alexjercan/bugnet huggingface dataset:
Problem p02418 (C++) — buggy submission, verdict: Time Limit Exceeded

//
//  main.cpp
//  StringTest
//
//  Created by ?????¶??? on 15/8/13.
//  Copyright (c) 2015??´ ?????¶???. All rights reserved.
//

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

int main(int argc, const char *argv[]) {

  string str_1, str_2;

  cin >> str_1 >> str_2;

  str_1 = str_1 + str_1;

  int index_1 = 0;
  int index_2 = 0;

  //    printf("str_1 length : %d\\n" , static_cast<int>( str_1.length()));

  while (true) {

    if (str_1[index_1] == str_2[index_2]) {

      //            printf("str_1[%d]: %c  str_2[%d]: %c \\n", index_1,
      //            str_1[index_1], index_2, str_2[index_2] );

      index_2++;

    } else {

      //            printf("str_1[%d]: %c  str_2[%d]: %c \\n", index_1,
      //            str_1[index_1], index_2, str_2[index_2] );

      if (index_2 > 0) {
        index_1 -= index_2;
      }

      index_2 = 0;
    }

    index_1++;

    // ????¬??????¨??¨?¬????
    if (index_2 > static_cast<int>(str_2.length() - 1)) {

      cout << "Yes" << endl;

      break;
    }
    // ????¬?????¬????
    if (index_1 == static_cast<int>(str_1.length() - 1)) {

      cout << "No" << endl;

      break;
    }
  }

  return 0;
}

Error: TLE

Fixed submission:

//
//  main.cpp
//  ITP1_8-D_2
//
//  Created by Saicj on 2015/08/03.
//  Copyright (c) 2015??´ saicj. All rights reserved.
//

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

int main(int argc, const char *argv[]) {

  string s;
  string p;

  std::cin >> s;
  std::cin >> p;

  int sIndex = 0;
  int pIndex = 0;

  while (true) {

    //        cout << pIndex << ":" << sIndex << endl;

    if (p[pIndex] == s[sIndex]) {

      //            cout << p[pIndex] << ":" << s[sIndex] << endl;

      if (pIndex == (int)p.size() - 1) {
        cout << "Yes" << endl;
        break;
      }

      pIndex++;
    } else {

      //            cout << p[pIndex] << ":" << s[sIndex] << endl;

      if (pIndex == (int)p.size() - 1) {

        if (p.size() > 2) {
          cout << "No" << endl;
          break;
        }
      }

      pIndex = 0;
    }

    sIndex++;
    if (sIndex > (int)s.size() - 1) {
      sIndex = 0;
    }
  }

  return 0;
}
Problem p02418 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  char sa[101], p[100];
  char sb[200];
  scanf("%s", sa);
  scanf("%s", p);
  if (strstr(sa, p) != NULL) {
    printf("Yes\\n");
  } else {
    strcpy(sb, sa);
    strcat(sb, sa);
    if (strstr(sb, p) != NULL) {
      printf("Yes\\n");
    } else {
      printf("No\\n");
    }
  }
}

Error: 0

Fixed submission:

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

int main() {
  char s[200], p[100];
  scanf("%s", s);
  scanf("%s", p);

  strcat(s, s);
  if (strstr(s, p) != NULL) {
    printf("Yes\\n");
  } else {
    printf("No\\n");
  }
}
Problem p02418 (C++) — buggy submission, verdict: Runtime Error

// 標準解答
// 全角スペースにほんま注意　エラーでわかるけど
#include <cstdio>
#include <cstring>

int main() {
  char s[201], t[101], p[101];

  scanf("%s %s", s, p);
  strcpy(t, s); // tにsをコピー
  strcat(s, t); // sにtを連結

  if (strstr(s, p) == NULL)
    printf("No\\n");
  else
    printf("Yes\\n");

  return 0;
}


Error: 0

Fixed submission:

#include <cstdio>
#include <cstring>

int main() {
  char s[201], p[101];
  scanf("%s %s", s, p);
  strcat(s, s);
  if (strstr(s, p) == NULL)
    printf("No\\n");
  else
    printf("Yes\\n");

  return 0;
}
Problem p02418 (C++) — buggy submission, verdict: Runtime Error

