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()


score = {"s":R,"p":S,"r":P}

flag = [False for i in range(N)]
ans = 0
for i in range(N):
    if (flag[i]):
        s += "l"
    else:
        ans += score[T[i]]
        s += "w"
        if (N-i-1 >= K):
            if (T[i] == T[i+K]):
                flag[i+K] = True

print(ans)


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


score = {"s":R,"p":S,"r":P}

flag = [False for i in range(N)]
ans = 0
for i in range(N):
    if (flag[i]):
        pass
    else:
        ans += score[T[i]]
        if (N-i-1 >= K):
            if (T[i] == T[i+K]):
                flag[i+K] = True

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_ch = input()
t=[]
for i in range(n):
    t.append(t_ch[i])


for i in range(k-1, n):
    if t[i] == t[i-k]:
        t[i]=0
print(t)
for i in range(0,n):
    if t[i]=="r":
        t[i]=p
    elif t[i]=="p":
        t[i]=s
    elif t[i]=="s":
        t[i]=r
print(sum(t))    


n, k = (int(x) for x in input().split())
r, s, p = (int(x) for x in input().split())
t_ch = input()
t=[]
for i in range(n):
    t.append(t_ch[i])

for i in range(k, n):
    if t[i] == t[i-k]:
        t[i]=0
for i in range(0,n):
    if t[i]=="r":
        t[i]=p
    elif t[i]=="p":
        t[i]=s
    elif t[i]=="s":
        t[i]=r
print(sum(t))    


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 numpy as np
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
B = np.tile(np.array(A),(N,1))

N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = list(input())
j = 0
U = []
for i in T:
    if j < K:
        U.append(i)
    else:
        if U[j-K] == "o":
            U.append(i)
        elif T[j-K] == i:
            U.append("o")
        else:
            U.append(i)
    j += 1
print(U.count("r")*P+U.count("s")*R+U.count("p")*S)

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()

score = 0
for k in range(K):
    if T[k]=='r':
        score += P
    elif T[k]=='s':
        score += R
    else:
        score += S
    odd = False
    for n in range(K+k, N, K):
        print(n)
        if T[n-K] == T[n] and not odd:
            odd = True
        else:
            if T[n]=='r':
                score += P
            elif T[n]=='s':
                score += R
            else:
                score += S
            odd = False

print(score)

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

score = 0
for k in range(K):
    if T[k]=='r':
        score += P
    elif T[k]=='s':
        score += R
    else:
        score += S
    odd = False
    for n in range(K+k, N, K):
        if T[n-K] == T[n] and not odd:
            odd = True
        else:
            if T[n]=='r':
                score += P
            elif T[n]=='s':
                score += R
            else:
                score += S
            odd = False

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):
def main():
    import sys
    input = sys.stdin.readline

    N, K = map(int, input().split())
    RSP = list(map(int, input().split()))
    T = list(input().rsplit()[0])

    win_hand = ['s', 'p', 'r']


    ans = 0
    for i in range(N):
        for j in range(3):
            if T[i] == win_hand[j]:
                if i >= K:
                    if T[i] == T[i-K]:
                        continue
                ans += RSP[j]
    print(ans)


if __name__ == "__main__":
    main()


def main():
    import sys
    input = sys.stdin.readline

    N, K = map(int, input().split())
    RSP = list(map(int, input().split()))
    T = list(input().rsplit()[0])

    win_hand = ['s', 'p', 'r']
    ans = 0
    flag = True
    for i in range(N):
        for j in range(3):
            if T[i] == win_hand[j]:
                if i >= K:
                    if T[i] == T[i-K]:
                        if flag:
                            flag = False
                            continue
                        else:
                            flag = True
                        continue
                ans += RSP[j]
    print(ans)


if __name__ == "__main__":
    main()


