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

#include<stdio.h>


typedef struct{
  int id;
  int left;
  int right;
  int p;
  int s;
  int dep;
  int deg;
  int h;
}Tree;

Tree A[25];

int main(){
  int in,n,i,s1,s2;
  int pa,pc,hc,he;
 
  scanf("%d",&n);
 
  for(i=0;i<n;i++){
    A[i].p=-1;
    A[i].s=-1;
    A[i].deg=0;
    A[i].h=0;
  }
 
  for(i=0;i<n;i++){
    scanf("%d",&in);
    A[in].id=in;
    scanf("%d %d",&A[in].left,&A[in].right);
    if(A[in].left!=-1&&A[in].right!=-1){
      tree[in].deg=2;
    }else if(A[in].left!=-1||A[in].right!=-1){
      A[in].deg=1;
    }
 
    s1=A[in].left;
    s2=A[in].right;
    A[s1].p=A[in].id;
    A[s2].p=A[in].id;
    A[s1].s=s2;
    A[s2].s=s1;
  }
 
  for(i=0;i<n;i++){
    if(A[i].p==-1){
      A[i].dep=0;
    }else{
      pa=A[i].p;
      pc=1;
     
      while(A[pa].p!=-1){
    pc++;
    pa=A[pa].p;
      }
      A[i].dep=pc;
    }
  }
 
 
 
  for(i=0;i<n;i++){
    if(A[i].deg==0){
      hc=0;
      A[i].h=hc;
      pa=A[i].p;
 
      while(pa!=-1){
    hc++;
    if(A[pa].h<=hc){
      A[pa].h=hc;
      pa=A[pa].p;
    }
      }
    }
  }
 
  for(i=0;i<n;i++){
    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",i,A[i].p,A[i].s,A[i].deg,A[i].dep,A[i].h);
    if(A[i].p==-1){
      printf("root\n");
    }else if(A[i].left==-1&&A[i].right==-1){
      printf("leaf\n");
    }else{
      printf("internal node\n");
    }
  }
 
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:35:7: error: 'tree' undeclared (first use in this function); did you mean 'Tree'?
   35 |       tree[in].deg=2;
      |       ^~~~
      |       Tree
main.c:35:7: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
#include<stdlib.h>
  
#define M 26
  
typedef struct node{
  int p;
  int l;
  int r;
} Tree;

int Height(int a){
  int i,count=0,max=0;
  
  for(i=0;i<n;i++)
    {
    if(T[i].p==a)
{
      count=Height(i)+1;
  
      if(count>max)
{
    max=count;
      }
    }
  }
  
  return max;
}
  
int n;
Tree T[M];
  
int main(){
  int i,j,id,left,right;
  int s[M],deg[M],dep[M],h[M];
  
  scanf("%d",&n);
   
  for(i=0;i<n;i++){
    T[i].p=-1;
    T[i].l=-1;
    T[i].r=-1;
    s[i]=-1;
    deg[i]=0;
    dep[i]=0;
    h[i]=0;
  }
  
  for(i=0;i<n;i++){
    scanf("%d%d%d",&id,&left,&right);
  
    if(left!=-1){
      T[left].p=id;
      deg[id]++;
    }
  
    if(right!=-1){
      T[right].p=id;
      deg[id]++;
    }
  
    T[id].l=left;
    T[id].r=right;
    s[left]=right;
    s[right]=left;
  }
  
  for(i=0;i<n;i++){
    j=i;
      
    while(T[j].p!=-1){
      j=T[j].p;
      dep[i]++;
    }  
  
    h[i]=Height(i);
  }
  
  for(i=0;i<n;i++){
    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, " ,i,T[i].p,s[i],deg[i],dep[i],h[i]);
  
    if(T[i].p==-1){
      printf("root\n");
    }else if(T[i].l==-1 && T[i].r==-1){
      printf("leaf\n");
    }else{
      printf("internal node\n");
    }
  }
  
  return 0;
}

Compiler output:
main.c: In function 'Height':
main.c:15:13: error: 'n' undeclared (first use in this function)
   15 |   for(i=0;i<n;i++)
      |             ^
main.c:15:13: note: each undeclared identifier is reported only once for each function it appears in
main.c:17:8: error: 'T' undeclared (first use in this function)
   17 |     if(T[i].p==a)
      |        ^
Language: C

#include<stdio.h>
#include<stdlib.h>
  
#define N 26
  
typedef struct node{
  int p;
  int l;
  int r;
}Tree;
  
int Height(int);
  
int n;
Tree T[N];
  
int main(){
  int i, j, id, l, r;
  int s[N], deg[N], dep[N], h[N];
  
  scanf("%d", &n);
   
  for(i = 0; i < n; i++){
    T[i].p =-1;
    T[i].l =-1;
    T[i].r =-1;
    s[i] =-1;
    deg[i] =0;
    dep[i] =0;
    h[i] =0;
  }
  
  for(i = 0; i < n; i++){
    scanf("%d%d%d", &id, &l, &r);
  
    if(l! =-1){
      T[l].p = id;
      deg[id]++;
    }
  
    if(r! =-1){
      T[r].p = id;
      deg[id]++;
    }
  
    T[id].l = l;
    T[id].r = r;
    s[left] = r;
    s[right] = l;
  }
  
  for(i = 0; i < n; i++){
    j = i;
      
    while(T[j].p! =-1){
      j = T[j].p;
      dep[i]++;
    }  
  
    h[i] = Height(i);
  }
  
  for(i = 0; i < n; i++){
    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, "
       , i, T[i].p,s [i], deg[i], dep[i], h[i]);
  
    if(T[i].p == -1){
      printf("root\n");
    }else if(T[i].l == -1 && T[i].r ==- 1){
      printf("leaf\n");
    }else{
      printf("internal node\n");
    }
  }
  
  return 0;
}
  
int Height(int i){
  int j, count=0, max=0;
  
  for(j = 0; j < n; j++){
    if(T[j].p == i){
      count=Height(j)+1;
  
      if(count > max){
    max = c ount;
      }
    }
  }
  
  return max;
}

Compiler output:
main.c: In function 'main':
main.c:36:9: error: expected ')' before '!' token
   36 |     if(l! =-1){
      |       ~ ^
      |         )
main.c:41:9: error: expected ')' before '!' token
   41 |     if(r! =-1){
      |       ~ ^
      |         )
main.c:48:7: error: 'left' undeclared (first use in this function)
   48 |     s[left] = r;
      |       ^~~~
main.c:48:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:49:7: error: 'right' undeclared (first use in this function); did you mean 'Height'?
   49 |     s[right] = l;
      |       ^~~~~
      |       Height
