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

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using lint = long int;
using llint = long long int;
using namespace std;

bool is_palindrome(string str) {
  int head = 0;
  int tail = (int)str.size() - 1;
  while (head <= tail) {
    if (str[head] != str[tail]) {
      return false;
    }
    head++;
    tail--;
  }
  return true;
}

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

  string s;
  cin >> s;

  int n = s.size() / 2;

  string first = s.substr(0, n);
  string second = s.substr(n + 1);
  // cout << first << endl;
  // cout << second << endl;
  bool str_good = is_palindrome(s);
  bool first_good = is_palindrome(first);
  bool second_good = is_palindrome(second);

  if (str_good == true && first_good == true && second_good == true) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using lint = long int;
using llint = long long int;
using namespace std;

bool is_palindrome(string str) {
  int head = 0;
  int tail = (int)str.size() - 1;
  while (head <= tail) {
    if (str[head] != str[tail]) {
      cout << "No" << endl;
      exit(-1);
    }
    head++;
    tail--;
  }
  return true;
}

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

  string s;
  cin >> s;
  int n = s.size();
  string first = s.substr(0, ((n - 1) / 2));
  string second = s.substr((n + 3) / 2 - 1);

  if (is_palindrome(first) == 1 && is_palindrome(second) == 1) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}
Problem p02730 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>

