Language: C++

#include <iostream>
#include <vector>
#include <string>

using namespace std;

int go(int direction)
{
    if(direction == 0 )
    {
        return 1;
    }else if(direction == 1)
    {
        return 1;
    } else if(direction == 2)
    {
        return  -1;
    }else if(direction == 3)
    {
        return  -1;
    }
};

pair<int, int> nextDirection(int direction)
{
    if(direction == 0)
    {
        return {1, 3};
    }else if(direction == 1)
    {
        return {2, 0};
    }else if(direction == 2)
    {
        return {3, 1};
    }else if(direction == 3)
    {
        return {0, 2};
    }
};

int dp[8000][8001][4] = {-1};
void d()
{
    string s;
    cin >> s;
    int x, y;
    cin >> x >> y;
    int xnum = 0; int ynum = 0;
    bool state = true;
    if(s.front() == 'F')
    {
        dp[0][8000][0] = 1;
    } else{
        dp[0][8000][1] = 1;
        dp[0][8000][3] = 1;
        xnum = -1;
        state = false;
    }
    for(int i = 1; i < s.size(); i++)
    {
        for(int j = 0; j <= 16000; j++)
        {
            if(s[i] == 'F')
            {
                if(state)
                {
                    xnum++;
                }else{
                    ynum++;
                }
                for(int k = 0; k < 4; k++)
                {
                    if(dp[i - 1][j][k] == 1)
                    {
                        int next = j + go(k);
                        if(next >= 0 && next <= 16000)
                        {
                            dp[i][next][k] = 1;
                        }
                    }
                }
            }else{
                if(state)
                {
                    state = !state;
                }else{
                    state = !state;
                }
                for(int k = 0; k < 4; k++)
                {
                    if(dp[i - 1][j][k] == 1)
                    {
                        pair<int, int>next = nextDirection(k);
                        dp[i][j][next.first] = 1;
                        dp[i][j][next.second] = 1;
                    }
                }
            }
        }
    }
    bool xok = false;
    bool yok = false;
    for(int i = 0; i < 4; i++)
    {
        if(xnum < 0)
        {
            if(x == 0)
            {
                xok = true;
            }
            break;
        }
        if(dp[xnum][x + 8000][i] == 1)
        {
            xok = true;
        }
    }
    for(int i = 0; i < 4; i++)
    {
        if(dp[ynum][y + 8000][i] == 1)
        {
            yok = true;
        }
    }
    if(xok && yok){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return;
}

int main() {
    d();
    return 0;
}


Compiler output:
a.cc: In function 'int go(int)':
a.cc:22:1: warning: control reaches end of non-void function [-Wreturn-type]
   22 | };
      | ^
a.cc: In function 'std::pair<int, int> nextDirection(int)':
a.cc:39:1: warning: control reaches end of non-void function [-Wreturn-type]
   39 | };
      | ^
g++: internal compiler error: File size limit exceeded signal terminated program as
Please submit a full bug report, with preprocessed source (by using -freport-bug).
See <file:///usr/share/doc/gcc-14/README.Bugs> for instructions.