Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
def pair_cal(int):
    tar = int -1
    cnt = tar * (tar+1) / 2

    return round(cnt)

N = int(input())

str_ls = []
for _n in range(0, N):
    c = ''.join(sorted(str(input())))
    str_ls.append(c)

uniq_ls = list(set(str_ls))
# print(uniq_ls)

# str_ls.sort()
# print(str_ls)

total_cnt = 0

for _u in uniq_ls:
    count_num = str_ls.count(_u)
    if count_num != 1:
        total_cnt += pair_cal(count_num)

print(total_cnt)

Fixed submission:
n = int(input())
s = [sorted(input()) for i in range(n)]

count = 0
dic1 = {}
# print(s)
for i in range(n):
    # print(s[i])
    so = ''.join(s[i])
    # print(so)
    if so in dic1:
        count += dic1[so]
        dic1[so] += 1
    else:
        dic1[so] = 1
    # print(count, dic1)
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
def str_order(str):
    temp_ls = []
    for _s in str:
        temp_ls.append(_s)

    temp_ls.sort()

    temp_val = ""
    for _st in temp_ls:
        temp_val += _st

    return(temp_val)

def pair_cal(int):
    cnt = 0
    for _i in range(1, int):
        cnt += _i

    return cnt

N = int(input())

str_ls = []
for _n in range(0, N):
    str_ls.append(str_order(str(input())))

uniq_ls = list(set(str_ls))
# print(uniq_ls)

str_ls.sort()
# print(str_ls)

total_cnt = 0

for _u in uniq_ls:
    count_num = str_ls.count(_u)
    if count_num != 1:
        total_cnt += pair_cal(count_num)

print(total_cnt)

Fixed submission:
n = int(input())
s = [sorted(input()) for i in range(n)]

count = 0
dic1 = {}
# print(s)
for i in range(n):
    # print(s[i])
    so = ''.join(s[i])
    # print(so)
    if so in dic1:
        count += dic1[so]
        dic1[so] += 1
    else:
        dic1[so] = 1
    # print(count, dic1)
print(count)
Buggy python submission (verdict: Runtime Error):
x, y = input.split()
if x == y:
  print("H")
else:
  print("D")

Fixed submission:
x, y = input().split()
if x == y:
  print("H")
else:
  print("D")
Buggy python submission (verdict: Runtime Error):

def resolve():
    num, long = list(input().split())
    string = sorted([input for i in range(num)])
    print(*string, sep="")

if __name__ == '__main__':
    resolve()

Fixed submission:
n, l = map(int,input().split())
li = sorted([input() for i in range(n)])
print(*li, sep="")
Buggy python submission (verdict: Runtime Error):
a = input()
s = input()
if str(a) >= 3200:
    print(s)
else:
    print('red')

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

sum_list = []

def findSumOfDigit(n):
    s = 0
    while(n > 0):
        s += n % 10
        n = int(n / 10)
    return s

for a in range(1, N-1):
    b = N - a
    sum_list.append(findSumOfDigit(a) + findSumOfDigit(b))

print(min(sum_list))


Fixed submission:
N = int(input())

sum_list = []

def findSumOfDigit(n):
    s = 0
    while(n > 0):
        s += n % 10
        n = int(n / 10)
    return s

for a in range(1, N):
    b = N - a
    sum_list.append(findSumOfDigit(a) + findSumOfDigit(b))

print(min(sum_list))

Buggy python submission (verdict: Runtime Error):
N = int(input())

sum_list = []

def findSumOfDigit(n):
    s = 0
    while(n > 0):
        s += n % 10
        n = int(n / 10)N = int(input())

sum_list = []

def findSumOfDigit(n):
    s = 0
    while(n > 0):
        s += n % 10
        n = int(n / 10)
    return s

for a in range(1, N-1):
    b = N - a
    sum_list.append(findSumOfDigit(a) + findSumOfDigit(b))

print(min(sum_list))

    return s

