Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):

    def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0

def modinv(a, m):
    g, x, y = xgcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m

x, y = map(int, input().split())
inf = 10**9+7
if (x+y)%3 > 0:
  print(0)
else:
  n = (x+y)//3
  c = [1 for i in range(n+1)]
  invc = [1 for i in range(n+1)]
  for i in range(1, n+1):
    c[i] = c[i-1]*i % inf
    invc[i] = modinv(c[i], inf)
  cnt=-1
  for i in range(n+1):
    if (i+2*(n-i)==x)&(2*i+(n-i)==y):
      cnt = i
      break
  if cnt < 0:
    ans = 0
  else:
    ans = (c[n] * invc[cnt] * invc[n-cnt]) % inf
  print(ans)
    

Fixed submission:
def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0
  
def modinv(a, m):
    g, x, y = xgcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m
x, y = map(int, input().split())
inf = 10**9+7
if (x+y)%3 > 0:
  print(0)
else:
  n = (x+y)//3
  c = [1 for i in range(n+1)]
  invc = [1 for i in range(n+1)]
  for i in range(1, n+1):
    c[i] = c[i-1]*i % inf
    invc[i] = modinv(c[i], inf)
  cnt=-1
  for i in range(n+1):
    if (i+2*(n-i)==x)&(2*i+(n-i)==y):
      cnt = i
      break
  if cnt < 0:
    ans = 0
  else:
    ans = (c[n] * invc[cnt] * invc[n-cnt]) % inf
  print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
cost = []
i = 2
while i =< n**0.5:
  if n % i == 0:
    cost.append(i+n/i-2)
  i += 1
if len(cost) == 0:
  cost.append(n-1)
print(int(min(cost)))

Fixed submission:
n = int(input())
cost = []
i = 2
while i <= n**0.5:
  if n % i == 0:
    cost.append(i+n/i-2)
  i += 1
if len(cost) == 0:
  cost.append(n-1)
print(int(min(cost)))
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input())
ans = a - 2 * b
if ans < 0:
  ans = 0
print(ans)

Fixed submission:
a, b = map(int, input().split())
ans = a - 2 * b
if ans < 0:
  ans = 0
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = str(input())
ans = ''
for i in range(n):
  if i == 0:
    ans += s[i]
  elif ans[-1] != s[i]:
    ans += s[i]
print(len(ans))
  

Fixed submission:
n = int(input())
s = input()
prev = ''
ans = 0
for i in range(n):
  if s[i] != prev:
    ans += 1
    prev = s[i]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0
for i in range(n - 2):
  for j in range(i + 1, n - 1):
    for k in range(j + 1, n):
      if l[k] >= l[i] + l[j]:
        break
      ans += 1
print(ans)

Fixed submission:
n = int(input())
l_list = list(map(int, input().split()))
l_list.sort()
count = [0 for i in range(2000)]
cum = [0 for i in range(2000)]
for l in l_list:
  count[l] += 1
for i in range(1, 2000):
  cum[i] = cum[i - 1] + count[i]

ans = 0
cnt = 0
for i in range(n - 2):
  for j in range(i + 1, n - 1):
    ans += cum[l_list[i] + l_list[j] - 1] - j - 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
a, b = map(int, input().split())
l_value = max([a, b])
s_value = min([a, b])
temp_list = []
for i in range(1, s_value + 1):
  if s_value % i == 0:
    temp_list.append(i)
dev_list = []
for i in temp_list:
  if i == 1 or i == 2:
    dev_list.append(i)
  else:
    for j in range(2, i):
      if i % j == 0:
        break
      elif j == i - 1:
        dev_list.append(i)
ans = 0
for dev in dev_list:
  if l_value % dev == 0:
    ans += 1
print(ans)

Fixed submission:
# -*- Coding: utf-8 -*-
a, b = map(int, input().split())
def my_gcd(a, b):
  if b == 0:
    return a
  else:
    return my_gcd(b, a % b)