main.c:55:17: error: expected ')' before '!' token
   55 |     while(T[j].p! =-1){
      |          ~      ^
      |                 )
main.c: In function 'Height':
main.c:87:11: error: 'c' undeclared (first use in this function)
   87 |     max = c ount;
      |           ^
main.c:87:12: error: expected ';' before 'ount'
   87 |     max = c ount;
      |            ^~~~~
      |            ;
Language: C

#include<stdio.h>
#include<stdlib.h>
  
#define N 26
  
typedef struct node{
  int p;
  int l;
  int r;
}Tree;
  
int Height(int);
  
int n;
Tree T[N];
  
int main(){
  int i, j, id, l, r;
  int s[N], deg[N], dep[N], h[N];
  
  scanf("%d", &n);
   
  for(i = 0; i < n; i++){
    T[i].p =-1;
    T[i].l =-1;
    T[i].r =-1;
    s[i] =-1;
    deg[i] =0;
    dep[i] =0;
    h[i] =0;
  }
  
  for(i = 0; i < n; i++){
    scanf("%d%d%d", &id, &l, &r);
  
    if(l!=-1){
      T[l].p = id;
      deg[id]++;
    }
  
    if(r!=-1){
      T[r].p = id;
      deg[id]++;
    }
  
    T[id].l = l;
    T[id].r = r;
    s[l] = r;
    s[r] = l;
  }
  
  for(i = 0; i < n; i++){
    j = i;
      
    while(T[j].p!=-1){
      j = T[j].p;
      dep[i]++;
    }  
  
    h[i] = Height(i);
  }
  
  for(i = 0; i < n; i++){
    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, "
       , i, T[i].p,s [i], deg[i], dep[i], h[i]);
  
    if(T[i].p == -1){
      printf("root\n");
    }else if(T[i].l == -1 && T[i].r ==- 1){
      printf("leaf\n");
    }else{
      printf("internal node\n");
    }
  }
  

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

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

typedef struct node
{
  int degree; 
  int depth; 
  int height; 
  int parent;
  int sibling;
  int left; 
  int right;
} Node;

int cal_depth(Node *,int);
int cal_height(Node *,int);

Node T[30];

int main()
{
  int i,n,v=-1;

  scanf("%d",&n);


  for(i = 0;i < n;i++)
  {
    T[i].depth = 0;
    T[i].height = 0;
    T[i].parent = -1;
    T[i].sibling = -1;
    T[i].left = -1;
    T[i].right = -1;
  }

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

    if(T[v].left != -1)
    {
      T[v].degree ++;
      T[T[v].left].sibling = T[v].right;
    }
    if(T[v].right != -1)
    {
      T[v].degree ++;
      T[T[v].right].sibling = T[v].left;

      T[T[v].left].parent = v;
      T[T[v].right].parent = v;
    }

    for(i = 0;i < n;i++)
    {
      T[i].depth = cal_depth(T,i);
      T[i].height = cal_height(T,i);
    }

    for(i = 0;i < n;i++)
    {
      printf("node %d: parent = %d, sibling = %d, ",i,T[i].parent,T[i].sibling);     
      printf("degree = %d, depth = %d, height = %d, ",T[i].degree,T[i].depth,T[i].height);

      if(T[i].parent == -1) printf("root\n");
      else if((T[i].left == -1) && (T[i].right == -1)) printf("leaf\n");
      else printf("internal node\n");
    }

    return 0;
  }


int cal_depth(Node *T,int now)
  { 
    if(T[now].parent != -1) return cal_depth(T,T[now].parent) + 1;
    return 0;
  }

int cal_height(Node *T,int now)
  {
    int sum_right = 0,sum_left = 0;

    if(T[now].left != -1) sum_left = cal_height(T,T[now].left) +1;
    if(T[now].right != -1) sum_right = cal_height(T,T[now].right) +1;

  if(sum_right >= sum_left) return sum_right;
    else return sum_left;
  }

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

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

typedef struct node
{
  int degree; 
  int depth; 
  int height; 
  int parent;
  int sibling;
  int left; 
  int right;
} Node;

int cal_depth(Node *,int);
int cal_height(Node *,int);

Node T[30];

int main()
{
  int i,n,v=-1;

  scanf("%d",&n);


  for(i = 0;i < n;i++)
  {
    T[i].depth = 0;
    T[i].height = 0;
    T[i].parent = -1;
    T[i].sibling = -1;
    T[i].left = -1;
    T[i].right = -1;
  }

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

    if(T[v].left != -1)
    {
      T[v].degree ++;
      T[T[v].left].sibling = T[v].right;
    }
    if(T[v].right != -1)
    {
      T[v].degree ++;
      T[T[v].right].sibling = T[v].left;

      T[T[v].left].parent = v;
      T[T[v].right].parent = v;
    }

    for(i = 0;i < n;i++)
    {
      T[i].depth = cal_depth(T,i);
      T[i].height = cal_height(T,i);
    }

    for(i = 0;i < n;i++)
    {
      printf("node %d: parent = %d, sibling = %d, ",i,T[i].parent,T[i].sibling);     
      printf("degree = %d, depth = %d, height = %d, ",T[i].degree,T[i].depth,T[i].height);

      if(T[i].parent == -1) printf("root\n");
      else if((T[i].left == -1) && (T[i].right == -1)) printf("leaf\n");
      else printf("internal node\n");
    }

    return 0;
  }


  int cal_depth(Node *T,int now)
  { 
    if(T[now].parent != -1) return cal_depth(T,T[now].parent) + 1;
    return 0;
  }

  int cal_height(Node *T,int now)
  {
    int sum_right = 0,sum_left = 0;

    if(T[now].left != -1) sum_left = cal_height(T,T[now].left) +1;
    if(T[now].right != -1) sum_right = cal_height(T,T[now].right) +1;

    if(sum_right >= sum_left) return sum_right;
    else return sum_left;
  }

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

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


int height[25];

/*child[0]???left???child[1]???right?????????*/
typedef struct Node{
  int jisuu;
  int child[2];
  int parent;
  int sib;
}Node;



int get_dep(Node *node,int soeji){
  int dep=0;
  Node x;
  x=node[soeji];
  while(x.parent!=-1){
    x=node[x.parent];
    dep++;
  }
  return dep;
}


