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

Fixed submission:
S = input()
T = input()
k = len(T)
m = 0
for i in range(k):
  if S[i] != T[i]:
    m += 1
print(m)

Buggy submission (verdict: Runtime Error):
S = input()
T = input()
k = len(T)
m = 0
for i in range(k):
  if S[k] == T[k]:
    m = m
  else:
    S[k] = T[k]
    m += 1
print(m)

Buggy submission (verdict: Runtime Error):
S = input()
T = input()
k = len(T)
m = 0
for i in range(k):
  if S[k] == T[k]:
    m = m
  else:
    m += 1
print(m)

Buggy submission (verdict: Runtime Error):
S = input()
T = input()
k = len(T)
for i in range(k):
  if S[k] == T[k]:
    m = m
  else:
    m += 1
print(m)
Problem p02659 (python)

Fixed submission:
from decimal import Decimal


AB = list(map(Decimal, input().split()))

result = int((AB[0] * AB[1]))
print(result)

Buggy submission (verdict: Runtime Error):
AB = list(map(str, input().split()))
A = int(AB[0])
B = int(AB[1][0])*1000 + int(AB[1][1])*100 + int(AB[1][2])*10 + int(AB[1][3])

result = int((A * B) / 100)
print(result)

Buggy submission (verdict: Runtime Error):
AB = list(map(float, input().split()))
A = int(AB[0])
B = AB[1] * 100

result = int((A * B) / 100)
print(results)
Problem p02711 (python)

Fixed submission:
n = input()
if "7" in n:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
int main() {
	char s[3]
  	scanf("%s",s)
  	if(s[0]=="7" ||s[1]=="7"||s[2]=="7"){
    	printf("Yes")
    }
  	else{
    	printf("No")
    }
}
Problem p03834 (python)

Fixed submission:
a, b, c = input().split(",")
print(a, b, c)

Buggy submission (verdict: Runtime Error):
a, b, c = input().split(,)
print(a, b, c)

Buggy submission (verdict: Runtime Error):
a, b, c = map(input().split(,))
print(a, b, c)
Problem p02659 (python)

Fixed submission:
from decimal import Decimal
a, b = map(Decimal, input().split())
print(int(a*b))

Buggy submission (verdict: Runtime Error):
import fractions
a, b = map(float, input().split())
print(fractions.floor(a*b))
Problem p02701 (python)

Fixed submission:
n = int(input())
s = [input() for _ in range(n)]
x = set(s)
print(len(x))

Buggy submission (verdict: Runtime Error):
import pandas as pd
n = int(input())
s = [input() for _ in range(n)]
x = set(s)
print(len(x))
Problem p02723 (python)

Fixed submission:
# -*- coding: utf-8 -*-
s = input()
x = list(s)
if x[2] == x[3]:
    if x[4] == x[5]:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import queue

n, x, y = map(int, input().split())
x -= 1
y -= 1
INF = 10010101010101
ans = [0]*n
def put(v, d):
    if dist[v] != INF:
        return
    dist[v] = d
    q.put(v)
for sv in range(n):
    q = queue.Queue()
    dist = [INF for _ in range(n)]
    put(sv, 0)
    while not q.empty():
        v = q.get()
        d = dist[v]
        if v-1 >= 0:
            put(v-1, d+1)
        if v+1 < n:
            put(v+1, d+1)
        if v == x:
            put(y, d+1)
        if v == y:
            put(x, d+1)
    for i in range(n):
        ans[dist[i]] += 1
for i in range(n):
    ans[i] = int(ans[i] / 2)

print(*ans[1:], sep='\n')
Problem p02726 (python)

Fixed submission:
# -*- coding: utf-8 -*-
n, x, y = map(int, input().split())
x -= 1
y -= 1
ans = [0]*n
for i in range(n):
    for j in range(i + 1, n):
        dist1 = j - i
        dist2 = abs(x - i) + abs(y - j) + 1
        ans[min(dist1, dist2)] += 1
print(*ans[1:], sep='\n')

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n, x, y = map(int, input().split())
x -= 1
y -= 1
ans = [0]*n
for i in range(n):
    for j in range(i + 1, n):
        dist1 = j - i
        dist2 = abs(X - i) + abs(Y - j) + 1
        ans[min(dis1, dist2)] += 1
print(*ans[1:], sep='\n')
Problem p02729 (python)

