TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: At an arcade, Takahashi is playing a game called _RPS Battle_ , which is played as follows:    * The player plays N rounds of Rock Paper Scissors against the machine. (See Notes for the description of Rock Paper Scissors. A draw also counts as a round.)   * Each time the player wins a round, depending on which hand he/she uses, he/she earns the following score (no points for a draw or a loss):     * R points for winning with Rock;     * S points for winning with Scissors;     * P points for winning with Paper.   * However, in the i-th round, the player cannot use the hand he/she used in the (i-K)-th round. (In the first K rounds, the player can use any hand.)  Before the start of the game, the machine decides the hand it will play in each round. With supernatural power, Takahashi managed to read all of those hands.  The information Takahashi obtained is given as a string T. If the i-th character of T (1 \leq i \leq N) is `r`, the machine will play Rock in the i-th round. Similarly, `p` and `s` stand for Paper and Scissors, respectively.  What is the maximum total score earned in the game by adequately choosing the hand to play in each round?

Submission attempts (in order):
n, k = map(int, input().split(' '))
r, s, p = map(int, input().split(' '))
t = input()

dasita_te = []

score = 0

for i, c in enumerate(t):
    if c == "r":
        if (i >= k and dasita_te[i - k] != "p") or i < k:
            score += p
            dasita_te.append("p")
        else:
            dasita_te.append("-")
    elif c == "s":
        if (i >= k and dasita_te[i - k] != "r") or i < k:
            score += r
            dasita_te.append("r")
        else:
            dasita_te.append("-")
    elif c == "p":
        if (i >= k and dasita_te[i - k] != "s") or i < k:
            score += s
            dasita_te.append("s")
        else:
            dasita_te.append("-")
    print(i, score)

print(score)


n, k = map(int, input().split(' '))
r, s, p = map(int, input().split(' '))
t = input()

dasita_te = []

score = 0

for i, c in enumerate(t):
    if c == "r":
        if (i >= k and dasita_te[i - k] != "p") or i < k:
            score += p
            dasita_te.append("p")
        else:
            dasita_te.append("-")
    elif c == "s":
        if (i >= k and dasita_te[i - k] != "r") or i < k:
            score += r
            dasita_te.append("r")
        else:
            dasita_te.append("-")
    elif c == "p":
        if (i >= k and dasita_te[i - k] != "s") or i < k:
            score += s
            dasita_te.append("s")
        else:
            dasita_te.append("-")

print(score)


Verdicts: Wrong Answer

Accepted
Problem: At an arcade, Takahashi is playing a game called _RPS Battle_ , which is played as follows:    * The player plays N rounds of Rock Paper Scissors against the machine. (See Notes for the description of Rock Paper Scissors. A draw also counts as a round.)   * Each time the player wins a round, depending on which hand he/she uses, he/she earns the following score (no points for a draw or a loss):     * R points for winning with Rock;     * S points for winning with Scissors;     * P points for winning with Paper.   * However, in the i-th round, the player cannot use the hand he/she used in the (i-K)-th round. (In the first K rounds, the player can use any hand.)  Before the start of the game, the machine decides the hand it will play in each round. With supernatural power, Takahashi managed to read all of those hands.  The information Takahashi obtained is given as a string T. If the i-th character of T (1 \leq i \leq N) is `r`, the machine will play Rock in the i-th round. Similarly, `p` and `s` stand for Paper and Scissors, respectively.  What is the maximum total score earned in the game by adequately choosing the hand to play in each round?

Submission attempts (in order):
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()

