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

Fixed submission:
S = input()
Stack = []
for i in range(len(S)):
  if S[i] == "S":
    Stack.append("S")
  elif S[i] == "T" and len(Stack) == 0:
    Stack.append("T")
  elif S[i] == "T" and Stack[-1] == "T":
    Stack.append("T")
  elif S[i] == "T" and Stack[-1] == "S":
    Stack.pop()
print(len(Stack))

Buggy submission (verdict: Runtime Error):
S = list(input())
cnt = len(S)
while len(S) > 0:
  i = 0
  while i < len(S)-1:
    if S[i] == "S" and S[i+1] == "T":
      S.pop(i)
      S.pop(i+1)
    i += 1
  if cnt == len(S):
    print(len(S))
    exit()
  cnt = len(S)
print(len(S))
Problem p03137 (python)

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

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

X.sort()

buff = []

for i in range(M-1):
    buff.append(abs(X[i+1]-X[i]))


buff.sort()
buff = buff[::-1]

for i in range(min(N-1, len(buff))):
    buff.pop(0)

print(sum(buff))

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

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

X.sort()

buff = []

for i in range(M-1):
    buff.append(abs(X[i+1]-X[i]))


buff.sort()
buff = buff[::-1]

for i in range(min(N-1, len(buff))):
    # print(buff.pop(0))

print(sum(buff))
Problem p03221 (python)

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

_number = []
P = []
Y = []
yp = [[] for i in range(N+1)]
_yp = []

for i in range(M):
    p, y = map(int, input().split())
    yp[p].append([y, i])

# print(yp)

_l_yp = len(yp)

for i in range(_l_yp):
    yp[i].sort()


ans_yp = [[] for i in range(M)]

for i in range(_l_yp):
    nga_yp = len(yp[i])

    for j in range(nga_yp):
    #    print(i, j)
    #    print(yp[i][j][1])
       ans_yp[yp[i][j][1]].append(i)
       ans_yp[yp[i][j][1]].append(j+1)


__len = len(ans_yp)

for i in range(__len):
    buff = ''
    for d in range(2):
        ans = ''
        for j in range((6-len(str(ans_yp[i][d])))):
            ans += '0'

        buff += ans + str(ans_yp[i][d])

    print(buff)

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

_number = []
P = []
Y = []
yp = [[] for i in range(N+1)]
_yp = []

for i in range(M):
    p, y = map(int, input().split())
    yp[p].append([y, i])

# print(yp)

_l_yp = len(yp)

for i in range(_l_yp):
    yp[i].sort()


ans_yp = [[] for i in range(N+1)]

for i in range(_l_yp):
    nga_yp = len(yp[i])

    for j in range(nga_yp):
    #    print(i, j)
    #    print(yp[i][j][1])
       ans_yp[yp[i][j][1]].append(i)
       ans_yp[yp[i][j][1]].append(j+1)


__len = len(ans_yp)

for i in range(__len):
    buff = ''
    for d in range(2):
        ans = ''
        for j in range((6-len(str(ans_yp[i][d])))):
            ans += '0'

        buff += ans + str(ans_yp[i][d])

    print(buff)
Problem p02699 (python)

Fixed submission:
def issafe(S,W):
    if S > W:
        return "safe"
    return "unsafe"

S,W = map(int,input().split())
print(issafe(S,W))

Buggy submission (verdict: Runtime Error):
s,w=map(int.input().split());
if s<=w:
  print('unsafe');
else:
  print('safe');

Buggy submission (verdict: Runtime Error):
s,w=map(int.input().split())
if s<=w:
  print('unsafe')
else:
  print('safe')

Buggy submission (verdict: Runtime Error):
s,w=map(int.input().split());
if s<=w:
  print(unsafe);
else:
  print(safe);

Buggy submission (verdict: Runtime Error):
s,w=map(int.input().split())
if s<=w:
  print(unsafe)
else:
  print(safe)
Problem p02753 (python)

Fixed submission:
s = set(input())
print('Yes' if len(s)>1 else 'No')

