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

#include <stdio.h>
int n, v, a[25][2], r; bool f[25];
void p1(int u) { if(~u) return; printf(" %d", u), p1(a[u][0]), p1(a[u][1]); }
void p2(int u) { if(~u) return; p2(a[u][0]), printf(" %d", u), p2(a[u][1]); }
void p3(int u) { if(~u) return; p3(a[u][0]), p3(a[u][1]), printf(" %d", u); }
int main() {
	cin >> n;
	for(int i = 0; i < n; i++) scanf("%d", &v), scanf("%d%d", a[v], a[v] + 1), f[a[v][0]] = f[a[v][1]] = true;
	for(int i = 0; i < n; i++) if(!f[i]) r = i;
	puts("Preorder"); p1(r); puts("");
	puts("Inorder"); p2(r); puts("");
	puts("Postorder"); p3(r); puts("");
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'cin' was not declared in this scope
    7 |         cin >> n;
      |         ^~~
Language: C++

#include <iostream>
#include <vector>
using namespace  std;

const int END = -1;
struct StNod
{
  int m_nKey;
  int m_nLeft;
  int m_nRigt;

  StNod() :
    m_nKey(END), m_nLeft(END), m_nRigt(END)
  { }
};

void fnInput(vector<StNod> &rvoNod)
{
  StNod oNod;
  int nMaxSiz;

  cin >> nMaxSiz;
  rvoNod.resize(nMaxSiz, oNod);

  for (int i = 0; i < nMaxSiz; i++)
  {
    int nKey, nLeft, nRigt;
    cin >> nKey >> nLeft >> nRigt;

    rvoNod[nKey].m_nKey  = nKey;
    rvoNod[nKey].m_nLeft = nLeft;
    rvoNod[nKey].m_nRigt = nRigt;
  }
}

void fnPreOrder(const vector<StNod> &cnrvoNod, int nx)
{
  if (nx == END)  return;

  cout << " " << nx;
  fnPreOrder(cnrvoNod, cnrvoNod[nx].m_nLeft);
  fnPreOrder(cnrvoNod, cnrvoNod[nx].m_nRigt);
}

void fnInOrder(const vector<StNod> &cnrvoNod, int nx)
{
  if (nx == END)  return;

  fnInOrder(cnrvoNod, cnrvoNod[nx].m_nLeft);
  cout << " " << nx;
  fnInOrder(cnrvoNod, cnrvoNod[nx].m_nRigt);
}

void fnPostOrder(const vector<StNod> &cnrvoNod, int nx)
{
  if (nx == END)  return;

  fnPostOrder(cnrvoNod, cnrvoNod[nx].m_nLeft);
  fnPostOrder(cnrvoNod, cnrvoNod[nx].m_nRigt);
  cout << " " << nx;
}

void fnTreeWalk(const vector<StNod> &cnrvoNod)
{
  int nx = 0;
  while (cnrvoNod[nx].m_nParnt != END)
    nx = cnrvoNod[nx].m_nParnt;

  cout << "Preorder" << endl;
  fnPreOrder(cnrvoNod, nx);
  cout << endl;

  cout << "Inorder" << endl;
  fnInOrder(cnrvoNod, nx);
  cout << endl;

  cout << "Postorder" << endl;
  fnPostOrder(cnrvoNod, nx);
  cout << endl;
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<StNod> voNod;

  fnInput(voNod);
  fnTreeWalk(voNod);
  return 0;
}

Compiler output:
a.cc: In function 'void fnTreeWalk(const std::vector<StNod>&)':
a.cc:66:23: error: 'const __gnu_cxx::__alloc_traits<std::allocator<StNod>, StNod>::value_type' {aka 'const struct StNod'} has no member named 'm_nParnt'
   66 |   while (cnrvoNod[nx].m_nParnt != END)
      |                       ^~~~~~~~
a.cc:67:23: error: 'const __gnu_cxx::__alloc_traits<std::allocator<StNod>, StNod>::value_type' {aka 'const struct StNod'} has no member named 'm_nParnt'
   67 |     nx = cnrvoNod[nx].m_nParnt;
      |                       ^~~~~~~~
Language: C++

#include <iostream>
#include <vector>
using namespace  std;

const int END = -1;
struct StNod
{
  int m_nKey;
  int m_nParnt;
  int m_nLeft;
  int m_nRigt;

  StNod() :
    m_nKey(END), m_nParnt(END), m_nLeft(END), m_nRigt(END)
  { }
};

void fnInput(vector<StNod> &rvoNod)
{
  StNod oNod;
  int nMaxSiz;

  cin >> nMaxSiz;
  rvoNod.resize(nMaxSiz, oNod);

  for (int i = 0; i < nMaxSiz; i++)
  {
    int nKey, nLeft, nRigt;
    cin >> nNo >> nLeft >> nRigt;

    rvoNod[nNo].m_nKey  = nNo;
    rvoNod[nNo].m_nLeft = nLeft;
    rvoNod[nNo].m_nRigt = nRigt;
    if (nLeft != END)  rvoNod[nLeft].m_nParnt = nNo;
    if (nRigt != END)  rvoNod[nRigt].m_nParnt = nNo;
  }
}

void fnPreOrder(const vector<StNod> &cnrvoNod, int nx)
{
  if (nx == END)  return;

  cout << " " << nx;
  fnPreOrder(cnrvoNod, cnrvoNod[nx].m_nLeft);
  fnPreOrder(cnrvoNod, cnrvoNod[nx].m_nRigt);
}

void fnInOrder(const vector<StNod> &cnrvoNod, int nx)
{
  if (nx == END)  return;

  fnInOrder(cnrvoNod, cnrvoNod[nx].m_nLeft);
  cout << " " << nx;
  fnInOrder(cnrvoNod, cnrvoNod[nx].m_nRigt);
}

void fnPostOrder(const vector<StNod> &cnrvoNod, int nx)
{
  if (nx == END)  return;

  fnPostOrder(cnrvoNod, cnrvoNod[nx].m_nLeft);
  fnPostOrder(cnrvoNod, cnrvoNod[nx].m_nRigt);
  cout << " " << nx;
}

void fnTreeWalk(const vector<StNod> &cnrvoNod)
{
  int nx = 0;
  while (cnrvoNod[nx].m_nParnt != END)
    nx = cnrvoNod[nx].m_nParnt;

  cout << "Preorder" << endl;
  fnPreOrder(cnrvoNod, cnrvoNod[nx].m_nKey);
  cout << endl;

  cout << "Inorder" << endl;
  fnInOrder(cnrvoNod, cnrvoNod[nx].m_nKey);
  cout << endl;

  cout << "Postorder" << endl;
  fnPostOrder(cnrvoNod, cnrvoNod[nx].m_nKey);
  cout << endl;
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<StNod> voNod;

  fnInput(voNod);
  fnTreeWalk(voNod);
  return 0;
}

Compiler output:
a.cc: In function 'void fnInput(std::vector<StNod>&)':
a.cc:29:12: error: 'nNo' was not declared in this scope
   29 |     cin >> nNo >> nLeft >> nRigt;
      |            ^~~
Language: C++

#include <iostream>
#include <algorithm>
#include <stdio.h>
#define ll long long
#define MAX 10000
#define NIL -1
using namespace std;

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

void preOrder(int u){
  if(u == NIL)
    return;
  printf(" %d", u);
  preOrder(T[u].l);
  preOrder(T[u].r);
}

void postOrder(int u){
  if(u == NIL)
    return;
  postOrder(T[u].l);
  postOrder(T[u].r);
  printf(" %d", u);
}

void inOrder(int u){
  if(u == NIL)
    return;
  inOrder(T[u].l);
  printf(" %d", u);
  inOrder(T[u].r);
}

int main(){
  cin >> n;
  for(int i = 0; i < n; i++){
    int v, l, r;
    cin >> v >> l >> r;
    T[v] = l;
    T[r] = r;
  }
  int root;
  for(int i = 0; i < n; i++)
    if(T[i].p == NIL)
      root = i;
  printf("Preorder\n");
  preOrder(root);
  printf("Inorder\n");
  inOrder(root);
  printf("Postorder\n");
  postOrder(root);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:12: error: no match for 'operator=' (operand types are 'Node' and 'int')
   42 |     T[v] = l;
      |            ^
a.cc:9:8: note: candidate: 'constexpr Node& Node::operator=(const Node&)'
    9 | struct Node{int p,r,l;};
      |        ^~~~
a.cc:9:8: note:   no known conversion for argument 1 from 'int' to 'const Node&'
a.cc:9:8: note: candidate: 'constexpr Node& Node::operator=(Node&&)'
a.cc:9:8: note:   no known conversion for argument 1 from 'int' to 'Node&&'
a.cc:43:12: error: no match for 'operator=' (operand types are 'Node' and 'int')
   43 |     T[r] = r;
      |            ^
a.cc:9:8: note: candidate: 'constexpr Node& Node::operator=(const Node&)'
    9 | struct Node{int p,r,l;};
      |        ^~~~
a.cc:9:8: note:   no known conversion for argument 1 from 'int' to 'const Node&'
a.cc:9:8: note: candidate: 'constexpr Node& Node::operator=(Node&&)'
a.cc:9:8: note:   no known conversion for argument 1 from 'int' to 'Node&&'
Language: C++

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

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

void preOrder(int u){
  if(u == NIL)
    return;
  printf(" %d", u);
  preOrder(T[u].l);
  preOrder(T[u].r);
}

void postOrder(int u){
  if(u == NIL)
    return;
  postOrder(T[u].l);
  postOrder(T[u].r);
  printf(" %d", u);
}

void inOrder(int u){
  if(u == NIL)
    return;
  inOrder(T[u].l);
  printf(" %d", u);
  inOrder(T[u].r);
}

int main(){
  cin >> n;
  for(int i = 0; i < n; i++){
    int v, l, r;
    cin >> v >> l >> r;
    T[v] = l;
    T[r] = r;
  }
  int root;
  for(int i = 0; i < n; i++)
    if(T[i].p == NIL)
      root = i;
  printf("Preorder\n");
  preOrder(root);
  printf("Inorder\n");
  inOrder(root);
  printf("Postorder\n");
  postOrder(root);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:12: error: no match for 'operator=' (operand types are 'Node' and 'int')
   41 |     T[v] = l;
      |            ^
a.cc:8:8: note: candidate: 'constexpr Node& Node::operator=(const Node&)'
    8 | struct Node{int p,r,l;};
      |        ^~~~
a.cc:8:8: note:   no known conversion for argument 1 from 'int' to 'const Node&'
a.cc:8:8: note: candidate: 'constexpr Node& Node::operator=(Node&&)'
a.cc:8:8: note:   no known conversion for argument 1 from 'int' to 'Node&&'
a.cc:42:12: error: no match for 'operator=' (operand types are 'Node' and 'int')
   42 |     T[r] = r;
      |            ^
a.cc:8:8: note: candidate: 'constexpr Node& Node::operator=(const Node&)'
    8 | struct Node{int p,r,l;};
      |        ^~~~
a.cc:8:8: note:   no known conversion for argument 1 from 'int' to 'const Node&'
a.cc:8:8: note: candidate: 'constexpr Node& Node::operator=(Node&&)'
a.cc:8:8: note:   no known conversion for argument 1 from 'int' to 'Node&&'
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1e9+7
#define MOD 1e9+7
#define EPS 1e-10

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;

//struct tree{
//	string s;
//	tree *l, *r;
//	tree(string _s, tree* _l, tree* _r) :s(_s), l(_l), r(_r){}
//};
//
//void make_tree(tree t){
//	string buf = t.s;
//	REP(i, buf.size()){
//		if (s[i] == '*'){
//		
//		}
//	}
//}
//
//string s;

P p[100100];

void print_Preorder(int id){
	cout << " " << id;
	if (p[id].first != -1)print_Preorder(p[id].first);
	if (p[id].second != -1)print_Preorder(p[id].second);
}

void print_Inorder(int id){
	if (p[id].first != -1)print_Inorder(p[id].first);
	cout << " " << id;
	if (p[id].second != -1)print_Inorder(p[id].second);
}

void print_Postorder(int id){
	if (p[id].first != -1)print_Postorder(p[id].first);
	if (p[id].second != -1)print_Postorder(p[id].second);
	cout << " " << id;
}

int main(){
	int n, s;
	bool f[100];
	cin >> n;
	REP(i, n){
		int id, l, r;
		cin >> id >> l >> r;
		p[id] = P(l, r);
		f[l] = 1;
		f[r] = 1;
	}
	REP(i, n)if (!F[i])s = i;
	cout << "Preorder" << endl;
	print_Preorder(s);
	cout << endl;
	cout << "Inorder" << endl;
	print_Inorder(s);
	cout << endl;
	cout << "Postorder" << endl;
	print_Postorder(s);
	cout << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:84:23: error: 'F' was not declared in this scope
   84 |         REP(i, n)if (!F[i])s = i;
      |                       ^
Language: C++

#include<stdio.h>
#include<stdlib.h>
typedef struct{
  int this;
  int parent;
  int l,r;    // child
}node;
void Preorder(int);
void Inorder(int);
void Postorder(int);
node *T;
int main(){
  int n, i, root;
  scanf("%d",&n);
  T = (node *)malloc(sizeof(node) * n);
  for(i=0; i<n; i++) T[i].parent = -1;
  for(i=0; i<n; i++){
    scanf("%d",&T[i].this);
    if(i == 0) root = i;
    scanf("%d%d",&T[T[i].this].l,&T[T[i].this].r);
    T[T[T[i].this].l].parent = T[i].this;
    T[T[T[i].this].r].parent = T[i].this;
  }
  printf("Preorder \n");
  Preorder(root);
  printf("\nInorder \n");
  Inorder(root);
  printf("\nPostorder \n");
  Postorder(root);
  printf("\n");
  free(T);
  return 0;
}

void Preorder(int x){
  if(x != -1){
    printf("%d ",T[x].this);
    Preorder(T[x].l);
    Preorder(T[x].r);
  }
}

void Inorder(int x){
  if(x != -1){
    Inorder(T[x].l);
    printf("%d ",T[x].this);
    Inorder(T[x].r);
  }
}

void Postorder(int x){
  if(x != -1){
    Postorder(T[x].l);
    Postorder(T[x].r);
    printf("%d ",T[x].this);
  }
}

Compiler output:
a.cc:4:7: error: expected unqualified-id before 'this'
    4 |   int this;
      |       ^~~~
a.cc: In function 'int main()':
a.cc:18:22: error: expected unqualified-id before 'this'
   18 |     scanf("%d",&T[i].this);
      |                      ^~~~
a.cc:20:26: error: expected unqualified-id before 'this'
   20 |     scanf("%d%d",&T[T[i].this].l,&T[T[i].this].r);
      |                          ^~~~
a.cc:20:26: error: expected ']' before 'this'
   20 |     scanf("%d%d",&T[T[i].this].l,&T[T[i].this].r);
      |                          ^~~~
      |                          ]
a.cc:21:14: error: expected unqualified-id before 'this'
   21 |     T[T[T[i].this].l].parent = T[i].this;
      |              ^~~~
a.cc:21:14: error: expected ']' before 'this'
   21 |     T[T[T[i].this].l].parent = T[i].this;
      |              ^~~~
      |              ]
a.cc:21:14: error: expected ']' before 'this'
   21 |     T[T[T[i].this].l].parent = T[i].this;
      |              ^~~~
      |              ]
a.cc:22:14: error: expected unqualified-id before 'this'
   22 |     T[T[T[i].this].r].parent = T[i].this;
      |              ^~~~
a.cc:22:14: error: expected ']' before 'this'
   22 |     T[T[T[i].this].r].parent = T[i].this;
      |              ^~~~
      |              ]
