TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: Find the minimum prime number greater than or equal to X.

Submission attempts (in order):
x=input()
x=int(x)
while True:
  for i in range(2, int(x/2)):
    if x%i==0:
      x+=1
      break
    else:
      print(x)

def waru(x):
  for i in range(2, x):
    if x%i==0:
      return 1
    if i==x-1:
      return 2
x=input()
x=int(x)
while True:
  if waru(x)==1:
    x+=1
  else:
    print(x)
    break

Verdicts: Time Limit Exceeded

Accepted
Problem: Find the minimum prime number greater than or equal to X.

Submission attempts (in order):
def isPrime(x):
  i = 2
  while i*i <= x:
    if x % i == 0:
      return True
  return False

X = int(input())
ans = X
while not isPrime(ans):
  ans += 1
print(ans)


def isPrime(x):
  i = 2
  while i*i <= x:
    if x % i == 0:
      return True
  return False

X = int(input())
ans = X
while not isPrime(x):
  ans += 1
print(ans)


prime_table = [True]*(2*(10**5)+1)
prime_table[0], prime_table[1] = False, False
i = 2
while i * i <= 2*(10**5):
  if prime_table[i]:
    j = i*i
    while j <= 2*(10**5):
      prime_table[j] = False
      j += i
  i += 1
x = int(input())
ans = x
while not prime_table[ans]:
  ans += 1
print(ans)


Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: Find the minimum prime number greater than or equal to X.

Submission attempts (in order):
MAX_X = 10 ** 5
buffer = 10 ** 3
prime_flags = [1 for _ in range(MAX_X + buffer)]

for i in range(MAX_X + buffer):
  num = i
  while num < MAX_X + buffer:
    num += i
    prime_flags[num] = 0

X = int(input().strip())
for i, flag in enumerate(prime_flags[X:]):
  if flag == 1:
    print(X + i)
    break
    

MAX_X = 10 ** 5
buffer = 10 ** 3
prime_flags = [1 for _ in range(MAX_X + buffer)]

for i in range(2, MAX_X + buffer):
  num = i
  if prime_flags[num] == 0:
    continue
  while num + i < len(prime_flags):
    num += i
    prime_flags[num] = 0

X = int(input().strip())
for i, flag in enumerate(prime_flags[X:]):
  if flag == 1:
    print(X + i)
    break
    


Verdicts: Time Limit Exceeded

Accepted
Problem: Find the minimum prime number greater than or equal to X.

Submission attempts (in order):
a = int(input())

def mark(s, x):
    for i in range(x + x, len(s), x):
        s[i] = False

def sieve(n):
    s = [True] * n
    for x in range(2, int(n**0.5) + 1):
        if s[x]: mark(s, x)
    return [i for i in range(0,n) if s[i] and i => a]

s = sieve(a * 2)
print(s[0])

a = int(input())

def mark(s, x):
    for i in range(x + x, len(s), x):
        s[i] = False

def sieve(n):
    s = [True] * n
    for x in range(2, int(n**0.5) + 1):
        if s[x]: mark(s, x)
    return [i for i in range(0,n) if s[i] and i >= a]

s = sieve(a * 2)
print(s[0])

Verdicts: Runtime Error

Accepted
Problem: Find the minimum prime number greater than or equal to X.

Submission attempts (in order):
def isPrime(n):
    if (n > 2 and n % 2 == 0) return False
    i = 3
    while (i <= mySqrt(n)):
        if (n % i == 0):
            return false
        i += 2;
    return n > 1


n = int(input())
while !isPrime(n):
  n += 1
print(n)


def isPrime(n):
    if (n > 2 and n % 2 == 0) return False
    i = 3
    while (i <= mySqrt(n)):
        if (n % i == 0):
            return False
        i += 2;
    return n > 1
 
 
n = int(input())
while !isPrime(n):
  	n += 1
print(n)

from math import sqrt


def isPrime(n):
    if n > 2 and n % 2 == 0: return False
    i = 3
    while i <= sqrt(n):
        if n % i == 0:
            return False
        i += 2
    return n > 1


n = int(input())
while not isPrime(n):
    n += 1
