Problem p03957 (C++)

Buggy submission (status: Runtime Error):
// #pragma warning(disable:4996)
#include <assert.h>
#include <memory.h>
#include <stdio.h>

#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long int64;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<ll> vll;

#define ALL(x) (x).begin(), (x).end()
#define CLEAR(x) (x).clear()
#define RESET(x) memset((x), 0, sizeof(x))
#define MP(X, Y) make_pair(X, Y) // NOTES:MP(

#define FOR(i, b, e) for (int i = (b); i < (e); ++i)
#define RE(i, n) FOR(i, 0, (n))
#define FOREACH(i, x, y) for (int i = (x); i <= (y); ++i)

const ll maxn = (ll)77777;
const ll maxm = (ll)1e6 + 10;
const ll MOD = 786433;
const ll INF = 1e15;

int fast_read() {
  int input;
  char c = 0;
  while (c < 33)
    c = getchar();
  input = 0;
  while (c > 33) {
    input = input * 10 + c - '0';
    c = getchar();
  }
  return input;
}

int main() {
#ifndef ONLINE_JUDGE
  freopen("in.txt", "r", stdin);
#endif

  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);

  string s;
  while (cin >> s) {
    auto p = s.find('C');
    if (p == string::npos) {
      cout << "No" << endl;
      continue;
    }
    if (s.find('F', p) == string::npos) {
      cout << "No" << endl;
    } else {
      cout << "Yes" << endl;
    }
  }

  // cout << (float)(clock() - start_time)/CLOCKS_PER_SEC << "s" << endl;
  return 0;
}


Fixed submission:
// #pragma warning(disable:4996)
#include <assert.h>
#include <memory.h>
#include <stdio.h>

#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long int64;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<ll> vll;

#define ALL(x) (x).begin(), (x).end()
#define CLEAR(x) (x).clear()
#define RESET(x) memset((x), 0, sizeof(x))
#define MP(X, Y) make_pair(X, Y) // NOTES:MP(

#define FOR(i, b, e) for (int i = (b); i < (e); ++i)
#define RE(i, n) FOR(i, 0, (n))
#define FOREACH(i, x, y) for (int i = (x); i <= (y); ++i)

const ll maxn = (ll)77777;
const ll maxm = (ll)1e6 + 10;
const ll MOD = 786433;
const ll INF = 1e15;

int fast_read() {
  int input;
  char c = 0;
  while (c < 33)
    c = getchar();
  input = 0;
  while (c > 33) {
    input = input * 10 + c - '0';
    c = getchar();
  }
  return input;
}

int main() {

  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);

  string s;
  while (cin >> s) {
    auto p = s.find('C');
    if (p == string::npos) {
      cout << "No" << endl;
      continue;
    }
    if (s.find('F', p) == string::npos) {
      cout << "No" << endl;
    } else {
      cout << "Yes" << endl;
    }
  }

  // cout << (float)(clock() - start_time)/CLOCKS_PER_SEC << "s" << endl;
  return 0;
}