a.cc:22:14: error: expected ']' before 'this'
   22 |     T[T[T[i].this].r].parent = T[i].this;
      |              ^~~~
      |              ]
a.cc: In function 'void Preorder(int)':
a.cc:37:23: error: expected unqualified-id before 'this'
   37 |     printf("%d ",T[x].this);
      |                       ^~~~
a.cc: In function 'void Inorder(int)':
a.cc:46:23: error: expected unqualified-id before 'this'
   46 |     printf("%d ",T[x].this);
      |                       ^~~~
a.cc: In function 'void Postorder(int)':
a.cc:55:23: error: expected unqualified-id before 'this'
   55 |     printf("%d ",T[x].this);
      |                       ^~~~
Language: C++

#include <stdio.h>
#define N 100000
#define NIL -1
int preorder(int);
int inorder(int);
int postorder(int);
struct Node {
  int parent;
  int left;
  int right;
};

struct Node T[N];
int n,D[N];

int main()
{
  int a,b,c,i,l,m;
  scanf("%d",&n);
  for(i=0;i<n;i++)
    {
      T[i].parent=NIL;
      T[i].left=NIL;
      T[i].right=NIL;
    }
  
  for(i=0;i<n;i++)
    {
      scanf("%d%d%d",&a,&b,&c);
      T[a].left=b;
      T[a].right=c;
      if(b!=NIL) T[b].parent=a;
      if(c!=NIL) T[c].parent=a;
    }
  
  for(i=0;i<n;i++)
    {
      if(T[i].parent==NIL) l=i;
      printf("Preorder\n");
      preorder(l);
      printf("\n");
      printf("Inorder\n");
      inorder(l);
      printf("\n");
      printf("Postorder\n");
      postorder(l);
      printf("\n");
    }
  return 0;
}

