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

#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;
#define ALL(a) (a).begin(), (a).end()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

using namespace std;

#define M 1777771

int ch2int(char ch){
    if(ch == "A")
        return 1;
    if(ch == "C")
        return 2;
    if(ch == "G")
        return 3;
    if(ch == "T")
        return 4;
    return 0;
    
}

int hash_1(int kay)
{
    return kay % M;
}
int hash_2(int kay) { return 1 + (kay % (M - 1)); }

int get_Kay(string str)
{
    int k = 0;
    int p = 1;
    REP(i, (int)str.length())
    {
        k += ch2int(str[i]) * p;
        p *= 5;
    }
    return k;
}

int hash_Insert(string str, vector<string> data)
{
    int i = 0;
    int hashed_Kay;
    int kay = get_Kay(str);
    while (true)
    {
        hashed_Kay = (hash_1(kay) + i * hash_2(kay)) % M;
        if (data[hashed_Kay] == "" or data[hashed_Kay] == str)
            return hashed_Kay;
        i++;
    }
}

bool hash_Find(string str, vector<string> data)
{
    int i = 0;
    int hashed_Kay;
    int kay = get_Kay(str);
    while (true)
    {
        hashed_Kay = (hash_1(kay) + i * hash_2(kay)) % M;
        if (data[hashed_Kay] == str)
            return true;
        else if (data[hashed_Kay] == "")
            return false;
        i++;
    }
}

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;

    string op, word;
    vector<string> data(M);

    REP(_, n)
    {
        cin >> op >> word;
        if (op[0] == 'i')
            data[hash_Insert(word, data)] = word;
        else if (hash_Find(word, data))
            cout << "yes"
                 << "\n";
        else
            cout << "no"
                 << "\n";
    }
}


Compiler output:
a.cc: In function 'int ch2int(char)':
a.cc:20:11: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   20 |     if(ch == "A")
      |        ~~~^~~~~~
a.cc:22:11: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   22 |     if(ch == "C")
      |        ~~~^~~~~~
a.cc:24:11: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   24 |     if(ch == "G")
      |        ~~~^~~~~~
a.cc:26:11: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   26 |     if(ch == "T")
      |        ~~~^~~~~~
Language: C++

#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;
#define ALL(a) (a).begin(), (a).end()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

using namespace std;

#define M 1777771

int ch2int(string ch){
    if(ch == "A")
        return 1;
    if(ch == "C")
        return 2;
    if(ch == "G")
        return 3;
    if(ch == "T")
        return 4;
    return 0;
    
}

int hash_1(int kay)
{
    return kay % M;
}
int hash_2(int kay) { return 1 + (kay % (M - 1)); }

int get_Kay(string str)
{
    int k = 0;
    int p = 1;
    REP(i, (int)str.length())
    {
        k += ch2int(str[i]) * p;
        p *= 5;
    }
    return k;
}

int hash_Insert(string str, vector<string> data)
{
    int i = 0;
    int hashed_Kay;
    int kay = get_Kay(str);
    while (true)
    {
        hashed_Kay = (hash_1(kay) + i * hash_2(kay)) % M;
        if (data[hashed_Kay] == "" or data[hashed_Kay] == str)
            return hashed_Kay;
        i++;
    }
}

bool hash_Find(string str, vector<string> data)
{
    int i = 0;
    int hashed_Kay;
    int kay = get_Kay(str);
    while (true)
    {
        hashed_Kay = (hash_1(kay) + i * hash_2(kay)) % M;
        if (data[hashed_Kay] == str)
            return true;
        else if (data[hashed_Kay] == "")
            return false;
        i++;
    }
}

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;

    string op, word;
    vector<string> data(M);

    REP(_, n)
    {
        cin >> op >> word;
        if (op[0] == 'i')
            data[hash_Insert(word, data)] = word;
        else if (hash_Find(word, data))
            cout << "yes"
                 << "\n";
        else
            cout << "no"
                 << "\n";
    }
}


Compiler output:
a.cc: In function 'int get_Kay(std::string)':
a.cc:44:20: error: could not convert 'str.std::__cxx11::basic_string<char>::operator[](((std::__cxx11::basic_string<char>::size_type)i))' from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   44 |         k += ch2int(str[i]) * p;
      |              ~~~~~~^~~~~~~~
      |                    |
      |                    __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}
Language: C++

#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;
#define ALL(a) (a).begin(), (a).end()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

using namespace std;

#define M 1777771

int ch2int(char ch){
    if(ch == (int)"A")
        return 1;
    if (ch == (int)"C")
        return 2;
    if (ch == (int)"G")
        return 3;
    if (ch == (int)"T")
        return 4;
    return 0;
    
}

int hash_1(int kay)
{
    return kay % M;
}
int hash_2(int kay) { return 1 + (kay % (M - 1)); }

int get_Kay(string str)
{
    int k = 0;
    int p = 1;
    REP(i, (int)str.length())
    {
        k += ch2int(str[i]) * p;
        p *= 5;
    }
    return k;
}

