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

Fixed submission:
N = int(input())

def num_withdraw_l(N):
    dp = [N] * (N + 1)
    dp[0] = 0
    for n in range(1, N+1):
        dp[n] = min(dp[n], dp[n - 1] + 1)
        coin = 6
        while coin <= N:
            dp[n] = min(dp[n], dp[n - coin] + 1)
            coin *= 6
        coin = 9
        while coin <= N:
            dp[n] = min(dp[n], dp[n - coin] + 1)
            coin *= 9
    return dp[N]

print(num_withdraw_l(N))

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

ef num_withdraw_ll(N):
    dp = [N] * (N + 1)
    dp[0] = 0
    for n in range(0, N):
        dp[n + 1] = min(dp[n + 1], dp[n] + 1)
        coin = 6
        while n + coin <= N:
            dp[n + coin] = min(dp[n + coin], dp[n] + 1)
            coin *= 6
        coin = 9
        while n + coin <= N:
            dp[n + coin] = min(dp[n + coin], dp[n] + 1)
            coin *= 9
    return dp[N]

print(num_withdraw_ll(N))

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

def num_withdraw_ll(N):
    dp = [N] * (N + 1)
    dp[0] = 0
    for n in range(1, N):
        dp[n + 1] = min(dp[n + 1], dp[n] + 1)
        coin = 6
        while coin <= N:
            dp[n + coin] = min(dp[n + coin], dp[n] + 1)
            coin *= 6
        coin = 9
        while coin <= N:
            dp[n + coin] = min(dp[n + coin], dp[n] + 1)
            coin *= 9
    return dp[N]    

print(num_withdraw_ll(N))
Problem p02659 (python)

Fixed submission:
a, b = input().split()
b = b.replace('.', '')
p = str(int(a)*int(b))[:-2]
if len(p) < 1:
  p = 0
print(p)

Buggy submission (verdict: Runtime Error):
import math

a,b = map(int, input().split())
print(math.floor(a * b))
Problem p02781 (python)

Fixed submission:
import sys
sys.setrecursionlimit(100000)

def ii(): return int(input())
def iis(): return input().split()
def imi(): return map(int,iis())
def iil(): return list(imi())


factmemo={0:1} #階乗
def fact(n):
    if n in factmemo:
        return factmemo[n]
    k = n*fact(n-1)
    factmemo[n]=k
    return k

def comb(a,b):
    if a-b < 0:
        return 0
    return fact(a)//(fact(a-b)*fact(b)) #組み合わせ

def aaa(n,k):
    r = len(str(n))-1
    st = str(n)
    ans = 0
    if k==1 and r>=0:
        ans += 9*r \
               + int(st[0])
    elif k==2 and r>=1:
        ans += 9**2 * comb(r, 2) \
               + (int(st[0])-1) * 9**1 * comb(r, 1) \
               + aaa(n%(10**r), k-1)
    elif k==3 and r>=2:
        ans += comb(r, 3)*9**3\
               +comb(r, 2)*9**2*(int(st[0])-1)\
               +aaa(n%(10**r), k-1)
    return ans

n = int(input())
k = int(input())
ans = aaa(n,k)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100000)

def ii(): return int(input())
def iis(): return input().split()
def imi(): return map(int,iis())
def iil(): return list(imi())


factmemo={0:1} #階乗
def fact(n):
    if n in factmemo:
        return factmemo[n]
    k = n*fact(n-1)
    factmemo[n]=k
    return k

def comb(a,b):
    if a-b < 0:
        return 0
    return fact(a)//(fact(a-b)*fact(b)) #組み合わせ

n = int(input())
k = int(input())
r = len(str(n))-1
st = str(n)
ans = 0
if k==1:
    ans += 9*r + int(st[0])
elif k==2:
    ans += 9**2 * comb(r, 2) + (int(st[0])-1) * 9**1 * comb(r, 1) + 9**1 * comb(r-1, 1) + int(st[1])