int preorder(int u)
{
  if(u==NIL) return;
  printf("%d",u);
  preorder(T[u].left);
  preorder(T[u].right);
}

int inorder(int u)
{
  if(u==NIL) return;
  inorder(T[u].left);
  printf("%d",u);
  inorder(T[u].right);
}

int postorder(int u)
{
  if(u==NIL) return;
  postorder(T[u].left);
  postorder(T[u].right);
  printf("%d",u);
}

Compiler output:
a.cc: In function 'int preorder(int)':
a.cc:54:14: error: return-statement with no value, in function returning 'int' [-fpermissive]
   54 |   if(u==NIL) return;
      |              ^~~~~~
a.cc: In function 'int inorder(int)':
a.cc:62:14: error: return-statement with no value, in function returning 'int' [-fpermissive]
   62 |   if(u==NIL) return;
      |              ^~~~~~
a.cc: In function 'int postorder(int)':
a.cc:70:14: error: return-statement with no value, in function returning 'int' [-fpermissive]
   70 |   if(u==NIL) return;
      |              ^~~~~~
a.cc: In function 'int preorder(int)':
a.cc:57:11: warning: control reaches end of non-void function [-Wreturn-type]
   57 |   preorder(T[u].right);
      |   ~~~~~~~~^~~~~~~~~~~~
a.cc: In function 'int inorder(int)':
a.cc:65:10: warning: control reaches end of non-void function [-Wreturn-type]
   65 |   inorder(T[u].right);
      |   ~~~~~~~^~~~~~~~~~~~
a.cc: In function 'int postorder(int)':
a.cc:73:9: warning: control reaches end of non-void function [-Wreturn-type]
   73 |   printf("%d",u);
      |   ~~~~~~^~~~~~~~
Language: C++

#include <stdio.h>
#define N 100000
#define NIL -1
int preorder(int);
int inorder(int);
int postorder(int);
struct Node {
  int parent;
  int left;
  int right;
};

struct Node T[N];
int n,D[N];

int main()
{
  int a,b,c,i,l,m;
  scanf("%d",&n);
  for(i=0;i<n;i++)
    {
      T[i].parent=NIL;
      T[i].left=NIL;
      T[i].right=NIL;
    }
  
  for(i=0;i<n;i++)
    {
      scanf("%d%d%d",&a,&b,&c);
      T[a].left=b;
      T[a].right=c;
      if(b!=NIL) T[b].parent=a;
      if(c!=NIL) T[c].parent=a;
    }
  
  for(i=0;i<n;i++)
    {
      if(T[i].parent==NIL) l=i;
    }
      printf("Preorder\n");
      preorder(l);
      printf("\n");
      printf("Inorder\n");
      inorder(l);
      printf("\n");
      printf("Postorder\n");
      postorder(l);
      printf("\n");

      return 0;
}

int preorder(int u)
{
  if(u==NIL) return;
  printf(" %d",u);
  preorder(T[u].left);
  preorder(T[u].right);
}

int inorder(int u)
{
  if(u==NIL) return;
  inorder(T[u].left);
  printf(" %d",u);
  inorder(T[u].right);
}

