criyle/codenet-compile-errors huggingface dataset:
Language: C

#include<stdio.h>
#include<string.h>

#define M 1046527
#define NIL -1
#define L 14

char A[M][L];

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

//key?????????
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));
}

int find(char str[]){
  long long key,i,h;
  key = getKey(str); //??????????????°???
  for(i=0 ; ; i++){
    h = (h1(key) + i*h2(key)) % M;
    if(strcmp(H[h],str) == 0) return 1;
    else if(strlen(H[h]) == 0) return 0;
  }
  return 0;
}

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

int main(){
  int i,n,h;
  char str[L], com[9];

  scanf("%d", &n);
  for (i=0 ; i<n ; i++) H[i][0] = '\0';

  for (i=0 ; i<n ; i++){
    scanf("%s %s",com,str);

    if (com[0] == 'i'){
      insert(str);
    }
    else {
      if(find(str)){
        printf("yes\n");
      }
      else {
        printf("no\n");
      }
    }
  }

  return 0;
}

Compiler output:
main.c: In function 'getChar':
main.c:12:6: error: 'ch' undeclared (first use in this function); did you mean 'c'?
   12 |   if(ch == 'A') return 1;
      |      ^~
      |      c
main.c:12:6: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'find':
main.c:41:15: error: 'H' undeclared (first use in this function)
   41 |     if(strcmp(H[h],str) == 0) return 1;
      |               ^
main.c: In function 'insert':
main.c:52:15: error: 'H' undeclared (first use in this function)
   52 |     if(strcmp(H[h],str) == 0) return 1;
      |               ^
main.c: In function 'main':
main.c:66:25: error: 'H' undeclared (first use in this function)
   66 |   for (i=0 ; i<n ; i++) H[i][0] = '\0';
      |                         ^
Language: C

#include<stdio.h>
#include<string.h>

#define M 1000003
#define L 14

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)); }

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

void insert(char str[]){
  int i = 0, j, key = getKey(str);
  do {
    j = (h1(key) + i * h2(key)) % M;
    i++;
  } while H[j][0] != '\0';
  for(i = 0; i < strlen(str); i++) H[j][i] = str[i];
}

int main(){
    int i, n, h;
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i][0] = '\0';
    
    scanf("%d", &n);
    
    for ( i = 0; i < n; i++ ){
	scanf("%s %s", com, str);
	
	if ( com[0] == 'i' ){
	    insert(str);
	} else {
	    if (find(str)){
		printf("yes\n");
	    } else {
		printf("no\n");
	    }
	}
    }

    return 0;
}

Compiler output:
main.c: In function 'insert':
main.c:46:11: error: expected '(' before 'H'
   46 |   } while H[j][0] != '\0';
      |           ^
      |           (
Language: C

#include<stdio.h>
#include<string.h>

#define M 105000
#define NIL (-1)
#define L 14

char H[M][L];

//?????? to ??°???
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;
	else return 0;
}

//?????????????????°????????? & key??????
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));
}

//?????????????´¢
int find(char str[]){
	long long key,i,h;
	key=getkey(str);
	for(i=0;;i++){
		h=(h1(key)+i*h2(key))%M;
		if(strcmp(H[h],str)==0) return 1;
		else if(strlen(H[h])==0) return 0;
	}
	return 0;
}

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

int main(){
	int i,n,h;
	char str[L],com[9];
	for(i=0;i<M;i++) H[i][0]='\0';
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s %s",com,str);
		if(com[0]=='i'){
			insert(str);
		}
		else{
			if(find(str)){
				printf("yes\n");
			}
			else
			printf("no\n");
		}
	}
	return 0;
}

Compiler output:
main.c:11:5: error: conflicting types for 'getchar'; have 'int(char)'
   11 | int getchar(char ch){
      |     ^~~~~~~
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);
      |            ^~~~~~~
Language: C

#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
using namespace std;
 
const long M = 1046527;
string H[M];
 
long getKey(string str){
    long sum = 0, p = 1, digit = 0;
    for (long i = 0; i < str.size(); i++){
        if (str[i] == 'A') digit = 1;
        else if (str[i] == 'C') digit = 2;
        else if (str[i] == 'G') digit = 3;
        else if (str[i] == 'T') digit = 4;
        else digit = 0;
        sum += p * digit;
        p *= 5;
    }
    return sum;
}
 
long h1(long key){return key % M;}
long h2(long key){return 1 + (key % (M - 1));}
 
long find(string str){
    long key = getKey(str);
    for (long i = 0; ; i++){
        long h = (h1(key) + i * h2(key)) % M;
        if (H[h] == str) return 1;
        else if (H[h].size() == 0) return 0;
    }
    return 0;
}
 
long insert(string str){
    long key = getKey(str);
    for (long i = 0; ; i++){
        long h = (h1(key) + i * h2(key)) % M;
        if (H[h] == str) return 1;
        else if (H[h].size() == 0){
            H[h] = str;
            return 0;
        }
    }
}
 
int main(){
    long n;
    string str, com;
    cin >> n;
    for (long 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:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include<stdio.h>
#include<string.h>

const int L = 14;
const int M = 1046527;

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)); }

int find(char str[]){
    long long key,i = 0;
    key = getKey(str);
    while(1)
    {
        int h = ( h1(key) + i*h2(key) ) % M;
        if(strcmp( H[h],str) == 0 ) return 1;
        else if(strlen(H[h]) == 0) return 0;
        i++; 
    }
    return 0;
}

