alexjercan/bugnet huggingface dataset:
Problem p02681 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;

int main() {
  string S, T;
  cin >> S >> T;

  int count = 0;
  for (int i = 0; i < S.size(); i++) {
    if (S.at(i) == T.at(i)) {
      count++;
    }
  }

  if (count == S.size()) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Error: -6
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::at: __n (which is 9) >= this->size() (which is 9)


Fixed submission:

#include <iostream>
using namespace std;

int main() {
  string S, T;
  cin >> S >> T;

  T.at(S.size() + 1) = ' ';

  if (S == T) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
Problem p02681 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long unsigned int ll;

int main() {
  string s, t;
  cin >> s;
  cin >> t;
  t.erase(t.begin() + s.length());
  if (s == t) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Error: -11

Fixed submission:

#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long unsigned int ll;

int main() {
  string s, t;
  cin >> s;
  t.erase(t.begin() + s.length());
  cout << t << endl;
  if (s == t) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
Problem p02681 (C++) — buggy submission, verdict: Runtime Error

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

int main() {

  string S, T, nS;
  cin >> S >> T;
  int t;
  t = T.size();
  t--;
  char P;
  P = T.at(t);
  nS = S + P;
  if (T == nS) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Error: WA

Fixed submission:

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

int main() {

  string S, T;
  cin >> S >> T;
  bool a = false;
  int s, t;
  s = S.size();
  t = T.size();
  for (int i; i < s; i++) {
    for (int j; j < s; j++) {
      if (S.at(i) == T.at(j)) {
        a = true;
        continue;
      } else {
        a = false;
        break;
      }
    }
  }

  if (t == s + 1 && a == true) {

    cout << "Yes" << endl;
  } else if (t == s + 1 && a == false) {
    cout << "No" << endl;
  } else {
    cout << "No" << endl;
  }
}
Problem p02681 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  string S, T;
  cin >> S >> T;
  int x = S.size();
  int a = 0;

  for (int i = 0; i < x; i++) {
    if (S.at(i) == T.at(i))
      a++;
    else
      continue;
  }

  if (a == x)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Error: -6
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::at: __n (which is 8) >= this->size() (which is 8)


Fixed submission:

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

int main() {
  string S, T;
  cin >> S >> T;
  int x = S.size();

  for (int i = 0; i < x; i++) {
    if (S.at(i) == T.at(i))
      continue;
    else {
      break;
      cout << "No" << endl;
    }
  }

  if (S.at(x) == T.at(x))
    cout << "Yes" << endl;
}
Problem p02681 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  string S, T;

  cin >> S >> T;

  T.pop_back();

  if (S != T) {
    cout << "No" << endl;

  } else {

    cout << "Yes" << endl;
  }
}


Error: -6
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::at: __n (which is 8) >= this->size() (which is 8)


Fixed submission:

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

int main() {
  string S, T;
  int N;

  cin >> S >> T;

  N = S.size();

  for (int i = 0; i < N + 1; i++) {

    if (S.at(i) != T.at(i)) {
      cout << "No" << endl;
    }
  }
  cout << "Yes" << endl;
}
Problem p02681 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <string>
using namespace std;
int main() {

  string s, t;
  cin >> s >> t;
  t = t.erase(t.size() - 1);
  if (s == t) {
    cout << "Yes";
  } else {
    cout << "No";
  }
  return 0;
}

Error: -6
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::erase: __pos (which is 122) > this->size() (which is 9)


Fixed submission:

#include <iostream>
#include <string>
using namespace std;
int main() {

  string s, t;
  cin >> s >> t;
  t = t.erase(t[t.size() - 1]);
  if (s == t) {
    cout << "Yes";
  } else {
    cout << "No";
  }
  return 0;
}
Problem p02681 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <string>

using namespace std;

int main() {
  string s, t;
  cin >> s;
  cin >> t;
  if (t.size() == s.size() + 1) {
    for (int i = 0; i < s.size(); i++) {
      if (s[i] != t[i]) {
        cout << "No" << endl;
        return 0;
      }
    }
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
  return 0;
}

Error: 1

Fixed submission:


#include <iostream>
#include <string>

using namespace std;

int main() {
  string s, t;
  cin >> s;
  cin >> t;
  if (t.size() == s.size() + 1) {
    for (int i = 0; i < s.size(); i++) {
      if (s[i] != t[i])
        return false;
    }
    return true;
  }
  return false;
}
Problem p02681 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <string>

using namespace std;

int main() {
  string s, t;
  cin >> s >> t;

  int len = t.length();
  if (len != s.length() + 1) {
    cout << "No" << endl;
    return -1;
  }

  string u = t.substr(0, len - 1);
  if (s != u) {
    cout << "No" << endl;
    return 0;
  }

  for (char c = 'a'; c <= 'z'; c++) {
    if (t[len - 1] == c) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}


Error: 0

Fixed submission:

#include <iostream>
#include <string>

using namespace std;

int main() {
  string s, t;
  cin >> s >> t;

  int len = t.length();
  if (len != s.length() + 1) {
    cout << "No" << endl;
    return -1;
  }

  string u = t.substr(0, len - 1);
  if (s != u) {
    cout << "No" << endl;
    return -1;
  }

  for (char c = 'a'; c <= 'z'; c++) {
    if (t[len - 1] == c) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}
Problem p02681 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  string S, T;
  cin >> S >> T;
  int N;
  N = S.size();

  if (N + 1 == T.size()) {

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

      if (S.at(i) != T.at(i)) {
        cout << "No" << endl;
        break;
      } else if (i < N - 1) {
        continue;
      }

      else if (i == N - 1 && S.at(N - 1) == T.at(N - 1)) {
        cout << "Yes" << endl;
      }
    }
  }

  else {
    cout << "No" << endl;
  }
}

Error: -6
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::at: __n (which is 8) >= this->size() (which is 8)


Fixed submission:

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

int main() {
  string S, T;
  cin >> S >> T;

  if (S.size() + 1 == T.size()) {
    for (int i = 0; i < S.size() - 1; i++) {
      if (S.at(i) != T.at(i)) {
        cout << "No" << endl;
        break;
      } else {
        continue;
      }
    }
    if (S.at(S.size()) == T.at(S.size())) {
      cout << "Yes" << endl;
    }
  } else {
    cout << "No" << endl;
  }
}
Problem p02681 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <string>
#define arep(a, i, n) for (int i = (a); i < (n); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define cinf(x, n)                                                             \\
  for (int i = 0; i < (n); i++)                                                \\
    cin >> x[i];
#define coutf(x, n)                                                            \\
  for (int i = 0; i < (n); i++)                                                \\
    cout << x[i] << endl;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using namespace std;

ll str_len(char *s) {
  ll len;
  while (*s++)
    len++;
  return len;
}

bool judge(char *s, char *t, ll n) {
  rep(i, n) {
    if (s[i] != t[i])
      return false;
  }
  return true;
}

int main() {
  char s[100], t[100];
  cin >> s >> t;
  if (str_len(t) == str_len(s) + 1 && judge(s, t, str_len(s)) == true)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Error: WA

Fixed submission:

#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <string>
#define arep(a, i, n) for (int i = (a); i < (n); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define cinf(x, n)                                                             \\
  for (int i = 0; i < (n); i++)                                                \\
    cin >> x[i];
#define coutf(x, n)                                                            \\
  for (int i = 0; i < (n); i++)                                                \\
    cout << x[i] << endl;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using namespace std;

int str_len(char *s) {
  int len;
  while (*s++)
    len++;
  return len;
}

int main() {
  char s[10], t[10];
  cin >> s >> t;
  if (str_len(t) == str_len(s) + 1)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
Problem p02681 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;

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

  string S, T;

  cin >> S >> T;

  if (S.length() > 10 || S.length() < 1) {
    cout << "No" << endl;
    return 0;
  }

  if (S + T[T.length() - 1] != T) {
    cout << "No" << endl;
    return 0;
  }

  cout << "Yes" << endl;
  return 0;
}


Error: 0

Fixed submission:

#include <iostream>
using namespace std;

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

  string S, T;

  cin >> S >> T;

  if (S.length() > 10 || S.length() < 1) {
    cout << "No" << endl;
    return 1;
  }

  if (S + T[T.length() - 1] != T) {
    cout << "No" << endl;
    return 1;
  }

  cout << "Yes" << endl;
  return 0;
}
Problem p02681 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  string s, t;
  cin >> s >> t;
  t.pop_back();
  if (s == t) {
    puts("Yes");
  } else
    puts("No");
}


Error: WA

Fixed submission:

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

int main() {
  char *c;
  string s, t;
  cin >> s >> t;

  if (s + c == t) {
    puts("Yes");
    return 0;
  } else
    puts("No");
}
Problem p02681 (C++) — buggy submission, verdict: Runtime Error

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

int main() {

  string S, T;
  cin >> S >> T;
  for (int i = 0; i < S.size(); i++) {
    if (S.at(i) != T.at(i)) {
      cout << "No" << endl;
      break;
    }
    if (i == S.size() - 1) {
      cout << "Yes" << endl;
    }
  }
}


Error: -6
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::at: __n (which is 8) >= this->size() (which is 8)


Fixed submission:

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

int main() {

  string S, T;
  cin >> S >> T;
  for (int i = 0; i < (T.size()); i++) {
    if (S.at(i) != T.at(i)) {
      cout << "No" << endl;
      break;
    }
    if (i == (T.size() - 1)) {
      cout << "Yes" << endl;
    }
  }
}
Problem p02681 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  string S, T, ans = "Yes";
  cin >> S >> T;

  for (int i = 0; i < S.size(); i++) {
    if (S.at(i) != T.at(i)) {
      ans = "No";
      break;
    }
  }

  cout << ans << endl;

  return 0;
}


Error: 0

Fixed submission:

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

int main() {
  string S, T;
  cin >> S >> T;

  for (size_t i = 0; i < S.size(); i++) {
    if (S.at(i) != T.at(i)) {
      cout << "No" << endl;
      return -1;
    } else
      continue;
  }

  cout << "Yes" << endl;

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

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

int main(void) {
  char s[20], t[20];
  int len;
  scanf("%s %s", s, t);
  len = strlen(s);
  for (int i = 0; i < len; i++) {
    if (s[i] != t[i]) {
      printf("No\\n");
      return 0;
    }
  }
  printf("Yes\\n");
  return 0;
}

Error: 0

Fixed submission:

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

int main(void) {
  char s[10], t[10];
  int len;
  scanf("%s %s", s, t);
  len = strlen(s);
  for (int i = 0; i < len; i++) {
    if (s[i] != t[i]) {
      printf("No\\n");
      return 0;
    }
  }
  printf("Yes\\n");
  return 0;
}
Problem p02681 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, x, n) for (int i = x; i < (n); i++)
#define ALL(n) begin(n), end(n)
#define MOD (1000000007)
#define INF (1e9)
#define INFL (1e18)

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template <class T> using arr = vector<vector<T>>;
template <class T> void pr(T x) { cout << x << endl; }
template <class T> void prvec(vector<T> &a) {
  rep(i, a.size() - 1) { cout << a[i] << " "; }
  pr(a[a.size() - 1]);
}
template <class T> void prarr(arr<T> &a) {
  rep(i, a.size()) if (a[i].empty()) pr("");
  else prvec(a[i]);
}
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}

int main() {
  string s, t;
  cin >> s >> t;
  if (s.size() != t.size() - 1)
    pr("No");
  else {
    bool flag = false;
    rep(i, s.size()) if (s[i] != t[i]) {
      pr("No");
      flag = true;
      break;
    }
    if (!flag)
      pr("Yes");
  }
  return 0;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, x, n) for (int i = x; i < (n); i++)
#define ALL(n) begin(n), end(n)
#define MOD 1000000007

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
// template <class T>
// void print(T& x){printf("%d\\n", x);}
// void printvec(vector<int> a){
//     rep(i, a.size()-1){
//         printf("%d ", a[i]);
//     }
//     printf("%d\\n", a[a.size()-1]);
// }

int main() {
  char s[10], t[10];
  string ss, tt;
  scanf("%s", s);
  scanf("%s", t);

  ss = s;
  tt = t;
  bool flag = true;
  for (int i = 0; i < ss.length(); i++) {
    if (s[i] != t[i]) {
      flag = false;
      break;
    }
  }

  if (flag)
    printf("Yes\\n");
  else
    printf("No\\n");
  return 0;
}
Problem p02681 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  string S, T;
  cin >> S >> T;
  T.pop_back();
  if (S == T)
    cout << "Yes";
  else
    cout << "No";
}

Error: WA

Fixed submission:

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

int main() {
  string S, T;
  cin >> S >> T;
  for (int i = 0; i < S.length(); i++) {
    if (S[i] != T[i]) {
      cout << "No";
      exit(1);
    }
  }
  cout << "Yes";
}
Problem p02681 (C++) — buggy submission, verdict: Runtime Error

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

char tolowr(char c) {
  if ((c >= 'A') && (c <= 'Z')) {
    return (c + 0x20);
  } else {
    return 0;
  }
}

int main() {
  int i, flug = 0;
  string S;
  string T;
  int s, t;
  char c;

  cin >> S >> T;

  s = S.size();
  t = T.size();

  for (i = 0; i < s; i++) {
    if (S.at(i) != T.at(i)) {
      flug = 1;
      // cout << i << ":" << flug << endl;
    }
  }

  // cout << flug << endl;

  // transform (T.begin (), T.end (), T.begin (), tolower);
  // t=
  // cout << T.at(n)-0x20 << endl;

  if (t - s == 1 && flug == 0 && T.at(t - 1) == tolower(T.at(t - 1))) {
    if (t <= 11) {

      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  } else {
    cout << "No" << endl;
  }
}

Error: -6
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::at: __n (which is 9) >= this->size() (which is 9)


Fixed submission:

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

int main() {
  int i, flug = 0;
  string S;
  string T;
  // string t;

  cin >> S >> T;

  // t=T;

  for (i = 0; i < S.size(); i++) {
    if (S.at(i) == T.at(i)) {
      flug = 1;
    } else {
      flug = 0;
    }
  }
  // transform (T.begin (), T.end (), T.begin (), tolower);

  if (T.size() - S.size() == 1 && flug == 1 &&
      T.at(S.size() + 1) == (T.at(S.size() + 1) + 0x20)) {
    if (T.size() <= 11) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  } else {
    cout << "No" << endl;
  }
}
Problem p02681 (C++) — buggy submission, verdict: Runtime Error

#include <cstdio>
#include <cstring>
using namespace std;
int main(void) {
  int i, flg, n;
  flg = 0;
  char s[11], t[12];
  scanf("%s", s);
  scanf("%s", t);
  n = strlen(s);
  for (i = 0; i < n; i++) {
    if (s[i] != t[i])
      flg = 1;
  }
  if (flg == 1)
    printf("No\\n");
  else
    printf("Yes\\n");
  return 0;
}


Error: 0

Fixed submission:

#include <cstdio>
#include <cstring>
using namespace std;
int main(void) {
  int i, flg, n;
  flg = 0;
  char s[10], t[10];
  scanf("%s", s);
  scanf("%s", t);
  n = strlen(s);
  for (i = 0; i < n; i++) {
    if (s[i] != t[i])
      flg = 1;
  }
  if (flg == 1)
    printf("No\\n");
  else
    printf("Yes\\n");
  return 0;
}
Problem p02681 (C++) — buggy submission, verdict: Runtime Error

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

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

  if (strncmp(s, t, strlen(s)) != 0) {
    printf("No\\n");
  } else {
    if (strlen(t) != strlen(s) + 1)
      printf("No\\n");
    else
      printf("Yes\\n");
  }
  return 0;
}


Error: 0

Fixed submission:

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

int main() {
  char s[11], t[12];
  scanf("%s %s", &s, &t);

  for (int i = 0; i < strlen(s); i++) {
    if (t[i] != s[i]) {
      printf("No\\n");
      return 1;
      break;
    }
  }

  printf("Yes\\n");
  return 0;
}
Problem p02681 (C++) — buggy submission, verdict: Runtime Error

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

typedef long long ll;
typedef long double ld;

int main() {
  string s;
  cin >> s;
  string t;
  cin >> t;
  t.pop_back();
  if (s == t)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Error: -6
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string: construction from null is not valid


Fixed submission:

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

typedef long long ll;
typedef long double ld;

int main() {
  string s(0);
  cin >> s;
  string t(0);
  cin >> t;
  t.pop_back();
  if (s == t)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
Problem p02681 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <string>
using namespace std;
int main() {
  string x;
  string n;
  cin >> x >> n;
  n.pop_back();
  if (n == x) {
    cout << "Yes"
         << "\\n";
  } else {
    cout << "No"
         << "\\n";
  }
}


Error: 1

Fixed submission:

#include <iostream>
#include <string>
using namespace std;
int main() {
  string x;
  string n;
  cin >> x >> n;
  n.pop_back();
  if (n == x) {
    cout << "Yes"
         << "\\n";
    return true;
  } else {
    cout << "No"
         << "\\n";
  }
}
Problem p02681 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>

using namespace std;

int main(void) {
  string S, T;
  cin >> S >> T;
  if (S == T.substr(0, S.length())) {
    cout << "Yes";
  } else {
    cout << "No";
  }
  return 0;
}


Error: 1

Fixed submission:

#include <iostream>

using namespace std;

int main(void) {
  string S, T;
  cin >> S >> T;
  return S == T.substr(0, S.length());
}
Problem p02681 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, st, sa, sb;
  cin >> st >> s;
  sa = s.substr(0, s.size() - 1);
  if (sa == st) {
    cout << "Yes";
    return 0;
  }
  cout << "No";
  return 0;
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, st;
  cin >> st >> s;
  for (int i = 0; i < s.size(); i++) {
    string sa = s.substr(0, i + 1);
    string sb = s.substr(i + 2, s.size() - i - 1);
    if (sa + sb == st) {
      cout << "Yes";
      return 0;
    }
  }
  cout << "No";
  return 0;
}
Problem p02681 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  string s, t;
  cin >> s;
  cin >> t;
  bool flag = false;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == t[i]) {
      flag = true;
    } else {
      flag = false;
      break;
    }
  }
  if (flag == true) {
    cout << "Yes" << endl;
  } else if (flag == false) {
    cout << "No" << endl;
  }

  return 0;
}