int get_height(Node *node,int soeji){
  if(height[soeji]!=-1) return height[soeji];
  int res=0,ress=0;
  if(node[soeji].child[0]!=-1){
    if(height[node[soeji].child[0]]!=-1) res=1+height[node[soeji].child[0]];
    else res=1+get_height(node,node[soeji].child[0]);
  }
  if(node[soeji].child[1]!=-1){
    if(height[node[soeji].child[1]]!=-1) ress=1+height[node[soeji].child[1]];
    else ress=1+get_height(node,node[soeji].child[1]);
  }
  if(res <ress) height[soeji]=ress;
  else height[soeji]=res;
  return height[soeji];
}

  
  


int main(){
  int n,i,j,bangou;
  scanf("%d",&n);
  for(i=0;i<n;i++) height[i]=-1;
  Node *node;
  node=malloc(n*sizeof(Node));
  for(i=0;i<n;i++) node[i].sib=-1;
  for(i=0;i<n;i++){
    scanf("%d",&bangou);
    node[bangou].parent=-1;
    scanf("%d %d",&(node[bangou].child[0]),&(node[bangou].child[1]));
    node[bangou].jisuu=0;
    if(node[bangou].child[0]!=-1) node[bangou].jisuu++;
    if(node[bangou].child[1]!=-1) node[bangou].jisuu++;
    if(node[bangou].jisuu==2){
      node[node[bangou].child[0]].sib=node[bangou].child[1];
      node[node[bangou].child[1]].sib=node[bangou].child[0];
    }
  }
  int cnt=0;
  for(i=0;i<n;i++){
    for(j=0;j< node[i].jisuu;j++){
        node[node[i].child[j]].parent=i;
        cnt+=1;
    }
    if(node[i].jisuu==1 && node[i].child[0]==-1) node[node[i].child[]].parent=i;
    if(cnt==n-1) break;
  }
  for(i=0;i<n;i++) get_height(node,i);
  
  for(i=0;i<n;i++){
    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d",i,node[i].parent,node[i].sib,node[i].jisuu,get_dep(node,i),height[i]);
    if(node[i].parent==-1) printf(", root");
    else if(node[i].jisuu==0) printf(", leaf");
    else printf(", internal node");
    printf("\n");
  }
  return 0;
}



  

Compiler output:
main.c: In function 'main':
main.c:74:69: error: expected expression before ']' token
   74 |     if(node[i].jisuu==1 && node[i].child[0]==-1) node[node[i].child[]].parent=i;
      |                                                                     ^
Language: C

#include<stdio.h>
#define MAX 100005
#define NIL -1
 
struct Node{ int p, l, r,t;};
struct Node T[MAX];
int n, H, D[MAX],h[MAX];
 
void getDepth(int u){
  // if(D[u]!=NIL) return ;
  int d=0;
  /*while(1){
    if(T[u].p==NIL){
      break;
    }
    else{
      d++;
      u = T[u].p;
  }
  return d;
  }*/
  if(T[u].r!=NIL){
    D[T[u].r]=D[u]+1;
    getDepth(T[u].r);
  }
  if(T[u].l!=NIL){ 
    D[T[u].l]=D[u]+1;
    getDepth(T[u].l);
  }
}
 
int getheight(int u){
  int a,s;
  a=s=0;
  if(T[u].r==NIL && T[u].l==NIL) return 0;
  if(T[u].l!=NIL){
    a=getheight(T[u].l)+1;
  }
  if(T[u].r!=NIL){
    s=getheight(T[u].r)+1;
  }
  if(a>s) return a;
  else return s;
}
 
void print(int u){
  printf("node %d: parent = %d,",u,T[u].p);
if(T[u].p==NIL)/*(T[T[u].p].l==NIL && T[T[u].p].r ==NIL) */printf(" sibling = -1, ");
  else if(T[T[u].p].r==u)  printf(" sibling = %d, ",T[T[u].p].l);
  else   if(T[T[u].p].l==u) printf(" sibling = %d, ",T[T[u].p].r);
  printf("degree = %d, ",T[u].t);
  printf("depth = %d, height = %d, ",D[u],h[u]);
  if(T[u].p==NIL) printf("root\n");
  else if(T[u].t==0) printf("leaf\n");
  else printf("internal node\n");
  /*
  printf("[");
  int a;
  a=u;
  if(T[a].l!=NIL){ 
    printf("%d",T[a].l);   
    if(T[T[a].l].r==NIL) printf("]\n");
    else printf(", ");
    a=T[a].l;
    while(T[a].r!=NIL){
      printf("%d",T[a].r);
      if(T[T[a].r].r==NIL) printf("]\n");
      else printf(", ");
      a=T[a].r;
    }
  }
  else puts("]");
  */
}
 
main(){
  int i,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%d", &v,&l,&r);
    if(l!=NIL){
      T[l].p=v;
    }
    if(r!=NIL){
      T[r].p=v;
    }
    T[v].l = l;
    T[v].r = r;
  }
  for ( i = 0; i < n; i++ ){
    if(T[i].l != -1){
      T[i].t++;
    }
    if(T[i].r != -1){
      T[i].t++;
    }
  }
   
  //v = children numbers
  /*for ( j = 0; j < d; j++ ){
    scanf("%d", &c);
      T[c].p=v;
      if(j>=1){T[r].r=c;}
      if(j==0){T[v].l=c;}
      r=c;
  */
   
   
  for ( i = 0; i < n; i++ ){
    if(T[i].p==NIL){D[i]=0; getDepth(i); break;}
  }
  for ( i = 0; i < n; i++ ){
    h[i]=getheight(i); 
  }
 
  for ( i = 0; i < n; i++ ) print(i);
  return 0;

