Language: C++

#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
//typedef pair<int, int> P;
//typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1LL << 30;

int main(){
  int N, K;
  cin >> N >> K;
  int R, S, P;
  cin >> R >> S >> P;
  string T;
  cin >> T;
  
  vector<string> str(K, "");
  for(int i = 0; i < T.size(); i++){
    str.at(i%K) += T.at(i);
  }
  ll ans = 0;
  for(int i = 0; i < K; i++){
    //str.at(i)について
    for(int j = 0; j < str.at(i).size(); j++){
      if(j != 0 && str.at(i).at(j) == str.at(i).at(j-1)){
        int counter = 0;
        for(int k = j; k < str.at(i).size(); k++){
          if(str.at(i).at(j-1) == str.at(i).at(k)) counter++;
          else break;
        }
        if(str.at(i).at(j) == 'r') ans += counter/2 * P;
        if(str.at(i).at(j) == 's') ans += counter/2 * R;
        if(str.at(i).at(j) == 'p') ans += counter/2 * S;
        j += counter;
        j--;
      }
      else{
        if(str.at(i).at(j) == 'r') ans += P;
        if(str.at(i).at(j) == 's') ans += R;
        if(str.at(i).at(j) == 'p') ans += S;
      } 
    }
  }
  cout << ans << endl;
}#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
//typedef pair<int, int> P;
//typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1LL << 30;

int main(){
  int N, K;
  cin >> N >> K;
  int R, S, P;
  cin >> R >> S >> P;
  string T;
  cin >> T;
  
  vector<string> str(K, "");
  for(int i = 0; i < T.size(); i++){
    str.at(i%K) += T.at(i);
  }
  ll ans = 0;
  for(int i = 0; i < K; i++){
    //str.at(i)について
    for(int j = 0; j < str.at(i).size(); j++){
      if(j != 0 && str.at(i).at(j) == str.at(i).at(j-1)){
        int counter = 0;
        for(int k = j; k < str.at(i).size(); k++){
          if(str.at(i).at(j-1) == str.at(i).at(k)) counter++;
          else break;
        }
        if(str.at(i).at(j) == 'r') ans += counter/2 * P;
        if(str.at(i).at(j) == 's') ans += counter/2 * R;
        if(str.at(i).at(j) == 'p') ans += counter/2 * S;
        j += counter;
        j--;
      }
      else{
        if(str.at(i).at(j) == 'r') ans += P;
        if(str.at(i).at(j) == 's') ans += R;
        if(str.at(i).at(j) == 'p') ans += S;
      } 
    }
  }
  cout << ans << endl;
}

Compiler output:
a.cc:53:2: error: stray '#' in program
   53 | }#include <bits/stdc++.h>
      |  ^
a.cc:53:3: error: 'include' does not name a type
   53 | }#include <bits/stdc++.h>
      |   ^~~~~~~
a.cc:64:35: error: redefinition of 'template<class T> bool chmax(T&, T)'
   64 | template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
      |                                   ^~~~~
a.cc:12:35: note: 'template<class T> bool chmax(T&, T)' previously declared here
   12 | template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
      |                                   ^~~~~
a.cc:65:35: error: redefinition of 'template<class T> bool chmin(T&, T)'
   65 | template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
      |                                   ^~~~~
a.cc:13:35: note: 'template<class T> bool chmin(T&, T)' previously declared here
   13 | template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
      |                                   ^~~~~
a.cc:66:17: error: redefinition of 'const long long int INF'
   66 | const long long INF = 1LL << 60;
      |                 ^~~
a.cc:14:17: note: 'const long long int INF' previously defined here
   14 | const long long INF = 1LL << 60;
      |                 ^~~
a.cc:67:11: error: redefinition of 'const int INT_INF'
   67 | const int INT_INF = 1LL << 30;
      |           ^~~~~~~
a.cc:15:11: note: 'const int INT_INF' previously defined here
   15 | const int INT_INF = 1LL << 30;
      |           ^~~~~~~
a.cc:69:5: error: redefinition of 'int main()'
   69 | int main(){
      |     ^~~~
a.cc:17:5: note: 'int main()' previously defined here
   17 | int main(){
      |     ^~~~