void insert(char str[]){

    long long i = 0,key;
    key = getKey(str);
    while(1)
    {
        int h = ( h1(key) + i*h2(key) ) % M;
        if(strcmp(H[h],str) == 0 ) return ;
        else if(strlen(H[h]) == 0 )
        {
            strcpy(H[h],str);
            return ;
        }
        i++;
    }
    return ;
}

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

    for ( i = 0; i < n; i++ ){
        scanf(" %s %s", com, str);

    if ( com[0] == 'i' ){
        insert(str);
    } else {
        if (find(str)){
        printf("yes\n");
        } else {
        printf("no\n");
        }
    }
    }

    return 0;
}

Compiler output:
main.c:7:6: error: variably modified 'H' at file scope
    7 | char H[M][L]; /* Hash Table */
      |      ^
main.c:7:6: error: variably modified 'H' at file scope
Language: C

#include <iostream>
#include <cstdio>

const int MAX_KEY_LENGTH = 12;
const int N_KEY_CHARS = 4;

class Dict {
    int *KEYS;
    int char_to_id(char);
    int to_hash(char*);
    public:
        Dict();
        void insert(char*);
        bool has(char*);
};

Dict::Dict() {
    int max_hash = 0, w = 1;
    for (int i = 0; i < MAX_KEY_LENGTH; i++, w *= N_KEY_CHARS) {
        max_hash += N_KEY_CHARS * w;
    }
    KEYS = new int[max_hash + 1];
    std::fill_n(KEYS, max_hash, 0);
}

void Dict::insert(char *key) {
    KEYS[ to_hash(key) ] = true;
}

bool Dict::has(char *key) {
    return KEYS[ to_hash(key) ];
}

int Dict::char_to_id(char c) {
    switch (c) {
        case 'A': return 1;
        case 'C': return 2;
        case 'G': return 3;
        case 'T': return 4;
    }
    return 0;
}

int Dict::to_hash(char *key) {
    int hash = 0;
    int w = 1;
    for (int i = 0; key[i]; i++, w *= N_KEY_CHARS) {
        hash += w * char_to_id(key[i]);
    }
    return hash;
}

int main() {
    int n_ops;
    scanf("%d", &n_ops);

    Dict dict;
    char op[10], key[MAX_KEY_LENGTH + 1];

    for (int i = 0; i < n_ops; i++) {
        scanf("%s %s", op, key);
        switch (op[0]) {
            case 'i': // insert
                dict.insert(key);
                break;
            case 'f': // find
                puts( dict.has(key) ? "yes" : "no" );
                break;
        }
    }

    return 0;
}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

		hash = makehash(str);
		printf("%d\n",hash);
		if(strcmp(command,"find") == 0){
			find(hash);
		}else if(strcmp(command,"insert") == 0){
			insert(hash);
		}else{
			;
		}
	}
}

Compiler output:
main.c:1:17: warning: data definition has no type or storage class
    1 |                 hash = makehash(str);
      |                 ^~~~
main.c:1:17: error: type defaults to 'int' in declaration of 'hash' [-Wimplicit-int]
main.c:1:24: error: implicit declaration of function 'makehash' [-Wimplicit-function-declaration]
    1 |                 hash = makehash(str);
      |                        ^~~~~~~~
main.c:1:33: error: 'str' undeclared here (not in a function)
    1 |                 hash = makehash(str);
      |                                 ^~~
main.c:2:24: error: expected declaration specifiers or '...' before string constant
    2 |                 printf("%d\n",hash);
      |                        ^~~~~~
main.c:2:31: error: expected declaration specifiers or '...' before 'hash'
    2 |                 printf("%d\n",hash);
      |                               ^~~~
main.c:3:17: error: expected identifier or '(' before 'if'
    3 |                 if(strcmp(command,"find") == 0){
      |                 ^~
main.c:5:18: error: expected identifier or '(' before 'else'
    5 |                 }else if(strcmp(command,"insert") == 0){
      |                  ^~~~
main.c:7:18: error: expected identifier or '(' before 'else'
    7 |                 }else{
      |                  ^~~~
main.c:10:9: error: expected identifier or '(' before '}' token
   10 |         }
      |         ^
main.c:11:1: error: expected identifier or '(' before '}' token
   11 | }
      | ^
Language: C

#include <stdio.h>
#include <string.h>

#define STRLENHMAX		12
#define NMAX			1000000
#define	HASHTABLEMAX	STRLENMAX*NMAX
#define	EXIST			1
#define	NONE			0

char hashTable[HASHTABLEMAX];

void init(void){
	int i;
	for( i=0; i<HASHTABLEMAX; i++){
		hashTable[i] = NONE;
	}
}

int makehash(char *str){
	int i;
	int hash;
	int code;
	
	i = 0;
	hash = 0;
	code = 0;
	while(str[i] != '\0'){
		hash <<= 2;
		switch(str[i]){
			case 'A':
				code = 0b0001;
				break;
			case 'C':
				code = 0b0010;
				break;
			case 'G':
				code = 0b0100;
				break;
			case 'T':
				code = 0b1000;
				break;
			default:
				break;
		}
		hash += code;
		i++;
	}
	return hash;
}

void find(int hash){
	if(hashTable[hash] == EXIST){
		printf("yes\n");
	}else{
		printf("no\n");
	}
}

void insert(int hash){
	hashTable[hash] = EXIST;
}

int main(void){
	int i;
	int n;
	int hash;
	int length;
	char command[7];
	char str[13];
	
	init();
	scanf("%d",&n);
	for( i=0; i<n; i++){
		scanf("%s",command);
		scanf("%s",str);
		hash = makehash(str);
		printf("%d\n",hash);
		if(strcmp(command,"find") == 0){
			find(hash);
		}else if(strcmp(command,"insert") == 0){
			insert(hash);
		}else{
			;
		}
	}
}