elif k==3:
    ans += comb(r, 3)*9**3\
           +comb(r, 2)*9**2*(int(st[0])-1)\
           +comb(r-1,2)*9**2\
           +comb(r-1, 1)*9**1*(int(st[1])-1)\
           +comb(r-2,1)*9\
           +int(st[2])




print(ans)
Problem p02860 (python)

Fixed submission:

t = int(input())
s = input()
if s[:t//2]==s[t//2:]:
  print('Yes')
else: print('No')

Buggy submission (verdict: Runtime Error):
s = input()
t = len(s)
if s[:t//2]==s[s//2]:
  print('Yes')
else: print('No')

Buggy submission (verdict: Runtime Error):
s = input()
t = len(s)
if s[:t//2]=s[s//2]:
  print('Yes')
else: print('No')
Problem p02959 (python)

Fixed submission:
import sys
sys.setrecursionlimit(100000)
input=sys.stdin.readline
def intinput():return map(int,input().split())


n=int(input())
a=list(intinput())
b=list(intinput())
ans=0
for i in range(n):
    if a[i]+a[i+1]<b[i]:
        ans+=a[i]+a[i+1]
        a[i+1]=0
    else:
        ans+=b[i]
        a[i+1]-=0 if a[i]-b[i]>0 else b[i]-a[i]
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100000)
input=sys.stdin.readline
def intinput():return map(int,input().split())


n=int(input())
a=list(intinput())
b=list(intinput())
ans=0
print(a)
for i in range(n):
    if a[i]+a[i+1]<b[i]:
        ans+=a[i]+a[i+1]
        a[i+1]=0
        print(a,0)
    else:
        ans+=b[i]
        a[i+1]-=0 if a[i]-b[i]>0 else b[i]-a[i]
        print(a,1)
print(ans)
Problem p03013 (python)

Fixed submission:
import sys
sys.setrecursionlimit(100000)

def intinput(): return map(int,sys.stdin.readline().split())

fib={0:0,1:1,2:1}
for i in range(3,100003):
    fib[i]=fib[i-1]+fib[i-2]
  #  fib.append(fib[i-1]+fib[i-2])

n,m=intinput()
mod=10**9+7
a=[int(sys.stdin.readline()) for _ in range(m)]
if m!=0:
    l=[a[0]]
    for i in range(len(a)-1):
        l.append(a[i+1]-a[i]-1)
    l.append(n-a[-1])
    k=1
    for i in l:
        k=fib[i]*k%mod
    print(k%mod)
else:
    print(fib[n+1]%mod)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100000)

def intinput(): return map(int,sys.stdin.readline().split())

fib={0:0,1:1,2:1}
for i in range(3,100003):
    fib[i]=fib[i-1]+fib[i-2]
  #  fib.append(fib[i-1]+fib[i-2])

n,m=intinput()
mod=10**9+7
a=[int(sys.stdin.readline()) for _ in range(m)]
l=[a[0]]
for i in range(len(a)-1):
    l.append(a[i+1]-a[i]-1)
l.append(n-a[-1])
k=1
for i in l:
    k=fib[i]*k%mod
print(k%mod)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100001)

def intinput(): return map(int,sys.stdin.readline().split())

fibmemo={1:1,2:1}
for i in range(3,100000):
    fibmemo[i]=fibmemo[i-1]+fibmemo[i-2]
def fib(n):
    return fibmemo[n]

n,m=intinput()
mod=10**9+7
a=[int(sys.stdin.readline()) for _ in range(m)]
m=fib(a[0])
tmp=a[0]
for i in a:
    if i+1 in a:
        print(0)
        sys.exit()
    if a[0]==i:
        continue
    m=fib(i-tmp-1)*m%mod
    tmp=i
m=fib(n-tmp)*m%mod
print(m)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100000)

def intinput(): return map(int,sys.stdin.readline().split())

fibmemo={1:1,2:1}
for i in range(3,100000):
    fibmemo[i]=fibmemo[i-1]+fibmemo[i-2]
def fib(n):
    return fibmemo[n]