int postorder(int u)
{
  if(u==NIL) return;
  postorder(T[u].left);
  postorder(T[u].right);
  printf(" %d",u);
}

Compiler output:
a.cc: In function 'int preorder(int)':
a.cc:55:14: error: return-statement with no value, in function returning 'int' [-fpermissive]
   55 |   if(u==NIL) return;
      |              ^~~~~~
a.cc: In function 'int inorder(int)':
a.cc:63:14: error: return-statement with no value, in function returning 'int' [-fpermissive]
   63 |   if(u==NIL) return;
      |              ^~~~~~
a.cc: In function 'int postorder(int)':
a.cc:71:14: error: return-statement with no value, in function returning 'int' [-fpermissive]
   71 |   if(u==NIL) return;
      |              ^~~~~~
a.cc: In function 'int preorder(int)':
a.cc:58:11: warning: control reaches end of non-void function [-Wreturn-type]
   58 |   preorder(T[u].right);
      |   ~~~~~~~~^~~~~~~~~~~~
a.cc: In function 'int inorder(int)':
a.cc:66:10: warning: control reaches end of non-void function [-Wreturn-type]
   66 |   inorder(T[u].right);
      |   ~~~~~~~^~~~~~~~~~~~
a.cc: In function 'int postorder(int)':
a.cc:74:9: warning: control reaches end of non-void function [-Wreturn-type]
   74 |   printf(" %d",u);
      |   ~~~~~~^~~~~~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define Vi vector<int>
#define FOR(i,s,e) for (int i=s; i<e; i++)
#define ITER(v) v.begin(), v.end()

constexpr int MAX_N = 25;

struct Node {
    int parent, left, right;
    Node(int parent=-1, int left=-1, int right=-1) :
        parent(parent), left(left), right(right) {}
};

Node tree[MAX_N];

void add_node_to_tree(int id, int left, int right) {
    tree[id].left = left;
    tree[id].right = right;
    int degree = 0;
    if (left != -1) {
        tree[left].parent = id;
        tree[left].sibling = right;
        ++degree;
    }
    if (right != -1) {
        tree[right].parent = id;
        tree[right].sibling = left;
        ++degree;
    }
    tree[id].degree = degree;
}

void preorder_print(int id) {
    if (id == -1) return;
    cout << " " << id;
    preorder_print(tree[id].left);
    preorder_print(tree[id].right);
}

void inorder_print(int id) {
    if (id == -1) return;
    inorder_print(tree[id].left);
    cout << " " << id;
    inorder_print(tree[id].right);
}

void postorder_print(int id) {
    if (id == -1) return;
    postorder_print(tree[id].left);
    postorder_print(tree[id].right);
    cout << " " << id;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;

    int id, left, right;
    FOR(i,0,n) {
        cin >> id >> left >> right;
        add_node_to_tree(id, left, right);
    }
    int root = -1;
    FOR(i,0,n) {
        if (tree[i].parent == -1) {
            root = i;
            break;
        }
    }
    assert(root != -1);
    cout << "Preorder" << endl;
    preorder_print(root);
    cout << endl;
    cout << "Inorder" << endl;
    inorder_print(root);
    cout << endl;
    cout << "Postorder" << endl;
    postorder_print(root);
    cout << endl;

    return 0;
}

Compiler output:
a.cc: In function 'void add_node_to_tree(int, int, int)':
a.cc:25:20: error: 'struct Node' has no member named 'sibling'
   25 |         tree[left].sibling = right;
      |                    ^~~~~~~
a.cc:30:21: error: 'struct Node' has no member named 'sibling'
   30 |         tree[right].sibling = left;
      |                     ^~~~~~~
a.cc:33:14: error: 'struct Node' has no member named 'degree'
   33 |     tree[id].degree = degree;
      |              ^~~~~~
Language: C++

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

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

Node T[MAX];
int n;

void preParse (int u) {
    if (u == NIL) return;
    printf(" %d", u);
    preParse(T[u].left);
    preParse(T[u].right);
}

void inParse (int u) {
    
    if (u == NIL) return;
    inParse(T[u].left);
    printf(" %d", u);
    inParse(T[u].right);
}

void postParse (int u) {

    if (u == NIL) return;
    postParse( T[u].left);
    postParse(T[u].right);
    printf(" %d", u);
}