Compiler output:
main.c:6:25: error: 'STRLENMAX' undeclared here (not in a function); did you mean 'STRLENHMAX'?
    6 | #define HASHTABLEMAX    STRLENMAX*NMAX
      |                         ^~~~~~~~~
main.c:10:16: note: in expansion of macro 'HASHTABLEMAX'
   10 | char hashTable[HASHTABLEMAX];
      |                ^~~~~~~~~~~~
Language: C

#include <stdio.h>
#include <string.h>

#define	HASHTABLEMAX	16777216

unsigned short hashTable[HASHTABLEMAX];

void init(void){
	unsigned int i;
	for( i=0; i<HASHTABLEMAX; i++){
		hashTable[i] = 0;
	}
}

unsigned int makehash(char *str,unsigned int length){
	unsigned int i;
	unsigned int hash;
	unsigned int code;
	
	hash = 0;
	code = 0;
	for( i=0; i<length; i++){
		switch(str[i]){
			case 'A':
				code = 0b00;
				break;
			case 'C':
				code = 0b01;
				break;
			case 'G':
				code = 0b10;
				break;
			case 'T':
				code = 0b11;
				break;
			default:
				break;
		}
		hash <<= 2;
		hash += code;
	}
	return hash;
}

void find(unsigned int hash,unsigned int length){
	unsigned short lengthBit;
	lengthBit = 1 << (length - 1);
	if(hashTable[hash] & lengthBit){
		printf("yes\n");
	}else{
		printf("no\n");
	}
}

void insert(unsigned int hash,unsigned int length){
	unsigned short lengthBit;
	lengthBit = 1 << (length - 1);
	hashTable[hash] = hashTable[hash] | lengthBit;
}

int main(void){
	unsigned int i;
	unsigned int n;
	unsigned int hash;
	unsigned int length;
	char command[7];
	char str[13];
	
	init();
	scanf("%d",&n);
	for( i=0; i<n; i++){
		scanf("%s",command);
		scanf("%s",str);
		length = strlen(str);
		hash = makehash(str,lenght);
		if(strcmp(command,"find") == 0){
			find(hash,length);
		}else if(strcmp(command,"insert") == 0){
			insert(hash,length);
		}else{
			;
		}
	}
}

Compiler output:
main.c: In function 'main':
main.c:75:37: error: 'lenght' undeclared (first use in this function); did you mean 'length'?
   75 |                 hash = makehash(str,lenght);
      |                                     ^~~~~~
      |                                     length
main.c:75:37: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
#include<string.h>

#define M1046527
#define NIL (-1)
#define L 14

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;
  else return 0;
}

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));}

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

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

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

    if(com[0]=='i'){
      insert(str);
    }else{
      if(find(str)){
        printf("yes\n");
      }else{
        printf("no\n");
      }
    }
  }
  return 0;
}

Compiler output:
main.c: In function 'h1':
main.c:25:28: error: 'M' undeclared (first use in this function)
   25 | int h1(int key){return key%M;}
      |                            ^
main.c:25:28: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'h2':
main.c:26:32: error: 'M' undeclared (first use in this function)
   26 | int h2(int key){return 1+(key%(M-1));}
      |                                ^
main.c: In function 'find':
main.c:32:27: error: 'M' undeclared (first use in this function)
   32 |     h=(h1(key)+i*h2(key))%M;
      |                           ^
main.c:33:15: error: 'H' undeclared (first use in this function)
   33 |     if(strcmp(H[h],str)==0)return 1;
      |               ^
main.c:36:11: error: expected ';' before '}' token
   36 |   return 0
      |           ^
      |           ;
   37 | }
      | ~          
main.c: In function 'insert':
main.c:43:27: error: 'M' undeclared (first use in this function)
   43 |     h=(h1(key)+i*h2(key))%M;
      |                           ^
main.c:44:15: error: 'H' undeclared (first use in this function)
   44 |     if(strcmp(H[h],str)==0) return 1;
      |               ^
main.c: In function 'main':
main.c:56:13: error: 'M' undeclared (first use in this function)
   56 |   for(i=0;i<M;i++)H[i][0]='\0';
      |             ^
main.c:56:19: error: 'H' undeclared (first use in this function)
   56 |   for(i=0;i<M;i++)H[i][0]='\0';
      |                   ^
Language: C

#include<stdio.h>
#include<string.h>
#define MAX 100000

typedef struct word{

 char str[13];
 int num;

}word;



int find(word word[],char temp[],int last){
int i;

for(i=0;i<last;i++){
 if((word[i].num==-1)&&(word[i].num[0]==temp[0])){
  if(strcmp(word[i].str,temp)==0){return 1;}
 }
}
return 0;
}
 






int main(){
int n,i;
int A[MAX]={0};
char com[10];
char temp[13];
word word[MAX];

scanf("%d",&n);



for(i=0;i<n;i++){
 scanf("%s",com);
 switch(com[0]){
  case 'i':scanf("%s",&word[i].str);
           word[i].num=-1;
           break;
  case 'f':scanf("%s",temp);
           word[i].num=find(word,temp,i);
           break;
 }
}



for(i=0;i<n;i++){
 switch(word[i].num){
  case 1:printf("yes\n");
         break;
  case 0:printf("no\n");
         break;
 }
}



return 0;
}


