Problem p02730 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

#define clean(x, y) memset(x, y, sizeof(x));
#define pb push_back
#define F first
#define S second
#define LB lower_bound
#define UB upper_bound
#define ALL(v) v.begin(), v.end()
#define PI acos(-1.0)
#define EPS 1e-9
#define INF (1 << 30)
#define MOD 1000000007
#define MAX 100005
#define endl "\n"
#define FAST                                                                   \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL);
#define dbg(x) cout << (#x) << "=" << (x) << ":\n"
#define CS(i) cout << "Case " << i << ": "
#define tin                                                                    \
  ll T;                                                                        \
  cin >> T;                                                                    \
  while (T--)

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

bool isPalindrome(string s) {
  string rev = s;
  reverse(ALL(rev));
  return rev == s;
}

int main() {
  FAST

      string s;
  int i, j, x, y, len;
  cin >> s;
  len = s.size();
  if (len % 2 == 0) {
    cout << "No\n";
    return 0;
  }
  if (isPalindrome(s)) {
    x = (len - 1) / 2;
    y = (len + 3) / 2 + 1;
    string s1 = s.substr(0, x);
    string s2 = s.substr(y);
    if (isPalindrome(s1) && isPalindrome(s2))
      cout << "Yes\n";
    else
      cout << "No\n";
  } else {
    cout << "No\n";
  }

  return 0;
}


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

#define clean(x, y) memset(x, y, sizeof(x));
#define pb push_back
#define F first
#define S second
#define LB lower_bound
#define UB upper_bound
#define ALL(v) v.begin(), v.end()
#define PI acos(-1.0)
#define EPS 1e-9
#define INF (1 << 30)
#define MOD 1000000007
#define MAX 100005
#define endl "\n"
#define FAST                                                                   \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL);
#define dbg(x) cout << (#x) << "=" << (x) << ":\n"
#define CS(i) cout << "Case " << i << ": "
#define tin                                                                    \
  ll T;                                                                        \
  cin >> T;                                                                    \
  while (T--)

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

bool isPalindrome(string s) {
  string rev = s;
  reverse(ALL(rev));
  return rev == s;
}

int main() {
  FAST

      string s;
  int i, j, x, y, len;
  cin >> s;
  len = s.size();
  if (len % 2 == 0) {
    cout << "No\n";
    return 0;
  }
  if (isPalindrome(s)) {
    x = (len - 1) / 2;
    y = (len + 3) / 2 - 1;
    string s1 = s.substr(0, x);
    string s2 = s.substr(y);
    if (isPalindrome(s1) && isPalindrome(s2))
      cout << "Yes\n";
    else
      cout << "No\n";
  } else {
    cout << "No\n";
  }

  return 0;
}