Problem p02836 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define pb push_back
#define f(i, n) for (i = 0; i < n; i++)
#define F(i, a, b) for (i = a; a <= b; i++)
#define arr(a, n)                                                              \
  for (i = 0; i < n; i++)                                                      \
    cin >> a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a, a + n);
#define sr() sort(a, a + n, greater<ll>());
#define v() sort(v.begin(), v.end());
#define vr() sort(v.begin(), v.end(), greater<ll>());
#define mod 1000000007
#define fast()                                                                 \
  ios_base::sync_with_stdio(0);                                                \
  cin.tie(0);                                                                  \
  cout.tie(0)

int main() {
#ifndef ONLINE_JUDGE
  // for getting input from input.txt
  freopen("input.txt", "r", stdin);
  // for writing output to output.txt
  freopen("output.txt", "w", stdout);
#endif
  fast();
  ll n, c = 0;
  string s;
  cin >> s;
  n = s.length();
  for (int i = 0; i < n / 2; i++) {
    if (s[i] != s[n - i - 1])
      c++;
  }

  cout << c << endl;

  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define pb push_back
#define f(i, n) for (i = 0; i < n; i++)
#define F(i, a, b) for (i = a; a <= b; i++)
#define arr(a, n)                                                              \
  for (i = 0; i < n; i++)                                                      \
    cin >> a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a, a + n);
#define sr() sort(a, a + n, greater<ll>());
#define v() sort(v.begin(), v.end());
#define vr() sort(v.begin(), v.end(), greater<ll>());
#define mod 1000000007
#define fast()                                                                 \
  ios_base::sync_with_stdio(0);                                                \
  cin.tie(0);                                                                  \
  cout.tie(0)

int main() {
  /* #ifndef ONLINE_JUDGE
     // for getting input from input.txt
     freopen("input.txt", "r", stdin);
     // for writing output to output.txt
     freopen("output.txt", "w", stdout);
 #endif*/
  fast();
  ll n, c = 0;
  string s;
  cin >> s;
  n = s.length();
  for (int i = 0; i < n / 2; i++) {
    if (s[i] != s[n - i - 1])
      c++;
  }

  cout << c << endl;

  return 0;
}