Buggy submission (verdict: Runtime Error):
S = input()
s = set(input())
print('Yes' if len(s)>1 else 'No')
Problem p02759 (python)

Fixed submission:
import math
n = int(input())
print(int(math.ceil(n/2)))

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
d = {}
for _ in range(m):
  s,c = map(int,input().split())
  if s > n:
    print(-1)
    exit()
  if s in d:
    if d[s] == c:
      continue
    else:
      print(-1)
      exit()
  else:
    d[s] = c

ans = ''
for i in range(n):
  if i+1 in d:
    ans += str(d[i+1])
  else:
    ans += '1'
print(ans)
Problem p02766 (python)

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

def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)
ans = len(str(Base_10_to_n(int(n),k)))
print(ans)

Buggy submission (verdict: Runtime Error):
n,k = input().split()
k = int(k)
ans = len(str(int(n,k)))
print(ans)

Buggy submission (verdict: Runtime Error):
n,k = input().split()
k = int(k)
ans = len(int(n,k))
print(ans)
Problem p02781 (python)

Fixed submission:
import math
import sys
n=int(input())
k=int(input())
s=str(n)
l=len(s)
dp0=[[0 for j in range(k+1)] for i in range(l)]
dp1=[[0 for j in range(k+1)] for i in range(l)]

x=int(s[0])
dp0[0][1]=x-1
dp0[0][0]=1
dp1[0][1]=1
for i in range(1,l):
    x=int(s[i])
    dp0[i][0]=1

    for j in range(1,k+1):
        dp0[i][j]+=dp0[i-1][j-1]*9+dp0[i-1][j]
        if x>0:
            dp0[i][j]+=dp1[i-1][j-1]*(x-1)+dp1[i-1][j]
            dp1[i][j]=dp1[i-1][j-1]
        else:
            dp1[i][j]=dp1[i-1][j]

print(dp0[l-1][k]+dp1[l-1][k])

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

import math