gcd = my_gcd(a, b)
sqrt_gcd = int(gcd ** 0.5)
div_list = []
i = 2
res_gcd = gcd

while i <= sqrt_gcd:
  if res_gcd % i == 0:
    div_list.append(i)
    res_gcd = res_gcd / i
  else:
    i += 1
  if res_gcd == 1:
    break
if res_gcd > 1:
  div_list.append(gcd)
uni_cd = list(set(div_list))
ans = 1 + len(uni_cd)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
a, b = map(int, input().split())
min_n = min([a, b])
temp_list = []
for i in range(1, min_n + 1):
  if a % i == 0 and b % i == 0:
    temp_list.append(i)
ans = 0
for i in temp_list:
  if i == 1 or i == 2:
    ans += 1
  else:
    for j in range(2, i):
      if i % j == 0:
        break
      elif j == i - 1:
        ans += 1
print(ans)

Fixed submission:
# -*- Coding: utf-8 -*-
a, b = map(int, input().split())
def my_gcd(a, b):
  if b == 0:
    return a
  else:
    return my_gcd(b, a % b)

gcd = my_gcd(a, b)
sqrt_gcd = int(gcd ** 0.5)
div_list = []
i = 2
res_gcd = gcd

while i <= sqrt_gcd:
  if res_gcd % i == 0:
    div_list.append(i)
    res_gcd = res_gcd / i
  else:
    i += 1
  if res_gcd == 1:
    break
if res_gcd > 1:
  div_list.append(gcd)
uni_cd = list(set(div_list))
ans = 1 + len(uni_cd)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- Coding: utf-8 -*-
n, m = map(int, input().split())
INF = 1001001001
key_list = []
cost_list = []
for i in range(m):
  a, b = map(int, input().split())
  cost_list.append(a)
  c = list(map(int, input().split()))
  s = 0
  for j in range(b):
    s |= 1 << c[j] - 1
  key_list.append(s)
   
dp = [INF] * (1 << n)
dp[0] = 0
for s in range(1 << n):
  for i in range(m):
    t = s | key_list[i]
    cost = dp[s] + cost_list[i]
    dp[t] = min(cost, dp[t])
if dp[-1] == INF:
  ans = -1
else:
  ans = dp[-1]
print(ans)


Fixed submission:
# -*- Coding: utf-8 -*-
n, m = map(int, input().split())
INF = 1001001001
key_list = []
cost_list = []
for i in range(m):
  a, b = map(int, input().split())
  cost_list.append(a)
  c = list(map(int, input().split()))
  s = 0
  for j in range(b):
    s |= 1 << c[j] - 1
  key_list.append(s)
   
dp = [INF] * (1 << n)
dp[0] = 0
for s in range(1 << n):
  for i in range(m):
    t = s | key_list[i]
    cost = dp[s] + cost_list[i]
    dp[t] = min(cost, dp[t])
if dp[-1] == INF:
  ans = -1
else:
  ans = dp[-1]
print(ans)
Buggy python submission (verdict: Runtime Error):
# -*- Coding: utf-8 -*-
INF = 1001001001
n, m = map(int, input().split())

def bfs(sv, to_list):
  dist = [INF for i in range(n)]
  hist = [-1 for i in range(n)]
  q = []
  dist[sv] = 0
  q.append(sv)
  while len(q) > 0:
    v = q[0]
    del q[0]
    for j in to_list[v]:
      if dist[j] != INF:
        continue
      hist[j] = v
      dist[j] = dist[v] + 1
      q.append(j)
  min_cycle = INF
  min_hist = -1
  for i in range(n):
    if i == sv:
      continue
    for j in to[i]:
      if j == sv:
        if min_cycle > dist[j]:
          min_cycle = dist[i]
          min_hist = i
  res = []
  temp_v = min_hist
  if min_cycle < INF:
    while temp_v > -1:
      res.append(temp_v)
      temp_v = hist[temp_v]
  else:
    res = [1 for i in range(n+1)]
  return res
    

