Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02984 (python)

Fixed submission:
n = int(input())
a = [int(x) for x in input().split()]
s = sum(a)
ans = [0] * n
even_a = 0
for i in a[1::2]:
    even_a += i
ans[0] = s - 2 * even_a
for i in range(1, n):
    ans[i] = 2 * a[i-1] - ans[i-1]
print(" ".join(map(str, ans)))

Buggy submission (verdict: Runtime Error):
import numpy as np
n = int(input())
a = list(map(int, input().split()))
A = []
for i in range(n):
    c = [0] * n
    if i != n-1:
        c[i], c[i+1] = 0.5, 0.5
    else:
        c[0], c[n-1] = 0.5, 0.5
    A.append(c)

A = np.array(A)
b = np.array(a)
ans = list(np.linalg.solve(A, b))
ans = map(int, ans)
ans = map(str, ans)
print(" ".join(ans))
Problem p03013 (python)

Fixed submission:
n, m = (int(x) for x in input().split())
a = [0] * m
for i in range(m):
    a[i] = int(input())
dp = [0] * (n + 1)
mod = 1000000007
dp[0] = 1
j = 0

if m > 0:
    for i in range(1, n + 1):
        if i == a[j]:
            dp[i] = 0
            if j != m - 1:
                j += 1
        elif i >= 2:
            dp[i] = (dp[i - 1] + dp[i - 2]) % mod
        else:
            dp[i] = dp[i - 1] % mod
else:
    for i in range(1, n + 1):
        if i >= 2:
            dp[i] = (dp[i - 1] + dp[i - 2]) % mod
        else:
            dp[i] = dp[i - 1] % mod
print(dp[n])

Buggy submission (verdict: Runtime Error):
n, m = (int(x) for x in input().split())
a = [0] * m
for i in range(m):
    a[i] = int(input())

dp = [0] * (n + 1)
mod = 1000000007
dp[0] = 1
j = 0
for i in range(1, n+1):
    if i == a[j]:
        dp[i] = 0
        if j != m - 1:
            j += 1
    elif i >= 2:
        dp[i] = (dp[i-1] + dp[i-2]) % mod
    else:
        dp[i] = dp[i-1] % mod

print(dp[n])
Problem p03073 (python)

Fixed submission:
data = list(input())
count = 0
for i in range(1, len(data)):
  if data[i] == data[i-1]:
    if data[i] == "0":
      data[i] = "1"
    else:
      data[i] = "0"
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
deata = list(input())
count = 0
for i in range(1, len(data)):
  if data[i] == data[i-1]:
    if data[i] == "0":
      data[i] = "1"
    else:
      data[i] = "0"
    count += 1
print(count)
Problem p02829 (python)

Fixed submission:
a = int(input()) 
b = int(input())


listt = []
listt.append(a)
listt.append(b)
if 1 in listt and 2 in listt:
    print(3)

if 2 in listt and 3 in listt:
    print(1)

if 1 in listt and 3 in listt:
    print(2)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split()) 
 
count = 1
an = []
bn = []
eee = min(a,b)
 
for ii in range(1, eee+2):
    bbb = b * ii
    bn.append(bbb)
 
while True:
    aaa = a * count
    )
    if aaa in bn:
        print(aaa)
        break
    count += 1
Problem p02835 (python)

Fixed submission:
number = input().split()
if int(number[0]) + int(number[1]) + int(number[2]) >= 22:
  print('bust')
else:
  print('win')

Buggy submission (verdict: Runtime Error):
number = input().split()
if number[0] + number[1] + number[2] >= 22:
  print('bust')
else:
  print('win')

Buggy submission (verdict: Runtime Error):
number = input().split()
if number[0] + number[1] + number[2] >= 22:
  print(bust)
else:
  print(win)
Problem p02859 (python)

Fixed submission:
r = int(input())
print(r * r)

Buggy submission (verdict: Runtime Error):
print(r * r)
Problem p02819 (python)

Fixed submission:
a=int(input())

def prime(n):
  if n <= 1:
    return False
  else:
    for i in range (2,n):
      if n%i == 0:
        return False
    return True
        