Compiler output:
main.c: In function 'find':
main.c:18:36: error: subscripted value is neither array nor pointer nor vector
   18 |  if((word[i].num==-1)&&(word[i].num[0]==temp[0])){
      |                                    ^
Language: C

#include<stdio.h>
#include<string.h>
#define MAX 10000

typedef struct word{

 char str[13];
 int num;

}word;



int find(word word[],char temp[],int last){
int i;

for(i=0;i<last;i++){
 if((word[i].num==-1)&&(word[i].num[0]==temp[0])){
  if(strcmp(word[i].str,temp)==0){return 1;}
 }
}
return 0;
}
 






int main(){
int n,i;
int A[MAX]={0};
char com[10];
char temp[13];
word word[MAX];

scanf("%d",&n);



for(i=0;i<n;i++){
 scanf("%s",com);
 switch(com[0]){
  case 'i':scanf("%s",&word[i].str);
           word[i].num=-1;
           break;
  case 'f':scanf("%s",temp);
           word[i].num=find(word,temp,i);
           break;
 }
}



for(i=0;i<n;i++){
 switch(word[i].num){
  case 1:printf("yes\n");
         break;
  case 0:printf("no\n");
         break;
 }
}



return 0;
}


Compiler output:
main.c: In function 'find':
main.c:18:36: error: subscripted value is neither array nor pointer nor vector
   18 |  if((word[i].num==-1)&&(word[i].num[0]==temp[0])){
      |                                    ^
Language: C

#include <stdio.h>
#include <string.h>
#define h1(key) (key%M)
#define h2(key) (1+(key%(M-1)))

#define M 1046527
#define L 12

char H[M][L];
int n;

int charToInt(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;
  } else {
    return 0;
  }
}

long long getKey(char str[]) {
  long long key = 0;
  for (int i = 0; i < strlen(str); i++) {
    key += charToInt(str[i]);
  }
  return key;
}

long long getHash(long long key, int i) {
  return (h1(key) + i * h2(key)) % M;;
}

int insert(char str[]) {
  long long key = 0;
  long long h = 0;
  key = getKey(str);
  for (int i = 0; ; i++) {
    h = getHash(key, i);
    if (strlen(H[h])  == 0) {
      strcpy(H[h], str);
      break;
    }
  }
  return 0;
}

int find(char str[]) {
  long long key = 0;
  long long h = 0;
  key = getKey(str);
  for (int i = 0; ; i++) {
    h = getHash(key, i);
    if (strcmp(H[h], str) == 0) {
      return 1;
    } else if (strlen(H[h]) == 0) {
      return 0;
    }
  }
  return 0;
}

int main() {
  char str[12], com[5];

  scanf("%d\n", &n);

  for (int i = 0; i < n; i++) {
    scanf("%s %s", com, str);
    if (com[0] == 'i') {
      insert(str);
    } else {
      if (find(str)) {
        printf("%s\n", "yes");
      } else {
        printf("%s\n", "no");
      }
      j++;
    }
  }
  return 0;
}



Compiler output:
main.c: In function 'main':
main.c:82:7: error: 'j' undeclared (first use in this function)
   82 |       j++;
      |       ^
main.c:82:7: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
#include<string.h>

#define M 1000001
#define L 14

char H[M][L]; /* Hash Table */
typedef long long ll;

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;
}

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));
}

int find(char str[])
{
	ll key = 0, i = 0, l = 0;
	key = getKey(str);
	while (true)
	{
		l = (h1(key) + i*h2(key)) % M;
		if (strcmp(H[l], str)==0)
		{
			return 1;
		}
		else if (strlen(H[l]) == 0)
		{
			return 0;
		}
		i++;
	}
}

int insert(char str[])
{
	ll key = 0, i = 0, l = 0;
	key = getKey(str);
	while (true)
	{
		l = (h1(key) + i*h2(key)) % M;
		if (strcmp(H[l], str)==0)
		{
			return 0;
		}
		else if (strlen(H[l]) == 0)
		{
			strcpy(H[l], str);
			return 1;
		}
		i++;
	}
}

int main()
{
	int i, n, h;
	char str[L], com[9];
	for (i = 0; i < M; i++) H[i][0] = '\0';
	scanf("%d", &n);
	for (i = 0; i < n; i++)
	{
		scanf("%s %s", com, str);
		if (com[0] == 'i')
		{
			insert(str);
		}
		else
		{
			if (find(str))
			{
				printf("yes\n");
			}
			else
			{
				printf("no\n");
			}
		}
	}
	return 0;
}


Compiler output:
main.c: In function 'find':
main.c:43:16: error: 'true' undeclared (first use in this function)
   43 |         while (true)
      |                ^~~~
main.c:3:1: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
    2 | #include<string.h>
  +++ |+#include <stdbool.h>
    3 | 
main.c:43:16: note: each undeclared identifier is reported only once for each function it appears in
   43 |         while (true)
      |                ^~~~
main.c: In function 'insert':
main.c:62:16: error: 'true' undeclared (first use in this function)
   62 |         while (true)
      |                ^~~~
main.c:62:16: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
Language: C

// AOJ ALDS1_4_C Dictionary
// 2018.4.27 bal4u

#include <stdio.h>

// バッファを経ずstdinから数値を得る
#if 1
#define gc() getchar_unlocked()
#define Pc(c) putchar_unlocked(c)
#else
#define gc() getchar()
#define pc(c) putchar(c)
#endif
int in()
{
	int n = 0, c = gc();
	do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

int  tr['T'+1];
char f[33554432];

int main()
{
	int n, k, c;

	tr['A'] = 0, tr['C'] = 1, tr['G'] = 2, tr['T'] = 3;
	n = in();
	while (n--) {
		if (gc() == 'i') {
			k = 7; while (--k) gc();
			k++; while ((c = gc()) >= ' ') k <<= 2, k |= tr[c];
			f[k] = 1;
		} else {
			k = 5; while (--k) gc();
			k++; while ((c = gc()) >= ' ') k <<= 2, k |= tr[c];
			if (f[k]) pc('y'), pc('e'), pc('s');
			else      pc('n'), pc('o');
			pc('\n');
		}
	}
	return 0;
}



Compiler output:
main.c: In function 'main':
main.c:38:35: error: implicit declaration of function 'pc'; did you mean 'Pc'? [-Wimplicit-function-declaration]
   38 |                         if (f[k]) pc('y'), pc('e'), pc('s');
      |                                   ^~
      |                                   Pc
Language: C

#include<stdio.h>
#include<string.h>

#define M 1046527
#define NIL (-1)
#define L 14

char H[M][L];

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;
  else return 0;
}

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));}

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

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