for a in range(2, N):
    b = N - a
    sum_list.append(findSumOfDigit(a) + findSumOfDigit(b))

print(min(sum_list))


Fixed submission:
N = int(input())

sum_list = []

def findSumOfDigit(n):
    s = 0
    while(n > 0):
        s += n % 10
        n = int(n / 10)
    return s

for a in range(1, N):
    b = N - a
    sum_list.append(findSumOfDigit(a) + findSumOfDigit(b))

print(min(sum_list))

Buggy python submission (verdict: Runtime Error):
N = int(input())

sum_list = []

def findSumOfDigit(n):
    s = 0
    while(n > 0):
        s += n % 10
        n = int(n / 10)
    return s

for a in range(2, N):
    b = N - a
    sum_list.append(findSumOfDigit(a) + findSumOfDigit(b))

print(min(sum_list))


Fixed submission:
N = int(input())

sum_list = []

def findSumOfDigit(n):
    s = 0
    while(n > 0):
        s += n % 10
        n = int(n / 10)
    return s

for a in range(1, N):
    b = N - a
    sum_list.append(findSumOfDigit(a) + findSumOfDigit(b))

print(min(sum_list))
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = list(map(int, input().split()))

A_dict = {}
rewrite = 0

for a in A:
    if a in A_dict:
        A_dict[a] += 1
    else:
        A_dict[a] = 1

while len(A_dict) > K:
    rewrite_key = min(A_dict, key=A_dict.get)
    rewrite += A_dict[rewrite_key]
    del A_dict[rewrite_key]

print(rewrite)


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

A_dict = {}
for a in A:
    if a in A_dict:
        A_dict[a] += 1
    else:
        A_dict[a] = 1

A_sorted = sorted(A_dict.items(), key=lambda x:x[1], reverse=True)
rewrite = 0
while len(A_sorted) > K:
    tmp = A_sorted.pop()
    rewrite += tmp[1]

print(rewrite)
Buggy python submission (verdict: Runtime Error):
import numpy as np
n=int(input())
a=[]
m=[]
for i in range(n):
  a.append(int(input()))
m.append(a.index(max(a)))
m.append(a.pop(m[0]))
m.append(max(a))

for i in range(m[0]):
  print(m[1])
  
print(m[2])

for i in range(m[0]+1,n):
  print(m[i])

Fixed submission:
import numpy as np
n=int(input())
a=[]
m=[]
for i in range(n):
  a.append(int(input()))
m.append(a.index(max(a)))
m.append(a.pop(m[0]))
m.append(max(a))

for i in range(m[0]):
  print(m[1])
  
print(m[2])

for i in range(m[0]+1,n):
  print(m[1])
Buggy python submission (verdict: Runtime Error):
W,H,x,y = map(float,input().split(" "))
ans = (W * H) / 2
flag = 0
if (x == 0 or x == W) and (y == 0 or y == H):
    flag = 0
elif (y / x) == (H / W):
    flag = 0   
elif (W / 2) == x and (H/2) == y:
    flag = 1
elif (W / 2) == x or (H/2) == y:
    flag = 0
else:
    flag = 1
print(str(ans) + " " + str(flag))

Fixed submission:
W,H,x,y = map(float,input().split(" "))
ans = (W * H) / 2
flag = 0
if (W / 2) == x and (H/2) == y:
    flag = 1
else:
    flag = 0
print(str(ans) + " " + str(flag))
Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split(" "))
ans = 0
GATE_ID = []
for i in range(M):
    GATE_ID1,GATE_ID2 = map(int,input().split(" "))
    GATE_ID.append([GATE_ID1,GATE_ID2])
#print(GATE_ID)

