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

#include <stdio.h>

int main(){
    int n, k, r, s, p;
    scanf("%d%d%d%d%d", &n,&k,&r,&s,%p);
    char t[n];
    scanf("%s", t);

    int score = 0;
    for(int i = 0; i < k; i++){
        if(t[i] == 'r') score += r;
        else if(t[i] == 's') score += s;
        else if(t[i] == 'p')  score += p;
    }
    for(int i = k; i < n; i++){
        if((t[i] == 'r') && (t[i-k]!='r')) score += r;
        else if((t[i] == 's') && (t[i-k]!='s')) score += s;
        else if((t[i] == 'p') && (t[i-k]!='p')) score += p;
    }
    printf("%d", score);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:37: error: expected primary-expression before '%' token
    5 |     scanf("%d%d%d%d%d", &n,&k,&r,&s,%p);
      |                                     ^
Language: C

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

int count(char *a,char *b,int n);

int main(){
  int n,k;
  int r,s,p;
  int i,rn,sn,pn;
  char t[100000];
  
  scanf("%d %d",&n,&k);
  scanf("%d %d %d",&r,&s,&p);
  scanf("%s",t);
  
  rn = count(t,"r",k);
  sn = count(t,"s",k);
  pn = count(t,"p",k);
  
  for(i=k;i<n;i++){
    if(strcmp(&t[i],"r")==0){
      if(strcmp(&t[i-k],"r")==0){
        rn++;
      }else{
        pn++;
      }
    }else if(strcmp(&t[i],"s")==0){
      if(strcmp(&t[i-k],"s")==0){
        sn++;
      }else{
        rn++;
      }
    }else if(strcmp(&t[i],"p")==0){
      if(strcmp(&t[i-k],"p")==0){
        pn++;
      }else{
        sn++;
      }
    }
  }
  printf("%ld",r*rb+s*sn+p*pn);
    
  return 0;
}
    
int count(char a,char b,int n){
  int i,s=0;
  for(i=0;i<n;i++0){
    if(strcmp(&a[i],b)==0)
      s++;
  }
  return s;
}
  
  


Compiler output:
main.c: In function 'main':
main.c:41:18: error: 'rb' undeclared (first use in this function); did you mean 'rn'?
   41 |   printf("%ld",r*rb+s*sn+p*pn);
      |                  ^~
      |                  rn
main.c:41:18: note: each undeclared identifier is reported only once for each function it appears in
main.c: At top level:
main.c:46:5: error: conflicting types for 'count'; have 'int(char,  char,  int)'
   46 | int count(char a,char b,int n){
      |     ^~~~~
main.c:4:5: note: previous declaration of 'count' with type 'int(char *, char *, int)'
    4 | int count(char *a,char *b,int n);
      |     ^~~~~
main.c: In function 'count':
main.c:48:18: error: expected ')' before numeric constant
   48 |   for(i=0;i<n;i++0){
      |      ~           ^
      |                  )
main.c:49:17: error: subscripted value is neither array nor pointer nor vector
   49 |     if(strcmp(&a[i],b)==0)
      |                 ^
main.c:49:21: error: passing argument 2 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   49 |     if(strcmp(&a[i],b)==0)
      |                     ^
      |                     |
      |                     char
In file included from main.c:2:
/usr/include/string.h:156:50: note: expected 'const char *' but argument is of type 'char'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                                      ~~~~~~~~~~~~^~~~
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-k]==" ")
 {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:28:29: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   28 |  {if(l[i-k]==g[t[i]]||l[i-k]==" ")
      |                       ~~~~~~^~~~~
a.cc:29:8: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   29 |  {l[i]=" ";
      |        ^~~
      |        |
      |        const char*
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;
 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)
{cin>>p[i];
  sum+=g1[g[t[i]]];}
 else
 {if(p[i-k]==g[t[i]])
    sum=sum+0;
  else
      sum+=g1[g[t[i]]];
 
 }
 
 
 }




cout<<sum;

return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:8: error: invalid types 'int[int]' for array subscript
   25 | {cin>>p[i];
      |        ^
a.cc:28:7: error: invalid types 'int[int]' for array subscript
   28 |  {if(p[i-k]==g[t[i]])
      |       ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define all(vec) vec.begin(), vec.end()
#define END return 0
typedef long long ll;
const int mod7 = 1e9 + 7;
const int mod9 = 1e9 + 9;
const int inf = 1 << 30;
const ll INF = 1LL << 60;
template<typename T> T gcd(T a, T b) {return b ? gcd(b, a%b) : abs(a);}
template<typename T> T lcm(T a, T b) {return a / gcd(a, b) * b;}
template<typename T> bool chmax(T &a, T b) {if (a < b) {a = b; return true;} return false;}
template<typename T> bool chmin(T &a, T b) {if (a > b) {a = b; return true;} return false;}
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) {fill((T*)array, (T*)(array+N), val);}

int n, k;
ll p[3], ans = 0;
string t, te = "rsp";
char log[inf];

int main() {
    cin >> n >> k;
    rep(i, 3) cin >> p[i];
    cin >> t;
    rep(i, k)
        rep(j, 3)
            if(t[i] == te[j]) {ans += p[(j + 2) % 3]; log[i] = te[(j + 2) % 3];}
    for(int i = k; i < n; i++)
        rep(j, 3)
            if(t[i] == te[j] && te[(j + 2) % 3] != log[i - k]){ans += p[(j + 2) % 3]; log[i] = te[(j + 2) % 3];}
    cout << ans << endl;
}

Compiler output:
a.cc:20:13: error: 'char log [1073741824]' redeclared as different kind of entity
   20 | char log[inf];
      |             ^
In file included from /usr/include/features.h:523,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
                 from /usr/include/c++/14/cassert:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33,
                 from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:122:1: note: previous declaration 'double log(double)'
  122 | __MATHCALL_VEC (log,, (_Mdouble_ __x));
      | ^~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:28:58: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   28 |             if(t[i] == te[j]) {ans += p[(j + 2) % 3]; log[i] = te[(j + 2) % 3];}
      |                                                          ^
a.cc:31:55: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   31 |             if(t[i] == te[j] && te[(j + 2) % 3] != log[i - k]){ans += p[(j + 2) % 3]; log[i] = te[(j + 2) % 3];}
      |                                                       ^
a.cc:31:90: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   31 |             if(t[i] == te[j] && te[(j + 2) % 3] != log[i - k]){ans += p[(j + 2) % 3]; log[i] = te[(j + 2) % 3];}
      |                                                                                          ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
int main() {
	ll n,k;
	cin>>n>>k;
  	ll r,s,p;
  	cin>>r>>s>>p;
  string t;
  string str;
  cin>>s; ll c=0;
  for(ll i=0;i<s.size();++i) {
  	if(i<k) {
    	if(s[i]=='r')  {str.pb('p'); c+=p; }
       	if(s[i]=='p') { str.pb('s'); c+=s; }
      	if(s[i]=='s') { str.pb('r'); c+=s; }
    }
    else {
      	if(s[i]=='r') { if(str[i-k]=='p') {str.pb('r');} else {str.pb('p'); c+=p;} }
      if(s[i]=='p') { if(str[i-k]=='s') {str.pb('p');} else { str.pb('s'); c+=s; } }
      if(s[i]=='s') { if(str[i-k]=='r') {str.pb('s');} else { str.pb('r'); c+=r; } }
    }
  }
  
    cout<<c;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:18: error: request for member 'size' in 's', which is of non-class type 'long long int'
   13 |   for(ll i=0;i<s.size();++i) {
      |                  ^~~~
a.cc:15:13: error: invalid types 'long long int[long long int]' for array subscript
   15 |         if(s[i]=='r')  {str.pb('p'); c+=p; }
      |             ^
a.cc:16:13: error: invalid types 'long long int[long long int]' for array subscript
   16 |         if(s[i]=='p') { str.pb('s'); c+=s; }
      |             ^
a.cc:17:13: error: invalid types 'long long int[long long int]' for array subscript
   17 |         if(s[i]=='s') { str.pb('r'); c+=s; }
      |             ^
a.cc:20:13: error: invalid types 'long long int[long long int]' for array subscript
   20 |         if(s[i]=='r') { if(str[i-k]=='p') {str.pb('r');} else {str.pb('p'); c+=p;} }
      |             ^
a.cc:21:11: error: invalid types 'long long int[long long int]' for array subscript
   21 |       if(s[i]=='p') { if(str[i-k]=='s') {str.pb('p');} else { str.pb('s'); c+=s; } }
      |           ^
a.cc:22:11: error: invalid types 'long long int[long long int]' for array subscript
   22 |       if(s[i]=='s') { if(str[i-k]=='r') {str.pb('s');} else { str.pb('r'); c+=r; } }
      |           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
 int N;
 int K;
 int R;
 int S;
 int P;
 cin >> N >> K;
 cin >> R >> S >> P;
string T;
 cin >> T;
  int i;
  int j;
  int count=0;
  int k;
for(i=0;i<K;i++){
    j=i;
    k=0;
    int sum[N][3]={0};
        if(T[j]=='r')sum[k][2]=P; 
        if(T[j]=='s')sum[k][0]=R;
        if(T[j]=='p')sum[k][1]=S;
        j+=K;
    while(j<N){
        k++;
        if(T[j]=='r')sum[k][2]=P+max(sum[k-1][0],sum[k-1][1]); 
        if(T[j]=='s')sum[k][0]=R+max(sum[k-1][2],sum[k-1][1]);
        if(T[j]=='p')sum[k][1]=S+max(sum[k-1][0],sum[k-1][2]);
        j+=K;}
    count += max(sum[k][0],sum[k][1],sum[k][2]);
}
   cout << count << endl;
  return 0;
}

Compiler output:
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:32:17:   required from here
   32 |     count += max(sum[k][0],sum[k][1],sum[k][2]);
      |              ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
Language: Java

class Main {
    public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int k = scanner.nextInt();
		
		int r = scanner.nextInt(); // グー
		int s = scanner.nextInt(); // チョキ
		int p = scanner.nextInt(); // パー
		
		String str = scanner.next();
		
		char[] b = new char[n];
		int sum = 0;
		for (int i = 0, c = 1; i < n; i++, c++) {
			char st = str.charAt(i);
			b[i] = st;
			if (c > k) {
				if (st == b[i - k]) {
					st = 0;
				}
			}
			switch (st) {
				case 'r':
					sum += p;
					break;
				case 's':
					sum += r;
					break;
				case 'p':
					sum += s;
					break;
				default:
			}
		}
		System.out.println(sum);
	}
}

Compiler output:
Main.java:3: error: cannot find symbol
		Scanner scanner = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:3: error: cannot find symbol
		Scanner scanner = new Scanner(System.in);
		                      ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: C++

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

int main(void)
{
  int n, k, r, s, p;
  char t[100001];
  int i;
  int score = 0;

  scanf("%d %d", &n, &k);
  scanf("%d %d %d", &r, &s, &p);
  scanf("%s", t);
  
  for(i = 0; i < n; i++) {
    if(strcmp(t[i], 'r') == 0) {
      score += r;
    } else if(strcmp(t[i], 's') == 0) {
      score += s;
    } else {
      score += p;
    }
  }  

  printf("%d\n", score);
}
  


Compiler output:
a.cc: In function 'int main()':
a.cc:16:18: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   16 |     if(strcmp(t[i], 'r') == 0) {
      |               ~~~^
      |                  |
      |                  char
In file included from a.cc:2:
/usr/include/string.h:156:32: note:   initializing argument 1 of 'int strcmp(const char*, const char*)'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                    ~~~~~~~~~~~~^~~~
a.cc:16:21: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   16 |     if(strcmp(t[i], 'r') == 0) {
      |                     ^~~
      |                     |
      |                     char
/usr/include/string.h:156:50: note:   initializing argument 2 of 'int strcmp(const char*, const char*)'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                                      ~~~~~~~~~~~~^~~~
a.cc:18:25: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   18 |     } else if(strcmp(t[i], 's') == 0) {
      |                      ~~~^
      |                         |
      |                         char
/usr/include/string.h:156:32: note:   initializing argument 1 of 'int strcmp(const char*, const char*)'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                    ~~~~~~~~~~~~^~~~
a.cc:18:28: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   18 |     } else if(strcmp(t[i], 's') == 0) {
      |                            ^~~
      |                            |
      |                            char
/usr/include/string.h:156:50: note:   initializing argument 2 of 'int strcmp(const char*, const char*)'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                                      ~~~~~~~~~~~~^~~~
Language: C++

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

int main(void)
{
  int n, k, r, s, p;
  char t[100001];
  int i;
  int score = 0;

  scanf("%d %d", &n, &k);
  scanf("%d %d %d", &r, &s, &p);
  scanf("%s", &t);
  
  for(i = 0; i < n; i++) {
    if(strcmp(t[i], 'r') == 0) {
      score += r;
    } else if(strcmp(t[i], 's') == 0) {
      score += s;
    } else {
      score += p;
    }
  }  

  printf("%d\n", score);
}
  


Compiler output:
a.cc: In function 'int main()':
a.cc:16:18: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   16 |     if(strcmp(t[i], 'r') == 0) {
      |               ~~~^
      |                  |
      |                  char
In file included from a.cc:2:
/usr/include/string.h:156:32: note:   initializing argument 1 of 'int strcmp(const char*, const char*)'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                    ~~~~~~~~~~~~^~~~
a.cc:16:21: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   16 |     if(strcmp(t[i], 'r') == 0) {
      |                     ^~~
      |                     |
      |                     char
/usr/include/string.h:156:50: note:   initializing argument 2 of 'int strcmp(const char*, const char*)'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                                      ~~~~~~~~~~~~^~~~
a.cc:18:25: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   18 |     } else if(strcmp(t[i], 's') == 0) {
      |                      ~~~^
      |                         |
      |                         char
/usr/include/string.h:156:32: note:   initializing argument 1 of 'int strcmp(const char*, const char*)'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                    ~~~~~~~~~~~~^~~~
a.cc:18:28: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   18 |     } else if(strcmp(t[i], 's') == 0) {
      |                            ^~~
      |                            |
      |                            char
/usr/include/string.h:156:50: note:   initializing argument 2 of 'int strcmp(const char*, const char*)'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                                      ~~~~~~~~~~~~^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define pi 3.14159265359
#define int long long
#define pii pair<int,int>
const int mod=1e9 + 7;
 
int dx[]={-1, 0, 1, 0};
int dy[]={0, -1, 0, 1};



int32_t main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
 
  #ifndef ONLINE_JUDGE
  freopen("input.txt", "rt", stdin);
  freopen("output.txt", "wt", stdout);
  #endif 

  
   int n, k, r, s, p;
  int res = 0;
  string t;
  cin >>n>>k>>r>>s>>p>>t;
  vector<int> scores(n);
  for(int i = 0; i < n; i++) {
    int score;
    switch(t[i]) {
      case 'r':
        score = p;
        break;
      case 's':
        score = r;
        break;
      case 'p':
        score = s;
        break;
    }
    if(i - k >= 0 && scores[i - k] != 0 && t[i] == t[i - k]) {
      score = 0;
    }
    scores[i] = score;
    res += (ll)score;
  }
  cout << res;

}

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:47:13: error: 'll' was not declared in this scope
   47 |     res += (ll)score;
      |             ^~
Language: C++

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

int main() {

	int N,K,R,S,P,score=0;
  string T;
  cin>>N>>K>>R>>S>>P>>T;
  map<char,int> es;
  es['r']=P;
  es['s']=R;
  es['p']=S;
  for(int i=0; i<N;i++)
  {
    if(i>=K){
      char a,b,c; 
      a=T.at(i-K); b=T.at(i);
          if(i+K<N){c=T.at(i+K);}
      　  if(a==b){T.at(i)='l';}
          else{score += es.at(b);}     
             }
    else{score+=es.at(T.at(i));}
   }
cout<<score<<endl;
}

Compiler output:
a.cc:19:7: error: extended character 　 is not valid in an identifier
   19 |       　  if(a==b){T.at(i)='l';}
      |       ^
a.cc: In function 'int main()':
a.cc:19:7: error: '\U00003000' was not declared in this scope
   19 |       　  if(a==b){T.at(i)='l';}
      |       ^~
a.cc:20:11: error: expected '}' before 'else'
   20 |           else{score += es.at(b);}
      |           ^~~~
a.cc:15:13: note: to match this '{'
   15 |     if(i>=K){
      |             ^
a.cc:20:31: error: 'b' was not declared in this scope
   20 |           else{score += es.at(b);}
      |                               ^
a.cc:22:5: error: 'else' without a previous 'if'
   22 |     else{score+=es.at(T.at(i));}
      |     ^~~~
a.cc:22:28: error: 'i' was not declared in this scope
   22 |     else{score+=es.at(T.at(i));}
      |                            ^
a.cc: At global scope:
a.cc:24:1: error: 'cout' does not name a type
   24 | cout<<score<<endl;
      | ^~~~
a.cc:25:1: error: expected declaration before '}' token
   25 | }
      | ^
Language: C++

#include<iostream>
using namespace std;
  
int main() {
  int n, k ,r, s, p;
  string t;
  cin >> n >> k >> r >> s >> p >> t;
  
  // total score
  int score = 0;
  
  for(int i=0; i<k; i++){
    char hand = t.at(i);
    char bef = 'o'; //other
    for(int j=0; i+j*k<n; j++){
      char hand = t.at(i+j*k);
      // 筐体がグーでk個前の手がパーでない
      if(hand=='r' && bef!='p'){
        score += p;
        bef = 'p'
      }
      // 筐体がチョキでk個前がグーでない
      else if(hand=='s' && bef!='r'){
        score += r;
        bef = 'r';
      }
      // 筐体がパーでk個前がチョキでない
      else if(hand=='p' && bef!='s'){
        score += s;
        bef = 's';
      }
      else{
        // 勝てないのであいこか負け，k個先でかぶらないように選ぶ
        bef = 'o';
      }
    }
  }
  
  cout << score << endl;
      
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:18: error: expected ';' before '}' token
   20 |         bef = 'p'
      |                  ^
      |                  ;
   21 |       }
      |       ~
Language: C++

#include<iostream>
#include<stream>
using namespace std;
  
int main() {
  int n, k ,r, s, p;
  string t;
  cin >> n >> k >> r >> s >> p >> t;
  
  // total score
  int score = 0;
  
  for(int i=0; i<k; i++){
    char hand = t.at(i);
    char bef = 'o'; //other
    for(int j=0; i+j*k<n; j++){
      char hand = t.at(i+j*k);
      // 筐体がグーでk個前の手がパーでない
      if(hand=='r' && bef!='p'){
        score += p;
        bef = 'p'
      }
      // 筐体がチョキでk個前がグーでない
      else if(hand=='s' && bef!='r'){
        score += r;
        bef = 'r';
      }
      // 筐体がパーでk個前がチョキでない
      else if(hand=='p' && bef!='s'){
        score += s;
        bef = 's';
      }
      else{
        // 勝てないのであいこか負け，k個先でかぶらないように選ぶ
        bef = 'o';
      }
    }
  }
  
  cout << score << endl;
      
  return 0;
}


Compiler output:
a.cc:2:9: fatal error: stream: No such file or directory
    2 | #include<stream>
      |         ^~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int plus(char a, int R, int S, int P){
  switch(a){
    case 'r':
      return P; 
    case 's':
      return R;
    case 'p':
      return S;
  }
}
 
int main(){
  long long N, K, R, S, P;
  string janken;
  cin >> N >> K;
  cin >> R >> S >> P;
  cin >> janken;
  long long score = 0;
  for(int i=0; i<N; i++){
    if(i >= K && janken[i] == janken[i-K]){
      continue;
    }
    score += plus(janken[i], R, S, P);
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:14: error: reference to 'plus' is ambiguous
   26 |     score += plus(janken[i], R, S, P);
      |              ^~~~
In file included from /usr/include/c++/14/string:49,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_function.h:160:12: note: candidates are: 'template<class _Tp> struct std::plus'
  160 |     struct plus;
      |            ^~~~
a.cc:4:5: note:                 'int plus(char, int, int, int)'
    4 | int plus(char a, int R, int S, int P){
      |     ^~~~
a.cc: In function 'int plus(char, int, int, int)':
a.cc:13:1: warning: control reaches end of non-void function [-Wreturn-type]
   13 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int plus(char a, int R, int S, int P){
  switch(a){
    case 'r':
      return P; 
    case 's':
      return R;
    case 'p':
      return S;
  }
}
 
int main(){
  long long N, K, R, S, P;
  string janken;
  cin >> N >> K;
  cin >> R >> S >> P;
  cin >> janken;
  score = 0
  for(int i=0; i<N; i++){
    if(i >= K && janken[i] == janken[i-K]){
      continue;
    }
    score += plus(janken[i], R, S, P);
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:3: error: 'score' was not declared in this scope
   21 |   score = 0
      |   ^~~~~
a.cc:22:16: error: 'i' was not declared in this scope
   22 |   for(int i=0; i<N; i++){
      |                ^
a.cc: In function 'int plus(char, int, int, int)':
a.cc:13:1: warning: control reaches end of non-void function [-Wreturn-type]
   13 | }
      | ^
Language: C++

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

int plus(char a, int R, int S, int P){
  switch(a){
    case 'r':
      return p; 
    case 's':
      return R;
    case 'P':
      return S;
  }
}
 
int main(){
  long long N, K, R, S, P;
  string janken;
  cin >> N >> K;
  cin >> R >> S >> P;
  cin >> janken;
  score = 0
  for(int i=0; i<N; i++){
    if(i >= K && janken[i] == janken[i-K]){
      continue;
    }
    score += plus(janken[i], R, S, P);
  }
}

Compiler output:
a.cc: In function 'int plus(char, int, int, int)':
a.cc:7:14: error: 'p' was not declared in this scope
    7 |       return p;
      |              ^
a.cc: In function 'int main()':
a.cc:21:3: error: 'score' was not declared in this scope
   21 |   score = 0
      |   ^~~~~
a.cc:22:16: error: 'i' was not declared in this scope
   22 |   for(int i=0; i<N; i++){
      |                ^
Language: C++

#include <bits/stdc++.h>
//For ordered_set
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define MOD 1000000007
#define test int t; cin>>t; while(t--)
#define init(arr,val) memset(arr,val,sizeof(arr))
#define loop(i,a,b) for(int i=a;i<b;i++)
#define loopr(i,a,b) for(int i=a;i>=b;i--)
#define loops(i,a,b,step) for(int i=a;i<b;i+=step)
#define looprs(i,a,b,step) for(int i=a;i>=b;i-=step)
#define ull unsigned long long int
#define ll long long int
#define P pair
#define PLL pair<long long, long long>
#define PII pair<int, int>
#define PUU pair<unsigned long long int, unsigned long long int>
#define L list
#define V vector
#define D deque
#define ST set
#define MS multiset
#define M map
#define UM unordered_map
#define mp make_pair
#define pb push_back
#define pf push_front
#define MM multimap
#define F first
#define S second
#define IT iterator
#define RIT reverse_iterator
#define FAST ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define FILE_READ_IN freopen("input.txt","r",stdin);
#define FILE_READ_OUT fr(eopen("output.txt","w",stdout);
#define all(a) a.begin(),a.end()
#define ld long double
using namespace std;
// For ordered_set
using namespace __gnu_pbds;
template <typename T>
using ord_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
const ll maxn = 1e5;
const ll inf = 1e9;
const double pi = acos(-1);
const int N = 1e5+10;
ll dp[N][3];
ll r,s,p;
int n,k;
string a;

int winner(char a){
    if(a == 'r')return 1;
    if(a == 'p')return 2;
    return 0;
}
ll cost(int a){
    if(a == 0)return r;
    if(a == 1)return p;
    return s;
}
int main(){
    cin >> n >> k;
    cin >> r >> s >> p;
    cin >> a;
    loop(i,0,k){
        if(i >= a.size())break;
        dp[i][winner(a[i])] += cost(winner(a[i]));
    }
    loop(i,k,n){
        dp[i][0] = max(dp[i-k][1],dp[i-k][2]);
        dp[i][1] = max(dp[i-k][0],dp[i-k][2]);
        dp[i][2] = max(dp[i-k][1],dp[i-k][0]);
        dp[i][winner(a[i])]+=cost(winner(a[i]));
    }
    ll ans = 0;
    loop(i,0,k){
        if(i >= a.size())break;
        auto o = dp[n-1-i];
        ans+=max(o[0],o[1],o[2]);
    }
    cout << ans << "\n";
   return 0;
}

Compiler output:
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = long long int; _Compare = long long int]':
a.cc:80:17:   required from here
   80 |         ans+=max(o[0],o[1],o[2]);
      |              ~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
Language: C++

#include <iostream>
using namespace std;

int point(char p,int r,int s,int p){
 if(p=="r"){
  return r;
 }else if(p=="s"){
  return s;
 }else if{
  return p;
 }
}

int main(void){
 int n,k,r,s,p;
 cin>>n>>k>>r>>s>>p;

 int count=0;
 int ans=0;
 char t[k][n/k+1];

for(int i=0;i<=n/k+1;i++){
 for(int j=0;j<k;j++){
  cin>>mine[i][j];
  if(mine[i][j]=="r"){
   mine[i][j]="p";
  }else if(mine[i][j]=="s"){
   mine[i][j]="r";
  }else if(mine[i][j]=="p"){
   mine[i][j]="s";
  }
 }
}

for(int i=0;i<k;i++){
 for(int j=0;j<=n/k+1;j++){
   if(j!=0&&mine[i][j-1]==mine[i][j]){

  }else if(j!=0&&mine[i][j-1]!=mine[i][j])){
   if(count%2==1){
    ans+=(point(mine[i][j-1],r,s,p))*(count/2+1);
    count=0;
   }else{
    ans+=(point(mine[i][j-1],r,s,p))*(count/2);
    count=0;   
   }
  }else{
   count++;
  }
 }
}

cout ans;

}


Compiler output:
a.cc:4:34: error: conflicting declaration 'int p'
    4 | int point(char p,int r,int s,int p){
      |                              ~~~~^
a.cc:4:16: note: previous declaration as 'char p'
    4 | int point(char p,int r,int s,int p){
      |           ~~~~~^
a.cc: In function 'int point(...)':
a.cc:5:6: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    5 |  if(p=="r"){
      |     ~^~~~~
a.cc:7:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    7 |  }else if(p=="s"){
      |           ~^~~~~
a.cc:9:10: error: expected '(' before '{' token
    9 |  }else if{
      |          ^
      |          (
a.cc: In function 'int main()':
a.cc:24:8: error: 'mine' was not declared in this scope
   24 |   cin>>mine[i][j];
      |        ^~~~
a.cc:37:13: error: 'mine' was not declared in this scope
   37 |    if(j!=0&&mine[i][j-1]==mine[i][j]){
      |             ^~~~
a.cc:39:43: error: expected primary-expression before ')' token
   39 |   }else if(j!=0&&mine[i][j-1]!=mine[i][j])){
      |                                           ^
a.cc:53:5: error: expected ';' before 'ans'
   53 | cout ans;
      |     ^~~~
      |     ;
a.cc: In function 'int point(...)':
a.cc:12:1: warning: control reaches end of non-void function [-Wreturn-type]
   12 | }
      | ^
Language: C++

#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <set>
#include <queue>
using namespace std;

int main() {
    int n, k;
    cin >> n >> k;
    queue<char> q;
    int r, s, p;
    cin >> r >> s >> p;
    string rt;
    cin >> rt;
    long long sum1 = 0, sum2 = 0;
    for (int i = 0; rt[i]; i++) {
        if (q.size() == k) {
            char pos = q.front();
            q.pop();
            if (rt[i] == 'r') {
                if (pos == 'p') {
                    q.push('r');
                }
                else {
                    sum1 += p;
                    q.push('p');
                }
            }
            if (rt[i] == 's') {
                if (pos == 'r') {
                    q.push('s');
                }
                else {
                    sum1 += r;
                    q.push('r');
                }
            }
            if (rt[i] == 'p') {
                if (pos == 's') {
                    q.push('p');
                }
                else {
                    sum1 += s;
                    q.push('s');
                }
            }
        }
        else {
            if (rt[i] == 'r') {
                sum1 += p;
                q.push('p');
            }
            if (rt[i] == 's') {
                sum1 += r;
                q.push('r');
            }
            if (rt[i] == 'p') {
                sum1 += s;
                q.push('s');
            }
        }
    }
    q.clear();
    for (int i = rt.size() - 1; i >= 0; i--) {
        if (q.size() == k) {
            char pos = q.front();
            q.pop();
            if (rt[i] == 'r') {
                if (pos == 'p') {
                    q.push('r');
                }
                else {
                    sum2 += p;
                    q.push('p');
                }
            }
            if (rt[i] == 's') {
                if (pos == 'r') {
                    q.push('s');
                }
                else {
                    sum2 += r;
                    q.push('r');
                }
            }
            if (rt[i] == 'p') {
                if (pos == 's') {
                    q.push('p');
                }
                else {
                    sum2 += s;
                    q.push('s');
                }
            }
        }
        else {
            if (rt[i] == 'r') {
                sum2 += p;
                q.push('p');
            }
            if (rt[i] == 's') {
                sum2 += r;
                q.push('r');
            }
            if (rt[i] == 'p') {
                sum1 += s;
                q.push('s');
            }
        }
    }
    cout << max(sum1, sum2) << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:66:7: error: 'class std::queue<char>' has no member named 'clear'
   66 |     q.clear();
      |       ^~~~~
Language: C

#include<stdio.h>
#include<string.h> 
 
int main(void){
  int n, k, r, s, p;
  int score = 0;
  char t[100000];
  scanf("%d %d", &n, &k);
  scanf("%d %d %d", &r, &s, &p);
  scanf("%s", t);
  
  for(int i=0; i < k; i++){
    if(!strcmp(&t[i], "r")){
      score = score + p;
    }else if(!strcmp(&t[i], "s")){
      score = score + r;
    }else if(!strcmp(&t[i], "p")){
      score = score + s;
    }
  }
  
  for(int i = k; i < n; i ++){
    prev[0] = t[i-k];
    if(strcmp(&t[i], &prev[0])){
      if(!strcmp(&t[i], "r")){
        score = score + p;
      }else if(!strcmp(&t[i], "s")){
        score = score + r;
      }else if(!strcmp(&t[i], "p")){
        score = score + s;
      }
    }
  }
  printf("%d", score);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:23:5: error: 'prev' undeclared (first use in this function)
   23 |     prev[0] = t[i-k];
      |     ^~~~
main.c:23:5: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
#include<string.h> 
 
int main(void){
  int n, k, r, s, p;
  int score = 0;
  char t[100000];
  scanf("%d %d", &n, &k);
  scanf("%d %d %d", &r, &s, &p);
  scanf("%s", t);
  
  for(int i=0; i < k; i++){
    if(!strcmp(&t[i], "r")){
      score = score + p;
    }else if(!strcmp(&t[i], "s")){
      score = score + r;
    }else if(!strcmp(&t[i], "p")){
      score = score + s;
    }
  }
  
  for(int i = k; i < n; i ++){
    prev[0] = t[i-k];
    if(strcmp(t[i], prev[0])){
      if(!strcmp(&t[i], "r")){
        score = score + p;
      }else if(!strcmp(&t[i], "s")){
        score = score + r;
      }else if(!strcmp(&t[i], "p")){
        score = score + s;
      }
    }
  }
  printf("%d", score);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:23:5: error: 'prev' undeclared (first use in this function)
   23 |     prev[0] = t[i-k];
      |     ^~~~
main.c:23:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:24:16: error: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   24 |     if(strcmp(t[i], prev[0])){
      |               ~^~~
      |                |
      |                char
In file included from main.c:2:
/usr/include/string.h:156:32: note: expected 'const char *' but argument is of type 'char'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                    ~~~~~~~~~~~~^~~~
Language: C++

from sys import stdin
input = stdin.readline


n, k = map(int, input().split())

r, s, p = map(int, input().split())

t = list(map(str, input().strip().split()[0]))
ans = 0
mp = {'r': p, 'p': s, 's': r}


for i, x in enumerate(t):
    if i >= k and t[i-k] == x:
        t[i] = 'o'
    else:
        ans += mp[x]

print(ans)


Compiler output:
a.cc:1:1: error: 'from' does not name a type
    1 | from sys import stdin
      | ^~~~
a.cc:14:1: error: expected unqualified-id before 'for'
   14 | for i, x in enumerate(t):
      | ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main() {
  long long int f,n,r,p,s,k,ans = 0;
  string s1;
  cin >> n >> k >> r >> s >> p;
  cin >> s;
  for (int i =0; i < s1.size(); i++) {
    if (s1[i] == 'r') f = p;
    if (s1[i] == 'p') f = s;
    if (s1[i] == 's') f = r;
    if(i >= k && s1[i-k] == s1[i]){
      f = 0;
      s1[i] = '0';
    }
    ans += f;
    cout << ans << "\n";
   return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
int main() {
  long long int f,n,r,p,s,k,ans = 0;
  string s;
  cin >> n >> k >> r >> s >> p;
  cin >> s;
  for (int i =0; i < s.size(); i++) {
    if (s[i] == 'r') f = p;
    if (s[i] == 'p') f = s;
    if (s[i] == 's') f = r;
    if(i >= k && s[i-k] == s[i]){
      f = 0;
      s[i] = '0';
    }
    ans += f;
    cout << ans << "\n";
   return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:10: error: conflicting declaration 'std::string s'
    5 |   string s;
      |          ^
a.cc:4:25: note: previous declaration as 'long long int s'
    4 |   long long int f,n,r,p,s,k,ans = 0;
      |                         ^
a.cc:8:24: error: request for member 'size' in 's', which is of non-class type 'long long int'
    8 |   for (int i =0; i < s.size(); i++) {
      |                        ^~~~
a.cc:9:10: error: invalid types 'long long int[int]' for array subscript
    9 |     if (s[i] == 'r') f = p;
      |          ^
a.cc:10:10: error: invalid types 'long long int[int]' for array subscript
   10 |     if (s[i] == 'p') f = s;
      |          ^
a.cc:11:10: error: invalid types 'long long int[int]' for array subscript
   11 |     if (s[i] == 's') f = r;
      |          ^
a.cc:12:19: error: invalid types 'long long int[long long int]' for array subscript
   12 |     if(i >= k && s[i-k] == s[i]){
      |                   ^
a.cc:12:29: error: invalid types 'long long int[int]' for array subscript
   12 |     if(i >= k && s[i-k] == s[i]){
      |                             ^
a.cc:14:8: error: invalid types 'long long int[int]' for array subscript
   14 |       s[i] = '0';
      |        ^
a.cc:19:2: error: expected '}' at end of input
   19 | }
      |  ^
a.cc:3:12: note: to match this '{'
    3 | int main() {
      |            ^
Language: C

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

long int R,S,P;

long int point(char s){
  switch(s){
    case 'r':
      return P;
      break;
    case 's':
      return R;
      break;
    case 'p':
      return S;
      break;
  }
}

int main(void){
  char str[100000];
  long int K,N,i,j,k,sum;
  int flag=0;
  
  fgets(str,sizeof(str),stdin);
  N=atoi(strtok(str," "));
  K=atoi(strtok(NULL," "));
  fgets(str,sizeof(str),stdin);
  R=atoi(strtok(str," "));
  S=atoi(strtok(NULL," "));
  P=atoi(strtok(NULL," "));
  fgets(str,sizeof(str),stdin));
  
  sum=0;
  for(i=0;i<K;i++){
    sum+=point(str[i]);
    for(j=1;i+j*K<N;j++){
      if(str[i+j*K]!=str[i+(j-1)*K]){
        sum+=point(str[i+j*K]);
        flag=0;
      }else{
        if(flag==0){
          flag=1;
        }else{
          sum+=point(str[i+j*K]);
          flag=0;
        }
      }
    }
  }
  printf("%Ld\n",sum);
  return 0;
}
      
  

Compiler output:
main.c: In function 'main':
main.c:34:31: error: expected ';' before ')' token
   34 |   fgets(str,sizeof(str),stdin));
      |                               ^
      |                               ;
main.c:34:31: error: expected statement before ')' token
Language: C

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

long int R,S,P;

long int point(char s){
  switch(s){
    case 'r':
      return P;
      break;
    case 's':
      return R;
      break;
    case 'p':
      return S;
      break;
  }
}

int main(void){
  char str[100000];
  long int K,N,i,j,k,sum;
  int flag=0;
  
  fgets(str,sizeof(str),stdin);
  N=atoi(strtok(str," "));
  K=atoi(strtok(NULL," "));
  fgets(str,sizeof(str),stdin);
  R=atoi(strtok(str," "));
  S=atoi(strtok(NULL," "));
  P=atoi(strtok(NULL," "));
  fgets(str,sizeof(str),stdin));
  
  sum=0;
  for(i=0;i<K;i++){
    sum+=point(str[i]);
    for(j=1;i+j*K<N;j++){
      if(str[i+j*K]!=str[i+(j-1)*K]){
        sum+=point(str[i+j*K]);
        flag=0;
      }else{
        if(flag==0){
          flag=1;
        }else{
          sum+=point(str[i+j*K]);
          flag=0;
        }
      }
    }
  }
  printf("%d\n",sum);
  return 0;
}
      
  

Compiler output:
main.c: In function 'main':
main.c:34:31: error: expected ';' before ')' token
   34 |   fgets(str,sizeof(str),stdin));
      |                               ^
      |                               ;
main.c:34:31: error: expected statement before ')' token
Language: C

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

long int R,S,P;

long int point(char s,){
  switch(s){
    case 'r':
      return P;
      break;
    case 's':
      return R;
      break;
    case 'p':
      return S;
      break;
  }
}

int main(void){
  char str[100000];
  long int K,N,i,j,k,sum;
  int flag=0;
  
  fgets(str,sizeof(str),stdin);
  N=atoi(strtok(str," "));
  K=atoi(strtok(NULL," "));
  fgets(str,sizeof(str),stdin);
  R=atoi(strtok(str," "));
  S=atoi(strtok(NULL," "));
  P=atoi(strtok(NULL," "));
  fgets(str,sizeof(str),stdin));
  
  sum=0;
  for(i=0;i<K;i++){
    sum+=point(str[i]);
    for(j=1;i+j*K<N;j++){
      if(str[i+j*K]!=str[i+(j-1)*K]){
        sum+=point(str[i+j*K]);
        flag=0;
      }else{
        if(flgg==0){
          flag=1;
        }else{
          sum+=point(str[i+j*K]);
          flag=0;
        }
      }
    }
  }
  printf("%Ld\n",sum);
  return 0;
}
      
  

Compiler output:
main.c:8:23: error: expected declaration specifiers or '...' before ')' token
    8 | long int point(char s,){
      |                       ^
main.c: In function 'main':
main.c:34:31: error: expected ';' before ')' token
   34 |   fgets(str,sizeof(str),stdin));
      |                               ^
      |                               ;
main.c:34:31: error: expected statement before ')' token
main.c:38:10: error: implicit declaration of function 'point' [-Wimplicit-function-declaration]
   38 |     sum+=point(str[i]);
      |          ^~~~~
main.c:44:12: error: 'flgg' undeclared (first use in this function); did you mean 'flag'?
   44 |         if(flgg==0){
      |            ^~~~
      |            flag
main.c:44:12: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
int main(){
    int n,k;scanf("%d %d",&n,&k);
    int r,s,p;scanf("%d %d %d",&r,&s,&p);
    char t[200000];scanf("%s",t);

    int win_way[200000]={};
    for(int i=0;i<n;i++){
        if(t[i]=='r')win_way[i]=p;
        else if(t[i]=='s')win_way[i]=r;
        else win_way[i]=s;
    }
	
	//k回前と被っていたらあいこもしくは負けたことにする
    //必ず後の邪魔にならない手を出すことができる（できない？）
    for(int i=k;i<n;i++){
        if(win_way[i]==win_way[i-k]){
            win_way[i]=0;
        }
    }
  
    ull ans=0;
    for(int i=0;i<n;i++){
        ans+=win_way[i];
    }
    printf("%llu\n",ans);
  
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:22:5: error: unknown type name 'ull'
   22 |     ull ans=0;
      |     ^~~
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;
    bitset<100000> win;
    for(int i=0; i<N; i++){
        if(i<K || T[i-K] != T[i] || !win[i-K]) win[i] = 1;
    }
    int64_t ans = 0;
    for(int i=0; i<N; i++) if(win[i]){
        if(T[i] == 'r') ans += P;
        if(T[i] == 's') ans += R;
        if(T[i] == 'p') ans += S;
    }
    cout << ans << endl;
    return 0;
}
#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;
    bitset<100000> win;
    for(int i=0; i<N; i++){
        if(i<K || T[i-K] != T[i] || !win[i-K]) win[i] = 1;
    }
    int64_t ans = 0;
    for(int i=0; i<N; i++) if(win[i]){
        if(T[i] == 'r') ans += P;
        if(T[i] == 's') ans += R;
        if(T[i] == 'p') ans += S;
    }
    cout << ans << endl;
    return 0;
}
Submission Info

Compiler output:
a.cc:25:5: error: redefinition of 'int main()'
   25 | int main(){
      |     ^~~~
a.cc:4:5: note: 'int main()' previously defined here
    4 | int main(){
      |     ^~~~
a.cc:43:1: error: 'Submission' does not name a type
   43 | Submission Info
      | ^~~~~~~~~~
Language: C++

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

int main() {
    int n, k, r, s, p;
    string t;
    cin >> n >> k >> r >> s >> p >> t;
    int ans = 0;
    for (int i = 0; i < k; i++) {
        int dpr0 = 0;
        int dps0 = 0;
        int dpp0 = 0;
        for (int j = i; j < n; j += k) {
            int dpr1 = (t[j] == 's' ? r : 0) + max(dps0, dpp0);
            int dps1 = (t[j] == 'p' ? s : 0) + max(dpp0, dpr0);
            int dpp1 = (t[j] == 'r' ? p : 0) + max(dpr0, dps0);
            dpr0 = dpr1;
            dps0 = dps1;
            dpp0 = dpp1;
        }
        ans += max({dpr0, dps0, dpp0});
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:19: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
   23 |         ans += max({dpr0, dps0, dpp0});
      |                ~~~^~~~~~~~~~~~~~~~~~~~
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:1:
/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 n,k,r,s,p,i,ans;
string t,a;
int main()
{
	cin>>n>>k>>r>>s>>p;
	cin>>t;
	for(i=0;i<n;i++)
	{
		if(t[i]=='r'){ans+=p;a[i]='p';}
		if(t[i]=='s'){ans+=r;a[i]='r';}
		if(t[i]=='p'){ans+=s;a[i]='s';}
	}
	for(i=0;i<n;i++)
	{
		if(a[i]=='r')
		{
			if(a[i]==a[i-k])
			{ans-=r;
			if(a[i+k]=='p')a[i]='s';
			else a[i]='p';
			}
		}
		if(a[i]=='s')
		{
			if(a[i]==a[i-k]){
			ans-=s;
			if(a[i+k]=='r')a[i]='p';
			else a[i]='r';}
		}
		if(a[i]=='p')
		{
			if(a[i]==a[i-k])
			{
				ans-=p;
				if(a[i+k]=='s')a[i]='r';
				else a[i]='s';
			}
		}
	}
	cout<<ans;
	return 0;

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

#include<iostream>
using namespace std;
int main(){
  // taking n and k
  int n,k;
  cin >> n >> k;
  // taking points for r, p, s
  int r, p, s;
  cin >> r >> p >> s;
  // string by machine
  string s, t;
  cin >> s;
  t = s;
  long int res = 0;
  for (int i= 0; i < k ; i++){
  	if (s[i] == 'p') {
      t[i]='s';
      res += s;
    }
    else if (s[i] == 'r') {
      t[i]='p';
      res += p;
    }
    else {
      t[i]='r';
      res += r;
    }
  }
  // from k+1 th element onwards
  for (int i = k; i < n; i++){
  	if (s[i]==s[i-k] && s[i]!=t[i-k]) t[i] = s[i];
    else{

      if (s[i] == 'p') {
        t[i]='s';
        res += s;
      }
      else if (s[i] == 'r') {
        t[i]='p';
        res += p;
      }
      else {
        t[i]='r';
        res += r;
      }
    }
  }
cout << res <<'\n';

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:10: error: conflicting declaration 'std::string s'
   11 |   string s, t;
      |          ^
a.cc:8:13: note: previous declaration as 'int s'
    8 |   int r, p, s;
      |             ^
a.cc:16:14: error: invalid types 'int[int]' for array subscript
   16 |         if (s[i] == 'p') {
      |              ^
a.cc:20:15: error: invalid types 'int[int]' for array subscript
   20 |     else if (s[i] == 'r') {
      |               ^
a.cc:31:14: error: invalid types 'int[int]' for array subscript
   31 |         if (s[i]==s[i-k] && s[i]!=t[i-k]) t[i] = s[i];
      |              ^
a.cc:31:20: error: invalid types 'int[int]' for array subscript
   31 |         if (s[i]==s[i-k] && s[i]!=t[i-k]) t[i] = s[i];
      |                    ^
a.cc:31:30: error: invalid types 'int[int]' for array subscript
   31 |         if (s[i]==s[i-k] && s[i]!=t[i-k]) t[i] = s[i];
      |                              ^
a.cc:31:51: error: invalid types 'int[int]' for array subscript
   31 |         if (s[i]==s[i-k] && s[i]!=t[i-k]) t[i] = s[i];
      |                                                   ^
a.cc:34:12: error: invalid types 'int[int]' for array subscript
   34 |       if (s[i] == 'p') {
      |            ^
a.cc:38:17: error: invalid types 'int[int]' for array subscript
   38 |       else if (s[i] == 'r') {
      |                 ^