int main(){
  int i,n,h;
  char str[L],com[9];
  for(i=0;i<M;i++) H[i][0]='\0'
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s %s",com,str);
    if(com[0]=='i'){
      insert(str);
    }else{
      if(find(str)){
	printf("yes\n");
      }else{
	printf("no\n");
      }
    }
  }
  return 0;
}



Compiler output:
main.c:10:5: error: conflicting types for 'getchar'; have 'int(char)'
   10 | int getchar(char ch){
      |     ^~~~~~~
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 'main':
main.c:60:32: error: expected ';' before 'scanf'
   60 |   for(i=0;i<M;i++) H[i][0]='\0'
      |                                ^
      |                                ;
   61 |   scanf("%d",&n);
      |   ~~~~~
Language: C

#include<stdio.h>
#include<string.h>

#define M 1046527
#define NIL (-1)
#define L 14

char H[M][L];

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;
  else return 0;
}

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));}

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

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


int main(){
  int i,n,h;
  char str[L],com[9];
  for(i=0;i<M;i++) H[i][0]='\0'
;  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s %s",com,str);
    if(com[0]=='i'){
      insert(str);
    }else{
      if(find(str)){
	printf("yes\n");
      }else{
	printf("no\n");
      }
    }
  }
  return 0;
}




Compiler output:
main.c:10:5: error: conflicting types for 'getchar'; have 'int(char)'
   10 | int getchar(char ch){
      |     ^~~~~~~
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);
      |            ^~~~~~~
Language: C

#include <stdio.h>
#include <string.h>

// positive only
int get_int() {
    int n = 0;
    int c = getchar_unlocked();
    if(c < 48 || 57 < c) return -1;
    while(47 < c && c < 58) {
        n = 10 * n + (c & 0xf);
        c = getchar_unlocked();
    }
    return n;
}
int get_str(char *str) {
    int c = getchar_unlocked();
    if(c == -1) return -1;
    while(c > 32) {
        *str++ = (char)c;
        c = getchar_unlocked();
    }
    *str = 0;
    return 0;
}

// prime number
#define M 49762109
char dic[M][13];

// base: 5
int str_key(char *str){
    int key = 0;
    for(int i = 1; *str; i*=5) {
        switch(*str++) {
            case 'A': key += 1 * i;
                      break;
            case 'C': key += 2 * i;
                      break;
            case 'G': key += 3 * i;
                      break;
            case 'T': key += 4 * i;
                      brerak;
            defaut: break;
        }
    }
    return key;
}

#define hash_key(k) ((k) % M)
#define hash_alt(k) (1 + ((k) % (M - 1)))
#define hash(k, i) ((hash_key(k) + (i) * hash_alt(k)) % M)
int dic_find(char *str){
    int key = str_key(str);
    size_t len = strlen(str);
    int hash;
    for(int i = 0;; ++i) {
        hash = hash(key, i);
        // found
        if(strlen(dic[hash]) == len && strncmp(dic[hash], str, len) == 0) return 1;
        // not exist
        if(strlen(dic[hash]) == 0) return 0;
        // else: found other key
    }
}
void dic_insert(char *str){
    int key = str_key(str);
    size_t len = strlen(str);
    int hash;
    for(int i = 0;; ++i) {
        hash = hash(key, i);
        // already exist
        if(strlen(dic[hash]) == len && strncmp(dic[hash], str, len) == 0) return;
        // insert
        if(strlen(dic[hash]) == 0){
            strcpy(dic[hash], str);
            return;
        }
        // else: hash used by other key
    }
}

int main(int argc, char **argv) {
    int n = get_int();
    char c[13];
    for(int i = 0; i < n; ++i) {
        get_str(c);
        if(*c == 'i') {
            get_str(c);
            dic_insert(c);
        } else {
            get_str(c);
            if(dic_find(c)) puts("yes");
            else puts("no");
        }
    }
    return 0;
}




Compiler output:
main.c: In function 'str_key':
main.c:42:23: error: 'brerak' undeclared (first use in this function)
   42 |                       brerak;
      |                       ^~~~~~
main.c:42:23: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
#include<string.h>
#define M 1000000
#define L 14

char H[M][L];
int size=0;

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;
}

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 ; }
int h2(int key){ return ; }


int find(char str[]){
  int i;
  for(i=0;i<size;i++){
    if(strcmp(str,H[i])== 0) return 1;
    else(strcmp(str,H[size-i])==0) return 1;
  }
}

int insert(char str[]){
  strcpy(H[size],str);
  size++;
  return 0;
}

int main(){
    int i, n, h;
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i][0] = '\0';
    
    scanf("%d", &n);
    
    for ( i = 0; i < n; i++ ){
	scanf("%s %s", com, str);
	
	if ( com[0] == 'i' ){
	    insert(str);
	} else {
	    if (find(str)){
		printf("yes\n");
	    } else {
		printf("no\n");
	    }
	}
    }

    return 0;
}