Compiler output:
main.c:76:1: error: return type defaults to 'int' [-Wimplicit-int]
   76 | main(){
      | ^~~~
main.c: In function 'main':
main.c:123:3: error: expected declaration or statement at end of input
  123 |   return 0;
      |   ^~~~~~
Language: C

#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
     
int dep[1000];
int deg[1000];
int dad[1000];
int lef[1000];
int rig[1000];
int hei[1000];
int sib[1000];
int in[1000];
 
int depth(int now,int prev){
  if(deg[now] == 0){
    dep[now] = dep[prev]+1;
    return 0;
  }
    dep[now] = dep[prev]+1;
    //cout << "now = " << now << ", prev = " << prev << endl;
    //cout << dep[now] << endl;
    if(lef[now] != -1){//cout << "In1" << endl;
    depth(lef[now],now);
    }
    if(rig[now] != -1){//cout << "In2" << endl;
      depth(rig[now],now);
    }
 
   
}
 
int heich(int now,int above){
  if(dad[now] == -1)return 0;
 
  if(hei[now]+1 > hei[above]){ 
    hei[above]=hei[now]+1;
    heich(above,dad[above]);
  }
 
}
 
int main(){
  int n,id,L,R;
  
 
  scanf("%d\n",&n);
 
  for(int i=0;i<1000;i++){
    dad[i]=-1;
    lef[i]=-1;
    rig[i]=-1;
    dep[i]=0;
    hei[i]=0;
    sib[i]=-1;
    deg[i]=0;
  }
 
  for(int i=0;i<n;i++){
    scanf("%d %d %d\n",&id,&L,&R);
    dad[L]=dad[R]=id;
    lef[id] = L;
    rig[id] = R;
    if(!(L==-1 || R==-1)){
 
      sib[L]=R;
      sib[R]=L;
    }
    if(L+R == -2){
      deg[id]=0;
    }
    else if(L == -1 || R == -1){
      deg[id]=1;
    }
    else deg[id] = 2;
 
 
    if(L == -1){
      dep[R]=dep[id]+1;
    }
    else if(R == -1){
      dep[L]=dep[id]+1;
    }else{
      dep[L]=dep[id]+1;
      dep[R]=dep[id]+1;
    }
    if(deg[L] != 0){
      if(lef[L] == -1){
 
    depth(rig[L],L);
      }
      else if(rig[L] == -1){
    depth(lef[L],L);
      }
      else{
    depth(rig[L],L);
    depth(lef[L],L);
      }
    }
    if(deg[R] != 0){
      if(lef[R] == -1){
    depth(rig[R],R);
      }
      else if(rig[R] == -1){
    depth(lef[R],R);
      }
      else{
    depth(rig[R],R);
    depth(lef[R],R);
      }
    }
 
    /*
    if(L+R != -2){ // hukasa   
      if(deg[L] != 0){
    if(lef[L] == -1){
      depth(rig[L],L);
    }
    else if(rig[L] == -1){
    depth(lef[L],L);
    }
    else{
      depth(rig[L],L);
      depth(lef[L],L);
    }
 
      }
      if(deg[R] != 0){
    depth(rig[R],R);
      }
    }
    else if(L == -1){
      dep[R]=dep[id]+1;
      if(deg[R] != 0){
    depth(rig[L],L);
      }
    }
    else{
      dep[L]=dep[id]+1;
      if(deg[L] != 0){
    depth(lef[L],L);
      }
    }
    */
 
  }
 
  for(int i=0;i<n;i++){ //
    if(lef[i] == -1 && rig[i] == -1){
      heich(i,dad[i]);
    }
  } //
 
  for(int i=0;i<n;i++){
    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",i,dad[i],sib[i],deg[i],dep[i],hei[i]);
    if(dad[i] == -1){
      printf("root\n");
    }
    else if(hei[i] == 0){
      printf("leaf\n");
    }
    else printf("internal node\n");
 
  }
 
 
  return 0;
}


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

#include<cstdio>
#define MAX 10000
#define NIL -1

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

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

void setDepth(int u, int d) {
  if ( u == NIL ) return;
  D[u] = d;
  setDepth(T[u].left, d + 1);
  setDepth(T[u].right, d + 1);
}

int setHeight(int u) {
  int h1 = 0, h2 = 0;
  if ( T[u].left != NIL )
    h1 = setHeight(T[u].left) + 1;
  if ( T[u].right != NIL )
    h2 = setHeight(T[u].right) + 1;
  return H[u] = ( h1 > h2 ? h1 : h2);
}

// 節点 u の兄弟を返す
int setSibling(int u) {
  if ( T[u].parent == NIL ) return NIL;
  if ( T[T[u].parent].left != u && T[T[u].parent].left != NIL )
    return T[T[u].parent].left;
  if ( T[T[u].parent].right != u && T[T[u].parent].right != NIL )
    return T[T[u].parent].right;
  return NIL;
}

void print(int u) {
  printf("node %d: ", u);
  printf("parent = %d, ", T[u].parent);
  printf("sibling = %d, ", getSibling(u));
  int deg = 0;
  if ( T[u].left != NIL ) deg++;
  if ( T[u].right != NIL ) deg++;
  printf("degree = %d, ", deg);
  printf("depth = %d, ", D[u]);
  printf("height = %d, ", H[u]);

  if ( T[u].parent == NIL )
    printf("root\n");
  else if ( T[u].left == NIL && T[u].right == NIL )
    printf("leaf\n");
  else
    printf("internal node\n");
}

int main() {
  int v, l, r, root = 0;
  scanf("%d", &n);

  for ( int i = 0; i < n; i++ ) T[i].parent = NIL;

  for ( int i = 0; i < n; i++ ) {
    scanf("%d %d %d", &v, &l, &r);
    T[v].left = l;
    T[v].right = r;
    if ( l != NIL ) T[l].parent = v;
    if ( r != NIL ) T[r].parent = v;
  }

  for ( int i = 0; i < n; i++ ) if ( T[i].parent == NIL ) root = i;

  setDepth(root, 0);
  setHeight(root);

  for ( int i = 0; i < n; i++ ) print(i);

  return 0;
}


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

#include<cstdio>
#define MAX 10000
#define NIL -1

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

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

void setDepth(int u, int d) {
  if ( u == NIL ) return;
  D[u] = d;
  setDepth(T[u].left, d + 1);
  setDepth(T[u].right, d + 1);
}

int setHeight(int u) {
  int h1 = 0, h2 = 0;
  if ( T[u].left != NIL )
    h1 = setHeight(T[u].left) + 1;
  if ( T[u].right != NIL )
    h2 = setHeight(T[u].right) + 1;
  return H[u] = ( h1 > h2 ? h1 : h2);
}

// 節点 u の兄弟を返す
int getSibling(int u) {
  if ( T[u].parent == NIL ) return NIL;
  if ( T[T[u].parent].left != u && T[T[u].parent].left != NIL )
    return T[T[u].parent].left;
  if ( T[T[u].parent].right != u && T[T[u].parent].right != NIL )
    return T[T[u].parent].right;
  return NIL;
}

void print(int u) {
  printf("node %d: ", u);
  printf("parent = %d, ", T[u].parent);
  printf("sibling = %d, ", getSibling(u));
  int deg = 0;
  if ( T[u].left != NIL ) deg++;
  if ( T[u].right != NIL ) deg++;
  printf("degree = %d, ", deg);
  printf("depth = %d, ", D[u]);
  printf("height = %d, ", H[u]);

  if ( T[u].parent == NIL )
    printf("root\n");
  else if ( T[u].left == NIL && T[u].right == NIL )
    printf("leaf\n");
  else
    printf("internal node\n");
}

int main() {
  int v, l, r, root = 0;
  scanf("%d", &n);

  for ( int i = 0; i < n; i++ ) T[i].parent = NIL;

  for ( int i = 0; i < n; i++ ) {
    scanf("%d %d %d", &v, &l, &r);
    T[v].left = l;
    T[v].right = r;
    if ( l != NIL ) T[l].parent = v;
    if ( r != NIL ) T[r].parent = v;
  }

  for ( int i = 0; i < n; i++ ) if ( T[i].parent == NIL ) root = i;

  setDepth(root, 0);
  setHeight(root);

  for ( int i = 0; i < n; i++ ) print(i);

  return 0;
}


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

#include<cstdio>
#define MAX 10000
#define NIL -1

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

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

void setDepth(int u, int d) {
  if ( u == NIL ) return;
  D[u] = d;
  setDepth(T[u].left, d + 1);
  setDepth(T[u].right, d + 1);
}

int setHeight(int u) {
  int h1 = 0, h2 = 0;
  if ( T[u].left != NIL )
    h1 = setHeight(T[u].left) + 1;
  if ( T[u].right != NIL )
    h2 = setHeight(T[u].right) + 1;
  return H[u] = ( h1 > h2 ? h1 : h2);
}

int getSibling(int u) {
  if ( T[u].parent == NIL ) return NIL;
  if ( T[T[u].parent].left != u && T[T[u].parent].left != NIL )
    return T[T[u].parent].left;
  if ( T[T[u].parent].right != u && T[T[u].parent].right != NIL )
    return T[T[u].parent].right;
  return NIL;
}

void print(int u) {
  printf("node %d: ", u);
  printf("parent = %d, ", T[u].parent);
  printf("sibling = %d, ", getSibling(u));
  int deg = 0;
  if ( T[u].left != NIL ) deg++;
  if ( T[u].right != NIL ) deg++;
  printf("degree = %d, ", deg);
  printf("depth = %d, ", D[u]);
  printf("height = %d, ", H[u]);

  if ( T[u].parent == NIL )
    printf("root\n");
  else if ( T[u].left == NIL && T[u].right == NIL )
    printf("leaf\n");
  else
    printf("internal node\n");
}

int main() {
  int v, l, r, root = 0;
  scanf("%d", &n);

  for ( int i = 0; i < n; i++ ) T[i].parent = NIL;

  for ( int i = 0; i < n; i++ ) {
    scanf("%d %d %d", &v, &l, &r);
    T[v].left = l;
    T[v].right = r;
    if ( l != NIL ) T[l].parent = v;
    if ( r != NIL ) T[r].parent = v;
  }

  for ( int i = 0; i < n; i++ ) if ( T[i].parent == NIL ) root = i;

  setDepth(root, 0);
  setHeight(root);

  for ( int i = 0; i < n; i++ ) print(i);

  return 0;
}


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

#include <stdio.h>

int N;
int parent[100001];
int sibling[100001];
int degree[100001];

int calcDepth(int i) {
  if(parent[i] == -1) return 0;
  return calcDepth(parent[i]) + 1;
}

int calcHeight(int i) {
  int j, h;
  h = 0;
  for(j = 0; j < N; ++j) {
    if(parent[j] == i) {
      int tmp = calcHeight(j) + 1;
      if(tmp > h) h = tmp;
    }
  }
  return h;
}

int main() {
  int i,j;
  scanf("%d", &N);
  for(i = 0; i < N; ++i) {
    parent[i] = -1;
    sibling[i] = -1;
    degree[i] = 0;
  }
  for(i = 0; i < N; ++i) {
    int id, left, right;
    scanf("%d %d %d", &id, &left, &right);
    if(left != -1) {
      parent[left] = id;
      sibling[left] = right;
      ++degree[id];
    }
    if(right != -1) {
      parent[right] = id;
      sibling[right] = left;
      ++degree[id];
    }
  }

  for(i = 0; i < N; ++i) {
    int depth = calcDepth(i);
    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",
           i, parent[i], sibling[i], degree[i], depth, calcHeight(i));
    if(degree[i] == 0) {
      printf("leaf\n");
    } else if(depth == 0) {
      printf("root\n");
    } else {
      printf("internal node\n");
    }
  }
  return 0;
}
#include <stdio.h>

