Language: C++

#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
  
using namespace std;
  
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;
  
static const double EPS = 1e-8;
  
int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};

class State {
public:
  int pos;
  int cost;
  int prev_hand;
  int prev_pos;
  State(int _p,int _c) : pos(_p),cost(_c),prev_hand(-1000),prev_pos(-1000) {}
  State(int _p,int _c,int _ph,int _pp) : pos(_p),cost(_c),prev_hand(_ph),prev_pos(_pp) {}
  bool operator<(const State& s) const{
    return cost < s.cost;
  }
  bool operator>(const State& s) const{
    return cost > s.cost;
  }
};

struct DP{
  int cost;
  int prev_hand;
  int prev_pos;
  DP(int _c,int _ph,int _pp) : cost(_c),prev_hand(_ph),prev_pos(_pp){}
  DP() : cost(INF),prev_hand(-1000),prev_pos(-1000){}
};

int main(){
  int total_cells;
  while(~scanf("%d",&total_cells)){
    int dice[7];
    for(int i=1;i<=6;i++){
      scanf("%d",dice + i);
    }
    int start,goal;
    scanf("%d %d",&start,&goal);
    int stage[303];
    for(int i=1;i<=total_cells;i++){
      scanf("%d",stage + i);
    }
    
    priority_queue<State,vector<State>,greater<State> > que;
    que.push(State(start,0,-1000,-1000));

    DP dp[303];

    while(!que.empty()){
      State s = que.top();
      que.pop();

      if(dp[s.pos].cost <= s.cost) continue;

      dp[s.pos].cost = s.cost;
      dp[s.pos].prev_hand = s.prev_hand;
      dp[s.pos].prev_pos = s.prev_pos;

      for(int i=1;i<=6;i++){
\s{8}int dx1 = s.pos + dice[i];
\s{8}int dx2 = s.pos - dice[i];

\s{8}if(1 <= dx1 && dx1 <= total_cells){
\s{8}  dx1 += stage[dx1];
\s{8}  que.push(State(dx1,s.cost + 1,i,s.pos));
\s{8}}
\s{8}if(1 <= dx2 && dx2 <= total_cells){
\s{8}  dx2 += stage[dx2];
\s{8}  que.push(State(dx2,s.cost + 1,-i,s.pos));
\s{8}}
      }
    }

    vector<int> hands;
    int prev_x = goal;
    for(int round = 0;round <= 3000;round++){
      hands.push_back(dp[prev_x].prev_hand);
      prev_x = dp[prev_x].prev_pos;
      if(prev_x == start) break;
    }

    reverse(hands.begin(),hands.end());

    int hand_idx = 0;
    for(int round = 0;round <= 3000;round++){
      int num;
      scanf("%d", &num);
      
      if(num != abs(hands[hand_idx])){
\s{8}printf("0\n"); fflush(stdout);
      }

      else if(num == abs(hands[hand_idx])){
\s{8}if(hands[hand_idx] > 0){
\s{8}  printf("1\n"); fflush(stdout);
\s{8}}
\s{8}else{
\s{8}  printf("-1\n"); fflush(stdout);
\s{8}}
\s{8}hand_idx++;
      }

      if(hand_idx >= hands.size()) break;
    }
  }
}

Compiler output:
a.cc:88:1: error: stray '\' in program
   88 | \s{8}int dx1 = s.pos + dice[i];
      | ^
a.cc:89:1: error: stray '\' in program
   89 | \s{8}int dx2 = s.pos - dice[i];
      | ^
a.cc:91:1: error: stray '\' in program
   91 | \s{8}if(1 <= dx1 && dx1 <= total_cells){
      | ^
a.cc:92:1: error: stray '\' in program
   92 | \s{8}  dx1 += stage[dx1];
      | ^
a.cc:93:1: error: stray '\' in program
   93 | \s{8}  que.push(State(dx1,s.cost + 1,i,s.pos));
      | ^
a.cc:94:1: error: stray '\' in program
   94 | \s{8}}
      | ^