print(n)


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Find the minimum prime number greater than or equal to X.

Submission attempts (in order):
def check_prime(num):
  for i in range(2,num):
    if (x % i == 0):
      return False
      break
  else: 
    return True
 
if _name_ == "_main_":
  x = int(input())
  flag = True
  
  while flag: 
    if (check_prime(x)):
      print(x)
      flag = False
    else: 
      x = x + 1

def check_prime(num):
  for i in range(2,num):
    if (x % i == 0):
      return False
      break
  else: 
    return True
 
if __name__ == "__main__":
  x = int(input())
  flag = True
  while flag: 
    if (check_prime(x)):
      print(x)
      flag = False
    else: 
      x = x + 1

Verdicts: Runtime Error

Accepted
Problem: Find the minimum prime number greater than or equal to X.

Submission attempts (in order):
limit = 100000
def resolve()
	N = int(input())
  	for k in range(N, limit+1):
        if k % 2 == 0 and k != 2:
            continue
        for divisor in range(2, math.floor(math.sqrt(k))+1):
            if k % divisor == 0:
              	print(k)
                break
resolve()

limit = 100003
import math
def resolve():
    N = int(input())
    for k in range(N, limit+1):
        factor = 0
        if k % 2 == 0 and k != 2:
            continue
        for divisor in range(2, math.floor(math.sqrt(k))+1):
            if k % divisor == 0:
                factor += 1
        if factor == 0:
                return k
print(resolve())

Verdicts: Runtime Error

Accepted
Problem: Find the minimum prime number greater than or equal to X.

Submission attempts (in order):
nn=int(input())
n=10**5+1
ar=[0]*(n)
ar[1]=0
ans=0
pre=1
for i in range(2,n):
    if ar[i]==0:

        for j in range(2*i,n,i):
            ar[j]=1
ans=1
for i in range(2,nn+1):
    if ar[i]==0:
        ans=i
print(ans)
    

nn=int(input())
n=10**5+100
ar=[0]*(n)
ar[1]=0
ans=0
pre=1
for i in range(2,(n**0.5)+1):
    if ar[i]==0:

        for j in range(2*i,n,i):
            ar[j]=1
ans=1
if ar[nn]==0:
    print(nn)
else:
        
    for i in range(nn,n):
        if ar[i]==0:
            print(i)
            break
        

        

nn=int(input())
n=10**5+100
ar=[0]*(n)
ar[1]=0
ans=0
pre=1
for i in range(2,int((n**0.5))+1):
    if ar[i]==0:

        for j in range(2*i,n,i):
            ar[j]=1
ans=1
if ar[nn]==0:
    print(nn)
else:
        
    for i in range(nn,n):
        if ar[i]==0:
            print(i)
            break
        

        

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):
def main():
    n = int(input())
    if n % 2:
        print(0)
    else:
        n //= 2
        i = 5
        answer = 0
        while i <= n:
            answer += n // i
            i *= 5
        print(answer)


if __name__ == '__main__':
    main()



def main():
    n, k = map(int, input().split())
    r, s, p = map(int, input().split())
    t = list(input())
    score = {"r": p, "s": r, "p": s}
    answer = 0
    for i in range(n):
        if i < k:
            answer += score[t[i]]
            if i + k < n and t[i] == t[i + k]:
                t[i + k] = t[i + k] + "*"
        elif i + k < n:
            if "*" not in t[i]:
                answer += score[t[i][0]]
                if t[i][0] == t[i + k][0]:
                    t[i + k] = t[i + k] + "*"
        else:
            if "*" not in t[i]:
                answer += score[t[i][0]]
    print(answer)


if __name__ == '__main__':
    main()



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

res = [0]*N
hands = ["r", "s", "p"]

for i in range(N):
    res[i] = hands[hands.index(T[i])-1]

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

score = R*res.count("r") + S*res.count("s") + P*res.count("p")
print(res)
print(R*res.count("r"), S*res.count("s"), P*res.count("p"))
print(score)


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

res = [0]*N
hands = ["r", "s", "p"]

for i in range(N):
    res[i] = hands[hands.index(T[i])-1]

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

