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

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

int main() {
  int N,K;
  cin >> N >> K;
  
  int R, S, P;
  cin >> R >> S >> P;
  
  int map<char, int> Point;
  Point['s'] = R;
  Point['p'] = S;
  Point['r'] = P;
  
  string T;
  cin >> T;
  
  int ans = 0;
  for (int i = 0; i < K; i++) {
    ans += Point[T[i]];
  }
  for (int i = K; i < N; i++) {
    if (T[i] != T[i-K]) {
    ans += Point[T[i]];
    }
  }
    
       
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:22: error: invalid declarator before 'Point'
   11 |   int map<char, int> Point;
      |                      ^~~~~
a.cc:12:3: error: 'Point' was not declared in this scope
   12 |   Point['s'] = R;
      |   ^~~~~
Language: C++

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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define range(a) a.begin(), a.end()
#define endl "\n"
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
const unsigned long long mod = 1e9 + 7;
const long long INF = 1LL<<60;
void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }

int main(void){
	ios::sync_with_stdio(0);
	cin.tie(0);
	ull N,K;		cin>>N>>K;
	ull R,S,P;		cin>>R>>S>>P;
	string str;		cin>>str;
	//0:r 1:s 2:p
	ull sum=0;
	
	FOR(i,0,K){
		if(str[i]=="r")	sum+=P;
		else if(str[i]=="s")	sum+=R;
		else if(str[i]=="p")	sum+=S;
	}
	FOR(i,K,N){
		if(str[i]!=str[i-K]){
			if(str[i]=="r")	sum+=P;
			else if(str[i]=="s")	sum+=R;
			else if(str[i]=="p")	sum+=S;
		}
		else	str[i]="a";
	}
	
	cout<<sum<<endl;

    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:28:26: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   28 |                 if(str[i]=="r") sum+=P;
a.cc:29:31: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   29 |                 else if(str[i]=="s")    sum+=R;
a.cc:30:31: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   30 |                 else if(str[i]=="p")    sum+=S;
a.cc:34:34: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   34 |                         if(str[i]=="r") sum+=P;
a.cc:35:39: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   35 |                         else if(str[i]=="s")    sum+=R;
a.cc:36:39: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   36 |                         else if(str[i]=="p")    sum+=S;
a.cc:38:32: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive]
   38 |                 else    str[i]="a";
      |                                ^~~
      |                                |
      |                                const char*
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;
  for(int i = 0; i < t.size(); i++){
    cin >> t.at(i);
  }
  vector<int>ra;
  vector<int>sa;
  vector<int>pa;
  for(int i = 0; i < t.size(); i++){
    if(t.at(i) == 'r'){
      ra.push_back(i);
    }
   if(t.at(i) =='s'){
      sa.push_back(i);
    }
   if(t.at(i) == 'p'){
      pa.push_back(i);
   }
  }
  int ans = 0;
  ans += R * ra.size();
    ans += S * sa.size();
    ans += P * pa.size();
    int countr;
  for(int i = 0; i < ra.size() - k;i++){
    if(ra.at(i) == ra.at(i + k)){
      countr++;
    }
  }
  ans-=(countr - (countr + 2)/2) * R;
   int counts;
  for(int i = 0; i < sa.size() - k;i++){
    if(sa.at(i) == sa.at(i + k)){
      counts++;
    }
  }
  ans-=(counts - (counts + 2)/2) * S;
   int countp;
  for(int i = 0; i < pa.size() - k;i++){
    if(pa.at(i) == pa.at(i + k){
      countp++;
    }
  }
  ans-=(countp - (countp + 2)/2) * P;
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:34: error: 'k' was not declared in this scope
   30 |   for(int i = 0; i < ra.size() - k;i++){
      |                                  ^
a.cc:37:34: error: 'k' was not declared in this scope
   37 |   for(int i = 0; i < sa.size() - k;i++){
      |                                  ^
a.cc:44:34: error: 'k' was not declared in this scope
   44 |   for(int i = 0; i < pa.size() - k;i++){
      |                                  ^
a.cc:45:32: error: expected ')' before '{' token
   45 |     if(pa.at(i) == pa.at(i + k){
      |       ~                        ^
      |                                )
a.cc:48:3: error: expected primary-expression before '}' token
   48 |   }
      |   ^
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;
  for(int i = 0; i < t.size(); i++){
    cin >> t.at(i);
  }
  vector<int>ra;
  vector<int>sa;
  vector<int>pa;
  for(int i = 0; i < t.size(); i++){
    if(t.at(i) == 'r'){
      ra.push_back(i);
    }
   if(t.at(i) =='s'){
      sa.push_back(i);
    }
   if(t.at(i) == 'p'){
      pa.push_back(i);
   }
  }
  int ans = 0;
  ans += R * ra.size()
    ans += S * sa.size()
    ans += P * pa.size()
    int countr;
  for(int i = 0; i < ra.aize();i++){
    if(ra.at(i) == ra.at(i + 2)){
      countr++;
    }
  }
  ans-=(countr - (countr + 2)/2) * R;
   int counts;
  for(int i = 0; i < sa.aize();i++){
    if(sa.at(i) == sa.at(i + 2)){
      counts++;
    }
  }
  ans-=(counts - (counts + 2)/2) * S;
   int countp;
  for(int i = 0; i < pa.aize();i++){
    if(pa.at(i) == pa.at(i + 2)){
      countp++;
    }
  }
  ans-=(countp - (countp + 2)/2) * R;
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:23: error: expected ';' before 'ans'
   26 |   ans += R * ra.size()
      |                       ^
      |                       ;
   27 |     ans += S * sa.size()
      |     ~~~                
a.cc:30:25: error: 'class std::vector<int>' has no member named 'aize'; did you mean 'size'?
   30 |   for(int i = 0; i < ra.aize();i++){
      |                         ^~~~
      |                         size
a.cc:32:7: error: 'countr' was not declared in this scope
   32 |       countr++;
      |       ^~~~~~
a.cc:35:9: error: 'countr' was not declared in this scope
   35 |   ans-=(countr - (countr + 2)/2) * R;
      |         ^~~~~~
a.cc:37:25: error: 'class std::vector<int>' has no member named 'aize'; did you mean 'size'?
   37 |   for(int i = 0; i < sa.aize();i++){
      |                         ^~~~
      |                         size
a.cc:44:25: error: 'class std::vector<int>' has no member named 'aize'; did you mean 'size'?
   44 |   for(int i = 0; i < pa.aize();i++){
      |                         ^~~~
      |                         size
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
  int N;
  cin>>N;
  
  vector <int> counter;
  
  vector<int> A;
  vector<int> B;
  vector<int> AtB;
  
  for(int i=0;i<N;i++)
  {
      int Temp1,Temp2;
      
      cin>>Temp1>>Temp2;
      
      A.push_back(Temp1);
      B.push_back(Temp2);
      AtB.push_back(Temp1);
      AtB.push_back(Temp2);
  }
  
 
  
  for(int i=0;i<N*N*2*2-1;i++)
  {
      int Enter=AtB[i].first;
      int Exit=AtB[i].second;
      int Counter=0;
      
      for(int j=0;j<30;j++)
      {
          int a=A[j];
          int b=B[j];
          
          if(Enter<=a&&Exit<=b)
          {
              Counter+=(b-Enter+b-Exit);
          }
          else if(Enter>=a&&Exit<=b)
          {
              Counter+=(Enter-a+(b-a)+b-Exit);
          }
          else if(Enter>=a&&Exit>=b)
          {
              Counter+=(Enter-a+Exit-a);
          }
          else
          {
              Counter+=Exit-enter;
          }
      }
      
      counter.push_back(Counter);
      
      
  }
  
  sort(counter.begin(),counter.end());
  
  cout<<counter[0];
}
  
  
 

Compiler output:
a.cc: In function 'int main()':
a.cc:30:24: error: request for member 'first' in 'AtB.std::vector<int>::operator[](((std::vector<int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   30 |       int Enter=AtB[i].first;
      |                        ^~~~~
a.cc:31:23: error: request for member 'second' in 'AtB.std::vector<int>::operator[](((std::vector<int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   31 |       int Exit=AtB[i].second;
      |                       ^~~~~~
a.cc:53:29: error: 'enter' was not declared in this scope; did you mean 'Enter'?
   53 |               Counter+=Exit-enter;
      |                             ^~~~~
      |                             Enter
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
int N,K,R,S,P;
  string T;
  cin>>N>>K>>R>>S>>P>>T;
  vector<bool>t(N,false);
  for(int i=0;i<K;i++){
  t[i]=true;
  }int sum=0;
  for(int i=0;i<K;i++)
    if(T[i]=='r')
      sum+=P;
  else if(T[i]=='s')
    sum+=R;
  else
    sum+=P;
  map<char,int>M; M['s']=R; M['p']=S; M['r']=P;
  for(int i=K;i<N;i++){
  if(T.at(i)==T.at(i-K)){
   if(!t[i-K]){sum+=M.at(s.at(i)); t[i]=true;}
  }else{
  sum+=M.at(s.at(i)); t[i]=true;
  
  }
    
  
  }cout<<sum<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:26: error: 's' was not declared in this scope
   21 |    if(!t[i-K]){sum+=M.at(s.at(i)); t[i]=true;}
      |                          ^
a.cc:23:13: error: 's' was not declared in this scope
   23 |   sum+=M.at(s.at(i)); t[i]=true;
      |             ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
int N,K,R,S,P;
  string T;
  cin>>N>>K>>R>>S>>P>>T;
  vector<bool>t(N,false);
  for(int i=0;i<K;i++){
  t[i]=true;
  }int sum=0;
  for(int i=0;i<K;i++)
    if(T[i]=='r')
      sum+=P;
  else if(T[i]=='s')
    sum+=R;
  else
    sum+=P;
  map<char,int>M; M['s']=R; M['p']=S; M['r']=P;
  for(int i=K;i<N;i++){
  if(s.at(i)==s.at(i-K)){
   if(!t[i-K]){sum+=M.at(s.at(i)); t[i]=true;}
  }else{
  sum+=M.at(s.at(i)); t[i]=true;
  
  }
    
  
  }cout<<sum<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:6: error: 's' was not declared in this scope
   20 |   if(s.at(i)==s.at(i-K)){
      |      ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define pi acos(-1.0)
//cout << fixed << setprecision(8) << a << endl;
//cout << "Case " << ca << ": " << ans << endl;
#define Fast_Input ios_base :: sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
#define MX 100001
#define infinity 20000000
#define pb push_back
#define ll long long int
int main()
{
    int n,k,i;
    cin >> n >> k;
    int r,s,p;
    cin >> r >> s >> p;
    string si;
    cin >> si;
    string z="";
    map < char,char>m;
    map < char,int>mi;
    m['r']='p';
    m['p']='s';
    m['s']='r';
    mi['r']=r;
    mi['p']=p;
    mi['s']=s;
    ll sum=0;
    for(i=0; i<n; i++)
    {
        if(i<k)
        {
            char u;
            u=m[si[i]];
            z+=u;
            sum+=mi[u];
        }

        else
        {
            char u;
            u=m[si[i]];
            if(z[i-k]==u)
            {
                if((f+k)<n)
                {
                    char f=m[si[i+k]];
                    if(f!='r' && u!='r')
                        z+='r';
                    else if(f!='s' && u!='s')
                        z+='s';
                    else 
                        z+='p';
                }
                
                else 
                    z+=si[i];
            }

            else
            {
                z+=u;
                sum+=mi[u];
            }
        }
    }
    cout << sum<< endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:45:21: error: 'f' was not declared in this scope
   45 |                 if((f+k)<n)
      |                     ^
a.cc:47:26: error: redeclaration of 'char f'
   47 |                     char f=m[si[i+k]];
      |                          ^
a.cc:45:21: note: '<typeprefixerror>f' previously declared here
   45 |                 if((f+k)<n)
      |                     ^
Language: C++

#include <iostream>
#include <math.h>
#include <algorithm>
#include <queue>
#include <map>
#include <list>
//#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for (int i = (a), i##formax = (b); i < i##formax; i++)
typedef long long ll;

int main()
{
    int n, k;
    int r, s, p;
    char pre = 'a';
    map<char, int> dic{{'r', 2}, {'s', 0}, {'p', 1}};
    vector<int> cnt(3);
    string t;
    bool flag = true;
    cin >> n >> k >> r >> s >> p >> s;
    FOR(i, 0, n)
    {
        if (i >= k)
        {
            if (t[i - k] == t[i])
            {
                t[i] = 'a';
            }
            else { cnt[dic[t[i]]]++; }
        }
        else { cnt[dic[t[i]]]++; }
        ll score = cnt[0] * r + cnt[1] * s + cnt[2] * p;
        cout << score << endl;
        return 0;
    }

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

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define FOR(i,l,r) for(i=l;i<r;i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define P pair<ll,ll>
#define F first
#define S second
signed main(){
  ll N,K,R,S,P,i,ans=0;string T,X;
  cin>>N>>K>>R>>S>>P>>T;
  REP(i,N){
    if(i<K||T[i]!=T[i-K]){
      if(T[i]=='r')ans+=P;
      if(T[i]=='s')ans+=R;
      if(T[i]=='p')ans+=S;
    }
    else T[i]=='O';
  }
  cout<<ans<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:15: error: invalid declarator before ',' token
   11 |   ll N,K,R,S,P,i,ans=0;string T,X;
      |               ^
a.cc:12:21: error: expected primary-expression before '>>' token
   12 |   cin>>N>>K>>R>>S>>P>>T;
      |                     ^~
a.cc:15:26: error: expected primary-expression before ';' token
   15 |       if(T[i]=='r')ans+=P;
      |                          ^
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(a) sort(a.begin(), a.end())
const int INF = 1<<30;
const ll MOD = 1000000007;

// int win(int a) {
//     if (a == 0) return p;
//     else if (a == 1) return r;
//     else return s;
// }

int main(void) {

    int n, k; cin >> n >> k;
    vi rsp(3); rep(i, 3) cin >> rsp[i];
    string t; cin >> t;
    vector<vi> T(k);
    rep(i, t.size()) {
        if (t[i] == 'r') T[i%k].push_back(0);
        if (t[i] == 's') T[i%k].push_back(1);
        if (t[i] == 'p') T[i%k].push_back(2);
    }

    int ans = 0;
    rep (j, k) {
        int sum = 0, former = 1;
        sum += rsp[(T[j][0] + 2) % 3];
        // cout << sum << endl;

        for (int i = 1; i < T[j].size(); i++) {

            if (T[j][i-1] == T[j][i]) {
                if (former) {
                    former = 0;
                    // cout << sum << endl;
                    continue;
                }
                else {
                    sum += rsp[(T[j][i]+2) % 3];
                    former = 1;
                }
            }
            else {
                sum += rsp[(T[j][i]+2) % 3];
                former = 1;
            }
        // }cout << sum << endl;
        ans += sum;
        // cout << endl;
    }
    
    cout << ans << endl;


    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:67:2: error: expected '}' at end of input
   67 | }
      |  ^
a.cc:23:16: note: to match this '{'
   23 | int main(void) {
      |                ^
Language: C++

#D
n, k = map(int(), input().split())
r, s, p = map(int(), input().split())
t = list(input())
# g=r点 t=s点 p=p点
ans = 0
for i in range(n):
    if t[i] == "r":
        if i >= k and t[i - k] == "r":
            t[i] = 'm'#iの手以外の手
        else:
            ans += p
    if t[i] == "t":
        if i >= k and t[i - k] == "t":
            t[i] = 'm'
        else:
            ans += r
    if t[i] == "p":
        if i >= k and t[i - k] == "p":
            t[i] = 'm'
        else:
            ans += s
print(ans)

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #D
    1 | #D
      |  ^
a.cc:5:3: error: invalid preprocessing directive #g
    5 | # g=r点 t=s点 p=p点
      |   ^
a.cc:10:23: error: stray '#' in program
   10 |             t[i] = 'm'#iの手以外の手
      |                       ^
a.cc:2:1: error: 'n' does not name a type
    2 | n, k = map(int(), input().split())
      | ^
Language: C++

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

int main(){
  int a,b,x,y,z;
  cin>>a>>b>>x>>y>>z;
  string c;
  cin>>c;
  for(int i=0;i<a-b;i++){
  if(c.at(i)==c.at(i+b)){
  c.at(i+b)='f';
  }
  }
  int sum=0;
  for(int j=0;j<a;j++){
  if(c.at(j)=='r'){
  sum+=z;
  }
  if(c.at(j)=='s'){
  sum+=x;
  }
  if(c.at(j)=='p'){
  sum+=y;
  }
  }
  cout<<sum<<endl;


Compiler output:
a.cc: In function 'int main()':
a.cc:26:19: error: expected '}' at end of input
   26 |   cout<<sum<<endl;
      |                   ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

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

int main(){
  int a,b,x,y,z;
  cin>>a>>b>>x>>y>>z;
  string c;
  for(int i=0;i<c.size()-b;i++){
  if(c.at(i)==c.at(i+b)){
  c.at(i+b)='f';
  }
  }
  int sum=0
  for(int j=0;j<c.size();j++){
  if(c.at(j)=='r'){
  sum+=x;
  }
  if(c.at(j)=='g'){
  sum+=y;
  }
 if(c.at(j)=='b'){
 sum+=z;
 }
  }
  cout<<sum<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:3: error: expected ',' or ';' before 'for'
   14 |   for(int j=0;j<c.size();j++){
      |   ^~~
a.cc:14:15: error: 'j' was not declared in this scope
   14 |   for(int j=0;j<c.size();j++){
      |               ^
Language: C++

#pragma region
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define repc(i, m, n) for (int i = m; i < n; i++)
#define reprc(i, m, n) for (int i = m; i > n; i--)
#define all(v) v.begin(), v.end()
#define INF 1e9
#define EPS 1e-10
using namespace std;
typedef long long ll;
#pragma endregion

int main()
{
  int N,K,R,S,P;
  string T;
  cin >> N >> K >> R >> S >> P >> T;
  char B[K+10];

  // long total = 0;
  // for(int i=0; i<N; ++i){
  //   if(B[i%K]!=T[i]){
  //     if(T[i]=='r')
  //       total += P;
  //     else if(T[i]=='s')
  //       total += R;
  //     else if(T[i]=='p')
  //       total += S;
  //     B[i%K] = T[i];
  //   }
  //   else{
  //     B[i%K] = ' ';
  //   }
    
  // }
  long ans = 0;
  for(int i=0; i<N; ++i){
    if(i>=K && T[i] == T[i-K]){
      T[i] = 'q';
    }
    else{
      if(T[i]=='r') ans += P;
      else if(T[i]=='s') ans += R;
      else ans += S;
    }
  }

  cout << ans << endl;

  return 0;
}

    
    /*
    int N,K,R,S,P;
    ll ans = 0;
    string T;
    cin >> N >> K;
    cin >> R >> S >> P;
    cin >> T;
    vector<int> score(N);

    rep(i, N){
        if(T.at(i) == 'r') score.at(i) = P;
        if(T.at(i) == 's') score.at(i) = R;
        if(T.at(i) == 'p') score.at(i) = S;

        if(i >= K && score.at(i) == score.at(i - K)){
            score.at(i) = 0;
        }
    }

    rep(i, N){
        ans += score.at(i);
    }

    cout << ans << endl;
    */
}

Compiler output:
a.cc:81:1: error: expected declaration before '}' token
   81 | }
      | ^
Language: C++

#include<iostream>
#include<algorithm>
#include<string>

int const MAXN = 1e5;
int N, K, R, S, P;
std::string T, RSP = "rsp";
int iRSP[256];
int sRSP[3];
inline bool win(int c, int d) { return (c-d+3)%3 == 1; }

// greedy
int calc(int n) {
  int c = (iRSP[T[n]]+2)%3;
  int res = sRSP[c];
  while(n+K < N) {
    n += K;
    int newc = (iRSP[T[n]]+2)%3;
    if(c != newc) {
      res += sRSP[c];
      c = newc;
    } else c = -1;
  }
  return  = res;
}

int main() {
  std::cin >> N >> K >> R >> S >> P >> T;
  sRSP[0] = R; sRSP[1] = S; sRSP[2] = P;
  iRSP['r'] = 0; iRSP['s'] = 1; iRSP['p'] = 2;
  std::fill_n(dp[0], MAXN*3, -1);
  int ans = 0;
  for(int i = 0; i < K; ++i) ans += calc(i);
  std::cout << ans << std::endl;
  return 0;
}


Compiler output:
a.cc: In function 'int calc(int)':
a.cc:24:11: error: expected primary-expression before '=' token
   24 |   return  = res;
      |           ^
a.cc: In function 'int main()':
a.cc:31:15: error: 'dp' was not declared in this scope
   31 |   std::fill_n(dp[0], MAXN*3, -1);
      |               ^~
Language: C++

import java.util.*;

class Main{
    public static void main(String[] args){
        
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int K = sc.nextInt();
        int R = sc.nextInt();
        int S = sc.nextInt();
        int P = sc.nextInt();
        String T = sc.next();
        long sum = 0;

        for(int i=0; i<N; i++){
            if(i<=K-1){
                if(T.charAt(i)=='r'){
                    sum += P;
                }
                else if(T.charAt(i)=='s'){
                    sum += R;
                }
                else{
                    sum += S;
                }
            }
            else{
                if(T.charAt(i)!=T.charAt(i-K)){
                    if(T.charAt(i)=='r'){
                        sum += P;
                    }
                    else if(T.charAt(i)=='s'){
                        sum += R;
                    }
                    else{
                        sum += S;
                    }
                }
                else{
                    T=T.substring(0, i) + "a" + T.substring(i + 1);
                }
            }
        }
        System.out.println(sum);
    }
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:11: error: expected ':' before 'static'
    4 |     public static void main(String[] args){
      |           ^~~~~~~
      |           :
a.cc:4:29: error: 'String' has not been declared
    4 |     public static void main(String[] args){
      |                             ^~~~~~
a.cc:4:38: error: expected ',' or '...' before 'args'
    4 |     public static void main(String[] args){
      |                                      ^~~~
a.cc:47:2: error: expected ';' after class definition
   47 | }
      |  ^
      |  ;
a.cc: In static member function 'static void Main::main(int*)':
a.cc:6:9: error: 'Scanner' was not declared in this scope
    6 |         Scanner sc = new Scanner(System.in);
      |         ^~~~~~~
a.cc:8:17: error: 'sc' was not declared in this scope
    8 |         int N = sc.nextInt();
      |                 ^~
a.cc:13:9: error: 'String' was not declared in this scope
   13 |         String T = sc.next();
      |         ^~~~~~
a.cc:18:20: error: 'T' was not declared in this scope
   18 |                 if(T.charAt(i)=='r'){
      |                    ^
a.cc:29:20: error: 'T' was not declared in this scope
   29 |                 if(T.charAt(i)!=T.charAt(i-K)){
      |                    ^
a.cc:45:9: error: 'System' was not declared in this scope
   45 |         System.out.println(sum);
      |         ^~~~~~
Language: C++

#include <iostream>
#include <queue>
using namespace std;
int main(){
	int n,k;
	int r,s,p;
	string t;
	cin>>n>>k;
	cin>>r>>s>>p;
	cin>>t;
	int ans=0;
	inr dp[100000][3]={};
	for(int i=0;i<k;i++){
		int now=i;
		if(t[now]=='r'){
			dp[now][2]=p;
		}else if(t[now]=='s'){
			dp[now][0]=r;
		}else{
			dp[now][1]=s;
		}
		now+=k;
		while(now<n){
			if(t[now]=='r'){
				dp[now][0]=max(dp[now-k][1],dp[now-k][2]);
				dp[now][1]=max(dp[now-k][0],dp[now-k][2]);
				dp[now][2]=max(dp[now-k][0]+p,dp[now-k][1]+p);
			}else if(t[now]=='s'){
				dp[now][0]=max(dp[now-k][1]+r,dp[now-k][2]+r);
				dp[now][1]=max(dp[now-k][0],dp[now-k][2]);
				dp[now][2]=max(dp[now-k][0],dp[now-k][1]);
			}else{
				dp[now][0]=max(dp[now-k][1],dp[now-k][2]);
				dp[now][1]=max(dp[now-k][0]+s,dp[now-k][2]+s);
				dp[now][2]=max(dp[now-k][0],dp[now-k][1]);
			}
			now+=k;
		}
		ans+=max(dp[now-k][0],max(dp[now-k][1],dp[now-k][2]));
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'inr' was not declared in this scope; did you mean 'int'?
   12 |         inr dp[100000][3]={};
      |         ^~~
      |         int
a.cc:16:25: error: 'dp' was not declared in this scope; did you mean 'p'?
   16 |                         dp[now][2]=p;
      |                         ^~
      |                         p
a.cc:18:25: error: 'dp' was not declared in this scope; did you mean 'p'?
   18 |                         dp[now][0]=r;
      |                         ^~
      |                         p
a.cc:20:25: error: 'dp' was not declared in this scope; did you mean 'p'?
   20 |                         dp[now][1]=s;
      |                         ^~
      |                         p
a.cc:25:33: error: 'dp' was not declared in this scope; did you mean 'p'?
   25 |                                 dp[now][0]=max(dp[now-k][1],dp[now-k][2]);
      |                                 ^~
      |                                 p
a.cc:29:33: error: 'dp' was not declared in this scope; did you mean 'p'?
   29 |                                 dp[now][0]=max(dp[now-k][1]+r,dp[now-k][2]+r);
      |                                 ^~
      |                                 p
a.cc:33:33: error: 'dp' was not declared in this scope; did you mean 'p'?
   33 |                                 dp[now][0]=max(dp[now-k][1],dp[now-k][2]);
      |                                 ^~
      |                                 p
a.cc:39:26: error: 'dp' was not declared in this scope; did you mean 'p'?
   39 |                 ans+=max(dp[now-k][0],max(dp[now-k][1],dp[now-k][2]));
      |                          ^~
      |                          p
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;
    
  char a[n];
  long long score = 0;
  
  for (int i = 0; i < n; i++) {
    a[i] = t.charAt[i];
    
    if (i < k or a[i] != a[i-k]) {
      switch (a[i]) {
        case 'r':
          score += p;
          break;
        case 's':
          score += r;
          break;
        case 'p':
          score += s;
          break;
        default:
          score += 0;
          break;
      }
      
    } else if (a[i] == a[i-k]) {
      a[i] = 'x';
    }
  }
  cout << score << endl;
}
        
          

Compiler output:
a.cc: In function 'int main()':
a.cc:16:14: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'charAt'
   16 |     a[i] = t.charAt[i];
      |              ^~~~~~
Language: Java

import java.util.Scanner;

public class AssignD {
    private static final int MOD = 1_000_000_007;
    private static final String YES = "Yes";
    private static final String NO = "No";

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int K = sc.nextInt();
        int R = sc.nextInt();
        int S = sc.nextInt();
        int P = sc.nextInt();
        String T = sc.next();

        System.out.println(solve(N, K, R, S, P, T));
    }

    private static int solve(int N, int K, int R, int S, int P, String T) {
        int[][] score = new int[N+1][3];

        for (int i=0; i<N; i++) {
            char ch = T.charAt(i);

            if (i < K) {
                score[i+1][0] = max(score[i]) + toScore(R, S, P, ch, 'r');
                score[i+1][1] = max(score[i]) + toScore(R, S, P, ch, 's');
                score[i+1][2] = max(score[i]) + toScore(R, S, P, ch, 'p');
            } else {
                score[i+1][0] = max(score[i]) - max(score[i+1-K]) + Math.max(score[i+1-K][1], score[i+1-K][2]) + toScore(R, S, P, ch, 'r');
                score[i+1][1] = max(score[i]) - max(score[i+1-K])+ Math.max(score[i+1-K][2], score[i+1-K][0]) + toScore(R, S, P, ch, 's');
                score[i+1][2] = max(score[i]) - max(score[i+1-K]) + Math.max(score[i+1-K][0], score[i+1-K][1]) + toScore(R, S, P, ch, 'p');
            }

            // System.err.println((i+1) + ": " + score[i+1][0] + ", " + score[i+1][1] + ", " + score[i+1][2]);
        }

        return max(score[N]);
    }

    private static int toScore(int R, int S, int P, char t, char s) {
        if (t == 'r' && s == 'p') return P;
        if (t == 'p' && s == 's') return S;
        if (t == 's' && s == 'r') return R;

        return 0;
    }

    private static int max(int[] array) {
        int max = array[0];
        for (int i=1; i<array.length; i++) {
            max = Math.max(max, array[i]);
        }

        return max;
    }
}

Compiler output:
Main.java:3: error: class AssignD is public, should be declared in a file named AssignD.java
public class AssignD {
       ^
1 error
Language: C++

#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
using ll = long long;

int main(){
  int n, k, r, s, p;
  cin >> n >> k >> r >> s >> p;  
  string t;
  cin >> t;
  vector<int> result(n);
  int ans = 0;
  rep(i,k){
    result[i] = 1;
    if(t[i] == 'r') ans += p;
    else if(t[i] == 's') ans += r;
    else ans += s;
  }
  for(int i = k; i < n; i++){
    if(t[i-k] != t[i] || !result[i-k]){
      if(t[i] == 'r') ans += p;
      else if(t[i] == 's') ans += r;
      else ans += s;
      result[i] = 1;
    }
  }
  cout << ans << endl;
}
  

  #include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
using ll = long long;

int main(){
  int n, k, r, s, p;
  cin >> n >> k >> r >> s >> p;  
  string t;
  cin >> t;
  vector<int> result(n);
  int ans = 0;
  rep(i,k){
    result[i] = 1;
    if(t[i] == 'r') ans += p;
    else if(t[i] == 's') ans += r;
    else ans += s;
  }
  for(int i = k; i < n; i++){
    if(t[i-k] != t[i] || !result[i-k]){
      if(t[i] == 'r') ans += p;
      else if(t[i] == 's') ans += r;
      else ans += s;
      result[i] = 1;
    }
  }
  cout << ans << endl;
}
  

  

Compiler output:
a.cc:36:5: error: redefinition of 'int main()'
   36 | int main(){
      |     ^~~~
a.cc:6:5: note: 'int main()' previously defined here
    6 | int main(){
      |     ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll =long long;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(i) i.begin(),i.end()
template<typename T=ll>
using v =vector<T>;
template<typename T=ll>
using vv = vector<v<T>>;
//using p = pair<ll,ll>;
const ll INF = (ll)1e9;
template<typename T> T chmin(T &a,T b){a=min(a,b);}
template<typename T> T chmax(T &a,T b){a=max(a,b);}
ll n,k;
ll r,s,p;//r:g,s:c,p:p
string t;
int main(){
    cin >> n >> k;
    cin >> r >> s >> p;
    cin >> t;
	t = '#'+t;
  	ll ans =0;
\ 	for(ll i=1;i<=n;i++){
    	if(t[max(0LL,i-k)]==t[i]) t[i]=-1;
      	if(t[i]=='r') ans+=p;
    	else if(t[i] == 's') ans+=r;
      	else if(t[i] == 'p') ans +=s;
    }
  	cout << ans << endl;
  	return 0;
}

Compiler output:
a.cc:23:1: error: stray '\' in program
   23 | \       for(ll i=1;i<=n;i++){
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
char st[101011];
int main()
{
	int n,k,r,s,p,i,ans=0,ss=0;
	string t;
	cin>>n>>k;
	cin>>r>>s>>p;
	cin>>t;
	int len=t.size();
	for(i=0;i<len;i++)
	{
		if(ss>=k) 
		{
			if(t[i]=='s'&&st[ss-k]=='r')
			{
				if(t>)
				st[ss++]='s';
				continue;
			}
			
			else if(t[i]=='r'&&st[ss-k]=='p')
			{
				st[ss++]='r';
				continue;
			}
			else if(t[i]=='p'&&st[ss-k]=='s')
			{
				st[ss++]='p';
				continue;
			}
		}
		if(t[i]=='s'){
			st[ss++]='r';
			ans+=r;
		} 
		else if(t[i]=='p'){
			st[ss++]='s'; 
			ans+=s;
		}
		else if(t[i]=='r'){
			st[ss++]='p';
			ans+=p;
		} 
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:38: error: expected primary-expression before ')' token
   18 |                                 if(t>)
      |                                      ^
Language: C++

 #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#include <iomanip>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << endl
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
int dx8[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy8[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int dx4[4] = {1, 0, -1, 0};
int dy4[4] = {0, 1, 0, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){ fill((T*)array, (T*)(array+N), val); }
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;
int main(void) {
    int N,K,R,S,P;
    string T;

    cin >> N >> K >> R >> S >> P;
    cin >> T;
    int dp[100100][3];
    int value[3] = {R,S,P};
    int t[N];
    //0:R,1;S,2:Pとする
    //勝てる手リストを作る
    rep(i,N){
        if(T[i] == 'r') t[i]=2;
        if(T[i] == 's') t[i]=0;
        if(T[i] == 'p') t[i]=1;
    }
    
    //modKで分割して考える
    rep(i,K){
        //グループのスタート、0から始まる、1から始まる,.....,K-1から始まる
        dp[i][t[i]] = value[t[i]];//グループごとの初期値、分割したので最初は何の制限もないので買っておいて損はない
        for (int j = i+K; j < N; j+=K){
        //ここはグループごと
        //modKで分割したのでK個ごとに更新
            rep(l,3){
                if(t[j] == l){//もしkが勝てる手だったら
                    //K個とびの更新なので注意,ここで(l+1)%3、(l+2)%3としてK個前と同じ手は出さないという制約を守っている
                    dp[j][l] = max(dp[j-K][(l+1)%3],dp[j-K][(l+2)%3])+value[l];
                }else{
                    dp[j][l] = max(dp[j-K][(l+1)%3],dp[j-K][(l+2)%3]);
                }
            }
        }
        
    }
    int ans = 0;
    rrep(i,K){
        ans += max(d[N-i][0],d[N-i][1],d[N-i][2]);
    }
    fin(ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:96:20: error: 'd' was not declared in this scope
   96 |         ans += max(d[N-i][0],d[N-i][1],d[N-i][2]);
      |                    ^
Language: C++

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

int main(){
  ll n,k,r,s,p,sum=0;
  string t;
  cin>>n>>k>>r>>s>>p>>t;
  for(int i=0; i<t.size(); i++){
    if(i>=k && t[i]==t[i-k]) t[i] = '0'
    if(t[i]=='r') sum += p;
    if(t[i]=='s') sum += r;
    if(t[i]=='p') sum += s;
  }
  cout<<sum;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:40: error: expected ';' before 'if'
   10 |     if(i>=k && t[i]==t[i-k]) t[i] = '0'
      |                                        ^
      |                                        ;
   11 |     if(t[i]=='r') sum += p;
      |     ~~
Language: C++

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

map<char,char> mp;
bool vis[200005];
int main()
{
   int n,k,r,si,p;
   cin >> n >> k;
   cin >> r >> si >> p;
   mp['r'] = p;
   mp['s'] = r;
   mp['p'] = si;

    string s;
    cin >> s;
    ll ans = 0;
    for(int i = 0; i < n;i++){
        if(vis[i])
            continue;
        if(i+k < n){
            if(s[i] != s[i+k]){
                ans += mp[s[i]]+mp[s[i+k]];
                vis[i] = vis[i+k] = 1;
            }

            else{
                vis[i+k] = 1;
                vis[i] = 1;
                ans += mp[s[i]];
            }
        }
        else{
            vis[i] = 1;
            ans += mp[s[i]];
        }#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

map<char,int> mp;
bool vis[200005];
int main()
{
   int n,k,r,si,p;
   cin >> n >> k;
   cin >> r >> si >> p;
   mp['r'] = p;
   mp['s'] = r;
   mp['p'] = si;


    string s;
    cin >> s;
    ll ans = 0;
    for(int i = 0; i < n;i++){
        if(vis[i])
            continue;
        if(i < k){
            ans += mp[s[i]],vis[i] = 1;
        }
        else {
            if(mp[s[i]] != mp[s[i-k]]){
                ans += mp[s[i]],vis[i] = 1;
            }
            else{
                if(!vis[i-k])
                    vis[i] = 1,ans += mp[s[i]];
            }
        }
    }

    cout << ans << endl;

}

    }

    cout << ans << endl;

}


Compiler output:
a.cc:38:10: error: stray '#' in program
   38 |         }#include <bits/stdc++.h>
      |          ^
a.cc: In function 'int main()':
a.cc:38:11: error: 'include' was not declared in this scope
   38 |         }#include <bits/stdc++.h>
      |           ^~~~~~~
a.cc:38:20: error: 'bits' was not declared in this scope
   38 |         }#include <bits/stdc++.h>
      |                    ^~~~
a.cc:38:25: error: 'stdc' was not declared in this scope; did you mean 'std'?
   38 |         }#include <bits/stdc++.h>
      |                         ^~~~
      |                         std
a.cc:40:1: error: expected primary-expression before 'using'
   40 | using namespace std;
      | ^~~~~
a.cc:45:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   45 | int main()
      |         ^~
a.cc:45:9: note: remove parentheses to default-initialize a variable
   45 | int main()
      |         ^~
      |         --
a.cc:45:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:46:1: error: a function-definition is not allowed here before '{' token
   46 | {
      | ^
Language: Java


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class ABC149D {
    static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    } 
    public static void main(String[] args) throws IOException {
        FastReader br=new FastReader();
        String[] t=br.nextLine().split("\\ ");
        int N=Integer.parseInt(t[0]);
        int K=Integer.parseInt(t[1]);
        t=br.nextLine().split("\\ ");
        int R=Integer.parseInt(t[0]);
        int S=Integer.parseInt(t[1]);
        int P=Integer.parseInt(t[2]);
        
        //0=R, 1=S, 2=P
        String moves=br.nextLine();
        String[] cc=new String[K]; Arrays.fill(cc,"");
        for(int i=0;i<N;i++){
            cc[i%K]+=moves.charAt(i);
        }
        
        int greedy=0;
        for(int i=0;i<K;i++){
            if(cc[i].charAt(0)=='r')greedy+=P;
            else if(cc[i].charAt(0)=='s')greedy+=R;
            else if(cc[i].charAt(0)=='p')greedy+=S;
            boolean used=true;
            for(int j=0;j<cc[i].length()-1;j++){
                if(cc[i].charAt(j+1)!=cc[i].charAt(j)){
                    
                        if(cc[i].charAt(j+1)=='r')greedy+=P;
                        else if(cc[i].charAt(j+1)=='s')greedy+=R;
                        else if(cc[i].charAt(j+1)=='p')greedy+=S;
                        used=true;
                }else if(used){
                    used=false;
                }else{
                    if(cc[i].charAt(j+1)=='r')greedy+=P;
                    else if(cc[i].charAt(j+1)=='s')greedy+=R;
                    else if(cc[i].charAt(j+1)=='p')greedy+=S;
                    used=true;
                }
            }   
            
        }
        System.out.println(greedy);
    }
    
}


Compiler output:
Main.java:7: error: class ABC149D is public, should be declared in a file named ABC149D.java
public class ABC149D {
       ^
1 error
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
int mod;
int po(int a,int b){
    int res=1;
    while(b!=0){
        if(b&1){
            res*=a;
            res%=mod;
        }
        a*=a;
        a%=mod;
        b/=2;
    }
    return res;
}
int inv(int a){
    return po(a,mod-2);
}
int32_t main(){
    int n,k;
  	cin>>n>>k;
  int r,s,p;
  cin>>r>>s>>p;
  string t;
  cin>>t;
 	 int s=0;
  string v="";
  map<char,int> mp;
  mp['r']=p;
  mp['p']=s;
  mp['s']=r;
  for(int i=0;i<t.size();++i){
    if(k>0){
      k--;
      v+='a';
      s+=mp[t[i]];
    }else{
      if(t[i]==t[i-k] && v[i-k]=='a'){
        	v+='b';
      }else{
        v+='a';
		s+=mp[t[i]];     	
      }
    }
  }
  cout<<s;
    return 0;
}


Compiler output:
a.cc: In function 'int32_t main()':
a.cc:28:14: error: redeclaration of 'long long int s'
   28 |          int s=0;
      |              ^
a.cc:24:9: note: 'long long int s' previously declared here
   24 |   int r,s,p;
      |         ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
int mod;
int po(int a,int b){
    int res=1;
    while(b!=0){
        if(b&1){
            res*=a;
            res%=mod;
        }
        a*=a;
        a%=mod;
        b/=2;
    }
    return res;
}
int inv(int a){
    return po(a,mod-2);
}
int32_t main(){
    int n,k;
  	cin>>n>>k;
  int r,s,p;
  cin>>r>>s>>p;
  string t;
  cin>>t;
 	 int s=0;
  string v="";
  map<char,int> mp;
  mp['r']=p;
  mp['p']=s;
  mp['s']=r;
  for(int i=0;i<t.size();++i){
    if(k>0){
      k--;
      v+='a';
      s+=mp[t[i]];
    }else{
      if(s[i]==s[i-k] && v[i-k]=='a'){
        	v+='b';
      }else{
        v+='a';
		s+=mp[t[i]];     	
      }
    }
  }
  cout<<s;
    return 0;
}

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:28:14: error: redeclaration of 'long long int s'
   28 |          int s=0;
      |              ^
a.cc:24:9: note: 'long long int s' previously declared here
   24 |   int r,s,p;
      |         ^
a.cc:40:11: error: invalid types 'long long int[long long int]' for array subscript
   40 |       if(s[i]==s[i-k] && v[i-k]=='a'){
      |           ^
a.cc:40:17: error: invalid types 'long long int[long long int]' for array subscript
   40 |       if(s[i]==s[i-k] && v[i-k]=='a'){
      |                 ^
Language: C++

from itertools import groupby as gb
n,k,g,t,p,s=map(lambda v:v if v[0] in "rsp" else int(v),open(0).read().split())
r,ss,pa=0,0,0
l=[""]*k
for x,i in enumerate(list(s)):
  if l[x%k]==i:l[x%k]="";continue
  if i=="r":pa+=1
  elif i=="s":r+=1
  else:ss+=1
  l[x%k]=i
print(r*g+ss*t+pa*p)

Compiler output:
a.cc:1:1: error: 'from' does not name a type
    1 | from itertools import groupby as gb
      | ^~~~
a.cc:6:26: error: expected unqualified-id before 'continue'
    6 |   if l[x%k]==i:l[x%k]="";continue
      |                          ^~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
 
#define FOR(n) for(int i=0;i<n;i++)
#define ll long long
 
using namespace std;
int main()
{ int n,k,r,s,p;int sum=0;char l[100001];
 cin>>n>>k;
 cin>>r>>s>>p;
 char t[100001];
 cin>>t;
 map<char,char> g;
 g.insert({'s','r'});
 g.insert({'r','p'});
 g.insert({'p','s'});
 map<char,int> g1;
 g1.insert({'s',s});
 g1.insert({'r',r});
 g1.insert({'p',p});
 
FOR(n)
{if(i<k)
{l[i]=g[t[i]];
  sum+=g1[g[t[i]]];}
 else
 {if(l[i-k]==g[t[i]])
 {l[i]=" ";
   sum=sum+0;}
  else
  { l[i]=g[t[i]];
    sum+=g1[g[t[i]]];}
  
 }
 
 
 }
 
 
 
 
cout<<sum;
 
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:8: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   29 |  {l[i]=" ";
      |        ^~~
      |        |
      |        const char*
Language: C++

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

int main()
{
  int n,k,r,s,p,i,res;
  string t;
  map<char,int>m;
  
  cin>>n>>k;
  cin>>r>>s>>p;
  cin>>t;
  
  m['r']=p;
  m['s']=r;
  m['p']=s;
  
  vector<int>v(n,-1);
  for(i=k;i<n;++i)
  {
    if(t[i]==t[i-k])
    {
      if(v[i-k]==-1)
      {
        v[i-k]=m[t[i]];
        v[i]=0;
      }
      else
      v[i]=m[t[i]];  
    }
    else
    {
      if(v[i-k]==-1)
      v[i-k]=m[t[i-k]];
      
      v[i]=m[t[i]];
    }
  }
  
  res=0;
  for(i=0;<n;++i)
  res+=v[i];
  
  cout<<res;
  
  return 0; 
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:43:11: error: expected primary-expression before '<' token
   43 |   for(i=0;<n;++i)
      |           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
	int n, k, r, s, p, t;
	string o;
  	cin >> n >> k >> r >> s >> p >> t >> o;
  	int dp[n][3];
  	dp[0][0] = dp[0][1] = dp[0][2] = 0;
  	for (int i = 0; i < n; i++) {
    	for (int j = 0; j < 3; j++) {
        	if (i < k) {
            	dp[i][j] = (i > 0 ? max(max(dp[i-1][0], dp[i-1][1]), dp[i-1][2]) : 0);
              	if (j == 0 && o[i] == 's' dp[i][j] += r;
                if (j == 1 && o[i] == 'p') dp[i][j] += s;
                if (j == 2 && o[i] == 'r') dp[i][j] += p;
            }
          	else {
            	if (j == 0) dp[i][j] = max(dp[i-1][1], dp[i-1][2]);
              	if (j == 1) dp[i][j] = max(dp[i-1][0], dp[i-1][2]);
              	if (j == 2) dp[i][j] = max(dp[i-1][0], dp[i-1][1]);
              	if (j == 0 && o[i] == 's' dp[i][j] += r;
                if (j == 1 && o[i] == 'p') dp[i][j] += s;
                if (j == 2 && o[i] == 'r') dp[i][j] += p;
            }
        }
    }
    cout << max(max(dp[n-1][0], dp[n-1][1]), dp[n-1][2]) << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:42: error: expected ';' before 'dp'
   13 |                 if (j == 0 && o[i] == 's' dp[i][j] += r;
      |                                          ^~~
      |                                          ;
a.cc:14:17: error: expected primary-expression before 'if'
   14 |                 if (j == 1 && o[i] == 'p') dp[i][j] += s;
      |                 ^~
a.cc:13:57: error: expected ')' before 'if'
   13 |                 if (j == 0 && o[i] == 's' dp[i][j] += r;
      |                    ~                                    ^
      |                                                         )
   14 |                 if (j == 1 && o[i] == 'p') dp[i][j] += s;
      |                 ~~                                       
a.cc:21:42: error: expected ';' before 'dp'
   21 |                 if (j == 0 && o[i] == 's' dp[i][j] += r;
      |                                          ^~~
      |                                          ;
a.cc:22:17: error: expected primary-expression before 'if'
   22 |                 if (j == 1 && o[i] == 'p') dp[i][j] += s;
      |                 ^~
a.cc:21:57: error: expected ')' before 'if'
   21 |                 if (j == 0 && o[i] == 's' dp[i][j] += r;
      |                    ~                                    ^
      |                                                         )
   22 |                 if (j == 1 && o[i] == 'p') dp[i][j] += s;
      |                 ~~