n,m=intinput()
mod=10**9+7
a=[int(sys.stdin.readline()) for _ in range(m)]
m=fib(a[0])
tmp=a[0]
for i in a:
    if i+1 in a:
        print(0)
        sys.exit()
    if a[0]==i:
        continue
    m=fib(i-tmp-1)*m%mod
    tmp=i
m=fib(n-tmp)*m%mod
print(m)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100000)

def intinput(): return map(int,sys.stdin.readline().split())

fibmemo={1:1,2:1}
def fib(n):
    if n in fibmemo:
        return fibmemo[n]
    k=fib(n-2)+fib(n-1)
    fibmemo[n]=k
    return k

n,m=intinput()
mod=10**9+7
a=[int(sys.stdin.readline()) for _ in range(m)]
m=fib(a[0])
tmp=a[0]
for i in a:
    if i+1 in a:
        print(0)
        sys.exit()
    if a[0]==i:
        continue
    m=fib(i-tmp-1)*m%mod
    tmp=i
m=fib(n-tmp)*m%mod
print(m)
Problem p03038 (python)

Fixed submission:
import sys

def intinput(): return map(int,sys.stdin.readline().split())

n,m=intinput()
a = list(intinput())
a = [(a[x],1) for x in range(n)]
for i in range(m):
    b,c=intinput()
    a.append((c,b))
a.sort(reverse=1)
res,cnt=0,n
for (x,y) in a:
    k = min(cnt,y)
    res += k*x
    cnt -= k
print(res)

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

def intinput():
    return map(int,sys.stdin.readline().split())

n,m=intinput()
a = list(intinput())
x = np.zeros((2,m),dtype="int64")
for i in range(m):
    x[0,i],x[1,i]=intinput()
y = np.empty(n+np.sum(x[0]),dtype="int64")
y[0:n]=a
x = x.T
k = 0
for i in x:
    y[n+k:n+k+i[0]]=i[1]
    k+=i[0]
y=np.sort(y)[::-1]
print(np.sum(y[0:n]))

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

def intinput():
    return map(int,sys.stdin.readline().split())

n,m=intinput()
a = list(intinput())
x = np.zeros((2,m),int)
for i in range(m):
    x[0,i],x[1,i]=intinput()
y = np.empty(n+np.sum(x[0]),dtype="int64")
y[0:n]=a
x = x.T
k = 0
for i in x:
    y[n+k:n+k+i[0]]=i[1]
    k+=i[0]
y=np.sort(y)[::-1]
print(np.sum(y[0:n]))

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

def intinput():
    return map(int,sys.stdin.readline().split())

n,m=intinput()
a = list(intinput())
x = np.zeros((2,m),int)
for i in range(m):
    x[0,i],x[1,i]=intinput()
y = np.empty(n+np.sum(x[0]),int)
y[0:n]=a
x = x.T
k = 0
for i in x:
    y[n+k:n+k+i[0]]=i[1]
    k+=i[0]
y=np.sort(y)[::-1]
print(np.sum(y[0:n]))
Problem p02785 (python)

Fixed submission:
# def sort(A):
#     if len(A) < 2:
#         return A
#     c = len(A)//2
#     return merge(sort(A[:c]), sort(A[c:]))

# def merge(X, Y):
#     if len(X) < 1:
#         return Y
#     if len(Y) < 1:
#         return X
#     if (X[0] < Y[0]):
#         return [Y[0]]+ merge(X, Y[1:])
    # else:
#         return [X[0]] + merge(X[1:], Y)

N, K = map(int, input().split())
enemyHP = list(map(int, input().split()))
# enemyHP = sort(enemyHP)
enemyHP.sort(reverse=True)
if(len(enemyHP) <= K):
    print(0)
else:
    print(sum(enemyHP[K:]))

Buggy submission (verdict: Runtime Error):
def sort(A):
    if len(A) < 2:
        return A
    c = len(A)//2
    return merge(sort(A[:c]), sort(A[c:]))