a.cc:95:1: error: stray '\' in program
   95 | \s{8}if(1 <= dx2 && dx2 <= total_cells){
      | ^
a.cc:96:1: error: stray '\' in program
   96 | \s{8}  dx2 += stage[dx2];
      | ^
a.cc:97:1: error: stray '\' in program
   97 | \s{8}  que.push(State(dx2,s.cost + 1,-i,s.pos));
      | ^
a.cc:98:1: error: stray '\' in program
   98 | \s{8}}
      | ^
a.cc:118:1: error: stray '\' in program
  118 | \s{8}printf("0\n"); fflush(stdout);
      | ^
a.cc:122:1: error: stray '\' in program
  122 | \s{8}if(hands[hand_idx] > 0){
      | ^
a.cc:123:1: error: stray '\' in program
  123 | \s{8}  printf("1\n"); fflush(stdout);
      | ^
a.cc:124:1: error: stray '\' in program
  124 | \s{8}}
      | ^
a.cc:125:1: error: stray '\' in program
  125 | \s{8}else{
      | ^
a.cc:126:1: error: stray '\' in program
  126 | \s{8}  printf("-1\n"); fflush(stdout);
      | ^
a.cc:127:1: error: stray '\' in program
  127 | \s{8}}
      | ^
a.cc:128:1: error: stray '\' in program
  128 | \s{8}hand_idx++;
      | ^
a.cc: In function 'int main()':
a.cc:88:3: error: expected ';' before '{' token
   88 | \s{8}int dx1 = s.pos + dice[i];
      |   ^
      |   ;
a.cc:89:3: error: expected ';' before '{' token
   89 | \s{8}int dx2 = s.pos - dice[i];
      |   ^
      |   ;
a.cc:91:3: error: expected ';' before '{' token
   91 | \s{8}if(1 <= dx1 && dx1 <= total_cells){
      |   ^
      |   ;
a.cc:92:3: error: expected ';' before '{' token
   92 | \s{8}  dx1 += stage[dx1];
      |   ^
      |   ;
a.cc:93:3: error: expected ';' before '{' token
   93 | \s{8}  que.push(State(dx1,s.cost + 1,i,s.pos));
      |   ^
      |   ;
a.cc:94:3: error: expected ';' before '{' token
   94 | \s{8}}
      |   ^
      |   ;
a.cc:95:3: error: expected ';' before '{' token
   95 | \s{8}if(1 <= dx2 && dx2 <= total_cells){
      |   ^
      |   ;
a.cc:96:3: error: expected ';' before '{' token
   96 | \s{8}  dx2 += stage[dx2];
      |   ^
      |   ;
a.cc:97:3: error: expected ';' before '{' token
   97 | \s{8}  que.push(State(dx2,s.cost + 1,-i,s.pos));
      |   ^
      |   ;
a.cc:98:3: error: expected ';' before '{' token
   98 | \s{8}}
      |   ^
      |   ;
a.cc:118:2: error: 's' was not declared in this scope
  118 | \s{8}printf("0\n"); fflush(stdout);
      |  ^
a.cc:122:2: error: 's' was not declared in this scope
  122 | \s{8}if(hands[hand_idx] > 0){
      |  ^
a.cc:123:3: error: expected ';' before '{' token
  123 | \s{8}  printf("1\n"); fflush(stdout);
      |   ^
      |   ;
a.cc:124:3: error: expected ';' before '{' token
  124 | \s{8}}
      |   ^
      |   ;
a.cc:125:3: error: expected ';' before '{' token
  125 | \s{8}else{
      |   ^
      |   ;
a.cc:125:6: error: expected '}' before 'else'
  125 | \s{8}else{
      |      ^~~~
a.cc:121:43: note: to match this '{'
  121 |       else if(num == abs(hands[hand_idx])){
      |                                           ^
a.cc:126:2: error: 's' was not declared in this scope
  126 | \s{8}  printf("-1\n"); fflush(stdout);
      |  ^
a.cc:127:3: error: expected ';' before '{' token
  127 | \s{8}}
      |   ^
      |   ;
a.cc:128:2: error: 's' was not declared in this scope
  128 | \s{8}hand_idx++;
      |  ^
a.cc: At global scope:
a.cc:134:1: error: expected declaration before '}' token
  134 | }
      | ^