int hash_Insert(string str, vector<string> data)
{
    int i = 0;
    int hashed_Kay;
    int kay = get_Kay(str);
    while (true)
    {
        hashed_Kay = (hash_1(kay) + i * hash_2(kay)) % M;
        if (data[hashed_Kay] == "" or data[hashed_Kay] == str)
            return hashed_Kay;
        i++;
    }
}

bool hash_Find(string str, vector<string> data)
{
    int i = 0;
    int hashed_Kay;
    int kay = get_Kay(str);
    while (true)
    {
        hashed_Kay = (hash_1(kay) + i * hash_2(kay)) % M;
        if (data[hashed_Kay] == str)
            return true;
        else if (data[hashed_Kay] == "")
            return false;
        i++;
    }
}

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;

    string op, word;
    vector<string> data(M);

    REP(_, n)
    {
        cin >> op >> word;
        if (op[0] == 'i')
            data[hash_Insert(word, data)] = word;
        else if (hash_Find(word, data))
            cout << "yes"
                 << "\n";
        else
            cout << "no"
                 << "\n";
    }
}


Compiler output:
a.cc: In function 'int ch2int(char)':
a.cc:20:14: error: cast from 'const char*' to 'int' loses precision [-fpermissive]
   20 |     if(ch == (int)"A")
      |              ^~~~~~~~
a.cc:22:15: error: cast from 'const char*' to 'int' loses precision [-fpermissive]
   22 |     if (ch == (int)"C")
      |               ^~~~~~~~
a.cc:24:15: error: cast from 'const char*' to 'int' loses precision [-fpermissive]
   24 |     if (ch == (int)"G")
      |               ^~~~~~~~
a.cc:26:15: error: cast from 'const char*' to 'int' loses precision [-fpermissive]
   26 |     if (ch == (int)"T")
      |               ^~~~~~~~
Language: C++

#include <bits/stdc++.h>
#include <iostream>
#include <stdio.h>
using namespace std;

int main(void){
  string A;
  string Key;
  int n;
  cin >> n;
  string S[n];
  string AS[n];
  string CS[n];
  string GS[n];
  string TS[n];
  int countA=0;
  int countC=0;
  int countG=0;
  int countT=0;
  for(int i=0;i<n;i++){
    cin >> A;
    if(A=="insert"){
      cin >> S[i];
      if(S[i].at(0)=='A'){
        AS[countA]=S[i];
        countA++;
      }
      else if(S[i].at(0)=='C'){
        CS[countC]=S[i];
        countC++;
      }
      else if(S[i].at(0)=='G'){
        GS[countG]=S[i];
        countG++;
      }
      else{
        TS[countT]=S[i];
        countT++;
      }
    }
    else{
      cin >> Key;
      if(Key.at(0)=='A'){
        for(int j=0;j<=countA;j++){
          if(Key==AS[j]){
          printf("yes\n");
          break;
          }
          if(j==countA){
          printf("no\n");
          }
        }
      }
      else if(Key.at(0)=='C'){
        for(int j=0;j<=countC;j++){
         if(Key==CS[j]){
          printf("yes\n");
          break;
         }
         if(j==countC){
          printf("no\n");
         }
        }
      }
      else if(Key.at(0)=='G'){
        for(int j=0;j<=countG;j++){
         if(Key==GS[j]){
          printf("yes\n");
          break;
         }
         if(j==countG){
          printf("no\n");
         }
        }
      }
      else{
        for(int j=0;j<=countT;j++){
         if(Key==TS[j]){
          printf("yes\n");
          break;
         }
         if(j==coun){
          printf("no\n");
         }
        }
      }
    }
  }
  return 0;
}  