def merge(X, Y):
    if len(X) < 1:
        return Y
    if len(Y) < 1:
        return X
    if (X[0] < Y[0]):
        return [Y[0]]+ merge(X, Y[1:])
    else:
        return [X[0]] + merge(X[1:], Y)

N, K = map(int, input().split())
enemyHP = list(map(int, input().split()))
enemyHP = sort(enemyHP)
if(len(enemyHP) <= K):
    print(0)
else:
    print(sum(enemyHP[K:]))
Problem p02792 (python)

Fixed submission:
N = int(input())

c = [[0]* 10 for i in range(10)]

for i in range(1, N+1):
    s = str(i)
    c[int(s[0])][int(s[-1])] += 1

ans = 0
for i in range(10):
    for j in range(10):
        ans += c[i][j] * c[j][i]

print(ans)

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

c = [[0] for i in range(10)]

for i in range(1, N+1):
    s = str(i)
    c[int(s[0])][int(s[-1])] += 1

ans = 0

for i in range(10):
    for j in range(10):
        ans += c[i][j] * c[j][i]

print(ans)
Problem p03834 (python)

Fixed submission:

s = input()

print(s.replace(',',' '))

Buggy submission (verdict: Runtime Error):

k,s = map(int,input().split())

count = 0

for x in range(0,k+1):
    #print(x)
    for y in range(0,k+1):
        #print(y)
        if 0 <= (s-x-y) and (s-x-y) <= k:
            count += 1
print(count)
Problem p02682 (python)

Fixed submission:

#a,b=(int(x) for x in input().split()) #数値の時




#a,b=(x for x in input().split()) 
a,b,c,k=(int(x) for x in input().split())

if(k<=a):
  print(k)
else:
  sum=a
  t=k-a
  if(t<=b):
    print(sum)
    
  else:
    t-=b
    
    
    print(sum-t)

Buggy submission (verdict: Runtime Error):
a,b,c,k=(int(x) for x in input().split())

if(k<=a):
  print(a*len(k))
else:
  sum=a*len(k)
  t=k-a
  if(t<=b):
    print(sum+b*len(t))
  else:
    sum+=b*len(t)
    t2=t-c
    print(sum+c*len(t2))
Problem p02699 (python)

Fixed submission:
S, W = map(int, input().split())

if S <= W :
  print('unsafe')
else :
  print('safe')

Buggy submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())
while 1:
  C -= B
  if C <= 0:
    print('Yes')
    break
  A -= D
  if A < 0:
     print('No')
     break

Buggy submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())
while 1:
  C -= B
  if C <= 0:
    print('Yes')
    break
  A -= D
  if A < 0:
     print('No')
     break

Buggy submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())
while true:
  C -= B
  if C <= 0:
    print('Yes')
    break
  A -= D
  if A < 0:
     print('No')
      break

Buggy submission (verdict: Runtime Error):
S, W = map(int, input().split())
if S < = W :
  print('unsafe')
else :
  print('safe')
Problem p03775 (python)

Fixed submission:
n = int(input())
a = int(n **(0.5) + 1)
num = 1
for i in range(1,a + 1):
    if  n%i == 0:
        num = i
