Language: C++

#include<iostream>
#include<math.h>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<algorithm>
#include<bitset>
#include <climits>
using namespace std;
#define _GLIBCXX_DEBUG
#define pq priority_queue
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define vit vector<lint>::iterator
#define all(x) (x).begin(),(x).end()
#define rep(x) for(int i = 0;i < (x);i++)
#define repj(x) for(int j = 0;j < (x);j++)
#define REP(i,x) for(int (i) = 0;(i) < (x);(i)++)
#define rrep(x) for(int i = (x);i >= 0;i--)
#define mins(x,y) x = min(x,y)
#define maxs(x,y) x = max(x,y)
#define mod 1000000007
#define graph_set(n) struct edge{int to,int cost;} vector<edge> G((n))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define range(x,y) ((x) >= 0 && (x) < h && (y) >= 0 && (y) < w)
#define pyes cout << "Yes" << endl
#define pno cout << "No" << endl
typedef vector<long long> vi;
typedef vector<pair<long long, long long>> vp;
typedef vector<vector<long long>> vvi;
typedef pair<long long, long long> pi;
typedef long long lint;
typedef long long ll;
lint qp(int a, ll b) { int ans = 1; do { if (b & 1)ans = 1ll * ans*a; a = 1ll * a*a; } while (b >>= 1); return ans; }
lint qp(int a, ll b, int mo) { int ans = 1; do { if (b & 1)ans = 1ll * ans*a%mo; a = 1ll * a*a%mo; } while (b >>= 1); return ans; }
lint gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };
long long INF = 1e14;

//////////////////////////////////////////////////////////////////////
bool dpe[8010][8010];
bool dpo[8010][8010];

int main(void) {
	rep(8010)repj(8010) { dpe[i][j] = false, dpo[i][j] = false; }
	rep(8010) { dpe[i][0] = dpo[i][0] = true; }
	string s; cin >> s;
	int x, y; cin >> x >> y;
	vi even, odd;
	int k = 0;
	int e = -1; //odd,even,odd...
	int seq = 0;
	int esum = 0, osum = 0;
	while (k < s.size()) {
		if (s[k] == 'F') {
			seq++;
			if (k == s.size() - 1) {
				if (e == 1 && seq != 0) {
					even.pb(seq);
					esum += seq;
					seq = 0;
				}
				else if (e == -1 && seq != 0) {
					odd.pb(seq);
					osum += seq;
					seq = 0;
				}
			}
		}
		else {
			if (e == 1 && seq != 0) {
				even.pb(seq);
				esum += seq;
				seq = 0;
			}
			else if (e == -1 && seq != 0) {
				odd.pb(seq);
				osum += seq;
				seq = 0;
			}
			e *= -1;
		}
		k++;
	}
	/*cout << esum << " " << y <<  endl;
	cout << osum << " " << x << endl;*/
	bool a1 = (esum >= y);
	bool a2 = (osum >= x);
	bool a3 = ((esum - y) % 2 == 0);
	bool a4 = ((osum - x) % 2 == 0);

	if (!(a1&&a2&&a3&&a4)) {
		//cout << "E" << endl;
		pno;
		return 0;
	}
	ll eva = (esum - y) / 2;
	//	cout << eva << endl;
	ll odm = (osum - x) / 2;
	//   cout << odm << endl;
	   //oddのｄｐ
	   //odd側の最初は使っちゃダメ

	if (odd.size() != 0) {
		for (int i = 1; i < odd.size(); i++) {
			for (int j = 0; j <= 8000; j++) {
				if (j - odd[i] >= 0) dpo[i][j] = dpo[i - 1][j] || dpo[i - 1][j - odd[i]];
				else dpo[i][j] = dpo[i - 1][j];
			}
		}
	}
	//evenのｄｐ

	if (even.size() != 0) {
		dpe[0][even[0]] = true;
		for (int i = 1; i < even.size(); i++) {
			for (int j = 0; j <= 8000; j++) {
				if (j - even[i] >= 0) dpe[i][j] = dpe[i - 1][j] || dpe[i - 1][j - even[i]];
				else dpe[i][j] = dpe[i - 1][j];
			}
		}
	}

	if (dpe[max(0LL, even.size() - 1LL)][eva] && dpo[max(0LL, odd.size() - 1LL)][odm]) pyes;
	else pno;

	//int p; cin >> p;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:130:20: error: no matching function for call to 'max(long long int, long long unsigned int)'
  130 |         if (dpe[max(0LL, even.size() - 1LL)][eva] && dpo[max(0LL, odd.size() - 1LL)][odm]) pyes;
      |                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:130:20: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
  130 |         if (dpe[max(0LL, even.size() - 1LL)][eva] && dpo[max(0LL, odd.size() - 1LL)][odm]) pyes;
      |                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:8:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:130:20: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
  130 |         if (dpe[max(0LL, even.size() - 1LL)][eva] && dpo[max(0LL, odd.size() - 1LL)][odm]) pyes;
      |                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~
a.cc:130:61: error: no matching function for call to 'max(long long int, long long unsigned int)'
  130 |         if (dpe[max(0LL, even.size() - 1LL)][eva] && dpo[max(0LL, odd.size() - 1LL)][odm]) pyes;
      |                                                          ~~~^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:130:61: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
  130 |         if (dpe[max(0LL, even.size() - 1LL)][eva] && dpo[max(0LL, odd.size() - 1LL)][odm]) pyes;
      |                                                          ~~~^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:130:61: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
  130 |         if (dpe[max(0LL, even.size() - 1LL)][eva] && dpo[max(0LL, odd.size() - 1LL)][odm]) pyes;
      |                                                          ~~~^~~~~~~~~~~~~~~~~~~~~~~