Language: C

#include <stdio.h>

int main(void){
  int n, k, r, s, p;
  int score = 0;
  char *t;
  t = (char *)malloc(n);
  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; j ++){
    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:7:15: error: implicit declaration of function 'malloc' [-Wimplicit-function-declaration]
    7 |   t = (char *)malloc(n);
      |               ^~~~~~
main.c:2:1: note: include '<stdlib.h>' or provide a declaration of 'malloc'
    1 | #include <stdio.h>
  +++ |+#include <stdlib.h>
    2 | 
main.c:7:15: warning: incompatible implicit declaration of built-in function 'malloc' [-Wbuiltin-declaration-mismatch]
    7 |   t = (char *)malloc(n);
      |               ^~~~~~
main.c:7:15: note: include '<stdlib.h>' or provide a declaration of 'malloc'
main.c:9:29: error: expected expression before '%' token
    9 |   scanf("%d %d %d", &r, &s, %p);
      |                             ^
main.c:13:9: error: implicit declaration of function 'strcmp' [-Wimplicit-function-declaration]
   13 |     if(!strcmp(t[i], "r")){
      |         ^~~~~~
main.c:2:1: note: include '<string.h>' or provide a declaration of 'strcmp'
    1 | #include <stdio.h>
  +++ |+#include <string.h>
    2 | 
main.c:13:17: error: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   13 |     if(!strcmp(t[i], "r")){
      |                ~^~~
      |                 |
      |                 char
main.c:13:17: note: expected 'const char *' but argument is of type 'char'
main.c:15:23: error: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   15 |     }else if(!strcmp(t[i], "s")){
      |                      ~^~~
      |                       |
      |                       char
main.c:15:23: note: expected 'const char *' but argument is of type 'char'
main.c:17:23: error: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   17 |     }else if(!strcmp(t[i], "p")){
      |                      ~^~~
      |                       |
      |                       char
main.c:17:23: note: expected 'const char *' but argument is of type 'char'
main.c:22:25: error: 'j' undeclared (first use in this function)
   22 |   for(int i = k; i < n; j ++){
      |                         ^
main.c:22:25: note: each undeclared identifier is reported only once for each function it appears in
main.c:23:5: error: 'prev' undeclared (first use in this function)
   23 |     prev[0] = t[i-k];
      |     ^~~~
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
main.c:24:16: note: expected 'const char *' but argument is of type 'char'
main.c:25:19: error: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   25 |       if(!strcmp(t[i], "r")){
      |                  ~^~~
      |                   |
      |                   char
main.c:25:19: note: expected 'const char *' but argument is of type 'char'
main.c:27:25: error: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   27 |       }else if(!strcmp(t[i], "s")){
      |                        ~^~~
      |                         |
      |                         char
main.c:27:25: note: expected 'const char *' but argument is of type 'char'
main.c:29:25: error: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   29 |       }else if(!strcmp(t[i], "p")){
      |                        ~^~~
      |                         |
      |                         char
main.c:29:25: note: expected 'const char *' but argument is of type 'char'