score = R*res.count("r") + S*res.count("s") + P*res.count("p")
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 = input("N:K").split()
N = int(N_K[0])
K = int(N_K[1])

R_S_P = input("R:S:P").split()
R = int(R_S_P[0])
S = int(R_S_P[1])
P = int(R_S_P[2])

T = input("T")

win_strategy = {
    "r": "p",
    "s": "r",
    "p": "s"
}

decision = ""
for index, value in enumerate(T):
    if (index <= K-1):
        decision += win_strategy[value]
    else:
        if (win_strategy[value] == decision[index-K]):
            decision += value
        else:
            decision += win_strategy[value]

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

points = 0
for i in range(N):
    if (decision[i] != T[i]):
        points += point_acquire[decision[i]]

print(points)

N_K = input().split()
N = int(N_K[0])
K = int(N_K[1])

R_S_P = input().split()
R = int(R_S_P[0])
S = int(R_S_P[1])
P = int(R_S_P[2])

T = input()

win_strategy = {
    "r": "p",
    "s": "r",
    "p": "s"
}

decision = ""
for index, value in enumerate(T):
    if (index >= K and win_strategy[value] == decision[index-K]):
        decision += "X"
    else:
        decision += win_strategy[value]

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

points = decision.count('r')*R + decision.count('s')*S + decision.count('p')*P
print(points)


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 math
import sys

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


#print(R,S,P)
#print(T)

def maxp(s):
    vr = 0
    vs = 0
    vp = 0
    for i in range(0,len(s)):
        if s[i] == 'r':
            nvr = 0 + max(vs,vp)
            nvs = 0 + max(vp,vr)
            nvp = P + max(vr,vs)
        elif s[i] == 's':
            nvr = R + max(vs,vp)
            nvs = 0 + max(vp,vr)
            nvp = 0 + max(vr,vs)
        else:
            nvr = 0 + max(vs,vp)
            nvs = S + max(vp,vr)
            nvp = 0 + max(vr,vs)
        vr = nvr
        vs = nvs
        vp = nvp
        
    return(max(vr,vs,vp))
ans=0
for i in range(0,K):
    p = ""
    for k in range(i,len(T),K):
        p = p + T[k]
    #print(p)
    ans  = ans + maxp(p)

import math
import sys

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


#print(R,S,P)
#print(T)

def maxp(s):
    vr = 0
    vs = 0
    vp = 0
    for i in range(0,len(s)):
        if s[i] == 'r':
            nvr = 0 + max(vs,vp)
            nvs = 0 + max(vp,vr)
            nvp = P + max(vr,vs)
        elif s[i] == 's':
            nvr = R + max(vs,vp)
            nvs = 0 + max(vp,vr)
            nvp = 0 + max(vr,vs)
        else:
            nvr = 0 + max(vs,vp)
            nvs = S + max(vp,vr)
            nvp = 0 + max(vr,vs)
        vr = nvr
        vs = nvs
        vp = nvp
        
    return(max(vr,vs,vp))