#include <cstring>
#include <ctype.h>
#include <stdio.h>
char s[201] = {};
char p[101] = {};
char t[101] = {};

int main(void) {
  scanf("%s", &s);
  scanf("%s", &p);
  strcpy(t, s);
  strcat(s, t);
  if (strstr(s, p))
    printf("Yes\\n");
  else
    printf("No\\n");

  return 0;
}

Error: 0

Fixed submission:

#include <cstring>
#include <ctype.h>
#include <stdio.h>
char s[202] = {};
char p[101] = {};
int main(void) {
  scanf("%s", &s);
  scanf("%s", &p);
  strcat(s, s);
  if (strstr(s, p))
    printf("Yes\\n");
  else
    printf("No\\n");

  return 0;
}
Problem p02418 (C++) — buggy submission, verdict: Runtime Error

#include <cstring>
#include <iostream>
using namespace std;

int main() {
  char s[201];
  char t[101];
  char p[101];
  scanf("%s", s);
  scanf("%s", p);

  strcpy(t, s);
  strcat(s, t);

  if (strstr(s, p) == NULL)
    cout << "No";
  else
    cout << "Yes";
  cout << endl;
}

Error: 0

Fixed submission:

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

int main() {
  char s[1000];
  char p[1000];
  scanf("%s", s);
  scanf("%s", p);
  strcat(s, s);
  if (strstr(s, p) == NULL)
    cout << "No";
  else
    cout << "Yes";
  cout << endl;
}
Problem p02418 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm> //max,min
#include <cctype>    //isalpha,tolower
#include <cstdio>    //scanf,printf
#include <cstring>   //strlen,strcat
#include <iostream>
#include <string> //string
using namespace std;

int main() {
  char s[205], q[105], t[101];
  cin >> s >> q;
  strcpy(t, s);
  strcat(s, t);
  if (strstr(s, q) == NULL) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
  return 0;
}


Error: 0

Fixed submission:

#include <algorithm> //max,min
#include <cctype>    //isalpha,tolower
#include <cstdio>    //scanf,printf
#include <cstring>   //strlen,strcat
#include <iostream>
#include <string> //string
using namespace std;

int main() {
  char s[205], q[105];
  cin >> s >> q;
  strcat(s, s);
  if (strstr(s, q) == NULL) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
  return 0;
}
Problem p02418 (C++) — buggy submission, verdict: Runtime Error

#include <cctype>
#include <cstring>
#include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;

int main() {
  char str1[100], str2[100], str3[200];
  scanf("%s\\n%s", str1, str2);

  int length = strlen(str1);
  strcpy(str3, str1);
  strcat(str3, str1); // 文字列 str1 に文字列 str2 を連結する

  if (strstr(str3, str2) == NULL)
    printf("No\\n");
  else
    printf("Yes\\n");

  return 0;
}


Error: 0

Fixed submission:

#include <cctype>
#include <cstring>
#include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;

int main() {
  char str1[100], str2[100], str3[100];
  scanf("%s\\n%s", str1, str2);

  int length = strlen(str1);
  strcpy(str3, str1);
  strcat(str3, str1); // 文字列 str1 に文字列 str2 を連結する

  if (strstr(str3, str2) == NULL)
    printf("No\\n");
  else
    printf("Yes\\n");

  return 0;
}
Problem p02418 (C++) — buggy submission, verdict: Runtime Error

#include <cctype>
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;

#define ll long long
#define REP(i, a, b) for (i = a; i < b; i++)
#define rep(i, n) REP(i, 0, n)
#define MD 1000000007

char sep[2] = {' ', '\\n'};

int main() {
  int i, j, k, n, m, l;

  char s1[210], s2[110], s3[210];
  cin >> s1 >> s2;
  strcpy(s3, s1);
  strcat(s3, s1);
  if (nullptr == strstr(s3, s2))
    cout << "No" << endl;
  else
    cout << "Yes" << endl;

  return 0;
}


Error: 0

Fixed submission:

#include <cctype>
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;

#define ll long long
#define REP(i, a, b) for (i = a; i < b; i++)
#define rep(i, n) REP(i, 0, n)
#define MD 1000000007