to = [[] for i in range(m)]
for i in range(m):
  a, b = map(int, input().split())
  to[a-1].append(b-1)
c = [bfs(i, to) for i in range(n)]
ans = [1 for i in range(n+1)]
for i in range(n):
  if len(ans) > len(c[i]):
    ans = c[i]
if len(ans) == n + 1:
  print(-1)
else:
  print(len(ans))
  for v in ans[::-1]:
    print(v+1)

Fixed submission:
# -*- Coding: utf-8 -*-
INF = 1001001001
n, m = map(int, input().split())

def bfs(sv, to_list):
  dist = [INF for i in range(n)]
  hist = [-1 for i in range(n)]
  q = []
  dist[sv] = 0
  q.append(sv)
  while len(q) > 0:
    v = q[0]
    del q[0]
    for j in to_list[v]:
      if dist[j] != INF:
        continue
      hist[j] = v
      dist[j] = dist[v] + 1
      q.append(j)
  min_cycle = INF
  min_hist = -1
  for i in range(n):
    if i == sv:
      continue
    for j in to[i]:
      if j == sv:
        if min_cycle > dist[j]:
          min_cycle = dist[i]
          min_hist = i
  res = []
  temp_v = min_hist
  if min_cycle < INF:
    while temp_v > -1:
      res.append(temp_v)
      temp_v = hist[temp_v]
  else:
    res = [1 for i in range(n+1)]
  return res
    

to = [[] for i in range(m)]
for i in range(m):
  a, b = map(int, input().split())
  to[a-1].append(b-1)
if len(to) == 0:
  print(-1)
else:  
  c = [bfs(i, to) for i in range(n)]
  ans = [1 for i in range(n+1)]
  for i in range(n):
    if len(ans) > len(c[i]):
      ans = c[i]
  if len(ans) == n + 1:
    print(-1)
  else:
    print(len(ans))
    for v in ans[::-1]:
      print(v+1)
Buggy python submission (verdict: Time Limit Exceeded):
n, k, q = map(int, input().split())
score = [k for i in range(n)]
for i in range(q):
  a = int(input())
  score[a - 1] += 1
  score = list(map(lambda x: x- 1, score))
for i in range(n):
  if score[i] > 0:
    print('Yes')
  else:
    print('No')

Fixed submission:
n, k, q = map(int, input().split())
score = [0 for i in range(n)]
for i in range(q):
  a = int(input())
  score[a - 1] += 1
for i in range(n):
  if q - score[i] >= k:
    print('No')
  else:
    print('Yes')
Buggy python submission (verdict: Runtime Error):
n = input()
print(N**3)

Fixed submission:
n = int(input())
print(n**3)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))
c_list = list(map(int, input().split()))

ans = 0
prev = 0
for i in range(n):
  if a_list[i] == prev + 1:
    ans += b_list[i] + c_list[i]
  else:
    ans += b_list[i]
  prev = a_list[i]
print(ans)

Fixed submission:
n = int(input())
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))
c_list = list(map(int, input().split()))

ans = 0
prev = -1
for i in range(n):
  if a_list[i] == prev + 1:
    ans += b_list[a_list[i] - 1] + c_list[prev - 1]
  else:
    ans += b_list[a_list[i] - 1]
  prev = a_list[i]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = []
for i in range(n):
  s.append(''.join(sorted(input())))
ans = 0

for i in range(n - 1):
  for j in range(i + 1, n):
    if s[i] == s[j]:
      ans += 1
print(ans)

Fixed submission:
n = int(input())
d = {}
ans = 0
for i in range(n):
  s = ''.join(sorted(input()))
  a = d.get(s)
  if a is None:
    d[s] = 1
  else:
    ans += a
    d[s] += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
l, r = map(int, input().split())
m = []
if l == r:
  print(l%2019 * l%2019)