while prime(a)==False:
    a += 1

print(a)

Buggy submission (verdict: Runtime Error):
a=input()

def prime(n):
  for i in range(2,n):
    if n%i == 0:
      return False
    return True
  
while prime(a) == False:
  a += 1

print(a)

Buggy submission (verdict: Runtime Error):
a=input()

def prime(n):
  if n <= 1:
    return False
  else:
    for i in range(2,n):
      if n%i == 0:
      	return False
      return True
    
while prime(a)==False:
  a += 1

print(a)
Problem p02829 (python)

Fixed submission:
array = [1, 2, 3]
 
for _ in range(2):
  num = int(input())
  array.pop(array.index(num))
 
print(array[0])

Buggy submission (verdict: Runtime Error):
array = [1, 2, 3]

for _ in range(3):
  num = int(input())
  array.pop(array.index(num))

print(array[0])
Problem p02862 (python)

Fixed submission:
import math
import functools

law = 10 ** 9 + 7
def mul_mod(x, y):
  return x * y % law

def prod_mod(seq):
  return functools.reduce(mul_mod, seq, 1)
#互いに素なa,bについて、a*x+b*y=1の一つの解
def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    #[x,y]
    return [w[0],w[1]]

# aの逆元(mod m)を求める。(aとmは互いに素であることが前提)
def mod_inv(a,m):
    x = extgcd(a,m)[0]
    return (m+x%m)%m
  
def comb(n, k):
  return prod_mod(i for i in range(n - k + 1, n + 1)) * mod_inv(prod_mod(i for i in range(1, k + 1)), law) % law

