Language: C++

#include <iostream>
#include <string.h>
#define M 1046527
define L 14

using namespace std;

char H[M][L]; /* Hash Table */

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
}

/* convert a string into an integer value */
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){
    return key % M;
}
int h2(int key){
    return 1 + (key % (M - 1)); 
}

bool find(char str[]){
    long long key = getKey(str), i = 0, j;
    while(1){
        j = h1(key) + i * h2(key) % M;
        if(strcmp(H[j], str) == 0) return true;
        else if(H[j][0] == '\0' || i >= M) return false;
        else i++;
    }
}

void insert(char str[]){
    long long key = getKey(str), i = 0, j;
    while(1){
        j = h1(key) + i * h2(key) % M;
        if(H[j][0] == '\0'){
            strcpy(H[j], str);
            return;
        }else if(strcmp(H[j], str) == 0){
            return; 
        }else{
            i++;
        }
    }
}

int main(){
    int i, n, h;
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i][0] = '\0';
    
    cin >> n;
    
    for ( i = 0; i < n; i++ ){
        cin >> com >> str;
        if ( com[0] == 'i' ){
                insert(str);
            } else {
                if (find(str)){
                    cout << "yes" << endl;
            } else {
                    cout << "no" << endl;
            }
            }
    }

    return 0;
}


Compiler output:
a.cc:4:1: error: 'define' does not name a type
    4 | define L 14
      | ^~~~~~
a.cc:8:11: error: 'L' was not declared in this scope
    8 | char H[M][L]; /* Hash Table */
      |           ^
a.cc: In function 'bool find(char*)':
a.cc:38:19: error: 'H' was not declared in this scope
   38 |         if(strcmp(H[j], str) == 0) return true;
      |                   ^
a.cc: In function 'void insert(char*)':
a.cc:48:12: error: 'H' was not declared in this scope
   48 |         if(H[j][0] == '\0'){
      |            ^
a.cc: In function 'int main()':
a.cc:61:14: error: 'L' was not declared in this scope
   61 |     char str[L], com[9];
      |              ^
a.cc:62:31: error: 'H' was not declared in this scope
   62 |     for ( i = 0; i < M; i++ ) H[i][0] = '\0';
      |                               ^
a.cc:64:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   64 |     cin >> n;
      |     ^~~
      |     std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:67:23: error: 'str' was not declared in this scope; did you mean 'std'?
   67 |         cin >> com >> str;
      |                       ^~~
      |                       std
a.cc:72:21: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   72 |                     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:72:38: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   72 |                     cout << "yes" << endl;
      |                                      ^~~~
      |                                      std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc:74:21: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   74 |                     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:74:37: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   74 |                     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: In function 'int getChar(char)':
a.cc:15:1: warning: control reaches end of non-void function [-Wreturn-type]
   15 | }
      | ^