Language: C

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

 int H[M];

 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[7];
       char moji[12];
 
       scanf("%d",&n);
       for(i=0;i<n;i++){
               scanf("%s%s",&com,&moji);
               if(com[0]=='i'){insert(moji);}
               else(com[0]=='f'){
                           if(search(moji)){printf("yes\n");}
                           else{printf("no\n");}
               }
       return 0;
       }









Compiler output:
main.c:8:6: error: conflicting types for 'getchar'; have 'int(char)'
    8 |  int getchar(char moji){
      |      ^~~~~~~
In file included from main.c:1:
/usr/include/stdio.h:582:12: note: previous declaration of 'getchar' with type 'int(void)'
  582 | extern int getchar (void);
      |            ^~~~~~~
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:34:32: error: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   34 |                     if(strcmp(H[h],moji)==0){return 1;}
      |                               ~^~~
      |                                |
      |                                int
main.c:34:32: note: expected 'const char *' but argument is of type 'int'
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:40: error: passing argument 1 of 'strlen' makes pointer from integer without a cast [-Wint-conversion]
   35 |                     else if(strlen(H[h]==0)){return 0;}
      |                                    ~~~~^~~
      |                                        |
      |                                        int
main.c:35:40: note: expected 'const char *' but argument is of type 'int'
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:32: error: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   45 |                     if(strcmp(H[h],moji)==0){return 1;}
      |                               ~^~~
      |                                |
      |                                int
main.c:45:32: note: expected 'const char *' but argument is of type 'int'
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:40: error: passing argument 1 of 'strlen' makes pointer from integer without a cast [-Wint-conversion]
   46 |                     else if(strlen(H[h]==0)){
      |                                    ~~~~^~~
      |                                        |
      |                                        int
main.c:46:40: note: expected 'const char *' but argument is of type 'int'
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:44: error: passing argument 1 of 'strcpy' makes pointer from integer without a cast [-Wint-conversion]
   47 |                                    strcpy(H[h],moji);
      |                                           ~^~~
      |                                            |
      |                                            int
main.c:47:44: note: expected 'char *' but argument is of type 'int'
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:62:39: error: passing argument 1 of 'insert' makes integer from pointer without a cast [-Wint-conversion]
   62 |                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){
      |             ~~~~~^~~~
main.c:63:33: error: expected ';' before '{' token
   63 |                else(com[0]=='f'){
      |                                 ^
      |                                 ;
main.c:68:8: error: expected declaration or statement at end of input
   68 |        }
      |        ^