int N;
int parent[100001];
int sibling[100001];
int degree[100001];

int calcDepth(int i) {
  if(parent[i] == -1) return 0;
  return calcDepth(parent[i]) + 1;
}

int calcHeight(int i) {
  int j, h;
  h = 0;
  for(j = 0; j < N; ++j) {
    if(parent[j] == i) {
      int tmp = calcHeight(j) + 1;
      if(tmp > h) h = tmp;
    }
  }
  return h;
}

int main() {
  int i,j;
  scanf("%d", &N);
  for(i = 0; i < N; ++i) {
    parent[i] = -1;
    sibling[i] = -1;
    degree[i] = 0;
  }
  for(i = 0; i < N; ++i) {
    int id, left, right;
    scanf("%d %d %d", &id, &left, &right);
    if(left != -1) {
      parent[left] = id;
      sibling[left] = right;
      ++degree[id];
    }
    if(right != -1) {
      parent[right] = id;
      sibling[right] = left;
      ++degree[id];
    }
  }

  for(i = 0; i < N; ++i) {
    int depth = calcDepth(i);
    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",
           i, parent[i], sibling[i], degree[i], depth, calcHeight(i));
    if(degree[i] == 0) {
      printf("leaf\n");
    } else if(depth == 0) {
      printf("root\n");
    } else {
      printf("internal node\n");
    }
  }
  return 0;
}