def func(n,k):
  if k==0:
    return 0
  digit = len(n)
  res = 0
  if digit == 1:
    if k ==1:
      res = int(n)
    return res
  if digit == 2:
    if k ==2:
      res = (int(n) - 9 - int(n) //10)
    elif k == 3:
      res = (0)
    else:
      res = (9+int(n)//10)
    return res

  base = 9**k * (math.factorial(digit-1)/ (math.factorial(k) * math.factorial(digit-1-k)) )

  for i in range(9):
    i+= 1
    if i < int(n[0]):
      base += func(n[1:],k-1)
  return base

print(int(func(n,k)))
Problem p02820 (python)

Fixed submission:
n,k = map(int,input().split())
r,s,p = map(int,input().split())
t = input()
score = {'r':p, 's':r ,'p':s}
from collections import deque
past = deque([])

ans = 0
for i in range(n):
  if i < k:
    ans += score[t[i]]
    past.append(t[i])
  else:
    if past.popleft() != t[i]:
      ans += score[t[i]]
      past.append(t[i])
    else:
      past.append('nn')
      
  
print(ans)

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

scores = {'r':p,'s':r,'p':s}


ans = 0
memo = []

for i in range(n):
  if i < k:
    ans += scores[T[i]]
    memo.append(T[i])
  else:
    if memo[i-k] == T[i]:
      memo.append('N')
    else:
      ans += scores[T[i]]
      memo.append(T[i])
print(ans)
Problem p02897 (python)

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

Buggy submission (verdict: Runtime Error):
def Euclid(a,b):
  r = a % b
  if r == 0:
    return b
  return Euclid(b,r)
import fractions

a,b = map(int,input().split())
#c = Euclid(a,b) if a > b else Euclid(b,a)
c = fractions.gcd(a,b)

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
  
if c == 1:
  print(1)
else:
  print(len(factorization(c))+1)
Problem p02935 (python)

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

while len(V)> 1:
  a = min(V)
  V.pop(V.index(a))
  b = min(V)
  V.pop(V.index(b))
  V.append((a+b)/2)
print(V[0])

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

while len(V)> 1:
  a = min(V)
  V.pop(V.index(a))
  b = min(V)
  V.pop(V.index(b))
  V.append((a+b)/2)
print(V[0])
Problem p02970 (python)

Fixed submission:
import math
n,d = map(int,input().split())
print(math.ceil(n / (2*d+1)) )

Buggy submission (verdict: Runtime Error):
import math
n,d = map(int,input().split())
print(math.ceil(n / (2d+1)) )
Problem p02990 (python)

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

history = {}
def comb(n,k):
  if (n,k) in history:
    return history[(n,k)]
  if k == 0:
    return 1
  res = (n-k+1)*pow(k,MOD-2,MOD)*comb(n,k-1)
  res = res%MOD
  history[(n,k)] = res
  history[(n,n-k)] = res
  return res

for i in range(k):
  #print(comb(k-1,i),comb(n-k+1,i+1))
  ans = comb(k-1,i) * comb(n-k+1,i+1)
  print(ans % MOD)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
MOD = 10**9+7

history = {}
def comb(n,k):
  if (n,k) in history:
    return history[(n,k)]
  res = (n-k+1)*pow(k,MOD-2,MOD)*comb(n,k-1)
  res = res%MOD
  history[(n,k)] = res
  history[(n,n-k)] = res
  return res

for i in range(k):
  #print(comb(k-1,i),comb(n-k+1,i+1))
  ans = comb(k-1,i) * comb(n-k+1,i+1)
  print(ans % MOD)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
MOD = 10**9+7

history = {}
def comb(n,k):
  if (n,k) in history:
    return history((n,k))
  res = 1
  for i in range(k):
    res *= n-i
    res *= pow(i+1,MOD-2,MOD)
  res = res % MOD
  history[(n,k)] = res
  history[(n,n-k)] = res
  return res

for i in range(k):
  #print(comb(k-1,i),comb(n-k+1,i+1))
  ans = comb(k-1,i) * comb(n-k+1,i+1)
  print(ans % MOD)
Problem p03012 (python)

Fixed submission:
n = int(input())
ws = list(map(int,input().split()))
others = [0]
diff = 999999999999
for i in range(n):
  d= abs(sum(ws)-sum(others))
  if d < diff:
    diff = d
  others.append(ws.pop(0))
print(diff)

Buggy submission (verdict: Runtime Error):
n = int(input())
ws = list(map(int,input().split()))
others = [0]
diff = 999999999999
for i in range(n):
  d= abs(sum(ws)-sum(other))
  if d < diff:
    diff = d
  others.add(ws.pop(0))
print(diff)
Problem p03041 (python)

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

Buggy submission (verdict: Runtime Error):
n,k  = map(int,input().split())
s = input()
print(s[:k] +chr(ord(s[k])+32)+ s[k+1:])
Problem p03072 (python)

Fixed submission:
n = int(input())
#mont = [int(input()) for i in range(n)]
mont = list(map(int,input().split()))
count = 0
for i in range(n):
  if mont[i] >= max(mont[:i+1]):
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
#mont = [int(input()) for i in range(n)]
mont = list(map(int,input().split()))
conut = 0
for i in range(n):
  if mont[i] >= max(mont[:i]):
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
mont = [int(input()) for i in range(n)]
conut = 0
for i in range(n):
  if mont[i] >= max(mont[:i]):
    count += 1
print(count)
Problem p03077 (python)

Fixed submission:
n = int(input())

max_nums = []
for i in range(5):
  max_nums.append(int(input()))
max_nums.append(n)
a = n/min(max_nums)
print(int(a) +4+ (0 if a == int(a) else 1))

Buggy submission (verdict: Runtime Error):
n = int(input())
def move(max_num,before):
  return min(max_num,before)

people = [n,0,0,0,0,0]
max_nums = []
for i in range(5):
  max_nums.append(int(input()))

time = 0
while True:
  time += 1
  move_p = [0] * 6
  for i in range(5):
    move_p[i] -= min(max_num[i],people[i])
    move_p[i+1] += min(max_num[i],people[i])
  people += move_p
  if people[-1] == n:
    break
Problem p03107 (python)

Fixed submission:
s = input()
z = s.count('0')
if 2*z > len(s):
  print((len(s)-z)*2)
else:
  print(2*z)

Buggy submission (verdict: Runtime Error):
s = input()
o = len(s)
while True:
  len(s) = b
  s.replace('00','')
  s.replace('11','')
  if(len(s) == b):
    break
print(o - len(s))
Problem p03208 (python)

Fixed submission:
n,k = map(int,input().split())
H = [int(input()) for _ in range(n)]
H.sort()
ans = float('inf')

for i in range(n-k+1):
  ans = min(H[i+k-1]-H[i], ans)
print(ans)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
H = [int(input()) for _ in range(n)]
H.sort()
ans = float('inf')

for i in range(n-k+1):
  ans = min(H[i+k-1]-H[i])
print(ans)
Problem p03250 (python)

Fixed submission:
l = sorted(list(map(int,input().split())))
print(l[2]*10 + l[1] + l[0])

Buggy submission (verdict: Runtime Error):
s =input()
t =input()
n = len(s)
d = {}
used = set([])

for i in range(n):
  if s[i] not in d:
    if t[i] in used:
      print('No')
      continue
    d[s[i]] = t[i]
    used.add(t[i])
  else:
    if d[s[i]] == t[i]:
      continue
    else:
      print('No')
      break
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
l = list(map(int,input().split())).sort
print(l[2]*10 + l[1] + l[0])
Problem p03295 (python)

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

cut  = []
for _ in range(m):
  a,b = map(int,input().split())
  cut.append((a,b))

cut.sort()

b_min = cut[0][1]
count = 0

for a,b in cut[1:]:
  if b_min > b:
    b_min = b
    continue
  if b_min <= a:
    count += 1
    b_min = b

print(count+1)

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

cut  = []
for _ in range(m):
  a,b = map(int,input().split())
  cut.append((a,b))

cut.sort()

b_min = cut[0][1]
count = 0

for a,b in cut:
  if b_min > b:
    b_min = b
    continue
  if b_min > a:
    count += 1
    b_min = b

print(count)
Problem p03317 (python)

Fixed submission:
n,k = map(int,input().split())
A = list(map(int,input().split()))
import math
ans = math.ceil(((n-1)/(k-1)))
print(ans)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
A = list(map(int,input().split()))
import math
ans = math.ceil(((n-1)/(k-1))
print(ans)
Problem p03327 (python)

Fixed submission:
n = int(input())
ans = 'AB'
if n <= 999:
  ans += 'C'
else:
  ans += 'D'
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = 'AB'
if n <= 999:
  ans += 'C'
else:
  ans += 'D'
  n -= 999
print(ans+'{03}'.format(n))
Problem p03723 (python)

Fixed submission:
a,b,c = map(int,input().split())

if a%2 or b%2 or c%2:
  print(0)
  exit()
elif a==b==c:
  print(-1)
  exit()
  
ans =0
while 1:
  if all((a%2==0, b%2==0, c%2==0)):
    ans += 1
  else:
    print(ans)
    exit()
  a, b, c = (b+c)//2, (a+c)//2, (b+a)//2

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

if a%2 or b%2 or c%2:
  print(0)
  exit()
elif a==b==c:
  print(-1)
  exit()
  
ans =0
while 1:
  if all(a%2==0, b%2==0, c%2==0):
    ans += 1
  else:
    print(ans)
    exit()
  a, b, c = (b+c)//2, (a+c)//2, (b+a)//2
Problem p03805 (python)

Fixed submission:
n,m = map(int,input().split())
graph = {i+1:[] for i in range(n)}
for _ in range(m):
  a,b = map(int,input().split())
  graph[a].append(b)
  graph[b].append(a)

def func(path,p,count):
  if len(path) == n:
    return count + 1
  for i in graph[p]:
    if i in path:
      continue
    count = func(path+[i],i,count)
  return count
print(func([1],1,0))

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
graph = {i+1:[] for i in range(n)}
for _ in range(m):
  a,b = map(int,input(),split())
  graph[a].append(b)
  graph[b].append(a)

count = 0
def func(path,p):
  if len(path) == n:
    count += 1
    return
  for i in graph[p]:
    if i in path:
      continue
    func(path+[i],i)
print(count)
Problem p02729 (python)

Fixed submission:
import math

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

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

if not 0 <= n <= 100 and 0 <= m <= 100 and 2 <= n + m:
    print('Unsupported...')  
if n >= 2:
    n_comb = combinations_count(n, 2)
else:
    n_comb = 0
if m >= 2:
    m_comb = combinations_count(m, 2)
else:
    m_comb = 0
    
print(n_comb + m_comb)

Buggy submission (verdict: Runtime Error):
import math

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

if not 0 <= n <= 100 and 0 <= m <= 100 and 2 <= n + m:
    print('Unsupported...')  
if n >= 2:
    n_comb = combinations_count(n, 2)
else:
    n_comb = 0
if m >= 2:
    m_comb = combinations_count(m, 2)
else:
    m_comb = 0
    
print(n_comb + m_comb)
Problem p02754 (python)

Fixed submission:
n, a, b = map(int, input().split())
if n == (a + b):
    print(a)
else:
    q = n // (a + b)
    mod = n % (a + b)
    if mod > a:
        print(a * q + a)
    else:
        print(a * q + mod)

Buggy submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
if n == (a + b):
    print(a)
else:
    q = n // (a + b)
    mod = n % (a + b)
    if mod > a:
    print(a * q + a)
    else:
        print(a * q + mod)

Buggy submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
if n == (a + b):
    print(a)
else:
    q, mod = divmod(n, (a + b))
    if mod > a:
    print(a * q + a)
    else:
        print(a * q + mod)
Problem p02766 (python)

Fixed submission:
n, k = map(int, input().split())
ans = 0
while n > 0:
    n = n // k
    ans += 1
print(ans)

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

while n > 0:
    d.append(n % k)
    n = n // k
    
print(len(d))

Buggy submission (verdict: Runtime Error):
from collections import deque

n, r = map(int, input().split())
d = deque()

while n > 0:
    d.append(n % k)
    n = n // k
    
print(len(d))

Buggy submission (verdict: Runtime Error):
from collections import deque

n, r = map(int, input().split())
d = deque()

while n > 0:
    d.append(n % k)
    n = n // k
    
print(len(d))
Problem p02847 (python)

Fixed submission:
import sys
input = sys.stdin.readline
from collections import Counter, deque

INF = float('inf')
weekly = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']


def main():
    S = input().rstrip()
    index = weekly.index(S)
    print(-(index - len(weekly)))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

import numpy as np
import scipy as sp
from collections import Counter, deque

INF = float('inf')
weekly = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']


def main():
    S = input().rstrip()
    index = weekly.index(S)
    print(-(index - len(weekly)))


if __name__ == '__main__':
    main()
Problem p02779 (python)

Fixed submission:
aaa = int(input())
la = list(map(int, input().split()))
d = {}
ret = 'YES'
for a in la:
    if a in d:
        ret = 'NO'
        break
    d[a] = ''
print(ret)

Buggy submission (verdict: Runtime Error):
n = int(input())
la = list(map(int, input().split())
d = {}
ret = 'NO'
for a in la:
    if a in d:
        ret = 'YSE'
        break
    d[a] = ''
print(ret)
Problem p02659 (python)

Fixed submission:
def main():
    A, B = input().split()
    A = int(A)
    B_big, B_small = B.split(".")
    B_big = int(B_big)
    B_small = int(B_small)
    print(A*B_big + A*B_small//100)
 
 
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import math
 
a, b = input().split()
a = int(a)
b_int = int(b)
b_fric = b -b_int
r1 = a*b_int
r2 = a*b_fric//100
result = r1+r2
print(result)

Buggy submission (verdict: Runtime Error):
import math
 
a, b = map(int, input().split())
a = int(a)
b_int = int(b)
b_fric = b -b_int
r1 = a*b_int
r2 = a*b_fric//100
result = r1+r2
print(result)

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

Buggy submission (verdict: Runtime Error):
import math

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

Fixed submission:
import math
N,D=map(int,input().split())
print(math.ceil(N/(2*D+1)))

Buggy submission (verdict: Runtime Error):
N,D=map(int(),input().split())
print(N//(2D+1))
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):
a,b=input().split()
s=list(input())
print([l.replace(s[int(b)],str.lower(s[int(b)])) for l in s])
Problem p03042 (python)

Fixed submission:
A=input()
B=int(A[:2])
C=int(A[2:4])
  
if(1<=B<=12):
    if(1<=C<=12):
        print('AMBIGUOUS')
    else:
        print('MMYY')
elif(1<=C<=12):
    print('YYMM')    
else:
    print('NA')

Buggy submission (verdict: Runtime Error):
a=(input())
b=int(a[0:2])
c=int(a[2:4])
if b==0 or c==o:
  print("NA")
elif b => 12 and c=>12:
  print("NA")
elif b =>12:
  print("YYMM")
elif c=>12:
  print("MMYY")
else:
  print("AMBIGUOUS")
Problem p03207 (python)

Fixed submission:
N=int(input())
l=[]
for i in range(N):
  l.append(int(input()))
print(sum(l)-max(l)//2)

Buggy submission (verdict: Runtime Error):
N=int(input())
l=[]
for i in N:
  l.append(int(input()))
print(sum(l)-max(l)//2)
Problem p03208 (python)

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

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
h = [int(input()) for i in range(N)]
h.sort()
ans=[]
for i in range(len(h)-K+1):
  b=h[K+1-i]-h[i]
  ans.append(b)
print(min(b))
Problem p03242 (python)

Fixed submission:
print(1110-int(input()))

Buggy submission (verdict: Runtime Error):
import collections
N=int(input())
L=list(map(int,input().split()))
E=[i for i in L[::2]]
O=[i for i in L[1::2]]
e = collections.Counter(E).most_common()
o = collections.Counter(O).most_common()
if e[0][0] != o[0][0]:
    print(N - e[0][1] - o[0][1])
else:
    if len(e) == 1 or len(o) == 1:
        print(N // 2)
    else:
        a = N - e[1][1] - o[0][1]
        b = N - e[0][1] - o[1][1]
        print(min(a, b))

Buggy submission (verdict: Runtime Error):
import collections
N=int(input())
L=list(map(int,input().split()))
E=[i for i in L[::2]]
O=[i for i in L[1::2]]
e = collections.Counter(E)
o = collections.Counter(O)
e1=e.most_common()[0][1]
e2=e.most_common()[-1][1]
o1=o.most_common()[0][1]
o2=o.most_common()[-1][1]

Ans=[N-e1-o2,N-e2-o1,N-e2-o2,N-o1-e1]

if len(set(L))==1:
  print(N//2)
else:
  print(min(Ans))
Problem p03803 (python)

Fixed submission:
A,B=map(int,input().split())
 
if A==B:
  print("Draw")
elif B==1:
  print("Bob")
elif B>1 and A==1 or A>B:
  print("Alice")
else:
  print("Bob")

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
 
if A==B:
  print("Draw")
elif B>1 and A==1 or A>B:
  print(""Alice)
else:
  print("Bob")

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
 
if A>B or A==1 not B==1:
  print("Alice")
elif A==B:
  print("Draw")
else:    
  print("Bob")

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
if A>B:
  print("Alice")
elif A==B:
  print(Draw)
else:
  print("Bob")
Problem p02933 (python)

Fixed submission:
a=int(input())
s=input()
if a>=2800 and a<3200:
  print('red')
if a>=3200 and a<5000:
  print(s)

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

Buggy submission (verdict: Runtime Error):
a=int(input())
s=input()
if a>3200:
  print(s)
else:
  print(red)
Problem p02951 (python)

Fixed submission:
a,b,c=list(map(int,input().split()))
cap=a-b
use=min(a-b,c)
ans=c-use
print(ans)

Buggy submission (verdict: Runtime Error):
n= int(input())
ans = 0
for i in range(1, n+1 ):
	if len(str(i))%2 == 1:
		ans += 1
print(ans)