ans = max(num, n // num)
print(len(str(ans)))

Buggy submission (verdict: Runtime Error):
N = int(input())
max_num = []
  
def yakusu(num):
    cd = []
    for i in range(1, int(num*0.5 + 1)):
        if num % i ==0:
            cd.append(i)
    return cd
  
for A in yakusu(N):
    for B in yakusu(N):
        if A * B == N:
            max_num.append(max(A, B))
            
print(len(str(max(max_num))))
Problem p02781 (python)

Fixed submission:
from functools import lru_cache

N=int(input())
K=int(input())
 
@lru_cache(None)
def F(N, K):
    """N以下で0でないものがちょうどK個。0を含める"""
#     assert N >= 0
    if N < 10:
        if K == 0:
            return 1
        if K == 1:
            return N
        return 0
    q,r = divmod(N,10)
    ret = 0
    if K >= 1:
        # 1の位が nonzero
        ret += F(q, K-1) * r
        ret += F(q-1, K-1) * (9-r)
    # 1の位が zero
    ret += F(q, K)
    return ret
 
# F(100, 1), F(25, 2), F(314159, 2)
 
print(F(N, K))

Buggy submission (verdict: Runtime Error):
from functools import lru_cache

N, K = map(int,input().split())
 
@lru_cache(None)
def F(N, K):
    """N以下で0でないものがちょうどK個。0を含める"""
#     assert N >= 0
    if N < 10:
        if K == 0:
            return 1
        if K == 1:
            return N
        return 0
    q,r = divmod(N,10)
    ret = 0
    if K >= 1:
        # 1の位が nonzero
        ret += F(q, K-1) * r
        ret += F(q-1, K-1) * (9-r)
    # 1の位が zero
    ret += F(q, K)
    return ret

 
print(F(N, K))

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

n=str(N)
n_digi=len(n)

import math

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)


if n_digi < K:
    print(0)

else:
    ans=0
    
    if n_digi>K:
        ans += permutations_count(n_digi-1,K)*9
    
    keta1=int(n[0])
    nokori=n[1:]
    
    if keta1 != 1 and K!=1:
        ans += (keta1-1)*ermutations_count(n_digi-2,K-1)*9
        
    elif keta1 != 1 and K==1:
        ans += (keta1-1)
        
    elif K==1 and int(nokori)==0:
        ans += 1
        
    else:
        noko_list = list(nokori)
        aa=1
        bb=sum(noko_list)
        for j in noko_list:
            aa *=j
             
        ans += aa-bb*(K-1)
Problem p02793 (python)

Fixed submission:
from functools import reduce
import fractions
 
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
 
n = int(input())

inp_list = list(map(int,(input().split())))

lcm = lcm_list(inp_list)

ans = 0
mod = 10**9+7

for i in inp_list:
    ans += lcm // i



print(ans % mod)

Buggy submission (verdict: Runtime Error):
from functools import reduce
import fractions
 
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)


n = int(input())

inp_list = list(map(int,(input().split())))

lcm = lcm_list(inp_list)

ans = 0

for i in inp_list:
    ans += lcm // i


print(ans % (10**9+7))
Problem p03075 (python)

Fixed submission:
# A - Five Antennas 

a = []

for i in range(6):
    a.append(int(input()))

if a[4] -a[0] <= a[5]:
    print('Yay!')
else:
    print(':(')

Buggy submission (verdict: Runtime Error):
# A - Five Antennas

for i in range(6):
    a[i] = int(input())

out_flag = False
    
for i in range(4):
    if a[i+1]-a[i] > a[5]:
        out_flag = True

if out_flag:    
    print(':(')
else:
    print('Yay!')
Problem p03295 (python)

Fixed submission:
# Youtubeをみて作りましょう


N, M = map(int, input().split())

request_list = []

for i in range(M):
    request_list.append(list(map(int,input().split())))
    
request_list.sort(key=lambda x: x[1])

ans = 0
f = False

while True:
    ans += 1
    end_point = request_list[0][1]
    for i in range(len(request_list)):
        if request_list[0][0] < end_point:
            del request_list[0]
            if len(request_list) == 0:
                f = True
                break
        else:
            break
            
            
    
    if f:
        break
    
print(ans)

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

N, M = map(int, input().split())

request_arr = np.zeros((M, N-1),dtype=np.int)

for i in range(M):
    a,b = map(int, input().split())
    request_arr[i][a-1:b-1] = 1




for counter in range(1,100000):
    max_index = np.argmax(request_arr.sum(axis=0))
    delete_raw = []
    for i in range(len(request_arr)):    
        if request_arr[i][max_index] == 1:
            delete_raw.append(i)
    request_arr = np.delete(request_arr,delete_raw,0)
    
    if len(request_arr) == 0:
        ans=counter
        break

print(ans)
Problem p03315 (python)

Fixed submission:
s = input()