else:
  if r - l < 2019:
    for i in range(l, r+1):
      m.append(i%2019)
  else:
    for i in range(l, l+2020):
      m.append(i%2019)
  m = sorted(m)
  print(


Fixed submission:
l, r = map(int, input().split())
m = []
if l == r:
  print(l%2019 * l%2019)
else:
  if r - l < 2019:
    for i in range(l, r+1):
      m.append(i%2019)
    ans = 2019
    for i in range(len(m)-1):
      for j in range(i+1, len(m)):
        temp = (m[i]*m[j])%2019
        if ans > temp:
          ans = temp
    print(ans)
  else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
def xgcd(a, b):
    if b == 0:
        g = a
        x = 1
        y = 0
        return g, x, y
    else:
        g, s, t = xgcd(b, a%b)
        x = t
        y = s - a//b*x
        return g, x, y

def invmod(a, p):
    _, x, _ = xgcd(a, p)
    if x < 0:
        x = x + p
    return x

def count_route(n):
  if n < 0:
    return 0
  res = 0
  for i in range(n//2+1):
    res += f[n - i] * inv[i] * inv[n - 2* i]
  return res%const
    
n, m = map(int, input().split())
const = 1000000007
#nまでの階乗をハッシュテーブルに格納する
f = [1 for i in range(n + 1)]
inv = [1 for i in range(n + 1)]
for i in range(1, n+1):
  f[i] = f[i - 1] * i
  inv[i] = invmod(f[i], const)
prev = 0
ans = 1
for i in range(m):
  m = int(input())
  ans = (ans * count_route(m - 1 - prev))%const
  prev = m + 1
  if ans == 0:
    break
ans = (ans * count_route(n - prev))%const
print(ans)

Fixed submission:
def xgcd(a, b):
    if b == 0:
        g = a
        x = 1
        y = 0
        return g, x, y
    else:
        g, s, t = xgcd(b, a%b)
        x = t
        y = s - a//b*x
        return g, x, y

def invmod(a, p):
    _, x, _ = xgcd(a, p)
    if x < 0:
        x = x + p
    return x

def count_route(n):
  if n < 0:
    return 0
  res = 0
  for i in range(n//2+1):
    res += f[n - i] * inv[i] * inv[n - 2* i]
  return res%const
    
n, m = map(int, input().split())
const = 1000000007
#nまでの階乗をハッシュテーブルに格納する
f = [1 for i in range(n + 1)]
inv = [1 for i in range(n + 1)]
for i in range(1, n+1):
  f[i] = (f[i - 1] * i)%const
  inv[i] = invmod(f[i], const)
prev = 0
ans = 1
for i in range(m):
  m = int(input())
  ans = (ans * count_route(m - 1 - prev))%const
  prev = m + 1
  if ans == 0:
    break
ans = (ans * count_route(n - prev))%const
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
def ip(l1, l2):
  ans = []
  if len(l1) != len(l2):
    print('length mismatch')
  else:
    for i in range(len(l1)):
      ans.append(l1[i]*l2[i])
    return ans
g = []
for i in range(m):
  g.append(list(map(int, input().split())))
l = [1 for i in range(n)]
for i in range(m):
  temp_l = [0 for i in range(n)]
  for j in range(g[i][0]-1, g[i][1]):
    temp_l[j-1] = 1
  l = ip(l, temp_l)
ans = sum(l)
print(ans)
  
  

Fixed submission:
n, m = map(int, input().split())
max_l = 0
min_r = n
for i in range(m):
  l, r = map(int, input().split())
  if l > max_l:
    max_l = l
  if r < min_r:
    min_r = r
ans = min_r - max_l + 1
if ans < 0:
  ans = 0
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
t = []
for i in range(5):
  t.append(int(input()))
ct = [math.ceil(x/10)*10 for x in t]
fraction = [x%10 for x in t]
min_fraction = min(list(filter(lambda x: x > 0, fraction)))
print(sum(ct) - 10 + min_fraction)


Fixed submission:
import math
t = []
for i in range(5):
  t.append(int(input()))
ct = [math.ceil(x/10)*10 for x in t]
fraction = [x%10 for x in t]
fraction = list(filter(lambda x: x > 0, fraction))
if len(fraction) > 0:
  min_fraction = min(fraction)
else:
  min_fraction = 10
print(sum(ct) - 10 + min_fraction)
Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = 0
btcjpy = 380000
for i in range(n):
  x, u = input().split()
  if u == 'BTC':
    ans += btcjpy * int(x)
  else:
    ans += int(x)
print(ans)

Fixed submission:
n = int(input())
ans = 0
btcjpy = 380000
for i in range(n):
  x, u = input().split()
  if u == 'BTC':
    ans += btcjpy * float(x)
  else:
    ans += float(x)
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
if n = 1:
  print('Hello World')
else:
  a = int(input())
  b = int(input())
  print(a+b)

Fixed submission:
n = int(input())
if n == 1:
  print('Hello World')
else:
  a = int(input())
  b = int(input())
  print(a+b)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    A = list(map(int,input().split()))

    total = sum(A)
    for i in range(N):
        num = i+1
        totali = 0
        for j in range((N-1)//2):
            if num >= N:
                num -= N
            totali += A[num]
            num += 2
        ans= total - 2*totali
        print(ans,end = " ")



if __name__ == "__main__":
    main()


Fixed submission:
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    A = list(map(int,input().split()))

    total = sum(A)
    num = 1
    totali = 0
    for j in range((N-1)//2):
        if num >= N:
            num -= N
        totali += A[num]
        num += 2
    ans= total - 2*totali
    print(ans,end = " ")
    for i in range(1,N,1):
        ans = (A[i-1] - ans//2)*2
        print(ans,end = " ")


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
a ,b =map(int,input().split())

if (a*b)%2 ==0:
    print("Even")
else:
    print("Odd)


Fixed submission:
a ,b =map(int,input().split())

if (a*b)%2 ==0:
    print("Even")
else:
    print("Odd")
Buggy python submission (verdict: Runtime Error):
h, a = input().split()
print(int(h/a) + 1)

Fixed submission:
import math

h, a = input().split()
print(math.ceil(int(h)/int(a)))

Buggy python submission (verdict: Runtime Error):
h, a = input()
print(int(h)/int(a) + 1)

Fixed submission:
import math

h, a = input().split()
print(math.ceil(int(h)/int(a)))

Buggy python submission (verdict: Runtime Error):
h, a = input()
print(int(h/a) + 1)

Fixed submission:
import math

h, a = input().split()
print(math.ceil(int(h)/int(a)))
Buggy python submission (verdict: Runtime Error):
    import math

    h, n = map(int, input().split())
    a = map(int, input().split())
    if h - sum(a) > 0:
        print("No")
    else:
        print("Yes")

Fixed submission:
import math
 
h, n = map(int, input().split())
a = map(int, input().split())
if h - sum(a) > 0:
    print("No")
else:
    print("Yes")
Buggy python submission (verdict: Runtime Error):
import numpy as np

n, m, q = map(int, input().split())

mat = np.zeros((n, n), dtype=int)

for _ in range(m):
    l, r = map(int, input().split())
    mat[l-1][r-1] += 1

ans = np.cumsum(mat, axis=1)[::-1], axis=0)[::-1]

for _ in range(q):
    l, r = map(int, input().split())
    print(ans[l-1][r-1])


Fixed submission:
import numpy as np

n, m, q = map(int, input().split())

mat = np.zeros((n, n), dtype=int)

for _ in range(m):
    l, r = map(int, input().split())
    mat[l-1][r-1] += 1

ans = np.cumsum(np.cumsum(mat, axis=1)[::-1], axis=0)[::-1]

for _ in range(q):
    l, r = map(int, input().split())
    print(ans[l-1][r-1])
Buggy python submission (verdict: Runtime Error):
s = input().split()

WtoE = []
wtoec = 0
EtoW = []
etowc = 0

for c in s[1]:
    if c == "W":
        wtoec = wtoec + 1
    WtoE.append(wtoec)

for c in s[1][::-1]:
    if c == "E":
        etowc = etowc + 1
    EtoW.append(etowc)
EtoW.reverse()
print(WtoE)
print(EtoW)

a = []
for i in range(0, int(s[0])):
    ans = WtoE[i] + EtoW[i]
    if WtoE[i] != 0 and s[1][i] == "W" or EtoW[i] != 0 and s[1][i] == "E":
        ans = ans - 1

    a.append(ans)

print(min(a))


Fixed submission:
s = ["", ""]

s[0] = input()
s[1] = input()

WtoE = []
wtoec = 0
EtoW = []
etowc = 0

for c in s[1]:
    if c == "W":
        wtoec = wtoec + 1
    WtoE.append(wtoec)

for c in s[1][::-1]:
    if c == "E":
        etowc = etowc + 1
    EtoW.append(etowc)
EtoW.reverse()

a = []
for i in range(0, int(s[0])):
    ans = WtoE[i] + EtoW[i]
    if WtoE[i] != 0 and s[1][i] == "W" or EtoW[i] != 0 and s[1][i] == "E":
        ans = ans - 1

    a.append(ans)

print(min(a))
Buggy python submission (verdict: Runtime Error):
H = int(input("モンスターの体力を入力してください")) 
A = int(input("サーバルの攻撃力を入力してください"))
i = 0
while H > 0:
    H -=A
    i += 1
    print("モンスターの体力は", end="")
    print(H, end="")
    print("です。")
    
print("よって",end = "")
print(i, end = "")
print("回の攻撃でモンスターに勝つことができます")


Fixed submission:
i = list(map(int, input().split()))

if i[0] == i[1]:
    print("1")
elif i[0] % i[1] > 0:
    print((i[0] // i[1]) + 1)
else :
    print(i[0] // i[1])
Buggy python submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
if A <= K:
	a = 0
	if B <= K - A:
		b = 0
	else:
		b = B - (K - A)
else:
	a = A - K
print(a, b)

Fixed submission:
A, B, K = map(int, input().split())
if A <= K:
	a = 0
	if B <= K - A:
		b = 0
	else:
		b = B - (K - A)
else:
	a = A - K
	b = B
print(a, b)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = list(input())
ro, si, pa = 0,0,0
rp, sp, pp = 0,0,0
for t in range(len(T)):
	if T[t] == 'r':
		pa += 1
		if (t - K >= 0 and T[t-K] == 'r') and (t+K>N or(t+K<=N and T[t+K] != 'r')):
			pp += 1
	if T[t] == 's':
		ro += 1
		if (t - K >= 0 and T[t-K] == 's') and (t+K>N or(t+K<=N and T[t+K] != 's')):
			rp += 1
	if T[t] == 'p':
		si += 1
		if (t - K >= 0 and T[t-K] == 'p') and (t+K>N or(t+K<=N and T[t+K] != 'p')):
			sp += 1
s_r = (ro-rp)*R
s_s = (si-sp)*S
s_p = (pa-pp)*P
print(s_r+s_s+s_p)

Fixed submission:
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = list(input())
r, s, p = 0,0,0
for i in range(N):
	if i-K >= 0 and T[i-K] == T[i]:
		T[i] = None
	elif T[i] == 'r':
		p += 1
	elif T[i] == 's':
		r += 1
	elif T[i] == 'p':
		s += 1
print(r*R+s*S+p*P)
Buggy python submission (verdict: Runtime Error):
N, M, V, P = map(int, input().split())
pre = list(map(int, input().split()))
li = sorted(pre)
total = M * V
tf = False
for i in range(N):
	if li[i] + M >= li[-P]:
		tmp = i+1 + P - 1
		nokori = total - (M * tmp)
		count = i + 1
		while count <= N - P:
			if nokori <= 0:
				ans = N-i
				tf = True
				break	
			sa = (li[i]+M) - li[count]
			if sa <= 1:
				count += 1
				continue
			nokori -= sa-1
			count += 1
		if tf == True:
			break
print(ans)



Fixed submission:
N, A, B = map(int, input().split())
ans = 0
if (B - A) % 2 == 0:
	ans = (B - A) // 2
else:
	if N - A >= B - 1:
		dis = A - 1 + 1
		ans = dis + ((B-dis) - 1) //2
		
		
	else:
		
		dis = N - B + 1
		ans = dis + (N - (A+dis)) //2

print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()
N = int(input())
li = list("ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ")
sli = list(S)
for i in range(len(sli)):
  for j in range(26):
    if li[j] == sli[i]:
      sli[i] == li[j+N]
print("".join(sli))

Fixed submission:
N = int(input())
S = input()
li = list("ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ")
sli = list(S)
for i in range(len(sli)):
  for j in range(26):
    if li[j] == sli[i]:
      sli[i] = li[j+N]
      break
print("".join(sli))

Buggy python submission (verdict: Runtime Error):
S = input()
N = input()
li = list("ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ")
sli = list(S)
for i in range(len(sli)):
  for j in range(26):
    if li[j] == sli[i]:
      sli[i] == li[j+2]
print("".join(sli)
  

Fixed submission:
N = int(input())
S = input()
li = list("ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ")
sli = list(S)
for i in range(len(sli)):
  for j in range(26):
    if li[j] == sli[i]:
      sli[i] = li[j+N]
      break
print("".join(sli))
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
li = list(S)
n = int(len(li)/2)
half_li = list()
for i in range(n):
	half_li.append(li[i])
T = ''.join(half_li)
if S == T*2:
	print('Yes')
else:
	print('No')

Fixed submission:
N = int(input())
ans = 'No'
for i in range(1,10):
	for j in range(1,10):
		if i*j == N:
			
			ans = 'Yes'
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
li = list(map(int, input().split()))
ans = dict()
for i in range(len(li)):
    ans[li[i]] = i + 1
ali = []
for j in sorted(ans.keys()):
    ali.append(ans[j])
print(*join(ali))

Fixed submission:
N = int(input())
S = list(input())
li = list()
for i in range(N):
    if i < N-1:
        if S[i] != S[i+1]:
            li.append(S[i])
    else:
        li.append(S[i])
print(len(li))
Buggy python submission (verdict: Runtime Error):
N = int(input())
li = list(map(int, input().split()))
ans = dict()
for i in range(len(li)):
    ans[li[i]] = i + 1
ali = []
for j in sorted(ans.keys()):
    ali.append(ans[j])
print(*join(ali))

Fixed submission:
N = int(input())
li = list(map(int, input().split()))
ans = dict()
for i in range(len(li)):
    ans[li[i]] = i + 1
ali = []
for j in sorted(ans.keys()):
    ali.append(ans[j])
print(*ali)

Buggy python submission (verdict: Runtime Error):
N = int(input())
li = list(map(int, input().split()))
ans = dict()
for i in range(len(li)):
    ans[li[i]] = i + 1
ali = []
for j in sorted(ans.keys()):
    ali.append(ans[j])
print(ali.split())



Fixed submission:
N = int(input())
li = list(map(int, input().split()))
ans = dict()
for i in range(len(li)):
    ans[li[i]] = i + 1
ali = []
for j in sorted(ans.keys()):
    ali.append(ans[j])
print(*ali)
Buggy python submission (verdict: Time Limit Exceeded):
N, K, Q = map(int, input().split())
li = [int(input()) for i in range(Q)]
member = [x+1 for x in range(N)]
for i in member:
    ans = K
    for j in li:
        if i != j:
            ans -= 1
    if ans <= 0:
        print('No')
    else:
        print('Yes')

Fixed submission:
N, K, Q = map(int, input().split())
li = [int(input()) for i in range(Q)]
member = [0 for x in range(N)]
for i in li:
    member[i-1] += 1
for j in member:
    ans = j-Q+K
    if ans <= 0:
        print('No')
    else:
        print('Yes')