Fixed submission:
n, m = list(map(int, input().split()))
def factorial(x):
    f = 1
    for i in range(1, x+1):
        f *= i
    return f
ans = 0
if n < 2 and m < 2:
    ans = 0
    print(ans)
elif n < 2:
    ans = int(factorial(m) / (factorial(2) * factorial(m - 2)))
    print(ans)
elif m < 2:
    ans = int(factorial(n) / (factorial(2) * factorial(n - 2)))
    print(ans)
else:
    ans = int(factorial(m) / (factorial(2) * factorial(m - 2)) + factorial(n) / (factorial(2) * factorial(n - 2)))
    print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
cnt = [0]*n
for i in a:
    cnt[i] += 1
total = 0
for i in cnt:
    total += i * (i-1) // 2
for i in a:
    print(total - (cnt[i] - 1)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
ans = [0]*n
def choose2(n):
    return n * (n - 1) // 2
total = 0
for i in range(1,n+1):
    total += choose2(a.count(i))
for i in range(n):
    ans[i] = total
    ans[i] -= a.count(a[i]) - 1
print(*ans[:], sep='\n')

Buggy submission (verdict: Runtime Error):
s = input()
ans = True
def isPalindrome(string):
    return s == s[::-1]
if not isPalindrome(s):
    ans = Flase
if not isPalindrome(s[:len(s)//2]):
    ans = False
if not isPalindrome(s[len(s)//2+1:]):
    ans = False
if ans:
    print('Yes')
else:
    print('No')
Problem p02831 (python)

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

Buggy submission (verdict: Runtime Error):
import numpy as np
a, b = map(int, input().split())
p =np.gcd(a, b)
print(b * (a // p))

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

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

Fixed submission:
import math
n = int(input())
ans = 0
for i in reversed(range(int(math.sqrt(n))+1)):
    if n%i == 0:
        j = n // i
        ans = i+j-2
        break
print(ans)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
ans = 0
for i in reversed(range(int(math.sqrt(n)))):
    if n%i == 0:
        j = n // i
        ans = i+j-2
        break
print(ans)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
i = 0
ans = 10**13
for i in range(int(math.sqrt(n))):
    if n%i != 0:
        continue
    j = n // i
    ans = min(ans, i+j-2)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
i = 0
ans = 10**18
for i in range(int(math.sqrt(n))):
    if n%i != 0:
        continue
    j = n // i
    ans = min(ans, i+j-2)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
i = 0
for j in reversed(range(int(math.sqrt(n)))):
    if n % j == 0:
        i = j
        break
j = n // i
print(i + j - 2)
Problem p03137 (python)

Fixed submission:
import numpy as np
 
N,M=[int(i) for i in input().split()]
x=input().split()
y=[int(i) for i in x]
y.sort()
if(N==1):
    print(max(y)-min(y))
#    print(y[M-1]-y[0])
    exit()
if(M==1):
    print("0")
    exit()
if(N>=M):
    print("0")
    exit()
diff=[]
for i in range(M-1):
    diff.append(y[i+1]-y[i])
sub=[]
array=np.array(diff)
index=np.argsort(array)
c=index[-1::-1]
for i in range(N-1):
    sub.append(c[i])
ans=0
for i in range(N):
    if(i==0):
        ans+=y[sub[i]]-y[0]
    elif(i==N-1):
        ans+=y[M-1]-y[sub[i-1]+1]
    else:
        ans+=y[sub[i]]-y[sub[i-1]+1]
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
 
N,M=[int(i) for i in input().split()]
x=input().split()
y=[int(i) for i in x]
y.sort()
if(N==1):
    print(max(y)-min(y))
#    print(y[M-1]-y[0])
    exit()
if(M==1):
    print("0")
    exit()
diff=[]
for i in range(M-1):
    diff.append(y[i+1]-y[i])
sub=[]
array=np.array(diff)
index=np.argsort(array)
c=index[-1::-1]
for i in range(N-1):
    sub.append(c[i])
ans=0
for i in range(N):
    if(i==0):
        ans+=y[sub[i]]-y[0]
    elif(i==N-1):
        ans+=y[M-1]-y[sub[i-1]+1]
    else:
        ans+=y[sub[i]]-y[sub[i-1]+1]
print(ans)

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

N,M=[int(i) for i in input().split()]
x=input().split()
y=[int(i) for i in x]
y.sort()

if(N==1):
    print(y[M-1]-y[0])
    exit()
if(M==1):
    print("0")
    exit()

diff=[]
for i in range(M-1):
    diff.append(y[i+1]-y[i])
sub=[]
array=np.array(diff)
index=np.argsort(array)
c=index[-1::-1]
for i in range(N-1):
    sub.append(c[i])
print(sub)
ans=0
for i in range(N):
    if(i==0):
        ans+=y[sub[i]]-y[0]
    elif(i==N-1):
        ans+=y[M-1]-y[sub[i-1]+1]
    else:
        ans+=y[sub[i]]-y[sub[i-1]+1]
print(ans)

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

N,M=[int(i) for i in input().split()]
x=input().split()
y=[int(i) for i in x]
y.sort()
if(M==1):
    print("0")
    exit()
if(N==1):
    print(y[M-1]-y[0])
    exit()

diff=[]
for i in range(M-1):
    diff.append(y[i+1]-y[i])
sub=[]
array=np.array(diff)
index=np.argsort(array)
c=index[-1::-1]
for i in range(N-1):
    sub.append(c[i])
print(sub)
ans=0
for i in range(N):
    if(i==0):
        ans+=y[sub[i]]-y[0]
    elif(i==N-1):
        ans+=y[M-1]-y[sub[i-1]+1]
    else:
        ans+=y[sub[i]]-y[sub[i-1]+1]
print(ans)

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

N,M=[int(i) for i in input().split()]
x=input().split()
y=[int(i) for i in x]
y.sort()
if(N==1):
    print(y[M-1]-y[0])
    exit()
if(M==1):
    print("0")
    exit()
diff=[]
for i in range(M-1):
    diff.append(y[i+1]-y[i])
sub=[]
array=np.array(diff)
index=np.argsort(array)
c=index[-1::-1]
for i in range(N-1):
    sub.append(c[i])
ans=0
for i in range(N):
    if(i==0):
        ans+=y[sub[i]]-y[0]
    elif(i==N-1):
        ans+=y[M-1]-y[sub[i-1]+1]
    else:
        ans+=y[sub[i]]-y[sub[i-1]+1]
print(ans)
Problem p03250 (python)

Fixed submission:
a=list(map(int,input().split()))
a.sort()
print(10*a[-1]+a[0]+a[1])

Buggy submission (verdict: Runtime Error):
a,b,c=[int(i) for i in input().split()]
if(a>b &&a>c):
  print(10*a+b+c)
elif(b>a &&  b>c):
  print(10*b+c+a)
else:
  print(a+b+10+c)
Problem p02659 (python)

Fixed submission:
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN

r = list(map(float,input().split()))

x = Decimal(str(r[0])).quantize(Decimal('0'),rounding=ROUND_HALF_UP)
y = Decimal(str(r[1])).quantize(Decimal('0.01'),rounding=ROUND_HALF_UP)

z = x * y

z = math.floor(z)

print(z)

Buggy submission (verdict: Runtime Error):
import math
import decimal

r = list(map(float,input().split()))

x = decimal.Decimal(str(r[1])).quantize(Decimal('0'),rounding=ROUND_HALF_UP)
y = decimal.Decimal(str(r[1])).quantize(Decimal('0.01'),rounding=ROUND_HALF_UP)

z = x * y

z = math.floor(z)

print(z)

Buggy submission (verdict: Runtime Error):
import math
import decimal

r = list(map(float,input().split()))

x = decimal.Decimal(str(r[1])).quantize(Decimal('0'),rounding=ROUND_HALF_UP)
y = decimal.Decimal(str(r[1])).quantize(Decimal('0.01'),rounding=ROUND_HALF_UP)

z = x * y

z = math.floor(z)
if r[0] == 0 or r[1] == 0:
    z = int(0)

print(z)

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

lim = 10^18

for i in range(n):
    if i == 0:
        x = r[i]
    else:
        x = x * r[i]
    
    if x >= lim:
        x = -1
        break

if x > lim:
        x = -1
print(int(x))
Problem p02729 (python)

Fixed submission:
N,M = list(map(int,input().split()))
ans = (N*(N-1)//2) + (M*(M-1)//2)
print(ans)

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

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

ans = combination(N,2) + combination(M,2)

print(ans)

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

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

ans = combination(N,2) + combination(M,2)

print(ans)
Problem p02659 (python)

Fixed submission:
from decimal import Decimal
a, b = input().split()
a = int(a)
b = Decimal(b)
c = a*b*100//100
print(int(c))

Buggy submission (verdict: Runtime Error):
from decimal import Decimal
a, b = input().split()
a = int(a)
b = decimal.Decimal(b)
c = a*b*100//100
print(int(c))
Problem p02699 (python)

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

Buggy submission (verdict: Runtime Error):
s = input()
long = len(s)
count = 0
for i in range(long):
  for j in range(i+1,long):
    num = int(s[i:j+1])
    if len(str(num)) < 4:
      continue
    if num % 2019 == 0:
      count += 1
print(count)
Problem p02711 (python)

Fixed submission:
n = input()
Flag = False
for i in n:
  if i == "7":
    Flag = True
if Flag:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = int(input)
Flag = False
for i in n:
  if i == 7:
    Flag = True
if Flag:
  print("Yes")
else:
  print("No")
Problem p03775 (python)

Fixed submission:
import math
n = int(input())
root_n = math.ceil(math.sqrt(n))
f = []
for i in range(1,root_n+1):
  if n % i == 0:
    f_pair = max(len(str(int(i))),len(str(int(n/i))))
    f.append(f_pair)
mini = min(f)
print(mini)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
root = math.ceil(math.sqrt(n))
nums = []
for i in range(1,root+1):
  if n % i == 0:
    count_i = len(str(i))
    count_j = len(str(j))
    ans = max(count_i,count_j)  
    nums.append(ans) 
nummm = sorted(nums,reverse = True)
print(nummm[0])

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
root = math.ceil(math.sqrt(n))
nums = []
for i in range(1,root+1):
  for j in range(1,root + 1):
    if i*j == n:
      count_i = len(str(i))
      count_j = len(str(j))
      ans = max(count_i,count_j)  
      nums.append(ans)
nummm = sorted(nums,reverse = True)
print(nummm[0])
Problem p03345 (python)

Fixed submission:
line = input().split()

A = int( line[0] )
B = int( line[1] )
C = int( line[2] )
K = int( line[3] )

if K % 2 == 0:
    print(A-B)
    
else:
    print(B-A)

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

line = input()

N = int(line)
A = np.array([0]*N)

for i in range(N):
    line = input()
    A[i] = int(line)

    
def IsNotPossible(A):
    foo = 0
    
    if A[0] != 0:
        foo = 1
        return foo
        
    else:
        for i in range(N-1):
            if A[i] + 1 < A[i+1]:
                foo  = 1
                break
        return foo

if IsNotPossible(A):
    print(-1)
    
else:
    count = 0
    for i in range(N-1):
        a = A[N-1-i]
        
        if a == 0:
            continue
        elif a == A[N-2-i] + 1:
            count += 1
        else:
            count += a
            
    print(count)

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

N = int(line)
A = np.array([0]*N)

for i in range(N):
    line = input()
    A[i] = int(line)

    
def IsNotPossible(A):
    foo = 0
    
    if A[0] != 0:
        foo = 1
        return foo
        
    else:
        for i in range(N-1):
            if A[i] + 1 < A[i+1]:
                foo  = 1
                break
        return foo

if IsNotPossible(A):
    print(-1)
    
else:
    count = 0
    for i in range(N-1):
        a = A[N-1-i]
        
        if a == 0:
            continue
        elif a == A[N-2-i] + 1:
            count += 1
        else:
            count += a
            
    print(count)

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

N = int(line)
A = np.array([0]*N)

for i in range(N):
    line = input()
    A[i] = int(line)

def IsNotPossible(A):
    foo = 0
    
    if A[0] != 0:
        foo = 1
        
    else:
        for i in range(N-1):
            if A[i] + 1 < A[i+1]:
                foo  = 1
                break
    
    return foo

if IsNotPossible(A):
    print(-1)
    
else:
    count = 0
    for i in range(N-1):
        a = A[N-1-i]
        
        if a == 0:
            continue
        elif a == A[N-2-i] + 1:
            count += 1
        else:
            count += a
            
    print(count)
Problem p02622 (python)

Fixed submission:
a = list(input())
b = list(input())
count = 0

for i in range(len(b)):
  if b[i] != a[i]:
  	count+=1
    
print(count)

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

for i,con in enumerate(b):
  if i == a[i]:
    break
  else:
    count+=1
print(count)
Problem p02689 (python)

Fixed submission:
N , M = (map(int , input().split()))
H = list(map(int , input().split()))
AB = [list(map(int, input().split())) for i in range(M)]
HH = {i+1 : H[i] for i in range(len(H))}

count = {i+1 : 0 for i in range(N)}
for i in AB:
    if HH[i[1]] > HH[i[0]]:
        count[i[0]] -= 1
    elif HH[i[1]] == HH[i[0]]:
        count[i[0]] -= 1
        count[i[1]] -= 1
    else:
        count[i[1]] -= 1
        
print(sum([1 for i in count.values() if i == 0]))

Buggy submission (verdict: Runtime Error):
import itertools
N , M = (map(int , input().split()))
H = list(map(int , input().split()))
AB = [list(map(int, input().split())) for i in range(M)]
HH = {i+1 : H[i] for i in range(len(H))}
count = []
for i in AB:
    if HH[i[1]] > HH[i[0]]:
        count.append(i[1])
for i in HH:
    if i in CC:
        pass
    else:
        count.append(i)
print(len(list(set(count))))
Problem p02693 (python)

Fixed submission:
K = int(input())
A , B = (map(int , input().split()))
kk = K
while True:
    if kk >= A and kk <= B:
        ans = 'OK'
        break
    elif  kk > B:
        ans = 'NG'
        break
    else:
        kk = kk+K
print(ans)

Buggy submission (verdict: Runtime Error):
kk = K
while True:
    if kk >= A and kk <= 600:
        ans = 'OK'
        break
    elif  kk > 600:
        ans = 'NG'
        break
    else:
        kk = kk+K
print(ans)
Problem p02701 (python)

Fixed submission:
from collections import Counter
N = int(input())
n_list = []
for i in range(N):
    n_list.append(input())
print(len(dict(Counter(n_list))))

Buggy submission (verdict: Runtime Error):
N = int(input())
n_list = []
for i in range(N):
    n_list.append(input())
print(len(dict(Counter(n_list))))
Problem p02712 (python)

Fixed submission:
import itertools
N = int(input())
N_list = [i+1 for i in range(N)]
cumsum = list(itertools.accumulate(N_list))
aa = cumsum[-1]
t_list = [i for i in N_list if i%3 == 0 or i%5 == 0]
if len(t_list) != 0:
    acumsum = list(itertools.accumulate(t_list))[-1]
else:
    acumsum = 0
print(aa - acumsum)

Buggy submission (verdict: Runtime Error):
import itertools
N = int(input())
N_list = [i+1 for i in range(N)]
cumsum = list(itertools.accumulate(N_list))
aa = cumsum[-1]
t_list = [i for i in N_list if i%3 == 0 or i%5 == 0]
acumsum = list(itertools.accumulate(t_list))[-1]
print(aa - acumsum)
Problem p02754 (python)

Fixed submission:
N , A , B = (map(int , input().split()))
def divmod_(a ,b):
    q, mod = divmod(a ,b)
    return q, mod
c , d = divmod_(N ,A+B)
if (d - A) > 0:
    d = A
print((c * A) + d)

Buggy submission (verdict: Runtime Error):
N , A , B = (map(int , input().split()))
a = ''
l = -(-N//(A + B))
for i in range(l):
    a += 'b'*A
    a += 'r'*B
    if len(a) >= N:
        break
print(list(a[:N]).count('b'))

Buggy submission (verdict: Runtime Error):
N , A , B = (map(int , input().split()))
a = ''
l = -(-N//(A + B))
for i in range(l):
    a += 'b'*A
    a += 'r'*B
print(list(a[:N]).count('b'))
Problem p02819 (python)

Fixed submission:
N = int(input())
n = 11**5
primes = set(range(2, n+1))
for i in range(2, int(n**0.5+1)):
    primes.difference_update(range(i*2, n+1, i))
primes=list(primes)
print(min([i for i in primes if i >= N]))

Buggy submission (verdict: Runtime Error):
from sympy import sieve
X = int(input())
a = 100004
b = [i for i in sieve.primerange(X,a)]
print(b[0])
Problem p02881 (python)

Fixed submission:
import math
a = int(input())
b = int(math.sqrt(a))
for i in range(b):
    x = a/b
    if x.is_integer():
        break
    else:
        b -= 1
print(int(x + b -2))

Buggy submission (verdict: Runtime Error):
import math
a = int(input())
b = int(math.sqrt(a))-1
for i in range(b):
    x = a/b
    if x.is_integer():
        break
    else:
        b -= 1
print(int(x + b -2))

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(math.sqrt(a))-1
for i in range(b):
    x = a/b
    if x.is_integer():
        break
    else:
        b -= 1
print(int(x + b -2))
Problem p03137 (python)

Fixed submission:
N , M = (map(int , input().split()))
X = list(map(int , input().split()))
sorted_x = sorted(X)
total_kukann = 0
kukann_kyori = []
a = N-1
for i in range(len(sorted_x)-1):
    kukann_kyori.append(sorted_x[i + 1] - sorted_x[i])
    total_kukann += sorted_x[i + 1] - sorted_x[i]
kukann_kyori.sort()
if N >= M:
    total_kukann = 0
else:
    for j in range(1,a+1):
        total_kukann -= kukann_kyori[-j]
print(total_kukann)

Buggy submission (verdict: Runtime Error):
N , M = (map(int , input().split()))
X = list(map(int , input().split()))
sorted_x = sorted(X)
ans= 0
total_kukann = 0
kukann_kyori = []
a = N-1
for i in range(len(sorted_x)-1):
    kukann_kyori.append(sorted_x[i + 1] - sorted_x[i])
    total_kukann += sorted_x[i + 1] - sorted_x[i]
kukann_kyori.sort()
for j in range(1,a+1):
    total_kukann -= kukann_kyori[-j]
if N >= M:
    total_kukann = 0
print(total_kukann)
Problem p03208 (python)

Fixed submission:
N , M = (map(int , input().split()))
tree = []
for i in range(N):
    tree.append(int(input()))
sort_tree = sorted(tree)
print(min([sort_tree[i+M-1] - sort_tree[i] for i in range(N-M+1)]))

Buggy submission (verdict: Runtime Error):
N , M = (map(int , input().split()))
tree = []
for i in range(N):
    tree.append(int(input()))
sort_tree = sorted(tree)
print(min([sort_tree[N-M+i] - sort_tree[i] for i in range(N-M+1)]))
Problem p02831 (python)

Fixed submission:
from sys import stdin
import fractions





a,b = [int(x) for x in stdin.readline().rstrip().split()]

f=fractions.gcd(a,b)
f2=a*b//f
print(f2)

Buggy submission (verdict: Runtime Error):
from sys import stdin
import math



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

a,b = stdin.readline().rstrip().split()


print(lcm(int(a), int(b)))
Problem p02832 (python)

Fixed submission:
from sys import stdin


n = int(stdin.readline().rstrip())
arr = [int(x) for x in stdin.readline().rstrip().split()]

rslt = []

ex = 0
cntr = 1
bb = 0

for a,j in enumerate(arr):
    if j == cntr:
        cntr += 1
    else:
        bb += 1


if bb == n:
    print(-1)
else:
    print(bb)

Buggy submission (verdict: Runtime Error):
from sys import stdin


n = int(stdin.readline().rstrip())
arr = [int(x) for x in stdin.readline().rstrip().split()]

rslt = []
for i in range(1,n):
    cntr = 0
    ex = 0
    for s in arr:
        s = int(s)
        if ex != 0:
            ex = s
        if s != ex +1:
            cntr += 1
        ex = s
    rslt.append(cntr)


print(rslt)
print(min(rslt))
Problem p02835 (python)

Fixed submission:
from sys import stdin
a, b, c = [int(x) for x in stdin.readline().rstrip().split()]
if a+b+c >= 22:
  print('bust')
else:
  print('win')

Buggy submission (verdict: Runtime Error):
a,b,c = stdin.readline().rstrip().split()
if a+b+c >= 22:
  print('bust')
else:
  print('win')

Buggy submission (verdict: Runtime Error):
a,b,c = stdin.readline().rstrip().split()
if a+b+c >= 22:
	print('bust')
else:
	print('win')
Problem p02879 (python)

Fixed submission:
from sys import stdin

a,b = [int(x) for x in stdin.readline().rstrip().split()]

if 1 <= a <= 9 and 1 <= b <= 9:
    print(a*b)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
from sys import stdin

a,b = int(stdin.readline().rstrip().split())

if 1 <= a,b <= 10:
    print(a*b)
else:
    print(-1)
Problem p02951 (python)

Fixed submission:
from sys import stdin

a,b,c = [int(x) for x in stdin.readline().rstrip().split()]

if b+c-a>0:
    print(b+c-a)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
 from sys import stdin

a,b,c = [int(x) for x in stdin.readline().rstrip().split()]

print(b+c-a)