ans = 0

for i in s:
	if i == '+':
		ans += 1
	else:
		ans -= 1
		
		
print(ans)

Buggy submission (verdict: Runtime Error):
import math

n, k = map(int, input().split())
aas = input()
a = n - k

num = math.ceil(a / (k-1))

print(num+1)

Buggy submission (verdict: Runtime Error):
import math

n, k = map(int, input().split())

a = n - k

num = math.ceil(a / (k-1))

print(num+1)
Problem p02729 (python)

Fixed submission:
n, m = map(int, input().split())
print(n*(n-1)//2 + m*(m-1)//2)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
print(n(n-1)//2 + m(m-1)//2)

Buggy submission (verdict: Runtime Error):
def nCr(n, r): 
  return (fact(n) / (fact(r)  
                * fact(n - r))) 
  
# Returns factorial of n 
def fact(n): 
  res = 1  
  for i in range(2, n+1): 
	res = res * i 
  return res
n, m = list(map(int, input().split()))

print(nCr(n + m, n) * nCr(n + m - 1, n - 1) + nCr(n + m, m) * nCr(n + m - 1, m - 1))
Problem p02990 (python)

Fixed submission:
n, k = map(int, input().split())
mod = 10**9 + 7

fact = [1] * (n+1)

for i in range(2, n+1):
	fact[i] = fact[i-1] * i


def nck(a,b):
    return fact[a] // (fact[b] * fact[a - b])

for i in range(1, k + 1):
	print((nck(n-k+1,i) * fact[k-1] // (fact[i-1] * fact[k-i])) % mod)

Buggy submission (verdict: Runtime Error):
import math

n, k = map(int, input().split())
mod = 10**9 + 7
def nck(a,b):
    return math.factorial(a) // (math.factorial(b) * math.factorial(a - b))

for i in range(1, k + 1):
	x = (nck(n-k+1,i) * math.factorial(k-1) // (math.factorial(i-1) * math.factorial(k-i))) % mod
	print(x)

Buggy submission (verdict: Runtime Error):
import math

n, k = map(int, input().split())
mod = 10**9 + 7
def nck(a,b):
    return math.factorial(a) // (math.factorial(b) * math.factorial(a - b))

for i in range(1, k + 1):
	x = (nck(n-k+1,i) * min(i, k-i+1)) % mod
	print(x)

Buggy submission (verdict: Runtime Error):
import math

n, k = map(int, input().split())
mod = 10**9 + 7
def nck(a,b):
    return math.factorial(a) // (math.factorial(b) * math.factorial(a - b))

for i in range(1, k + 1):
	x = (nck(n-k+1,i) * min(i, k-i+1)) % mod
	print(x)

Buggy submission (verdict: Runtime Error):
from sympy import factorial

n, k = map(int, input().split())
mod = 10**9 + 7
def nck(a,b):
    return factorial(a) // (factorial(b) * factorial(a - b))

for i in range(1, k + 1):
	x = (nck(n-k+1,i) * min(i, k-i+1)) % mod
	print(x)

Buggy submission (verdict: Runtime Error):
from sympy import factorial

n, k = map(int, input().split())
mod = 10**9 + 7
def nck(a,b):
    return factorial(a) // (factorial(b) * factorial(a - b))

for i in range(1, k + 1):
	x = (nck(n-k+1,i) * min(i, k-i+1)) % mod
	print(x)

Buggy submission (verdict: Runtime Error):
from fractions import factorial

n, k = map(int, input().split())
mod = 10**9 + 7
def nck(a,b):
    return factorial(a) // (factorial(b) * factorial(a - b))

for i in range(1, k + 1):
	x = (nck(n-k+1,i) * min(i, k-i+1)) % mod
	print(x)

Buggy submission (verdict: Runtime Error):
from math import factorial

n, k = map(int, input().split())
mod = 10**9 + 7
def nck(a,b):
    return factorial(a) // (factorial(b) * factorial(a - b))

for i in range(1, k + 1):
	x = (nck(n-k+1,i) * min(i, k-i+1)) % mod
	print(x)
Problem p02676 (python)

Fixed submission:
K = int(input())
S = input()
if len(S) > K:
	print(S[:K] + '...')
else:
	print(S)

Buggy submission (verdict: Runtime Error):
K = input()
S = input()
if len(s) > int(k):
  print(s[:k]+'...')
else:
  print(s)
Problem p02879 (python)

Fixed submission:
ams = 0
a,b = map(int, input().split())
if (a >=10 or b >= 10):
  ans = -1
else:
  ans = a*b
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = 0
flg = False

for i in range(10)[1:]:
  ans = n/i
  r = n%i
  if(ans<10 and r ==0):
    flg = True
    break
if(flg):
    print("Yes")
else:
    print("No")
Problem p03834 (python)

Fixed submission:
print(str(input().replace(","," ")))

Buggy submission (verdict: Runtime Error):
k,s = map(int, input().split())

count = 0
for i in range(k+1):
    if s-i > k:
        rang = k
    else:
        rang = s-i
    for j in range(rang+1):
        if s-i-j < 0:
            continue
        elif s-i-j > k:
            rangg = k
        else:
            rang = s-i-j
        for h in range(rang+1):
            if i+j+h == s:
                count += 1

print(count)

Buggy submission (verdict: Runtime Error):
k,s = map(int, input().split())

count = 0
for i in range(k+1):
    for j in range(k+1):
        if s - (i+j) <= k:
            count += 1

print(count)
Problem p02682 (python)

Fixed submission:
import sys
#import cython

def main():
    read = lambda: sys.stdin.readline().rstrip()
    
    #N: cython.longlong = 0
    A, B, C, K = map(int,read().split())
    print(K if A >= K else A if K-A <= B else A-(K-A-B))
    #a, b, c = map(int,read().split())
    #l = [int(read()) for _ in range(5)]
    

 
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys
#import cython

def main():
    read = lambda: sys.stdin.readline().rstrip()
    
    #N: cython.longlong = 0
    A, B, C, K = map(int,read().split())
    t = [1]*A+[0]*B+[-1]*C
    print(sum(t[:K]))
    #a, b, c = map(int,read().split())
    #l = [int(read()) for _ in range(5)]
    

 
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys
#import cython

def main():
    read = lambda: sys.stdin.readline().rstrip()
    
    #N: cython.longlong = 0
    A, B, C, K = map(int,read().split())
    t = [1]*A+[0]*B+[-1]*C
    print(sum(t[:K]))
    #a, b, c = map(int,read().split())
    #l = [int(read()) for _ in range(5)]
    

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

Fixed submission:
import math

def isPrime(n):
    if n == 1: return False
 
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
 
    return True
  
num = int(input())
 
res = True
ans = 0
if num > 2 and num%2 == 0:
  num += 1
while(res):
  if isPrime(num):
    print(num)
    break
  num += 2

Buggy submission (verdict: Runtime Error):
def isPrime(n):
    if n == 1: return False
 
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
 
    return True
  
num = input()
 
res = True
ans = 0
if num > 2 and num%2 == 0:
  num += 1
while(res):
  if isPrime(num):
    print(num)
    break
  num += 2

Buggy submission (verdict: Runtime Error):
def isPrime(n):
    if n == 1: return False
 
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
 
    return True
  
num = input()
 
res = True
ans = 0
if num > 2 and num%2 == 0:
  num += 1
while(res):
  if isPrime(num):
    return num
  num += 2

Buggy submission (verdict: Runtime Error):
def isPrime(n):
    if n == 1: return False
 
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
 
    return True
  
num = input()
 
res = True
ans = 0
if num > 2 and num%2 == 0:
  num += 1

Buggy submission (verdict: Runtime Error):
def isPrime(n):
    if n == 1: return False

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

    return True
  
num = input()

res = True
ans = 0
if num > 2 and num%2 == 0:
  num += 1
while(res):
  if isPrime(num):
    return num
  num += 2