Language: C++

#include <iostream>
#include <queue>

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

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;
	int value = 0;
	cin >> n;

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

		if (str == "insert")
		{
			int key;
			cin >> key;
			insert(key);
		}
		else if (str == "find")
		{
			cin >> findlist[value];
			value++;
		}
		else if (str == "print")
		{
			if (findlist)
			{
				for (int i = 0; i < value; ++i)
				{
					if (find(findlist[i])) cout << "yes" << endl;
					else cout << "no" << endl;
				}
			}
			pre(root);
			cout << endl;
			in(root);
			cout << endl;
		}
	}

	return 0;
}

Compiler output:
a.cc: In function 'void in(int)':
a.cc:14:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   14 |         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:23:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   23 |         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:66:9: error: 'string' was not declared in this scope
   66 |         string str;
      |         ^~~~~~
a.cc:66: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:68:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   68 |         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:72:24: error: 'str' was not declared in this scope; did you mean 'std'?
   72 |                 cin >> str;
      |                        ^~~
      |                        std
a.cc:91:64: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   91 |                                         if (find(findlist[i])) 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:91:81: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   91 |                                         if (find(findlist[i])) 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:92:46: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   92 |                                         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:92:62: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   92 |                                         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)
      |     ^~~~
a.cc:96:25: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   96 |                         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:96:33: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   96 |                         cout << endl;
      |                                 ^~~~
      |                                 std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~