Language: C++

#include <iostream>
#include <map>  
#include <algorithm>
#include <string>
#include <utility>
#include <deque>
#include <set>


const int X_PLUS = 0;
const int Y_PLUS = 1;
const int X_MINUS = 2;
const int Y_MINUS = 3;

class robot_node {
private:
	std::string instruction;
	int direction;
	std::pair<int, int> pos;

public:
	robot_node(std::string& inst, int dir, std::pair<int, int>& start) {
		pos = start;
		direction = dir;
		instruction = inst;
	}

	robot_node& operator=(const robot_node& rhs)
	{
		// 代入操作時に行う処理を記述
		pos = rhs.pos;
		direction = rhs.direction;
		instruction = rhs.instruction;


		return *this;
	}

	bool operator<(const robot_node &rhs) const {
		return (this->instruction < rhs.instruction) & (this->pos < rhs.pos) & (this->direction < rhs.direction);
	}

	int get_instruction_num() {
		return instruction.size();
	}
	char pop_instruction() {
		char s = instruction[0];
		instruction = instruction.substr(1);
		return s;
	}

	std::pair<int, int> get_pos() const{
		return pos;
	}

	void move() {
		if (direction == X_PLUS) {
			pos.first += 1;
		}
		else if (direction == Y_PLUS){
			pos.second += 1;
		}
		else if (direction == X_MINUS) {
			pos.first -= 1;
		}
		else if (direction == Y_MINUS) {
			pos.second -= 1;
		}
	}

	void turn_left() {
		direction = (direction + 1) % 4;
	}

	void turn_right() {
		if(direction - 1 >= 0) direction = (direction - 1);
		else direction = Y_MINUS;
	}

};

int manhattan_distance(std::pair<int, int>& pos1, std::pair<int, int>& pos2) {
	return std::abs(pos1.first - pos2.first) + std::abs(pos1.second - pos2.second);
}

int main() {
	std::string instruction;
	std::pair<int, int> target_pos;
	std::cin >> instruction;
	std::cin >> target_pos.first;
	std::cin >> target_pos.second;
	
	std::set<robot_node> already_set;

	std::deque<robot_node> node_container;

	robot_node node(instruction, X_PLUS, std::make_pair(0, 0));
	already_set.insert(node);

	node_container.push_back(node);

	while (1) {
		if (node_container.size() == 0) {
			std::cout << "no" << std::endl;
			break;
		}
		node = node_container.back();
		node_container.pop_back();
		if (node.get_pos() == target_pos) {
			std::cout << "yes" << std::endl;
			break;
		}
		if (node.get_instruction_num() <= 0) {
			continue;
		}
		char s = node.pop_instruction();
		if (s == 'F') {
			robot_node new_node = node;
			new_node.move();
			//if (already_set.find(new_node) == already_set.end()) {
				node_container.push_back(new_node);
				already_set.insert(new_node);
			//}
		}
		else {
			robot_node new_node1 = node;
			new_node1.turn_left();
			//if (already_set.find(new_node1) == already_set.end()) {
				node_container.push_back(new_node1);
				already_set.insert(new_node1);
			//}
			
			robot_node new_node2 = node;
			new_node2.turn_right();
			node_container.push_back(new_node2);
			//if (already_set.find(new_node2) == already_set.end()) {
				node_container.push_back(new_node2);
				already_set.insert(new_node2);
			//}
		}
	}

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:97:60: error: cannot bind non-const lvalue reference of type 'std::pair<int, int>&' to an rvalue of type 'std::pair<int, int>'
   97 |         robot_node node(instruction, X_PLUS, std::make_pair(0, 0));
      |                                              ~~~~~~~~~~~~~~^~~~~~
a.cc:22:69: note:   initializing argument 3 of 'robot_node::robot_node(std::string&, int, std::pair<int, int>&)'
   22 |         robot_node(std::string& inst, int dir, std::pair<int, int>& start) {
      |                                                ~~~~~~~~~~~~~~~~~~~~~^~~~~