ans=0
for i in range(0,K):
    p = ""
    for k in range(i,len(T),K):
        p = p + T[k]
    #print(p)
    ans  = ans + maxp(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 = input()

r1 = []
for j in range(N):
	if T[j] == 'r':
		r1.append(P)
	elif T[j] == 's':
		r1.append(R)
	else:
		r1.append(S)

for i in range(K,N):
	if r1[i] == r1[i - K]:
		if r1[i] != r1[i - K * 2] and (i - K * 2) > -1:
			r1[i] = 0
print(sum(r1))

import sys
read = sys.stdin.read
readlines = sys.stdin.readlines

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

    dp = [[0] * 3 for _ in range(n + k)]
    for i1 in range(k):
        i2 = i1 + k
        while i2 - k < n:
            dp[i2][0] = max(dp[i2-k][1], dp[i2-k][2])
            dp[i2][0] += r if t[i2-k] == 's' else 0
            dp[i2][1] = max(dp[i2-k][0], dp[i2-k][2])
            dp[i2][1] += s if t[i2-k] == 'p' else 0
            dp[i2][2] = max(dp[i2-k][0], dp[i2-k][1])
            dp[i2][2] += p if t[i2-k] == 'r' else 0
            i2 += k
    print(*dp, sep='\n')
    r = 0
    for j1 in range(-k, 0, 1):
        r += max(dp[j1])
    print(r)

if __name__ == '__main__':
    main()


import sys
read = sys.stdin.read
readlines = sys.stdin.readlines

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

    dp = [[0] * 3 for _ in range(n + k)]
    for i1 in range(k):
        i2 = i1 + k
        while i2 - k < n:
            dp[i2][0] = max(dp[i2-k][1], dp[i2-k][2])
            dp[i2][0] += r if t[i2-k] == 's' else 0
            dp[i2][1] = max(dp[i2-k][0], dp[i2-k][2])
            dp[i2][1] += s if t[i2-k] == 'p' else 0
            dp[i2][2] = max(dp[i2-k][0], dp[i2-k][1])
            dp[i2][2] += p if t[i2-k] == 'r' else 0
            i2 += k
    r = 0
    for j1 in range(-k, 0, 1):
        r += max(dp[j1])
    print(r)

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

a=0
b=0
c=0

if K>N:
  for i in range(N):
    if T[i]=="r":
      c+=1
    if T[i]=="s":
      a+=1
    if T[i]=="p":
      b+=1
  print(a*R+b*S+c*P)
else: 
  for i in range(K):
    if T[i]=="r":
      c+=1
    if T[i]=="s":
      a+=1
    if T[i]=="p":
      b+=1
  print(a,b,c)
  for j in range(K,N):
    if T[j]=="r":
      if T[j-K]=="r":
        c+=1
      if T[j-K]=="s":
        c+=1
      if T[j-K]=="p":
        pass
    if T[j]=="s":
      if T[j-K]=="r":
        pass
      if T[j-K]=="s":
        a+=1
      if T[j-K]=="p":
        a+=1
    if T[j]=="p":
      if T[j-K]=="r":
        b+=1
      if T[j-K]=="s":
        pass
      if T[j-K]=="p":
        b+=1
  print(a,b,c)
  print(a*R+b*S+c*P)

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

ans = 0
for i in range(N):
  if i<=K-1:
    if T[i]== "r":
      ans += P
    elif T[i]=="s":
      ans += R
    else:
      ans += S
    #print(i,ans)
  else:
    #print(i,f_l[i%K])
    if T[i]==T[i-K]:
      if f_l[i%K]==True: 
        f_l[i%K]=False
      else:
        f_l[i%K]=True
    else:
      f_l[i%K]=False
    if f_l[i%K]==False:
      if T[i]== "r":
        ans += P
      elif T[i]=="s":
        ans += R
      else:
        ans += S
    #print(i,ans)
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):
from collections import deque

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

best_hand = {'r': 'p', 's': 'r', 'p': 's'}
ban = []
cand = ''

while t:
    cpu = t.popleft()
    
    if len(ban) < k:
        add_hand = best_hand[cpu]
    else:
        ban_hand = ban.pop(0)
        if best_hand[cpu] == ban_hand:
            add_hand = 'e'
        else:
            add_hand = best_hand[cpu]
    ban.append(add_hand)
    cand += add_hand
    
print(p*cand.count('p') + s*cand.count('s') + r*cand.count('r'))
print(cand)

from collections import deque

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

best_hand = {'r': 'p', 's': 'r', 'p': 's'}
ban = []
cand = ''

while t:
    cpu = t.popleft()
    
    if len(ban) < k:
        add_hand = best_hand[cpu]
    else:
        ban_hand = ban.pop(0)
        if best_hand[cpu] == ban_hand:
            add_hand = 'e'
        else:
            add_hand = best_hand[cpu]
    ban.append(add_hand)
    cand += add_hand
    
