Language: C++

// -*- coding: utf-8 -*-
// Last-Updated : <2014/06/20 10:55:50 by samui>

#include <algorithm>
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <bitset>

#define MP(a, b) std::make_pair(a, b)
#define X first
#define Y second
#define rep(i,n) for(int (i) = 0; (i) < (int)(n); ++(i))
#define rer(i,l,n) for(int (i) = l; (i) <= (int)(n); ++(i))
#define reu(i,l,n) for(int (i) = l; (i) < (int)(n); ++(i))
template<typename T,typename U> inline void amin(T &x,U y){ if(y<x) x = y;}
template<typename T,typename U> inline void amax(T &x,U y){ if(x<y) x = y;}
template<typename TYPE,std::size_t SIZE>
std::size_t len(const TYPE (&array)[SIZE]){return SIZE;}

// データ構造
// 木
typedef struct node {
  int parent, lchild, rsibling;
  node(): parent(-1), lchild(-1), rsibling(-1) {}
} Node;
// Binary Tree
typedef struct bnode{
  int id = -1;
  int parent,cleft,cright;
  bnode(): parent(-1),cleft(-1),cright(-1) {};
} BNode;
template<typename T>
int depth(T G[],int id){
  if(G[id].parent!=-1)
    return depth(G,G[id].parent)+1;
  return 0;
}
template<typename T>
int height(T G[],int N,int id){
  int s = 0;
  int h = 0;
  rep(j,N){
    if(G[j].parent == id){
      int tmp = height(G,N,j)+1;
      if(tmp > h) h = tmp;
    }
  }

  return h;
}


// 幾何ライブ
typedef long double LD;
const LD INF = 1e100;
const LD EPS = 1e-8;
const LD PI = acos(-1);
typedef std::pair<LD,LD> PLD;
typedef std::vector<std::pair<LD,LD>> VPLD2;

class Point{
public:
  LD x,y;
  Point(LD x = 0,LD y = 0): x(x),y(y){ };
  Point operator + (Point p) {return Point(x+p.x,y+p.y);};
  Point operator - (Point p) {return Point(x-p.x,y-p.y);};
  Point operator * (LD a) {return Point(x*a,y*a);};
  Point operator / (LD a) {return Point(x/a,y/a);};
  LD abs(){return std::sqrt(x*x+y*y);};
  Point unit(){LD u = abs();return Point(x,y)/u; };
};
typedef Point Vector2D;
LD dotProduct(const Vector2D a,const Vector2D b){
  return a.x*b.x+a.y*b.y;
}
LD crossProduct(const Vector2D a, const Vector2D b){return a.x*b.y-a.y*b.x;}
LD angle(Vector2D a,Vector2D b){
  return acos(dotProduct(a,b)/(a.abs()*b.abs()));
}
LD norm(Vector2D a){return a.x*a.x+a.y*a.y;}
Point projection(Point a1,Point a2,Point a3){
  // 点a3にたいする線分a1-a2上への射影をもとめる。
  LD d = dotProduct(a3-a1,a2-a1)/norm(a2-a1);
  return (a1+(a2-a1)*d);
}
Point reflection(Point a1,Point a2,Point a3){
  return (a3+(projection(a1,a2,a3)-a3)*2);
}
int ccw(Point a1,Point a2,Point a3){
  Vector2D a = a2-a1;
  Vector2D b = a3-a1;
  if(crossProduct(a,b) > EPS) return 1; // a1,a2,a3が反時計まわり
  if(crossProduct(a,b) < -EPS) return -1;//a1,a2,a3が時計まわり
  if(dotProduct(a,b) < -EPS) return +2; //a3--a1--a2 で直線
  if(norm(a)< norm(b)) return -2; // a1--a2--a3 の順で直線
  return 0; // a1--a3--a2の順番
}


int main(int argc, char *argv[])
{
  int N;
  std::cin>>N;
  BNode G[N];
  int l,r;
  int i;
  rep(j,N){
    std::cin>>i>>l>>r;
    G[i].id = i;
    G[i].cleft = l;
    G[i].cright = r;
    if(l >= 0)
      G[l].parent = i;
    if(r>=0)
      G[r].parent = i;
  }
  rep(i,N){
    int j = i;
    int t = 0;
    while(G[j].parent != -1){
      j = G[j].parent;
      t++;
    }
    std::cout<<"node "<<i<<" parent = "<<G[i].parent<<", "<<std::flush;
    int m = -1;
    if(G[i].parent == -1){

    }else{
      
      if(G[G[i].parent].cleft!=-1) ++m;
      if(G[G[i].parent].cright!=-1) ++m;
    }
    std::cout<<"sibling = "<<m<<", "<<std::flush;
    std::cout<<"depth = "<<depth(G,i)<<" "<<std::flush;
    std::cout<<"height = "<<height(G,N,i)<<", "<<std::flush;
    m = height(G,N,i);
    if(depth(G,i) == 0)
      std::cout<<"root"<<std::endl;
    else if(m>=1){
      std::cout<<"internal node"<<std::endl;
    }else{
      std::cout<<"leaf"<<std::endl;
    }
     


  }
  return 0;
}

Compiler output:
a.cc:61:15: error: 'acos' was not declared in this scope
   61 | const LD PI = acos(-1);
      |               ^~~~
a.cc: In member function 'LD Point::abs()':
a.cc:73:24: error: 'sqrt' is not a member of 'std'; did you mean 'sort'?
   73 |   LD abs(){return std::sqrt(x*x+y*y);};
      |                        ^~~~
      |                        sort
a.cc: In function 'LD angle(Vector2D, Vector2D)':
a.cc:82:10: error: 'acos' was not declared in this scope
   82 |   return acos(dotProduct(a,b)/(a.abs()*b.abs()));
      |          ^~~~