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

Fixed submission:
import math
N, K = map(int,input().split())

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


for i in range(K):
    if N-K < i:
        print(0)
    else:
        print(comb(N-K+1, i+1)*comb(K-1, i) % 1000000007)

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

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

if N == K:
    print(1)
else:
    for i in range(K):
        if N-K < i-1:
            break
        print(comb(N-K+1, i+1)*comb(K-1, i) % 1000000007)

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

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

if N == K:
    print(1)
else:
    for i in range(K):
        print(comb(N-K+1, i+1)*comb(K-1, i) % 1000000007)

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

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

for i in range(K):
    print(comb(N-K+1, i+1)*comb(K-1, i) % 1000000007)
Problem p03013 (python)

Fixed submission:
n, m = map(int, input().split())

hole_count = 0
pattern = [0,1]

if m != 0:
    a = int(input())
    hole_count += 1
else:
    a = n+1
    
for i in range(n):
    index = i + 1
    if index == a:
        pattern.append(0)
        if hole_count < m:
            a = int(input())
            hole_count += 1
    else:
        pattern.append(pattern[-1] + pattern[-2])

print(pattern[-1] % 1000000007)

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

hole_count = 0
pattern = [0,1]

a = int(input())
hole_count += 1

for i in range(n):
    index = i + 1
    if index == a:
        pattern.append(0)
        if hole_count < m:
            a = int(input())
            hole_count += 1
    else:
        pattern.append(pattern[-1] + pattern[-2])

print(pattern[-1] % 1000000007)
Problem p03104 (python)

Fixed submission:
import numpy as np

def f(x):
    fm = x - (x % 4) - 1 
    ans = 0
    while fm < x:
        fm += 1
        ans ^= fm
    return ans

A,B = map(int, input().split())
print(f(A-1) ^ f(B))

Buggy submission (verdict: Runtime Error):
import numpy as np
A, B = map(int, input().split())

pre = A
for b in np.arange(A+1, B+1):
    pre = pre ^ b
print(pre)
Problem p03295 (python)

Fixed submission:
import numpy as np
N, M = map(int, input().split())

a = np.zeros((M,2))

for i in range(M):
	a[i] = list(map(int, input().split()))

a = a[np.argsort(a[:,1])]

index = 0
ans = 0
for tmp in a:
	if tmp[0] <= index:
		continue
	else:
		ans += 1
		index = tmp[1] - 1

print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
N, M = map(int, input().split())

a = np.zeros((M,2))

for i in range(M):
	a[i] = list(map(int, input().split()))

a = a[np.argsort(a[:,1])[::-1]]

prev = 0

a_max = 0
index = M
del_list = []
for i tmp in enumerate(a):
	if tmp[1] == prev:
		if tmp[0] > a_max:
			del_list.append(index)
			index = i
			a_max = tmp[0]
		else:
			del_list.append(i)
	else:
		prev = tmp[1]
		if tmp[0] > a_max:
			del_list.append(index)
			index = i
			a_max = tmp[0]
		elif a_max >= tmp[1]:
			a_max = tmp[0]
		else:
			del_list.append(i)
del del_list[0]
a = np.delete(a, del_list, 0)

prev = 0
b_min = N+1
index = M
del_list = []
for i, tmp in enumerate(a):
	if tmp[0] == prev:
		if tmp[1] < b_min:
			del_list.append(index)
			index = i
			b_min = tmp[1]
		else:
			del_list.append(i)
	else:
		prev = tmp[0]
		if tmp[1] < b_min:
			del_list.append(index)
			index = i
			b_min = tmp[1]
		elif b_min <= tmp[0]:
			b_min = tmp[1]
		else:
			del_list.append(i)
del del_list[0]
a = np.delete(a, del_list, 0)


a = a[np.argsort(a[:,0])]

prev = 0
b_min = N+1
index = M
del_list = []
for i, tmp in enumerate(a):
	if tmp[0] == prev:
		if tmp[1] < b_min:
			del_list.append(index)
			index = i
			b_min = tmp[1]
		else:
			del_list.append(i)
	else:
		prev = tmp[0]
		if tmp[1] < b_min:
			del_list.append(index)
			index = i
			b_min = tmp[1]
		elif b_min <= tmp[0]:
			b_min = tmp[1]
		else:
			del_list.append(i)