print(p*cand.count('p') + s*cand.count('s') + r*cand.count('r'))

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 collections import deque
N,K = (int(x) for x in input().split())
R,S,P = (int(x) for x in input().split())
T = input()
count = 0
prog = 0
checker = ""
l = list(T)
d = deque(l)
for hand in l:
    if prog >= K:
        if hand == "r" and hand != checker:
            count += P
            checker = d.popleft()
        elif hand == "s" and hand != checker:
            count += R
            checker = d.popleft()
        elif hand == "p" and hand != checker:
            count += S
            checker = d.popleft()
        else:
            checker = d.popleft() + " "
    else:
        prog += 1
        if hand == "r":
            count += P
        elif hand == "s":
            count += R
        else:
            count += S
        if prog >= K:
            checker = d.popleft()
print(count)

from collections import deque
N,K = (int(x) for x in input().split())
R,S,P = (int(x) for x in input().split())
T = input()
count = 0
prog = 0
checker = ""
l = list(T)
d = deque(l[0:K])
for hand in l:
    if prog >= K:
        if hand == "r" and hand != checker:
            count += P
            d.append(hand)
            checker = d.popleft()
        elif hand == "s" and hand != checker:
            count += R
            d.append(hand)
            checker = d.popleft()
        elif hand == "p" and hand != checker:
            count += S
            d.append(hand)
            checker = d.popleft()
        else:
            d.append(hand+" ")
            checker = d.popleft()
    else:
        prog += 1
        if hand == "r":
            count += P
        elif hand == "s":
            count += R
        else:
            count += S
        if prog >= K:
            checker = d.popleft()
print(count)

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 = {'r':p, 's':r, 'p':s}
from collections import deque
past = deque([])

ans = 0
for i in range(n):
  past.append(t[i])
  if i < k:
    ans += score[t[i]]
  else:
    if past.popleft() != t[i]:
      ans += score[t[i]]
print(ans)
    
    

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

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


ans = 0
memo = []

for i in range(n):
  if i < k:
    ans += scores[T[i]]
    memo.append(T[i])
  else:
    if memo[i-k] == T[i]:
      memo.append('N')
    else:
      ans += scores[T[i]]
      memo.append(T[i])
print(ans)
      

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

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


ans = 0
memo = []

for i in range(n):
  if i < k:
    ans += scores[T[i]]
    memo.append(T[i])
  else:
    if memo[i-k] == T[i]:
      memo.append('N')
    else:
      ans += scores[T[i]]
      memo.append(T[i])
print(ans)
      

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):
n,k = (int(w) for w in input().split()[:2])
r,s,p = (int(w) for w in input().split()[:3])
t = input()

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

x = sum(score[h[t[i]]] for i in range(k))

x += sum(score[h[c]] for c,cp in zip(t[k:], t) if c!=cp)

print(x)


n,k = (int(w) for w in input().split()[:2])
r,s,p = (int(w) for w in input().split()[:3])
t = input()

h = {'r': 'p', 's': 'r', 'p': 's'}
score = {'r': r, 's': s, 'p': p, 'e': 0}

z = [h[c] for c in t]
for i in range(k, n):
    if z[i]==z[i-k]: z[i] = 'e'

x = sum(score[v] for v in z)

