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\s\s\sint dx1 = s.pos + dice[i];
\s\s\s\sint dx2 = s.pos - dice[i];

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

    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\s\s\sprintf("0\n"); fflush(stdout);
      }

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

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

Compiler output:
a.cc:88:1: error: stray '\' in program
   88 | \s\s\s\sint dx1 = s.pos + dice[i];
      | ^
a.cc:88:3: error: stray '\' in program
   88 | \s\s\s\sint dx1 = s.pos + dice[i];
      |   ^
a.cc:88:5: error: stray '\' in program
   88 | \s\s\s\sint dx1 = s.pos + dice[i];
      |     ^
a.cc:88:7: error: stray '\' in program
   88 | \s\s\s\sint dx1 = s.pos + dice[i];
      |       ^
a.cc:89:1: error: stray '\' in program
   89 | \s\s\s\sint dx2 = s.pos - dice[i];
      | ^
a.cc:89:3: error: stray '\' in program
   89 | \s\s\s\sint dx2 = s.pos - dice[i];
      |   ^
a.cc:89:5: error: stray '\' in program
   89 | \s\s\s\sint dx2 = s.pos - dice[i];
      |     ^
a.cc:89:7: error: stray '\' in program
   89 | \s\s\s\sint dx2 = s.pos - dice[i];
      |       ^
a.cc:91:1: error: stray '\' in program
   91 | \s\s\s\sif(1 <= dx1 && dx1 <= total_cells){
      | ^
a.cc:91:3: error: stray '\' in program
   91 | \s\s\s\sif(1 <= dx1 && dx1 <= total_cells){
      |   ^
a.cc:91:5: error: stray '\' in program
   91 | \s\s\s\sif(1 <= dx1 && dx1 <= total_cells){
      |     ^
a.cc:91:7: error: stray '\' in program
   91 | \s\s\s\sif(1 <= dx1 && dx1 <= total_cells){
      |       ^
a.cc:92:1: error: stray '\' in program
   92 | \s\s\s\s  dx1 += stage[dx1];
      | ^
a.cc:92:3: error: stray '\' in program
   92 | \s\s\s\s  dx1 += stage[dx1];
      |   ^
a.cc:92:5: error: stray '\' in program
   92 | \s\s\s\s  dx1 += stage[dx1];
      |     ^
a.cc:92:7: error: stray '\' in program
   92 | \s\s\s\s  dx1 += stage[dx1];
      |       ^
a.cc:93:1: error: stray '\' in program
   93 | \s\s\s\s  que.push(State(dx1,s.cost + 1,i,s.pos));
      | ^
a.cc:93:3: error: stray '\' in program
   93 | \s\s\s\s  que.push(State(dx1,s.cost + 1,i,s.pos));
      |   ^
a.cc:93:5: error: stray '\' in program
   93 | \s\s\s\s  que.push(State(dx1,s.cost + 1,i,s.pos));
      |     ^
a.cc:93:7: error: stray '\' in program
   93 | \s\s\s\s  que.push(State(dx1,s.cost + 1,i,s.pos));
      |       ^
a.cc:94:1: error: stray '\' in program
   94 | \s\s\s\s}
      | ^
a.cc:94:3: error: stray '\' in program
   94 | \s\s\s\s}
      |   ^
a.cc:94:5: error: stray '\' in program
   94 | \s\s\s\s}
      |     ^
a.cc:94:7: error: stray '\' in program
   94 | \s\s\s\s}
      |       ^
a.cc:95:1: error: stray '\' in program
   95 | \s\s\s\sif(1 <= dx2 && dx2 <= total_cells){
      | ^
a.cc:95:3: error: stray '\' in program
   95 | \s\s\s\sif(1 <= dx2 && dx2 <= total_cells){
      |   ^
a.cc:95:5: error: stray '\' in program
   95 | \s\s\s\sif(1 <= dx2 && dx2 <= total_cells){
      |     ^
a.cc:95:7: error: stray '\' in program
   95 | \s\s\s\sif(1 <= dx2 && dx2 <= total_cells){
      |       ^
a.cc:96:1: error: stray '\' in program
   96 | \s\s\s\s  dx2 += stage[dx2];
      | ^
a.cc:96:3: error: stray '\' in program
   96 | \s\s\s\s  dx2 += stage[dx2];
      |   ^
a.cc:96:5: error: stray '\' in program
   96 | \s\s\s\s  dx2 += stage[dx2];
      |     ^
a.cc:96:7: error: stray '\' in program
   96 | \s\s\s\s  dx2 += stage[dx2];
      |       ^
a.cc:97:1: error: stray '\' in program
   97 | \s\s\s\s  que.push(State(dx2,s.cost + 1,-i,s.pos));
      | ^
a.cc:97:3: error: stray '\' in program
   97 | \s\s\s\s  que.push(State(dx2,s.cost + 1,-i,s.pos));
      |   ^
a.cc:97:5: error: stray '\' in program
   97 | \s\s\s\s  que.push(State(dx2,s.cost + 1,-i,s.pos));
      |     ^
a.cc:97:7: error: stray '\' in program
   97 | \s\s\s\s  que.push(State(dx2,s.cost + 1,-i,s.pos));
      |       ^
a.cc:98:1: error: stray '\' in program
   98 | \s\s\s\s}
      | ^
a.cc:98:3: error: stray '\' in program
   98 | \s\s\s\s}
      |   ^
a.cc:98:5: error: stray '\' in program
   98 | \s\s\s\s}
      |     ^
a.cc:98:7: error: stray '\' in program
   98 | \s\s\s\s}
      |       ^