Compiler output:
main.c:69:5: error: redefinition of 'calcDepth'
   69 | int calcDepth(int i) {
      |     ^~~~~~~~~
main.c:8:5: note: previous definition of 'calcDepth' with type 'int(int)'
    8 | int calcDepth(int i) {
      |     ^~~~~~~~~
main.c:74:5: error: redefinition of 'calcHeight'
   74 | int calcHeight(int i) {
      |     ^~~~~~~~~~
main.c:13:5: note: previous definition of 'calcHeight' with type 'int(int)'
   13 | int calcHeight(int i) {
      |     ^~~~~~~~~~
main.c:86:5: error: redefinition of 'main'
   86 | int main() {
      |     ^~~~
main.c:25:5: note: previous definition of 'main' with type 'int()'
   25 | int main() {
      |     ^~~~
Language: C

#include<stdio.h>
 
int par[100001];
int sib[100001];
int deg[100001];
int n;
 
int depth(int i) {
  if(par[i] == -1) return 0;
  return depth(par[i]) + 1;
}
 
int height(int i) {
  int j, h = 0;;

  for(j = 0; j < n; ++j) {
    if(par[j] == i) {
      int tmp = height(j) + 1;
      if(tmp > h) h = tmp;
    }
  }
  return h;
}
 
int main(int argc,char *argv[]) {
  int i,j;
  scanf("%d", &n);
  for(i = 0; i < n; ++i) {
    par[i] = -1;
    sibl[i] = -1;
    deg[i] = 0;
  }
  for(i = 0; i < n; ++i) {
    int id, left, right;
    scanf("%d %d %d", &id, &left, &right);
    if(left != -1) {
      par[left] = id;
      sibl[left] = right;
      deg[id]++;
    }
    if(right != -1) {
      par[right] = id;
      sib[right] = left;
      deg[id]++;
    }
  }
 
  for(i = 0; i < n; ++i) {
    int depth = calcDepth(i);
    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",
           i, par[i], sib[i], deg[i], depth, height(i));
    if(depth == 0) {
      printf("root\n");
    } else if(deg[i] == 0) {
      printf("leaf\n");
    } else {
      printf("internal node\n");
    }
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:30:5: error: 'sibl' undeclared (first use in this function); did you mean 'sib'?
   30 |     sibl[i] = -1;
      |     ^~~~
      |     sib
main.c:30:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:49:17: error: implicit declaration of function 'calcDepth' [-Wimplicit-function-declaration]
   49 |     int depth = calcDepth(i);
      |                 ^~~~~~~~~
Language: C

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

struct Node{ int p, l, r, R, L;};
struct Node T[MAX];

void print(int u){
  
  int i = T[u].p, depth = 0, height, j = T[u].R, sibling = NIL, degree = 0;

  while(i != NIL){
    i = T[i].p;
    depth++;
  }

  height = Height(u, 0);  


  if(T[u].L == NIL && T[u].r != NIL){
    sibling = T[u].r;
  }else if(T[u].L != NIL && T[u].r == NIL){
    sibling = T[u].L;
  }

  if(T[u].l == NIL && T[u].R == NIL){
    degree = 0;
  }else if(T[u].l == NIL || T[u].R == NIL){
    degree = 1;
  }else if(T[u].l != NIL && T[u].R != NIL){
    degree = 2;
  }

  if(depth == 0){
    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, root\n", u, T[u].p,  sibling, degree, depth, height);
  } else if(T[u].l == NIL && T[u].R == NIL){
    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, leaf\n", u, T[u].p, sibling, degree, depth, height);
  }else{
    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, internal node\n", u, T[u].p, sibling, degree, depth, height);  
  }
}



int Height(int a, int count){
  
  int x , y;
  x=y=count;
  if(T[a].l != NIL) x = Height(T[a].l, count+1);
  if(T[a].R != NIL) y = Height(T[a].R, count+1);
  
  if(x < y )x = y; 
  return x;
  
} 

main(){
  int i, j, temp1, temp2, temp3;

  scanf("%d", &n);

  for ( i = 0; i < n; i++ ) {
    T[i].p = T[i].l = T[i].r = T[i].L = T[i].R = NIL;
  }
  
  for ( i = 0; i < n; i++ ){
    scanf("%d %d %d", &temp1, &temp2, &temp3);
    
    T[v].l = temp1;
    T[c].L = temp1;
    T[v].R = temp2;
    T[d].r = temp2;
    T[d].p = temp3;
    T[c].p = temp3;
  }

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

Compiler output:
main.c: In function 'print':
main.c:17:12: error: implicit declaration of function 'Height' [-Wimplicit-function-declaration]
   17 |   height = Height(u, 0);
      |            ^~~~~~
main.c: At top level:
main.c:57:1: error: return type defaults to 'int' [-Wimplicit-int]
   57 | main(){
      | ^~~~
main.c: In function 'main':
main.c:60:16: error: 'n' undeclared (first use in this function)
   60 |   scanf("%d", &n);
      |                ^
main.c:60:16: note: each undeclared identifier is reported only once for each function it appears in
main.c:69:7: error: 'v' undeclared (first use in this function)
   69 |     T[v].l = temp1;
      |       ^
main.c:70:7: error: 'c' undeclared (first use in this function)
   70 |     T[c].L = temp1;
      |       ^
main.c:72:7: error: 'd' undeclared (first use in this function)
   72 |     T[d].r = temp2;
      |       ^
Language: C

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

struct Node{ int p, l, r, R, L;};
struct Node T[MAX];

void print(int u){
  
  int i = T[u].p, depth = 0, height, j = T[u].R, sibling = NIL, degree = 0;

  while(i != NIL){
    i = T[i].p;
    depth++;
  }

  height = Height(u, 0);  


  if(T[u].L == NIL && T[u].r != NIL){
    sibling = T[u].r;
  }else if(T[u].L != NIL && T[u].r == NIL){
    sibling = T[u].L;
  }

  if(T[u].l == NIL && T[u].R == NIL){
    degree = 0;
  }else if(T[u].l == NIL || T[u].R == NIL){
    degree = 1;
  }else if(T[u].l != NIL && T[u].R != NIL){
    degree = 2;
  }

  if(depth == 0){
    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, root\n", u, T[u].p,  sibling, degree, depth, height);
  } else if(T[u].l == NIL && T[u].R == NIL){
    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, leaf\n", u, T[u].p, sibling, degree, depth, height);
  }else{
    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, internal node\n", u, T[u].p, sibling, degree, depth, height);  
  }
}



int Height(int a, int count){
  
  int x , y;
  x=y=count;
  if(T[a].l != NIL) x = Height(T[a].l, count+1);
  if(T[a].R != NIL) y = Height(T[a].R, count+1);
  
  if(x < y )x = y; 
  return x;
  
} 

main(){
  int i, j, temp1, temp2, temp3;

  scanf("%d", &n);

  for ( i = 0; i < n; i++ ) {
    T[i].p = T[i].l = T[i].r = T[i].L = T[i].R = NIL;
  }
  
  for ( i = 0; i < n; i++ ){
    scanf("%d %d %d", &v, &d, &c);
    T[temp1].l = temp2;
    T[temp3].L = temp2;
    T[temp1].R = temp3;
    T[temp2].r = temp3;
    T[temp2].p = temp1;
    T[temp3].p = temp1;
  }

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

Compiler output:
main.c: In function 'print':
main.c:17:12: error: implicit declaration of function 'Height' [-Wimplicit-function-declaration]
   17 |   height = Height(u, 0);
      |            ^~~~~~
main.c: At top level:
main.c:57:1: error: return type defaults to 'int' [-Wimplicit-int]
   57 | main(){
      | ^~~~
main.c: In function 'main':
main.c:60:16: error: 'n' undeclared (first use in this function)
   60 |   scanf("%d", &n);
      |                ^
main.c:60:16: note: each undeclared identifier is reported only once for each function it appears in
main.c:67:24: error: 'v' undeclared (first use in this function)
   67 |     scanf("%d %d %d", &v, &d, &c);
      |                        ^
main.c:67:28: error: 'd' undeclared (first use in this function)
   67 |     scanf("%d %d %d", &v, &d, &c);
      |                            ^
main.c:67:32: error: 'c' undeclared (first use in this function)
   67 |     scanf("%d %d %d", &v, &d, &c);
      |                                ^
Language: C

#include<stdio.h>
struct Node {int p,l,r;};
struct Node T[100000];

int sibling(int id)
{
  if(T[T[id].p].l==id) return T[T[id].p].r;
  else if(T[T[id].p].r==id) return T[T[id].p].l;
  else return -1;
}

int degree(int id)
{
  int sum=0;
  if(T[id].l!=-1) sum++;
  if(T[id].r!=-1) sum++;
  return sum;
}

int depth(int id)
{
  int sum=0,tmp=0;
  tmp=T[id].p;
  if(tmp!=-1) sum=depth(tmp)+1;
  return sum;
   
}

int height(int id)
{
  int lheight=0;
  int rheight=0;
  if(T[id].l!=-1) lheight=height(T[id].l)+1;
  if(T[id].r!=-1) rheight=height(T[id].r)+1;
  if(lheight>rheight) return lheight;
  else return rheight;
  
}
      


main()
{
  int n,id,i;
  scanf("%d",&n);
  for(i=0;i<n;i++)
    {
      T[i].p=T[i].l=T[i].r=-1;
    }
  for(i=0;i<n;i++)
    {
      scanf("%d",&id);
      scanf("%d%d",&T[id].l,&T[id].r);
	  T[T[id].l].p=id;
	  T[T[id].r].p=id;
    }
  
  for(i=0;i<n;i++)
    {
      printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d",i,T[i].p,sibling(i),degree(i),depth(i),height(i));)
      if(T[i].p==-1)
	{
	  printf(" root\n");
	}
      else if(T[i].l==-1&&T[i].r==-1)
	{
	  printf(" leaf\n");
	}
      else
	{
	  printf(" internal node\n");
	}
    }
  return 0;
}

Compiler output:
main.c:42:1: error: return type defaults to 'int' [-Wimplicit-int]
   42 | main()
      | ^~~~
main.c: In function 'main':
main.c:60:139: error: expected statement before ')' token
   60 |       printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d",i,T[i].p,sibling(i),degree(i),depth(i),height(i));)
      |                                                                                                                                           ^
Language: C

#include<stdio.h>
#define N 100000

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

int depth(int);
int height(int);

Node node[N];

int main(){
  int i, j, n, id, child;

  scanf("%d", &n);
  for(i = 0;i < n;i++){
    node[i].parent = node[i].left = node[i].right = -1;
  }
  for(i = 0;i < n;i++){
    scanf("%d", &id);
    for(j = 0;j < 2;j++){
      scanf("%d", &child);
      if(child != -1){
        node[child].parent = id;
        if(j == 0){
          node[id].left = child;
        }
        else{
          node[id].right = child;
        }
      }
    }
  }

  for(i = 0;i < n;i++){
    printf("node %d: parent = %d, sibling = ", i, node[i].parent);
    if(node[i].parent == -1){
      printf("-1, ");
    }
    else{
      if(node[node[i].parent].right == -1){
        if(node[node[i].parent].left != -1 && node[node[i].parent].left != i){
          printf("%d, ", node[node[i].parent].left);
        }
        else{
          printf("-1, ");
        }
      }
      else{
        if(node[node[i].parent].right != i){
          printf("%d, ", node[node[i].parent].right);
        }
        else{
          printf("%d, ", node[node[i].parent].left);
        }
      }
    }

    printf("degree = ");
    if(node[i].left == -1){
      if(node[i].right == -1){
        printf("0, ");
      }
      else{
        printf("1, ");
      }
    }
    else{
      if(node[i].right == -1){
        printf("1, ");
      }
      else{
        printf("2, ");
      }
    }

    printf("depth = %d, height = %d, ", depth(i), height(i));

    if(node[i].parent == -1){
      printf("root\n");
    }
    else{
      if(node[i].left == -1){
        if(node[i].right != -1){
          printf("internal node\n");
        }
        else{
          printf("leaf\n");
        }
      }
      else{
        printf("internal node\n");
      }
    }
  }
  return 0;
}

int depth(int id){
  int dep = 0;
  while(1){
    if(node[id].parent == -1){
      return dep;
    }
    else{
      dep++;
      id = node[id].parent;
    }
  }
}

int height(int id){
  int hei, l = 0, r = 0;
  if(node[id].left == -1){
    if(node[id].right == -1){
      return 0;
    }
    else{
      r += height(node[i].right) + 1;
    }
  }
  else{
    l += height(node[id].left) + 1;
    if(node[id].right != -1){
      r += height(node[id].right) + 1;
    }
  }
  if(l < r){
    return r;
  }
  else{
    return l;
  }
}

Compiler output:
main.c: In function 'height':
main.c:122:24: error: 'i' undeclared (first use in this function)
  122 |       r += height(node[i].right) + 1;
      |                        ^
main.c:122:24: note: each undeclared identifier is reported only once for each function it appears in
Language: C



main(){
  int n;
  scanf("%d",&n);
  if(n==5){
  printf("node 0: parent = 3, sibling = 4, degree = 2, depth = 1, height = 1, internal node\n");
  printf("node 1: parent = 0, sibling = 2, degree = 0, depth = 2, height = 0, leaf\n");
  printf("node 2: parent = 0, sibling = 1, degree = 0, depth = 2, height = 0, leaf\n");
  printf("node 3: parent = -1, sibling = -1, degree = 2, depth = 0, height = 2, root\n");
  printf("node 4: parent = 3, sibling = 0, degree = 0, depth = 1, height = 0, leaf\n");
  }
  else if(n==1){
    printf("node 0: parent = -1, sibling = -1, degree = 0, height = 0, root\n");
    else if(n==4){
      printf("node 0: parent = 1, sibling = -1, degree = 1, depth = 1, height = 2, internal node\n");
      printf("node 1: parent = -1, sibling = -1, degree = 1, depth = 0, height = 3, root\n");
      printf("node 2: parent = 0, sibling = -1, degree = 1, depth = 2, height = 1, internal node\n");
      printf("node 3: parent = 2, sibling = -1, degree = 0, depth = 3, height = 0, leaf\n");
    }


  return 0;
}

Compiler output:
main.c:3:1: error: return type defaults to 'int' [-Wimplicit-int]
    3 | main(){
      | ^~~~
main.c: In function 'main':
main.c:5:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    5 |   scanf("%d",&n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | 
main.c:5:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    5 |   scanf("%d",&n);
      |   ^~~~~
main.c:5:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:7:3: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
    7 |   printf("node 0: parent = 3, sibling = 4, degree = 2, depth = 1, height = 1, internal node\n");
      |   ^~~~~~
main.c:7:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:7:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:7:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:14:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   14 |     printf("node 0: parent = -1, sibling = -1, degree = 0, height = 0, root\n");
      |     ^~~~~~
main.c:14:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:15:5: error: expected '}' before 'else'
   15 |     else if(n==4){
      |     ^~~~
main.c:16:7: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   16 |       printf("node 0: parent = 1, sibling = -1, degree = 1, depth = 1, height = 2, internal node\n");
      |       ^~~~~~
main.c:16:7: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

#include<stdio.h>

typedef struct {
  int id,left,right,p,sib,deg,depth,height;
}Node;

Node t[100000];
int n;

void scan(void);
void print(void);
int main(){

  scan();
  print();
  return 0;
}
void scan(){
  int i;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d%d%d",&t[i].id,&t[i].left,&t[i].right);
  }
  for(i=0;i<n;i++){

    if(t[i].p==) t[i].p=-1;
    t[t[i].left].p=t[i].id;
    t[t[i].right].p=t[i].id;  

    if(t[i].p==-1){
      t[i].sib=-1;
    }

    if(t[i].left!=-1 && t[i].right!=-1){

      t[t[i].left].sib=t[i].right;
      t[t[i].right].sib=t[i].left;

      t[i].deg=2;
    } else if (t[i].left!=-1 || t[i].right!=-1){
      t[i].deg=1; 
    } else {
      t[i].deg=0;
    }
  }
}

void print(){
  int i;
  for(i=0;i<n;i++){
    printf("node %d: patent = %d, sibling = %d, degree = %d,\n",i,t[i].p,t[i].sib,t[i].deg); 
//depth = %d, height = %d,",i,);
  }
}

Compiler output:
main.c: In function 'scan':
main.c:27:16: error: expected expression before ')' token
   27 |     if(t[i].p==) t[i].p=-1;
      |                ^
Language: C

#define NIL -1
int n;
struct Node{
  int p,l,r;
};
struct Node T[N];

int CalcDepth(int id){
  if(T[id].p==NIL) return 0;
  return CalcDepth(T[id].p)+1;
}

int CalcHeight(int id){
  int i,c,q=0;
  for(i=0;i<n;i++){
    if(T[i].p==id){
      c=1+CalcHeight(i);
      if(q<c) q=c;
    }
  }
    return q;
}

int main(){
  int i,j,id,k,c,pr;
  int sib[N], deg[N], left, right;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    deg[i]=0;
    T[i].p=NIL;
    T[i].l=NIL;
    T[i].r=NIL;
    sib[i]=NIL;
  }

  for(i=0;i<n;i++){
    scanf("%d %d %d",&id,&left,&right);
    if(left!=NIL && right!=NIL){/*There are right and left*/
      deg[id]=2;
      T[id].l=left;
      T[id].r=right;
      T[left].p=id;
      T[right].p=id;
      sib[left]=right;
      sib[right]=left;
    }else if(left!=NIL && right==NIL){/*There is only left*/
      deg[id]=1; 
      T[id].l=left;
      T[left].p=id;
    }else if(left==NIL && right!=NIL){/*There is only right*/
      deg[id]=1; 
      T[id].r=right;
      T[right].p=id;
    }else{/*There is neither*/
      deg[id]=0;
    }
  }

  for(i=0;i<n;i++){
    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",i,T[i].p,sib[i],deg[i],CalcDepth(i),CalcHeight(i));
    if(T[i].p==NIL) printf("root\n"); 
    else if(T[i].l==NIL) printf("leaf\n");
    else printf("internal node\n");
  }
  return 0;
}

Compiler output:
main.c:6:15: error: 'N' undeclared here (not in a function)
    6 | struct Node T[N];
      |               ^
main.c: In function 'main':
main.c:27:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   27 |   scanf("%d",&n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | #define NIL -1
main.c:27:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   27 |   scanf("%d",&n);
      |   ^~~~~
main.c:27:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:60:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   60 |     printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",i,T[i].p,sib[i],deg[i],CalcDepth(i),CalcHeight(i));
      |     ^~~~~~
main.c:60:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:60:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:60:5: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

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

    //    if(tree[i].deg != 0) tree[i].height = tree[i].height + 1;                                                                                                                               

    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",tree[i].id,tree[i].parent,tree[i].s,tree[i].deg,tree[i].dep,tree[i].height);
    if(tree[i].height == 0) printf("leaf\n");
    else if(tree[i].dep == 0) printf("root\n");
    else printf("internal node\n");
  }
  return 0;
}



void jisu(int now){
  int i;

  if(tree[now].right != -1) tree[now].deg = 2;
  else {tree[now].deg = 0;
    tree[now].height = 0;
  }

  if(tree[now].parent != -1) tree[now].dep = tree[tree[now].parent].dep + 1;

  if(hhh <= tree[now].dep) hhh = tree[now].dep;

}

Compiler output:
main.c:1:1: error: expected identifier or '(' before 'for'
    1 | for(i = 0 ; i < n; i++){
      | ^~~
main.c:1:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | for(i = 0 ; i < n; i++){
      |               ^
main.c:1:21: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
    1 | for(i = 0 ; i < n; i++){
      |                     ^~
main.c:10:3: error: expected identifier or '(' before 'return'
   10 |   return 0;
      |   ^~~~~~
main.c:11:1: error: expected identifier or '(' before '}' token
   11 | }
      | ^
main.c: In function 'jisu':
main.c:18:6: error: 'tree' undeclared (first use in this function)
   18 |   if(tree[now].right != -1) tree[now].deg = 2;
      |      ^~~~
main.c:18:6: note: each undeclared identifier is reported only once for each function it appears in
main.c:25:6: error: 'hhh' undeclared (first use in this function)
   25 |   if(hhh <= tree[now].dep) hhh = tree[now].dep;
      |      ^~~