Language: C

#include<stdio.h>
#include<stdlib.h>
#define M 1046527
#define NIL -1

 char H[M][14];

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

 long long getkey(char moji[]){
         long long i,sum=0,p=1;
         for(i=0;i<strlen(moji);i++){
                    sum+=p*getChar(moji[i]);
                    p*=5;
                   }
         return sum;
         }

 int h1(int key){return key%M;}

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

 int search(char moji[]){
            long long i,h,key;
            key=getkey(moji);
            for(i=0;;i++){
                    h=(h1(key)+i*h2(key))%M;
                    if(strcmp(H[h],moji)==0){return 1;}
                    else if(strlen(H[h])==0)){return 0;}
                    }
            return 0;
            }

 int insert(char moji){
            long long i,h,key;
            key=getkey(moji);
            for(i=0;;i++){
                    h=(h1(key)+i*h2(key))%M;
                    if(strcmp(H[h],moji)==0){return 1;}
                    else if(strlen(H[h])==0)){
                                   strcpy(H[h],moji);
                                   return 0;
                                   }
                    }
            return 0;
            }

 int main(){
       int n,i;
       char com[9];
       char moji[14];
 
       for(i=0;i<M;i++)H[i][0]='\0';
       scanf("%d",&n);
       for(i=0;i<n;i++){
               scanf("%s%s",&com,&moji); 

               if(com[0]=='i'){insert(moji);}

               else{
                    if(search(moji)){printf("yes\n");}
                    else{printf("no\n");}
                    }
               }
       return 0;
       }









Compiler output:
main.c: In function 'getkey':
main.c:18:20: error: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
   18 |          for(i=0;i<strlen(moji);i++){
      |                    ^~~~~~
main.c:3:1: note: include '<string.h>' or provide a declaration of 'strlen'
    2 | #include<stdlib.h>
  +++ |+#include <string.h>
    3 | #define M 1046527
main.c:18:20: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch]
   18 |          for(i=0;i<strlen(moji);i++){
      |                    ^~~~~~
main.c:18:20: note: include '<string.h>' or provide a declaration of 'strlen'
main.c: In function 'search':
main.c:34:24: error: implicit declaration of function 'strcmp' [-Wimplicit-function-declaration]
   34 |                     if(strcmp(H[h],moji)==0){return 1;}
      |                        ^~~~~~
main.c:34:24: note: include '<string.h>' or provide a declaration of 'strcmp'
main.c:35:29: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch]
   35 |                     else if(strlen(H[h])==0)){return 0;}
      |                             ^~~~~~
main.c:35:29: note: include '<string.h>' or provide a declaration of 'strlen'
main.c:35:45: error: expected statement before ')' token
   35 |                     else if(strlen(H[h])==0)){return 0;}
      |                                             ^
main.c: In function 'insert':
main.c:42:24: error: passing argument 1 of 'getkey' makes pointer from integer without a cast [-Wint-conversion]
   42 |             key=getkey(moji);
      |                        ^~~~
      |                        |
      |                        char
main.c:16:24: note: expected 'char *' but argument is of type 'char'
   16 |  long long getkey(char moji[]){
      |                   ~~~~~^~~~~~
main.c:45:36: error: passing argument 2 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   45 |                     if(strcmp(H[h],moji)==0){return 1;}
      |                                    ^~~~
      |                                    |
      |                                    char
main.c:45:36: note: expected 'const char *' but argument is of type 'char'
main.c:46:29: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch]
   46 |                     else if(strlen(H[h])==0)){
      |                             ^~~~~~
main.c:46:29: note: include '<string.h>' or provide a declaration of 'strlen'
main.c:46:45: error: expected statement before ')' token
   46 |                     else if(strlen(H[h])==0)){
      |                                             ^
main.c:47:36: error: implicit declaration of function 'strcpy' [-Wimplicit-function-declaration]
   47 |                                    strcpy(H[h],moji);
      |                                    ^~~~~~
main.c:47:36: note: include '<string.h>' or provide a declaration of 'strcpy'
main.c:47:36: warning: incompatible implicit declaration of built-in function 'strcpy' [-Wbuiltin-declaration-mismatch]
main.c:47:36: note: include '<string.h>' or provide a declaration of 'strcpy'
main.c:47:48: error: passing argument 2 of 'strcpy' makes pointer from integer without a cast [-Wint-conversion]
   47 |                                    strcpy(H[h],moji);
      |                                                ^~~~
      |                                                |
      |                                                char
main.c:47:48: note: expected 'const char *' but argument is of type 'char'
main.c: In function 'main':
main.c:64:39: error: passing argument 1 of 'insert' makes integer from pointer without a cast [-Wint-conversion]
   64 |                if(com[0]=='i'){insert(moji);}
      |                                       ^~~~
      |                                       |
      |                                       char *
main.c:40:18: note: expected 'char' but argument is of type 'char *'
   40 |  int insert(char moji){
      |             ~~~~~^~~~