score = np.array([0, R, S, P], dtype=int)
M = (1 + (N-1)//K)
addi = M * K - N
t = np.array([{'n':0, 's':1, 'p':2, 'r':3}[i] for i in T+'n'*addi], dtype=int)

t = t.reshape(M,K).T

for i in range(K):
    for j in range(M):
        if j!=0 and t[i,j] == t[i,j-1]:
            t[i,j] = 0

print(score[t].sum())

N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()

import numpy as np

score = np.array([0, R, S, P], dtype=int)
M = (1 + (N-1)//K)
addi = M * K - N
t = np.array([{'n':0, 's':1, 'p':2, 'r':3}[i] for i in T+'n'*addi], dtype=int)

t = t.reshape(M,K).T

for i in range(K):
    for j in range(M):
        if j!=0 and t[i,j] == t[i,j-1]:
            t[i,j] = 0

print(score[t].sum())

Verdicts: Runtime Error

Accepted
Problem: At an arcade, Takahashi is playing a game called _RPS Battle_ , which is played as follows:    * The player plays N rounds of Rock Paper Scissors against the machine. (See Notes for the description of Rock Paper Scissors. A draw also counts as a round.)   * Each time the player wins a round, depending on which hand he/she uses, he/she earns the following score (no points for a draw or a loss):     * R points for winning with Rock;     * S points for winning with Scissors;     * P points for winning with Paper.   * However, in the i-th round, the player cannot use the hand he/she used in the (i-K)-th round. (In the first K rounds, the player can use any hand.)  Before the start of the game, the machine decides the hand it will play in each round. With supernatural power, Takahashi managed to read all of those hands.  The information Takahashi obtained is given as a string T. If the i-th character of T (1 \leq i \leq N) is `r`, the machine will play Rock in the i-th round. Similarly, `p` and `s` stand for Paper and Scissors, respectively.  What is the maximum total score earned in the game by adequately choosing the hand to play in each round?

Submission attempts (in order):
n,k=list(map(int,input().split()))
r,p,s=list(map(int,input().split()))
t=input()
vic=""
ans=0
for i in t:
    if i=="r":
        vic+="p"
    if i=="p":
        vic+="s"
    if i=="s":
        vic+="r"
#print(vic[:k])
for i in vic[:k]:
    if i=="r":
        ans+=r
    elif i=="p":
        ans+=p
    elif i=="s":
        ans+=s
#print(vic)
#print(ans)
for i in range(k,n):
    #print(i,":",vic[i])
    if vic[i]==vic[i-k]:
        #print("lose")
        if not i==n-1:
            vic=vic[:i]+'n'+vic[i+1:]
    else:
        #print("win")
        if vic[i]=="r":
            ans+=r
        elif vic[i]=="p":
            ans+=p
        elif vic[i]=="s":
            ans+=s
        else:
            pass
            #print("wrong input")

    #print()

print(ans)

def sol(score,hand):
    if hand=="r":
        return score["p"]
    elif hand=="p":
        return score["s"]
    elif hand=="s":
        return score["r"]
    return 0
n,k=map(int,input().split())
r,s,p=map(int,input().split())
t=input()
win=""
for num,val in enumerate(t):
    if num<k or win[num-k]!=val:
        win+=val
    else:
        win+="n"
score={"r":r,"p":p,"s":s}
ans=0
for val in win:
    ans+=sol(score,val)

print(ans)


Verdicts: Wrong Answer

Accepted
Problem: At an arcade, Takahashi is playing a game called _RPS Battle_ , which is played as follows:    * The player plays N rounds of Rock Paper Scissors against the machine. (See Notes for the description of Rock Paper Scissors. A draw also counts as a round.)   * Each time the player wins a round, depending on which hand he/she uses, he/she earns the following score (no points for a draw or a loss):     * R points for winning with Rock;     * S points for winning with Scissors;     * P points for winning with Paper.   * However, in the i-th round, the player cannot use the hand he/she used in the (i-K)-th round. (In the first K rounds, the player can use any hand.)  Before the start of the game, the machine decides the hand it will play in each round. With supernatural power, Takahashi managed to read all of those hands.  The information Takahashi obtained is given as a string T. If the i-th character of T (1 \leq i \leq N) is `r`, the machine will play Rock in the i-th round. Similarly, `p` and `s` stand for Paper and Scissors, respectively.  What is the maximum total score earned in the game by adequately choosing the hand to play in each round?

Submission attempts (in order):
n,k = map(int,input().split())
lis = list(map(int,input().split()))
s = str(input())
dp = [[0] * 3 for i in range(n+k+1)]
dp[0] = [0,0,0]
s = "*"+s
for i in range(1,k+1):
    if s[i] == "s":
        dp[i][0] = max(dp[i-1])+lis[0]
        dp[i][1] = max(dp[i-1])
        dp[i][2] = max(dp[i-1])
    elif s[i] == "p":
        dp[i][0] = max(dp[i-1])
        dp[i][1] = max(dp[i-1])+lis[1]
        dp[i][2] = max(dp[i-1])
    else:
        dp[i][0] = max(dp[i-1])
        dp[i][1] = max(dp[i-1])
        dp[i][2] = max(dp[i-1])+lis[2]
for i in range(k+1,n+1):
    if s[i] == "s":
        dp[i][0] = max(dp[i-1][1],dp[i-1][2])+lis[0]
        dp[i][1] = max(dp[i-1][0],dp[i-1][2])
        dp[i][2] = max(dp[i-1][1],dp[i-1][0])
    elif s[i] == "p":
        dp[i][0] = max(dp[i-1][1],dp[i-1][2])
        dp[i][1] = max(dp[i-1][0],dp[i-1][2])+lis[1]
        dp[i][2] = max(dp[i-1][1],dp[i-1][0])
    else:
        dp[i][0] = max(dp[i-1][1],dp[i-1][2])
        dp[i][1] = max(dp[i-1][0],dp[i-1][2])
        dp[i][2] = max(dp[i-1][1],dp[i-1][0])+lis[2]
print(max(dp[n]))

n,k = map(int,input().split())
point = list(map(int,input().split()))
t = str(input())
janken = ["s","p","r"]
ans = 0
iziwaru = [False for i in range(n)]
for i in range(n):
    if not iziwaru[i]:
        ans += point[janken.index(t[i])]
        if i + k < n:
            if t[i] == t[i+k]:iziwaru[i+k] = True
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: At an arcade, Takahashi is playing a game called _RPS Battle_ , which is played as follows:    * The player plays N rounds of Rock Paper Scissors against the machine. (See Notes for the description of Rock Paper Scissors. A draw also counts as a round.)   * Each time the player wins a round, depending on which hand he/she uses, he/she earns the following score (no points for a draw or a loss):     * R points for winning with Rock;     * S points for winning with Scissors;     * P points for winning with Paper.   * However, in the i-th round, the player cannot use the hand he/she used in the (i-K)-th round. (In the first K rounds, the player can use any hand.)  Before the start of the game, the machine decides the hand it will play in each round. With supernatural power, Takahashi managed to read all of those hands.  The information Takahashi obtained is given as a string T. If the i-th character of T (1 \leq i \leq N) is `r`, the machine will play Rock in the i-th round. Similarly, `p` and `s` stand for Paper and Scissors, respectively.  What is the maximum total score earned in the game by adequately choosing the hand to play in each round?

Submission attempts (in order):
[N,K] = list(map(int,input().split()))
[R,S,P] = list(map(int,input().split()))
T = input()

j_l = "rsp"
kachi = lambda k : j_l[ (j_l.find(T[k]) + 2) % 3 ]

rireki = []
score = [0,0,0] 

for i in range(N): 
  if i-K >= 0: 
    if kachi(i) != rireki[i-K]: 
      score[ (j_l.find(T[i])+ 2) % 3 ] += 1
      rireki.append(kachi(i)) 
      print(score)
    else: 
      rireki.append(T[i]) 
      print(score)
  else: 
    score[ (j_l.find(T[i])+ 2) % 3 ] += 1 
    rireki.append(kachi(i)) 
    print(score) 
tortal_score = R*score[0] + S*score[1] + P*score[2]

print(tortal_score)

[N,K] = list(map(int,input().split()))
[R,S,P] = list(map(int,input().split()))
T = input()

j_l = "rsp"
kachi = lambda k : j_l[ (j_l.find(T[k]) + 2) % 3 ]

rireki = []
score = [0,0,0] 

for i in range(N): 
  if i-K >= 0: 
    if kachi(i) != rireki[i-K]: 
      score[ (j_l.find(T[i])+ 2) % 3 ] += 1
      rireki.append(kachi(i)) 
      #print(score)
    else: 
      rireki.append("hikiwake_or_make") 
      #print(score)
  else: 
    score[ (j_l.find(T[i])+ 2) % 3 ] += 1 
    rireki.append(kachi(i)) 
    #print(score) 
tortal_score = R*score[0] + S*score[1] + P*score[2]

#print(rireki)

print(tortal_score)

Verdicts: Wrong Answer

Accepted
Problem: At an arcade, Takahashi is playing a game called _RPS Battle_ , which is played as follows:    * The player plays N rounds of Rock Paper Scissors against the machine. (See Notes for the description of Rock Paper Scissors. A draw also counts as a round.)   * Each time the player wins a round, depending on which hand he/she uses, he/she earns the following score (no points for a draw or a loss):     * R points for winning with Rock;     * S points for winning with Scissors;     * P points for winning with Paper.   * However, in the i-th round, the player cannot use the hand he/she used in the (i-K)-th round. (In the first K rounds, the player can use any hand.)  Before the start of the game, the machine decides the hand it will play in each round. With supernatural power, Takahashi managed to read all of those hands.  The information Takahashi obtained is given as a string T. If the i-th character of T (1 \leq i \leq N) is `r`, the machine will play Rock in the i-th round. Similarly, `p` and `s` stand for Paper and Scissors, respectively.  What is the maximum total score earned in the game by adequately choosing the hand to play in each round?

Submission attempts (in order):
import collections

N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = list(input())

for i in range(N-K):
    if T[i] == T[i+K]:
        T[i+K] = "a"

c = colelctions.Counter(T)

print(c["r"]*P + c["s"]*R + c["p"]*S)

import collections

N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = list(input())

for i in range(N-K):
    if T[i] == T[i+K]:
        T[i+K] = "a"

c = collections.Counter(T)

print(c["r"]*P + c["s"]*R + c["p"]*S)

Verdicts: Runtime Error

Accepted
Problem: At an arcade, Takahashi is playing a game called _RPS Battle_ , which is played as follows:    * The player plays N rounds of Rock Paper Scissors against the machine. (See Notes for the description of Rock Paper Scissors. A draw also counts as a round.)   * Each time the player wins a round, depending on which hand he/she uses, he/she earns the following score (no points for a draw or a loss):     * R points for winning with Rock;     * S points for winning with Scissors;     * P points for winning with Paper.   * However, in the i-th round, the player cannot use the hand he/she used in the (i-K)-th round. (In the first K rounds, the player can use any hand.)  Before the start of the game, the machine decides the hand it will play in each round. With supernatural power, Takahashi managed to read all of those hands.  The information Takahashi obtained is given as a string T. If the i-th character of T (1 \leq i \leq N) is `r`, the machine will play Rock in the i-th round. Similarly, `p` and `s` stand for Paper and Scissors, respectively.  What is the maximum total score earned in the game by adequately choosing the hand to play in each round?

Submission attempts (in order):
N,K=map(int,input().split())
R,S,P=map(int,input().split())
T=str(input())
c=int(0)
def get(x,c):
  if x=="r":
    c+=P
  elif x=="s":
    c+=R
  else:
    c+=S
  return c
for i in range(len(T)):
  if i<=K-1:
    c=get(T[i],c)
  else:
    if T[i-K]!=T[i]:
      c=get(T[i],c)
    if T[i-K]!="o" and T[i-K]==T[i]:
      T[i]="o"
print(c)

N,K=map(int,input().split())
R,S,P=map(int,input().split())
T=str(input())
c=int(0)
def get(x,c):
  if x=="r":
    c+=P
  elif x=="s":
    c+=R
  else:
    c+=S
  return c
n=len(T)
for i in range(n):
  if i<=K-1:
    c=get(T[i],c)
  else:
    if T[i-K]!=T[i]:
      c=get(T[i],c)
    if T[i-K]!="o" and T[i-K]==T[i]:
      T=T[:i-K]+"o"+T[i-K+1:]
print(c)

N,K=map(int,input().split())
R,S,P=map(int,input().split())
T=str(input())
c=int(0)
def get(x,c):
  if x=="r":
    c+=P
  elif x=="s":
    c+=R
  else:
    c+=S
  return c
for i in range(len(T)):
  if i<=K-1:
    c=get(T[i],c)
  else:
    if T[i-K]!=T[i]:
      c=get(T[i],c)
print(c)

N,K=map(int,input().split())
R,S,P=map(int,input().split())
T=str(input())
c=int(0)
def get(x,c):
  if x==r:
    c+=P
  elif x==s:
    c+=R
  else:
    c+=S
  return c
for i in range(len(T)):
  if i<=K-1:
    c=get(T[i],c)
  else:
    if T[i-K]!=T[i]:
      c=get(T[i],c)
print(c)

N,K=map(int,input().split())
R,S,P=map(int,input().split())
T=str(input())
c=int(0)
def get(x,c):
  if x=="r":
    c+=P
  elif x=="s":
    c+=R
  else:
    c+=S
  return c
n=len(T)
for i in range(n):
  if i<=K-1:
    c=get(T[i],c)
  else:
    if T[i-K]!=T[i]:
      c=get(T[i],c)
    if T[i-K]!="o" and T[i-K]==T[i]:
      T=T[:i]+"o"+T[i+1:]
print(c)

Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Runtime Error

Accepted
Problem: At an arcade, Takahashi is playing a game called _RPS Battle_ , which is played as follows:    * The player plays N rounds of Rock Paper Scissors against the machine. (See Notes for the description of Rock Paper Scissors. A draw also counts as a round.)   * Each time the player wins a round, depending on which hand he/she uses, he/she earns the following score (no points for a draw or a loss):     * R points for winning with Rock;     * S points for winning with Scissors;     * P points for winning with Paper.   * However, in the i-th round, the player cannot use the hand he/she used in the (i-K)-th round. (In the first K rounds, the player can use any hand.)  Before the start of the game, the machine decides the hand it will play in each round. With supernatural power, Takahashi managed to read all of those hands.  The information Takahashi obtained is given as a string T. If the i-th character of T (1 \leq i \leq N) is `r`, the machine will play Rock in the i-th round. Similarly, `p` and `s` stand for Paper and Scissors, respectively.  What is the maximum total score earned in the game by adequately choosing the hand to play in each round?

Submission attempts (in order):
n, k = map(int, input().split())
r, ss, p = map(int, input().split())
s = input()
hands = [None]*n
wins = {'r':'p', 's':'r', 'p':'s'}
h_s = {'r':r, 's':ss, 'p':p}
ans = 0
for i, c in enumerate(s):
    if i - k >= 0:
        if wins[c] == hands[i-k]:æ
            hs = set(wins.keys())
            hs.remove(wins[c])
            if i + k < n:
                if wins[s[i+k]] in hs:
                    hs.remove(wins[s[i+k]])
            hands[i] = hs.pop()
            continue
    hand = wins[c]
    hands[i] = hand
    ans += h_s[hand]

print(ans)
        




n, k = map(int, input().split())
r, ss, p = map(int, input().split())
s = input()
hands = [None]*n
wins = {'r':'p', 's':'r', 'p':'s'}
h_s = {'r':r, 's':ss, 'p':p}
ans = 0
for i, c in enumerate(s):
    if i - k >= 0:
        if wins[c] == hands[i-k]:
            hs = set(wins.keys())
            hs.remove(wins[c])
            if i + k < n:
                if wins[s[i+k]] in hs:
                    hs.remove(wins[s[i+k]])
            hands[i] = hs.pop()
            continue
    hand = wins[c]
    hands[i] = hand
    ans += h_s[hand]

print(ans)
        




Verdicts: Runtime Error

Accepted
Problem: At an arcade, Takahashi is playing a game called _RPS Battle_ , which is played as follows:    * The player plays N rounds of Rock Paper Scissors against the machine. (See Notes for the description of Rock Paper Scissors. A draw also counts as a round.)   * Each time the player wins a round, depending on which hand he/she uses, he/she earns the following score (no points for a draw or a loss):     * R points for winning with Rock;     * S points for winning with Scissors;     * P points for winning with Paper.   * However, in the i-th round, the player cannot use the hand he/she used in the (i-K)-th round. (In the first K rounds, the player can use any hand.)  Before the start of the game, the machine decides the hand it will play in each round. With supernatural power, Takahashi managed to read all of those hands.  The information Takahashi obtained is given as a string T. If the i-th character of T (1 \leq i \leq N) is `r`, the machine will play Rock in the i-th round. Similarly, `p` and `s` stand for Paper and Scissors, respectively.  What is the maximum total score earned in the game by adequately choosing the hand to play in each round?

Submission attempts (in order):
N, K = (int(x) for x in input().split())
R, S, P = (int(x) for x in input().split())
T = input()

def getScore(t):
    if t == "r":
        print("P", end="")
        return P
    elif t == "s":
        print("R", end="")
        return R
    elif t == "p":
        print("S", end="")
        return S
    else:
        print(" ", end="")

score=0
mycard = []
for i in range(N):
    if i < K:
        score += getScore(T[i])
        mycard.append(1)
    else:
        if mycard[i-K] == 0:
            score += getScore(T[i])
            mycard.append(1)
        else:
            if T[i] != T[i-K]:
                score += getScore(T[i])
                mycard.append(1)
            else:
                mycard.append(0)
print("")
print(score)

N, K = (int(x) for x in input().split())
R, S, P = (int(x) for x in input().split())
T = input()

def getScore(t):
    if t == "r":
        return P
    elif t == "s":
        return R
    elif t == "p":
        return S

score=0
mycard = []
for i in range(N):
    if i < K:
        score += getScore(T[i])
        mycard.append(1)
    else:
        if mycard[i-K] == 0:
            score += getScore(T[i])
            mycard.append(1)
        else:
            if T[i] != T[i-K]:
                score += getScore(T[i])
                mycard.append(1)
            else:
                mycard.append(0)
print(score)

Verdicts: Internal error

Accepted
Problem: At an arcade, Takahashi is playing a game called _RPS Battle_ , which is played as follows:    * The player plays N rounds of Rock Paper Scissors against the machine. (See Notes for the description of Rock Paper Scissors. A draw also counts as a round.)   * Each time the player wins a round, depending on which hand he/she uses, he/she earns the following score (no points for a draw or a loss):     * R points for winning with Rock;     * S points for winning with Scissors;     * P points for winning with Paper.   * However, in the i-th round, the player cannot use the hand he/she used in the (i-K)-th round. (In the first K rounds, the player can use any hand.)  Before the start of the game, the machine decides the hand it will play in each round. With supernatural power, Takahashi managed to read all of those hands.  The information Takahashi obtained is given as a string T. If the i-th character of T (1 \leq i \leq N) is `r`, the machine will play Rock in the i-th round. Similarly, `p` and `s` stand for Paper and Scissors, respectively.  What is the maximum total score earned in the game by adequately choosing the hand to play in each round?

Submission attempts (in order):
N, K = map(int, input().split(" "))
R, S, P = map(int, input().split(" "))
T = input()

score_by_hand = {"r": P, "s": R, "p": S}
result = 0
score = 0
for k in range(K):
    column = T[k::K]
    print(column)
    before = None
    for hand in column:
        if hand == before:
            before = None
        else:
            score += score_by_hand[hand]
            before = hand

print(score)

N, K = map(int, input().split(" "))
R, S, P = map(int, input().split(" "))
T = input()

score_by_hand = {"r": P, "s": R, "p": S}
result = 0
score = 0
for k in range(K):
    column = T[k::K]
    before = None
    for hand in column:
        if hand == before:
            before = None
        else:
            score += score_by_hand[hand]
            before = hand

print(score)

Verdicts: Internal error

Accepted
Problem: At an arcade, Takahashi is playing a game called _RPS Battle_ , which is played as follows:    * The player plays N rounds of Rock Paper Scissors against the machine. (See Notes for the description of Rock Paper Scissors. A draw also counts as a round.)   * Each time the player wins a round, depending on which hand he/she uses, he/she earns the following score (no points for a draw or a loss):     * R points for winning with Rock;     * S points for winning with Scissors;     * P points for winning with Paper.   * However, in the i-th round, the player cannot use the hand he/she used in the (i-K)-th round. (In the first K rounds, the player can use any hand.)  Before the start of the game, the machine decides the hand it will play in each round. With supernatural power, Takahashi managed to read all of those hands.  The information Takahashi obtained is given as a string T. If the i-th character of T (1 \leq i \leq N) is `r`, the machine will play Rock in the i-th round. Similarly, `p` and `s` stand for Paper and Scissors, respectively.  What is the maximum total score earned in the game by adequately choosing the hand to play in each round?

Submission attempts (in order):
*t,s=open(0).read().split()
n,k,r,s,p=map(int,t)
d={'r':p,'s':r,'p':s}
b=['']*n*2
a=0
for i,c in enumerate(s[:n]):
  if c!=b[i-k]:
    b[i]=c
    a+=d[c]
print(a)

*n,t=open(0).read().split()
n,k,r,s,p=map(int,n)
*t,=t
for i in range(n-k):
  if t[i+k]==t[i]:t[i+k]=5
a,b,c=map(t.count,'rsp')
print(a*p+b*r+c*s)

Verdicts: Runtime Error

Accepted
Problem: At an arcade, Takahashi is playing a game called _RPS Battle_ , which is played as follows:    * The player plays N rounds of Rock Paper Scissors against the machine. (See Notes for the description of Rock Paper Scissors. A draw also counts as a round.)   * Each time the player wins a round, depending on which hand he/she uses, he/she earns the following score (no points for a draw or a loss):     * R points for winning with Rock;     * S points for winning with Scissors;     * P points for winning with Paper.   * However, in the i-th round, the player cannot use the hand he/she used in the (i-K)-th round. (In the first K rounds, the player can use any hand.)  Before the start of the game, the machine decides the hand it will play in each round. With supernatural power, Takahashi managed to read all of those hands.  The information Takahashi obtained is given as a string T. If the i-th character of T (1 \leq i \leq N) is `r`, the machine will play Rock in the i-th round. Similarly, `p` and `s` stand for Paper and Scissors, respectively.  What is the maximum total score earned in the game by adequately choosing the hand to play in each round?

Submission attempts (in order):

n, k = map(int,input().split())
r, s, p = map(int,input().split())
t = input()
ans = 0
flag = 0
d = {"r":p, "s":r, "p":s}
for idx, j in enumerate(t):
    if idx >= k:
        if j != t[idx-k]:
            ans += d[j]
            flag = 0
        elif j == t[idx-k] and flag == 0:
            flag = 1
        elif j == t[idx-k] and flag == 1:
            ans += d[j]
            flag = 0         
    else:
        ans += d[j]
print(ans)
          

n, k = map(int,input().split())
r, s, p = map(int,input().split())
t = input()
ans = 0
flag = [0 for _ in range(k)]
d = {"r":p, "s":r, "p":s}

for i in range(k):
    ans += d[t[i]]

for i in range(1, len(t)//k+1):
    if i == len(t)//k :
        for j in range(len(t)%k):
            if t[i*k+j] != t[(i-1)*k+j]:
                ans += d[t[i*k+j]]
                flag[j] = 0
            elif t[i*k+j] == t[(i-1)*k+j] and flag[j] == 0:
                flag[j] = 1
            elif t[i*k+j] == t[(i-1)*k+j] and flag[j] == 1:
                ans += d[t[i*k+j]]
                flag[j] = 0
    else:
        for j in range(k):
            if t[i*k+j] != t[(i-1)*k+j]:
                ans += d[t[i*k+j]]
                flag[j] = 0
            elif t[i*k+j] == t[(i-1)*k+j] and flag[j] == 0:
                flag[j] = 1
            elif t[i*k+j] == t[(i-1)*k+j] and flag[j] == 1:
                ans += d[t[i*k+j]]
                flag[j] = 0

print(ans)
 

Verdicts: Wrong Answer

Accepted
Problem: At an arcade, Takahashi is playing a game called _RPS Battle_ , which is played as follows:    * The player plays N rounds of Rock Paper Scissors against the machine. (See Notes for the description of Rock Paper Scissors. A draw also counts as a round.)   * Each time the player wins a round, depending on which hand he/she uses, he/she earns the following score (no points for a draw or a loss):     * R points for winning with Rock;     * S points for winning with Scissors;     * P points for winning with Paper.   * However, in the i-th round, the player cannot use the hand he/she used in the (i-K)-th round. (In the first K rounds, the player can use any hand.)  Before the start of the game, the machine decides the hand it will play in each round. With supernatural power, Takahashi managed to read all of those hands.  The information Takahashi obtained is given as a string T. If the i-th character of T (1 \leq i \leq N) is `r`, the machine will play Rock in the i-th round. Similarly, `p` and `s` stand for Paper and Scissors, respectively.  What is the maximum total score earned in the game by adequately choosing the hand to play in each round?

Submission attempts (in order):
n,k=map(int, input().split())
r,s,p=map(int, input().split())
t=input()
ans=0
for i in range(k):
  u=s[i::k]
  u=u.replace("rr", "rx")
  u=u.replace("pp", "px")
  u=u.replace("ss", "sx")
  ans+=u.count("s")*r
  ans+=u.count("p")*s
  ans+=u.count("r")*p
print(ans)

n,k=map(int, input().split())
r,s,p=map(int, input().split())
t=input()
ans=0
for i in range(k):
  u=t[i::k]
  u=u.replace("rr", "rx")
  u=u.replace("pp", "px")
  u=u.replace("ss", "sx")
  ans+=u.count("s")*r
  ans+=u.count("p")*s
  ans+=u.count("r")*p
print(ans)

Verdicts: Runtime Error

Accepted
Problem: At an arcade, Takahashi is playing a game called _RPS Battle_ , which is played as follows:    * The player plays N rounds of Rock Paper Scissors against the machine. (See Notes for the description of Rock Paper Scissors. A draw also counts as a round.)   * Each time the player wins a round, depending on which hand he/she uses, he/she earns the following score (no points for a draw or a loss):     * R points for winning with Rock;     * S points for winning with Scissors;     * P points for winning with Paper.   * However, in the i-th round, the player cannot use the hand he/she used in the (i-K)-th round. (In the first K rounds, the player can use any hand.)  Before the start of the game, the machine decides the hand it will play in each round. With supernatural power, Takahashi managed to read all of those hands.  The information Takahashi obtained is given as a string T. If the i-th character of T (1 \leq i \leq N) is `r`, the machine will play Rock in the i-th round. Similarly, `p` and `s` stand for Paper and Scissors, respectively.  What is the maximum total score earned in the game by adequately choosing the hand to play in each round?

Submission attempts (in order):
n, k = map(int,input().split())
r, s, p = map(int,input().split())
t = input()

def point(aite):
    if aite == "r":
        return p
    elif aite == "s":
        return r
    else:
        return s

ten = t.count('r')*p+t.count('s')*r+t.count('p')*s
lose = []
'''
for i in range(n-k):
    if t[i] == t[i+k] and not i in lose:
        ten -= point(t[i])
        lose.append(i+k)
'''
print(ten)


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

def point(aite):
    if aite == "r":
        return p
    elif aite == "s":
        return r
    else:
        return s

ten = 0
kako = ["o"]*k
for i in range(n):
    if kako[i%k] == t[i]:
        kako[i%k] = "o"
    else:
        kako[i%k] = t[i]
        ten += point(t[i])

print(ten)


Verdicts: Wrong Answer

Accepted
Problem: At an arcade, Takahashi is playing a game called _RPS Battle_ , which is played as follows:    * The player plays N rounds of Rock Paper Scissors against the machine. (See Notes for the description of Rock Paper Scissors. A draw also counts as a round.)   * Each time the player wins a round, depending on which hand he/she uses, he/she earns the following score (no points for a draw or a loss):     * R points for winning with Rock;     * S points for winning with Scissors;     * P points for winning with Paper.   * However, in the i-th round, the player cannot use the hand he/she used in the (i-K)-th round. (In the first K rounds, the player can use any hand.)  Before the start of the game, the machine decides the hand it will play in each round. With supernatural power, Takahashi managed to read all of those hands.  The information Takahashi obtained is given as a string T. If the i-th character of T (1 \leq i \leq N) is `r`, the machine will play Rock in the i-th round. Similarly, `p` and `s` stand for Paper and Scissors, respectively.  What is the maximum total score earned in the game by adequately choosing the hand to play in each round?

Submission attempts (in order):
n,k=map(int,input().split())
a,b,c=map(int,input().split())
s=input()
l=['a']*k
for i in range(n):
  l[i%k]+=s[i]
ans=0
d={'s':a,'p':b,'r':c}
for i in range(k):
  x=l[i]
  for j in range(len(x)-1):
    if x[j+1]==x[j]:
      ans+=d[x[j+1]]
print(ans)

n,k=map(int,input().split())
a,b,c=map(int,input().split())
s=input()
l=['']*k
for i in range(n):
  l[i%k]+=s[i]
ans=0
d={'s':a,'p':b,'r':c}
for i in range(k):
  x=l[i]
  now=x[0]
  memo=0
  for j in range(len(x)):
    if x[j]==now:
      memo+=1
    else:
      ans+=(max(1,(memo+1)//2))*d[now]
      now=x[j]
      memo=1
  ans+=(max(1,(memo+1)//2))*d[now]
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: At an arcade, Takahashi is playing a game called _RPS Battle_ , which is played as follows:    * The player plays N rounds of Rock Paper Scissors against the machine. (See Notes for the description of Rock Paper Scissors. A draw also counts as a round.)   * Each time the player wins a round, depending on which hand he/she uses, he/she earns the following score (no points for a draw or a loss):     * R points for winning with Rock;     * S points for winning with Scissors;     * P points for winning with Paper.   * However, in the i-th round, the player cannot use the hand he/she used in the (i-K)-th round. (In the first K rounds, the player can use any hand.)  Before the start of the game, the machine decides the hand it will play in each round. With supernatural power, Takahashi managed to read all of those hands.  The information Takahashi obtained is given as a string T. If the i-th character of T (1 \leq i \leq N) is `r`, the machine will play Rock in the i-th round. Similarly, `p` and `s` stand for Paper and Scissors, respectively.  What is the maximum total score earned in the game by adequately choosing the hand to play in each round?

Submission attempts (in order):
#D
n,k=map(int, input().split())
r,s,p=map(int, input().split())
t=str(input())
te=[]
score=0
for i in range(n):
  if i>=k and t[i]==t[i-k]:
    score+=0
    te.append(t[i])
  else:
    if t[i]=='r':
      score+=p
      te.append('p')
    elif t[i]=='s':
      score+=r
      te.append('r')
    elif t[i]=='p':
      score+=s
      te.append('s')
print(score)

#D
n,k=map(int, input().split())
r,s,p=map(int, input().split())
t=str(input()) 
te=[]
score=0
for i in range(n):
  if i>=k and t[i]==t[i-k] and t[i]!=te[i-k]:
    te.append(t[i]) 
  else: 
    if t[i]=='r':
      score+=p
      te.append('p')
    elif t[i]=='s':
      score+=r
      te.append('r')
    elif t[i]=='p':
      score+=s
      te.append('s')
print(score)#print(i,score,t,te)

Verdicts: Wrong Answer

Accepted
Problem: At an arcade, Takahashi is playing a game called _RPS Battle_ , which is played as follows:    * The player plays N rounds of Rock Paper Scissors against the machine. (See Notes for the description of Rock Paper Scissors. A draw also counts as a round.)   * Each time the player wins a round, depending on which hand he/she uses, he/she earns the following score (no points for a draw or a loss):     * R points for winning with Rock;     * S points for winning with Scissors;     * P points for winning with Paper.   * However, in the i-th round, the player cannot use the hand he/she used in the (i-K)-th round. (In the first K rounds, the player can use any hand.)  Before the start of the game, the machine decides the hand it will play in each round. With supernatural power, Takahashi managed to read all of those hands.  The information Takahashi obtained is given as a string T. If the i-th character of T (1 \leq i \leq N) is `r`, the machine will play Rock in the i-th round. Similarly, `p` and `s` stand for Paper and Scissors, respectively.  What is the maximum total score earned in the game by adequately choosing the hand to play in each round?

Submission attempts (in order):
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()

r = {'p': s, 'r': p, 's': r}

a = 0
for i in range(k):
    a += r[t[i]]
    
for i in range(k, n):
    if t[i] != t[i-k]:
        a += r[t[i]]

print(a)

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

m = {'p': s, 'r': p, 's': r}

dp = [''] * n
a = 0
for i in range(k):
    a += m[t[i]]
    dp[i] = t[i]
    
for i in range(k, n):
    if t[i] != dp[i-k]:
        a += m[t[i]]
        dp[i] = t[i]

print(a)

Verdicts: Wrong Answer

Accepted
Problem: At an arcade, Takahashi is playing a game called _RPS Battle_ , which is played as follows:    * The player plays N rounds of Rock Paper Scissors against the machine. (See Notes for the description of Rock Paper Scissors. A draw also counts as a round.)   * Each time the player wins a round, depending on which hand he/she uses, he/she earns the following score (no points for a draw or a loss):     * R points for winning with Rock;     * S points for winning with Scissors;     * P points for winning with Paper.   * However, in the i-th round, the player cannot use the hand he/she used in the (i-K)-th round. (In the first K rounds, the player can use any hand.)  Before the start of the game, the machine decides the hand it will play in each round. With supernatural power, Takahashi managed to read all of those hands.  The information Takahashi obtained is given as a string T. If the i-th character of T (1 \leq i \leq N) is `r`, the machine will play Rock in the i-th round. Similarly, `p` and `s` stand for Paper and Scissors, respectively.  What is the maximum total score earned in the game by adequately choosing the hand to play in each round?

Submission attempts (in order):
n, k = map(int, input().split())
r, s, p = map(int, input().split())
T=list(input())

commands = [""]*n
ans = 0

for i, t in enumerate(T):
    if t == "p":
        point = s
    elif t == "s":
        point = r
    elif t == "r":
        point = p

    if(i - k) >= 0 and (commands[i-k] == command):
        point = 0

    ans += point
print(ans)


n, k = map(int, input().split())
r, s, p = map(int, input().split())
T=list(input())

commands = [""]*n
ans = 0

for i, t in enumerate(T):
    if t == "p":
        point = s
    elif t == "s":
        point = r
    elif t == "r":
        point = p

    if(i - k) >= 0 and (commands[i-k] == command):
        point = 0

    ans += point
print(ans)


n, k = map(int, input().split())
r, s, p = map(int, input().split())
T=list(input())

commands = [""]*n
ans = 0

for i, t in enumerate(T):
    if t == "p":
        command = "s"
        point = s
    elif t == "s":
        command = "r"
        point = r
    elif t == "r":
        command = "p"
        point = p

    if(i - k) >= 0 and (commands[i-k] == command):
        command = ""
        point = 0

    ans += point
    commands[i] = command
print(ans)


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: At an arcade, Takahashi is playing a game called _RPS Battle_ , which is played as follows:    * The player plays N rounds of Rock Paper Scissors against the machine. (See Notes for the description of Rock Paper Scissors. A draw also counts as a round.)   * Each time the player wins a round, depending on which hand he/she uses, he/she earns the following score (no points for a draw or a loss):     * R points for winning with Rock;     * S points for winning with Scissors;     * P points for winning with Paper.   * However, in the i-th round, the player cannot use the hand he/she used in the (i-K)-th round. (In the first K rounds, the player can use any hand.)  Before the start of the game, the machine decides the hand it will play in each round. With supernatural power, Takahashi managed to read all of those hands.  The information Takahashi obtained is given as a string T. If the i-th character of T (1 \leq i \leq N) is `r`, the machine will play Rock in the i-th round. Similarly, `p` and `s` stand for Paper and Scissors, respectively.  What is the maximum total score earned in the game by adequately choosing the hand to play in each round?

Submission attempts (in order):
from collections import defaultdict

N,K = map(int, input().split())
R,S,P = map(int, input().split())
T = input()

index = defaultdict(list)

for i, t in enumerate(T):
    index[t].append(i)


len_r = len(index['r'])
len_s = len(index['s'])
len_p = len(index['p'])

tmp = 0
flag = True
for i in index['r']:    
    if tmp % K == 0 and flag == True:
        len_r -= 1
        flag = False
        tmp = i
        continue
    if tmp % K == 0 and flag == False:    
        flag = True
        tmp = i
        continue
    tmp += i -tmp

tmp = 0
flag = True
for j in index['s']:    
    if tmp % K == 0 and flag == True:
        len_s -= 1
        flag = False
        tmp = js
        continue
    if tmp % K == 0 and flag == False:    
        flag = True
        tmp = j
        continue
    tmp += j - tmp

tmp = 0
flag = True
for k in index['p']:    
    if tmp % K == 0 and flag == True:
        len_p -= 1
        flag = False
        tmp = k
        continue
    if tmp % K == 0 and flag == False:    
        flag = True
        tmp = k
        continue
    tmp += k-tmp

ans = P * len_r + R * len_s + S * len_p
print(ans)

N,K = map(int, input().split())
R,S,P = map(int, input().split())
T = input()

ans = ""
score = 0

for i, t in enumerate(T):
    if t == 'r':
        if i >= K and "p" == ans[-K]:
            ans += " "
        else:
            ans += 'p'
            score += P    

    elif t == 's':
        if i >= K and "r" == ans[-K]:
            ans += " "
        else:
            ans += 'r'
            score += R 
    else:
        if i >= K and 's' == ans[-K]:
            ans += " "
        else:
            ans += 's'
            score += S
print(score)                               

Verdicts: Runtime Error

Accepted
Problem: At an arcade, Takahashi is playing a game called _RPS Battle_ , which is played as follows:    * The player plays N rounds of Rock Paper Scissors against the machine. (See Notes for the description of Rock Paper Scissors. A draw also counts as a round.)   * Each time the player wins a round, depending on which hand he/she uses, he/she earns the following score (no points for a draw or a loss):     * R points for winning with Rock;     * S points for winning with Scissors;     * P points for winning with Paper.   * However, in the i-th round, the player cannot use the hand he/she used in the (i-K)-th round. (In the first K rounds, the player can use any hand.)  Before the start of the game, the machine decides the hand it will play in each round. With supernatural power, Takahashi managed to read all of those hands.  The information Takahashi obtained is given as a string T. If the i-th character of T (1 \leq i \leq N) is `r`, the machine will play Rock in the i-th round. Similarly, `p` and `s` stand for Paper and Scissors, respectively.  What is the maximum total score earned in the game by adequately choosing the hand to play in each round?

Submission attempts (in order):
N,K=map(int,input().split())
R,S,P=map(int,input().split())
T=input()

for i in range(N,K):
    if T[k+j]==T[j]:
        T[k+j]="x"
    
ans=T.count("r")*P+T.count("s")*R+T.count("p")*S

print(ans)

N,K=map(int,input().split())
R,S,P=map(int,input().split())
T=list(input())

for i in range(N-K):
    if T[K+i]==T[i]:
        T[K+i]="x"
    
ans=T.count("r")*P+T.count("s")*R+T.count("p")*S

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: At an arcade, Takahashi is playing a game called _RPS Battle_ , which is played as follows:    * The player plays N rounds of Rock Paper Scissors against the machine. (See Notes for the description of Rock Paper Scissors. A draw also counts as a round.)   * Each time the player wins a round, depending on which hand he/she uses, he/she earns the following score (no points for a draw or a loss):     * R points for winning with Rock;     * S points for winning with Scissors;     * P points for winning with Paper.   * However, in the i-th round, the player cannot use the hand he/she used in the (i-K)-th round. (In the first K rounds, the player can use any hand.)  Before the start of the game, the machine decides the hand it will play in each round. With supernatural power, Takahashi managed to read all of those hands.  The information Takahashi obtained is given as a string T. If the i-th character of T (1 \leq i \leq N) is `r`, the machine will play Rock in the i-th round. Similarly, `p` and `s` stand for Paper and Scissors, respectively.  What is the maximum total score earned in the game by adequately choosing the hand to play in each round?

Submission attempts (in order):
N, K = map(int, input().split(' '))
R, S, P = map(int, input().split(' '))
T = list(input())
print(T)
score = 0
A = T
for i in range(N-K):
  if T[i] == T[i+K]:
    A[i+K] = 'a'

for i in range(N):
  if A[i] == 'r':
    score += P
  elif A[i] == 's':
    score += R
  elif A[i] == 'p':
    score += S
print(score)

N, K = map(int, input().split(' '))
R, S, P = map(int, input().split(' '))
T = list(input())
score = 0
A = T
for i in range(N-K):
  if T[i] == T[i+K]:
    A[i+K] = 'a'

for i in range(N):
  if A[i] == 'r':
    score += P
  elif A[i] == 's':
    score += R
  elif A[i] == 'p':
    score += S
print(score)

Verdicts: Wrong Answer

Accepted
Problem: At an arcade, Takahashi is playing a game called _RPS Battle_ , which is played as follows:    * The player plays N rounds of Rock Paper Scissors against the machine. (See Notes for the description of Rock Paper Scissors. A draw also counts as a round.)   * Each time the player wins a round, depending on which hand he/she uses, he/she earns the following score (no points for a draw or a loss):     * R points for winning with Rock;     * S points for winning with Scissors;     * P points for winning with Paper.   * However, in the i-th round, the player cannot use the hand he/she used in the (i-K)-th round. (In the first K rounds, the player can use any hand.)  Before the start of the game, the machine decides the hand it will play in each round. With supernatural power, Takahashi managed to read all of those hands.  The information Takahashi obtained is given as a string T. If the i-th character of T (1 \leq i \leq N) is `r`, the machine will play Rock in the i-th round. Similarly, `p` and `s` stand for Paper and Scissors, respectively.  What is the maximum total score earned in the game by adequately choosing the hand to play in each round?

Submission attempts (in order):
n, k = map(int, input().split())
r, s, p = map(int, input().split())
d = {'r':r, 's':s, 'p':p}
t = input()
def janken(x):
    if x == 'r':
        return 'p'
    elif x == 's':
        return 'r'
    else:
        return 's'
l = ['']*k
for i in range(n):
    l[i%k] += t[i]
ans = 0
for i in l:
    dp = d(i[0]) + ['-1']*(len(i)-1)
    ans += d[janken(i[0])]
    for j in range(1, len(i)):
        if i[j] != i[j-1]:
            ans += d[janken(i[j])]
            dp[j] = d(i[j])
        else:
            dp[j] = d(i[j])
print(ans)

n, k = map(int, input().split())
r, s, p = map(int, input().split())
d = {'r':r, 's':s, 'p':p}
t = input()
def janken(x):
    if x == 'r':
        return 'p'
    elif x == 's':
        return 'r'
    else:
        return 's'
l = ['']*k
for i in range(n):
    l[i%k] += t[i]
ans = 0
for i in l:
    dp = [janken(i[0])] + ['-1']*(len(i)-1)
    ans += d[janken(i[0])]
    for j in range(1, len(i)):
        if janken(i[j]) != dp[j-1]:
            ans += d[janken(i[j])]
            dp[j] = janken(i[j])
        else:
            dp[j] = '0'
print(ans)

Verdicts: Runtime Error

Accepted