del del_list[0]
a = np.delete(a, del_list, 0)



ans = 0
flg = True
for i in range(len(a[:,0])-1):
	if a[i,1] > a[i+1, 0]:
		ans += 1
		flg = False
	elif flg:
		ans += 1
		flg = True
	else:
		flg = True
if flg:
	ans += 1
print(ans)
Problem p03012 (python)

Fixed submission:
n=int(input().strip())
l=list(map(int,input().strip().split()))
ans=1000000009;
for t in range(1,n):
  ans=min(ans,abs(sum(l[:t]) - sum(l[t:])))
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
ans=1000000009;
for t in range(1,n+1):
  ans=min(ans,abs(sum(l[:t]) - sum(l[t:]))
print(ans)
Problem p02989 (python)

Fixed submission:
N=int(input())
x=int(N/2)
d=[int(x) for x in (input().split())]
d.sort()
print(d[x]-d[x-1])

Buggy submission (verdict: Runtime Error):
N=int(input())
d=[int(input().sprit())]
d.sort()
print(d[N]-d[N-1])
Problem p03013 (python)

Fixed submission:
N,M=(int(x) for x in input().split())
a=[int(input()) for i in range(M)]

x=[0]*(N+1)
j=0
if N!=0:
    x[0]=1
if N>1 and M!= 0 and a[0]==1:
    j+=1
else:
    x[1]=1

for i in range(2,N+1): 
    if j==M or i!=a[j]:
        x[i]=x[i-1]+x[i-2]
    else:
        x[i]=0
        j+=1
print(int(x[N]%(1000000007)))

Buggy submission (verdict: Runtime Error):
N,M=(int(x) for x in input().split())
a=[int(input()) for i in range(M)]

x=[0]*(N+1)
j=0
if N!=0:
    x[0]=1
if N>1 and M!= 0 and a[0]==1:
        j+=1
    else:
        x[1]=1

for i in range(2,N+1): 
    print(j)
    if j==M or i!=a[j]:
        x[i]=x[i-1]+x[i-2]
    else:
        x[i]=0
        j+=1
print(int(x[N]%(1000000007)))

Buggy submission (verdict: Runtime Error):
N,M=(int(x) for x in input().split())
a=[int(input()) for i in range(M)]

x=[0]*(N+1)
j=0
if len(x)!=0:
    x[0]=1
if len(x) >0:
    if a[0]==1:
        j+=1
    else:
        x[1]=1


for i in range(2,N+1): 
    if i!=a:
        x[i]=x[i-1]+x[i-2]
    else:
        x[i]=0
        j+=1

print(int(x[N]%(1000000007)))

Buggy submission (verdict: Runtime Error):
N,M=(int(x) for x in input().split())
a=[int(input()) for i in range(M)]

x=[0]*(N+1)
x[0]=1
x[1]=1 if not 1 in a else 0

for i in range(2,N+1): 
    if not i in a:
        x[i]=x[i-1]+x[i-2]

print(int(x[N]%((1e+9)+7)))

Buggy submission (verdict: Runtime Error):
N,M=(int(x) for x in input().split())
a=[int(input()) for i in range(M)]

x=[0 if i in a else 1 for i in range(N+1)]
for i in range(2,N+1):
    if x[i]!=0:
        x[i]=x[i-1]+x[i-2] 

print(x[N]%((1e+9)+7))

Buggy submission (verdict: Runtime Error):
N,M=(int(x) for x in input().split())
a=[int(input()) for i in range(M)]

x=[0 if i in a else 1 for i in range(N+1)]
for i in range(2,N+1):
    if x[i]!=0:
        x[i]=x[i-1]+x[i-2] 

print(x[N]%((10e+9)+7))

Buggy submission (verdict: Runtime Error):
def fib(x):
  if x==0:
    return 0
  elif x==1 or x==2:
  	return 1
  else:
  	return fib(x-2)+fib(x-1)

N,M=(int(x) for xin input().split())
a=[int(input()) for i in range(M)]
x=1
for i in range(1,M):
  x*=fib(a[i]-a[i-1])

print (a%((10e+9)+7))

Buggy submission (verdict: Runtime Error):
def fib(x):
  if x==0:
    return 0
  elif x==1 or x==2
  	return 1
  else
  	return fib(x-2)+fib(x-1)

N,M=(int(x) for xin input().split())
a=[int(input()) for i in range(M)]
x=1
for i in range(1,M):
  x*=fib(a[i]-a[i-1])

print (a%((10e+9)+7))

Buggy submission (verdict: Runtime Error):
def fib(x):
  if x=0:
    return 0
  elif x=1 or x=2
  	return 1
  else
  	return fib(x-2)+fib(x-1)

N,M=(int(x) for xin input().split())
a=[int(input()) for i in range(M)]
x=1
for i in range(1,M):
  x*=fib(a[i]-a[i-1])

print (a%((10e+9)+7))
Problem p03011 (python)

Fixed submission:
def solve():
    p, q, r = sorted([int(x) for x in input().split()])

    print(p + q)


if __name__ == '__main__':
    solve()

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


def solve(MM, H, W):

    L, R, U, D = np.zeros((H, W), dtype=int), np.zeros((H, W), dtype=int), np.zeros((H, W), dtype=int), np.zeros((H, W), dtype=int)

    for i in range(H):
        i_r = H - 1 - i

        # L, U
        for j in range(W):
            j_r = W - 1 - j

            # L
            if MM[i][j]:
                if j == 0:
                    L[i][j] = 1
                else:
                    L[i][j] = L[i][j - 1] + 1

            # R
            if MM[i][j_r]:
                if j_r == W - 1:
                    R[i][j_r] = 1
                else:
                    R[i][j_r] = R[i][j_r + 1] + 1

            # U
            if MM[i][j]:
                if i == 0:
                    U[i][j] = 1
                else:
                    U[i][j] = U[i - 1][j] + 1

            # D
            if MM[i_r][j]:
                if i_r == H - 1:
                    D[i_r][j] = 1
                else:
                    D[i_r][j] = D[i_r + 1][j] + 1

    print((L + R + U + D - 3).max())


def solve2(MM, H, W):
    L, R, U, D = [MM.copy() for _ in range(4)]

    # U, D
    for i in range(1, H):
        U[i] = (U[i - 1] + 1) * MM[i]
        i_r = H - 1 - i
        D[i_r] = (D[i_r + 1] + 1) * MM[i_r]

    MM_T = MM.T
    L_T, R_T = L.T, R.T

    # L, R
    for i in range(1, W):
        L_T[i] = (L_T[i - 1] + 1) * MM_T[i]
        i_r = W - 1 - i
        R_T[i_r] = (R_T[i_r + 1] + 1) * MM_T[i_r]

    L, R = L_T.T, R_T.T
    print((L + R + U + D).max() - 3)


def stdin():
    H, W = [int(x) for x in input().split()]
    MM = np.zeros((H, W), dtype=int)

    for i in range(H):
        line = str(input())

        for j in range(W):
            if line[j] != '#':
                MM[i][j] = 1

    solve2(MM, H, W)


if __name__ == '__main__':
    stdin()
Problem p02990 (python)

Fixed submission:
from scipy.misc import comb

mod=10**9+7
N,K=map(int,input().split())
B=K
R=N-K

for i in range(1,K+1):
    print(comb(R+1,i,exact=True)*comb(B-1,i-1,exact=True)%mod)

Buggy submission (verdict: Runtime Error):
import scipy.special

def combination(n,r):
    return scipy.special.comb(n,r,exact=True)

mod=10**9+7
N,K=map(int,input().split())
B=K
R=N-K

for i in range(1,K+1):
    print(combination(R+1,i)*combination(B-1,i-1)%mod)
Problem p03776 (python)

Fixed submission:
class Frac(object):
    def __init__(self, a, b):
        self.a = a
        self.b = b

    def eq(self, f):
        return self.a * f.b == f.a * self.b

    def lt(self, f):
        return self.a * f.b > f.a * self.b

    def __repr__(self):
        return '%.6f' % (self.a / self.b)


def factorial(n):
    res = 1
    for i in range(n):
        res *= i+1
    return res


def nCr(n, r):
    return factorial(n) // factorial(r) // factorial(n - r)


N, A, B = map(int, input().split())
V = list(map(int, input().split()))
V.sort(reverse=True)

res = None
for i in range(A, B+1):
    now = Frac(sum(V[:i]), i)
    if res is None or now.lt(res[0]):
        res = [now]
    elif now.eq(res[0]):
        res.append(now)

cnt = 0
for now in res:
    p = V[:now.b]
    n = len(list(filter(lambda x: x == p[-1], V)))
    r = len(list(filter(lambda x: x == p[-1], p)))
    cnt += nCr(n, r)

print(res[0])
print(cnt)

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


class Frac(object):
    def __init__(self, a, b):
        self.a = a
        self.b = b

    def eq(self, f):
        return self.a * f.b == f.a * self.b

    def lt(self, f):
        return self.a * f.b > f.a * self.b

    def __repr__(self):
        return '%.6f' % (self.a / self.b)


def nCr(n, r):
    return factorial(n) // factorial(r) // factorial(n - r)


N, A, B = map(int, input().split())
V = list(map(int, input().split()))
V.sort(reverse=True)

res = None
for i in range(A, B+1):
    now = Frac(sum(V[:i]), i)
    if res is None or now.lt(res[0]):
        res = [now]
    elif now.eq(res[0]):
        res.append(now)

cnt = 0
for now in res:
    p = V[:now.b]
    n = len(list(filter(lambda x: x == p[-1], V)))
    r = len(list(filter(lambda x: x == p[-1], p)))
    cnt += nCr(n, r)

print(res[0])
print(cnt)
~
Problem p03011 (python)

Fixed submission:
try:
    n=list(map(int, input().strip().split()))
    lis1=[]
    for i in range(0,len(n)):
        for a in range(0,len(n)):
            if a!=i:
                z=(int(n[a])+int(n[i]))
                lis1.append(z)
            
    minscore='9999999999'
    for i in range(0,len(lis1)):
        if float(minscore)>float(lis1[i]):
            minscore=lis1[i]
    
    print(minscore)
    
except:
    print('')

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

lis1=[]
for i in range(0,len(n)):
    for a in range(0,len(n)):
        if n[i]!=n[a]:
            z=(int(n[a])+int(n[i]))
            lis1.append(str(z))

minscore='9999999999'
for i in range(0,len(n)):
    if float(minscore)>float(lis1[i]):
        minscore=lis1[i]

print(minscore)

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

lis1=[]
for i in range(0,len(n)):
    for a in range(0,len(n)):
        if n[i]!=n[a]:
            z=(int(n[a])+int(n[i]))
            lis1.append(str(z))
minscore='9999999999'
for i in range(0,len(n)):
    if float(minscore)>float(lis1[i]):
        minscore=lis1[i]

print(minscore)

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

lis1=[]
for i in range(0,len(n)):
    for a in range(0,len(n)):
        if n[i]!=n[a]:
            z=(int(n[a])+int(n[i]))
            lis1.append(str(z))
             
print(int(min(lis1)))

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

lis1=[]
for i in range(0,len(n)):
    for a in range(0,len(n)):
        if n[i]!=n[a]:
            z=int(n[a]+n[i])
            lis1.append(str(z))
           
print(min(lis1))
Problem p03012 (python)

Fixed submission:
n = int(input())
list1 = list(map(int, input().split()))
great = 9999999
for i in range(n - 1):
  temp = int(abs(sum(list1[:i + 1]) - sum(list1[i + 1:])))
  if temp < great:
    great = temp
print(great)

Buggy submission (verdict: Runtime Error):
n = int(input())
list1 = list(map(int, input().split()))
great = 9999999
for i in range(n - 1):
  temp = int(abs(sum(list1[:i + 1]) - sum(list1[i + 1:])))
  if temp < great:
    great = temp
print(samin)
Problem p03042 (python)

Fixed submission:
a=input()
 
b = int(a[:2])
c = int(a[2:])
 
if 0< b < 13:
    a_month_flag = 1
    
elif b == 0:
    a_month_flag = 0    
else:
    a_month_flag = 0
 
if 0< c < 13:
    b_month_flag = 1
    
elif c == 0:
    b_month_flag = 0
  
else:
    b_month_flag = 0
 
if a_month_flag ==1 and b_month_flag==1:
    print("AMBIGUOUS")
elif a_month_flag == 1 and b_month_flag == 0:
    print("MMYY")
elif a_month_flag == 0 and b_month_flag ==1:
    print("YYMM")
else:
    print("NA")

Buggy submission (verdict: Runtime Error):
try:
    s1=(input(''))
    if len(s1)>=4:
        raise ValueError
    
    check=list((s1))
    assert bool(int(check[0]+check[1])<=12) != bool(int(check[2]+check[3])<=12)
    if int(check[0]+check[1])<=12:
        print("MMYY")
    elif int(check[2]+check[3])<=12:
        print("YYMM")
except AssertionError:
    if int(check[0]+check[1])<=12 and int(check[2]+check[3])<=12:
        print("AMBIGUOUS")
    else:
        print("NA")
Problem p03075 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if e-a > k:
    print(":(")
else:
    print("Yay!")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
k = int(input())

if e-a > k:
    print(":(")
else:
    print("Yay!")

# for i in range(4):
#     for j in range(4):
#         if i<j :
#             print("." * j)
#             continue
#         print(f"i={i}, j={j}")
#
# print()

# numlist = [3, 4.2, 10, "x", 1, 9]
#
# sum = 0
# for num in numlist :
#     if not isinstance(num, (int,float)):
#         print(num, "数値ではありません。")
#         continue
#     sum += num
#     print(num, "/", sum)

# print(1,2, sep ="/")

Buggy submission (verdict: Runtime Error):
a,b,c,d,e,k = map(int, input().split)

legth = max(b-a,c-b,d-c,e-d)

if legth > k:
    print(":(")
else:
    print("Yay!")
Problem p03137 (python)

Fixed submission:
n, m = map(int, input().split())
alist = list(map(int, input().split()))
alist.sort()
blist = []

if n >= m :
  print(0)
elif n == 1:
  print(alist[m-1] - alist[0])
else:
  for i in range(0,m-1):
    blist.append(alist[i+1] - alist[i])
  blist.sort()
  d = -1 * (n-1)
  c = sum(blist[d:])
  b1 = alist[m-1] - alist[0]
  print(b1 - c)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
alist = list(map(int, input().split()))
alist.sort()
blist = []
for i in range(0,m-1):
  blist.append(alist[i+1] - alist[i])
b1 = alist[m-1] - alist[0]
b2 = max(blist)
print(b1 - b2)
Problem p03072 (python)

Fixed submission:
n = int(input())
h_list = list(map(int, input().split()))
highest = 0
count = 0

for i in range(n):
    if highest <= h_list[i]:
        count += 1
        highest = h_list[i]

print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
h_list = map(int, input().split())
highest = max(h_list)
count = 1

for i in range(1, n):
    if highest <= h_list[i]:
        count += 1

print(count)
Problem p03073 (python)

Fixed submission:
s = list(input())

count1  = 0
count2 = 0

for i in range(len(s)):
    if i % 2 == 0 and s[i] == '1':
        count1 += 1
    elif i % 2 and s[i] == '0':
        count1 += 1

    if i % 2 == 0 and s[i] == '0':
        count2 += 1
    elif i % 2 and s[i] == '1':
        count2 += 1

print(min(count1, count2))

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

prev = s[0]
count  = 0
for i in range(1, len(s)):
    print(s)
    if prev == s[i]:
        count += 1

        if prev == '0':
            s[i] = '1'
        else:
            s[i] = '0'

    prev = s[i]

print(count)
Problem p03250 (python)

Fixed submission:
a, b, c = map(int, input().split())
print(max([a, b, c]) * 9 + sum([a, b, c]))

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
print(max(a, b, c) * 9 + sum(a, b, c))
Problem p03011 (python)

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

Buggy submission (verdict: Runtime Error):
n = int(input())
w = list(map(int,input().split()))
ans = 1000000000
for t in range(1, n):
    left = sum(w[:t])
    right = sum(w[t:])
    ans = min(ans , abs(left - right))
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
w = list(map(int,input(),split()))
ans = 1000000000
for t in range(1, n):
    left = sum(w[:t])
    right = sum(w[t:])
    ans = min(ans , abs(left - right))
print(ans)
Problem p03012 (python)

Fixed submission:
n = int(input())
w = list(map(int,input().split()))
ans = 1000000000
for t in range(1, n):
    left = sum(w[:t])
    right = sum(w[t:])
    ans = min(ans , abs(left - right))
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
w = list(map(int,input(),split()))
ans = 1000000000
for t in range(1, n);
    left = sum(w[:t])
    right = sum(w[t:])
    ans = min(ans , abs(left - right))
print(ans)
Problem p03036 (python)

Fixed submission:
r,d,x = map(int,input().split())
for i in range(10):
    x = r * x - d
    print(x)

Buggy submission (verdict: Runtime Error):
r,d,x = map(int,input().split())
for i in range(10)
    x = r * x - d
    print(x)
Problem p03041 (python)

Fixed submission:
n,k = map(int,input().split())
s = input()
print(s[:k -1] + s[k -1].lower() + s[k:])

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
s = input()
print(s[:k -1] + s[k -1].lower + s[k:-1])

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
s = input()
s[k-1] = s[k-1].lower()
print(s)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
s = input()
s[k-1] = s[k-1].lower()
print(s)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
s input()
s[k-1] = s[k-1].lower()
print(s)
Problem p03137 (python)

Fixed submission:
N, M = map(int, input().split())
zahyou = list(map(int,input().split()))
zahyou.sort()
difference = []
ans = 0

if N >= M:
    ans = 0
else:
    for i in range (M-1):
        difference.append(zahyou[i+1] - zahyou[i])
    difference.sort()
    ans = sum(difference[:M-N])

print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
zahyou = list(map(int,input().split()))
zahyou.sort()
difference = []
ans = 0

if M == 1:
    ans = 0
else:
    for i in range (M-1):
        difference.append(zahyou[i+1] - zahyou[i])
    difference.append(0)
    difference.sort()
    difference.reverse()
    length = zahyou[-1] - zahyou[0]
    ans = int(length)
    for i in range (N-1):
        ans -= difference[i]

print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
zahyou = list(map(int,input().split()))
zahyou.sort()
difference = []
ans = 0

if M == 1:
    ans = 0
else:
    for i in range (M-1):
        difference.append(zahyou[i+1] - zahyou[i])
    difference.append(0)
    difference.sort()
    difference.reverse()
    length = zahyou[-1] - zahyou[0]
    ans = int(length)
    for i in range (N):
        ans -= difference[i-1]

print(ans)
Problem p03011 (python)

Fixed submission:
p,q,r = map(int, input().split())
print(min(p+q, q+r, r+p))

Buggy submission (verdict: Runtime Error):
p,q,r = map(int, input().split())
print(min(p+q, q+r, r+s))
Problem p03075 (python)

Fixed submission:
lis = []
for i in range(5):
    lis.append(int(input()))
k = int(input())

flag_disconnectable = False
for i in range(5):
    for j in range(5):
        if i == j: continue
        if (lis[j]-lis[i]) > k:
            flag_disconnectable = True
            break

if flag_disconnectable:
    print(":(")
else:
    print("Yay!")

Buggy submission (verdict: Runtime Error):
(X,Y,Z,K) = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

delicious_list = []
for a in A[:min((1000,len(A)))]:
    for b in B[:min((1000,len(B)))]:
        for c in C[:min((1000,len(C)))]:
            delicious_list.append(a+b+c)
delicious_list.sort(reverse=True)
for i in range(K):
    print(delicious_list[i])

Buggy submission (verdict: Runtime Error):
(X,Y,Z,K) = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

delicious_list = []
for a in A[:min((1100,len(A)))]:
    for b in B[:min((1100,len(B)))]:
        for c in C[:min((1100,len(C)))]:
            delicious_list.append(a+b+c)
delicious_list.sort(reverse=True)
for i in range(K):
    print(delicious_list[i])

Buggy submission (verdict: Runtime Error):
(X,Y,Z,K) = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

delicious_list = []
for a in A[:min((1500,len(A)))]:
    for b in B[:min((1500,len(A)))]:
        for c in C[:min((1500,len(A)))]:
            delicious_list.append(a+b+c)
delicious_list.sort(reverse=True)
for i in range(K):
    print(delicious_list[i])
Problem p03315 (python)

Fixed submission:
s = raw_input()
total = 0
for t in s:
  if t == '+':
    total += 1
  else:
    total -= 1
print(total)

Buggy submission (verdict: Runtime Error):
s = raw_input()
total = 0
for t in s:
  if t == '+':
    total += 1
  else:
    total -= 1
print(total)