Compiler output:
main.c: In function 'h1':
main.c:26:18: error: 'return' with no value, in function returning non-void [-Wreturn-mismatch]
   26 | int h1(int key){ return ; }
      |                  ^~~~~~
main.c:26:5: note: declared here
   26 | int h1(int key){ return ; }
      |     ^~
main.c: In function 'h2':
main.c:27:18: error: 'return' with no value, in function returning non-void [-Wreturn-mismatch]
   27 | int h2(int key){ return ; }
      |                  ^~~~~~
main.c:27:5: note: declared here
   27 | int h2(int key){ return ; }
      |     ^~
main.c: In function 'find':
main.c:34:35: error: expected ';' before 'return'
   34 |     else(strcmp(str,H[size-i])==0) return 1;
      |                                   ^~~~~~~
      |                                   ;
Language: C

#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#define C 4
#define N 244140625
#define S 13

char H[N][S];

init(){
  int i;
  for(i=0; i<N; i++){
    H[i][0] = '\0';
  }
}

int getNum(char *str){
  switch (str[0]) {
    case 'A': return 1;
    case 'C': return 2;
    case 'G': return 3;
    case 'T': return 4;
    default :
    printf("INPUT ERROR\n");
    exit(0);
  }
}

// convert character string to Quintuple
int convertCtoI(char *str){
  int i, sum=0, p=1;
  for(i=0; i<strlen(str); i++){
    sum += p * getNum(str[i]);
    p *= 5;
  }
  return sum;
}

void insert(char *str){
  strcpy(H[convertCtoI(str)], str);
}

int find(char *str){
  if(!strcmp(dic[convertCtoI(str)],str))  return 1;
  else return 0;
}

int main(){
  int i,n;
  char str[13], command[7];

  init();

  scanf("%d",&n);
  for(i=0; i<n; i++){
    scanf("%s %s",command, str);
    if(!strcmp(command, "insert")){
      //printf("insert\n");
      insert(str);
    }
    else if(!strcmp(command, "find")){
      //printf("find\n");
      if(find(str)){
        printf("yes\n");
      }
      else printf("no\n");
    }
  }

  return 0;
}



