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

Fixed submission:
n = int(input())
ans = ''
while n > 0:
    n, r = divmod(n-1, 26)
    ans = chr(r+ord('a')) + ans
print(ans)

Buggy submission (verdict: Runtime Error):

N = int(input())
# = map(int, input().split())
# = list(map(int, input().split()))
# = [int(input()) for i in range(N)]
# = [list(map(int, input().split())) for i in range(N)]
alpha = [chr(ord('a') + i) for i in range(26)]
name = []
number = []
a = 1
count = 0

while N//a > 0:
    a = a*26
    count += 1

a = a/26

for i in range(count):
    num = int(N//a)
    number.append(num)
    N = N - num*a
    a = a//26

print(number)

for i in range(count):
    if number[-i] == 0:
        for j in range(count-i-1):
            number[j] -= 1
        del number[0]
print(number)

for i in number:
    name.append(alpha[i-1])

result = "".join(name)
print(result)
Problem p02699 (python)

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

if W>=S:
    print("unsafe")
else:
    print("safe")

Buggy submission (verdict: Runtime Error):
S, W = map(int, input().split())

if W >= S:
    print(unsafe)
else:
    print(safe)

Buggy submission (verdict: Runtime Error):
S, W = map(int, input().split())

if W >= S:
    print(undafe)
else:
    print(safe)
Problem p02701 (python)

Fixed submission:
N = int(input())
S = [str(input()) for i in range(N)]

S = sorted(S)
count = 0
first = 0
removecount = 0

for i in range(N):
    j = 0
    while first + count + 1 < len(S) :
        if S[first]==S[first+1+j]:
            S[first+1+j] = "null"
            count+=1
            j += 1
        else:
            first += count + 1
            removecount += count
            count = 0
            break

print(len(S)-S.count("null"))

Buggy submission (verdict: Runtime Error):
N = int(input())
S = [str(input()) for i in range(N)]

S = sorted(S)
count = 0
first = 0
removecount = 0

for i in range(N):
    j = 0
    while first + count + 1 < len(S) :
        if S[first]==S[first+1+j]:
            S[first+1+j] = "nullsad"
            count+=1
            j += 1
            print(S)
        else:
            first += count + 1
            removecount += count
            count = 0
            print(S)
            break

for i in range(removecount + count):
    S.remove("nullsad")

print(len(S))
Problem p02873 (python)

Fixed submission:
S = list(map(str, input()))
N = len(S)+1
List = [0]*N
rightcount = 0
leftcount = 0

if S[0] == "<":
    leftcount+=1
else:
    rightcount+=1

for i in range(1, N-1):
    if S[i] == "<":
        leftcount+=1
        if S[i-1] == "<":
            List[i] = List[i-1]+1
        elif S[i-1] == ">":
            for j in range(rightcount):
                List[i-j] = j
            if List[i-rightcount]<=List[i-rightcount+1]:
                List[i-rightcount] = List[i-rightcount+1] + 1
            rightcount = 0


    if S[i] == ">":
        rightcount+=1
        if S[i-1] =="<":
            for j in range(leftcount+1):
                List[i-j] = leftcount - j
            leftcount = 0

if S[N-2] == "<":
    List[N-1] = List[N-2] + 1
else:
    for j in range(rightcount):
        List[N-1-j] = j
    if List[N-1-rightcount]<=List[N-1-rightcount+1]:
        List[N-1-rightcount] = List[N-1-rightcount+1] + 1

print(sum(List))

Buggy submission (verdict: Runtime Error):
S = list(map(str, input()))
N = len(S)+1
List = [0]*N
rightcount = 0
leftcount = 0

if S[0] == "<":
    leftcount+=1
else:
    rightcount+=1

for i in range(1, N-1):
    if S[i] == "<":
        leftcount+=1
        if S[i-1] == ">":
            for j in range(rightcount):
                List[i-j] = j
            if List[i-rightcount]<List[i-rightcount+1]:
                List[i-rightcount] = List[i-rightcount+1] + 1
            rightcount = 0


    if S[i] == ">":
        rightcount+=1
        if S[i-1] =="<":
            for j in range(leftcount+1):
                List[i-j] = leftcount - j
            leftcount = 0

if S[N-2] == "<":
    List[N-1] = 1
else:
    for j in range(rightcount):
        List[N-j] = j
    if List[N-rightcount]<List[N-rightcount+1]:
        List[N-rightcount] = List[N-rightcount+1] + 1

print(sum(List))
Problem p02624 (python)

Fixed submission:
N = int(input())
ans = 0
for i in range(1, N + 1):
    largest = N // i * i
    ans += ((largest + i) * (N // i)) // 2
print(ans)

Buggy submission (verdict: Runtime Error):
import math
N=int(input())
ans=0
for i in range(1,N):
  Y=math.ceil(N/i)
  ans+=(Y*(Y+1)*x)//2
print(ans)
Problem p02990 (python)

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

inv = [0] * 2000
inv[1] = 1
for i in range(2, 2000):
    inv[i] = (MOD - (MOD // i) * inv[MOD % i] % MOD) % MOD

fact = [0] * 2000
finv = [0] * 2000
fact[0] = 1
finv[0] = 1
for i in range(1, 2000):
    fact[i] = (i * fact[i - 1]) % MOD
    finv[i] = (inv[i] * finv[i - 1]) % MOD


def modcomb(n, r):
    if n < r or r < 0:
        return 0
    return fact[n] * finv[r] % MOD * finv[n - r] % MOD


for i in range(k):
    x = modcomb(n - k + 1, i + 1)
    y = modcomb(k - 1, i)
    print(x * y % MOD)

Buggy submission (verdict: Runtime Error):
factorial = [0] * 2000
factorial[0] = 1
factorial[1] = 1
for i in range(2, 2000):
    factorial[i] = i * factorial[i - 1]


def combination(n, r):
    return factorial[n] / (factorial[r] * factorial[n - r])


n, k = map(int, input().split())
MOD = 10 ** 9 + 7

for i in range(k):
    x = int(combination(n - k + 1, n - k - i) % MOD)
    y = int(combination(k - 1, i) % MOD)
    print(x * y % MOD)

Buggy submission (verdict: Runtime Error):
factorial = [0] * 2000
factorial[0] = 1
factorial[1] = 1
for i in range(2, 2000):
    factorial[i] = i * factorial[i - 1]


def combination(n, r):
    return factorial[n] / (factorial[r] * factorial[n - r])


n, k = map(int, input().split())
MOD = 10 ** 9 + 7

for i in range(k):
    x = int(combination(n - k + 1, i + 1) % MOD)
    y = int(combination(k - 1, i) % MOD)
    print(x * y % MOD)
Problem p03038 (python)

Fixed submission:
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
bc = [list(map(int, input().split())) for _ in range(m)]
bc.sort(key=lambda x: x[1], reverse=True)


def f():
    s = sum(a)
    i = 0
    for v in bc:
        b, c = map(int, v)
        while b > 0:
            if i >= n:
                return s
            if c <= a[i]:
                return s
            s += c - a[i]
            b -= 1
            i += 1
    return s


print(f())

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
bc = [list(map(int, input().split())) for _ in range(m)]
bc.sort(key=lambda x: x[1], reverse=True)


def f():
    s = sum(a)
    i = 0
    for v in bc:
        b, c = map(int, v)
        while b > 0:
            if c < a[i] or i >= n:
                return s
            s += c - a[i]
            b -= 1
            i += 1
    return s


print(f())
Problem p03208 (python)

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

Buggy submission (verdict: Runtime Error):
n, k = [int(i) for i in input().split()]
h = [int(input()) for i in range(n)]
h.sort()
print(min(h[k + ki - 1] - h[ki] for ki in range(k)))

Buggy submission (verdict: Runtime Error):
n, k = [int(i) for i in input().split()]
h = [int(input()) for i in range(n)]
INF = 10 ** 9 + 1

h.sort()
ans = INF
for ki in range(k):
    d = h[k + ki - 1] - h[ki]
    if ans > d:
        ans = d

print(ans)
Problem p02897 (python)

Fixed submission:
#l=list(map(int, input().split()))
#n,k=map(int, input().split())
#l=list(map(int, input().split()))
n = int(input())

if (n%2==0):
    ans = n//2/n
else:
    ans = (n//2+1)/n

print(ans)

Buggy submission (verdict: Runtime Error):
#l=list(map(int, input().split()))
a,b=map(int, input().split())
#l=list(map(int, input().split()))
#n = int(input())
def divisor(n): #nの約数を全て求める
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table

def cf(x1,x2):
    cf =[]
    cf.append(1)
    for i in range(2, min(x1,x2)+1):
        if x1 %i == 0 and x2 % i == 0:
            cf.append(i)
    return cf

def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1

ans = 1
temp1 = divisor(a)
temp2 = divisor(b)
hoge = []
if len(temp1) < len(temp2):
    hoge = temp1
    hoge2 = temp2
else:
    hoge = temp2
    hoge2 = temp1

temp = []
for i in hoge:
    if i in hoge2:
        temp.append(i)

#print (temp)
for i in temp:
    if is_prime(i):
        ans += 1

print (ans)
Problem p02935 (python)

Fixed submission:
a = int(input())
Lists = sorted(list(map(int, input().split())))

ans = Lists[0]

for i in range(1,a):
    ans += Lists[i]
    ans /= 2

print(ans)

Buggy submission (verdict: Runtime Error):
a = int(input())
Lists = list(map(int, input().split()))

ma = []

for j in range(a):
    test = Lists.pop(0)
    for i in Lists:
        ma.append((i+test)/2)

ma2 = []
for j in ma:
    test = ma.pop(0)
    for i in ma:
        ma2.append((i+test)/2)

print (max(ma2))
Problem p03042 (python)

Fixed submission:
s = input()

aa = int(s[0]+s[1])
bb = int(s[2]+s[3])

if bb <= 12 and bb >=1:
    if aa <= 12 and aa >=1:
        print("AMBIGUOUS")
    else:
        print("YYMM")
else:
    if aa <=12 and aa >=1:
        print("MMYY")
    else:
        print("NA")

Buggy submission (verdict: Runtime Error):
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]

n = int(input())
a = []
for i in range(n):
    s, p = map(str, input().split())
    p = int(p)
    a.append((s,p,i+1))
# 要素[1]を逆ソート
a.sort(key=lambda x:x[1], reverse=True)
# 要素[0]を順ソート
a.sort(key=lambda x:x[0])

for i in range(n):
    print(a[i][2])
Problem p03775 (python)

Fixed submission:
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [input() for _ in range(n)]

n = int(input())

i = 1
ans = 1000000000000
while i * i <= n:
    if (n % i == 0):
        a = i
        b = n//a
        a_keta = len(str(a))
        b_keta = len(str(b))
        m_keta = max(a_keta, b_keta)
        ans = min(ans, m_keta)
    i += 1
print(ans)

Buggy submission (verdict: Runtime Error):
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [input() for _ in range(n)]
import math

n = int(input())

ans = []

nj = int(math.sqrt(n))
for i in range(1,nj):
    a = i
    if n % a == 0:
        b = n // a
        tmp = max(len(str(a)), len(str(b)))
        #print(a,b)
        ans.append(tmp)
print(min(ans))
Problem p02571 (python)

Fixed submission:
S = input()
T = input()

ans = [0 for i in range(len(S)-len(T)+1)]
for i in range(len(S)-len(T)+1):
    cnt = len(T)
    for j in range(len(T)):
        if S[i+j] == T[j]:
            cnt -= 1
    ans[i] = cnt
print(min(ans))

Buggy submission (verdict: Runtime Error):
S = input()
T = input()

ans = [0 for i in range(len(S)-len(T))]
for i in range(len(S)-len(T)):
    cnt = len(T)
    for j in range(len(T)):
        if S[i+j] == T[j]:
            cnt -= 1
    ans[i] = cnt
print(min(ans))
Problem p02711 (python)

Fixed submission:
N = input()

flag = 0

if N[0] == '7':
    flag = 1
if N[1] == '7':
    flag = 1
if N[2] == '7':
    flag = 1

if flag == 1:
    print('Yes')
else:
    print('No')

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


for i in range(1, N-1):
    for j in range(i+1, N):
        if S[i-1] == S[j-1]:
            pass
        else:
            for k in range(j+1, N+1):
                if (S[i-1] != S[k-1]) and (S[j-1] != S[k-1]) and ((j-i) != (k-j)):
                    count += 1

print(count)
Problem p02753 (python)

Fixed submission:
s = input()
if s == 'AAA' or s == 'BBB':
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
s = input()
if s == 'AAA' or s = 'BBB':
    print('No')
else:
    print('Yes')
Problem p02831 (python)

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

Buggy submission (verdict: Runtime Error):
from fractions import gcm
a, b = map(int, input().split())
print(a*b/gcm(a, b))

Buggy submission (verdict: Runtime Error):
from math import gcm
a, b = map(int, input().split())
print(a*b/gcm(a, b))

Buggy submission (verdict: Runtime Error):
from numpy import lcm
a, b = map(int, input().split())
print(lcm(a, b))

Buggy submission (verdict: Runtime Error):
from numpy import lcm
a, b = map(int, input().split())
print(lcm(a, b))
Problem p02833 (python)

Fixed submission:
from math import log
n = int(input())
if n % 2 == 1 or n == 0:
    print(0)
else:
    m = n // 2
    total = 0
    for p in range(1, int(log(m, 5)) + 1):
        total += m // (5 ** p)
    print(total)

Buggy submission (verdict: Runtime Error):
from math import log
n = int(input())
if n % 2 == 1:
    print(0)
else:
    m = n // 2
    total = 0
    for p in range(1, int(log(m, 5)) + 1):
        total += m // (5 ** p)
    print(total)

Buggy submission (verdict: Runtime Error):
from math import log
n = int(input(n))
if n % 2 == 1:
    print(0)
else:
    m = n // 2
    total = 0
    for p in range(1, int(log(m, 5)) + 1):
        total += m // (5 ** p)
    print(total)
Problem p02699 (python)

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

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

count = 0
mod_check = {}
mod_check[0] = 1
check_S = 0
for i in reversed(S):
    check_S += int(i) * (10 ** count)
    mod = check_S % 2019
    mod_check.setdefault(mod, 0)
    mod_check[mod] += 1
    count += 1
mod_match = 0
for x in mod_check.values():
    mod_match += x * (x - 1) // 2
print(mod_match)
Problem p02773 (python)

Fixed submission:
N = int(input())
L = []
D = {}
for _ in range(N):
    x = input()
    L.append(x)

for x in L:
    D[x] = 0
    
for x in L:
    D[x] += 1

SortD = sorted(D.items(), key=lambda x:x[1])
maxD = SortD[-1][1]
ans = []
for x in reversed(SortD):
    if x[1] == maxD:
        ans.append(x[0])
    else:
        break
for x in sorted(ans):
    print(x)

Buggy submission (verdict: Runtime Error):
import collections
import itertools

N = int(input())
L = []
D = {}
for _ in range(N):
    x = input()
    L.append(x)

counter = collections.Counter(L)

mode_v = counter.most_common()[0][-1]
it = itertools.takewhile(
    lambda kv: kv[-1] == mode_v, counter.most_common()
)

print(sorted(*(k for k, v in it)))
Problem p02831 (python)

Fixed submission:
from fractions import gcd
A, B = map(int, input().split())
print(A * B // gcd(A, B))

Buggy submission (verdict: Runtime Error):
import math
A, B = map(int, input().split())
print(A * B // math.gcd(A, B))

Buggy submission (verdict: Runtime Error):
import math
A, B = map(int, input().split())
print(A * B // math.gcd(A, B))
Problem p02836 (python)

Fixed submission:
S = list(input())

firstS = S[:len(S) // 2]
if len(S) % 2 == 0:
    secondS = list(reversed(S[len(S) // 2:]))
else:
    secondS = list(reversed(S[len(S) // 2 + 1:]))

count = 0

for x in range(len(firstS)):
    if firstS[x] != secondS[x]:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
S = list(input())

firstS = S[:len(S) // 2]
secondS = list(reversed(S[len(S) // 2 + 1:]))

count = 0

for x in range(len(firstS)):
    if firstS[x] != secondS[x]:
        count += 1
print(count)
Problem p02859 (python)

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

Buggy submission (verdict: Runtime Error):
str = input()
print(str*str)
Problem p02987 (python)

Fixed submission:
S = input()
S = S.replace(S[0],"")
if len(S) > 0:
    S = S.replace(S[0],"")
    if len(S) == 0:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
S = input()
S = S.strip(S[0])

if len(S[0]) > 0:
    S = S.strip(S[0])
    if len(S) == 0:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
S = input()
S = S.strip(S[0])

if len(S[0]) > 0:
    S = S.strip(S[0])
    if len(S) == 0:
        print("YES")
    else:
        print("NO")
else:
    print("NO")
Problem p03073 (python)

Fixed submission:
S = list(input())
lenS = len(S)

patternA = []
patternB = []
countA = 0
countB = 0

for x in range(lenS):
    if x % 2 == 0:
        if S[x] == "0":
            countA += 1
        else:
            countB += 1
    else:
        if S[x] == "1":
            countA += 1
        else:
            countB += 1

if countA < countB:
    print(countA)
else:
    print(countB)

Buggy submission (verdict: Runtime Error):
import Levenshtein

S = list(input())
lenS = len(S)

patternA = []
patternB = []
countA = 0
countB = 0

for x in range(lenS):
    print(S[x])
    if x % 2 == 0:
        if S[x] == "0":
            countA += 1
        else:
            countB += 1
    else:
        if S[x] == "1":
            countA += 1
        else:
            countB += 1

if countA < countB:
    print(countA)
else:
    print(countB)
Problem p03705 (python)

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

if (N == 1 and A != B) or (B < A):
    print(0)
else:
    print((B - A) * (N - 2) + 1)

Buggy submission (verdict: Runtime Error):
import itertools


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

if (N == 1 and A != B) or (B < A):
    print(0)
    exit()

combi = list(itertools.combinations_with_replacement(
    range(A, B + 1, 1), N - (B - A)))


sum_array = []
for x in combi:
    sumX = A + sum(x) + B
    sum_array.append(sumX)
print(len(set(sum_array)))

Buggy submission (verdict: Runtime Error):
import itertools


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

if N == 1 and A != B:
    print(0)
    exit()

combi = list(itertools.combinations_with_replacement(
    range(A, B + 1, 1), N - (B - A)))


sum_array = []
for x in combi:
    sumX = A + sum(x) + B
    sum_array.append(sumX)
print(len(set(sum_array)))
Problem p02659 (python)

Fixed submission:
import math
import decimal
x,y = list(map(decimal.Decimal,input().split()))
print(math.floor(x*y))

Buggy submission (verdict: Runtime Error):
x,y = list(map(decimal.Decimal,input().split()))
y*=100
print(math.floor((x*y)/100))

Buggy submission (verdict: Runtime Error):
x,y = list(map(decimal.Decimal,input().split()))
y*=100
print(math.floor(x*y/100))

Buggy submission (verdict: Runtime Error):
import decimal
a,b=list(map(int,input().split()))
x = decimal.Decimal(a)
y = decimal.Decimal(b)
print(x*y)
Problem p02689 (python)

Fixed submission:
import numpy as np
n,m=map(int,input().split())
hlist = list(map(int,input().split()))
ablist = []
for i in range(m):
    ablist.append(input().split())
x=np.zeros(n,int)
for ab in ablist:
  a=int(ab[0])
  b=int(ab[1])
  if hlist[a-1]<hlist[b-1]:
    x[a-1]=1#ダメ
  elif hlist[a-1]>hlist[b-1]:
    x[b-1]=1#ダメ
  elif hlist[a-1]==hlist[b-1]:
    x[a-1]=1
    x[b-1]=1
count=0
for l in range(n):
  if x[l]==0:
    count+=1
print(count)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
alist=list(map(int,input().split()))
a1=[]
a2=[]
for i,a in enumerate(alist):
  a2.append(i-a)
  a1.append(i+a)
aa=Counter(a2)
count=0
for k in a1:
  count+=aa.get(k,0)
print(count)
Problem p02753 (python)

Fixed submission:
S = input()
if S[0]==S[1] and S[0]==S[2]:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
S = input()
if S[0]==S[1]orS[1]==S[2]:
  print("Yes")
else:
  print("No")
Problem p02689 (python)

Fixed submission:
n, m = map(int, input().split())
h = list(map(int,input().split()))
ans = [1]*n
for j in range(m):
    a, b = map(int, input().split())
    if h[a-1] <= h[b-1]:
        ans[a-1] *= 0
    if h[b-1] <= h[a-1]:
        ans[b-1] *= 0
print(sum(ans))

Buggy submission (verdict: Runtime Error):
from numpy import zeros
n, m = map(int, input().split())
h = list(map(int,input().split()))
t = zeros((n, n), dtype=int)
for j in range(m):
    a, b = map(int, input().split())
    t[a-1][b-1] = 1
    t[b-1][a-1] = 1
ans = [1]*n
for i in range(n):
    for j in range(n):
        if t[i][j] == 1:
            if h[i] <= h[j]:
                ans[i] *= 0
                break
print(sum(ans))
Problem p02785 (python)

Fixed submission:
n, k = list(map(int,input().split()))
h = list(map(int,input().split()))

h.sort()

if(n < k):
    print(0)
else:
    newH = h[0:(n-k)]
    print(sum(newH))

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

h.sort(reverse=True)

for i in range(k):
    h.pop(0)

print(sum(h))
Problem p02572 (python)

Fixed submission:
import functools
import operator

N = int(input())
A = list(map(int, input().split()))
mod = 10**9+7
ans = 0
v = sum(A)
for i in range(N-1):
    v -= A[i]
    ans += A[i]*v
print(ans%mod)

Buggy submission (verdict: Runtime Error):
import functools
import operator

N = int(input())
A = list(map(int, input().split()))
mod = 10**9+7
ans = 0

for i in range(2**len(A)):\
    list2 = []
    for j in range(len(A)):
        if (i >> j) &1 == 1:
            list2.append(A[j])
    if len(list2) == 2:
        ans += list2[0]*list2[1]
#        print(ans)
#    print(list2)
    ans = ans%mod
print(ans)
Problem p03137 (python)

Fixed submission:

def solve():
    if N >= M:
        return 0
    elif N == 1:
        cnt = abs(X[-1] - X[0])
        return cnt
    L = [0] * (M-1)
    
    for i in range(len(L)):
        L[i] = X[i+1] - X[i]
    L.sort()
    return sum(L[:M-N])



if __name__=="__main__":
    N,M = list(map(int, input().split()))
    X = list(map(int, input().split()))
    X.sort()
    print(solve())

Buggy submission (verdict: Runtime Error):


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

X.sort()
cnt = 0
arr = [0]*(M-1)
if N > M:
    ans = 0
else:
    for i in range(1,M):
        arr[i] = (abs(X[i-1]-X[i]))
    #print(arr)
    arr.sort()
    ans = sum(arr[0:M-N])
print(ans)
Problem p02659 (python)

Fixed submission:
A, B = input().split(" ")
A = int(A.strip())
B = int(B.strip().replace(".", ""))
print(A * B // 100)

Buggy submission (verdict: Runtime Error):
import math
A, B = input().split(" ")
A = int(A.strip())
B = int(B.strip().replace(".", ""))
print(math.floor(A * B / 100)
Problem p02699 (python)

Fixed submission:
n, k = map(int, input().split())
if n<=k:
  print("unsafe")
else:
  print("safe")

Buggy submission (verdict: Runtime Error):
n = input()
p=input()
p=p[0:-1]
if n==p:
    print("Yes")
else:
    print("No")
Problem p02701 (python)

Fixed submission:
a=int(input())
list1=[]
for i in range(a):
  list1.append(input())
a=set(list1)
print(len(a))

Buggy submission (verdict: Runtime Error):
from collections import Counter
a=int(input())
list1=[]
for i in range(a)
list1.append(input())
a=set(list1)
print(len(a))
Problem p02725 (python)

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
a.append(n)
d=[]
for i in range(len(a)-1):
    d.append([i,a[i+1]-a[i]])
d[-1][1]+=a[0]
l=sorted(d,key=lambda x:x[1])

o=l[-1][0]
if o==len(a)-2:
    g=a[-2]-a[0]
else:
    g=a[o]+n-a[o+1]
print(g)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = list(map(int, input().split()))
a.append(n)
d=[]
for i in range(len(a)):
    d.append([i,a[i+1]-a[i]])
l=sorted(d,key=lambda x:x[1])

o=l[-1][0]
g=a[o]+n-a[o+1]
print(g)