int main(void) {
    int i, v, l, r ,root = 0;
    scanf("%d", &n);
    for (i = 0 ; i < n ; i ++ ) T[i].parent = NIL;

    for ( 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 ( i = 0 ; i < n ; i++ ) if (T[i].p == NIL) root = i;

    printf("Preorder\n");
    preParse(root);
    printf("\n");
    printf("Inorder\n");
    inParse(root);
    printf("\n");
    printf("Postorder\n");
    postParse(root);

    printf("\n");

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:42: error: 'struct Node' has no member named 'p'
   46 |     for ( i = 0 ; i < n ; i++ ) if (T[i].p == NIL) root = i;
      |                                          ^
Language: C++

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

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

void preOrder(int u) {
  if (u == NIL) return;
  printf(" %d", u);
  preOrder(T[u].l);
  preOrder(T[u].r);
}

void inOrder(int u) {
  if (u == NIL) return;
  inOrder(T[u].l);
  printf(" %d", u);
  inOrder(T[u].r);
}

void postOrder(int u) {
  if (u == NIL) return;
  postOrder(T[u].l);
  postOrder(T[u].r);
  printf(" %d", u);
}

int main() {
  int root, i, n, v, l, r;

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

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

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

  printf("Preorder\n");
  preOrder(root);
  printf("\n");
  printf("Inorder\n");
  InOrder(root);
  printf("\n");
  printf("Postorder\n");
  postOrder(root);

  return 0;
}

Compiler output:
a.cc:5:18: error: expected unqualified-id before ',' token
    5 | struct Node { int, p, r, l; };
      |                  ^
a.cc: In function 'void preOrder(int)':
a.cc:11:17: error: 'struct Node' has no member named 'l'
   11 |   preOrder(T[u].l);
      |                 ^
a.cc:12:17: error: 'struct Node' has no member named 'r'
   12 |   preOrder(T[u].r);
      |                 ^
a.cc: In function 'void inOrder(int)':
a.cc:17:16: error: 'struct Node' has no member named 'l'
   17 |   inOrder(T[u].l);
      |                ^
a.cc:19:16: error: 'struct Node' has no member named 'r'
   19 |   inOrder(T[u].r);
      |                ^
a.cc: In function 'void postOrder(int)':
a.cc:24:18: error: 'struct Node' has no member named 'l'
   24 |   postOrder(T[u].l);
      |                  ^
a.cc:25:18: error: 'struct Node' has no member named 'r'
   25 |   postOrder(T[u].r);
      |                  ^
a.cc: In function 'int main()':
a.cc:33:34: error: 'struct Node' has no member named 'p'
   33 |   for ( i = 0; i < n; i++ ) T[i].p = NIL;
      |                                  ^
a.cc:37:10: error: 'struct Node' has no member named 'l'
   37 |     T[v].l = l;
      |          ^
a.cc:38:10: error: 'struct Node' has no member named 'r'
   38 |     T[v].r = r;
      |          ^
a.cc:39:26: error: 'struct Node' has no member named 'p'
   39 |     if ( l != NIL ) T[l].p = v;
      |                          ^
a.cc:40:26: error: 'struct Node' has no member named 'p'
   40 |     if ( r != NIL ) T[r].p = v;
      |                          ^
a.cc:43:39: error: 'struct Node' has no member named 'p'
   43 |   for ( i = 0; i < n; i++ ) if ( T[i].p == NIL ) root = i;
      |                                       ^
a.cc:49:3: error: 'InOrder' was not declared in this scope; did you mean 'inOrder'?
   49 |   InOrder(root);
      |   ^~~~~~~
      |   inOrder
Language: C++

#include <iostream>
#include <map>
#include <stack>
#include <vector>

using namespace std;
class Node{
public:
	int id;
	Node* children[2];
	Node* parent;
	Node();
};

Node::Node(){
	this -> children[0] = NULL;
	this -> children[1] = NULL;
	this -> parent = NULL;
};

Node* createChild(Node* node, int child_id, map<int, Node*>& m){
	Node* child = new Node();
	child -> id = child_id;
	child -> parent = node;
	m.insert(make_pair(child_id,child));
	return child; 
}

void preorder(Node* root, int n){
	cout << "Preorder" << endl;
	cout << " ";
	stack<Node*> st;
	st.push(root);
	int cnt = 0;
	while(!st.empty()){
		Node* node  = new Node();
		node = st.top();
		cnt++;
		st.pop();
		if(cnt < n)
			cout << node -> id << " ";
		else
			cout << node -> id ;
		if(node -> children[1] != NULL)
			st.push(node -> children[1]);
		if(node -> children[0] != NULL)
			st.push(node -> children[0]);
	}
	cout << endl;
}
static int inorder_cnt = 0;
void inorder(Node* root, int n){
	if(root -> children[0] != NULL)
		inorder(root -> children[0],n);
	inorder_cnt++;
	if(inorder_cnt == n)
			cout << root -> id << endl;
	else
			cout << root -> id << " ";
	if(root -> children[1] != NULL)
		inorder(root -> children[1],n);
}

static int postorder_cnt = 0;
void postorder(Node* root, int n){
	if(root -> children[0] != NULL)
		postorder(root -> children[0],n);
	if(root -> children[1] != NULL)
		postorder(root -> children[1],n);
	postorder_cnt++;
	if(postorder_cnt == n)
		cout << root -> id ;
	else
		cout << root -> " ";

}

int main(){
	vector<int> v;
	map<int, Node*> m;
	int n, root_id,id, left,right;
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> id >> left >> right;
		if(i == 0)
			root_id = id;
		Node* node = new Node();
		if(m.find(id) == m.end())
			node -> id = id;
		else
			node = m.at(id);
		if(left != -1)
			node -> children[0] = createChild(node,left,m);
		if(right != -1)
			node -> children[1] = createChild(node,right,m);
		m.insert(make_pair(id,node));
	}
	Node* root = new Node();
	if(m.find(root_id) != m.end())
		root = m.at(root_id);
	preorder(root, n);
	cout << "Inorder" << endl;
	cout << " ";
	inorder(root,n);
	cout << "Postorder" << endl;
	cout << " ";
	postorder(root,n);
}

Compiler output:
a.cc: In function 'void postorder(Node*, int)':
a.cc:74:33: error: expected unqualified-id before string constant
   74 |                 cout << root -> " ";
      |                                 ^~~
Language: C++

#include <cstdio>
using std::scanf;
using std::printf;

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

void Preorder(Node tree[], i) {
  printf(" %d", i);
  if (tree[i].left != -1) { Preorder(tree, tree[i].left); }
  if (tree[i].right != -1) { Preorder(tree, tree[i].right); }
}

void Inorder(Node tree[], i) {
  if (tree[i].left != -1) { Inorder(tree, tree[i].left); }
  printf(" %d", i);
  if (tree[i].right != -1) { Inorder(tree, tree[i].right); }
}

void Postorder(Node tree[], i) {
  if (tree[i].left != -1) { Postorder(tree, tree[i].left); }
  if (tree[i].right != -1) { Postorder(tree, tree[i].right); }
  printf(" %d", i);
}

int main() {
  int n;
  scanf("%d", &n);
  Node tree[n];
  for (int i = 0; i < n; ++i) { tree[i].parent = -1; }
  for (int i = 0; i < n; ++i) {
    int id, left, right;
    scanf("%d %d %d", &id, &left, &right);
    tree[id].left = left;
    tree[id].right = right;
    if (left != -1) { tree[left].parent = id; }
    if (right != -1) { tree[right].parent = id; }
  }
  int root;
  for (int i = 0; i < n; ++i) {
    if (tree[i].parent == -1) {
      root = i;
      break;
    }
  }

  printf("Preorder\n");
  Preorder(tree, root);
  printf("\n");
  printf("Inorder\n");
  Inorder(tree, root);
  printf("\n");
  printf("Postorder\n");
  Postorder(tree, root);
  printf("\n");

  return 0;
}

Compiler output:
a.cc:7:28: error: 'i' has not been declared
    7 | void Preorder(Node tree[], i) {
      |                            ^
a.cc: In function 'void Preorder(Node*, int)':
a.cc:8:17: error: 'i' was not declared in this scope
    8 |   printf(" %d", i);
      |                 ^
a.cc: At global scope:
a.cc:13:27: error: 'i' has not been declared
   13 | void Inorder(Node tree[], i) {
      |                           ^
a.cc: In function 'void Inorder(Node*, int)':
a.cc:14:12: error: 'i' was not declared in this scope
   14 |   if (tree[i].left != -1) { Inorder(tree, tree[i].left); }
      |            ^
a.cc:15:17: error: 'i' was not declared in this scope
   15 |   printf(" %d", i);
      |                 ^
a.cc: At global scope:
a.cc:19:29: error: 'i' has not been declared
   19 | void Postorder(Node tree[], i) {
      |                             ^
a.cc: In function 'void Postorder(Node*, int)':
a.cc:20:12: error: 'i' was not declared in this scope
   20 |   if (tree[i].left != -1) { Postorder(tree, tree[i].left); }
      |            ^
a.cc:21:12: error: 'i' was not declared in this scope
   21 |   if (tree[i].right != -1) { Postorder(tree, tree[i].right); }
      |            ^
a.cc:22:17: error: 'i' was not declared in this scope
   22 |   printf(" %d", i);
      |                 ^
Language: C++

/*
 * Problem Description: Tree Walk
 * Category: Tree
 * Author: Khan
 * Date: 23th October, 2017
 */

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

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

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

void Preorder(int u)
{
    printf("%d ", u);
    if(T[u].left != NIL)
        Preorder(T[u].left);
    if(T[u].right != NIL)
        Preorder(T[u].right);
}

void Inorder(int u)
{
    if(T[u].left != NIL)
        Inorder(T[u].left);
    printf("%d ", u);
    if(T[u].right != NIL)
        Inorder(T[u].right);
}

void Postorder(int u)
{
    if(T[u].left != NIL)
        Postorder(T[u].left);
    if(T[u].right != NIL)
        Postorder(T[u].right);
    printf("%d ", u);
}

int main(int argc, char const *argv[])
{
    freopen("sample.txt", "r", stdin);
    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);

    printf("Preorder\n");
    Preorder(root);
    printf("\nInorder\n");
    Inorder(root);
    printf("\nPostorder\n");
    Postorder(root);
    printf("\n");
    return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:71:5: error: 'setDepth' was not declared in this scope
   71 |     setDepth(root, 0);
      |     ^~~~~~~~
a.cc:72:5: error: 'setHeight' was not declared in this scope
   72 |     setHeight(root);
      |     ^~~~~~~~~
Language: C++

/*
 * Problem Description: Tree Walk
 * Category: Tree
 * Author: Khan
 * Date: 23th October, 2017
 */

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

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

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

void Preorder(int u)
{
    printf("%d ", u);
    if(T[u].left != NIL)
        Preorder(T[u].left);
    if(T[u].right != NIL)
        Preorder(T[u].right);
}

void Inorder(int u)
{
    if(T[u].left != NIL)
        Inorder(T[u].left);
    printf("%d ", u);
    if(T[u].right != NIL)
        Inorder(T[u].right);
}

void Postorder(int u)
{
    if(T[u].left != NIL)
        Postorder(T[u].left);
    if(T[u].right != NIL)
        Postorder(T[u].right);
    printf("%d ", u);
}

int main(int argc, char const *argv[])
{
    //freopen("sample.txt", "r", stdin);
    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);

    printf("Preorder\n");
    Preorder(root);
    printf("\nInorder\n");
    Inorder(root);
    printf("\nPostorder\n");
    Postorder(root);
    printf("\n");
    return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:71:5: error: 'setDepth' was not declared in this scope
   71 |     setDepth(root, 0);
      |     ^~~~~~~~
a.cc:72:5: error: 'setHeight' was not declared in this scope
   72 |     setHeight(root);
      |     ^~~~~~~~~
Language: C++

#include <cstdio>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define llong long long
#define IFY 2000000000
#define MAX 10000
#define NIL -1
using namespace std;
struct Node{int parent,left,right;};
Node T[MAX];
int n;
void preparse(int u){
  if(u==NIL) return;
  printf(" %d",u);
  prepalse(T[u].left);
  prepalse(T[u].right);
}
void inprse(int u){
  if(u==NIL) return;
  inparse(T[u].left);
  printf(" %d",u);
  inparse(T[u].right);
}
void postparse(int u){
  if(u==NIL) return;
  postparse(T[u].left);
  postparse(T[u].right);
  printf(" %d",u);
}
int main(){
  int root=0,v,left,right;
  scanf("%d",&n);
  REP(i,n) T[i].parent=NIL;
  REP(i,n){
    scanf("%d %d %d",&v,&left,&right);
    T[v].left=left;
    T[v].right=right;
    if(left!=NIL) T[left].parent=v;
    if(right!=NIL) T[right].parent=v;
  }
  REP(i,n) if(T[i].parent==NIL) root=i;
  printf("Preorder\n");
  preparse(root);
  printf("\n");
  printf("Inorder\n");
  inparse(root);
  printf("\n");
  printf("Postorder\n");
  postparese(root);
  printf("\n");
  return 0;
}

Compiler output:
a.cc: In function 'void preparse(int)':
a.cc:15:3: error: 'prepalse' was not declared in this scope; did you mean 'preparse'?
   15 |   prepalse(T[u].left);
      |   ^~~~~~~~
      |   preparse
a.cc: In function 'void inprse(int)':
a.cc:20:3: error: 'inparse' was not declared in this scope; did you mean 'inprse'?
   20 |   inparse(T[u].left);
      |   ^~~~~~~
      |   inprse
a.cc: In function 'int main()':
a.cc:46:3: error: 'inparse' was not declared in this scope; did you mean 'inprse'?
   46 |   inparse(root);
      |   ^~~~~~~
      |   inprse
a.cc:49:3: error: 'postparese' was not declared in this scope; did you mean 'postparse'?
   49 |   postparese(root);
      |   ^~~~~~~~~~
      |   postparse
Language: C++

#include<iostream>

#define MAX 10000
#define NIL -1

using namespace std;

int n;
struct Node {int p, l, r;};
sturct Node T[MAX];

void preParse (int u) {

    if (u == NIL) {
        return ;
    }

    cout << " " << u;

    preParse (T[u].l);
    preParse (T[u].r);

}

void inParse (int u) {

    if (u == NIL) {
        return ;
    }

    inParse (T[u].l);

    cout << " " << u;

    inParse (T[u].r);

}

void postParse (int u) {

    if (u == NIL) {
        return ;
    }

    postParse (T[u].l);
    postParse (T[u].r);

    cout << " " << u;


}

int main () {

    int i, v, l, r, root;

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

    for (i = 0; i < n; i++) {
        cin >> v >> l >> r;

        T[v].l = l;
        T[v].r = r;

        if (l != NIL) {
            T[l].p = v;
        }
        if (r != NIL) {
            T[r].p = v;
        }

    }

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

    cout << "Preorder" << endl;
    preParse (root);
    cout << endl;

    cout << "Inorder" << endl;
    inParse (root);
    cout << endl;

    cout << "Postorder" << endl;
    postParse (root);
    cout << endl;

    return 0;

}

Compiler output:
a.cc:10:1: error: 'sturct' does not name a type; did you mean 'struct'?
   10 | sturct Node T[MAX];
      | ^~~~~~
      | struct
a.cc: In function 'void preParse(int)':
a.cc:20:15: error: 'T' was not declared in this scope
   20 |     preParse (T[u].l);
      |               ^
a.cc: In function 'void inParse(int)':
a.cc:31:14: error: 'T' was not declared in this scope
   31 |     inParse (T[u].l);
      |              ^
a.cc: In function 'void postParse(int)':
a.cc:45:16: error: 'T' was not declared in this scope
   45 |     postParse (T[u].l);
      |                ^
a.cc: In function 'int main()':
a.cc:59:9: error: 'T' was not declared in this scope
   59 |         T[i].p = NIL;
      |         ^
a.cc:65:9: error: 'T' was not declared in this scope
   65 |         T[v].l = l;
      |         ^
a.cc:78:13: error: 'T' was not declared in this scope
   78 |         if (T[i].p == NIL) {
      |             ^
Language: C++

#include<bits/stdc++.h>
#define ll long long int
#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n)
#define MAX 10000
#define NIL -1

using namespace std;

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

void preParse(int u) {
  if (u == NIL) return;
  cout << " " << u;
  preParse(T[u].l);
  preParse(T[u].r);
}

void inParse(int u) {
  if (u == NIL) return;
  inParse(T[u].l);
  cout << " " << u;
  inParse(T[u].r);
}

void postaParse(int u) {
  if (u == NIL) return;
  postParse(T[u].l);
  postParse(T[u.r]);
  cout << " " << u;
}

int main() {
  int v, l, r, root;

  cin >> n;
  REP(i, n) T[i].p = NIL;

  REP(i, n) {
    cin >> v >> l >> r;
    T[v].l = l;
    T[v].r = r;
    if (l != NIL) T[l].p = v;
    if (r != NIL) T[r].p = v;
  }

  REP(i, n) {
    if (T[i].p == NIL)
      root = i;
  }

  cout << "Precorder" << endl;
  preParse(root);
  cout << endl;
  cout << "Incorder" << endl;
  inParse(root);
  cout << endl;
  cout << "Postcorder" << endl;
  postParse(root);
  cout << endl;

  return 0;
}

Compiler output:
a.cc:11:24: error: expected ';' at end of member declaration
   11 | struct Node {int p, l, r};
      |                        ^
      |                         ;
a.cc: In function 'void postaParse(int)':
a.cc:31:3: error: 'postParse' was not declared in this scope; did you mean 'postaParse'?
   31 |   postParse(T[u].l);
      |   ^~~~~~~~~
      |   postaParse
a.cc:32:17: error: request for member 'r' in 'u', which is of non-class type 'int'
   32 |   postParse(T[u.r]);
      |                 ^
a.cc: In function 'int main()':
a.cc:62:3: error: 'postParse' was not declared in this scope; did you mean 'postaParse'?
   62 |   postParse(root);
      |   ^~~~~~~~~
      |   postaParse
Language: C++

#include<bits/stdc++.h>
#define ll long long int
#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n)
#define MAX 10000
#define NIL -1

using namespace std;

struct Node {int p; l;  r;};
struct Node T[MAX];
int n;

void preParse(int u) {
  if (u == NIL) return;
  cout << " " << u;
  preParse(T[u].l);
  preParse(T[u].r);
}

void inParse(int u) {
  if (u == NIL) return;
  inParse(T[u].l);
  cout << " " << u;
  inParse(T[u].r);
}

void postParse(int u) {
  if (u == NIL) return;
  postParse(T[u].l);
  postParse(T[u.r]);
  cout << " " << u;
}

int main() {
  int v, l, r, root;

  cin >> n;
  REP(i, n) T[i].p = NIL;

  REP(i, n) {
    cin >> v >> l >> r;
    T[v].l = l;
    T[v].r = r;
    if (l != NIL) T[l].p = v;
    if (r != NIL) T[r].p = v;
  }

  REP(i, n) {
    if (T[i].p == NIL)
      root = i;
  }

  cout << "Precorder" << endl;
  preParse(root);
  cout << endl;
  cout << "Incorder" << endl;
  inParse(root);
  cout << endl;
  cout << "Postcorder" << endl;
  postParse(root);
  cout << endl;

  return 0;
}

Compiler output:
a.cc:11:21: error: 'l' does not name a type; did you mean 'll'?
   11 | struct Node {int p; l;  r;};
      |                     ^
      |                     ll
a.cc:11:25: error: 'r' does not name a type
   11 | struct Node {int p; l;  r;};
      |                         ^
a.cc: In function 'void preParse(int)':
a.cc:18:17: error: 'struct Node' has no member named 'l'
   18 |   preParse(T[u].l);
      |                 ^
a.cc:19:17: error: 'struct Node' has no member named 'r'
   19 |   preParse(T[u].r);
      |                 ^
a.cc: In function 'void inParse(int)':
a.cc:24:16: error: 'struct Node' has no member named 'l'
   24 |   inParse(T[u].l);
      |                ^
a.cc:26:16: error: 'struct Node' has no member named 'r'
   26 |   inParse(T[u].r);
      |                ^
a.cc: In function 'void postParse(int)':
a.cc:31:18: error: 'struct Node' has no member named 'l'
   31 |   postParse(T[u].l);
      |                  ^
a.cc:32:17: error: request for member 'r' in 'u', which is of non-class type 'int'
   32 |   postParse(T[u.r]);
      |                 ^
a.cc: In function 'int main()':
a.cc:44:10: error: 'struct Node' has no member named 'l'
   44 |     T[v].l = l;
      |          ^
a.cc:45:10: error: 'struct Node' has no member named 'r'
   45 |     T[v].r = r;
      |          ^
Language: C++

#include<bits/stdc++.h>
#define ll long long int
#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n)
#define MAX 10000
#define NIL -1

using namespace std;

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

void preParse(int u) {
  if (u == NIL) return;
  cout << " " << u;
  preParse(T[u].l);
  preParse(T[u].r);
}

void inParse(int u) {
  if (u == NIL) return;
  inParse(T[u].l);
  cout << " " << u;
  inParse(T[u].r);
}

void postParse(int u) {
  if (u == NIL) return;
  postParse(T[u].l);
  postParse(T[u.r]);
  cout << " " << u;
}

int main() {
  int v, l, r, root;

  cin >> n;
  REP(i, n) T[i].p = NIL;

  REP(i, n) {
    cin >> v >> l >> r;
    T[v].l = l;
    T[v].r = r;
    if (l != NIL) T[l].p = v;
    if (r != NIL) T[r].p = v;
  }

  REP(i, n) {
    if (T[i].p == NIL)
      root = i;
  }

  cout << "Precorder" << endl;
  preParse(root);
  cout << endl;
  cout << "Incorder" << endl;
  inParse(root);
  cout << endl;
  cout << "Postcorder" << endl;
  postParse(root);
  cout << endl;

  return 0;
}

Compiler output:
a.cc: In function 'void postParse(int)':
a.cc:32:17: error: request for member 'r' in 'u', which is of non-class type 'int'
   32 |   postParse(T[u.r]);
      |                 ^
Language: C++

#include<stdio.h>
#define MAX 10000
#define NO -1
 
struct tree { int p,l,r;};
struct tree T[MAX];
int n;
 
void Preorder ( int u ) {
    if (u==NO) return;
    printf(" %d",u);
    Preorder(T[u].l);
    Preorder(T[u].r);
}
 
void Inorder (int u) {
    if (u==NO) return;
    Inorder(T[u].l);
    printf(" %d",u);
    Inorder(T[u].r);
}
 
void Postorder (int u) {
    if (u==NO) return;
    Postorder(T[u].l);
    Postorder(T[u].r);
    printf(" %d",u);
}
 
int main(void) {
int i, v, l, r, f, root;
scanf("%d", &n);
for ( i = 0; i < n; i++ ) {
T[i].p = NO;
}
for ( i = 0; i < n; i++ ) {
scanf("%d %d %d", &v, &l, &r);
T[v].l = l;
T[v].r = r;
if ( l != NO ) T[l].p = v;
if ( r != NO ) T[r].p = v;
}
for ( i = 0; i < n; i++ ) {
if ( T[i].p == NO ) root = i;
}
printf("Preorder\n");
Preorder(root);
printf("\nInorder\n");
Inorder(root);
printf("\nPostorder\n");
Postorder(root);
printf("\n");
return 0;
}
???

Compiler output:
a.cc:55:1: error: expected unqualified-id before '?' token
   55 | ???
      | ^
Language: C++

#include<stdio.h>

int LCS(char [],char[])

int LCS(char X[],char Y[]){
	
int count,i,j,n,m,C[1000][1000];


count++;
}
}
return count;
}

int main(){
	
	int q,i;
	char n[1000],m[1000];
	
	scanf("%d",&q);
	for(i=0;i<=q;i++){
	scanf("%s",n[i]);
	scanf("%s",m[i]);
	printf("%d\n",LCS(n,m));
	}

	return 0;
}

Compiler output:
a.cc:5:1: error: expected initializer before 'int'
    5 | int LCS(char X[],char Y[]){
      | ^~~
a.cc:12:1: error: expected declaration before '}' token
   12 | }
      | ^
a.cc:13:1: error: expected unqualified-id before 'return'
   13 | return count;
      | ^~~~~~
a.cc:14:1: error: expected declaration before '}' token
   14 | }
      | ^
a.cc: In function 'int main()':
a.cc:25:23: error: 'LCS' was not declared in this scope
   25 |         printf("%d\n",LCS(n,m));
      |                       ^~~
Language: C++

#include <stdio.h>

struct node { int o, p, q; };
struct node x[10000];
int n;

void pre( int u) {
	if ( u == -1) {
		return ;
	}
	printf(" %d", u);
	pre( x[u].l);
	pre( x[u].r);
	
}

void in( int u) {
	if ( u == -1) {
		return ;
	}
	in( x[u].l);
	printf(" %d", u);
	in( x[u].r);
	
}

void post( int u) {
	if ( u == -1){
		return ;
	}
	post( x[u].l);
	post( x[u].r);
	printf(" %d", u);
	
}

int main() {
	int i, v, l, r, way;
	
	scanf("%d", &n);
	for ( i = 0; i < n; i++) {
		x[i].p = -1;
	}
	
	for ( i = 0; i < n; i++) {
		scanf("%d %d %d", &v, &l, &r);
		x[v].l = l;
		x[v].r = r;
		if ( l != -1) {
			x[l].p = v;
		}
		if ( r != -1) {
			x[r].p = v;
		}
	}
	
	for ( i = 0; i < n; i++) {
		if ( x[i].p == -1) {
			way = i;
		}
	}
	puts("Preorder");
	pre(way);
	puts("\n");
	puts("Inorder");
	in(way);
	puts("\n");
	puts("Postorder");
	pos(way);
	puts("\n");
	
	return 0;
}

Compiler output:
a.cc: In function 'void pre(int)':
a.cc:12:19: error: 'struct node' has no member named 'l'
   12 |         pre( x[u].l);
      |                   ^
a.cc:13:19: error: 'struct node' has no member named 'r'
   13 |         pre( x[u].r);
      |                   ^
a.cc: In function 'void in(int)':
a.cc:21:18: error: 'struct node' has no member named 'l'
   21 |         in( x[u].l);
      |                  ^
a.cc:23:18: error: 'struct node' has no member named 'r'
   23 |         in( x[u].r);
      |                  ^
a.cc: In function 'void post(int)':
a.cc:31:20: error: 'struct node' has no member named 'l'
   31 |         post( x[u].l);
      |                    ^
a.cc:32:20: error: 'struct node' has no member named 'r'
   32 |         post( x[u].r);
      |                    ^
a.cc: In function 'int main()':
a.cc:47:22: error: 'struct node' has no member named 'l'
   47 |                 x[v].l = l;
      |                      ^
a.cc:48:22: error: 'struct node' has no member named 'r'
   48 |                 x[v].r = r;
      |                      ^
a.cc:69:9: error: 'pos' was not declared in this scope; did you mean 'post'?
   69 |         pos(way);
      |         ^~~
      |         post
Language: C++

#include <stdio.h>

struct node { int o, p, q; };
struct node x[10000];
int n;

void pre( int u) {
	if ( u == -1) {
		return ;
	}
	printf(" %d", u);
	pre( x[u].l);
	pre( x[u].r);
	
}

void in( int u) {
	if ( u == -1) {
		return ;
	}
	in( x[u].l);
	printf(" %d", u);
	in( x[u].r);
	
}

void post( int u) {
	if ( u == -1){
		return ;
	}
	post( x[u].l);
	post( x[u].r);
	printf(" %d", u);
	
}

int main() {
	int i, v, l, r, way;
	
	scanf("%d", &n);
	for ( i = 0; i < n; i++) {
		x[i].p = -1;
	}
	
	for ( i = 0; i < n; i++) {
		scanf("%d %d %d", &v, &l, &r);
		x[v].l = l;
		x[v].r = r;
		if ( l != -1) {
			x[l].p = v;
		}
		if ( r != -1) {
			x[r].p = v;
		}
	}
	
	for ( i = 0; i < n; i++) {
		if ( x[i].p == -1) {
			way = i;
		}
	}
	printf("Preorder");
	pre(way);
	printf("\n");
	puts("Inorder");
	in(way);
	printf("\n");
	printf("Postorder");
	pos(way);
	printf("\n");
	
	return 0;
}

Compiler output:
a.cc: In function 'void pre(int)':
a.cc:12:19: error: 'struct node' has no member named 'l'
   12 |         pre( x[u].l);
      |                   ^
a.cc:13:19: error: 'struct node' has no member named 'r'
   13 |         pre( x[u].r);
      |                   ^
a.cc: In function 'void in(int)':
a.cc:21:18: error: 'struct node' has no member named 'l'
   21 |         in( x[u].l);
      |                  ^
a.cc:23:18: error: 'struct node' has no member named 'r'
   23 |         in( x[u].r);
      |                  ^
a.cc: In function 'void post(int)':
a.cc:31:20: error: 'struct node' has no member named 'l'
   31 |         post( x[u].l);
      |                    ^
a.cc:32:20: error: 'struct node' has no member named 'r'
   32 |         post( x[u].r);
      |                    ^
a.cc: In function 'int main()':
a.cc:47:22: error: 'struct node' has no member named 'l'
   47 |                 x[v].l = l;
      |                      ^
a.cc:48:22: error: 'struct node' has no member named 'r'
   48 |                 x[v].r = r;
      |                      ^
a.cc:69:9: error: 'pos' was not declared in this scope; did you mean 'post'?
   69 |         pos(way);
      |         ^~~
      |         post