Language: C++

#include <iostream>
#include <stdlib.h>

using namespace std;
int n = 0;
//??°??????????????§??£?¨????????????¨for???n???????????????????????£????????????
struct data {
    char key;
};
int getKey(char c)
{
    if ('A' == c) {
	return 1;
    } else if ('C' == c) {
	return 2;
    } else if ('G' == c) {
	return 3;
    } else if ('T' == c) {
	return 4;
    }
    return 0;
}
int h(char c[])
{
    int sum = 0;
    for (int i = 0; i < strlen(c); i++) {
	sum += getKey(c[i]);
    }

    return sum % 10465271;
}
void insert(char c[], data* t)
{
    data* d = (data*)malloc(sizeof(data));
    d->key = *c;
    t[h(c)] = *d;
}
void find(char c[], data* t)
{
    if (t[h(c)].key == *c) {
	cout << "yes" << endl;
    } else {
	cout << "no" << endl;
    }
}
int main()
{
    string INSERT = "insert";
    string FIND = "find";
    char command[6];
    char c[14];
    scanf("%d", &n);
    data* t = (data*)malloc(sizeof(data) * n);
    for (int i = 0; i < n; i++) {
	//	cin >> command;
	//	cin >> c;
	scanf("%s %s", command, c);
	if (INSERT == command) {
	    insert(c, t);
	}
	if (FIND == command) {
	    find(c, t);
	}
    }

    return 0;
}

Compiler output:
a.cc: In function 'int h(char*)':
a.cc:26:25: error: 'strlen' was not declared in this scope
   26 |     for (int i = 0; i < strlen(c); i++) {
      |                         ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <stdlib.h>
  +++ |+#include <cstring>
    3 | 
a.cc: At global scope:
a.cc:32:23: error: reference to 'data' is ambiguous
   32 | void insert(char c[], data* t)
      |                       ^~~~
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:7:8: note:                 'struct data'
    7 | struct data {
      |        ^~~~
a.cc:32:23: error: 'data' has not been declared
   32 | void insert(char c[], data* t)
      |                       ^~~~
a.cc: In function 'void insert(char*, int*)':
a.cc:34:5: error: reference to 'data' is ambiguous
   34 |     data* d = (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:7:8: note:                 'struct data'
    7 | struct data {
      |        ^~~~
a.cc:34:11: error: 'd' was not declared in this scope
   34 |     data* d = (data*)malloc(sizeof(data));
      |           ^
a.cc:34:16: error: reference to 'data' is ambiguous
   34 |     data* d = (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:7:8: note:                 'struct data'
    7 | struct data {
      |        ^~~~
a.cc:34:21: error: expected primary-expression before ')' token
   34 |     data* d = (data*)malloc(sizeof(data));
      |                     ^
a.cc: At global scope:
a.cc:38:21: error: reference to 'data' is ambiguous
   38 | void find(char c[], data* t)
      |                     ^~~~
/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:7:8: note:                 'struct data'
    7 | struct data {
      |        ^~~~
a.cc:38:21: error: 'data' has not been declared
   38 | void find(char c[], data* t)
      |                     ^~~~
a.cc: In function 'void find(char*, int*)':
a.cc:40:17: error: request for member 'key' in '*(t, (t + ((sizetype)(((long unsigned int)h(c)) * 4))))', which is of non-class type 'int'
   40 |     if (t[h(c)].key == *c) {
      |                 ^~~
a.cc: In function 'int main()':
a.cc:53:5: error: reference to 'data' is ambiguous
   53 |     data* t = (data*)malloc(sizeof(data) * n);
      |     ^~~~
/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:7:8: note:                 'struct data'
    7 | struct data {
      |        ^~~~
a.cc:53:11: error: 't' was not declared in this scope
   53 |     data* t = (data*)malloc(sizeof(data) * n);
      |           ^
a.cc:53:16: error: reference to 'data' is ambiguous
   53 |     data* t = (data*)malloc(sizeof(data) * n);
      |                ^~~~
/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:7:8: note:                 'struct data'
    7 | struct data {
      |        ^~~~
a.cc:53:21: error: expected primary-expression before ')' token
   53 |     data* t = (data*)malloc(sizeof(data) * n);
      |                     ^