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

Fixed submission:

def quick_sort(arr):
    left = []
    right = []
    if len(arr) <= 1:
        return arr

    # データの状態に左右されないためにrandom.choice()を用いることもある。
    # ref = random.choice(arr)
    ref = arr[0]
    ref_count = 0

    for ele in arr:
        if ele < ref:
            left.append(ele)
        elif ele > ref:
            right.append(ele)
        else:
            ref_count += 1
    left = quick_sort(left)
    right = quick_sort(right)
    return left + [ref] * ref_count + right


if __name__ == "__main__":
    k,n = list((map(int, input().split(' '))))
    a = list(map(int, input().split(' ')))
    # a = quick_sort
    result = 0
    for i in range(1,n):
        length = a[i]-a[i-1]
        result = max(length, result)
        
    length = a[0] + (k-a[n-1])
    result = max(result, length)
    print(k-result)
    





      
# for i in range(10):
#     print(i)
#     if i%5==4:
#         break

Buggy submission (verdict: Runtime Error):


def quick_sort(arr):
    left = []
    right = []
    if len(arr) <= 1:
        return arr

    # データの状態に左右されないためにrandom.choice()を用いることもある。
    # ref = random.choice(arr)
    ref = arr[0]
    ref_count = 0

    for ele in arr:
        if ele < ref:
            left.append(ele)
        elif ele > ref:
            right.append(ele)
        else:
            ref_count += 1
    left = quick_sort(left)
    right = quick_sort(right)
    return left + [ref] * ref_count + right


if __name__ == "__main__":
    k,n = list((map(int, input().split(' '))))
    a = list(map(int, input().split(' ')))
    a = quick_sort
    result = 0
    for i in range(1,n):
        length = a[i]-a[i-1]
        result = max(length, result)
        
    length = a[0] + (k-a[n-1])
    result = max(result, length)
    print(k-result)
    





      
# for i in range(10):
#     print(i)
#     if i%5==4:
#         break

Buggy submission (verdict: Runtime Error):

def quick_sort(arr):
    left = []
    right = []
    if len(arr) <= 1:
        return arr

    # データの状態に左右されないためにrandom.choice()を用いることもある。
    # ref = random.choice(arr)
    ref = arr[0]
    ref_count = 0

    for ele in arr:
        if ele < ref:
            left.append(ele)
        elif ele > ref:
            right.append(ele)
        else:
            ref_count += 1
    left = quick_sort(left)
    right = quick_sort(right)
    return left + [ref] * ref_count + right


if __name__ == "__main__":
    k,n = list((map(int, input().split(' '))))
    a = list(map(int, input().split(' ')))
    a = quick_sort
    result = 0
    for i in range(1,n):
        length = a[i]-a[i-1]
        result = max(length, result)
        
    length = a[0] + (k-a[n-1])
    result = max(result, length)
    print(k-result)
    





      
# for i in range(10):
#     print(i)
#     if i%5==4:
#         break
Problem p02629 (python)

Fixed submission:
n = int(input())

m = {}
for i in range(0,26):
  m[i] = chr(97+i)

ans = ''
while 1:

  n -= 1

  x = n // 26
  y = n % 26

  ans = m[y] + ans

  n = x
  if n == 0:
    break

print(ans)

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

m = {}
for i in range(1,27):
  m[i] = chr(96+i)

ans = ''
while 1:
  x = n // 26
  y = n % 26

  ans = m[y] + ans
  
  if x == 0:
    break
  else:
    n = n // 26

print(ans)
Problem p02831 (python)

Fixed submission:
a,b = map(int,input().split())
import fractions
ans = a*b // fractions.gcd(a,b)
print(ans)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
import math
ans = a*b // math.gcd(a,b)
print(ans)
Problem p02659 (python)

Fixed submission:
a,b = map(str,input().split())
a = int(a)
if len(b) == 4:
    b = int(b[0] + b[2:])
    
else:
    b = int(b[0] + b[2] +'0')
tmp = str(a*b)
if len(tmp) <=2:
    print(0)
else:
    tmp = str(a*b)[:-2]
    print(int(tmp))

Buggy submission (verdict: Runtime Error):
a,b = map(float,input().split())

a = int(a)
b = int(b*100)
tmp = str(a*b)[:-2]
print(int(tmp))
Problem p02726 (python)

