Language: C++

#include <iostream>
#include <queue>

#define NIL -1
struct Node { int parent, left, right, key; };
Node tree[500001];
int treesize;
int root = NIL;

void in(int id)
{
	if (id == NIL) return;
	cout << " " << tree[id].key;
	in(tree[id].left);
	in(tree[id].right);
}

void pre(int id)
{
	if (id == NIL) return;
	pre(tree[id].left);
	cout << " " << tree[id].key;
	pre(tree[id].right);
}

bool find(int id)
{
	if (!treesize) return false;
	else
	{
		for(int i = 0; i < treesize;++i)
		{
			if (tree[i].key == id) return true;
		}
		return false;
	}
}

void insert(int key)
{
	int y = NIL;
	int x = root;
	while (x != NIL)
	{
		y = x;
		if (key < tree[x].key) x = tree[x].left;
		else x = tree[x].right;
	}
	tree[treesize].parent = y;

	if (y == NIL) root = treesize;
	else if (key < tree[y].key) tree[y].left = treesize;
	else tree[y].right = treesize;

	tree[treesize].left = NIL;
	tree[treesize].right = NIL;
	tree[treesize].key = key;

	treesize++;
}

int main(void)
{
	int n;
	string str;

	cin >> n;

	for (int i = 0; i < n; i++)
	{
		cin >> str;

		if (str == "insert")
		{
			int key;
			cin >> key;
			insert(key);
		}
		else if (str == "print")
		{
			pre(root);
			cout << endl;
			in(root);
			cout << endl;
		}
		else if (str == "find")
		{
			int key;
			cin >> key;
			if (find(key)) cout << "yes" << endl;
			else cout << "no" << endl;
		}
	}

	return 0;
}

Compiler output:
a.cc: In function 'void in(int)':
a.cc:13:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   13 |         cout << " " << tree[id].key;
      |         ^~~~
      |         std::cout
In file included from a.cc:1:
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc: In function 'void pre(int)':
a.cc:22:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   22 |         cout << " " << tree[id].key;
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc: In function 'int main()':
a.cc:65:9: error: 'string' was not declared in this scope
   65 |         string str;
      |         ^~~~~~
a.cc:65:9: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
                 from /usr/include/c++/14/ios:40,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
In file included from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44:
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:67:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   67 |         cin >> n;
      |         ^~~
      |         std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:71:24: error: 'str' was not declared in this scope; did you mean 'std'?
   71 |                 cin >> str;
      |                        ^~~
      |                        std
a.cc:82:25: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   82 |                         cout << endl;
      |                         ^~~~
      |                         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:82:33: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   82 |                         cout << endl;
      |                                 ^~~~
      |                                 std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc:90:40: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   90 |                         if (find(key)) cout << "yes" << endl;
      |                                        ^~~~
      |                                        std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:90:57: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   90 |                         if (find(key)) cout << "yes" << endl;
      |                                                         ^~~~
      |                                                         std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc:91:30: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   91 |                         else cout << "no" << endl;
      |                              ^~~~
      |                              std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:91:46: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   91 |                         else cout << "no" << endl;
      |                                              ^~~~
      |                                              std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~