if __name__ == "__main__":
  
  x, y = sorted(map(int, input().split()), reverse=True)
  
  if (x + y) % 3 != 0:
    print(0)
  else:
    print(comb((x + y) // 3, x - (x + y) // 3))

Buggy submission (verdict: Runtime Error):

if __name__ == "__main__":
  law = 10 ** 9 + 7
  
  dest_x, dest_y = sorted(map(int, input().split()), reverse=True)
  W = H = dest_x + 1
  
  num_pattern = [[0] * W for j in range(H)]
  
  num_pattern[0][0] = 1
  
  stack = [(0, 0, 0, 0)]
  moves = [(1, 2), (2, 1)]
  
  while(stack):
    x, y, or_x, or_y = stack.pop(0)
    
    for dx, dy in moves:
      if x + dx != or_x and y + dy != or_y and 0 <= x + dx < W and 0 <= y + dy < H and x + dx >= y + dy:
        num_pattern[x + dx][y + dy] += num_pattern[x][y]
        stack.append((x + dx, y + dy, x, y))
      
  print(num_pattern[dest_x][dest_y] * 2 % law)
  pass
Problem p03127 (python)

Fixed submission:
import numpy as np
import math
import sys

n = list(map(int, input().split()))
a = list(map(int, input().split()))
a = np.asarray(a)

while True:
    tmpmin = np.min(a[a!=0])
    a[a!=tmpmin] %= tmpmin
    #print(a,tmpmin)
    if tmpmin == np.min(a[a!=0]):break
    if np.sum(a) == 0: break

print(tmpmin)

Buggy submission (verdict: Runtime Error):
import numpy as np
import math
import sys
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

n = list(map(int, input().split()))
a = list(map(int, input().split()))
a = np.asarray(a)

print(gcd(*a))
Problem p03135 (python)

Fixed submission:
import numpy as np

m = list(map(int, input().split()))
t = m[0]
x = m[1]
print(t/x)

Buggy submission (verdict: Runtime Error):
import numpy as np

in_num = list(map(int, input().split()))
in_num2 = list(map(int, input().split()))
n = in_num[0]
k = in_num[1]
a = np.asarray(in_num2)
#n = 10**5
#k = 10**12
#a = np.asarray(np.arange(10**12))
if False:# k == 0 :
    print(np.sum(a))
    exit
else:
    max = 0
    ktmp = 0
    flag = 1 if k == 0 else 0
    i = 1
    while True:
        tmp = len(a[a%2==1])
        ktmp += i if tmp > n - tmp or flag == 1 else 0
        if ktmp > k:
            break
        tmp = tmp if tmp > n - tmp or flag == 1 else n - tmp 

        max += tmp * i
        #print(tmp,max,i,np.max(a))
        a = np.trunc(a / 2)
        i = i * 2
        if i > k:
            flag = 1
            if 0 ==  np.max(a):
                break

    print(max)

Buggy submission (verdict: Runtime Error):
import numpy as np

in_num = list(map(int, input().split()))
in_num2 = list(map(int, input().split()))
n = in_num[0]
k = in_num[1]
a = np.asarray(in_num2)

if k == 0 :
    print(np.sum(a))
else:

    b = np.arange(k).reshape(k,1) + 1
    c = np.bitwise_xor(a,b)

    print(np.max(np.sum(c,axis=1)))

Buggy submission (verdict: Runtime Error):
import numpy as np

in_num = list(map(int, input().split()))
in_num2 = list(map(int, input().split()))
n = in_num[0]
k = in_num[1]
a = np.asarray(in_num2)

if k == 0 :
    print(np.sum(a))
else:

    b = np.arange(k).reshape(k,1) + 1
    result = np.bitwise_xor(a,b)

    print(np.max(np.sum(result,axis=1)))
Problem p02990 (python)

Fixed submission:
from math import factorial as fact
def comb(n, r):
  if n<=r: return fact(n)//fact(r)
  else: return fact(n)//(fact(r)*fact(n-r))

def main():
    n, k = map(int, input().split())
    for i in range(k): print((comb(n-k+1, i+1) * comb(k-1, i)) % 1000000007)

if __name__=="__main__": main()

Buggy submission (verdict: Runtime Error):
from math import factorial as fact
def comb(n, r): return fact(n)//(fact(r)*fact(n-r))

def main():
    n, k = map(int, input().split())
    for i in range(k): print((comb(n-k+1, i+1) * comb(k-1, i)) % 1000000007)

if __name__=="__main__": main()
Problem p03137 (python)

Fixed submission:
n,m,*x=map(int,open(0).read().split());x.sort();print(sum(sorted([x[i+1]-x[i]for i in range(m-1)])[:m-n])if n<m else 0)

Buggy submission (verdict: Runtime Error):
def main():
    n, m, *x = map(int, open(0).read().split())
    x.sort()

    if m==1:print(0);exit()

    piece = [0]*(n-1)
    itvl = [[x[i+1]-x[i], i]for i in range(m-1)]
    j = 0
    for i in sorted(itvl, key=lambda x:-x[0]):
        if piece[-1]: break
        piece[j] = i[1]
        j += 1

    ans = x[-1]-x[0]
    for i in piece: ans -= itvl[i][0]
    print(ans)

if __name__=="__main__":main()
Problem p03221 (python)

Fixed submission:
from sys import stdin
input = stdin.readline
n, m = map(int, input().split())

ans = sorted([list(map(int, input().split()))+[i] for i in range(m)], key=lambda x:x[1])

built = [1]*n
for i in range(m):
    ans[i][1] = built[ans[i][0]-1]
    built[ans[i][0]-1] += 1

for i in sorted(ans,key=lambda x:x[2]): print("%06d%06d" % (i[0],i[1]))

Buggy submission (verdict: Runtime Error):
from sys import stdin
input = stdin.readline
n, m = map(int, input().split())

ans = sorted([list(map(int, input().split()))+[i] for i in range(m)], key=lambda x:x[1])

built = [1]*m
for i in range(m):
    ans[i][1] = built[ans[i][0]-1]
    built[ans[i][0]-1] += 1

for i in sorted(ans,key=lambda x:x[2]): print("%06d%06d" % (i[0],i[1]))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
py = [list(map(int, input().split()))for i in range(m)]
pre = [[] for i in range(n)]
for i in range(3): pre[py[i][0]-1].append(py[i][1])
for i in range(n): pre[i].sort()
for i in range(3):
    j = pre[py[i][0]-1].index(py[i][1])
    print("%06d%06d" % (py[i][0], j+1))
Problem p03804 (python)

Fixed submission:
n, m = map(int, input().split())
a = [input() for i in range(n)]
b = [input() for i in range(m)]

for i in range(n-m+1):
    for j in range(n-m+1):
        if a[i][j] == b[0][0]:
            cnt = 0
            for k in range(m):
                if a[i+k][j:j+m] == b[k]: cnt+=1
            if cnt == m:
                print("Yes")
                exit()
print("No")

Buggy submission (verdict: Runtime Error):
from sys import exit
n, m = map(int, input().split())
s1 = " ".join([input() for _ in range(n)])
s2 = [input() for _ in range(m)]
flag = True

i = 0
while i < m:
    #try:
        if s1.count(s2[i]) == 0:
            print("No")
            exit()
        ind = s1.index(s2[i])
        s1 = list(s1)
        del s1[ind]
        s1 = "".join(s1)
        if s1[ind+n+1:ind+n+m+1:] == s2[i+1]:
            i += 1
    #except:
        """print("No")
        exit()"""
print("Yes")
Problem p02835 (python)

Fixed submission:
A1,A2,A3=map(int, input().split())
if A1+A2+A3>=22:
  print("bust")
else:
  print("win")

Buggy submission (verdict: Runtime Error):
A1,A2,A3=map(int, input().split())
print(f'{"bust" if A1+A2+A3>=22 else "win"}' )
Problem p03135 (python)

Fixed submission:
t, x = map(int, input().split())

print(t / x)

Buggy submission (verdict: Runtime Error):
t, x = map(int input().split())

print(t / x)
Problem p02819 (python)

Fixed submission:
import math
x=int(input())
if x==2:
    print(2)
else:   
    l=0
    a=[i for i in range(2,x)]
    prime=[]
    limit=math.sqrt(x)
    while True:
        p = a[0]
        if limit <= p:
            break
        prime.append(p)
        a = [e for e in a if e % p != 0]
    co=0
    x-=1
    l=len(prime)
    while co==0:
        c=0
        x+=1
        for i in range(l):
            if x%prime[i]!=0:
                c+=1
            else:
                break
        if c==l:
            print(x)
            co+=1

Buggy submission (verdict: Runtime Error):
import math
x=int(input())
l=0
a=[i for i in range(2,x)]
prime=[]
limit=math.sqrt(x)
while True:
        p = a[0]
        if limit <= p:
            break
        prime.append(p)
        a = [e for e in a if e % p != 0]
co=0
x-=1
l=len(prime)
while co==0:
    c=0
    x+=1
    for i in range(l):
        if x%prime[i]!=0:
            c+=1
        else:
            break
    if c==l:
        print(x)
        co+=1
Problem p03011 (python)

Fixed submission:
P,Q,R=map(int,input().split())
a=min(P+Q,P+R,Q+R)
print(a)

Buggy submission (verdict: Runtime Error):
N=int(input())
M=input().split()
for i in range(N):
    M[i]=int(M[i])
S1=0
S2=sum(M)
t=100000
for i in range(N):
    S1+=M[i]
    S2=S2-M[i]
    if t>abs(S2-S1):
        t=abs(S2-S1)
print(t)
Problem p03012 (python)

Fixed submission:
N=int(input())
M=input().split()
for i in range(N):
    M[i]=int(M[i])
S1=0
S2=sum(M)
t=100000
for i in range(N):
    S1+=M[i]
    S2=S2-M[i]
    if t>abs(S2-S1):
        t=abs(S2-S1)
print(t)

Buggy submission (verdict: Runtime Error):
N=int(input())
M=list(map(int,input().split))
S1=0
S2=sum(M)
t=100000
for i in range(N):
    S1+=M[i]
    S2=S2-M[i]
    if t>abs(S2-S1):
        t=abs(S2-S1)
print(t)

Buggy submission (verdict: Runtime Error):
N=int(input())
M=list(map(int,input().split))
S1=0
S2=sum(M)
t=0
for i in range(N):
    S1+=M[i]
    S2=S2-M[i]
    if t>=abs(S2-S1):
        t=abs(S2-S1)
print(t)
Problem p02987 (python)

Fixed submission:
s=[]
s = input()
cnt=0
 
if(s[0] == s[1]):
    cnt+=1

if(s[0] == s[2]):
    cnt+=1
 
 
if(s[0] == s[3]):
    cnt+=1
 
 
if(s[1] == s[2]):
    cnt+=1
 
 
if(s[1] == s[3]):
    cnt+=1
 
 
if(s[2] == s[3]):
    cnt+=1
 
 
if cnt == 2 :
  print("Yes")
else :
  print("No")

Buggy submission (verdict: Runtime Error):
n = input()
p = input().split()


n = int(n)

cnt=0

for i in range(1,n-1):
  if(p[i]<p[i+1] and p[i]>p[i-1]) or (p[i]>p[i+1] and p[i]<p[i-1]):
    cnt+=1;


   
  
print(cnt)

Buggy submission (verdict: Runtime Error):
n = input()
p = input().split()


n = int(n)

cnt=0

for i in range(1,n-1):
  if(p[i]<p[i+1] and p[i]>p[i-1]) or (p[i]>p[i+1] and p[i]<p[i-1]):
    cnt+=1;

  
print(cnt)
Problem p02819 (python)

Fixed submission:
def is_prime(n):
    for p in range(2,n):
        if n % p ==0:
            return True

N =int(input())
p=N
while p <10**7:
    if is_prime(p):
        p +=1
    else:
        print(p)
        break

Buggy submission (verdict: Runtime Error):
def is_prime(n):
    for p in range(2,n):
        if n % p ==0:
            return True

N =int(input())
p=N
while cnt <10**7:
    if is_prime(p):
        p +=1
    else:
        print(p)
        break

Buggy submission (verdict: Runtime Error):
N =int(input())
p=N
while cnt <10**7:
    if is_prime(p):
        p +=1
    else:
        print(p)
        break
Problem p02819 (python)

Fixed submission:
import math
n = int(input())
c = n


def is_prime(n):
    for i in range(2, int(math.sqrt(n)+1)):
        if n % i == 0:
            return False
    return True


while True:
    if is_prime(c):
        print(c)
        exit(0)
    else:
        c+=1

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
c = n

def is_prime(n)
	for i in range(2, math.sqrt(n)+1):
    	if n % i == 0:
        	return False
    return True


while True:
  if is_prime(c):
    print(c)
    exit(0)
  else:
    c+=1
Problem p02831 (python)

Fixed submission:
def lcm(a,b):
    m = a*b
    while a != 0 and b != 0:
        if a > b:
            a %= b
        else:
            b %= a
    return m // (a+b)
a, b = tuple(map(int, input().split()))
print(lcm(a, b))

Buggy submission (verdict: Runtime Error):
def lcm(a,b):
    m = a*b
    while a != 0 and b != 0:
        if a > b:
            a %= b
        else:
            b %= a
    return m // (a+b)

print(lcm(int(input()), int(input())))
Problem p02835 (python)

Fixed submission:
a , b , c  = map(int , (input().split()))
sum = a + b + c
if sum >= 22:
    print("bust")
else:
    print("win")

Buggy submission (verdict: Runtime Error):
sum = 0
for num range(3):
  num = input()
  sum += int(num)
 if sum >= 22:
  print("bust")
 else:
  print("win")
Problem p02819 (python)

Fixed submission:
import random


def is_prime(q, k=50):
    q = abs(q)
    #計算するまでもなく判定できるものははじく
    if q == 2:
        return True
    if q < 2 or q & 1 == 0:
        return False

    #n-1=2^s*dとし（但しaは整数、dは奇数)、dを求める
    d = (q-1) >> 1
    while d & 1 == 0:
        d >>= 1

    #判定をk回繰り返す
    for i in range(k):
        a = random.randint(1, q-1)
        t = d
        y = pow(a, t, q)
        #[0,s-1]の範囲すべてをチェック
        while t != q-1 and y != 1 and y != q-1:
            y = pow(y, 2, q)
            t <<= 1
        if y != q-1 and t & 1 == 0:
            return False
    return True

X = int(input())

while True:
    if is_prime(X):
        break
    X += 1
print(X)

Buggy submission (verdict: Runtime Error):
import random


def is_prime(q, k=50):
    q = abs(q)
    #計算するまでもなく判定できるものははじく
    if q == 2:
        return True
    if q < 2 or q & 1 == 0:
        return False

    #n-1=2^s*dとし（但しaは整数、dは奇数)、dを求める
    d = (q-1) >> 1
    while d & 1 == 0:
        d >>= 1

    #判定をk回繰り返す
    for i in xrange(k):
        a = random.randint(1, q-1)
        t = d
        y = pow(a, t, q)
        #[0,s-1]の範囲すべてをチェック
        while t != q-1 and y != 1 and y != q-1:
            y = pow(y, 2, q)
            t <<= 1
        if y != q-1 and t & 1 == 0:
            return False
    return True

X = int(input())

while True:
    if is_prime(X):
        break
    X += 1
print(X)
Problem p02860 (python)

Fixed submission:
N = int(input())
S = input()

if S[:N//2] == S[N//2:]:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()

if N % 2 == 1:
  print('No')
  exit()

if S[:N/2] == S[N/2:]:
  print('Yes')
else:
  print('No')
Problem p02847 (python)

Fixed submission:
s = input()
a = ''
if s == 'SUN':
    a = 7
elif s == 'MON':
    a = 6
elif s == 'TUE':
    a = 5
elif s == 'WED':
    a = 4
elif s == 'THU':
    a = 3
elif s == 'FRI':
    a = 2
elif s == 'SAT':
    a = 1
    
print(a)

Buggy submission (verdict: Runtime Error):
a, b, x = map(int, input().split())
e = False
first = True
n = 0
chk = ''

if a * 1000000000 + b * len(str(1000000000)) <= x:
    print(1000000000)
    exit()


n = int((x -(len(str(int(x // a)))*b))//a) - 1000000
if n < 0:
    n = 0
    
while e == False:
    p = a * n + b * len(str(n))
    if p <= x:
        chk = 'kaeru'
    elif p > x:
        chk += 'kaenai'
    if first == True and chk == 'kaenai':
        print(0)
        break
        
    if chk == 'kaerukaenai':
        print(n - 1)
        break
    n += 1
    first = False

Buggy submission (verdict: Runtime Error):
a, b, x = map(int, input().split())
e = False
first = True
n = 0
chk = ''

if a * 1000000000 + b * len(str(1000000000)) <= x:
    print(1000000000)
    exit()

if x - (a+b) > 0:
    n = a+b-1
    
    
while e == False:
    p = a * n + b * len(str(n))
    if p <= x:
        chk = 'kaeru'
    elif p > x:
        chk += 'kaenai'
    if first == True and chk == 'kaenai':
        print(0)
        break
        
    if chk == 'kaerukaenai':
        print(n - 1)
        break
    n += 1
    first = False
Problem p02951 (python)

Fixed submission:
a, b, c = map(int,input().split())
ans = c-(a-b)
if ans < 0:
  ans = 0
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
if n < 10:
  print(n)
  exit()
if n >= 10 and n < 100:
  print(9)
  exit()
if n >= 100 and n < 1000:
  #print(9 + (int(str(n)[-2:])) + 1)
  print(9 + (n-100) + 1)
  exit()
if n >= 1000 and n < 10000:
  print(909)
  exit()
if n >= 10000 and n < 100000:
  print(909 + (n-10000) + 1)
  exit
if n == 100000:
  print(90909)

Buggy submission (verdict: Runtime Error):
n = int(input())
if n < 10:
  print(n)
  exit()
if n >= 10 and n < 100:
  print(9)

if n >= 100 and n < 1000:
  #print(9 + (int(str(n)[-2:])) + 1)
  print(9 + (n-100) + 1)
  exit()
if n >= 1000 and n < 10000:
  print(909)
  exit()
if n >= 10000 and n < 100000:
  print(909 + (n-10000) + 1)
  exit
if n == 100000:
  print(90909)

Buggy submission (verdict: Runtime Error):
n = int(input())
if n < 10:
  print(n)
  exit()
if n >= 10 and n < 100:
  print(9)

if n >= 100 and n < 1000:
  #print(9 + (int(str(n)[-2:])) + 1)
  print(9 + (n-100) + 1)
  exit()
if n >= 1000 and n < 10000:
  print(909)
  exit()
if n >= 10000 and n < 100000:
  print(909 + (n-10000) + 1)
  exit
if n == 100000:
  print(90909)
Problem p02915 (python)

Fixed submission:
n = int(input())
answer = n * n * n
print(answer)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))score = 0
order = -1
for i in range(n):
  score += b[i]
  _order = a[i]
  
  if order+1 == _order:
    score += c[order - 1]
  order = _order
  
print(score)
Problem p02916 (python)

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

score = 0
order = -1

for i in range(n):
  score += b[i]
  _order = a[i]

  if order + 1 == _order:
    score += c[order - 1]
    
  order = _order

print(score)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))score = 0
order = -1
for i in range(n):
  score += b[i]
  _order = a[i]
  
  if order+1 == _order:
    score += c[order - 1]
  order = _order
  
print(score)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))score = 0
order = -1
for i in range(n):
 score += b[i]
 _order = a[i]
 if order+1 == _order:
   score += c[order - 1]
 order = _orderprint(score)
Problem p03107 (python)

Fixed submission:
S=input()

stack=[]
cnt=0
for s in S:
    if not stack:
        stack.append(s)
    elif s!=stack[-1]:
        stack.pop()
        cnt+=2
    else:
        stack.append(s)
        
print(cnt)

Buggy submission (verdict: Runtime Error):
import deque
S=input()

stack=deque()
cnt=0
for s in S:
    if not stack:
        stack.append(s)
    elif s!=stack[-1]:
        stack.pop()
        cnt+=2
    else:
        stack.append(s)
        
print(cnt)
Problem p03207 (python)

Fixed submission:
N=int(input())
p = [int(input()) for _ in range(N)]

print(sum(p) - int(max(p)/2))

Buggy submission (verdict: Runtime Error):
N=int(input())
p = [int(input) for _ in range(len(N))]

print(sum(p) - int(max(p)/2))
Problem p02820 (python)

Fixed submission:
def ints():
  return [int(x) for x in input().split()]
def ii():
  return int(input())

n, k = ints()
R, S, P = ints()
cpu = input()
jibun = [0] * n

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

for i in range(n):
  c = cpu[i]
  if c=='r':
    t = ['p']
  elif c=='s':
    t = ['r']
  else:
    t = ['s']

  j = i-k
  if j>=0:
    o = jibun[j]
    te = t[0]
    if te in o:
      if len(o)==1:
        ww = w.copy()
        ww.remove(te)
        t = ww
      else:
        o.remove(te)

  jibun[i] = t

s = 0
for i in range(n):
  w = jibun[i][0]+cpu[i]
  if w=='rs':
    s += R
  elif w=='sp':
    s += S
  elif w=='pr':
    s += P
print(s)

Buggy submission (verdict: Runtime Error):
def ints():
  return [int(x) for x in input().split()]
def ii():
  return int(input())

n, k = ints()
R, S, P = ints()
cpu = input()
jibun = [0] * n

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

for i in range(n):
  c = cpu[i]
  if c=='r':
    t = ['p']
  elif c=='s':
    t = ['r']
  else:
    t = ['s']

  j = i-k
  if j>=0:
    o = jibun[j]
    te = t[0]
    if te in o:
      if len(o)==1:
        ww = w.copy()
        ww.remove(te)
        t = ww
      else:
        o.remove(te)

  jibun[i] = t

s = 0
for i in range(n):
  w = jibun[i][0]+cpu[i]
  if w=='rs':
    s += R
  elif w=='sp':
    s += S
  elif w=='pr':
    s += P
print(s)