int main(void) {
  std::string S, s1, s2;
  int N, N1;
  std::cin >> S;
  N = S.size();
  bool flag = true;
  while (flag) {
    for (int i = 0; i < (N - 1) / 2; i++) {
      if (S[i] != S[N - i - 1]) {
        std::cout << "No" << std::endl;
        // return -1;
        flag = !flag;
        break;
      }
    }
    if (!flag) {
      break;
    }
    s1 = S.substr(0, (N - 1) / 2);
    // std::cout << s1 << std::endl;
    N1 = s1.size();
    if (N1 == 1) {
      std::cout << "Yes" << std::endl;
      return 0;
    } else if (N1 % 2 == 0) {
      for (int i = 0; i < N1 / 2; i++) {
        if (s1[i] != s1[N1 - i - 1]) {
          std::cout << "No" << std::endl;
          // return -1;
          flag = !flag;
          break;
        }
      }
    } else {
      for (int i = 0; i < (N1 - 1) / 2; i++) {
        if (s1[i] != s1[N1 - i - 1]) {
          std::cout << "No" << std::endl;
          // return -1;
          flag = !flag;
          break;
        }
      }
    }
    if (flag) {
      std::cout << "Yes" << std::endl;
      flag = !flag;
    }
  }

  return 0;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>

int main(void) {
  std::string S, s1, s2;
  int N, N1;
  std::cin >> S;
  N = S.size();
  bool flag = false;
  // while(flag){
  for (int i = 0; i < (N - 1) / 2; i++) {
    if (S[i] != S[N - i - 1]) {
      std::cout << "No" << std::endl;
      return -1;
      // flag = !flag;
    }
  }
  s1 = S.substr(0, (N - 1) / 2);
  // std::cout << s1 << std::endl;
  N1 = s1.size();
  if (N1 == 1) {
    std::cout << "Yes" << std::endl;
    return 0;
  } else if (N1 % 2 == 0) {
    for (int i = 0; i < N1 / 2; i++) {
      if (s1[i] != s1[N1 - i - 1]) {
        std::cout << "No" << std::endl;
        return -1;
        // flag = !flag;
      }
    }
  } else {
    for (int i = 0; i < (N1 - 1) / 2; i++) {
      if (s1[i] != s1[N1 - i - 1]) {
        std::cout << "No" << std::endl;
        return -1;
        // flag = !flag;
      }
    }
  }

  std::cout << "Yes" << std::endl;

  // s2 = s2.substr((N+3)/2, (N-1)/2));
  // }

  return 0;
}
Problem p02730 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  string S;
  cin >> S;
  string T = S;
  int s = S.size();
  bool a = true;
  bool b = true;
  bool c = true;
  reverse(S.begin(), S.end());

  if (S != T)
    a = false;
  string s1 = S.substr(0, (s - 1) / 2);
  string t1 = s1;
  reverse(s1.begin(), s1.end());

  if (s1 != t1)
    b = false;
  string s2 = S.substr((s + 1) / 2, s - 1);
  string t2 = s2;
  reverse(s2.begin(), s2.end());

  if (s2 != t2)
    c = false;

  if (a && b && c)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Error: TLE

Fixed submission:

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

int main() {
  string S;
  cin >> S;
  int s = S.size();
  s++;
  int s2 = s / 2; // 整数値
  bool a, b, c = true;
  for (int i = 0; i < s2; s2++) {
    if (S[i] != S[s - i - 1])
      a = false;
  }
  for (int i = 0; i < (s - 1) / 4; i++) {
    if (S[i] != S[(s - 1) / 2 - i - 1])
      b = false;
  }
  for (int i = (s + 1) / 2; i < s; i++) {
    if (S[i] != S[s - 1 + (s + 1) / 2 - i])
      c = false;
  }

  if (a && b && c)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
Problem p02730 (C++) — buggy submission, verdict: Runtime Error

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

bool pal(string str) {
  int i = 0, j = str.size() - 1;

  while (i < j) {
    if (str[i] != str[j])
      return false;

    i++;
    j--;
  }

  return true;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);

  string str;

  cin >> str;

  int f1 = 0, f2 = 0, f3 = 0;

  f1 = pal(str);

  f2 = pal(str.substr(0, (str.size() - 1) / 2));

  if (f1 && f2)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}


Error: 0

Fixed submission:

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

bool pal(string str) {
  int i = 0, j = str.size() - 1;

  while (i < j) {
    if (str[i] != str[j])
      return false;

    i++;
    j--;
  }

  return true;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);

  string str;

  cin >> str;

  int f1 = 0, f2 = 0, f3 = 0;

  f1 = pal(str);

  f2 = pal(str.substr(0, 3));

  f3 = pal(str.substr(4, 7));

  if (f1 && f2 && f3)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

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

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

bool isPalindrome(string x) {
  string y(x.rbegin(), x.rend());
  return x == y;
}

int main() {
  string s;
  cin >> s;
  int n = s.size();
  if (isPalindrome(s) && isPalindrome(s.substr(0, (n - 1) / 2)) &&
      isPalindrome(s.substr((n + 1) / 2))) {
    cout << "Yes" << endl;
    return 0;
  } else {
    cout << "No";
    return 0;
  }
}

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


Fixed submission:

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

bool kaibun(string x) {
  int L = x.size();
  bool checker = true;
  for (int i; i < L / 2; i++) {
    if (x.at(i) != x.at(L - i - 1)) {
      checker = false;
      return 0;
    }
  }
  return checker;
}
int main() {
  string S;
  cin >> S;
  int N = S.size();
  string ss = S.erase((N - 1) / 2);
  string sss = S.substr((N + 1) / 2);
  if (kaibun(S) && kaibun(ss) && kaibun(sss)) {
    cout << "Yes";
    return 0;
  } else {
    cout << "No";
    return 0;
  }
}
Problem p02730 (C++) — buggy submission, verdict: Runtime Error

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

bool KBjudge(string x) {

  string x_ = x;
  reverse(x.begin(), x.end());
  return (x_ == x);
}

int main() {

  string S;
  cin >> S;
  int N = S.size();

  if (KBjudge(S.substr(0, S.size()))) {
    if (KBjudge(S.substr(0, (N - 1) / 2))) {
      if (KBjudge(S.substr((N + 3) / 2 - 1, N - (N + 3) / 2 + 2))) {

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

Error: 0

Fixed submission:

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

bool KBjudge(string x) {

  string x_ = x;
  reverse(x.begin(), x.end());
  return (x_ == x);
}

int main() {

  string S;
  cin >> S;
  int N = S.size();

  if (KBjudge(S.substr(0, S.size()))) {
    if (KBjudge(S.substr(0, (N - 1) / 2))) {
      if (KBjudge(S.substr((N + 3) / 2 + 1, N - (N + 3) / 2))) {

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

#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
int ispal(string k) {
  string r = k;
  reverse(r.begin(), r.end());
  if (r == k)
    return 1;
  else
    return 0;
}
int main() {
  string s;
  cin >> s;
  ll n = s.size();
  string f;
  for (ll i = 0; i < (n - 1) / 2; i++)
    f.push_back(s.at(i));
  string d;
  for (ll j = (n + 3) / 2 - 1; j < n; j++)
    d.push_back(s.at(j));
  if (ispal(d) && ispal(f) && ispal(s))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
int ispal(string k) {
  string r = k;
  reverse(r.begin(), r.end());
  if (r == k)
    return 1;
  else
    return 0;
}
int main() {
  string s;
  cin >> s;
  ll n = s.size();
  string r = s.substr(0, (n - 1) / 2);
  string r1 = s.substr((n - 3) / 2 - 1, n - (n - 3) / 2);
  if (ispal(r) && ispal(r1) && ispal(s))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
Problem p02730 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>

using namespace std;

#define fori(x) for (int i = 0; i < x; ++i)
#define forj(x) for (int j = 0; j < x; ++j)

int main() {
  string s;
  cin >> s;
  for (int i = 0; i < s.length() / 2; ++i) {
    if (s[i] != s[s.length() - i - 1]) {
      cout << "No";
      return 0;
    }
  }
  if (s.length() == 3) {
    cout << "Yes";
    return 0;
  }
  int n = s.length();
  string t(s.c_str(), s.c_str() + (n - 1) / 2);
  for (int i = 0; i < t.length() / 2; ++i) {
    if (t[i] != t[t.length() - i - 1]) {
      cout << "No";
      return 0;
    }
  }
  string u(s.c_str() + (n + 3) / 2, s.c_str() - 1 + s.length());
  for (int i = 0; i < u.length() / 2; ++i) {
    if (u[i] != u[u.length() - i - 1]) {
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";
  return 0;
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

#define fori(x) for (int i = 0; i < x; ++i)
#define forj(x) for (int j = 0; j < x; ++j)

int main() {
  string s;
  cin >> s;
  for (int i = 0; i < s.length() / 2; ++i) {
    if (s[i] != s[s.length() - i - 1]) {
      cout << "No";
      return 0;
    }
  }
  int n = s.length();
  string t(s.c_str(), s.c_str() + (n - 1) / 2);
  for (int i = 0; i < t.length() / 2; ++i) {
    if (t[i] != t[t.length() - i - 1]) {
      cout << "No";
      return 0;
    }
  }
  string u(s.c_str() + (n + 3) / 2, s.c_str() - 1 + s.length());
  for (int i = 0; i < u.length() / 2; ++i) {
    if (u[i] != u[u.length() - i - 1]) {
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";
  return 0;
}
Problem p02730 (C++) — buggy submission, verdict: Runtime Error

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
#define all(v) v.begin(), v.end()
const int inf = 1000000000; // 10^9
using ll = long long;
using P = pair<int, int>;
// 加算代入演算子は+=！！！！！

int main() {
  string s;
  cin >> s;
  int n = 0;
  n = s.size();
  int p2, p3, p4 = 0;
  p2 = (n - 1) / 2;
  p3 = (n + 3) / 2;
  p4 = n;
  // n番目以降の文字列をm文字だけ取り出す場合はsubstr(n, m)
  // nは0スタート、mは1スタート。 if (s.substr(0, p2 / 2) == s.substr((p2 / 2) +
  // 1, p2 / 2) && s.substr(p3 + 1, p2 / 2) == s.substr(((p4 - p3) / 2) + p3, p2
  // / 2)) {
  //     cout << "Yes" << endl;
  // }
  if (s.substr(0, p2) == s.substr(p2 + 1, p2)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Error: 0

Fixed submission:

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
#define all(v) v.begin(), v.end()
const int inf = 1000000000; // 10^9
using ll = long long;
using P = pair<int, int>;
// 加算代入演算子は+=！！！！！

int main() {
  string s;
  cin >> s;
  int n = s.size();
  int p1, p2, p3, p4 = 0;
  p2 = (n - 1) / 2;
  p3 = (n + 3) / 2;
  p4 = n;
  // n番目以降の文字列をm文字だけ取り出す場合はsubstr(n, m)
  // nは0スタート、mは1スタート。
  if (s.substr(0, p2 / 2) == s.substr((p2 / 2) + 1, p2 / 2) &&
      s.substr(p3 + 1, p2 / 2) == s.substr(((p4 - p3) / 2) + p3, p2 / 2)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}
Problem p02730 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
int a;
bool b = true;
string A;
int main() {
  cin >> A;
  a = A.size();
  for (int i = 0; i < a; i++) {
    int c = A.at(i), d = A.at(a - i - 1);
    if (c != d)
      b = false;
  }
  for (int i = 0; i < (a - 1) / 2; i++) {
    int c = A.at(i), d = A.at((a - 1) / 2 - i - 1);
    if (c != d)
      b = false;
  }
  for (int i = 0; i < a + 1 - (a + 3) / 2; i++) {
    int c = A.at((a + 3) / 2 + i - 1), d = A.at(a - i - 1);
    if (c != d)
      b = false;
  }
  if (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 7) >= this->size() (which is 7)


Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int a;
bool b = true;
string A;
int main() {
  cin >> A;
  a = A.size();
  for (int i = 0; i < a; i++)
    if (A.at(i) != A.at(a - i - 1))
      b = false;
  for (int i = 0; i < (a - 1) / 2; i++)
    if (A.at(i) != A.at((a - 1) / 2 - i - 1))
      b = false;
  for (int i = 0; i < a + 1 - (a + 3) / 2; i++)
    if (A.at((a + 3) / 2 + i - 1) != A.at(a - i))
      b = false;
  if (b)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
Problem p02730 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  string S;
  cin >> S;
  int N;
  N = S.size();
  int res = 0;
  int check = 0;
  for (int i = 0; i < N; i++) {
    if (S.at(i) == S.at(N - 1 - i)) {
      check = check + 0;
    } else {
      check = check + 1;
    }
  }
  if (check == 0) {
    res = res + 1;
  }
  int M = (N - 1) / 2;
  int chec = 0;
  for (int i = 0; i < M; i++) {
    if (S.at(i) == S.at(M - 1 - i)) {
      chec = chec + 0;
    } else {
      chec = chec + 1;
    }
  }
  if (chec == 0) {
    res = res + 1;
  }
  int L = (N + 3) / 2;
  int che = 0;
  for (int i = 0; i < N - L; i++) {
    if (S.at(L + i - 1) == S.at(N - 1 - i)) {
      che = che + 0;
    } else {
      che = che + 1;
    }
  }
  if (che == 0) {
    res = res + 1;
  }
  if (res == 3) {
    cout << "Yes";
  }
  if (res < 3) {
    cout << "No";
  }
}


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


Fixed submission:

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

int main() {
  string S;
  cin >> S;
  int N;
  N = S.size();
  int res = 0;
  int check = 0;
  for (int i = 0; i < N; i++) {
    if (S.at(i) == S.at(N - 1 - i)) {
      check = check + 0;
    } else {
      check = check + 1;
    }
  }
  if (check == 0) {
    res = res + 1;
  }
  int M = (N - 1) / 2;
  int chec = 0;
  for (int i = 0; i < M; i++) {
    if (S.at(i) == S.at(M - 1 - i)) {
      chec = chec + 0;
    } else {
      chec = chec + 1;
    }
  }
  if (chec == 0) {
    res = res + 1;
  }
  int L = (N + 3) / 2;
  int che = 0;
  for (int i = 0; i < L; i++) {
    if (S.at(L + i) == S.at(N - 1 - i)) {
      che = che + 0;
    } else {
      che = che + 1;
    }
  }
  if (che == 0) {
    res = res + 1;
  }
  if (res == 3) {
    cout << "Yes";
  }
  if (res < 3) {
    cout << "No";
  }
}
Problem p02730 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
#define vpll vector<pll>
#define all(x) x.begin(), x.end()
#define present(c, x) ((c).find(x) != (c).end())
#define dbg(...) ZZ(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void ZZ(const char *name, Arg1 &&arg1) {
  std::cerr << name << " = " << arg1 << "\\n";
}
template <typename Arg1, typename... Args>
void ZZ(const char *names, Arg1 &&arg1, Args &&...args) {
  const char *comma = strchr(names + 1, ',');
  std::cerr.write(names, comma - names) << " = " << arg1;
  ZZ(comma, args...);
}
#define sz(a) a.size()
#define vll vector<int>
#define pll pair<int, int>
#define ff first
#define ss second
#define br cout << "\\n";
#define ld long double
#define int long long int
const int INF = 1e18 + 7;
const int MAX = 1234567;
const int MOD = 1000000007;

bool ispalin(string s, int start, int end) {
  int mid = start + (end - start) / 2;
  for (int i = start; i <= mid; i++)
    if (s[i] != s[end - i + 1])
      return false;
  return true;
}

void solve() {
  string s;
  cin >> s;
  int n = s.length();
  s = " " + s;
  if (ispalin(s, 1, n) and ispalin(s, 1, (n - 1) / 2) and
      ispalin(s, ((n + 3) / 2), n))
    cout << "Yes";
  else
    cout << "No ";
}
int32_t main() {
  int t;
  t = 1;

  cin.sync_with_stdio(0), cin.tie(0);
  // cin>>t;
  while (t--) {
    solve();
    br;
  }
  return 0;
}


Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define vpll vector<pll>
#define all(x) x.begin(), x.end()
#define present(c, x) ((c).find(x) != (c).end())
#define dbg(...) ZZ(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void ZZ(const char *name, Arg1 &&arg1) {
  std::cerr << name << " = " << arg1 << "\\n";
}
template <typename Arg1, typename... Args>
void ZZ(const char *names, Arg1 &&arg1, Args &&...args) {
  const char *comma = strchr(names + 1, ',');
  std::cerr.write(names, comma - names) << " = " << arg1;
  ZZ(comma, args...);
}
#define sz(a) a.size()
#define vll vector<int>
#define pll pair<int, int>
#define ff first
#define ss second
#define br cout << "\\n";
#define ld long double
#define int long long int
const int INF = 1e18 + 7;
const int MAX = 1234567;
const int MOD = 1000000007;

bool ispalin(string s, int s1, int e1, int s2, int e2) {
  for (int diff = 0; diff < e1 - s1; diff++)
    if (s[s1 + diff] != s[s2 + diff])
      return false;
  return true;
}

void solve() {
  string s;
  cin >> s;
  int n = s.length();
  s = " " + s;
  int e1 = (n - 1) / 2;
  int s2 = (n + 3) / 2;
  int e3 = 1 + (e1 - 1) / 2;
  if (ispalin(s, 1, e1, s2, n) and ispalin(s, 1, e1 / 2, e1 / 2 + 1, e1))
    cout << "Yes";
  else
    cout << "No ";
}
int32_t main() {
  int t;
  t = 1;
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  cin.sync_with_stdio(0), cin.tie(0);
  // cin>>t;
  while (t--) {
    solve();
    br;
  }
  return 0;
}
Problem p02730 (C++) — buggy submission, verdict: Runtime Error

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

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

  int test = 0;
  int length = 0;

  length = S.size();
  for (int i = 0; i < S.size() / 2; i++) {
    if (S.at(i) != S.at(S.size() - 1 - i))
      test++;
  }

  int N;
  N = (length - 1) / 2;
  for (int i = 0; i < S.size() / 4; i++) {
    if (S.at(i) != S.at((S.size() / 2) - 1 - i))
      test++;
  }

  if (test)
    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 7) >= this->size() (which is 0)


Fixed submission:

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

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

  string temp;

  for (int i = 0; i < S.size(); i++) {
    temp.at(S.size() - i) = S.at(i);
  }

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

#include <bits/stdc++.h>
#define sz(s) (int)s.size()
using namespace std;
int main() {

  string s;
  cin >> s;
  int l = 0, r = sz(s) - 1;
  int f = 0;
  while (l < r) {
    if (s[l] != s[r])
      f = 1;
    ;
    l++;
    r--;
  }

  l = 0;
  r = ((sz(s) - 1) / 2) - 1;
  // cout << l << " " << r << endl;
  while (l < r) {
    if (s[l] != s[r])
      f = 1;
    l++;
    r--;
  }
  l = ((sz(s) + 3) / 2) - 1;
  r = sz(s) - 1;
  // cout << l << " " << r << endl;
  while (l < r) {
    if (s[l] != s[r])
      f = 1;

    l++;
    r--;
  }
  if (f == 1)
    cout << "No";
  else
    cout << "Yes";
}

Error: WA

Fixed submission:

#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#define endl '\\n'
#define Ceil(x, y) ((x + y - 1) / y)
#define sz(s) (int)s.size()
#define RT(x) return cout << x, 0;
#define mem(x, y) memset(x, y, sizeof(x))
#define all(v) ((v).begin()), ((v).end())
#define vi vector<int>
#define fr(x, y) for (int x = 0; x < (y); ++x)
#define fr2(x, z, y) for (int x = z; x < (y); ++x)
#define Rabee_Adel file();
const double PI = acos(-1), EPS = 1e-7;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int dr[]{-1, -1, 0, 1, 1, 1, 0, -1};
const int dc[]{0, 1, 1, 1, 0, -1, -1, -1};
ll gcd(ll x, ll y) { return (!y) ? x : gcd(y, x % y); }
ll lcm(ll x, ll y) { return ((x / gcd(x, y)) * y); }
ll mod = 998244353;
ll power(ll x, ll y) {
  if (y == 0)
    return 1;
  if (y == 1)
    return x;
  ll r = power(x, y / 2) % mod;
  return r % mod * r % mod * power(x, y % 2) % mod;
}
void file() {
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif !ONLINEJUDGE
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int main() {

  Rabee_Adel string s;
  cin >> s;
  int l = 0, r = sz(s) - 1;
  int f = 0;
  while (l < r) {
    if (s[l] != s[r])
      f = 1;
    ;
    l++;
    r--;
  }

  l = 0;
  r = ((sz(s) - 1) / 2) - 1;
  // cout << l << " " << r << endl;
  while (l < r) {
    if (s[l] != s[r])
      f = 1;
    l++;
    r--;
  }
  l = ((sz(s) + 3) / 2) - 1;
  r = sz(s) - 1;
  //	cout << l << " " << r << endl;
  while (l < r) {
    if (s[l] != s[r])
      f = 1;

    l++;
    r--;
  }
  if (f == 1)
    cout << "No";
  else
    cout << "Yes";
}
Problem p02730 (C++) — buggy submission, verdict: Runtime Error


#include <bits/stdc++.h>

#define sz(s) (int)s.size()

using namespace std;
int main() {

  // Rabee_Adel
  string s;
  cin >> s;
  int l = 0, r = sz(s) - 1;
  int f = 0;
  while (l < r) {
    if (s[l] != s[r])
      f = 1;
    ;
    l++;
    r--;
  }

  l = 0;
  r = ((sz(s) - 1) / 2) - 1;
  // cout << l << " " << r << endl;
  while (l < r) {
    if (s[l] != s[r])
      f = 1;
    l++;
    r--;
  }
  l = ((sz(s) + 3) / 2) - 1;
  r = sz(s) - 1;
  //	cout << l << " " << r << endl;
  while (l < r) {
    if (s[l] != s[r])
      f = 1;

    l++;
    r--;
  }
  if (f == 1)
    cout << "No";
  else
    cout << "Yes";
}

Error: WA

Fixed submission:

#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#define endl '\\n'
#define Ceil(x, y) ((x + y - 1) / y)
#define sz(s) (int)s.size()
#define RT(x) return cout << x, 0;
#define mem(x, y) memset(x, y, sizeof(x))
#define all(v) ((v).begin()), ((v).end())
#define vi vector<int>
#define fr(x, y) for (int x = 0; x < (y); ++x)
#define fr2(x, z, y) for (int x = z; x < (y); ++x)
#define Rabee_Adel file();
const double PI = acos(-1), EPS = 1e-7;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int dr[]{-1, -1, 0, 1, 1, 1, 0, -1};
const int dc[]{0, 1, 1, 1, 0, -1, -1, -1};
ll gcd(ll x, ll y) { return (!y) ? x : gcd(y, x % y); }
ll lcm(ll x, ll y) { return ((x / gcd(x, y)) * y); }
ll mod = 998244353;
ll power(ll x, ll y) {
  if (y == 0)
    return 1;
  if (y == 1)
    return x;
  ll r = power(x, y / 2) % mod;
  return r % mod * r % mod * power(x, y % 2) % mod;
}
void file() {
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif !ONLINEJUDGE
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int main() {

  Rabee_Adel string s;
  cin >> s;
  int l = 0, r = sz(s) - 1;
  int f = 0;
  while (l < r) {
    if (s[l] != s[r])
      f = 1;
    ;
    l++;
    r--;
  }

  l = 0;
  r = ((sz(s) - 1) / 2) - 1;
  // cout << l << " " << r << endl;
  while (l < r) {
    if (s[l] != s[r])
      f = 1;
    l++;
    r--;
  }
  l = ((sz(s) + 3) / 2) - 1;
  r = sz(s) - 1;
  //	cout << l << " " << r << endl;
  while (l < r) {
    if (s[l] != s[r])
      f = 1;

    l++;
    r--;
  }
  if (f == 1)
    cout << "No";
  else
    cout << "Yes";
}