Language: C++

#include <iostream>
#include <string>

using namespace std;

long long int cnt = 0;

typedef struct _str
{
	string str;
	struct _str *ll;
	struct _str *rr;
} data;

void count()
{
	cnt++;
}

int main() {
	long long int nn, res;
	cin >> nn;
	string tmp;
	cin >> tmp;
	data *root;
	count();
	root = (data*)malloc(sizeof(data));
	root->str = tmp;
	root->rr = NULL;
	root->ll = NULL;
	data *memo;
	for(long long int ii = 1;ii < nn;ii++)
	{
		cin >> tmp;
		memo = root;
		while(1)
		{
			res = memo->str.compare(tmp);
			if(res == 0)
			{
				break;
			}
			else if(res < 0)
			{
				if(memo->ll == NULL)
				{
					count();
					memo->ll = (data*)malloc(sizeof(data));
					memo->ll->str = tmp;
					memo->ll->ll = NULL;
					memo->ll->rr = NULL;
					break;
				}
				else
				{
					memo = memo->ll;
				}
			}
			else if(res > 0)
			{
				if(memo->rr == NULL)
				{
					count();
					memo->rr = (data*)malloc(sizeof(data));
					memo->rr->str = tmp;
					memo->rr->ll = NULL;
					memo->rr->rr = NULL;
					break;
				}
				else
				{
					memo = memo->rr;
				}
			}
		}
	}
	
	cout << cnt << '\n';
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:9: error: reference to 'data' is ambiguous
   25 |         data *root;
      |         ^~~~
In file included from /usr/include/c++/14/string:53,
                 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,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:13:3: note:                 'typedef struct _str data'
   13 | } data;
      |   ^~~~
a.cc:25:15: error: 'root' was not declared in this scope
   25 |         data *root;
      |               ^~~~
a.cc:27:17: error: reference to 'data' is ambiguous
   27 |         root = (data*)malloc(sizeof(data));
      |                 ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:13:3: note:                 'typedef struct _str data'
   13 | } data;
      |   ^~~~
a.cc:27:22: error: expected primary-expression before ')' token
   27 |         root = (data*)malloc(sizeof(data));
      |                      ^
a.cc:31:9: error: reference to 'data' is ambiguous
   31 |         data *memo;
      |         ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:13:3: note:                 'typedef struct _str data'
   13 | } data;
      |   ^~~~
a.cc:31:15: error: 'memo' was not declared in this scope
   31 |         data *memo;
      |               ^~~~
a.cc:48:53: error: reference to 'data' is ambiguous
   48 |                                         memo->ll = (data*)malloc(sizeof(data));
      |                                                     ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:13:3: note:                 'typedef struct _str data'
   13 | } data;
      |   ^~~~
a.cc:48:58: error: expected primary-expression before ')' token
   48 |                                         memo->ll = (data*)malloc(sizeof(data));
      |                                                          ^
a.cc:64:53: error: reference to 'data' is ambiguous
   64 |                                         memo->rr = (data*)malloc(sizeof(data));
      |                                                     ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:13:3: note:                 'typedef struct _str data'
   13 | } data;
      |   ^~~~
a.cc:64:58: error: expected primary-expression before ')' token
   64 |                                         memo->rr = (data*)malloc(sizeof(data));
      |                                                          ^