for i in range(N):
    CARD_ID = i+1
    #print("CARD_ID:",CARD_ID)
    ALL_GATE_PASS_COUNT = 0
    for j in range(M):
        GATE_ID1,GATE_ID2 = GATE_ID[j][0],GATE_ID[j][1]
        #print(GATE_ID1,GATE_ID2)
        if CARD_ID >= GATE_ID1 and CARD_ID <= GATE_ID2:
            ALL_GATE_PASS_COUNT += 1
            #print(CARD_ID,":PASS")
        else:
            break
    #print("ALL_GATE_PASS_COUNT:",ALL_GATE_PASS_COUNT)
    if ALL_GATE_PASS_COUNT == M:
        ans += 1
print(ans)

Fixed submission:
N,M = map(int,input().split(" "))
L_list = []
R_list = []
for i in range(M):
    L,R = map(int,input().split(" "))
    L_list.append(L)
    R_list.append(R)
if min(R_list) - max(L_list) >= 0:
    print(min(R_list) - max(L_list) +1)
else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split(" "))
ans = 0
GATE_ID = []
for i in range(M):
    GATE_ID1,GATE_ID2 = map(int,input().split(" "))
    GATE_ID.append([GATE_ID1,GATE_ID2])
#print(GATE_ID)

for i in range(N):
    CARD_ID = i+1
    #print("CARD_ID:",CARD_ID)
    ALL_GATE_PASS_COUNT = 0
    for j in range(M):
        GATE_ID1,GATE_ID2 = GATE_ID[j][0],GATE_ID[j][1]
        #print(GATE_ID1,GATE_ID2)
        if CARD_ID >= GATE_ID1 and CARD_ID <= GATE_ID2:
            ALL_GATE_PASS_COUNT += 1
            #print(CARD_ID,":PASS")
    #print("ALL_GATE_PASS_COUNT:",ALL_GATE_PASS_COUNT)
    if ALL_GATE_PASS_COUNT == M:
        ans += 1
print(ans)

Fixed submission:
N,M = map(int,input().split(" "))
L_list = []
R_list = []
for i in range(M):
    L,R = map(int,input().split(" "))
    L_list.append(L)
    R_list.append(R)
if min(R_list) - max(L_list) >= 0:
    print(min(R_list) - max(L_list) +1)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
S = list(input())
list = []
temp = ""
for i in range(len(S)):
    if S[i] == 'A' or S[i] == 'T' or S[i] == 'G' or S[i] == 'C':
        temp += S[i]
    else:
        list.append(temp)
        temp = ""
#print(list)
ans = []
for i in range(len(list)):
    ans.append(len(list[i]))
#print(ans)
print(max(ans))

Fixed submission:
S = list(input())
#print(S)
list = []
temp = ""
for i in range(len(S)):
    if S[i] == 'A' or S[i] == 'T' or S[i] == 'G' or S[i] == 'C':
        temp += S[i]
        list.append(temp)
    else:
        list.append(temp)
        temp = ""
#print(list)
ans = []
for i in range(len(list)):
    ans.append(len(list[i]))
#print(ans)
print(max(ans))
Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split(" "))
list = []
for i in range(N):
    A,B = map(int,input().split(" "))
    list.append([A,B])
#print(list)
list = sorted(list)
#print(list)
cost = 0
while True:
    #print(cost)
    M -= list[0][1]
    if M <= 0:
        cost += list[0][0] * (list[0][1]+M)
        break
    else:
        cost += list[0][0] * list[0][1]
        list.remove(list[0])
print(cost)


Fixed submission:
N,M = map(int,input().split(" "))
list = []
for i in range(N):
    A,B = map(int,input().split(" "))
    list.append([A,B])
#print(list)
list = sorted(list)
#print(list)
cost = 0
while True:
    #print(cost)
    M -= list[0][1]
    if M <= 0:
        cost += list[0][0] * (list[0][1]+M)
        break
    else:
        cost += list[0][0] * list[0][1]
        list.remove(list[0])
print(cost)
Buggy python submission (verdict: Time Limit Exceeded):
S = list(input())
S = [int(i) for i in S]
c = 0
while True:
    OK,flag,break_flag = 0,0,0
    LOOP = len(S)-1
    for i in range(LOOP):
        if S[i] != S[i+1] and S[i] != 9:
            S[i],S[i+1] = 9,9
            OK += 1
        else:
            flag += 1
    if flag == LOOP:
        break_flag = 1
    if OK >= 1:
        for i in range(2*OK):
            S.remove(9)
            c += 1
    if break_flag == 1 or len(S) <= 1:
        break
