Language: C++

#include<iostream>
using namespace std;
int main(){
  int R,S,P;
  int K,N;
  int bigger[3];//rspの順
  int small[3];
  char big[3];
  int points[3];
  int point = 0;
  int changed[100000];
  char hands[100010];
  cin >> N >> K;
  cin >> R >> S >> P;
  cin >> hands;
  if(R > S){
    bigger[0] = R;
    small[0] = S;
    big[0] = 'r';
  }else{
    bigger[0] = S;
    small[0] = R;
    big[0] = 's';
  }
  if(S > P){
    bigger[1] = S;
    small[1] = P;
    big[1] = 's';
  }else{
    bigger[1] = P;
    small[1] = S;
    big[1] = 'p';
  }
  if(R > P){
    bigger[2] = R;
    small[2] = P;
    big[2] = 'r';
  }else{
    bigger[2] = P;
    small[2] = R;
    big[2] = 'p';
  }
  for(int i = 0;i < N;i++){
    if(i < K){
      switch(hands[i]){
        case 'r':
          point += points[2];
          break;
        case 's':
          point += points[0];
          break;
        case 'p':
          point += points[1];
          break;
      }
    }else{
      switch(hands[i]){
        case 'r':
          if(hands[i-K] == 'p' && changed[i-k] != 1){
            if(i+K < N){
              if(hands[i+k] == big[0])point += small[0];
              else{points += bigger[0];}
            }else{
              point += big[0];
            }
            changed[i] = 1;
          }else{
            point += points[2];
          }
          break;
        case 's':
          if(hands[i-K] == 'r' && changed[i-k] != 1){
            if(i+K < N){
              if(hands[i+k] == big[1])point += small[1];
              else{points += bigger[1];}
            }else{
              point += big[1];
            }
            changed[i] = 1;
          }else{
            point += points[0];
          }
          break;
        case 'p':
          if(hands[i-K] == 's' && changed[i-k] != 1){
            if(i+K < N){
              if(hands[i+k] == big[2])point += small[2];
              else{points += bigger[2];}
            }else{
              point += big[2];
            }
            changed[i] = 1;
          }else{
            point += points[1];
          }
          break;
      }
    }
  }
  cout << point << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:59:45: error: 'k' was not declared in this scope
   59 |           if(hands[i-K] == 'p' && changed[i-k] != 1){
      |                                             ^
a.cc:62:27: error: incompatible types in assignment of 'int' to 'int [3]'
   62 |               else{points += bigger[0];}
      |                    ~~~~~~~^~~~~~~~~~~~
a.cc:72:45: error: 'k' was not declared in this scope
   72 |           if(hands[i-K] == 'r' && changed[i-k] != 1){
      |                                             ^
a.cc:75:27: error: incompatible types in assignment of 'int' to 'int [3]'
   75 |               else{points += bigger[1];}
      |                    ~~~~~~~^~~~~~~~~~~~
a.cc:85:45: error: 'k' was not declared in this scope
   85 |           if(hands[i-K] == 's' && changed[i-k] != 1){
      |                                             ^
a.cc:88:27: error: incompatible types in assignment of 'int' to 'int [3]'
   88 |               else{points += bigger[2];}
      |                    ~~~~~~~^~~~~~~~~~~~