Error: -11

Fixed submission:

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

int main() {
  string s, t;
  cin >> s;
  cin >> t;
  for (int i = 0; i < 100; i++) {
    if (s[i] = t[i]) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }

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

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

int main() {
  string S, T;
  cin >> S >> T;
  int a = S.size();
  char b = T.at(a);
  if (T == S + b) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Error: -6
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::at: __n (which is 9) >= this->size() (which is 9)


Fixed submission:

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

int main() {
  string S, T;
  cin >> S >> T;
  int a = S.size();
  char b = T.at(a + 1);
  if (T == S + b) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
Problem p02681 (C++) — buggy submission, verdict: Runtime Error

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

typedef pair<int, int> P;
typedef long long ll;

#define REP(i, n) for (int i = 0; i < n; i++) // 普通のループ
#define REPTO(i, n) for (int i = 0; i <= n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)  // 逆ループ
#define FOR(i, m, n) for (int i = m; i < n; i++) // 最初の数値を指定

int strlen(char *s) {
  int i = 0;
  while (s[i] != '\\0') {
    i++;
  }
  return i;
}

int main() {
  char S[20];
  char T[20];
  cin >> S >> T;
  int ans = 0;
  for (int i = 0; i < strlen(S); i++) {
    if (S[i] == T[i]) {
    } else {
      ans = 1;
    }
  }
  if (ans == 0) {
    if (strlen(T) - strlen(S) == 1) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  } else {
    cout << "No" << endl;
  }

  return 0;
}

Error: 0

Fixed submission:

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

typedef pair<int, int> P;
typedef long long ll;

#define REP(i, n) for (int i = 0; i < n; i++) // 普通のループ
#define REPTO(i, n) for (int i = 0; i <= n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)  // 逆ループ
#define FOR(i, m, n) for (int i = m; i < n; i++) // 最初の数値を指定

int strlen(char *s) {
  int i = 0;
  while (s[i] != '\\0') {
    i++;
  }
  return i;
}

int main() {
  char S[10];
  char T[10];
  cin >> S >> T;
  int ans = 0;
  for (int i = 0; i < strlen(S); i++) {
    if (S[i] == T[i]) {
    } else {
      ans = 1;
    }
  }
  if (ans == 0) {
    if (strlen(T) - strlen(S) == 1) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  } else {
    cout << "No" << endl;
  }

  return 0;
}