print(x)


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())
scores=list(map(int,input().split()))
t=input()
winner={'r':2,'s':0,'p':1}
ans=0
for i in range(k):
  ts=''
  for j in range(n):
    if k*j+i>=n:
      break
    ts+=t[k*j+i]
  print(ts)
  ts+='?'
  l=len(ts)
  hand=ts[0]
  cnt=1
  for j in range(1,l):
    if hand==ts[j]:
      cnt+=1
    else:
      ans+=scores[winner[hand]]*((cnt+1)//2)
      hand=ts[j]
      cnt=1
print(ans)

n,k=map(int,input().split())
scores=list(map(int,input().split()))
t=input()
winner={'r':2,'s':0,'p':1}
ans=0
for i in range(k):
  ts=''
  for j in range(n):
    if k*j+i>=n:
      break
    ts+=t[k*j+i]
  ts+='?'
  l=len(ts)
  hand=ts[0]
  cnt=1
  for j in range(1,l):
    if hand==ts[j]:
      cnt+=1
    else:
      ans+=scores[winner[hand]]*((cnt+1)//2)
      hand=ts[j]
      cnt=1
print(ans)

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

hands = ['r', 's', 'p']
for i,t in enumerate(T):
    if t == 'r':
        T[i] = 'p'
    elif t == 's':
        T[i] = 'r'
    else:
        T[i] = 's'
point = 0
for i,t in enumerate(T):
    if i+1 <= K:
        if t == 'r':
            point += R
        elif t == 's':
            point += S
        else:
            point += P
        continue
    print(i)
    if t == T[i-K]:
        # print(i)
        a = 0
        if len(T)-1 < i+K:
            next_hand = T[i]
        else:
            next_hand = T[i+K]
        while T[i] == T[i-K] or T[i] == next_hand:
            T[i] = hands[a]
            a += 1
    else:
        if t == 'r':
            point += R
        elif t == 's':
            point += S
        else:
            point += P
print(point)

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

hands = ['r', 's', 'p']
for i,t in enumerate(T):
    if t == 'r':
        T[i] = 'p'
    elif t == 's':
        T[i] = 'r'
    else:
        T[i] = 's'
point = 0
for i,t in enumerate(T):
    if i+1 <= K:
        if t == 'r':
            point += R
        elif t == 's':
            point += S
        else:
            point += P
        continue
    if t == T[i-K]:
        a = 0
        if len(T)-1 < i+K:
            next_hand = T[i]
        else:
            next_hand = T[i+K]
        while T[i] == T[i-K] or T[i] == next_hand:
            T[i] = hands[a]
            a += 1
    else:
        if t == 'r':
            point += R
        elif t == 's':
            point += S
        else:
            point += P
print(point)

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=[int(i) for i in input().split()]
r,s,p=[int(i) for i in input().split()]
hand=input()
ans=0
for i in range(k):
  free=True
  j=i
  while j<n:
    if free=True or hand[j-k]!=hand[j]:
      if hand[j]='r':
        ans+=p
      elif hand[j]='s':
        ans+=r
      else:
        ans+=s
      free=False
    else:
      free=True
    j+=k
print(ans)

n,k=[int(i) for i in input().split()]
r,s,p=[int(i) for i in input().split()]
hand=input()
ans=0
for i in range(k):
  free=True
  j=i
  while j<n:
    if free=True or hand[j-k]!=hand[j]:
      if hand[j]=='r':
        ans+=p
      elif hand[j]=='s':
        ans+=r
      else:
        ans+=s
      free=False
    else:
      free=True
    j+=k
print(ans)

n,k=[int(i) for i in input().split()]
r,s,p=[int(i) for i in input().split()]
hand=input()
ans=0
for i in range(k):
  free=True
  j=i
  while j<n:
    if free==True or hand[j-k]!=hand[j]:
      if hand[j]=='r':
        ans+=p
      elif hand[j]=='s':
        ans+=r
      else:
        ans+=s
      free=False
    else:
      free=True
    j+=k
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):
N,K=map(int,input().split())
R,S,P=map(int,input().split()) 
T=list(input())

c=0

def jan(a):
    if a=="r":
        return P
    elif a=="s":
        return R
    elif a=="p":
        return S
    else:
        return 0

for i in range(1,N):
    if T[i]==T[i-1]:
        T[i]="o"

for i in range(1,K+1): #modK
    for j in range(N//K+1):
        if i+K*j>N:
            continue
        c+=jan(T[i+K*j-1])

print(c)

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

c=0

def jan(a):
    if a=="r":
        return P
    elif a=="s":
        return R
    elif a=="p":
        return S
    else:
        return 0

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

for i in T:
    c+=jan(i)

print(c)

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())
for i in range(n-k):
    if t[i+k] == t[i]:
        t[i+k] == 0
x = t.count("r")*p+t.count("S")*r+t.count("p")*s
print(x)

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] = 0
xs = t.count('r')*p+ t.count('s')*r+t.count('p')*s
print(x)

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+k] == t[i]:
        t[i+k] == 0
x = t.count("r")*p+t.count("S")*r+t.count("p")*s
print(x)

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] == 0
x = t.count("r")*p+ t.count("s")*r+ t.count("p")*s
print(x)

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+k] == t[i]:
        t[i+k] == 0