print(c)

Fixed submission:
S = list(input())
S = [int(i) for i in S]
one = 0
zero = 0
for i in range(len(S)):
    if S[i] == 1:
      one += 1
    elif S[i] == 0:
      zero += 1
print(len(S)-abs(one-zero))

Buggy python submission (verdict: Time Limit Exceeded):
S = list(input())
S = [int(i) for i in S]
c = 0
#print(S)
while True:
    OK = 0
    flag = 0
    break_flag = 0
    for i in range(len(S)-1):
        if S[i] != S[i+1] and S[i] != 9 and S[i+1] != 9:
            S[i] = 9
            S[i+1] = 9
            OK += 1
        else:
            flag += 1
    #print(S)
    if flag == len(S)-1:
        break_flag = 1
    if OK >= 1:
        for i in range(2*OK):
            S.remove(9)
            c += 1
    #print(S)
    #print(flag)
    if break_flag == 1 or len(S) <= 1:
        break
print(c)

Fixed submission:
S = list(input())
S = [int(i) for i in S]
one = 0
zero = 0
for i in range(len(S)):
    if S[i] == 1:
      one += 1
    elif S[i] == 0:
      zero += 1
print(len(S)-abs(one-zero))

Buggy python submission (verdict: Time Limit Exceeded):
S = list(input())
S = [int(i) for i in S]
c = 0
#print(S)
while True:
    OK = 0
    flag = 0
    break_flag = 0
    for i in range(len(S)-1):
        if S[i] != S[i+1] and S[i] != 9 and S[i+1] != 9:
            S[i] = 9
            S[i+1] = 9
            OK = 1
            break
        else:
            flag += 1
    #print(S)
    if flag == len(S)-1:
        break_flag = 1
    if OK == 1:
        for i in range(2):
            S.remove(9)
            c += 1
    #print(S)
    #print(flag)
    if break_flag == 1 or len(S) <= 1:
        break
print(c)

Fixed submission:
S = list(input())
S = [int(i) for i in S]
one = 0
zero = 0
for i in range(len(S)):
    if S[i] == 1:
      one += 1
    elif S[i] == 0:
      zero += 1
print(len(S)-abs(one-zero))
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = input().split(" ")
A = [int(i) for i in A]
list = [min(A)]
A = sorted(A)
iii = 0
while True:
    iii += 1
    if A[N-1] % A[N-2] != 0:
        A[N-1] = A[N-1] % A[N-2]
    elif N >= 3 and A[N-1] % A[N-3] != 0:
        A[N-1] = A[N-1] % A[N-3]

    A = sorted(A)
    list.append(min(A))
    if iii > 32:
        break       
#print(list)
for i in range(N-1):
    if A[i+1]-A[i] > 0:
        list.append(A[i+1]-A[i])
#print(list)
print(min(list))

Fixed submission:
A,B = map(int,input().split(" "))
if B % A == 0:
    print(A + B)
else:
    print(B - A)
Buggy python submission (verdict: Time Limit Exceeded):
A,B,C = map(int,input().split(" "))
p_flag = 0
D = 0
i = 0
limit = A+B+C+1
while True:
    if p_flag == 0 and C >= 1:
        p_flag = 1
        D += 1
        C -= 1
    elif p_flag == 1 and B >= 1:
        p_flag = 0
        D += 1
        B -= 1
    elif p_flag == 1 and A >= 1:
        p_flag = 0
        A -= 1
    elif B >= 1:
        p_flag = 0
        D += 1
        B -= 1
    elif A >= 1:
        p_flag = 0
        A -= 1
    elif C >= 1:
        if p_flag == 1:
            break
        p_flag = 1
        D += 1
        C -= 1
    i += 1
    if i >= limit:
        break