char sep[2] = {' ', '\\n'};

int main() {
  int i, j, k, n, m, l;

  char s1[210], s2[110];
  scanf("%s\\n%s", s1, s2);
  strcat(s1, s1);
  if (nullptr == strstr(s1, s2))
    cout << "No" << endl;
  else
    cout << "Yes" << endl;

  return 0;
}
Problem p02418 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <string.h>
using namespace std;
int main() {
  char s[205], p[105];
  char a[10000];
  cin >> s;
  cin >> p;
  strcat(a, s);
  strcat(a, s);
  if (strstr(a, p) != NULL) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Error: 0

Fixed submission:

#include <iostream>
#include <string.h>
using namespace std;
int main() {
  char s[205], p[105];
  cin >> s;
  cin >> p;
  strcat(s, s);
  if (strstr(s, p) != NULL) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}
Problem p02418 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>

using namespace std;

int main() {

  char s[200];
  char p[100];

  bool answer = false;

  cin >> s;
  cin >> p;

  // cout << "Complete Cin" << endl;

  // 文字列を文字列終了直後にコピーする。
  for (int i = 0;; i++) {

    // cout << "Now Loading1" << endl;

    bool flag = false;

    if (s[i] == 0) {

      int x = i;

      for (int j = x; j < x * 2; j++) {
        s[j] = s[j - x];
      }

      s[x * 2] = 0;

      flag = true;
    }

    if (flag == true) {
      break;
    }
  }

  for (int i = 0;; i++) {

    // cout << "Now Loading2" << endl;

    if (s[i] == 0) {
      break;
    }

    if (p[0] == s[i]) {

      // cout << "Now Loading3" << endl;

      int x = i;
      int j = 0;

      while (1) {
        if (p[j] == 0 && p[j - 1] == s[x - 1]) {
          answer = true;
          break;
        }
        if (p[j] != s[x]) {
          break;
        }

        j++;
        x++;
      }
    }
  }

  if (answer) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>

using namespace std;

int main() {

  char s[200];
  char p[100];

  bool answer = false;

  cin >> s;
  cin >> p;

  // 文字列を文字列終了直後にコピーする。
  for (int i = 0;; i++) {

    bool flag = false;

    if (s[i] == 0) {

      int x = i;

      for (int j = x; j < (x - 1) * 2; j++) {
        s[j] = s[j - x];
      }

      s[(x - 1) * 2 + 1] = 0;

      flag = true;
    }

    if (flag == true) {
      break;
    }
  }

  for (int i = 0;; i++) {

    if (s[i] == 0) {
      break;
    }

    if (p[0] == s[i]) {

      int x = i;
      int j = 0;

      while (1) {
        if (p[j] == 0 && p[j - 1] == s[x - 1]) {
          answer = true;
          break;
        }
        if (p[j] != s[x]) {
          break;
        }
      }
    }
  }

  if (answer) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}
Problem p02418 (C++) — buggy submission, verdict: Runtime Error

#include <cstring>
#include <stdio.h>

int main() {
  char s[201], p[101], t[101];
  scanf("%s %s", s, p);
  strcpy(t, s);
  strcat(s, t);
  if (strstr(s, p) == NULL) {
    printf("No\\n");
  } else {
    printf("Yes\\n");
  }
  return 0;
}

Error: 0

Fixed submission:

#include <cstring>
#include <stdio.h>

int main() {
  char s[200], p[100];
  scanf("%s %s", s, p);
  if (strstr(strcat(s, s), p) == NULL) {
    printf("No\\n");
  } else {
    printf("Yes\\n");
  }
  return 0;
}
Problem p02418 (C++) — buggy submission, verdict: Runtime Error

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

using namespace std;
int main() {
  string s, p;
  cin >> s >> p;
  s = s + s;
  if (s.find(p) != -1) {
    printf("Yes\\n");
  } else {
    printf("No\\n");
  }
}


Error: -11

Fixed submission:

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

using namespace std;
int main() {
  string s1, s2;
  scanf("%s", &s1);
  scanf("%s", &s2);
  for (int i = 0; i < s2.length(); i++) {
    if (s1.find(s2[i])) {
      if (i = s2.length() - 1)
        printf("Yes");
    } else {
      printf("No");
      break;
    }
  }
}
Problem p02418 (C++) — buggy submission, verdict: Runtime Error

#include <cstdio>
#include <cstring>
using namespace std;
int main(void) {
  char str1[101], str2[101], str3[201];
  scanf("%s %s", str1, str2);
  strcpy(str3, str1);
  strcat(str3, str1);
  if (strstr(str3, str2))
    printf("Yes\\n");
  else
    printf("No\\n");

  return 0;
}


Error: 0

Fixed submission:

#include <cstdio>
#include <cstring>
using namespace std;
int main(void) {
  char str1[201], str2[101];
  scanf("%s %s", str1, str2);
  strcat(str1, str1);
  if (strstr(str1, str2))
    printf("Yes\\n");
  else
    printf("No\\n");

  return 0;
}
Problem p02418 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cctype>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
  std::string s;
  std::string p;
  cin >> s;
  cin >> p;
  s += s;
  int loc = s.find(p, 0);
  if (loc != string::npos)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Error: 1

Fixed submission:

#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
  char s[200], p[100];
  int chk = 0;
  scanf("%s", s);
  scanf("%s", p);
  string s1(s);
  string p1(p);
  int gl = p1.size();
  s1 += s1;
  int st = s1.size();
  for (int i = 0; i <= st; i++) {
    if (s1[i] == p[chk]) {
      chk++;
      if (chk == gl) {
        printf("Yes\\n");
        exit(1);
      }
    } else {
      chk = 0;
    }
  }
  printf("No\\n");
  return 0;
}
Problem p02418 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  string p, s;
  cin >> s;
  cin >> p;
  while (s.size() <= 100)
    s += s;
  if (s.find(p) != string::npos)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Error: -6
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc


Fixed submission:

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

int main() {
  string p, s;
  cin >> s;
  cin >> p;
  for (int i = 0; i < 100; i++)
    s += s;
  if (s.find(p) != string::npos)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
Problem p02418 (C++) — buggy submission, verdict: Runtime Error

#include <cstdio>
#include <cstring>

int main() {
  char str1[201], str2[101], str3[101];
  scanf("%s %s", str1, str2);

  strcpy(str3, str1);
  strcat(str1, str3);
  if (strstr(str1, str2) == NULL) {
    printf("No\\n");
  } else {
    printf("Yes\\n");
  }

  return 0;
}


Error: 0

Fixed submission:

#include <cstdio>
#include <cstring>

int main() {
  char str1[200], str2[100];
  scanf("%s %s", str1, str2);

  strcat(str1, str1);
  if (strstr(str1, str2) != NULL) {
    printf("Yes\\n");
  } else {
    printf("No\\n");
  }

  return 0;
}
Problem p02418 (C++) — buggy submission, verdict: Runtime Error

#include <cstdio>
#include <cstring>

int main() {
  char s[300], p[300], t[300];

  scanf("%s", s);
  scanf("%s", p);

  strcpy(t, s);
  strcat(s, t);
  if (strstr(s, p)) {
    printf("Yes\\n");
  } else {
    printf("No\\n");
  }

  return 0;
}


Error: 0

Fixed submission:

#include <cstdio>
#include <cstring>

int main() {
  char s[300], p[300];

  scanf("%s", s);
  scanf("%s", p);

  strcat(s, s);
  if (strstr(s, p)) {
    printf("Yes\\n");
  } else {
    printf("No\\n");
  }

  return 0;
}
Problem p02418 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <string>
using namespace std;
int main() {
  int a, b;
  string s, p;
  cin >> s >> p;
  s = s + s;
  a = s.size() * 2 - 1;
  b = s.size();
  for (int i = 0; i < b; i++) {
    for (int n = 1; n < a; n++) {
      if (p == s.substr(i, n)) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}


Error: 0

Fixed submission:

#include <iostream>
#include <string>
using namespace std;
int main() {
  int a, b;
  string s, p;
  cin >> s >> p;
  s = s + s;
  a = s.size() * 2 - 1;
  b = p.size();
  for (int i = 0; i < a; i++) {
    for (int n = 1; n < a; n++) {
      if (p == s.substr(i, n)) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}
Problem p02418 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  int len1, len2, i, j = 0, k;
  char str1[100];
  char str2[100];
  char str3[200];

  scanf("%s", str1);
  scanf("%s", str2);

  sprintf(str3, "%s%s\\n", str1, str1);

  if (strstr(str3, str2) != NULL) {
    printf("Yes\\n");
  } else {
    printf("No\\n");
  }
  return 0;
}

Error: 0

Fixed submission:

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

int main() {
  char str1[200];
  char str2[100];

  scanf("%s", str1);
  scanf("%s", str2);

  strcat(str1, str1);

  if (strstr(str1, str2) != NULL) {
    printf("Yes\\n");
  } else {
    printf("No\\n");
  }
  return 0;
}
Problem p02418 (C++) — buggy submission, verdict: Runtime Error

#include <cstring>
#include <iostream>
using namespace std;

int main() {
  char test_str[201], search_string[101], copied_test_str[101];
  cin >> test_str >> search_string;
  strcpy(copied_test_str, test_str);
  strcat(test_str, copied_test_str);

  cout << (strstr(test_str, search_string) ? "Yes" : "No") << endl;
  return 0;
}

Error: 0

Fixed submission:

#include <cstring>
#include <iostream>
using namespace std;

int main() {
  char str1[201], str2[101];
  cin >> str1 >> str2;
  cout << (strstr(strcat(str1, str1), str2) ? "Yes" : "No") << endl;
  return 0;
}
Problem p02418 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  char a[101], b[101], c[201];
  cin >> a >> b;
  strcpy(c, a);
  strcat(c, a);
  if (strstr(c, b))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Error: 0

Fixed submission:

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

int main() {
  char a[210], b[101];
  cin >> a >> b;
  strcat(a, a);
  if (strstr(a, b))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
Problem p02418 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <string>
using namespace std;
int main() {
  string s, p;
  cin >> s >> p;
  bool a = false;
  for (int i = 0; i < s.size(); i++) {
    int count = 0;
    for (int j = 0; j < p.size(); j++) {
      if (s[(i + j) % s.size()] == p[j % p.size()])
        count++;
    }
    if (count == p.size())
      a = true;
  }
  if (a == true)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Error: -11

Fixed submission:

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

int main() {
  char s[200]; //?????¶????????????s
  char p[101]; //??£?¶????????????????p
  int i, j, k;

  while (1) { //?????????S???????????????
    cin >> s;
    if (s[i] == '\\n')
      break;
    i++;
  }

  for (k = 0; k < i; k++)
    s[k + i] = s[k]; //??????????????£???

  while (1) {
    scanf("%c", &p[j]);
    if (p[j] == '\\n')
      break;
    j++;
  }
  int m;
  for (int k = 0; k < i; k++) {
    if (s[k] == p[0]) {
      for (m = 0; m < j; m++) {
        if (s[k + m] != p[m])
          break;
      }
      if (m == j) {
        printf("Yes\\n");
      } else {
        printf("No\\n");
      }
      return (0);
    }
  }
  cout << endl;
  return (0);
}
Problem p02418 (C++) — buggy submission, verdict: Runtime Error

#include <cstdio>
#include <cstring>

int main() {
  char s[202], p[100];
  scanf("%s", s);
  scanf("%s", p);
  sprintf(s, "%s%s", s, s);
  if (strstr(s, p)) {
    printf("Yes\\n");
  } else {
    printf("No\\n");
  }
  return 0;
}

Error: 0

Fixed submission:

#include <cstdio>
#include <cstring>

int main() {
  char s[202], p[100];
  scanf("%s", s);
  scanf("%s", p);
  strcat(s, s);
  if (strstr(s, p)) {
    printf("Yes\\n");
  } else {
    printf("No\\n");
  }
  return 0;
}
Problem p02418 (C++) — buggy submission, verdict: Runtime Error

#include <cstdio>
#include <cstring>
using namespace std;

int main(void) {
  char ring[202], cp[101], search[101];
  scanf("%s %s", ring, search);
  strcpy(cp, ring);
  strcat(ring, cp);
  if (strstr(ring, search))
    printf("Yes\\n");
  else
    printf("No\\n");
  return 0;
}

Error: 0

Fixed submission:

#include <cstdio>
#include <cstring>
using namespace std;

int main(void) {
  char ring[300], search[200];
  scanf("%s %s", ring, search);
  strcat(ring, ring);
  if (strstr(ring, search))
    printf("Yes\\n");
  else
    printf("No\\n");
  return 0;
}
Problem p02418 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <string.h>

using namespace std;

int main() {
  char s[201], p[101], t[101];
  cin >> s >> p;
  strcpy(t, s);
  strcat(s, t);
  cout << (strstr(s, p) == NULL ? "No" : "Yes") << endl;
}


Error: 0

Fixed submission:

#include <iostream>
#include <string.h>

using namespace std;

int main() {
  char s[201], p[101];
  cin >> s >> p;
  strcat(s, s);
  cout << (strstr(s, p) == NULL ? "No" : "Yes") << endl;
}
Problem p02418 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
using namespace std;
int main() {
  string a, b, c;
  while (cin >> a >> b) {
    c = a + a;
    for (int i = 0; i < a.size(); i++)
      if (b == c.substr(i, b.size())) {
        cout << "Yes" << endl;
        goto EXIT;
      }
    cout << "No" << endl;
  EXIT:;

    return 0;
  }
}

Error: 0

Fixed submission:

#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
using namespace std;
int main() {
  string a, b;
  while (cin >> a >> b) // b?°±???key???a????????¬,???bi??????????????\\????????°
  {
    int j = 0, k[200];
    k[0] = -10000;
    int p = 0;

    for (int i = 0; i < a.length(); i++) {
      if (a[i] == b[j]) //????????????????????????
      {

        if (a.length() - i < b.length()) {
          k[p] = a.length() - i;
          p++;
        }

        j++;
        if (i == a.length() - 1 && j != 0 &&
            j < b.length()) //????????¶????°±???????§£??????i????????¶????????????lent
        {
          i = -1; //??????+1????????´??????
          continue;
        }
        if (j == b.length()) {
          cout << "Yes" << endl;
          break;
        }

        continue;
      }
      if (i <= a.length() - b.length() &&
          i >=
              b.length() - 1 -
                  k[0]) //??????????????????????????????,???????°±????????¢????¬??????????????????????????????????????????????
      {
        cout << "No" << endl;
        break;
      }

      j = 0;
      if (j == 0 &&
          i ==
              a.length() -
                  1) //?????????????§???????,if?????§???????°?????????????,????????¢?????????????°±?????°????????????????¢?
      {
        cout << "No" << endl;
        break;
      }
    }
  }
}
Problem p02418 (C++) — buggy submission, verdict: Runtime Error

#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
using namespace std;

int main() {
  char s[202];
  cin >> s;
  char p[101];
  cin >> p;
  char s1[202];
  for (int i = 0; i < strlen(s); i++)
    s1[i] = s[i];

  strcat(s, s1);
  if (strstr(s, p))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Error: 0

Fixed submission:

#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
using namespace std;

int main() {
  char s[404];
  cin >> s;
  char p[202];
  cin >> p;
  strcat(s, s);
  if (strstr(s, p))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
Problem p02418 (C++) — buggy submission, verdict: Time Limit Exceeded

#include "bits/stdc++.h"
using namespace std;
int main() {
  string s, p;
  cin >> s >> p;
  int i, j, n, m;
  n = s.length();
  m = p.length();
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      if (s.at((i + j) % n) != p.at(j))
        break;
      if (j == m - 1)
        j++;
    }
    if (j == m + 1) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}


Error: TLE

Fixed submission:

#include "bits/stdc++.h"
using namespace std;
int main() {
  string s, p;
  cin >> s >> p;
  int i, j, n, m;
  n = s.length();
  m = p.length();
  for (i = 0; i < n; i = (i + 1) % n) {
    for (j = 0; j < m; j++) {
      if (s.at((i + j) % n) != p.at(j))
        break;
      if (j == m - 1)
        j++;
    }
    if (j == m + 1) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}