Compiler output:
main.c:11:1: error: return type defaults to 'int' [-Wimplicit-int]
   11 | init(){
      | ^~~~
main.c: In function 'convertCtoI':
main.c:34:26: error: passing argument 1 of 'getNum' makes pointer from integer without a cast [-Wint-conversion]
   34 |     sum += p * getNum(str[i]);
      |                       ~~~^~~
      |                          |
      |                          char
main.c:18:18: note: expected 'char *' but argument is of type 'char'
   18 | int getNum(char *str){
      |            ~~~~~~^~~
main.c: In function 'find':
main.c:45:14: error: 'dic' undeclared (first use in this function); did you mean 'div'?
   45 |   if(!strcmp(dic[convertCtoI(str)],str))  return 1;
      |              ^~~
      |              div
main.c:45:14: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#define n_max 1000000

int main(){
  int n,i,j=0,k,F,len1,len2,l;
  char st[n_max][12],c1[n_max][12],c2[n_max][12];
  
  scanf("%d",&n);
  
  for(i=0;i<n;i++)
    scanf("%s %s",&c1[i],&c2[i]);
  
  for(i=0;i<n;i++){
    if(c1[i][0]=='i'){
      strcpy(st[j],c2[i]);
      j++;
    }
    else if(c1[i][0]=='f'){
      F=0;
      for(k=0;k<j;k++){
	len1=strlen(st[k]);
	len2=strlen(c2[i]);
	if(len1!=len2)break;
	for(l=0;l<len1;l++){
	  if(st[k][l]!=c2[i][l])break;
	  if(l==len1-2)
	    {printf("yes\n");
	      F=1;
	      break;
	    }
	}
	if(F==0) printf("no\n");
      }
    }
    return 0;
  }



Compiler output:
main.c: In function 'main':
main.c:39:3: error: expected declaration or statement at end of input
   39 |   }
      |   ^
Language: C

#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#define n_max 1000000

int main(){
  int n,i,j=0,k,F,len1,len2,l;
  char st[n_max][12],c1[n_max][12],c2[n_max][12];
  
  scanf("%d",&n);
  
  for(i=0;i<n;i++)
    scanf("%s %s",&c1[i],&c2[i]);
  
  for(i=0;i<n;i++){
    if(c1[i][0]=='i'){
      strcpy(st[j],c2[i]);
      j++;
    }
    else if(c1[i][0]=='f'){
      F=0;
      for(k=0;k<j;k++){
	len1=strlen(st[k]);
	len2=strlen(c2[i]);

	if(len1!=len2){
	  F=1;
	  break;
	}
	for(l=0;l<len1;l++){
	  if(st[k][l]!=c2[i][l]){
	    F=1;
	    break;
	  }
	  if(l==len1-1){	    {
	      printf("yes\n");
	      F=1;
	      break;
	    }
	}
      }
      if(F==0) printf("no\n");
    }
  }
  return 0;
}



Compiler output:
main.c: In function 'main':
main.c:47:1: error: expected declaration or statement at end of input
   47 | }
      | ^
Language: C

#include<stdio.h>
#include<string.h>

#define M 1000000
#define L 14

char H[M][L];
int cnt=0;

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 ?;
}
int h2(int key){
  return ?;
}


int find(char str[]){
  int i;
  long long hi = getKey(str):
  for(i=0; i<cnt; i++){
    if(strlen(str) != strlen(H[i])) continue;
    if(getKey(H[i]) == hi) return 1;
  }
  return 0;
}

int insert(char str[]){
  strcpy(H[cnt], str);
  cnt++;
}

int main(){
  int i, n, h;
  char str[L], com[9];
  for ( i = 0; i < M; i++ ) H[i][0] = '\0'; // 初期化
    
  scanf("%d", &n);
  for ( i = 0; i < n; i++ ){
    scanf("%s %s", com, str);
	
    if(com[0] == 'i'){
      insert(str);
    } else {
      if(find(str)){
	printf("yes\n");
      } else {
	printf("no\n");
      }
    }
  }

  return 0;
}



Compiler output:
main.c: In function 'h1':
main.c:29:10: error: expected expression before '?' token
   29 |   return ?;
      |          ^
main.c: In function 'h2':
main.c:32:10: error: expected expression before '?' token
   32 |   return ?;
      |          ^
main.c: In function 'find':
main.c:38:29: error: expected ',' or ';' before ':' token
   38 |   long long hi = getKey(str):
      |                             ^
main.c:39:22: error: expected ';' before ')' token
   39 |   for(i=0; i<cnt; i++){
      |                      ^
      |                      ;
main.c:39:22: error: expected statement before ')' token
main.c:40:37: error: continue statement not within a loop
   40 |     if(strlen(str) != strlen(H[i])) continue;
      |                                     ^~~~~~~~
Language: C

#include<stdio.h>
#include<string.h>

#define M 1000000
#define L 14

char H[M][L];
int cnt=0;

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 ?;
}
int h2(int key){
  //return ?;
}


int find(char str[]){
  int i;
  long long hi = getKey(str):
  for(i=0; i<cnt; i++){
    if(strlen(str) != strlen(H[i])) continue;
    if(getKey(H[i]) == hi) return 1;
  }
  return 0;
}

int insert(char str[]){
  strcpy(H[cnt], str);
  cnt++;
}

int main(){
  int i, n, h;
  char str[L], com[9];
  for ( i = 0; i < M; i++ ) H[i][0] = '\0'; // 初期化
    
  scanf("%d", &n);
  for ( i = 0; i < n; i++ ){
    scanf("%s %s", com, str);
	
    if(com[0] == 'i'){
      insert(str);
    } else {
      if(find(str)){
	printf("yes\n");
      } else {
	printf("no\n");
      }
    }
  }

  return 0;
}



Compiler output:
main.c: In function 'find':
main.c:38:29: error: expected ',' or ';' before ':' token
   38 |   long long hi = getKey(str):
      |                             ^
main.c:39:22: error: expected ';' before ')' token
   39 |   for(i=0; i<cnt; i++){
      |                      ^
      |                      ;
main.c:39:22: error: expected statement before ')' token
main.c:40:37: error: continue statement not within a loop
   40 |     if(strlen(str) != strlen(H[i])) continue;
      |                                     ^~~~~~~~
Language: C

#include<stdio.h>
#include<string.h>
#define M /* your task*/1000000
#define L 14

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(long long key){ return /* your task */key%M;}
int h2(long long key){ return /* your task */1+key%(M-1);}
int h(long long key,int i){return (h1(key)+i*h2(key))%M;}

int find(char str[]){

  /* your task */
  int i=0,j;
  while(1){
    j=h((getKey(str),i);
    if(strcmp(H[j],str)==0){
      return 1;
    }
    else if(H[j][0]=='\0'|| i>=M){
      return 0;
    }
    else{
      i++;
    }
  }
  return 0;

}

void insert(char str[]){

  /* your task */
  int i=0,j;
  while(1){
    j=h((getKey(str),i);
    if(H[j][0]=='\0'){
      strcpy(H[j],str);
      return;
    }
    else{
      i++;
    }
  }
  return;
}

int main(){
    int i, n, h;
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i][0] = '\0';
    
    scanf("%d", &n);
    
    for ( i = 0; i < n; i++ ){
	scanf("%s %s", com, str);
	
	if ( com[0] == 'i' ){
	    insert(str);
	} else {
	    if (find(str)){
		printf("yes\n");
	    } else {
		printf("no\n");
	    }
	}
    }

    return 0;
}



Compiler output:
main.c: In function 'find':
main.c:34:24: error: expected ')' before ';' token
   34 |     j=h((getKey(str),i);
      |        ~               ^
      |                        )
main.c:34:7: error: too few arguments to function 'h'
   34 |     j=h((getKey(str),i);
      |       ^
main.c:27:5: note: declared here
   27 | int h(long long key,int i){return (h1(key)+i*h2(key))%M;}
      |     ^
main.c:43:6: error: expected ';' before '}' token
   43 |     }
      |      ^
      |      ;
   44 |   }
      |   ~   
main.c: In function 'insert':
main.c:54:24: error: expected ')' before ';' token
   54 |     j=h((getKey(str),i);
      |        ~               ^
      |                        )
main.c:54:7: error: too few arguments to function 'h'
   54 |     j=h((getKey(str),i);
      |       ^
main.c:27:5: note: declared here
   27 | int h(long long key,int i){return (h1(key)+i*h2(key))%M;}
      |     ^
main.c:61:6: error: expected ';' before '}' token
   61 |     }
      |      ^
      |      ;
   62 |   }
      |   ~
Language: C

#include<stdio.h>
#include<string.h>
#define M /* your task*/1000000
#define L 14

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 */
int getKey(char str[]){
  int 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 /* your task */key%M;}
int h2(int key){ return /* your task */1+key%(M-1);}
int h(int key,int i){return (h1(key)+i*h2(key))%M;}

int find(char str[]){

  /* your task */
  int i=0,j;
  while(1){
    j=h((getKey(str),i);
    if(strcmp(H[j],str)==0){
      return 1;
    }
    else if(H[j][0]=='\0'|| i>=M){
      return 0;
    }
    else{
      i++;
    }
  }
  return 0;

}

void insert(char str[]){

  /* your task */
  int i=0,j;
  while(1){
    j=h((getKey(str),i);
    if(H[j][0]=='\0'){
      strcpy(H[j],str);
      return;
    }
    else{
      i++;
    }
  }
  return;
}

int main(){
    int i, n, h;
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i][0] = '\0';
    
    scanf("%d", &n);
    
    for ( i = 0; i < n; i++ ){
	scanf("%s %s", com, str);
	
	if ( com[0] == 'i' ){
	    insert(str);
	} else {
	    if (find(str)){
		printf("yes\n");
	    } else {
		printf("no\n");
	    }
	}
    }

    return 0;
}



Compiler output:
main.c: In function 'find':
main.c:34:24: error: expected ')' before ';' token
   34 |     j=h((getKey(str),i);
      |        ~               ^
      |                        )
main.c:34:7: error: too few arguments to function 'h'
   34 |     j=h((getKey(str),i);
      |       ^
main.c:27:5: note: declared here
   27 | int h(int key,int i){return (h1(key)+i*h2(key))%M;}
      |     ^
main.c:43:6: error: expected ';' before '}' token
   43 |     }
      |      ^
      |      ;
   44 |   }
      |   ~   
main.c: In function 'insert':
main.c:54:24: error: expected ')' before ';' token
   54 |     j=h((getKey(str),i);
      |        ~               ^
      |                        )
main.c:54:7: error: too few arguments to function 'h'
   54 |     j=h((getKey(str),i);
      |       ^
main.c:27:5: note: declared here
   27 | int h(int key,int i){return (h1(key)+i*h2(key))%M;}
      |     ^
main.c:61:6: error: expected ';' before '}' token
   61 |     }
      |      ^
      |      ;
   62 |   }
      |   ~