Fixed submission:
n,x,y = map(int,input().split())
ans = [0]*n
for i in range(1,n+1):
    for j in range(i+1,n+1):
        ans[min(abs(i-j) , abs(i-x)+1+abs(j-y), abs(i-y)+1+abs(j-x)) ]+=1
        
for i in range(1,n):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
import numpy as np
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
from scipy.sparse import csr_matrix

n,x,y = map(int,input().split())
graph = [[0 for i in range(n)]for j in range(n)]

for i in range(n-1):
    graph[i][i+1] = 1
    graph[i+1][i] = 1
    
graph[x-1][y-1] = 1
graph[y-1][x-1] = 1

ans = shortest_path(np.array(graph))
u, counts = np.unique(ans, return_counts=True)

for i in range(1,n):
    if i in u:
        print(int(counts[np.where(u==i)[0][0]]/2))
    else:print(0)
Problem p02777 (python)

Fixed submission:
s,t = input().split()
num_s,num_t =map(int,input().split())
u = input()
if u == s:
    num_s -= 1
else:
    num_t -= 1
print('{0} {1}'.format(num_s , num_t))

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
num_list = list(map(int , input().split()))
candidate = 0
for i in range(n-k):
    if i == 0:
        for j in range(k):
            candidate += (num_list[j]+1)/2
        tmp = candidate
    else:
        tmp += -(num_list[i-1]+1)/2 + (num_list[i+k]+1)/2
        if tmp > candidate:
            candidate = tmp
        
print(candidate)
Problem p02785 (python)

Fixed submission:
import numpy as np
n,k = map(int,input().split())
num_list = list(map(int,input().split()))
ans = 0
num_list = np.sort(num_list)[::-1]
num_list = np.array(num_list)

if k > len(num_list):
    ans = 0
    
else:
    for i in range(n-k):
        ans += num_list[i+k]
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
n,k = map(int,input().split())
num_list = list(map(int,input().split()))

num_list = np.sort(num_list)[::-1]
num_list = np.array(num_list)
for i in range(k):
    num_list = np.delete(num_list,0)
    
print(sum(num_list))
Problem p02829 (python)

Fixed submission:
a = int(input())
b = int(input())
num = [1,2,3]
num.remove(a)
num.remove(b)
print(num[0])

Buggy submission (verdict: Runtime Error):
import math
a,b = map(int,input().split())

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(a,b))
Problem p02831 (python)

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


print(lcm(a,b))

Buggy submission (verdict: Runtime Error):
import math
a,b = map(int,input().split())

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(123,456))
Problem p02832 (python)

Fixed submission:
n = int(input())
num_list = list(map(int,input().split()))
cnt = 0
num = 1
for i in num_list:
    if i != num:
        cnt += 1
    else:
        num += 1

if num == 1:
    print(-1)
    
else:print(cnt)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
def fcd(a , b):
    if a>= b:
        while b != 0:
            a,b = b,a%b
        return a
    
    else:
        while a != 0:
            b,a = a,b%a
        return b
    
    
def lcm(a,b):
    return a*b//fcd(a , b)


print(lcm(a,b))
Problem p02833 (python)

Fixed submission:
n = int(input())
if n%2 == 1:
    print(0)
    
else:
    if n < 10:
        print(0)
    else:
        list5 = []
        flag = True
        num = 5
        while flag:
            tmp = n//(num*2)
            if tmp > 0:
                list5.append(tmp)
                num *= 5
            else:
                flag = False
        ans_list = []
        for i in range(len(list5)-1):
            ans_list.append(list5[i] - list5[i+1])
        ans_list.append(list5[-1])
        ans = 0
        for i in range(len(ans_list)):
            ans += ans_list[i]*(i+1)
        print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
if n%2 == 1:
    print(0)
    
else:
    list5 = []
    flag = True
    num = 5
    while flag:
        tmp = n//(num*2)
        if tmp > 0:
            list5.append(tmp)
            num *= 5
        else:
            flag = False
    ans_list = []
    for i in range(len(list5)-1):
        ans_list.append(list5[i] - list5[i+1])
    ans_list.append(list5[-1])
    ans = 0
    for i in range(len(ans_list)):
        ans += ans_list[i]*(i+1)
    print(ans)
Problem p02912 (python)

