criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define pb push_back
typedef vector<pii> vpii;
typedef long long ll;
typedef unsigned long long ull;
const ll MN = 1e5+5;
ll n, k;
ll R, S, P;
string t;
ll arr[MN];
ll score[MN];
ll dp[2][MN];
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n >> k;
    cin >> R >> S >> P;
    cin >> t;
    for (ll i = 0; i<n;i++) {
        if (t[i] == 'r') {
            arr[i] = R;
            score[i] = P;
        }
        else if (t[i] == 's') {
            arr[i] = S;
            score[i] = R;
        }
        else {
            arr[i] = P;
            score[i] = S;
        }
    }
    ll ans = 0;
    for (ll i = 0; i<k;i++) {
        dp[1][i] = score[i];
        //take = 1
        //leave = 0
        dp[0][i] = 0;
        ll last = i;
        for (ll j = i+k; j<n;j+=k) {
            if (arr[j] == arr[j-k]) {
                dp[0][j] = dp[1][j-k];
                dp[1][j] = dp[0][j-k] + score[j];
            }
            else {
                dp[0][j] = dp[1][j-k];
                dp[1][j] = max(dp[1][j-k], dp[0][j-k]) + score[j];
            }
            last = j;
        }
        ans += max(dp[0][last], dp[1][last]);
    }
    cout << ans << "\n";
}

Compiler output:
a.cc:6:16: error: 'pii' was not declared in this scope
    6 | typedef vector<pii> vpii;
      |                ^~~
a.cc:6:19: error: template argument 1 is invalid
    6 | typedef vector<pii> vpii;
      |                   ^
a.cc:6:19: error: template argument 2 is invalid
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define pb push_back
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vpii;
typedef long long ll;
typedef unsigned long long ull;
const ll MN = 1e5+5;
ll n, k;
ll R, S, P;
string t;
ll arr[MN];
ll score[MN];
ll dp[2][MN];
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n >> k;
    cin >> R >> S >> P;
    cin >> t;
    for (ll i = 0; i<n;i++) {
        if (t[i] == 'r') {
            arr[i] = R;
            score[i] = P;
        }
        else if (t[i] == 's') {
            arr[i] = S;
            score[i] = R;
        }
        else {
            arr[i] = P;
            score[i] = S;
        }
    }
    ll ans = 0;
    for (ll i = 0; i<k;i++) {
        dp[1][i] = score[i];
        //take = 1
        //leave = 0
        dp[0][i] = 0;
        ll last = i;
        for (ll j = i+k; j<n;j+=k) {
            if (arr[j] == arr[j-k]) {
                dp[0][j] = dp[1][j-k];
                dp[1][j] = dp[0][j-k] + score[j];
            }
            else {
                dp[0][j] = dp[1][j-k];
                dp[1][j] = max(dp[1][j-k], dp[0][j-k]) + score[j];
            }
            last = j;
        }
        ans += max(dp[0][last], dp[1][last]);
    }
    cout << ans << "\n";
}

Compiler output:
a.cc:6:14: error: 'll' was not declared in this scope
    6 | typedef pair<ll, ll> pii;
      |              ^~
a.cc:6:18: error: 'll' was not declared in this scope
    6 | typedef pair<ll, ll> pii;
      |                  ^~
a.cc:6:20: error: template argument 1 is invalid
    6 | typedef pair<ll, ll> pii;
      |                    ^
a.cc:6:20: error: template argument 2 is invalid
a.cc:7:16: error: 'll' was not declared in this scope
    7 | typedef vector<ll> vi;
      |                ^~
a.cc:7:18: error: template argument 1 is invalid
    7 | typedef vector<ll> vi;
      |                  ^
a.cc:7:18: error: template argument 2 is invalid
Language: C++

#include<iostream>
#include<string>
using namespace std;