Language: C

#include<stdio.h>
#include<string.h>
#define M 1000000
#define L 14

char H[M][L];
int size=0;

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;
}

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);}

float find(char str[]){
  int i;
  long long key = getKey(str);
  long long hash;
  for(i=0;;i++){
    hash = (h1(key) + i*  h2(key)) % M;
    if(strcmp(H[hash],str)==0) return 1;
      else if(strlen(H[hash])==0){
      strcpy(H[hash],str);
      return 0;
    }
  }
}

int main(){
    int i, n, h;
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i][0] = '\0';

    scanf("%d", &n);

    for ( i = 0; i < n; i++ ){
        scanf("%s %s", com, str);

        if ( com[0] == 'i' ){
            insert(str);
        } else {
            if (find(str)){
                printf("yes\n");
            } else {
                printf("no\n");
            }
        }
    }

    return 0;
}



Compiler output:
main.c: In function 'main':
main.c:53:13: error: implicit declaration of function 'insert' [-Wimplicit-function-declaration]
   53 |             insert(str);
      |             ^~~~~~
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAXDEC 12

char dec[1000000][MAXDEC];
int no=0;

int find(char *str){
  int i;
  for(i=0; i<no; i++){
    //printf("Compare %s & %s\n",str,dec[i]);
    if(0==strcmp(dec[i],str)){
      return 1;
    }
  }
  return 0;
}
void insert(char *in){
  strcpy(dec[no],in);
  //printf("inserted dec[%d]-->%s\n",no,dec[no] );
  no++;
}
int main() {
    int n;
    int i;
    char com[9];
    char str[MAXDEC];

    scanf("%d",&n);

    for(i=0; i<n; i++){
      scanf("%s %s",com,str);
      //printf("%s %s\n",com,str);
      if (com[0]=='i') {
        insert(str);
      }else if (com[0]=='f') {
        if(1==find(str)){
          printf("yes\n");
        }else printf("no\n");
      }else printf("Command is illegal\n");
    }
  free(dec)
  return 0;
}



Compiler output:
main.c: In function 'main':
main.c:44:12: error: expected ';' before 'return'
   44 |   free(dec)
      |            ^
      |            ;
   45 |   return 0;
      |   ~~~~~~
Language: C

#include<stdio.h>
#include<string.h>

#define L 12
#define N 100000
int main(void){

  char Order[N][2];
  char Lib[N];
  int n,i,j;
  int c=0;

  scanf("%d",&n);

  for(i=0;i<n;i++){

    scanf("%s%s",Order[i][0], Order[i][1]);
    if((strcmp(Order[i][0], "insert")==0){
        Lib[c] = Order[i][1];
        c++;
      }

      else if((strcmp(Order[i][0], "find")==0){

          for(j=0;j<c;j++){

            if((strcmp(Order[i][1], Lib[j])==0)){
              printf("yes\n");
              break;
            }

            else if(j==c-1&&(strcmp(Order[i][1], Lib[j])!=0){
                printf("no\n");
                break;
            }
              else continue;
          }
      }

          return 0;
  }


Compiler output:
main.c: In function 'main':
main.c:18:24: error: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   18 |     if((strcmp(Order[i][0], "insert")==0){
      |                ~~~~~~~~^~~
      |                        |
      |                        char
In file included from main.c:2:
/usr/include/string.h:156:32: note: expected 'const char *' but argument is of type 'char'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                    ~~~~~~~~~~~~^~~~
main.c:18:42: error: expected ')' before '{' token
   18 |     if((strcmp(Order[i][0], "insert")==0){
      |       ~                                  ^
      |                                          )
main.c:41:3: error: expected declaration or statement at end of input
   41 |   }
      |   ^
main.c:41:3: error: expected declaration or statement at end of input