Language: C++

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

string s;
int x, y;

short a[4010][2][8010];

vector<int> ido[2];

bool dp1(int i, int j){
    if(i == ido[0].size()){
        if(j == x){
            return true;
        }
        return false;
    }

    if(a[i][j >= 0][abs(j)] != -1){
        return a[i][j >= 0][abs(j)];
    }

    if(i == 0){
        return a[i][j >= 0][abs(j)] = dp1(i+1, j+ido[0][i]);
    }else{
        return a[i][j >= 0][abs(j)] = dp1(i+1, j+ido[0][i]) || dp1(i+1, j-ido[0] [i]);
    }
}

bool dp2(int i, int j){
    if(i == ido[1].size()){
        if(j == y){
            return true;
        }
        return false;
    }

    if(a[i][j >= 0][abs(j)]){
        return a[i][j >= 0][abs(j)];
    }

    return a[i][j >= 0][abs(j)] = dp2(i+1, j+ido[1][i]) || dp2(i+1, j-ido[1][i]) ;
}

int main(){
    cin >> s;
    cin >> x >> y;

    int tmp = 0;
    int nakamura = 0;

    for(int i = 0;i < s.size();i++){
        if(s[i] == 'F'){
            tmp++;
        }else{
            ido[nakamura].push_back(tmp);
            nakamura = (nakamura + 1) & 1;
            tmp = 0;
        }
    }

    ido[nakamura].push_back(tmp);

    memset(a, -1, sizeof(a));
    if(dp1(0, 0)){
        memset(a, -1, sizeof(a));
        if(dp2(0, 0)){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }else{
        cout << "No" << endl;
    }

    return 0;
}
bash-4.3(luke):~/con
555:{ei1719}$ vim e.cpp
bash-4.3(luke):~/con
556:{ei1719}$ cat e.cpp
#include <bits/stdc++.h>
using namespace std;

string s;
int x, y;

short a[4010][2][8010];

vector<int> ido[2];

bool dp1(int i, int j){
    if(i == ido[0].size()){
        if(j == x){
            return true;
        }
        return false;
    }

    if(a[i][j >= 0][abs(j)] != -1){
        return a[i][j >= 0][abs(j)];
    }

    if(i == 0){
        return a[i][j >= 0][abs(j)] = dp1(i+1, j+ido[0][i]);
    }else{
        return a[i][j >= 0][abs(j)] = dp1(i+1, j+ido[0][i]) || dp1(i+1, j-ido[0][i]);
    }
}

bool dp2(int i, int j){
    if(i == ido[1].size()){
        if(j == y){
            return true;
        }
        return false;
    }

    if(a[i][j >= 0][abs(j)] != -1){
        return a[i][j >= 0][abs(j)];
    }

    return a[i][j >= 0][abs(j)] = dp2(i+1, j+ido[1][i]) || dp2(i+1, j-ido[1][i]);
}

int main(){
    cin >> s;
    cin >> x >> y;

    int tmp = 0;
    int nakamura = 0;

    for(int i = 0;i < s.size();i++){
        if(s[i] == 'F'){
            tmp++;
        }else{
            ido[nakamura].push_back(tmp);
            nakamura = (nakamura + 1) & 1;
            tmp = 0;
        }
    }

    ido[nakamura].push_back(tmp);

    memset(a, -1, sizeof(a));
    if(dp1(0, 0)){
        memset(a, -1, sizeof(a));
        if(dp2(0, 0)){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }else{
        cout << "No" << endl;
    }

    return 0;
}


Compiler output:
a.cc:78:1: error: 'bash' does not name a type
   78 | bash-4.3(luke):~/con
      | ^~~~
a.cc:79:13: error: '$' does not name a type
   79 | 555:{ei1719}$ vim e.cpp
      |             ^
a.cc:81:13: error: '$' does not name a type
   81 | 556:{ei1719}$ cat e.cpp
      |             ^
a.cc:85:8: error: redefinition of 'std::string s'
   85 | string s;
      |        ^
a.cc:4:8: note: 'std::string s' previously declared here
    4 | string s;
      |        ^
a.cc:86:5: error: redefinition of 'int x'
   86 | int x, y;
      |     ^
a.cc:5:5: note: 'int x' previously declared here
    5 | int x, y;
      |     ^
a.cc:86:8: error: redefinition of 'int y'
   86 | int x, y;
      |        ^
a.cc:5:8: note: 'int y' previously declared here
    5 | int x, y;
      |        ^
a.cc:88:7: error: redefinition of 'short int a [4010][2][8010]'
   88 | short a[4010][2][8010];
      |       ^
a.cc:7:7: note: 'short int a [4010][2][8010]' previously declared here
    7 | short a[4010][2][8010];
      |       ^
a.cc:90:13: error: redefinition of 'std::vector<int> ido [2]'
   90 | vector<int> ido[2];
      |             ^~~
a.cc:9:13: note: 'std::vector<int> ido [2]' previously declared here
    9 | vector<int> ido[2];
      |             ^~~
a.cc:92:6: error: redefinition of 'bool dp1(int, int)'
   92 | bool dp1(int i, int j){
      |      ^~~
a.cc:11:6: note: 'bool dp1(int, int)' previously defined here
   11 | bool dp1(int i, int j){
      |      ^~~
a.cc:111:6: error: redefinition of 'bool dp2(int, int)'
  111 | bool dp2(int i, int j){
      |      ^~~
a.cc:30:6: note: 'bool dp2(int, int)' previously defined here
   30 | bool dp2(int i, int j){
      |      ^~~
a.cc:126:5: error: redefinition of 'int main()'
  126 | int main(){
      |     ^~~~
a.cc:45:5: note: 'int main()' previously defined here
   45 | int main(){
      |     ^~~~