print(D)

Fixed submission:
A,B,C = map(int,input().split(" "))
D = 0

if (A+B) >= C:
    D += B + C
elif C >= B:
    D += B * 2
    C -= B
    if C >= A:
        D += A
        C -= A
        if C >= 1:
            D += 1
print(D)
Buggy python submission (verdict: Time Limit Exceeded):
A,B,K = map(int,input().split(" "))
list = []
for i in range(B-A+1):
    list.append(i+A)
#print(list)

if K*2 >= len(list):
    for i in range(len(list)):
        print(list[i])
else:
    for i in range(K):
        print(list[i])
    for i in range(K):
        print(list[i+len(list)-1-K+1])

Fixed submission:
A,B,K = map(int,input().split(" "))
list = []

if B - A + 1 <= K * 2:
    for i in range(A,B+1):
        print(i)
else:
    count = 0
    for i in range(A,B+1):
        count += 1
        print(i)
        if count >= K:
            break
    count = 0
    for i in range(B-K+1,B+1):
        print(i)
Buggy python submission (verdict: Time Limit Exceeded):
temp = input().split(" ")
X = int(temp[0])
Y = int(temp[1])
i = 2
while True:
    tgt = X * i
    if X == Y:
        print(-1)
        break
    elif tgt % Y != 0:
        print(tgt)
        break
    else:
        i += 1

Fixed submission:
temp = input().split(" ")
X = int(temp[0])
Y = int(temp[1])
i = 2
while True:
    tgt = X * i
    if X == Y:
        print(-1)
        break
    elif tgt % Y != 0:
        print(tgt)
        break
    elif i == 100000:
        print(-1)
        break
    else:
        i += 1
Buggy python submission (verdict: Time Limit Exceeded):
A,B,C,D,E,F = map(int,input().split(" "))
LOOP_A = int(F / (100*A)) + 1
LOOP_B = int(F / (100*B)) + 1
LOOP_C = int(F / C) + 1
LOOP_D = int(F / D) + 1
ans = []
temp = []
for i in range(LOOP_A):
    Ac = i
    for j in range(LOOP_B):
        Bc = j
        if Ac + Bc >= 1:
            for k in range(LOOP_C):
                W = Ac * A * 100 + Bc * B * 100
                Cc = k
                if W + (Cc * C) <= F:
                    for l in range(LOOP_D):
                        Dc = l
                        S = Cc * C + Dc * D
                        total = W + S 
                        SW = S / W
                        if F >= total and SW <= E/100:
                            ans.append(str(total) + " " + str(S))
                            temp.append(S / total)
print(ans[temp.index(max(temp))])

Fixed submission:
A,B,C,D,E,F = map(int,input().split(" "))
LOOP_A = int(F / (100*A)) + 1
LOOP_B = int(F / (100*B)) + 1
LOOP_C = int((F-100) / C) + 1
LOOP_D = int((F-100) / D) + 1
ans = []
temp = []
for i in range(LOOP_A):
    Ac = i
    for j in range(LOOP_B):
        Bc = j
        W = Ac * A * 100 + Bc * B * 100
        if W >= 100 and W <= F:
            for k in range(LOOP_C):
                Cc = k
                if W + (Cc * C) <= F:
                    for l in range(LOOP_D):
                        Dc = l
                        S = Cc * C + Dc * D
                        total = W + S 
                        SW = S / W
                        #print(Dc)
                        if F >= total and SW <= E/100:
                            ans.append(str(total) + " " + str(S))
                            temp.append(S / total)
print(ans[temp.index(max(temp))])
Buggy python submission (verdict: Runtime Error):
import collections
list = [0] * 100000
N = int(input())
for i in range(N):
    t = input().split(" ")
    L = int(t[0])
    R = int(t[1])
    for j in range(L-1,R):
        list[j] = 1
CC = collections.Counter(list)
print(CC.most_common()[1][1])