Compiler output:
a.cc: In function 'int main()':
a.cc:82:16: error: 'coun' was not declared in this scope; did you mean 'countT'?
   82 |          if(j==coun){
      |                ^~~~
      |                countT
Language: C++

#include <bits/stdc++.h>
#include <iostream>
#include <stdio.h>
using namespace std;

int main(void){
  string A;
  string Key;
  int n;
  cin >> n;
  string S[n];
  string AS[n];
  string CS[n];
  string GS[n];
  string TS[n];
  int countA=0;
  int countC=0;
  int countG=0;
  int countT=0;
  for(int i=0;i<n;i++){
    cin >> A;
    countAA=countA;
    countCC=countC;
    countGG=countG;
    countTT=countT;

    if(A=="insert"){
      cin >> S[i];
      if(S[i].at(0)=='A'){
        AS[countA]=S[i];
        countA++;
      }
      else if(S[i].at(0)=='C'){
        CS[countC]=S[i];
        countC++;
      }
      else if(S[i].at(0)=='G'){
        GS[countG]=S[i];
        countG++;
      }
      else{
        TS[countT]=S[i];
        countT++;
      }
    }
    else{
      cin >> Key;
      if(Key.at(0)=='A'){
        for(int j=0;j<=countA;j++){
          if(Key==AS[j]){
          printf("yes\n");
          break;
          }
          if(Key==AS[countAA]){
          printf("yes\n");
          break;
          }
          if(j==countA){
          printf("no\n");
          }
          countAA--;
        }
      }
      else if(Key.at(0)=='C'){
        for(int j=0;j<=countC;j++){
         if(Key==CS[j]){
          printf("yes\n");
          break;
         }
         if(Key==CS[countCC]){
          printf("yes\n");
          break;
          }
         if(j==countC){
          printf("no\n");
         }
         countCC--;
        }
      }
      else if(Key.at(0)=='G'){
        for(int j=0;j<=countG;j++){
         if(Key==GS[j]){
          printf("yes\n");
          break;
         }
         if(Key==GS[countGG]){
          printf("yes\n");
          break;
          }
         if(j==countG){
          printf("no\n");
         }
         countGG--;
        }
      }
      else{
        for(int j=0;j<=countT;j++){
         if(Key==TS[j]){
          printf("yes\n");
          break;
         }
         if(Key==TS[countTT]){
          printf("yes\n");
          break;
          }
         if(j==countT){
          printf("no\n");
         }
         countTT--;
        }
      }
    }
  }
  return 0;
}  


Compiler output:
a.cc: In function 'int main()':
a.cc:22:5: error: 'countAA' was not declared in this scope; did you mean 'countA'?
   22 |     countAA=countA;
      |     ^~~~~~~
      |     countA
a.cc:23:5: error: 'countCC' was not declared in this scope; did you mean 'countC'?
   23 |     countCC=countC;
      |     ^~~~~~~
      |     countC
a.cc:24:5: error: 'countGG' was not declared in this scope; did you mean 'countG'?
   24 |     countGG=countG;
      |     ^~~~~~~
      |     countG
a.cc:25:5: error: 'countTT' was not declared in this scope; did you mean 'countT'?
   25 |     countTT=countT;
      |     ^~~~~~~
      |     countT
Language: C++

#include <iostream>
#include <stack>
#include <algorithm>
#include <vector>
#include <string>

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

using namespace std;

char H[LEN][L];

int getChar(char ch){
  if(ch == 'A') return 1;
  if(ch == 'C') return 2;
  if(ch == 'G') return 3;
  if(ch == 'T') return 4;
  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 % LEN;
}

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

int find(char str[]){
  long long key, i, h;
  key = getKey(str);
  for(i=0;;i++){
    h = (h1(key) + i * h2(key)) % LEN;
    if(strcmp(H[h], str) == 0) return 1;
    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)) % LEN;
    if(strcmp(H[h], str) == 0) return 1;
    if(strlen(H[h]) == 0){
      strcpy(H[h], str);
      return 0;
    }
  }
  return 0;
}