def main():
    import sys
    input = sys.stdin.readline

    N, K = map(int, input().split())
    RSP = list(map(int, input().split()))
    T = list(input().rsplit()[0])

    win_hand = ['s', 'p', 'r']

    ans = 0
    hand = [0]*N
    for i in range(N):
        for j in range(3):
            if T[i] == win_hand[j]:
                if i >= K:
                    if T[i] == T[i-K] and T[i] == hand[i-K]:
                        continue
                hand[i] = win_hand[j]
                ans += RSP[j]
    print(ans)


if __name__ == "__main__":
    main()


Verdicts: Wrong Answer

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()

ret = 0
for i in range(1, K+1):
    prev = '?'
    for j in range(len(T) // K + 1):
        if i + K*j - 1 >= len(T):
            continue
        now = T[i + K*j - 1]
        print(i + K*j - 1)
        count+=1
        if prev == now:
            prev = '?'
        else:
            prev = now
            if now == 'r':  
                ret += P
            elif now == 's':
                ret += R
            else:
                ret += S
            
print(ret)

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

ret = 0
for i in range(1, K+1):
    prev = '?'
    for j in range(len(T) // K + 1):
        if i + K*j - 1 >= len(T):
            continue
        now = T[i + K*j - 1]
        
        if prev == now:
            prev = '?'
        else:
            prev = now
            if now == 'r':  
                ret += P
            elif now == 's':
                ret += R
            else:
                ret += S
            
print(ret)

      

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):
line1 = input().split(' ')
line2 = input().split(' ')
N = int(line1[0])
K = int(line1[1])
R = int(line2[0])
S = int(line2[1])
P = int(line2[2])
T = input()
score = 0
mem = list(range(K))

for i in range(N):
  index = i % K

  if (mem[index] != T[i:i+1]):
    if (T[i:i+1] == 'r'):
      score = score + R
    elif (T[i:i+1] == 's'):
      score = score + S
    elif (T[i:i+1] == 'p'):
      score = score + P
    mem[index] = T[i:i+1]
  else:
    mem[index] = 0

print(score)

line1 = input().split(' ')
line2 = input().split(' ')
N = int(line1[0])
K = int(line1[1])
R = int(line2[0])
S = int(line2[1])
P = int(line2[2])
T = input()
score = 0
mem = list(range(K))

for i in range(N):
  index = i % K

  if (mem[index] != T[i:i+1]):
    if (T[i:i+1] == 'r'):
      score = score + P
    elif (T[i:i+1] == 's'):
      score = score + R
    elif (T[i:i+1] == 'p'):
      score = score + S
    mem[index] = T[i:i+1]
  else:
    mem[index] = 0

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
R S P
T
"""

ln1 = input().split()
ln2 = input().split()
ln3 = input().split()

N, K = int(ln1[0]), int(ln1[1])
R, S, P = int(ln2[0]), int(ln2[1]), int(ln2[2])
T = ln3

point = 0

def janken_result(te):
    if te == "r":
        return P
    elif te == "s":
        return R
    elif te == "p":
        return S
    else:
        exit(0)

for i in range(N):
    if i < K:
        point += janken_result(T[i])
    elif T[i] != T[i-K]:
        point += janken_result(T[i])
    else:
        pass

print(point)


"""
N K
R S P
T
"""

ln1 = input().split()
ln2 = input().split()
ln3 = input().split()

N, K = int(ln1[0]), int(ln1[1])
R, S, P = int(ln2[0]), int(ln2[1]), int(ln2[2])
T = ln3

point = 0
result = []

def janken_result(te):
    if te == "r":
        return P
    elif te == "s":
        return R
    elif te == "p":
        return S
    else:
        exit(0)

for i in range(N):
    if i < K:
        point += janken_result(T[i])
        result.append(1)
    elif T[i] != T[i-K]:
        point += janken_result(T[i])
        result.append(1)
    else:
        if result[i-K] == 0:
            point += janken_result(T[i])
            result.append(1)
        else:
            result.append(0)
        
print(point)


"""
N K
R S P
T
"""

ln1 = input().split()
ln2 = input().split()
ln3 = input().split()

N, K = int(ln1[0]), int(ln1[1])
R, S, P = int(ln2[0]), int(ln2[1]), int(ln2[2])
T = ln3[0]

point = 0
result = []

def janken_result(te):
    if te == "r":
        return P
    elif te == "s":
        return R
    elif te == "p":
        return S
    else:
        exit(-1)

for i in range(N):
    if i < K:
        point += janken_result(T[i])
        result.append(1)
    elif T[i] != T[i-K]:
        point += janken_result(T[i])
        result.append(1)
    else:
        if result[i-K] == 0:
            point += janken_result(T[i])
            result.append(1)
        else:
            result.append(0)

print(point)


Verdicts: Wrong Answer

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())
takahashi = [0]*N
ans = 0
for i in range(N):
    janken = ['r', 's', 'p']         
    if i >= K:
        janken.remove(takahashi[i-K])
        
    if T[i] == 'r':
        if 'p' in janken:
            takahashi[i] = 'p'
            ans += P
        else:
            takahashi[i] = 'r'
    elif T[i] == 's':
        if 'r' in janken:
            takahashi[i]= 'r'
            ans += R
        else:
            takahashi[i] = 's'
    elif T[i] == 'p':
        if 's' in janken:
            takahashi[i] = 's'
            ans += S
        else:
            takahashi[i] = 'p'

print(takahashi)
print(ans)

from collections import Counter
N, K =map(int, input().split())
R, S, P = map(int, input().split())
T = list(input())
takahashi = [0]*N
for i in range(N):     
    if i < K:
        if T[i] == 'r':
            takahashi[i] = 'p'
        elif T[i] == 's':
            takahashi[i] = 'r'
        elif T[i] == 'p':
            takahashi[i] = 's'
            
    if i >= K:
        if T[i] == 'r' and takahashi[i-K] != 'p':
            takahashi[i] = 'p'
        elif T[i] == 's' and takahashi[i-K] != 'r':
            takahashi[i] = 'r'
        elif T[i] == 'p' and takahashi[i-K] != 's':
            takahashi[i] = 's'

c = Counter(takahashi)
print(R*c['r'] + S*c['s'] + P*c['p'])

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 = str(input())


n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = str(input())
syo = n//k 
total = 0
for i in range(k):
  for j in range(i, n, k):
    if j == i or score == 0 or t[j] ?= te:
      if t[j] = 'r'
      	score = p
      	total += p
        te = 'p'
      elif t[j] = 's'
      	score = r
      	total += r
        te = 'r'
      else:
        score = s
        total += s
        te = 's'
    else:
      score = 0
      
  
print(total)

n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = str(input())
syo = n//k 
total = 0
for i in range(k):
  te = ''
  score = 0
  for j in range(i, n, k):
    if score == 0 or t[j] != te:
      if t[j] == 'r':
        score = p
        total += p
        te = 'r'
      elif t[j] == 's':
        score = r
        total += r
        te = 's'
      else:
        score = s
        total += s
        te = 'p'
    else:
      score = 0
      
  
print(total)

Verdicts: 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):
args=input().split()
N=int(args[0])
K=int(args[1])
args=input().split()
R=int(args[0])
S=int(args[1])
P=int(args[2])
T=input()

resSS=[]
for i in T:
  if i=="r":
    resSS.append(P)
  elif i=="s":
    resSS.append(R)
  else:
    resSS.append(S)

if N>=K:
  for i in range(N-K):
    if T[i+K]==T[i]:
      resSS[i+K]=0
res=0
for i in resSS:
  res+=i
print(res)


args=input().split()
N=int(args[0])
K=int(args[1])
args=input().split()
R=int(args[0])
S=int(args[1])
P=int(args[2])
T=input()

resSS=[]
for i in T:
  if i=="r":
    resSS.append(P)
  elif i=="s":
    resSS.append(R)
  else:
    resSS.append(S)

if N>=K:
  for i in range(N-K):
    if T[i+K]==T[i] and resSS[i+K]==resSS[i]:
      resSS[i+K]=0
res=0
for i in resSS:
  res+=i
print(res)


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()

for i in range(n-k):
  if t[i] == t[i+k]:
    t[i+k] = 0
print(sum(t.count("r")*r + t.count("s")*s + t.count("p")*p))

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] = 0

print(sum([t.count("r")*p, t.count("s")*r, t.count("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):
def ten(arr,R,S,P):
  ans = 0
  num = 0
  length = len(arr)
  print(length)
  for i in range(length):
    if i == 0:
      if arr[i] == "r":
        ans = ans + P
        num = i
      elif arr[i] == "s":
        ans = ans + R
        num = i
      else:
        ans = ans + S
        num = i

    elif i > 0 and arr[i] != arr[i-1]:
      if arr[i] == "r":
        ans = ans + P
        num = i
      elif arr[i] == "s":
        ans = ans + R
        num = i
      else:
        ans = ans + S
        num = i
        
    elif i > 0 and arr[i] == arr[i-1] and int(num+1) != i:
      if arr[i] == "r":
        ans = ans + P
        num = i
      elif arr[i] == "s":
        ans = ans + R
        num = i
      else:
        ans = ans + S
        num = i
    
  return ans

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

T = list(T)
arr = []

for i in range(K):
  a = T[i::K]
  arr.append(a)

ans = 0

for i in arr:
  ans = ans + ten(i,R,S,P)

print(ans)


def ten(arr,R,S,P):
  ans = 0
  num = 0
  length = len(arr)
  for i in range(length):
    if i == 0:
      if arr[i] == "r":
        ans = ans + P
        num = i
      elif arr[i] == "s":
        ans = ans + R
        num = i
      else:
        ans = ans + S
        num = i

    elif i > 0 and arr[i] != arr[i-1]:
      if arr[i] == "r":
        ans = ans + P
        num = i
      elif arr[i] == "s":
        ans = ans + R
        num = i
      else:
        ans = ans + S
        num = i
        
    elif i > 0 and arr[i] == arr[i-1] and int(num+1) != i:
      if arr[i] == "r":
        ans = ans + P
        num = i
      elif arr[i] == "s":
        ans = ans + R
        num = i
      else:
        ans = ans + S
        num = i
    
  return ans

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

T = list(T)
arr = []

for i in range(K):
  a = T[i::K]
  arr.append(a)

ans = 0

for i in arr:
  ans = ans + ten(i,R,S,P)

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):
#!python3

def resolve():
    N, K = map(int, input().rstrip().split())
    R, S, P = map(int, input().rstrip().split())
    T = input().rstrip().split()

    score = {"r":  P, "s": R, "p": S}

    s = 0
    for i in range(i, K):
        s += score[T[i]]

    for i in range(K, N):
        if T[i-K] == T[i]:
            continue
        s += score[T[i]]

    print(s)

if __name__ == "__main__":
    resolve()


#!python3

def resolve():
    N, K = map(int, input().rstrip().split())
    R, S, P = map(int, input().rstrip().split())
    T = input().rstrip().split()

    score = {"r":  P, "s": R, "p": S}

    s = 0
    for i in range(i, K):
        s += score[T[i]]

    for i in range(K, N):
        if T[i-K] == T[i]:
            continue
        s += score[T[i]]

    print(s)

if __name__ == "__main__":
    resolve()


#!python3

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

    score = {"r":  P, "s": R, "p": S}

    s = 0
    for i in range(K):
        s += score[T[i]]

    for i in range(K, N):
        if T[i-K] == T[i]:
            T[i] = ""
            continue
        s += score[T[i]]

    print(s)

if __name__ == "__main__":
    resolve()


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):
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = list(input())
hand = {"r" : p, "s" : r, "p" : s}
ans = 0
for i in range(n-k):
  temp= i-k
  if temp >=0 and t[i]==t[temp]:
    t[i]=""
  else:
    ans+=hand[t[i]]
print(ans)

n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = list(input())
hand = {"r" : p, "s" : r, "p" : s}
ans = 0
for i in range(n):
  temp= i-k
  if temp >=0 and t[i]==t[temp]:
    t[i]=" "
  else:
    ans+=hand[t[i]]
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):
import sys
sys.setrecursionlimit(10000)
def conv(r,s,p,j):
    if j == 'r':
        return p
    if j == 's':
        return r
    if j == 'p':
        return s
def listint():
    a = input().split()
    for i in range(len(a)):
        a[i] = int(a[i])
    return a
def perse(t,k,num):
    stri = []
    point = []
    for i in range(k):
        stri.append([])
        point.append([])
    for i in range(num):
        stri[i%k].append(t[i])
        point[i%k].append(conv(r,s,p,t[i]))
    return stri,point
def main(q,r,s,p):
    if len(q) == 1:
        return point[0]
    if len(q) == 0:
        return 0
    if q[0] != q[1]:
        return main(q[1:],point[1:]) + point[0]
    else:
        return main(q[2:],point[2:]) + point[0]
num,k = listint()
r,s,p = listint()
t = input()
afterperse,point = perse(t,k,num)
ans = 0
for i in range(k):
    ans = ans + main(afterperse[i],point)
print(ans)

import sys
sys.setrecursionlimit(10000)
def conv(r,s,p,j):
    if j == 'r':
        return p
    if j == 's':
        return r
    if j == 'p':
        return s
def listint():
    a = input().split()
    for i in range(len(a)):
        a[i] = int(a[i])
    return a
def perse(t,k,num):
    stri = []
    for i in range(k):
        stri.append([])
    for i in range(num):
        stri[i%k].append(t[i])
    return stri
def main(q):
    i = 0
    ans = 0
    while i < len(q)-1:
        if q[i] == q[i+1]:
            ans = ans + conv(r,s,p,q[i])
            i = i+2
        else:
            ans = ans + conv(r,s,p,q[i])
            i = i+1
    if i == len(q)-1:
        ans = ans + conv(r,s,p,q[i])
    return ans
num,k = listint()
r,s,p = listint()
t = input()
afterperse = perse(t,k,num)
ans = 0
for i in range(k):
    ans = ans + main(afterperse[i])
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()

ans=[0]*N
i=0
while i<N:
    if i<K:
        if T[i]=='r':
            ans[i]=P
        elif T[i]=='s':
            ans[i]=R
        else:
            ans[i]=S
    else:
        if T[i]=='r':
            if T[i-K]=='r':
                ans[i]=0
            else:
                ans[i]=P
        elif T[i]=='s':
            if T[i-K]=='s':
                ans[i]=0
            else:
                ans[i]=R
        else:
            if T[i-K]=='p':
                ans[i]=0
            else:
                ans[i]=S
    i+=1

print(sum(ans))

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

ans=[0]*N
i=0
while i<N:
    if i<K:
        if T[i]=='r':
            ans[i]=P
        elif T[i]=='s':
            ans[i]=R
        else:
            ans[i]=S
    else:
        if T[i]=='r':
            if T[i-K]=='r'and ans[i-K]==P:
                ans[i]=0
            else:
                ans[i]=P
        elif T[i]=='s':
            if T[i-K]=='s'and ans[i-K]==R:
                ans[i]=0
            else:
                ans[i]=R
        else:
            if T[i-K]=='p'and ans[i-K]==S:
                ans[i]=0
            else:
                ans[i]=S
    i+=1

print(sum(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):
from sys import stdin
# import math
N, K = [int(x) for x in stdin.readline().rstrip().split()]
R, S, P = [int(x) for x in stdin.readline().rstrip().split()]
s = input()
ans = 0
d = {'r': P, 's': R, 'p': S}
# print(d)
temp = [0 for i in range(len(s))]
for i, v in enumerate(s):
    # print(i, v, temp)
    if i <= len(s)-K and temp[i] != 1:
        if d[s[i+K]] == d[s[i]]:
            ans += d[s[i]]
            temp[i+K] = 1
        else:
            ans += d[s[i]]
    else:
        if temp[i] != 1:
            ans += d[s[i]]
print(ans)


from sys import stdin
# import math
N, K = [int(x) for x in stdin.readline().rstrip().split()]
R, S, P = [int(x) for x in stdin.readline().rstrip().split()]
s = input()
ans = 0
d = {'r': P, 's': R, 'p': S}
# print(d)
temp = [0 for i in range(len(s))]
for i, v in enumerate(s):
    # print(i, v, temp)
    if i < len(s)-K and temp[i] != 1:
        if s[i+K] == s[i]:
            ans += d[s[i]]
            temp[i+K] = 1
        else:
            ans += d[s[i]]
    else:
        if temp[i] != 1:
            ans += d[s[i]]
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 = tuple(map(int, input().split(' ')))
r, s, p = tuple(map(int, input().split(' ')))
t = (input())
point = {'r':p, 's':r, 'p':s, 'any':0}
st = {i:t[i] for i in range(k)}
ans1 = sum(map(lambda x: point[x], t[:k]))
ans2 = 0
for i in range(k, n):
    h = t[i]
    m = i%k
    if st[m] != h:
        ans2 += point[h]
        st[m] = h
    else:
        st[m] = 'any' 
print(ans1 + ans2)
return

n, k = tuple(map(int, input().split(' ')))
r, s, p = tuple(map(int, input().split(' ')))
t = (input())
point = {'r':p, 's':r, 'p':s, 'any':0}
st = {i:t[i] for i in range(k)}
ans1 = sum(map(lambda x: point[x], t[:k]))
ans2 = 0
for i in range(k, n):
    h = t[i]
    m = i%k
    if st[m] != h:
        ans2 += point[h]
        st[m] = h
    else:
        st[m] = 'any' 
print(ans1 + ans2)

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
for i in range(N):
    if i >= K:
        if T[i] == T[i-K]:
            continue

    if T[i] == "r":
        ans += P
    elif T[i] == "s":
        ans += R
    else:
        ans += S
print(ans)


N,K = map(int,input().split())
R,S,P = map(int,input().split())
T = input()
ans = 0
me = []
for i in range(N):
    if T[i] == "r":
        ans += P
        log = P
        me.append("p")
    elif T[i] == "s":
        ans += R
        log = R
        me.append("r")
    else:
        ans += S
        log = S
        me.append("s")
    if i>=K:
        if me[i] == me[i-K]:
            ans -= log
            if (i+K) < N:
                if T[i+K] == "r":
                    if me[i-K] != "s":
                        me[i] = "s"
                    else:
                        me[i] = "r"
                if T[i+K] == "s":
                    if me[i-K] != "p":
                        me[i] = "p"
                    else:
                        me[i] = "s"
                if T[i+K] == "p":
                    if me[i-K] != "r":
                        me[i] = "r"
                    else:
                        me[i] = "p"
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(str(i) for i in input())

ans = [0] * n
def janken(te):
  if te == 'r':
    return p
  elif te == 's':
    return r
  else:
    return s
    
for i in range(n):
  konkai = janken(t[i])
  if i < k:
    ans[i] = konkai
  elif ans[i-k] != konkai:
    ans[i] = konkai
  else:
    ans[i] = 0

n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = list(str(i) for i in input())

ans = [0] * n
def janken(te):
  if te == 'r':
    return p
  elif te == 's':
    return r
  else:
    return s
    
for i in range(n):
  konkai = janken(t[i])
  if i < k:
    ans[i] = konkai
  elif ans[i-k] != konkai:
    ans[i] = konkai
  else:
    if t[i-k] == t[i]:
      ans[i] = 0
    else:
      ans[i] = konkai
print(sum(ans))

Verdicts: Wrong Answer

Accepted