Fixed submission:
N = int(input())
ans = 0
for i in range(N):
    t = input().split(" ")
    L = int(t[0])
    R = int(t[1])
    ans += R - L + 1
print(ans)

Buggy python submission (verdict: Runtime Error):
import collections
list = [0] * 100000
N = int(input())
for i in range(N):
    t = input().split(" ")
    L = int(t[0])
    R = int(t[1])
    for j in range(L-1,R):
        list[j] = 1
CC = collections.Counter(list)
print(CC.most_common()[1][1])

Fixed submission:
N = int(input())
ans = 0
for i in range(N):
    t = input().split(" ")
    L = int(t[0])
    R = int(t[1])
    ans += R - L + 1
print(ans)
Buggy python submission (verdict: Runtime Error):
O = str(input().rstrip())
E = str(input().rstrip())
ans = ""
for i in range(len(O)):
    ans += O[i]
    ans += E[i]
print(ans)

Fixed submission:
O = str(input().rstrip())
E = str(input().rstrip())
ans = ""
for i in range(len(O)):
    ans += O[i]
    if len(E) - (i+1) >= 0:
	    ans += E[i]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = 1
for i in range(N):
    P = P * (i+1)
print(P % (10**9 + 7))

Fixed submission:
import math
N = int(input())
P = math.factorial(N)
print(P % (10**9 + 7))
Buggy python submission (verdict: Runtime Error):
import fractions
import functools

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

ans = 1

for i in range(1,N):
    A_i = A[:i-1] + A[i:]
    ans = max(ans, functools.reduce(fractions.gcd, A_i))

print(ans)

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

print(B * (T // A))
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())

plus = a+b
minus = a-b
multipiled_by = a*b
ans = max([plus, minus, multipiled_by])
print(ans)

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

plus = a+b
minus = a-b
multipiled_by = a*b
ans = max([plus, minus, multipiled_by])
print(ans)

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input())

plus = a+b
minus = a-b
multipiled_by = a*b
ans = max([plus, minus, multipiled_by])
print(ans)

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

plus = a+b
minus = a-b
multipiled_by = a*b
ans = max([plus, minus, multipiled_by])
print(ans)
Buggy python submission (verdict: Runtime Error):
c,d = map(int,input().split())

if (c+d)%2 == 0:
    print(c+d)//2
else:
    print('IMPOSSIBLE')

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