int main(int argc, const char * argv[]) {
  int i, n;
  char str[L], com[9];
  
  for(i = 0; i < LEN; 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: In function 'long long int getKey(char*)':
a.cc:25:17: error: 'strlen' was not declared in this scope
   25 |   for(i = 0; i< strlen(str); i++){
      |                 ^~~~~~
a.cc:5:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <vector>
  +++ |+#include <cstring>
    5 | #include <string>
a.cc: In function 'int find(char*)':
a.cc:45:8: error: 'strcmp' was not declared in this scope
   45 |     if(strcmp(H[h], str) == 0) return 1;
      |        ^~~~~~
a.cc:45:8: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:46:8: error: 'strlen' was not declared in this scope
   46 |     if(strlen(H[h]) == 0) return 0;
      |        ^~~~~~
a.cc:46:8: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc: In function 'int insert(char*)':
a.cc:56:8: error: 'strcmp' was not declared in this scope
   56 |     if(strcmp(H[h], str) == 0) return 1;
      |        ^~~~~~
a.cc:56:8: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:57:8: error: 'strlen' was not declared in this scope
   57 |     if(strlen(H[h]) == 0){
      |        ^~~~~~
a.cc:57:8: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:58:7: error: 'strcpy' was not declared in this scope
   58 |       strcpy(H[h], str);
      |       ^~~~~~
a.cc:58:7: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

#include <iostream>
#include <stack>
#include <algorithm>
#include <vector>
#include <string>

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

using namespace std;

char H[LEN][L];

int getChar(char ch){
  if(ch == 'A') return 1;
  if(ch == 'C') return 2;
  if(ch == 'G') return 3;
  if(ch == 'T') return 4;
  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(long long key){
  return key % LEN;
}

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

int find(char str[]){
  long long key, i, h;
  key = getKey(str);
  for(i=0;;i++){
    h = (h1(key) + i * h2(key)) % LEN;
    if(strcmp(H[h], str) == 0) return 1;
    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)) % LEN;
    if(strcmp(H[h], str) == 0) return 1;
    if(strlen(H[h]) == 0){
      strcpy(H[h], str);
      return 0;
    }
  }
  return 0;
}

int main(int argc, const char * argv[]) {
  int i, n;
  char str[L], com[9];
  
  for(i = 0; i < LEN; 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: In function 'long long int getKey(char*)':
a.cc:25:17: error: 'strlen' was not declared in this scope
   25 |   for(i = 0; i< strlen(str); i++){
      |                 ^~~~~~
a.cc:5:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <vector>
  +++ |+#include <cstring>
    5 | #include <string>
a.cc: In function 'int find(char*)':
a.cc:45:8: error: 'strcmp' was not declared in this scope
   45 |     if(strcmp(H[h], str) == 0) return 1;
      |        ^~~~~~
a.cc:45:8: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:46:8: error: 'strlen' was not declared in this scope
   46 |     if(strlen(H[h]) == 0) return 0;
      |        ^~~~~~
a.cc:46:8: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc: In function 'int insert(char*)':
a.cc:56:8: error: 'strcmp' was not declared in this scope
   56 |     if(strcmp(H[h], str) == 0) return 1;
      |        ^~~~~~
a.cc:56:8: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:57:8: error: 'strlen' was not declared in this scope
   57 |     if(strlen(H[h]) == 0){
      |        ^~~~~~
a.cc:57:8: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:58:7: error: 'strcpy' was not declared in this scope
   58 |       strcpy(H[h], str);
      |       ^~~~~~
a.cc:58:7: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

#include <iostream>
#include <stack>
#include <algorithm>
#include <vector>
#include <string>

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

using namespace std;

char H[LEN][L];

int getChar(char ch){
  if(ch == 'A') return 1;
  if(ch == 'C') return 2;
  if(ch == 'G') return 3;
  if(ch == 'T') return 4;
  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;
}

long long h1(long long key){
  return key % LEN;
}

long long h2(long long key){
  return 1 + (key % (LEN -1));
}

int find(char str[]){
  long long key, i, h;
  key = getKey(str);
  for(i=0;;i++){
    h = (h1(key) + i * h2(key)) % LEN;
    if(strcmp(H[h], str) == 0) return 1;
    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)) % LEN;
    if(strcmp(H[h], str) == 0) return 1;
    if(strlen(H[h]) == 0){
      strcpy(H[h], str);
      return 0;
    }
  }
  return 0;
}

int main(int argc, const char * argv[]) {
  int i, n;
  char str[L], com[9];
  
  for(i = 0; i < LEN; 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: In function 'long long int getKey(char*)':
a.cc:25:17: error: 'strlen' was not declared in this scope
   25 |   for(i = 0; i< strlen(str); i++){
      |                 ^~~~~~
a.cc:5:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <vector>
  +++ |+#include <cstring>
    5 | #include <string>
a.cc: In function 'int find(char*)':
a.cc:45:8: error: 'strcmp' was not declared in this scope
   45 |     if(strcmp(H[h], str) == 0) return 1;
      |        ^~~~~~
a.cc:45:8: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:46:8: error: 'strlen' was not declared in this scope
   46 |     if(strlen(H[h]) == 0) return 0;
      |        ^~~~~~
a.cc:46:8: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc: In function 'int insert(char*)':
a.cc:56:8: error: 'strcmp' was not declared in this scope
   56 |     if(strcmp(H[h], str) == 0) return 1;
      |        ^~~~~~
a.cc:56:8: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:57:8: error: 'strlen' was not declared in this scope
   57 |     if(strlen(H[h]) == 0){
      |        ^~~~~~
a.cc:57:8: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:58:7: error: 'strcpy' was not declared in this scope
   58 |       strcpy(H[h], str);
      |       ^~~~~~
a.cc:58:7: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

string cmd,word;
#include <set>
#include <iostream>
#include <string>
using namespace std;

set<string> S;
int n;
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>cmd;
        if(cmd=="insert")
        {
            cin>>word;
            S.insert(word);
        }
        if(cmd=="find")
        {
            cin>>word;
            if(S.count(word)>0)cout<<"yes"<<endl;
            else cout<<"no"<<endl;
        }
    }
    return 0;
}


Compiler output:
a.cc:1:1: error: 'string' does not name a type; did you mean 'stdin'?
    1 | string cmd,word;
      | ^~~~~~
      | stdin
a.cc: In function 'int main()':
a.cc:14:14: error: 'cmd' was not declared in this scope
   14 |         cin>>cmd;
      |              ^~~
a.cc:17:18: error: 'word' was not declared in this scope
   17 |             cin>>word;
      |                  ^~~~
a.cc:22:18: error: 'word' was not declared in this scope
   22 |             cin>>word;
      |                  ^~~~
Language: C++

string cmd,word;
#include <set>
#include <iostream>
#include <string>
using namespace std;
string cmd, word;
set<string> S;
int n;
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>cmd;
        if(cmd=="insert")
        {
            cin>>word;
            S.insert(word);
        }
        if(cmd=="find")
        {
            cin>>word;
            if(S.count(word)>0)cout<<"yes"<<endl;
            else cout<<"no"<<endl;
        }
    }
    return 0;
}


Compiler output:
a.cc:1:1: error: 'string' does not name a type; did you mean 'stdin'?
    1 | string cmd,word;
      | ^~~~~~
      | stdin
Language: C++

#include <iostream>
#include <stack>
#include <algorithm>
#include <vector>
#include <string>

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

using namespace std;

char H[LEN][L];

int getChar(char ch){
  if(ch == 'A') return 1;
  if(ch == 'C') return 2;
  if(ch == 'G') return 3;
  if(ch == 'T') return 4;
  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;
}

long long h1(long long key){
  return key % LEN;
}

long long h2(long long key){
  return 1 + (key % (LEN -1));
}

int find(char str[]){
  long long key, i, h;
  key = getKey(str);
  for(i=0;;i++){
    h = (h1(key) + i * h2(key)) % LEN;
    if(strcmp(H[h], str) == 0) return 1;
    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)) % LEN;
    if(strcmp(H[h], str) == 0) return 1;
    if(strlen(H[h]) == 0){
      strcpy(H[h], str);
      return 0;
    }
  }
  return 0;
}

int main(int argc, const char * argv[]) {
  int i, n;
  char str[L], com[9];
  
  for(i = 0; i < LEN; 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: In function 'long long int getKey(char*)':
a.cc:25:17: error: 'strlen' was not declared in this scope
   25 |   for(i = 0; i< strlen(str); i++){
      |                 ^~~~~~
a.cc:5:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <vector>
  +++ |+#include <cstring>
    5 | #include <string>
a.cc: In function 'int find(char*)':
a.cc:45:8: error: 'strcmp' was not declared in this scope
   45 |     if(strcmp(H[h], str) == 0) return 1;
      |        ^~~~~~
a.cc:45:8: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:46:8: error: 'strlen' was not declared in this scope
   46 |     if(strlen(H[h]) == 0) return 0;
      |        ^~~~~~
a.cc:46:8: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc: In function 'int insert(char*)':
a.cc:56:8: error: 'strcmp' was not declared in this scope
   56 |     if(strcmp(H[h], str) == 0) return 1;
      |        ^~~~~~
a.cc:56:8: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:57:8: error: 'strlen' was not declared in this scope
   57 |     if(strlen(H[h]) == 0){
      |        ^~~~~~
a.cc:57:8: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:58:7: error: 'strcpy' was not declared in this scope
   58 |       strcpy(H[h], str);
      |       ^~~~~~
a.cc:58:7: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
  	int n;
  	scanf("%d",n);
	vector<string> A;
  	vector<string> C;
  	vector<string> G;
  	vector<string> T;
  	string b,c;
 	string ans;
  	for(int i=0;i<n;i++){
    	scanf("%s%s",b,c);
      	if(b=="insert"){
          if(c.at(0)=='A') A.push_back(c);
          if(c.at(0)=='C') C.push_back(c);
          if(c.at(0)=='G') G.push_back(c);
          if(c.at(0)=='T') T.push_back(c);
        }
      	if(b=="find"){
          	ans="no";
          	if(c.at(0)=='A'){ 
              for (int i=0;i<A.size();i++){
            	if(c==A.at(i)){
                	ans="yes";
                }
        	  }
          	  cout<<ans<<endl;
        	}
	      if(c.at(0)=='C'){ 
              for (int i=0;i<C.size();i++){
            	if(c==C.at(i)){
                	ans="yes";
                }
        	  }
          	  cout<<ans<<endl;
        	}
		  if(c.at(0)=='G'){ 
              for (int i=0;i<G.size();i++){
            	if(c==G.at(i)){
                	ans="yes";
                }
        	  }
          	  cout<<ans<<endl;
        	}
		  if(c.at(0)=='T'){ 
              for (int i=0;i<T.size();i++){
            	if(c==T.at(i)){
                	ans="yes";
                }
        	  }
          	  cout<<ans<<endl;
        	}
        }



Compiler output:
a.cc: In function 'int main()':
a.cc:58:10: error: expected '}' at end of input
   58 |         }
      |          ^
a.cc:16:29: note: to match this '{'
   16 |         for(int i=0;i<n;i++){
      |                             ^
a.cc:58:10: error: expected '}' at end of input
   58 |         }
      |          ^
a.cc:7:11: note: to match this '{'
    7 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(){
	int n, i, j;
	string siji, strIn, ansIn;
	vector<string> str;
	
	cin >> n;
	for(i=0;i<n;++i){
		cin >> siji;
		cin >> strIn;
		if(siji[0] == 'i'){
			str.push_back(strIn);
		}
		else{
			if(str.size() == 0)ans.push_back(false);
			for(j=0;j<str.size();++j){
				if(str[j] == strIn)cout << "yes" << endl;
				else cout << "no" << endl;
			}
		}
	}
	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:44: error: 'ans' was not declared in this scope; did you mean 'abs'?
   20 |                         if(str.size() == 0)ans.push_back(false);
      |                                            ^~~
      |                                            abs
Language: C++

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

int m = 1046527;

long long ChangeToNumber(char str[]){
    long long key = 0;
    for(int i=0; str[i]!='\0'; i++){
        if(str[i]=='A'){
            key = key*10 + 1;
        }
        else if(str[i]=='C'){ key = key*10 + 2; }
        else if(str[i]=='G'){
            key = key*10 + 3;
        }
        else{ key = key*10 + 4; }
    }
    return key;
}

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

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

void Insert(int T[], long long key){
    int i = 0;
    while(true){
        int j = h(key, i);
        if(j>16777213){
            i += 1;
        }else if(T[j] == NULL){
            T[j] = key;
            return;
        }else{
            i += 1;
        }
    }
}

void Search(int T[], long long key){
    int i = 0;
    while(true){
        int j = h(key, i);
        if(j>16777213){
            i += 1;
        }else if(T[j] == key){
            printf("yes\n");
            return;
        }else if(T[j] == NULL){
            printf("no\n");
            return;
        }else{
            i += 1;
        }
    }
}

int main(void){
    int *T = (int*)tc_malloc(16777213*sizeof(int));
    int n;
    scanf("%d", &n);
    // printf("%d", n);

    char order[7];
    char str[13];
    long long key;
    for(int i=0; i<n; i++){
        scanf("%s%s", order, str);
        // printf("%s\n", str);
        // printf("%d\n", n);
        // printf("%d\n", i);
        key = ChangeToNumber(str);
        if(order[0]=='i'){ Insert(T, key); }
        else{ Search(T, key); }
    }
    return 0;
}


Compiler output:
a.cc: In function 'void Insert(int*, long long int)':
a.cc:32:26: warning: NULL used in arithmetic [-Wpointer-arith]
   32 |         }else if(T[j] == NULL){
      |                          ^~~~
a.cc: In function 'void Search(int*, long long int)':
a.cc:50:26: warning: NULL used in arithmetic [-Wpointer-arith]
   50 |         }else if(T[j] == NULL){
      |                          ^~~~
a.cc: In function 'int main()':
a.cc:60:20: error: 'tc_malloc' was not declared in this scope; did you mean 'malloc'?
   60 |     int *T = (int*)tc_malloc(16777213*sizeof(int));
      |                    ^~~~~~~~~
      |                    malloc
Language: C++

#include <stdio.h>
#include <stdlib.h> 
#include <gperftools/tcmalloc.h>

int m = 1046527;

long long ChangeToNumber(char str[]){
    long long key = 0;
    for(int i=0; str[i]!='\0'; i++){
        if(str[i]=='A'){
            key = key*10 + 1;
        }
        else if(str[i]=='C'){ key = key*10 + 2; }
        else if(str[i]=='G'){
            key = key*10 + 3;
        }
        else{ key = key*10 + 4; }
    }
    return key;
}

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

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

void Insert(int T[], long long key){
    int i = 0;
    while(true){
        int j = h(key, i);
        if(j>16777213){
            i += 1;
        }else if(T[j] == NULL){
            T[j] = key;
            return;
        }else{
            i += 1;
        }
    }
}

void Search(int T[], long long key){
    int i = 0;
    while(true){
        int j = h(key, i);
        if(j>16777213){
            i += 1;
        }else if(T[j] == key){
            printf("yes\n");
            return;
        }else if(T[j] == NULL){
            printf("no\n");
            return;
        }else{
            i += 1;
        }
    }
}

int main(void){
    int *T = (int*)tc_malloc(16777213*sizeof(int));
    int n;
    scanf("%d", &n);
    // printf("%d", n);

    char order[7];
    char str[13];
    long long key;
    for(int i=0; i<n; i++){
        scanf("%s%s", order, str);
        // printf("%s\n", str);
        // printf("%d\n", n);
        // printf("%d\n", i);
        key = ChangeToNumber(str);
        if(order[0]=='i'){ Insert(T, key); }
        else{ Search(T, key); }
    }
    return 0;
}


Compiler output:
a.cc:3:10: fatal error: gperftools/tcmalloc.h: No such file or directory
    3 | #include <gperftools/tcmalloc.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include<stdio.h>
#include<string>
#include<stdlib.h>
using namespace std;

long long n;

long long *T;


void insert(long long a){
  for(long long i = 0; i < n; i++){
    long long j = (((a % n) + i * (1 + a % (n - 1))) % n);
    if(T[j] == '\0'){
      T[j] = a;
      break;
    }
  }
}

string findx(long long a){
  for(long long i = 0; i < n; i++){
    long long j = (((a % n) + i * (1 + a % (n - 1))) % n);
    if(T[j] == a){
      return "yes";
    }
    else if(T[j] == '\0'){
      return "no";
    }
  }
}

long long main(){

  cin >> n;

  string s, x;

  long long cnt = 0;

  string *yn = new string[n];

  T = new long long[n];



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

    cin >> s >> x;

    long long a = 0, b = 1;

    for(long long i = 0; i < (long long)x.size(); i++){

      if(x[i] == 'A'){
        a = a + 1 * b;
      }
      else if(x[i] == 'C'){
        a = a + 2 * b;
      }
      else if(x[i] == 'G'){
        a = a + 3 * b;
      }
      else if(x[i] == 'T'){
        a = a + 4 * b;
      }

      b = b * 10;

    }

    if(s == "insert"){
      insert(a);
    }
    else if(s == "find"){
      yn[cnt] = findx(a);
      cnt++;
    }
  }

  for(long long i = 0; i < cnt; i++){
    cout << yn[i] << endl;
  }
  return 0;
}



Compiler output:
cc1plus: error: '::main' must return 'int'
a.cc: In function 'std::string findx(long long int)':
a.cc:32:1: warning: control reaches end of non-void function [-Wreturn-type]
   32 | }
      | ^
Language: C++

#include<iostream>
#include<string>
#include<cstdio>
using namespace std;

#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<str.size();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(str.compare(H[h],str)==0)return 1;
        else if(str.size(H[h])==0){
            str.copy(H[h],str);
            return 0;
        }
    }
    return 0;
}

int main(){
    int i,n,h;
    char str[L],com[9];
    for(int 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:
a.cc: In function 'long long int getKey(char*)':
a.cc:22:19: error: request for member 'size' in 'str', which is of non-class type 'char*'
   22 |     for(i=0;i<str.size();i++){
      |                   ^~~~
a.cc: In function 'int find(char*)':
a.cc:41:16: error: request for member 'compare' in 'str', which is of non-class type 'char*'
   41 |         if(str.compare(H[h],str)==0)return 1;
      |                ^~~~~~~
a.cc:42:21: error: request for member 'size' in 'str', which is of non-class type 'char*'
   42 |         else if(str.size(H[h])==0){
      |                     ^~~~
a.cc:43:17: error: request for member 'copy' in 'str', which is of non-class type 'char*'
   43 |             str.copy(H[h],str);
      |                 ^~~~
a.cc: In function 'int main()':
a.cc:58:13: error: 'insert' was not declared in this scope
   58 |             insert(str);
      |             ^~~~~~
Language: C++

#include<iostream>
#include<string>
#include<cstdio>
using namespace std;

#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<str.len();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(str.compare(H[h],str)==0)return 1;
        else if(str.len(H[h])==0){
            str.copy(H[h],str);
            return 0;
        }
    }
    return 0;
}

int main(){
    int i,n,h;
    char str[L],com[9];
    for(int 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:
a.cc: In function 'long long int getKey(char*)':
a.cc:22:19: error: request for member 'len' in 'str', which is of non-class type 'char*'
   22 |     for(i=0;i<str.len();i++){
      |                   ^~~
a.cc: In function 'int find(char*)':
a.cc:41:16: error: request for member 'compare' in 'str', which is of non-class type 'char*'
   41 |         if(str.compare(H[h],str)==0)return 1;
      |                ^~~~~~~
a.cc:42:21: error: request for member 'len' in 'str', which is of non-class type 'char*'
   42 |         else if(str.len(H[h])==0){
      |                     ^~~
a.cc:43:17: error: request for member 'copy' in 'str', which is of non-class type 'char*'
   43 |             str.copy(H[h],str);
      |                 ^~~~
a.cc: In function 'int main()':
a.cc:58:13: error: 'insert' was not declared in this scope
   58 |             insert(str);
      |             ^~~~~~
Language: C++

#include<iostream>
#include<vector>
using namespace std;
int main(){
    int n;
    vector<string>v;
    cin>>n;
    for(int i=0; i<n; i++){
        string str,word;
        cin>>str>>word;
        if(str=="insert")   v.push_back(word);
        else if(str=="find"){
            vector<string>::iterator it;
            it=find(v.begin(), v.end(), word);
            if(it!=v.end()) cout<<"yes\n";
            else    cout<<"no\n";
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:20: error: no matching function for call to 'find(std::vector<std::__cxx11::basic_string<char> >::iterator, std::vector<std::__cxx11::basic_string<char> >::iterator, std::string&)'
   14 |             it=find(v.begin(), v.end(), word);
      |                ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:14:20: note:   '__gnu_cxx::__normal_iterator<std::__cxx11::basic_string<char>*, std::vector<std::__cxx11::basic_string<char> > >' is not derived from 'std::istreambuf_iterator<_CharT>'
   14 |             it=find(v.begin(), v.end(), word);
      |                ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <cstdio>
#include <string>
#include <cstdlib>
#include <map>

using namespace std;

#define rep(i, N) for (int i = 0; i < N; ++i)


int main() {
    int n, strMax = 12;
    scanf("%d", &n);
    char action[strMax], key[strMax];
    char *ins = "insert";
    char *fin = "find";
    map<string, bool> data;
    rep(i, n) {
        scanf("%s %s", action, key);
        if (strcmp(ins, action) == 0) {
            data[key] = true;
        } else if (strcmp(fin, action) == 0) {
            if (data[key]) {
                printf("yes\n");
            } else {
                printf("no\n");
            }
        }
    }

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:17: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
   15 |     char *ins = "insert";
      |                 ^~~~~~~~
a.cc:16:17: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
   16 |     char *fin = "find";
      |                 ^~~~~~
a.cc:20:13: error: 'strcmp' was not declared in this scope
   20 |         if (strcmp(ins, action) == 0) {
      |             ^~~~~~
a.cc:5:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <map>
  +++ |+#include <cstring>
    5 |
Language: C++

#include <cstdio>
#include <string>
#include <cstdlib>
#include <map>

using namespace std;

#define rep(i, N) for (int i = 0; i < N; ++i)

static const char *INSERT = "insert";
static const char *FIND = "find";

int main() {
    int n, strMax = 12;
    scanf("%d", &n);
    char action[strMax], key[strMax];

    map<string, bool> data;
    rep(i, n) {
        scanf("%s %s", action, key);
        if (strcmp(INSERT, action) == 0) {
            data[key] = true;
        } else if (strcmp(FIND, action) == 0) {
            if (data[key]) {
                printf("yes\n");
            } else {
                printf("no\n");
            }
        }
    }

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:13: error: 'strcmp' was not declared in this scope
   21 |         if (strcmp(INSERT, action) == 0) {
      |             ^~~~~~
a.cc:5:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <map>
  +++ |+#include <cstring>
    5 |
Language: C++

#include<iostream>
#include<string>
#include<set>

using namespace std;

int main() {
  set<string> d;
  int n, a;
  string o, b;
  cin >> n;
  for (a = 1; a <= n; a++) {
    cin >> o >> b;
    if (o == "insert") {
      d.insert(b);
    } else if (d.find(b) != s.end()) {
      cout << "yes" << endl;
    } else {
      cout << "no" << endl;
    }
  }
}
return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:16:29: error: 's' was not declared in this scope
   16 |     } else if (d.find(b) != s.end()) {
      |                             ^
a.cc: At global scope:
a.cc:23:1: error: expected unqualified-id before 'return'
   23 | return 0;
      | ^~~~~~
a.cc:24:1: error: expected declaration before '}' token
   24 | }
      | ^
Language: C++

#include<iostream>
#include<string>

using namespace std;

int main() {
  string s;
  int n;
  cin >> n;
  for (int i=0;i<n;++1){
      string q;
      cin >> q;
      if (q.find("insert")!=-1){
         string r = q.substr(7);
         s += r;
         }
      else if (q.find("find")!=-1){
         string a = q.substr(5);
         if (s.find(a)!=-1){
            cout << "yes" << endl;
            }
         else{
            cout << "no" << endl;
         }
       }
   return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:22: error: lvalue required as increment operand
   10 |   for (int i=0;i<n;++1){
      |                      ^
a.cc:27:2: error: expected '}' at end of input
   27 | }
      |  ^
a.cc:6:12: note: to match this '{'
    6 | int main() {
      |            ^
Language: C++

#include<iostream>
#include<string>

using namespace std;

int main() {
  string s;
  int n;
  cin >> n;
  for (int i=0;i<n;++i){
      string q;
      cin >> q;
      if (q.find("insert")!=-1){
         string r = q.substr(7);
         s += r;
         }
      else if (q.find("find")!=-1){
         string a = q.substr(5);
         if (s.find(a)!=-1){
            cout << "yes" << endl;
            }
         else{
            cout << "no" << endl;
         }
       }
   return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:2: error: expected '}' at end of input
   27 | }
      |  ^
a.cc:6:12: note: to match this '{'
    6 | int main() {
      |            ^
Language: C++

N=int(input())
dic={}
for _ in range(N):
    c,s=input().split()
    if c=="insert":
        dic[s]=True
    else:
        print("yes" if s in dic else "no")


Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N=int(input())
      | ^
a.cc:3:1: error: expected unqualified-id before 'for'
    3 | for _ in range(N):
      | ^~~
Language: C++

#include <array>
#include <iostream>
#include <map>

#define M 1046527
#define L 14

const std::map<char, int> charint{
    {'A', 1},
    {'C', 2},
    {'G', 3},
    {'T', 4},
};

int getChar(char ch) { return charint.at(ch); }

long long getKey(char str[]) {
  long long sum = 0, p = 1;
  for (std::size_t i = 0; i < strlen(str); ++i) {
    sum += p * (getChar(str[i]));
    p *= 5;
  }
  return sum;
}

struct Dict {
  std::array<std::string, M> v{};

  bool insert(char item[]) {
    auto key = h1(getKey(item));
    if (item[0] != '\0') {
      v[key] = item;
      return true;
    }
    for (int i = 0; i < M; i++) {
      key = h2(getKey(item));
      if (item[0] != '\0') {
        v[key] = item;
        return true;
      }
    }
    return false;
  }

  bool find(char item[]) { return v[getKey(item)] == item; }

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

int main() {
  int n;
  std::cin >> n;

  char cmd[7];
  char data[L];
  Dict *d = new Dict{};
  for (int i = 0; i < n; i++) {
    std::cin >> cmd >> data;
    if (cmd[0] == 'i') {
      d->insert(data);
    } else {
      std::cout << (d->find(data) ? "yes" : "no") << std::endl;
    }
  }
}



Compiler output:
a.cc: In function 'long long int getKey(char*)':
a.cc:19:31: error: 'strlen' was not declared in this scope
   19 |   for (std::size_t i = 0; i < strlen(str); ++i) {
      |                               ^~~~~~
a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <map>
  +++ |+#include <cstring>
    4 |