int main()
{
   // string S,t;    
    int n,k,r,s,p,i,len,sum=0;
    cin>>n>>k;
  char S[n],t[n];
    cin>>r>>s>>p;
    cin>>S;
    len=S.length();
    for(i=0;i<k;i++)
    {
        if(S[i]== 'r')
        {
            sum+=p;
            t[i]= 'p';
        }
            
        else if(S[i]== 's')
        {
            sum+=r;
            t[i]= 'r';
        }
        
        else
        {
            sum+=s;
            t[i]= 's';
        }
    }
    for(i=k;i<n;i++)
    {
        if(S[i]==S[i-k] && S[i]!=t[i-k])
        {
            sum+=0;
            t[i]=S[i];
         }
        else
        {
            if(S[i]== 'r')
        {
            sum+=p;
            t[i]= 'p';
        }
            
        else if(S[i]== 's')
        {
            sum+=r;
            t[i]= 'r';
        }
        
        else
        {
            sum+=s;
            t[i]= 's';
        }
        }
            
    }
    cout<<sum;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:11: error: request for member 'length' in 'S', which is of non-class type 'char [n]'
   13 |     len=S.length();
      |           ^~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main () {
  int N, K, R, S, P;
  cin >> N >> K >> R >> S >> P;
  string T;
  cin >> T;
  int ans = 0;
  int z = (N - 1) / K;
  vector<vector<char>>key(K, vector<char>(z + 1));
  for (int i = 0; i < N; i ++) {
    int j = i % K;
    int k = i / K;
    cin >> key[j][k];
  }
  int fin = N % K;
  int ans = 0;
  for (j = 0; j < K; j ++) {
    vector<int>rdp(z + 2);
    vector<int>sdp(z + 2);
    vector<int>pdp(z + 2);
    rdp[0] = sdp[0] = pdp[0] = 0;
    int ok = z + 1;
    if (j > fin) ok --;
    for (int i = 0; i < ok; i ++) {
      if (key[j][i] == 'r') {
        pdp[i + 1] = max(rdp[i], sdp[i]) + P;
      }
      if (key[j][i] == 's') {
        rdp[i + 1] = max(sdp[i], pdp[i]) + R;
      }
      if (key[j][i] == 'p') {
        sdp[i + 1] = max(rdp[i], pdp[i]) + S;
      }
    }
    ans += max(sdp[z + 1], max(rdp[z + 1], pdp[z + 1]));
  }
  cout << ans << endl;
}

  


Compiler output:
a.cc: In function 'int main()':
a.cc:17:7: error: redeclaration of 'int ans'
   17 |   int ans = 0;
      |       ^~~
a.cc:8:7: note: 'int ans' previously declared here
    8 |   int ans = 0;
      |       ^~~
a.cc:18:8: error: 'j' was not declared in this scope
   18 |   for (j = 0; j < K; j ++) {
      |        ^
Language: C++

#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	cin>>N>>M;
	int P,R,S;
	cin>>p>>r>>s;
	int point[256]={};
	point['p']=P;
	point['r']=R;
	point['s']=S;
	string s;
	cin>>s;
	vector<vector<int>>dp(N,vector<int>(2));
	for(int i=0;i<M;i++){
		dp[i][1]=point[s[i]];
	}
	for(int i=M;i<N;i++){
		dp[i][0]=max(dp[i-M][1],dp[i-M][0]);
		dp[i][1]=dp[i-M][0]+point[s[i]];
	}
	long long int ans=0;
	for(int i=0;i<M;i++){
		ans+=max(dp[N-1-i][0],dp[N-1-i][1]);
	}
	cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:14: error: 'p' was not declared in this scope
   39 |         cin>>p>>r>>s;
      |              ^
a.cc:39:17: error: 'r' was not declared in this scope
   39 |         cin>>p>>r>>s;
      |                 ^
a.cc:39:20: error: 's' was not declared in this scope
   39 |         cin>>p>>r>>s;
      |                    ^
Language: C++

import math
n,k = map(int, input().split())
r,s,p = map(int, input().split())
t = input()
ans=0
f=True;
for i in range(k):
  if t[i::k][0]=="r": ans+=p
  elif t[i::k][0]=="s": ans+=r
  elif t[i::k][0]=="p": ans+=s
  for j in range(1,len(t[i::k])):
    if t[i::k][j]==t[i::k][j-1] and f: f=False
    else:
      f=True
      if t[i::k][j]=="r": ans+=p
      elif t[i::k][j]=="s": ans+=r
      elif t[i::k][j]=="p": ans+=s
print(ans)

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import math
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:7:1: error: expected unqualified-id before 'for'
    7 | for i in range(k):
      | ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = unsigned long long;
int main(){
    ll N,K;
    cin >> N >> K;
    ll R,S,P;
    cin >> R >> S >> P;
    string T;
    cin >> T;
    
    ll score = 0;
    deque<char> dq;
    char r = 'r',s = 's',p = 'p';
//    vector<string> hand = {'r','s','p'};
    
    for(ll i = 0;i<N;++i){
//        cout << "i:" << score << " " << endl;

        char c = T.at(i);
//        q.push(c);
        if(c == r){
            if(K <= i){
                char a = dq.front();
//                                cout << endl;
//                cout << "i:" << i << " a:" << a << endl;
                if(a != p){
                    score += P;
                dq.push_back(p);
                }else{
                    score += 0;
                dq.push_back(r);
                }
                dq.pop_front();
            }else{
                score += P;
                dq.push_back(p);
            }
        }else if(c == s){
            if(K <= i){
                char a = dq.front();
                if(a != r){
                    score += R;
                dq.push_back(r);
                }else{
                    score += 0;
                dq.push_back(s);
                }
                dq.pop_front();
            }else{
                score += R;
                dq.push_back(r);
            }
        }else if(c == p){
            if(K <= i){
                char a = dq.front();
                if(a != s){
                    score += S;
                dq.push_back(s);
                }else{
                    score += 0;
                dq.push_back(p);
                }
                dq.pop_front();
            }else{
                score += S;
                dq.push_back(s);
            }
        }else{
            return;
        }
//        cout << "i:" << i << " score:" << score << " c:" << c << " "<< endl;
    }
    cout << score << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:70:13: error: return-statement with no value, in function returning 'int' [-fpermissive]
   70 |             return;
      |             ^~~~~~
Language: C++

ll r,s,p;

ll calc(char sc) {
  ll point = 0;
  if (sc == 'p') {
    point = s;
  } else if(sc == 'r') {
    point = p;
  } else if (sc == 's') {
    point = r;
  }
  return point;
}


int main() {
  ll n,k;
  cin >> n >> k;
  cin >> r >> s >> p;
  vector<bool> vb(k, false);

  ll total = 0;

  string sc;
  cin >> sc;

  REP(i, n) {
    if(i < k) {
      total += calc(sc.at(i));
    } else {
      if(sc.at(i-k) == sc.at(i) && !vb.at(i%k)) {
        vb.at(i%k) = true;
      } else {
        total += calc(sc.at(i));
        vb.at(i%k) = false;
      }
    }
  }

  cout << total << endl;
}


Compiler output:
a.cc:1:1: error: 'll' does not name a type
    1 | ll r,s,p;
      | ^~
a.cc:3:1: error: 'll' does not name a type
    3 | ll calc(char sc) {
      | ^~
a.cc: In function 'int main()':
a.cc:17:3: error: 'll' was not declared in this scope
   17 |   ll n,k;
      |   ^~
a.cc:18:3: error: 'cin' was not declared in this scope
   18 |   cin >> n >> k;
      |   ^~~
a.cc:18:10: error: 'n' was not declared in this scope
   18 |   cin >> n >> k;
      |          ^
a.cc:18:15: error: 'k' was not declared in this scope
   18 |   cin >> n >> k;
      |               ^
a.cc:19:10: error: 'r' was not declared in this scope
   19 |   cin >> r >> s >> p;
      |          ^
a.cc:19:15: error: 's' was not declared in this scope
   19 |   cin >> r >> s >> p;
      |               ^
a.cc:19:20: error: 'p' was not declared in this scope
   19 |   cin >> r >> s >> p;
      |                    ^
a.cc:20:3: error: 'vector' was not declared in this scope
   20 |   vector<bool> vb(k, false);
      |   ^~~~~~
a.cc:20:10: error: expected primary-expression before 'bool'
   20 |   vector<bool> vb(k, false);
      |          ^~~~
a.cc:22:5: error: expected ';' before 'total'
   22 |   ll total = 0;
      |     ^~~~~~
      |     ;
a.cc:24:3: error: 'string' was not declared in this scope
   24 |   string sc;
      |   ^~~~~~
a.cc:25:10: error: 'sc' was not declared in this scope
   25 |   cin >> sc;
      |          ^~
a.cc:27:7: error: 'i' was not declared in this scope
   27 |   REP(i, n) {
      |       ^
a.cc:27:3: error: 'REP' was not declared in this scope
   27 |   REP(i, n) {
      |   ^~~
a.cc:40:3: error: 'cout' was not declared in this scope
   40 |   cout << total << endl;
      |   ^~~~
a.cc:40:11: error: 'total' was not declared in this scope
   40 |   cout << total << endl;
      |           ^~~~~
a.cc:40:20: error: 'endl' was not declared in this scope
   40 |   cout << total << endl;
      |                    ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 9999999999999999;
using ll = long long;
int main(){
  int N,K;
  int R,S,P; //グー　チョキ　パー 0 1 2
  cin>>N>>K>>R>>S>>P;
  string s;
  cin>>s;
  string ss[K];
  for(int i = 0;i<N;i++){
    ss[K%i] += s.at(i);
  }
  for(int i = 0;i<K;i++){
    int dp[100100][4] = {0}; //　ｎ回目、n回目の手
    if(ss[i].at(0) == 'r'){
      dp[0][0] = 0;
      dp[0][1] = 0;
      dp[0][2] = P;
    }
    if(ss[i].at(0) == 's'){
      dp[0][0] = R;
      dp[0][1] = 0;
      dp[0][2] = 0;
    }
    if(ss[i].at(0) == 'p'){
      dp[0][0] = 0;
      dp[0][1] = S;
      dp[0][2] = 0;
    }
    for(int k = 0;k<ss[i].size();k++){
      dp[i][k] = 

Compiler output:
a.cc: In function 'int main()':
a.cc:34:17: error: expected primary-expression at end of input
   34 |       dp[i][k] =
      |                 ^
a.cc:34:17: error: expected '}' at end of input
a.cc:33:38: note: to match this '{'
   33 |     for(int k = 0;k<ss[i].size();k++){
      |                                      ^
a.cc:34:17: error: expected '}' at end of input
   34 |       dp[i][k] =
      |                 ^
a.cc:16:25: note: to match this '{'
   16 |   for(int i = 0;i<K;i++){
      |                         ^
a.cc:34:17: error: expected '}' at end of input
   34 |       dp[i][k] =
      |                 ^
a.cc:6:11: note: to match this '{'
    6 | int main(){
      |           ^
Language: C++

#include <iostream>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;

int main() {
  int N, K, R, S, P;
  cin >> N >> K >> R >> S >> P;
  string T;
  cin >> T;
  bitset<11000> win;
  REP(i, N) if (i < K || T[i - K] != T[i] || !win[i - K]) win[i] = true;
  ll ans = 0;
  REP(i, N) if (win[i]) {
    if (T[i] == 's') ans += R;
    if (T[i] == 'p') ans += S;
    if (T[i] == 'r') ans += P;
  }

  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:3: error: 'bitset' was not declared in this scope
   11 |   bitset<11000> win;
      |   ^~~~~~
a.cc:2:1: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>'
    1 | #include <iostream>
  +++ |+#include <bitset>
    2 | #define REP(i, n) for (int i = 0; i < (int)(n); i++)
a.cc:11:17: error: 'win' was not declared in this scope
   11 |   bitset<11000> win;
      |                 ^~~
Language: C++

#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <bitset>
#include <unordered_map>
#include <queue>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <cstring>
#include <cmath>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i, n) for(int i = (int)(n-1); i > -1; i--)


ull MOD = 1000000007;


int calculateScore(char hand, const int *scores){
    switch(hand){
        case 's':
        return scores[0];
        
        case 'p':
        return scores[1];

        default:
        return scores[2];
    }
}

int battle(char expectedHand, char previousHand, const int *scores){
    if( expectedHand == previousHand){
        return 0;
    }
    return calculateScore(expectedHand, scores);
}


int main(){
    int n,k;
    int scores[3];
    ll ans = 0;
    string t;
    cin >> n >> k;
    rep(i,3){
        cin >> scores[i];
    }
    cin >> t;
    char memo[n];
    memoset(memo, 0, sizeof(memo));
    rep(i,n){
        if(i < k){
            memo[i] = t[i];
            ans += calculateScore(t[i], scores);
            continue;
        }
        ll score = battle(t[i], memo[i-k], scores);
        if( score == 0 ) continue;
        memo[i] = t[i];
        ans += score; 
    }

    cout << ans << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:58:5: error: 'memoset' was not declared in this scope; did you mean 'memset'?
   58 |     memoset(memo, 0, sizeof(memo));
      |     ^~~~~~~
      |     memset
Language: C++

int main() {
  ll n,k;
  ll r,s,p;
  cin >> n >> k;
  cin >> r >> s >> p;
  vector<string> v(k, "");

  ll total = 0;

  bool passed = false;

  REP(i, n) {
    char c;
    cin >> c;
    string sc{c};

    //flagが立っている->1個前が同じだった場合はフラグを立ててカウントをしない
    if(v.at(i%k) == sc) {
      if(passed) {
        if (sc == "p") {
          total = total + s;
        } else if(sc == "r") {
          total = total + p;
        } else if (sc == "s") {
          total = total + r;
        }
        passed = false;
      } else {
        passed = true;
      }
    } else {
      if (sc == "p") {
        total = total + s;
      } else if(sc == "r") {
        total = total + p;
      } else if (sc == "s") {
        total = total + r;
      }
      passed = false;
    }
    v.at(i%k) = sc;
  }

  cout << total << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:2:3: error: 'll' was not declared in this scope
    2 |   ll n,k;
      |   ^~
a.cc:3:5: error: expected ';' before 'r'
    3 |   ll r,s,p;
      |     ^~
      |     ;
a.cc:4:3: error: 'cin' was not declared in this scope
    4 |   cin >> n >> k;
      |   ^~~
a.cc:4:10: error: 'n' was not declared in this scope
    4 |   cin >> n >> k;
      |          ^
a.cc:4:15: error: 'k' was not declared in this scope
    4 |   cin >> n >> k;
      |               ^
a.cc:5:10: error: 'r' was not declared in this scope
    5 |   cin >> r >> s >> p;
      |          ^
a.cc:5:15: error: 's' was not declared in this scope
    5 |   cin >> r >> s >> p;
      |               ^
a.cc:5:20: error: 'p' was not declared in this scope
    5 |   cin >> r >> s >> p;
      |                    ^
a.cc:6:3: error: 'vector' was not declared in this scope
    6 |   vector<string> v(k, "");
      |   ^~~~~~
a.cc:6:10: error: 'string' was not declared in this scope
    6 |   vector<string> v(k, "");
      |          ^~~~~~
a.cc:6:18: error: 'v' was not declared in this scope
    6 |   vector<string> v(k, "");
      |                  ^
a.cc:8:5: error: expected ';' before 'total'
    8 |   ll total = 0;
      |     ^~~~~~
      |     ;
a.cc:12:7: error: 'i' was not declared in this scope
   12 |   REP(i, n) {
      |       ^
a.cc:12:3: error: 'REP' was not declared in this scope
   12 |   REP(i, n) {
      |   ^~~
a.cc:44:3: error: 'cout' was not declared in this scope
   44 |   cout << total << endl;
      |   ^~~~
a.cc:44:11: error: 'total' was not declared in this scope
   44 |   cout << total << endl;
      |           ^~~~~
a.cc:44:20: error: 'endl' was not declared in this scope
   44 |   cout << total << endl;
      |                    ^~~~
Language: Java


import java.util.Scanner;
public class Main {
	
	static int r;
	static int s;
	static int p;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		int k = Integer.parseInt(sc.next());
		
		 r = Integer.parseInt(sc.next()); // グー
		 s = Integer.parseInt(sc.next()); //チョキ
		 p = Integer.parseInt(sc.next()); //パー
		
		char []hand = sc.next().toCharArray();
		int [][]cnt = new int [k][3];
		int [][]len = new int[k][3];
		for(int i = 0 ; i < n ; i++) {
			cnt[i%k][jdg(hand[i])]++;
			
			if(i - k >= 0 && hand[i] == hand[i-k]) {
			len[i%k][jdg(hand[i])]++;
			}
		}
		
		long ans = 0;
		
		for(int i = 0 ; i < k ; i++) {
			ans += p * (cnt[i][0] - dec(len[i][0]));
			ans += r * (cnt[i][1] - dec(len[i][1]));
			ans += s * (cnt[i][2] - dec(len[i][2]));
			
		}
		System.out.println(ans);
				}
	
	static int jdg(char k) {
		if(k == 'r') {
			return 0;
		}
		if(k == 's') {
			return 1;
		}
			return 2;
	}
		

	static int dec(int len) {
		if(len % 2 == 0) {
			return len/2;
		}
		else {
			return (len+1)/2;
		}
	}




Compiler output:
Main.java:59: error: reached end of file while parsing
	}
	 ^
1 error
Language: C++

#include <iostream>
#include <string>

using namespace std;

int main()
{
long int score = 0;
int N,K,Rock,Scissors,Paper;
cin >> N >> K;
cin >> Rock >> Scissors >> Paper;

string game;
cin >> game;

char table[100010];
int i = 0;
	for(i=0; i<N; i++){
		if(i < K){
			if(game[i] == 'r'){
				score += Paper;
			}else if(game[i] == 's'){
				score += Rock;
			}else if(game[i] == 'p'){
				score += Scissors;
			}
		}else{
			if(game[i] == 'r'){
				if(game[i-K] != 'r'){
					score += Paper;
				}else{
					game[i] = 'a';
				}
			}else if(game[i] == 's'){
				if(game[i-K] != 's'){
					score += Rock;
				}else{
					game[i] = 'a';
				}
			}else if(game[i] == 'p'){
				if(game[i-K] != 'p'){
					score += Scissors;
				}else{
					game[i] = 'a';
				}
			}
		}

	}

cout << score;

}#include <iostream>
#include <string>

using namespace std;

int main()
{
long int score = 0;
int N,K,Rock,Scissors,Paper;
cin >> N >> K;
cin >> Rock >> Scissors >> Paper;

string game;
cin >> game;

char table[100010];
int i = 0;
	for(i=0; i<N; i++){
		if(i < K){
			if(game[i] == 'r'){
				score += Paper;
			}else if(game[i] == 's'){
				score += Rock;
			}else if(game[i] == 'p'){
				score += Scissors;
			}
		}else{
			if(game[i] == 'r'){
				if(game[i-K] != 'r'){
					score += Paper;
				}else{
					game[i] = 'a';
				}
			}else if(game[i] == 's'){
				if(game[i-K] != 's'){
					score += Rock;
				}else{
					game[i] = 'a';
				}
			}else if(game[i] == 'p'){
				if(game[i-K] != 'p'){
					score += Scissors;
				}else{
					game[i] = 'a';
				}
			}
		}

	}

cout << score;

}

Compiler output:
a.cc:53:2: error: stray '#' in program
   53 | }#include <iostream>
      |  ^
a.cc:53:3: error: 'include' does not name a type
   53 | }#include <iostream>
      |   ^~~~~~~
a.cc:58:5: error: redefinition of 'int main()'
   58 | int main()
      |     ^~~~
a.cc:6:5: note: 'int main()' previously defined here
    6 | int main()
      |     ^~~~
Language: C++

//2019.12.29
//DP.
#include<iostream>
#include<vector>
#include<string>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
using namespace std;
typedef long long   llong;
typedef vector<int> vi;
typedef vector<vi > vvi;

int main(){
	int n,k;
	int a[3];
	string t;
	
	cin>>n>>k;
	REP(i,3) cin>>a[i];
	cin>>t;
	
	vi v(n);
	char hoge[]="spr";//point!
	REP(i,n){
		REP(j,3) if(t[i]==hoge[j]) v[i]=j;
	}
	
	vvi dp(n,vi(3));
	REP(i,n){
		if(i<k){
			REP(j,3){
				if(j==v[i]) dp[i][j]=a[v[i]];
				else dp[i][j]=0;
			}
		}else{
			REP(j,3){
				int tmp=0;
				REP(l,3) if(l!=j) tmp=max(tmp,dp[i-k][l]);
				
				if(j==v[i]) dp[i][j]=tmp+a[v[i]];
				else dp[i][j]=tmp;
			}
		}
	}
	
	llong ans=0;
	for(int i=n-1,j=k;i>=0 and j>0;--i,--j){
		ans+=max({dp[i][0],dp[i][1],dp[i][2]});
	}
	
	cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:48:25: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
   48 |                 ans+=max({dp[i][0],dp[i][1],dp[i][2]});
      |                      ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 1 provided
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k,r,s,p;
  string t;
  cin >> n >> k;
  cin >> r >> s >> p;
  cin >> t;
  int i;
  vector<long>gu(k);
  vector<long>choki(k);
  vector<long>pa(k);
  for(i=0;i<n;i++){
    if(s[i]=='r')gu[i%k]++;
    if(s[i]=='s')choki[i%k]++;
    if(s[i]=='p')pa[i%k]++;
  }
  long ans = 0;
  for(i=0;i<k;i++){
    ans += max(gu[i]*r,max(choki[i]*s,pa[i]*p));
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:9: error: invalid types 'int[int]' for array subscript
   14 |     if(s[i]=='r')gu[i%k]++;
      |         ^
a.cc:15:9: error: invalid types 'int[int]' for array subscript
   15 |     if(s[i]=='s')choki[i%k]++;
      |         ^
a.cc:16:9: error: invalid types 'int[int]' for array subscript
   16 |     if(s[i]=='p')pa[i%k]++;
      |         ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k,r,s,p;
  string t;
  cin >> n >> k;
  cin >> r >> s >> p;
  cin >> t;
  vector<long>gu(k);
  vector<long>choki(k);
  vector<long>pa(k);
  for(i=0;i<n;i++){
    if(s[i]=='r')gu[i%k]++;
    if(s[i]=='s')choki[i%k]++;
    if(s[i]=='p')pa[i%k]++;
  }
  long ans = 0;
  for(i=0;i<k;i++){
    ans += max(gu[i]*r,max(choki[i]*s,pa[i]*p));
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:7: error: 'i' was not declared in this scope
   12 |   for(i=0;i<n;i++){
      |       ^
a.cc:18:7: error: 'i' was not declared in this scope
   18 |   for(i=0;i<k;i++){
      |       ^
Language: C++

#include<iostream>
using namespace std;
int N,K,R,S,P,a,i;
string S;
bool f[1<<17];
int main(){
	cin>>N>>K>>R>>S>>P>>S;
	for(i=0;i<N;i++){
		if(i<K||S[i-K]!=S[i]||!f[i-K]){
			a+=S[i]=='r'?P:S[i]=='s'?R:S;
			f[i]=true;
		}
	}
	cout<<a<<endl;
}


Compiler output:
a.cc:4:8: error: conflicting declaration 'std::string S'
    4 | string S;
      |        ^
a.cc:3:11: note: previous declaration as 'int S'
    3 | int N,K,R,S,P,a,i;
      |           ^
a.cc: In function 'int main()':
a.cc:9:26: error: invalid types 'int[int]' for array subscript
    9 |                 if(i<K||S[i-K]!=S[i]||!f[i-K]){
      |                          ^
a.cc:9:34: error: invalid types 'int[int]' for array subscript
    9 |                 if(i<K||S[i-K]!=S[i]||!f[i-K]){
      |                                  ^
a.cc:10:29: error: invalid types 'int[int]' for array subscript
   10 |                         a+=S[i]=='r'?P:S[i]=='s'?R:S;
      |                             ^
a.cc:10:41: error: invalid types 'int[int]' for array subscript
   10 |                         a+=S[i]=='r'?P:S[i]=='s'?R:S;
      |                                         ^
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <deque>

#define Inf             987654321
using namespace std;

typedef long long int   ll;
typedef pair<ll, ll>    pii;
typedef vector<ll>      vi;
typedef vector<vi>      vii;
typedef vector <vector<char> > vvc;
typedef vector <char> vc;
/*************************************************/

ll N, K, R, S, P, ans;
string T;

void sol() {
    for(int i = 0; i < N; i++){
        if(i >= K){
            if(T[i] == T[i-k]){
                T[i] = 'x';     //중복이므로 continue,
                continue;       //하지만 다음 K번째에는 영향을 주면 안되므로 'x'로 처리한다.
            }                   //가위바위보라서 선택지가 이기는것말고 2개이기 때문에 가능한 경우.
        }
        if(T[i]=='r') ans += P;
        else if(T[i]=='s') ans += R;
        else if(T[i]=='p') ans += S;
        else;
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(); cout.tie();
    cin >> N >> K >> R >> S >> P >> T;
    sol();
    cout << ans;
    return 0;
}


Compiler output:
a.cc: In function 'void sol()':
a.cc:24:28: error: 'k' was not declared in this scope
   24 |             if(T[i] == T[i-k]){
      |                            ^
Language: C

#include<stdio.h>
#include <string.h>

int main(void){

    int n,k,r,s,p;
    int i=0;
    int cr=0, cs=0, cp=0; 
    char t[100000], at[100000];

    scanf("%d %d", &n, &k);

    char t[n+1], at[n+1];
    scanf("%d %d %d", &r, &s, &p);
    scanf("%s", &t);

    while(t[i] != '\0'){

        if(t[i]==at[i-k]){
            at[i]='f';
        }else if(t[i]=='r'){
            cp++;
            at[i]='r';
        }else if(t[i]=='s'){
            cr++;
            at[i]='s';
        }else if(t[i]=='p'){
            cs++;
            at[i]='p';
        }
        i++;
    }

    printf("%d", (r*cr+s*cs+p*cp) );
}

Compiler output:
main.c: In function 'main':
main.c:13:10: error: redeclaration of 't' with no linkage
   13 |     char t[n+1], at[n+1];
      |          ^
main.c:9:10: note: previous declaration of 't' with type 'char[100000]'
    9 |     char t[100000], at[100000];
      |          ^
main.c:13:18: error: redeclaration of 'at' with no linkage
   13 |     char t[n+1], at[n+1];
      |                  ^~
main.c:9:21: note: previous declaration of 'at' with type 'char[100000]'
    9 |     char t[100000], at[100000];
      |                     ^~
Language: C++

//的場梨沙★担当
//結城晴★副担当
//日野茜★副担当
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string.h>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <iostream>

using namespace std;

int main() {
    int N,K,R,S,P;
    string T;

    cin>>N>>K>>R>>S>>P>>T;
    int M;
    for(int i=0;i<N;i++){
        if(i<K){
            if(T[i]=='r'){
                M=M+R;
            }
            if(T[i]=='s'){
                M=M+S;
            }
            if(T[i]=='p'){
                M=M+P;
            }

        }
        else {
            if (T[i] == 'r' && T[i - K] != 'r') {
                M = M + R;

            } else if (T[i] == 's' && T[i - K] != 's') {
                M = M + S;

            } else if (T[i] == 'p' && T[i - K] != 'p') {
                M = M + S;

            }
        }
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:75:6: error: expected '}' at end of input
   75 |     }
      |      ^
a.cc:44:12: note: to match this '{'
   44 | int main() {
      |            ^
Language: C++

#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>
#include<limits>
#include<bitset>
#include<functional>
#include<type_traits>
#include<queue>
#include<stack>
#include<array>
#include<random>
#include<utility>
#include<cstdlib>
#include<ctime>

#include<string>
    
using namespace std;
int n, k, r, s, p;
string t;
string group[1000000][1000000];
int main() {
    cin >> n >> k;
    cin >> r >> s >> p;
    cin >> t;
    int res = n % k;
    int war = n / k;
    for ( int i = 0; i< k; ++i) {
        for (int j =0; j < war; j++) {
            group[i][j] = t[k * j + i];
        }
    }
    for (int i = 0; k-i> k - res; i ++) {
        group[k-i][war] = t[k * war + k-i];
    }
    int r_num[k], s_num[k], p_num[k];
    for (int i = 0; i < k;i++) {
        r_num[i] = 0;
        s_num[i] = 0;
        p_num[i] = 0;
        for(int j=0; j< war;j++) {
            if(group[i][j] == "r") r_num[i]++;
            if(group[i][j] == "s") s_num[i]++;
            if(group[i][j] == "p") p_num[i]++;
        }
        for (int i = 0; k-i> k - res; i ++) {
            if(group[k-i][war] == "r") r_num[i]++;
            if(group[k-i][war] == "s") s_num[i]++;
            if(group[k-i][war] == "p") p_num[i]++;
        }
        if (r_num[i] > 0) r_num[i]--;
        if (s_num[i] > 0) s_num[i]--;
        if (p_num[i] > 0) p_num[i]--;
    }
    int r_re=0;
    int s_re = 0;
    int p_re = 0;
    for (int i =0; i < k; i++) {
        r_re += r_num[i];
        s_re += s_num[i];
        p_re += p_num[i];
    }
    int min = 0;
    min += r_re * p;
    min += s_re * r;
    min += p_re * s;
    int plu = 0;
    for (int i =0; i < n; i++) {
        if(t[i] == "r") plu += p;
        if(t[i] == "s") plu += r;
        if(t[i] == "p") plu += s;
    }
    cout << plu - min << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:73:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   73 |         if(t[i] == "r") plu += p;
a.cc:74:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   74 |         if(t[i] == "s") plu += r;
a.cc:75:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   75 |         if(t[i] == "p") plu += s;
Language: C++

#include <bits/stdc++.h>
using namespace std;


int main() {
  long long n,k,r,s,p;
  string t;
  cin >> n >> k >> r >> s >> p;
  cin >> t;
  map<char, long long> score;      //charを引数として、数字を出力する
  score['r'] = p;
  score['s'] = r;
  score['p'] = s; //勝った手だから。注意
  
  long long all_sum = 0;
  for (long long i = 0; i < k; i++) {   //各partial の余り
    vector<char> vec(n/k + 1);
    for (long long j = 0; j < n; j++) {
      if (j%k == i) {
        vec.push_back(t.at(j));
      }
    }   //ここまでで、patrial(vec)が完成
    
    long long part_sum = score[vec.at(0)];
    
    for (long long i = 1; i < vec.size(); i++) {
      long long res = 0;
      if ((vec.at(i) != vec.at(i-1))) {
        part_sum += score[vec.at(i)];
        if (res != 0) {
          part_sum += ((res+1)/2) * score[vec.at(i-1)];
        }
      }
      else if {
        res++;
      }
    }
    cout << part_sum << endl;
    
    all_sum += part_sum;
  }
  
  cout << all_sum << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:34:15: error: expected '(' before '{' token
   34 |       else if {
      |               ^
      |               (
Language: C

#include<stdio.h>
#include <string.h>
#include<stdlib.h>
int main(){
int a,N,K,R,S,P;
int A =0;
char T[2000000];
scanf("%d %d",&N,&K);
scanf("%d %d %d",&R,&S,&P);
scanf("%s",T);

for(a=0;a<N;a++){
    if(T[a]=='r'){
        A += P;
    }else if(T[a]=='s'){
        A += R;
    }else if(T[a]=='p'){
        A += S;
    }else if{(T[a-K]==T[a] && T[a]=='r'){
    A-= P;
    }else if(T[a-K]==T[a] && T[a]=='s'){
    A-= R;
    }else if(T[a-K]==T[a] && T[a]=='p'){
    A-= S;
    }
  
}
  printf("%d",A);
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:19:13: error: expected '(' before '{' token
   19 |     }else if{(T[a-K]==T[a] && T[a]=='r'){
      |             ^
      |             (
main.c:19:41: error: expected ';' before '{' token
   19 |     }else if{(T[a-K]==T[a] && T[a]=='r'){
      |                                         ^
      |                                         ;
main.c:30:1: error: expected declaration or statement at end of input
   30 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repd(i,a,b) for (int i = (a); i < (b); i++)
#define INF LLONG_MAX
#define mod 1000000007
typedef long long ll;
int main(void)
{
	int N, K;
	cin >> N >> K;
	int R, S, P;
	cin >> R >> S >> P;
	int one, two, thr;
	int sco=0;
	string T, B="";
	cin >> T;
	rep(i, N)
	{
		if(T.at(i)=="r")
		{
			if(B=="p") 
			B += "p";
			sco += P;
		}
		if(T.at(i)=="s")
		{
			if(B=="r") 
			B += "r";
			sco += R;
		}
		else
		{
			if(B=="s") 
			B += "s";
			sco += S;
		}
	}
	cout << sco << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:27: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   20 |                 if(T.at(i)=="r")
      |                    ~~~~~~~^~~~~
a.cc:26:27: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   26 |                 if(T.at(i)=="s")
      |                    ~~~~~~~^~~~~
Language: C++

#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main(){
    ll n,k;
    map<char,ll>hand;
    vector<char>last;
    int r,s,p;
    cin>>s>>p>>r;
    string t;
    cin>>t;
    t=""+t;
    for(int i=1;i<=n;i++){
        if(i>=k){
          if(last[i-k]!=t[i]){
              hand[t[i]]+=1:
        }
      }
    }
    ll ans=0;
    ans+= hand[r];
    ans+= hand[s];
    ans+= hand[p];

    cout<<ans<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:28: error: expected ';' before ':' token
   17 |               hand[t[i]]+=1:
      |                            ^
      |                            ;
Language: C++

#include <iostream>
#include <string>
using namespace std;

int main() {
    int n, k, r, s, p;
    cin >> n >> k >> r >> s >> p;
    string t;
    cin >> t;
    for (int i = k; i < n; i++) {
        if (t[i].compare("t[i-k]")) t[i] = "a";
    }
    int numr, nums, nump;
    numr = 0;
    nums = 0;
    nump = 0;
    for (int i = 0; i < n; i++) {
        if (t[i].compare("r")) numr++;
            else if (t[i].compare("s")) nums++;
                else if (t[i].compare("p")) nump++;
    }
    int ans = numr*p + nums*r + nump*s;
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:18: error: request for member 'compare' in 't.std::__cxx11::basic_string<char>::operator[](((std::__cxx11::basic_string<char>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
   11 |         if (t[i].compare("t[i-k]")) t[i] = "a";
      |                  ^~~~~~~
a.cc:11:44: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive]
   11 |         if (t[i].compare("t[i-k]")) t[i] = "a";
      |                                            ^~~
      |                                            |
      |                                            const char*
a.cc:18:18: error: request for member 'compare' in 't.std::__cxx11::basic_string<char>::operator[](((std::__cxx11::basic_string<char>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
   18 |         if (t[i].compare("r")) numr++;
      |                  ^~~~~~~
a.cc:19:27: error: request for member 'compare' in 't.std::__cxx11::basic_string<char>::operator[](((std::__cxx11::basic_string<char>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
   19 |             else if (t[i].compare("s")) nums++;
      |                           ^~~~~~~
a.cc:20:31: error: request for member 'compare' in 't.std::__cxx11::basic_string<char>::operator[](((std::__cxx11::basic_string<char>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
   20 |                 else if (t[i].compare("p")) nump++;
      |                               ^~~~~~~
Language: C++

#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>
#include<limits>
#include<bitset>
#include<functional>
#include<type_traits>
#include<queue>
#include<stack>
#include<array>
#include<random>
#include<utility>
#include<cstdlib>
#include<ctime>

#include<string>
    
using namespace std;
int n, k, r, s, p;
string t;
string group[1000000][1000000];
int main() {
    cin >> n >> k;
    cin >> r >> s >> p;
    cin >> t;
    int res = n % k;
    int war = n / k;
    for ( int i = 0; i< k; ++i) {
        for (int j =0; j < war; j++) {
            group[i][j] = string[k * j + i];
        }
    }
    for (int i = 0; k-i> k - res; i ++) {
        group[k-i][war] = string[k * war + k-i];
    }
    int r_num[k], s_num[k], p_num[k];
    for (int i = 0; i < k;i++) {
        r_num[i] = 0;
        s_num[i] = 0;
        p_num[i] = 0;
        for(int j=0; j< war;j++) {
            if(group[i][j] == "r") r_num[i]++;
            if(group[i][j] == "s") s_num[i]++;
            if(group[i][j] == "p") p_num[i]++;
        }
        for (int i = 0; k-i> k - res; i ++) {
            if(group[k-i][war] == "r") r_num[i]++;
            if(group[k-i][war] == "s") s_num[i]++;
            if(group[k-i][war] == "p") p_num[i]++;
        }
        if (r_num[i] > 0) r_num[i]--;
        if (s_num[i] > 0) s_num[i]--;
        if (p_num[i] > 0) p_num[i]--;
    }
    int r_re=0;
    int s_re = 0;
    int p_re = 0;
    for (int i =0; i < k; i++) {
        r_re += r_num[i];
        s_re += s_num[i];
        p_re += p_num[i];
    }
    int min = 0;
    min += r_re * p;
    min += s_re * r;
    min += p_re * s;
    int plu = 0;
    for (int i =0; i < n; i++) {
        if(sting[i] == "r") plu += p;
        if(sting[i] == "s") plu += r;
        if(sting[i] == "p") plu += s;
    }
    cout << plu - min << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:33: error: expected primary-expression before '[' token
   34 |             group[i][j] = string[k * j + i];
      |                                 ^
a.cc:38:33: error: expected primary-expression before '[' token
   38 |         group[k-i][war] = string[k * war + k-i];
      |                                 ^
a.cc:73:12: error: 'sting' was not declared in this scope
   73 |         if(sting[i] == "r") plu += p;
      |            ^~~~~
a.cc:74:12: error: 'sting' was not declared in this scope
   74 |         if(sting[i] == "s") plu += r;
      |            ^~~~~
a.cc:75:12: error: 'sting' was not declared in this scope
   75 |         if(sting[i] == "p") plu += s;
      |            ^~~~~
Language: C++

#include <iostream>
#include <math.h>
using namespace std;


int main()
{
    int n, k;
    cin >> n >> k;
    int r, s, p;
    cin >> r >> s >> p;
    char t[100000];
    for(int i = 0; i < n; i++){
        cin >> t[i];
    }
    long pts = 0;
    for(int i = 0; i < n; i++){
        if(t[i] == "r")pts += r;
        if(t[i] == "s")pts += s;
        if(t[i] == "p")pts += p;
    }
    
    for(int i = 0; i < n; i++){
        for(int j = i + k; j < n; j += k){
            if(t[i] == t[j]){
                if(t[i] == "r")pts -= r;
                if(t[i] == "s")pts -= s;
                if(t[i] == "p")pts -= p;
            }
        }
    }
    cout << pts << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   18 |         if(t[i] == "r")pts += r;
      |            ~~~~~^~~~~~
a.cc:19:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   19 |         if(t[i] == "s")pts += s;
      |            ~~~~~^~~~~~
a.cc:20:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   20 |         if(t[i] == "p")pts += p;
      |            ~~~~~^~~~~~
a.cc:26:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   26 |                 if(t[i] == "r")pts -= r;
      |                    ~~~~~^~~~~~
a.cc:27:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   27 |                 if(t[i] == "s")pts -= s;
      |                    ~~~~~^~~~~~
a.cc:28:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   28 |                 if(t[i] == "p")pts -= p;
      |                    ~~~~~^~~~~~
Language: C++

#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>
#include<limits>
#include<bitset>
#include<functional>
#include<type_traits>
#include<queue>
#include<stack>
#include<array>
#include<random>
#include<utility>
#include<cstdlib>
#include<ctime>

#include<string>
    
using namespace std;
int n, k, r, s, p;
string t;
string group[1000000][1000000]
void main() {
    cin << n << k;
    cin << r << s << p;
    cin << t;
    int res = n % k;
    int war = n / k;
    for ( int i = 0; i< k; ++i) {
        for (int j =0; j < war; j++) {
            group[i][j] = string[k * j + i];
        }
    }
    for (int i = 0; k-i> k - res; i ++) {
        group[k-i][war] = string[k * war + k-i];
    }
    int r_num[k], s_num[k], p_num[k];
    for (int i = 0; i < k;i++) {
        r_num[i] = 0;
        s_num[i] = 0;
        p_num[i] = 0;
        for(int j=0; j< war;j++) {
            if(group[i][j] == "r") r_num[i]++;
            if(group[i][j] == "s") s_num[i]++;
            if(group[i][j] == "p") p_num[i]++;
        }
        for (int i = 0; k-i> k - res; i ++) {
            if(group[k-i][war] == "r") r_num[i]++;
            if(group[k-i][war] == "s") s_num[i]++;
            if(group[k-i][war] == "p") p_num[i]++;
        }
        if (r_num[i] > 0) r_num[i]--;
        if (s_num[i] > 0) s_num[i]--;
        if (p_num[i] > 0) p_num[i]--;
    }
    int r_re=0;
    int s_re = 0;
    int p_re = 0;
    for (int i =0; i < k; i++) {
        r_re += r_num[i];
        s_re += s_num[i];
        p_re += p_num[i];
    }
    int min = 0;
    min += r_re * p;
    min += s_re * r;
    min += p_re * s;
    int plu = 0;
    for (int i =0; i < n; i++) {
        if(sting[i] == "r") plu += p;
        if(sting[i] == "s") plu += r;
        if(sting[i] == "p") plu += s;
    }
    cout << plu - min << endl;

}

Compiler output:
a.cc:26:1: error: expected initializer before 'void'
   26 | void main() {
      | ^~~~
Language: C++

#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>
#include<limits>
#include<bitset>
#include<functional>
#include<type_traits>
#include<queue>
#include<stack>
#include<array>
#include<random>
#include<utility>
#include<cstdlib>
#include<ctime>

#include<string>
    
using namespace std;
int n, k, r, s, p;
string t;
string group[1000000][1000000]
int main() {
    cin << n << k;
    cin << r << s << p;
    cin << t;
    int res = n % k;
    int war = n / k;
    for ( int i = 0; i< k; ++i) {
        for (int j =0; j < war; j++) {
            group[i][j] = string[k * j + i];
        }
    }
    for (int i = 0; k-i> k - res; i ++) {
        group[k-i][war] = string[k * war + k-i];
    }
    int r_num[k], s_num[k], p_num[k];
    for (int i = 0; i < k;i++) {
        r_num[i] = 0;
        s_num[i] = 0;
        p_num[i] = 0;
        for(int j=0; j< war;j++) {
            if(group[i][j] == "r") r_num[i]++;
            if(group[i][j] == "s") s_num[i]++;
            if(group[i][j] == "p") p_num[i]++;
        }
        for (int i = 0; k-i> k - res; i ++) {
            if(group[k-i][war] == "r") r_num[i]++;
            if(group[k-i][war] == "s") s_num[i]++;
            if(group[k-i][war] == "p") p_num[i]++;
        }
        if (r_num[i] > 0) r_num[i]--;
        if (s_num[i] > 0) s_num[i]--;
        if (p_num[i] > 0) p_num[i]--;
    }
    int r_re=0;
    int s_re = 0;
    int p_re = 0;
    for (int i =0; i < k; i++) {
        r_re += r_num[i];
        s_re += s_num[i];
        p_re += p_num[i];
    }
    int min = 0;
    min += r_re * p;
    min += s_re * r;
    min += p_re * s;
    int plu = 0;
    for (int i =0; i < n; i++) {
        if(sting[i] == "r") plu += p;
        if(sting[i] == "s") plu += r;
        if(sting[i] == "p") plu += s;
    }
    cout << plu - min << endl;

}

Compiler output:
a.cc:26:1: error: expected initializer before 'int'
   26 | int main() {
      | ^~~