if (c+d)%2 == 0:
    print((c+d)//2)
else:
    print('IMPOSSIBLE')
Buggy python submission (verdict: Runtime Error):
n, a, b = map(int, input().split)
m = n*b
if m < a :
    print(m)
else:
    print(a)

Fixed submission:
n, a, b = map(int, input().split())
m = n*a
if m < b :
    print(m)
else:
    print(b)
Buggy python submission (verdict: Runtime Error):
s = input()
lis = list(s)
count = 0
if s.count(lis[0]) == 2:
   count+=1
else:
    if s.count(lis[1]) == 2:
        count+=1
    else:
        if s.count(lis[2]) == 2:
            count+=1
        else if count == 3:
            print("YES")
        else:
            print("NO")



Fixed submission:
s = input()
lst = list(s)
for c in s:
    k = s.count(c)
    if k != 2:
        print('No')
        exit()
print('Yes')

Buggy python submission (verdict: Runtime Error):
s = input()
lis = list(s)
count_str = 0
if s.count(lis[0]) == 2:
   count+=1
else:
    if s.count(lis[1]) == 2:
        count+=1
    else:
        if s.count(lis[2]) == 2:
            count+=1
        else if count == 3:
            print("YES")
        else:
            print("NO")

Fixed submission:
s = input()
lst = list(s)
for c in s:
    k = s.count(c)
    if k != 2:
        print('No')
        exit()
print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
h = []
ans = 1000000001
for i in range(n):
    h.append(int(input()))
h.sort()
for j in range(n-(k-1)):
    x = []
    if ans == 0:
        break
    for l in range(j,j+k):
        x.append(h[l])
        if ans == 0:
            break
        elif len(x) == k:
            y = x[-1]-x[0]
            if ans == 0:
                break
            elif ans > y:
                ans = y
print(ans)

Fixed submission:
n, k = map(int, input().split())
h = []
ans = 1000000001
for i in range(n):
    h.append(int(input()))
h.sort()
for j in range(n-(k-1)):
    if ans == 0:
        break
    elif ans > h[j+k-1]-h[j]:
        ans = h[j+k-1]-h[j]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
h = []
ans = 1000000001
for i in range(n):
    h.append(int(input()))
h.sort()
for j in range(n-(k-1)):
    x = []
    for l in range(j,j+k):
        x.append(h[l])
        if ans == 0:
            break
        elif len(x) == k:
            y = x[-1]-x[0]
            if ans == 0:
                break
            elif ans > y:
                ans = y
print(ans)

Fixed submission:
n, k = map(int, input().split())
h = []
ans = 1000000001
for i in range(n):
    h.append(int(input()))
h.sort()
for j in range(n-(k-1)):
    if ans == 0:
        break
    elif ans > h[j+k-1]-h[j]:
        ans = h[j+k-1]-h[j]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
h = []
ans = 1000000001
for i in range(n):
    h.append(int(input()))
h.sort()
for j in range(n-(k-1)):
    x = []
    for l in range(j,j+k):
        x.append(h[l])
        if len(x) == k:
            y = x[-1]-x[0]
            if ans > y:
                ans = y
print(ans)

Fixed submission:
n, k = map(int, input().split())
h = []
ans = 1000000001
for i in range(n):
    h.append(int(input()))
h.sort()
for j in range(n-(k-1)):
    if ans == 0:
        break
    elif ans > h[j+k-1]-h[j]:
        ans = h[j+k-1]-h[j]
print(ans)
Buggy python submission (verdict: Runtime Error):
s = [*input()]
ans = 1000
for i in range(len(s) - 2):
  x = int(s[i] + s[i+1] + s[i+2])
  if ans > abs(753 - x):
    ans = abs(753 - x)
print(ans)

Fixed submission:
s = [s for s in input()]
ans = 1000
for i in range(len(s)-2):
    x = int(s[i]+s[i+1]+s[i+2])
    if ans > abs(753-x):
        ans = abs(753-x)
print(ans)

Buggy python submission (verdict: Runtime Error):
s = [*input()]
ans = 1000
for i in range(len(s)-2):
	x = int(s[i]+s[i+1]+s[i+2])
    if ans > abs(753-x):
      ans = abs(753-x)
print(ans)


Fixed submission:
s = [s for s in input()]
ans = 1000
for i in range(len(s)-2):
    x = int(s[i]+s[i+1]+s[i+2])
    if ans > abs(753-x):
        ans = abs(753-x)
print(ans)

Buggy python submission (verdict: Runtime Error):
s = [*input()]
ans = 1000
for i in range(len(s)-2):
    x = int(s[i]+s[i+1]+s[i+2])
    if ans > abs(753-x):
        ans = abs(753-x)
print(ans)

Fixed submission:
s = [s for s in input()]
ans = 1000
for i in range(len(s)-2):
    x = int(s[i]+s[i+1]+s[i+2])
    if ans > abs(753-x):
        ans = abs(753-x)
print(ans)

Buggy python submission (verdict: Runtime Error):
s = [*input()]
ans = 1000
for i in range(len(s)-2):
    x = int(s[i]+s[i+1]+s[i+2])
    if ans > abs(753-x):
        ans = abs(753-x)
print(ans)

Fixed submission:
s = [s for s in input()]
ans = 1000
for i in range(len(s)-2):
    x = int(s[i]+s[i+1]+s[i+2])
    if ans > abs(753-x):
        ans = abs(753-x)
print(ans)
Buggy python submission (verdict: Runtime Error):
81 58

Fixed submission:
X, Y = map(int, input().split())
print(int(X + Y/2))