x = t.count("r")*p+t.count("s")*r+t.count("p")*s
print(x)

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+a] == t[a]:
        t[k+a] = 0
xs = t.count('r')*p+ t.count('s')*r+t.count('p')*s
print(x)

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] = 0
x = t.count('r')*p+ t.count('s')*r+t.count('p')*s
print(x)

Verdicts: Runtime Error

Runtime Error

Wrong Answer

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):
# d
n, k = [int(i) for i in input().split()]
r, s, p = [int(i) for i in input().split()]
t = np.array(list(input()))
point = 0
for i in range(k):
    if t[i] == 'r':
        point += p
    elif t[i] == 's':
        point += r
    else:
        point += s

for i in range(k, n):
    if t[i] != t[i-k]:
        if t[i] == 'r':
            point += p
        elif t[i] == 's':
            point += r
        else:
            point += s
    else:
        t[i] = ''

print(point)

# d
n, k = [int(i) for i in input().split()]
r, s, p = [int(i) for i in input().split()]
t = np.array(list(input()))
point = 0
for i in range(k):
    if t[i] == 'r':
        point += p
    elif t[i] == 's':
        point += r
    else:
        point += s

for i in range(k, n):
    if t[i] != t[i-k]:
        if t[i] == 'r':
            point += p
        elif t[i] == 's':
            point += r
        else:
            point += s
    else:
        t[i] = ""

print(point)

# d
import numpy as np
n, k = [int(i) for i in input().split()]
r, s, p = [int(i) for i in input().split()]
t = np.array(list(input()))
t = np.where(t == 'r', p, t)
t = np.where(t == 's', r, t)
t = np.where(t == 'p', s, t)
t = t.astype(dtype='int64')
tt = t
point = 0
point += np.sum(t[:k])

for i in range(k+1,n):
    if t[i] == t[i-k]:
        pass
    elif t[i] != t[i-k]:
        point += t[i]

print(point)

# d
n, k = [int(i) for i in input().split()]
r, s, p = [int(i) for i in input().split()]
t = list(input())
point = 0
for i in range(k):
    if t[i] == 'r':
        point += p
    elif t[i] == 's':
        point += r
    else:
        point += s

for i in range(k, n):
    if t[i] != t[i-k]:
        if t[i] == 'r':
            point += p
        elif t[i] == 's':
            point += r
        else:
            point += s
    else:
        t[i] = ''

print(point)

Verdicts: Runtime Error

Runtime Error

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

win={"r":"p","s":"r","p":"s"}
score={"r":r,"s":s,"p":p}
total=0
already=[]
for i in range(k):
    win_hand=win[tl[i]]
    already.append(win_hand)
    total+=score[win_hand]
temp=["r","s","p"]
for j in range(k,n):
    temp=["r","s","p"]
    win_hand=win[tl[j]]
    print(j-k)
    if already[j-k]==win_hand:
        temp.remove(win_hand)
        if j+k <= n-1:
            keep=win[tl[j+k]]
            if not keep in temp:
                already.append(temp[0])
            else:
                temp.remove(keep)
                already.append(temp[0])
        else:
            already.append(temp[0])
        pass
    else:
        already.append(win_hand)
        total+=score[win_hand]
print(total)








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

win={"r":"p","s":"r","p":"s"}
score={"r":r,"s":s,"p":p}
total=0
already=[]
for i in range(k):
    win_hand=win[tl[i]]
    already.append(win_hand)
    total+=score[win_hand]
temp=["r","s","p"]
for j in range(k,n):
    temp=["r","s","p"]
    win_hand=win[tl[j]]
    #print(j-k)
    if already[j-k]==win_hand:
        temp.remove(win_hand)
        if j+k <= n-1:
            keep=win[tl[j+k]]
            if not keep in temp:
                already.append(temp[0])
            else:
                temp.remove(keep)
                already.append(temp[0])
        else:
            already.append(temp[0])
        pass
    else:
        already.append(win_hand)
        total+=score[win_hand]
print(total)








Verdicts: Wrong Answer

Accepted