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 make(struct _str *hoge)
{
	struct _str *_new;
	hoge = _new;
	cnt++;
}

int main() {
	long long int nn, res;
	cin >> nn;
	string tmp;
	cin >> tmp;
	data *root;
	make(root);
	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)
				{
					make(memo->ll);
					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)
				{
					make(memo->rr);
					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:27:9: error: reference to 'data' is ambiguous
   27 |         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:27:15: error: 'root' was not declared in this scope
   27 |         data *root;
      |               ^~~~
a.cc:29:17: error: reference to 'data' is ambiguous
   29 |         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:29:22: error: expected primary-expression before ')' token
   29 |         root = (data*)malloc(sizeof(data));
      |                      ^
a.cc:33:9: error: reference to 'data' is ambiguous
   33 |         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:33:15: error: 'memo' was not declared in this scope
   33 |         data *memo;
      |               ^~~~
a.cc:50:53: error: reference to 'data' is ambiguous
   50 |                                         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:50:58: error: expected primary-expression before ')' token
   50 |                                         memo->ll = (data*)malloc(sizeof(data));
      |                                                          ^
a.cc:66:53: error: reference to 'data' is ambiguous
   66 |                                         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:66:58: error: expected primary-expression before ')' token
   66 |                                         memo->rr = (data*)malloc(sizeof(data));
      |                                                          ^