Fixed submission:
import heapq
n,m = map(int,input().split())
price_list =list(map(lambda x : -int(x),input().split()))
heapq.heapify(price_list)

for i in range(m):
    dis = heapq.heappop(price_list)
    heapq.heappush(price_list, -(-dis//2)) 
print(-1*sum(price_list))

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
price_list = sorted(list(map(int,input().split())),reverse = True)for num in range(m):
    price_list[0] = price_list[0]//2
    price_list = sorted(price_list,reverse = True)
sum(price_list)
Problem p02933 (python)

Fixed submission:
num = int(input())
s = input()
if num  >= 3200:
    print(s)
else:
    print('red')

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
tree_list  = []
answer_list = [0]
for i in range(n-1):
    tree_list.append(list(map(int,input().split())))
    answer_list.append(0)
for i in range(m):
    num1,num2 = map(int,input().split())
    answer_list[num1-1] +=  num2
for i in range(n): 
    true = True
    while true:
        true = False
        print(i)
        for _ in tree_list:
            if i == _[0]-1:
                answer_list[_[1]-1] += answer_list[i]
                tree_list.remove(_)
                true = True
for i in answer_list:
    print(i)
Problem p03013 (python)

Fixed submission:
n,m = map(int,input().split())
dp = [0]*n

for i in range(m):
    dp[int(input())-1] = 10**12
    
if dp[0] == 10**12:
    dp[0] = 0
else:
    dp[0] = 1

if n == 1:
    print(dp[0])
else:
    if dp[1] == 10**12:
        dp[1] = 0
    else:
        dp[1] = 1+ dp[0]

    mod = 1000000007

    for i in range(2,n):
        if dp[i] == 10**12:
            dp[i] = 0
        else:
            dp[i] = dp[i-1] + dp[i-2]
            dp[i] %= mod
    print(dp[-1])

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
dp = [0]*n

for i in range(m):
    dp[int(input())-1] = 10**12
    
if dp[0] == 10**12:
    dp[0] = 0
else:
    dp[0] = 1

if dp[1] == 10**12:
    dp[1] = 0
else:
    dp[1] = 1+ dp[0]

mod = 1000000007

for i in range(2,n):
    if dp[i] == 10**12:
        dp[i] = 0
    else:
        dp[i] = dp[i-1] + dp[i-2]
        dp[i] %= mod
print(dp[-1])

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
dp = [0]*n

for i in range(m):
    dp[int(input())-1] = 10**12
    
if dp[0] == 10**12:
    dp[0] = 0
else:
    dp[0] = 1

if dp[1] == 10**12:
    dp[1] = 0
else:
    dp[1] = 1+ dp[0]

mod = 1000000007

if 2 in a_list:
    dp[1] = 0
for i in range(2,n):
    if dp[i] == 10**12:
        dp[i] = 0
    else:
        dp[i] = dp[i-1] + dp[i-2]
        dp[i] %= mod
print(dp[-1])

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
a_list = []
for i in range(m):
    a_list.append(int(input()))
    
mod = 1000000007

dp = [0]*n
dp[0] = 1
if 1 in a_list:
    dp[0] = 0
    
dp[1] = 1 + dp[0]
if 2 in a_list:
    dp[1] = 0
for i in range(2,n):
    if (i+1) in a_list:
        continue
    else:
        dp[i] = dp[i-1] + dp[i-2]
        dp[i] %= mod
print(dp[-1])

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
a_list = []
for i in range(m):
    a_list.append(int(input()))
    
mod = 1000000007

dp = [0]*n
dp[0] = 1
dp[1] = 1
if 1 in a_list:
    dp[0] = 0
if 2 in a_list:
    dp[1] = 0
for i in range(2,n):
    if (i+1) in a_list:
        continue
    else:
        dp[i] = dp[i-1] + dp[i-2]
        dp[i] %= mod
print(dp[-1])
Problem p03127 (python)

Fixed submission:
n = int(input())
 
A = list(map(int, input().split()))
 
t = max(A)
 
from fractions import gcd
 
for i in A:
    t = gcd(t, i)
print(t)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

n = int(input())
num_list = list(map(int,input().split()))
def gcd_list(numbers):
    return reduce(math.gcd, numbers)

print(gcd_list(num_list))
Problem p03221 (python)

Fixed submission:
N,M = map(int, input().split())  
piys = [[] for _ in range(N)]   
for i in range(M):  
    p, y = map(int, input().split())  
    piys[p-1].append((y,i))  

ans = [None]*M  
for p,iys in enumerate(piys):  
    iys.sort()  
    for k,(y,i) in enumerate(iys):  
        ans[i] = "%06d%06d" % (p+1,k+1)  

for i in ans:  
    print(i)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())

tmpsort = [[0]for i in range(n)]
p_list = []
y_list = []

for i in range(m):
    p,y = map(int,input().split())
    tmpsort[p-1].append(y)
    p_list.append(p)
    y_list.append(y)

for i in range(m):
    tmpsort[i].sort()
for i in range(len(p_list)):
    idx = tmpsort[p_list[i]-1].index(y_list[i])
    print((str(p_list[i]).zfill(6) + str(idx).zfill(6)))
Problem p02847 (python)

Fixed submission:
dist = {"MON":1,"TUE":2,"WED":3,"THU":4,"FRI":5,"SAT":6,"SUN":7}
i = str(input())
if i == "SUN":
  print(7)
else:
  print(dist["SUN"]-dist[i])

Buggy submission (verdict: Runtime Error):
dist = {"MON":0,"TUE":1,"WED":2,"THU":3,"FRI":4,"SAT":5,"FRI":6,"SUN":7}
i = str(input())
if i == "SUN":
  print(7)
else:
  print(dist["SUN"]-dist(i))
Problem p02622 (python)

Fixed submission:
from sys import stdin,stdout
LI=lambda:list(map(int,input().split()))
MAP=lambda:map(int,input().split())
IN=lambda:int(input())
S=lambda:input()
import math
def p(a):print(" ".join(list(map(str,a))))
from collections import Counter

s=S()
t=S()
x=0
for i in range(len(s)):
    if s[i]!=t[i]:x+=1
print(x)

Buggy submission (verdict: Runtime Error):
from sys import stdin,stdout
LI=lambda:list(map(int,input().split()))
MAP=lambda:map(int,input().split())
IN=lambda:int(input())
S=lambda:input()
import math
def p(a):print(" ".join(list(map(str,a))))
from collections import Counter

s=S()
t=t()
x=0
for i in range(len(s)):
    if s[i]!=t[i]:x+=1
print(x)
Problem p02659 (python)

Fixed submission:
from sys import stdin,stdout
LI=lambda:list(map(int,input().split()))
MAP=lambda:map(int,input().split())
IN=lambda:int(input())
S=lambda:input()
import math
from collections import Counter,defaultdict

a,b=input().split()
b=b.replace(".","")
ans=int(a)*int(b)
print(ans//100)

Buggy submission (verdict: Runtime Error):
from sys import stdin,stdout
LI=lambda:list(map(int,input().split()))
MAP=lambda:map(int,input().split())
IN=lambda:int(input())
S=lambda:input()
import math
from collections import Counter,defaultdict

a,b=input.split()
b.remove(".")
ans=int(a)*int(b)
print(ans//100)
Problem p02792 (python)

Fixed submission:
N = int(input())
mem = [[0]*10 for _ in range(10)]

for i in range(1,N+1):
    a = int(str(i)[0])
    b = int(str(i)[-1])
    mem[a][b] += 1

ans = 0
for i in range(1,N+1):
    a = int(str(i)[0])
    b = int(str(i)[-1])
    ans += mem[b][a]
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
mem=[[0] * 10 for _ in range(10)]

for i in range(1, N+1):
    s = str(i)
    mem[int(s[0])][int(s[-1])] += 1 
    
ans = 0
for i in range(1, 10):
    for j in range(1, 10):
        ans += mem[i][j] * mem[j][i]
print(ans)
Problem p03804 (python)

Fixed submission:
N,M=map(int,input().split())
A=[list(input()) for i in range(N)]
B=[list(input()) for i in range(M)]

ans=0
flag=0

for i in range(N-M+1):
    for j in range(N-M+1):
        if A[i][j]==B[0][0]:
            for k in range(0,M):
                for l in range(0,M):
                    if A[i+k][j+l]==B[k][l]:
                        ans+=1
                        if ans==M**2:
                            flag=1
                    else:
                        ans=0
                        break
    
print("Yes" if flag else "No")

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
A=[list(input()) for i in range(N)]
B=[list(input()) for i in range(M)]

ans=0

for i in range(N-M+1):
    for j in range(N-M+1):
        if A[i][j]==B[0][0]:
            for k in range(0,M):
                for l in range(0,M):
                    if A[i+k][j+l]==B[k][l]:
                        ans+=1
                        if ans==M**2:
                            flag=1
                    else:
                        ans=0
                        break
    
print("Yes" if flag else "No")
Problem p02759 (python)

Fixed submission:
print(-(-int(input()) // 2))

Buggy submission (verdict: Runtime Error):
print((int(input() + 1) // 2)
Problem p02859 (python)

Fixed submission:
print(int(input())**2)

Buggy submission (verdict: Runtime Error):
print(int(input() ** 2)
Problem p03137 (python)

Fixed submission:
N, M = map(int, input().split())
X = list(map(int, input().split()))

X.sort()

result = 0
temp = []
if M <= N:
    print(0)
else:
    for i in range(M-1):
        temp.append(-(X[i] - X[i+1]))
    temp.sort()
    for i in range(M-N):
        result += temp[i]
    print(result)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
X = list(map(int, input().split()))

X.sort()

temp = []
if N >= M:
    print(0)
else:
    result = 0
    for i in range(M-1):
        temp.append(-(X[i] - X[i+1]))
    temp.sort()
    for i in range(N+1):
        result += temp[i]
    print(result)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
X = list(map(int, input().split()))

X.sort()

temp = []
if N > M:
    print(0)
else:
    result = 0
    for i in range(M-1):
        temp.append(-(X[i] - X[i+1]))
    temp.sort()
    for i in range(N+1):
        result += temp[i]
    print(result)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
X = list(map(int, input().split()))

X.sort()
X.reverse()

if N > M:
    print(0)
else:
    temp = []
    for i in range(M):
        if i < M - 1:
            temp.append(X[i] - X[i+1])
    temp.sort()
    result = 0
    for i in range(N+1):
        result += temp[i]
    print(result)
Problem p03208 (python)

Fixed submission:
N, K = map(int, input().split())
h = [int(input()) for i in range(N)]
h.sort()
print(min(h[i+K-1] - h[i] for i in range(N-K+1)))

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

N, K = map(int, input().split())
h = [int(input()) for i in range(N)]

h.sort()
median = statistics.median(h)
idx = np.abs(np.asarray(h) - median).argmin()
result = 10 ** 9

if abs(h[idx] - h[idx-(K-1)]) < abs(h[idx+(K-1)] - h[idx]):
    result = abs(h[idx] - h[idx-(K-1)])
else:
    result = abs(h[idx+(K-1)] - h[idx])
print(result)

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

N, K = map(int, input().split())
h = [int(input()) for i in range(N)]

h.sort()
median = statistics.median(h)
result = 10 ** 9

idx = np.abs(np.asarray(h) - median).argmin()
if h[idx] - h[idx-(K-1)] <= h[idx+(K-1)] - h[idx]:
    result = h[idx] - h[idx-(K-1)]
else:
    result = h[idx+(K-1)] - h[idx]
print(result)
Problem p02627 (python)

Fixed submission:
a = input()
if a.isupper():
    print('A')
else:
    print('a')

Buggy submission (verdict: Runtime Error):
a = input()
if a.isupper():
    print(A)
else:
    print(a)

Buggy submission (verdict: Runtime Error):
a = input()
if (a >= 'a' and a <= 'z'):
    print(A)
elif(a >= 'A' and a <= 'Z'):
    print(a)

Buggy submission (verdict: Runtime Error):
a = input()
if (a >= 'a' and a <= 'z')
    print(A)
elif(a >= 'A' and a <= 'Z')
    print(a)
Problem p02629 (python)

Fixed submission:
a = int(input())
c = ''
while (a > 26):
    b = int(a) % 26
    c += chr(ord('a') + (25 if b == 0 else int(b) - 1))
    a = int(a / 26 - 1 if a % 26 == 0 else a / 26)
c += chr(ord('a') + int(a) - 1)
print(c[::-1])

Buggy submission (verdict: Runtime Error):
a = int(input())
c = ''
while (a >= 26):
    b = a % 26
    c += chr(ord('a') + b - 1)
    a /= 26
c += chr(ord('a') + int(a) - 1)
print(c[::-1])
Problem p02659 (python)

Fixed submission:
A,B = input().split()
print(int(A) * int(float(B)*1000)//1000)

Buggy submission (verdict: Runtime Error):
A,B = input().split()
print(int(A) * float(B)*100)//100)
Problem p02623 (python)

Fixed submission:
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a, b = [0], [0]

for i in range(len(A)):
    a.append(a[i] + A[i])
for i in range(len(B)):
    b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N+1):
    if a[i] > K:
        break
    while a[i] + b[j] > K:
        j -= 1
    ans = max(ans, i+j)
    
print(ans)

Buggy submission (verdict: Runtime Error):
def readable(A, B, K):
    books_num = 0
    time = 0
    
    while(time < K):
        if len(A) == 0 and len(B) == 0:
            break
        elif len(A) != 0 and len(B) != 0:
            if A[0] < B[0]:
                time += A[0]
                temp = A[0]
                A.remove(A[0])
            else:
                time += B[0]
                temp = B[0]
                B.remove(B[0])
        elif len(A) == 0:
            time += B[0]
            temp = B[0]
            B.remove(B[0])
        elif len(B) == 0:
            time += A[0]
            temp = B[0]
            A.remove(A[0])
        if time <= K:
            books_num += 1
        
    return books_num

if __name__ == "__main__":
    N, M, K = map(int, input().split())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    print(readable(A, B, K))
Problem p02627 (python)

Fixed submission:
a = input()
print('A' if a.isupper() else 'a')

Buggy submission (verdict: Runtime Error):
a = input()
print('A' a.isupper() else 'a')

Buggy submission (verdict: Runtime Error):
b = int(input())
print('A' if b.islower() else 'a')
Problem p02676 (python)

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

if len(S) <= K:
  print(S)
else:
  print(S[:K] + '...')

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

if len(S) <= K:
  print(S)
else:
  print(s[:K] + '...')
Problem p02676 (python)

Fixed submission:
K=int(input())
S=input()
 
def printt(S,K):
  if len(S)<=K:
    print(S)
  else:
    print(S[:K]+'...')
      
printt(S,K)

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

def printt(S,K):
	if len(S)<=K:
      print(S)
    else:
      print(s[:k]+'...')
      
printt(S,K)
Problem p02682 (python)

Fixed submission:
abck=list(map(int,input().split()))
a=abck[0]
b=abck[1]
c=abck[2]
k=abck[3]

if a>=k:
    print(k)
elif a<k:
    if a+b>=k:
        print(a)
    else:
        print(a-(k-a-b))

Buggy submission (verdict: Runtime Error):
abck=list(input().split())
a=abck[0]
b=abck[1]
c=abck[2]
k=abck[3]

if a>=k:
    print(a)
elif a<k:
    if a+b>k:
        print(a)
    else:
        print(a-(k-a-b))

Buggy submission (verdict: Runtime Error):
abck=list(map(int,input().split()))
a=abck[0]
b=abck[1]
c=abck[2]
k=abck[3]

list=[]+[1]*a+[0]*b+[-1]*c
ans=0
for i in range(k):
    ans+=list[i]

print(ans)
Problem p02723 (python)

Fixed submission:
s=input()

if s[2]==s[3]:
  if s[4]==s[5]:
    print("Yes")
  else:
    print('No')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
k,n=map(int,input().split())
houses=list(map(int,input().split()))
houses.sort()
maxx=-float('INF')
for i in range(n-1):
    if houses[i+1]-houses[i]>maxx:
        maxx=houses[i+1]-houses[i]

maxx=max([maxx,k-(houses[-1]-houses[0])])
print(maxx)
Problem p02699 (python)

Fixed submission:
# AtCoder
S, W = map(int, input().split())
if S <= W:
    print('unsafe')
else:
    print('safe')

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

Fixed submission:
#AtCoder

N, A, B = map(int, input().split())
q, mod = divmod(N,(A+B))
blue = (q*A)
blue += min(mod, A)

print(blue)

Buggy submission (verdict: Runtime Error):
#AtCoder

N, A, B = map(int, input().split())

b = 'b'*A
r = 'r'*B

s = ''
while True:
    if len(s) >= N:
        break
    s += b
    s += r

print(s[:N].count('b'))