a.cc:118:1: error: stray '\' in program
  118 | \s\s\s\sprintf("0\n"); fflush(stdout);
      | ^
a.cc:118:3: error: stray '\' in program
  118 | \s\s\s\sprintf("0\n"); fflush(stdout);
      |   ^
a.cc:118:5: error: stray '\' in program
  118 | \s\s\s\sprintf("0\n"); fflush(stdout);
      |     ^
a.cc:118:7: error: stray '\' in program
  118 | \s\s\s\sprintf("0\n"); fflush(stdout);
      |       ^
a.cc:122:1: error: stray '\' in program
  122 | \s\s\s\sif(hands[hand_idx] > 0){
      | ^
a.cc:122:3: error: stray '\' in program
  122 | \s\s\s\sif(hands[hand_idx] > 0){
      |   ^
a.cc:122:5: error: stray '\' in program
  122 | \s\s\s\sif(hands[hand_idx] > 0){
      |     ^
a.cc:122:7: error: stray '\' in program
  122 | \s\s\s\sif(hands[hand_idx] > 0){
      |       ^
a.cc:123:1: error: stray '\' in program
  123 | \s\s\s\s  printf("1\n"); fflush(stdout);
      | ^
a.cc:123:3: error: stray '\' in program
  123 | \s\s\s\s  printf("1\n"); fflush(stdout);
      |   ^
a.cc:123:5: error: stray '\' in program
  123 | \s\s\s\s  printf("1\n"); fflush(stdout);
      |     ^
a.cc:123:7: error: stray '\' in program
  123 | \s\s\s\s  printf("1\n"); fflush(stdout);
      |       ^
a.cc:124:1: error: stray '\' in program
  124 | \s\s\s\s}
      | ^
a.cc:124:3: error: stray '\' in program
  124 | \s\s\s\s}
      |   ^
a.cc:124:5: error: stray '\' in program
  124 | \s\s\s\s}
      |     ^
a.cc:124:7: error: stray '\' in program
  124 | \s\s\s\s}
      |       ^
a.cc:125:1: error: stray '\' in program
  125 | \s\s\s\selse{
      | ^
a.cc:125:3: error: stray '\' in program
  125 | \s\s\s\selse{
      |   ^
a.cc:125:5: error: stray '\' in program
  125 | \s\s\s\selse{
      |     ^
a.cc:125:7: error: stray '\' in program
  125 | \s\s\s\selse{
      |       ^
a.cc:126:1: error: stray '\' in program
  126 | \s\s\s\s  printf("-1\n"); fflush(stdout);
      | ^
a.cc:126:3: error: stray '\' in program
  126 | \s\s\s\s  printf("-1\n"); fflush(stdout);
      |   ^
a.cc:126:5: error: stray '\' in program
  126 | \s\s\s\s  printf("-1\n"); fflush(stdout);
      |     ^
a.cc:126:7: error: stray '\' in program
  126 | \s\s\s\s  printf("-1\n"); fflush(stdout);
      |       ^
a.cc:127:1: error: stray '\' in program
  127 | \s\s\s\s}
      | ^
a.cc:127:3: error: stray '\' in program
  127 | \s\s\s\s}
      |   ^
a.cc:127:5: error: stray '\' in program
  127 | \s\s\s\s}
      |     ^
a.cc:127:7: error: stray '\' in program
  127 | \s\s\s\s}
      |       ^
a.cc:128:1: error: stray '\' in program
  128 | \s\s\s\shand_idx++;
      | ^
a.cc:128:3: error: stray '\' in program
  128 | \s\s\s\shand_idx++;
      |   ^
a.cc:128:5: error: stray '\' in program
  128 | \s\s\s\shand_idx++;
      |     ^
a.cc:128:7: error: stray '\' in program
  128 | \s\s\s\shand_idx++;
      |       ^
a.cc: In function 'int main()':
a.cc:88:3: error: expected ';' before 's'
   88 | \s\s\s\sint dx1 = s.pos + dice[i];
      |   ^~
      |   ;
a.cc:89:3: error: expected ';' before 's'
   89 | \s\s\s\sint dx2 = s.pos - dice[i];
      |   ^~
      |   ;
a.cc:91:3: error: expected ';' before 's'
   91 | \s\s\s\sif(1 <= dx1 && dx1 <= total_cells){
      |   ^~
      |   ;
a.cc:95:3: error: expected ';' before 's'
   95 | \s\s\s\sif(1 <= dx2 && dx2 <= total_cells){
      |   ^~
      |   ;
a.cc:118:2: error: 's' was not declared in this scope
  118 | \s\s\s\sprintf("0\n"); fflush(stdout);
      |  ^
a.cc:122:2: error: 's' was not declared in this scope
  122 | \s\s\s\sif(hands[hand_idx] > 0){
      |  ^
a.cc:125:3: error: expected ';' before 's'
  125 | \s\s\s\selse{
      |   ^~
      |   ;
a.cc:128:3: error: expected ';' before 's'
  128 | \s\s\s\shand_idx++;
      |   ^~
      |   ;