Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):

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

print(C if A == B else B if A == C else A if B == C)

Fixed submission:

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

if A == B :
    print(C)
elif B == C :
    print(A)
elif C == A :
    print(B)
Buggy python submission (verdict: Runtime Error):
N = int(input())

if 9 in N :
    print("Yes")
else :
    print("No")

Fixed submission:
N = input()

if "9" in N :
    print("Yes")
else :
    print("No")
Buggy python submission (verdict: Runtime Error):

s = input()

print(s[0] + len(s[1,len(s)]) + s[-1])


Fixed submission:

s = input()

print(s[0] + str(len(s)-2) + s[-1])
Buggy python submission (verdict: Runtime Error):

N = int(input())

list = []
for i in range(N) :
    a = input()
    list.append(a)

list.sort()

print(int(list[N-1])-int(list[0]))


Fixed submission:
input()
a = sorted(map(int, input().split()))
print(a[-1]-a[0])

Buggy python submission (verdict: Runtime Error):

N = int(input()) 

list = []
for i in range(N) :
    a = input()
    list.append(a)

list.sort()

print(int(list[N-1])-int(list[0]))


Fixed submission:
input()
a = sorted(map(int, input().split()))
print(a[-1]-a[0])

Buggy python submission (verdict: Runtime Error):

N = int(input()) 

list = []
for i in range(N) :
    a = input()
    list.append(a)

print(int(list[N-1])-int(list[0]))


Fixed submission:
input()
a = sorted(map(int, input().split()))
print(a[-1]-a[0])

Buggy python submission (verdict: Runtime Error):

N = int(input()) 

list = []
for i in range(N) :
    a = input()
    list.append(a)

print(int(list[N])-int(list[0]))


Fixed submission:
input()
a = sorted(map(int, input().split()))
print(a[-1]-a[0])

Buggy python submission (verdict: Runtime Error):

N = int(input()) #家の数

list = []
for i in N :
    a = input()
    list.append(a)

print(int(list[N])-int(list[0]))


Fixed submission:
input()
a = sorted(map(int, input().split()))
print(a[-1]-a[0])
Buggy python submission (verdict: Runtime Error):

S = input()

print("yes" if set(len(S))==len(S) else "no")


Fixed submission:

S = input()

print("yes" if len(set(S))==len(S) else "no")
Buggy python submission (verdict: Runtime Error):

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

print("Yes" if C >= A and C =< B else "No")


Fixed submission:

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

print("Yes" if C >= A and C <= B else "No")
Buggy python submission (verdict: Runtime Error):

import math
N = int(input())
print((math.factorial(N))/(10**9 + 7))

Fixed submission:
import math
N = int(input())
print(math.factorial(N) % (10**9+7))

Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
print((math.factorial(N)/(10**9 + 7)))


Fixed submission:
import math
N = int(input())
print(math.factorial(N) % (10**9+7))

Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
print((math.factorial(N)/(10**9 + 7))


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

K, S = map(int, input().split())

count = 0
for i in range(K+1) :
    for j in range(K+1) :
        if S < x + y :
            break
        if S - i - j <= K :
            count += 1
print(count)


Fixed submission:

K, S = map(int, input().split())

count = 0
for i in range(K+1) :
    for j in range(K+1) :
        if S < i + j :
            break
        if S - i - j <= K :
            count += 1

print(count)

Buggy python submission (verdict: Time Limit Exceeded):

K, S = map(int, input().split())

count = 0
for i in range(K+1) :
    for j in range(K+1) :
        for k in range(K+1) :
            if S == i + j + k :
                count += 1
print(count)


Fixed submission:

K, S = map(int, input().split())

count = 0
for i in range(K+1) :
    for j in range(K+1) :
        if S < i + j :
            break
        if S - i - j <= K :
            count += 1

print(count)
Buggy python submission (verdict: Runtime Error):

c = input()
if "a", "i", "u", "e", "o" in c :
    print("vowel")
else :
    print("consonant")


Fixed submission:

c = input()
if c in "aiueo" :
    print("vowel")
else :
    print("consonant")
Buggy python submission (verdict: Runtime Error):

a, b, c = sorted(map(int, input().split()))
list = sorted(abc)

print("Yes" if a+b==c else "No")


Fixed submission:

a, b, c = sorted(map(int, input().split()))

print("Yes" if a+b==c else "No")
Buggy python submission (verdict: Runtime Error):

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

n=int(input())
F = [1]
for i, j in factorization(n):
    for _ in range(j):
        F.append(i)
import itertools
ans = 9999999999999
for flags in itertools.product([0,1], repeat=len(F)):
    a = 1
    b = 1
    for i in range(len(F)):
        if flags[i]:
            a *= F[i]
        else:
            b *= F[i]
    tmp = (a-1) + (b-1)
    if tmp < ans:
        ans = tmp
print(ans)

Fixed submission:
a,b=map(int,input().split())
if(a > 9 or b > 9):
    print(-1)
else:
    print(a*b)
Buggy python submission (verdict: Time Limit Exceeded):

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

n=int(input())
F = [1]
for i, j in factorization(n):
    for _ in range(j):
        F.append(i)
import itertools
ans = 9999999999999
for flags in itertools.product([0,1], repeat=len(F)):
    a = 1
    b = 1
    for i in range(len(F)):
        if flags[i]:
            a *= F[i]
        else:
            b *= F[i]
    tmp = (a-1) + (b-1)
    if tmp < ans:
        ans = tmp
print(ans)

Fixed submission:
n=int(input())
ran = int(n**0.5) + 1
ans = 999999999999
for i in range(1, ran):
    j = n // i
    if j != int(n / i):
        continue
    if i * j != n:
        continue
    tmp = i + j - 2
    if tmp < ans:
        ans = tmp
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):

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

n=int(input())
F = [1]
for i, j in factorization(n):
    for _ in range(j):
        F.append(i)
import itertools
ans = 9999999999999
for flags in itertools.product([0,1], repeat=len(F)):
    a = 1
    b = 1
    for i in range(len(F)):
        if flags[i]:
            a *= F[i]
        else:
            b *= F[i]
    tmp = (a-1) + (b-1)
    if tmp < ans:
        ans = tmp
print(ans)

Fixed submission:
n=int(input())
ran = int(n**0.5) + 1
ans = 999999999999
for i in range(1, ran):
    j = n // i
    if j != int(n / i):
        continue
    if i * j != n:
        continue
    tmp = i + j - 2
    if tmp < ans:
        ans = tmp
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):

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

n=int(input())
F = [1]
for i, j in factorization(n):
    for _ in range(j):
        F.append(i)
import itertools
ans = 9999999999999
for flags in itertools.product([0,1], repeat=len(F)):
    a = 1
    b = 1
    for i in range(len(F)):
        if flags[i]:
            a *= F[i]
        else:
            b *= F[i]
    tmp = (a-1) + (b-1)
    if tmp < ans:
        ans = tmp
print(ans)

Fixed submission:
n=int(input())
ran = int(n**0.5) + 1
ans = 999999999999
for i in range(1, ran):
    j = n // i
    if j != int(n / i):
        continue
    if i * j != n:
        continue
    tmp = i + j - 2
    if tmp < ans:
        ans = tmp
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
L = list(map(int,input().split()))
L.sort(reverse=True)
ans = 0
for i in range(n-2):
    tmp = 0
    for j in range(i+1, n-1):
        for k in range(j+1, n):
            a, b, c = L[i], L[j], L[k]
            if a < b + c and b < a + c and c < a + b:
                ans += 1
print(ans)

Fixed submission:
n = int(input())
L = list(map(int,input().split()))
L.sort()
L2 = []
ans = 0
import bisect
for i in range(n-2):
    for j in range(i+1, n-1):
        index = bisect.bisect_left(L,  L[i] + L[j])
        ans += index - j - 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
L = list(map(int,input().split()))
ans = 0
import itertools
for l in list(itertools.combinations(L,3)):
    a, b, c = l
    if a < b + c and b < c + a and c < a + b:
        ans += 1
print(ans)

Fixed submission:
n = int(input())
L = list(map(int,input().split()))
L.sort()
L2 = []
ans = 0
import bisect
for i in range(n-2):
    for j in range(i+1, n-1):
        index = bisect.bisect_left(L,  L[i] + L[j])
        ans += index - j - 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0
for i in range(1, n):
    ans += i
print(ans)

Fixed submission:
n = int(input())
ans = (n - 1) * n // 2
print(int(ans))
Buggy python submission (verdict: Runtime Error):
あｓｄｆ

Fixed submission:
A,B=map(int, input().split())
print(max(A+B,A-B,A*B))

Buggy python submission (verdict: Runtime Error):
っっｊ

Fixed submission:
A,B=map(int, input().split())
print(max(A+B,A-B,A*B))

Buggy python submission (verdict: Runtime Error):
hh

Fixed submission:
A,B=map(int, input().split())
print(max(A+B,A-B,A*B))

Buggy python submission (verdict: Runtime Error):
jh

Fixed submission:
A,B=map(int, input().split())
print(max(A+B,A-B,A*B))

Buggy python submission (verdict: Runtime Error):
sfdsad

Fixed submission:
A,B=map(int, input().split())
print(max(A+B,A-B,A*B))
Buggy python submission (verdict: Runtime Error):
K, X = map(int, input().split())
ans =[]
for i in range(X - (K-1), X):
    ans.append(i)
for i in range(X, X + (K)):
    ans.append(i)
print(" ".join(map(str, ans)))


Fixed submission:
K, X = map(int, input().split())
ans =[]
for i in range(X - (K-1), X):
    ans.append(i)
for i in range(X, X + (K)):
    ans.append(i)
print(" ".join(map(str, ans)))

Buggy python submission (verdict: Runtime Error):
K, X = map(int, input().split())
ans =[]
for i in range(X - (K-1), X):
    ans.append(i)
for i in range(X, X + (K)):
    ans.append(i)
print(" ".join(map(str, ans)))


Fixed submission:
K, X = map(int, input().split())
ans =[]
for i in range(X - (K-1), X):
    ans.append(i)
for i in range(X, X + (K)):
    ans.append(i)
print(" ".join(map(str, ans)))
Buggy python submission (verdict: Time Limit Exceeded):
S=input()
ans = [0] * len(S)
for i in range(len(S)):
    if S[i] == "L":
        cnt = 0
        for j in reversed(range(i)):
            cnt += 1
            if S[j] == "R":
                break
        if cnt % 2 == 1:
            ans[j+1] += 1
        else:
            ans[j] += 1
    if S[i] == "R":
        cnt = 0
        for j in range(i+1, len(S)):
            cnt += 1
            if S[j] == "L":
                break
        if cnt %2 == 1:
            ans[j-1] += 1
        else:
            ans[j] += 1
ans = map(str, ans)
print(" ".join(ans))

Fixed submission:
S=input()
ans = [0] * len(S)
last_R=[0] * len(S)
tmp = 0
for i in range(len(S)):
    if S[i] == "R":
        tmp = i
    last_R[i] = tmp
first_L=[0] * len(S)
tmp = 0
for i in reversed(range(len(S))):
    if S[i] == "L":
        tmp = i
    first_L[i] = tmp
for i in range(len(S)):
    if S[i] == "L":
        R_index = last_R[i]
        if (i - R_index) % 2 == 1:
            ans[R_index+1] += 1
        else:
            ans[R_index] += 1
    if S[i] == "R":
        L_index = first_L[i]
        if (L_index - i) %2 == 1:
            ans[L_index-1] += 1
        else:
            ans[L_index] += 1
ans = map(str, ans)
print(" ".join(ans))
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
ans = []
for i in reversed(range(1, N+1)):
    a = A[i-1]
    for j in range(2, N+1):
        tmp = i * j
        if tmp > N:
            break
        a %= A[tmp-1]
    if a % 2 == 1:
        ans.append(i)
    A[i-1] = a % 2
print(len(ans))
for a in ans:
    print(a)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
B=[0] * N
ans = []
for i in reversed(range(1, N+1)):
    a = A[i-1]
    for j in range(1, N+1):
        tmp = i * j
        if tmp > N:
            break
        a += B[tmp-1]
    if a % 2 == 1:
        ans.append(i)
    B[i-1] = a % 2
print(len(ans))
for a in ans:
    print(a)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
D=list(map(int,input().split()))
D.sort()
for i in range(1, n):
    l = D[:i]
    r = D[i:]
    if len(l) == len(r):
        ans = r[0] - l[-1]
print(ans)

Fixed submission:
n=int(input())
D=list(map(int,input().split()))
D.sort()
i = int(n / 2) - 1
ans = D[i+1] - D[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
n,x =map(int,input().split())
L=list(map(int,input().split()))
tmp = 0
cnt = 0
for i in range(n+1):
    if tmp > x:
        break
    tmp += L[i]
    cnt += 1
print(cnt)

Fixed submission:
n,x =map(int,input().split())
L=list(map(int,input().split()))
A = [0] * (n+1)
for i in range(1,n+1):
    A[i] = A[i-1] + L[i-1]
cnt=0
for i in range(n+1):
    if A[i] <= x:
        cnt+= 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
MOD = 1000000007 
D=[1] * (n + 1)
for _ in range(m):
    D[int(input())] = 0
for i in range(2, n+1):
    if D[i] == 0:
        continue
    D[i] = (D[i-1] + D[i-2]) % MOD
print(D[i])

Fixed submission:
n,m=map(int,input().split())
MOD = 1000000007 
D=[0] * (n+2)
D[0] = 1
for _ in range(m):
    D[int(input())] = -1
for i in range(n):
    if D[i] == -1:
        continue
    if D[i+1] != -1:
        D[i+1] += D[i]
    if D[i+2] != -1:
        D[i+2] += D[i]
    D[i]%=MOD
print(D[n] % MOD)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
MOD = 1000000007 
D=[0] * n
D[0], D[1] = 1, 1
for _ in range(m):
    D[int(input())] = -1
for i in range(2, n):
    if D[i] == -1:
        continue
    if D[i-1] != -1:
        D[i] += D[i-1]
    if D[i-2] != -1:
        D[i] += D[i-2]
    D[i]%=MOD
ans = 0
if D[n-1] != -1:
    ans += D[n-1]
if D[n-2] != -1:
    ans += D[n-2]
print(ans % MOD)

Fixed submission:
n,m=map(int,input().split())
MOD = 1000000007 
D=[0] * (n+2)
D[0] = 1
for _ in range(m):
    D[int(input())] = -1
for i in range(n):
    if D[i] == -1:
        continue
    if D[i+1] != -1:
        D[i+1] += D[i]
    if D[i+2] != -1:
        D[i+2] += D[i]
    D[i]%=MOD
print(D[n] % MOD)
Buggy python submission (verdict: Runtime Error):
import bisect

n, m = list(map(int, input().split()))
cl = list(map(int, input().split()))
cl.sort()
ql=[]
for _ in range(m):
    b, c = list(map(int, input().split()))
    for _ in range(b):
        ql.append(c)
ql.sort()
ql.reverse()
ans=0
i = 0
for c in cl:
    if i >len(cl):
        break
    if c < ql[i]:
        ans+=ql[i]
        i+=1
    else:
        ans+=c
print(ans)

Fixed submission:
n, m = list(map(int, input().split()))
cl = list(map(int, input().split()))
cl.sort()
ql=[]
for _ in range(m):
    b, c = list(map(int, input().split()))
    ql.append([b,c])
ql.sort(key=lambda x: x[1],reverse=True)
i, j = 0,0
while i < len(cl) and j < len(ql):
    if cl[i] < ql[j][1]:
        cl[i] = ql[j][1]
        ql[j][0] -=1
        if ql[j][0] == 0:
            j+=1
    i+=1
print(sum(cl))

Buggy python submission (verdict: Runtime Error):
import bisect

n, m = list(map(int, input().split()))
cl = list(map(int, input().split()))
cl.sort()
ql=[]
for _ in range(m):
    b, c = list(map(int, input().split()))
    for _ in range(b):
        ql.append(c)
ql.sort()
ql.reverse()
ans=0
i = 0
for c in cl:
    if c < ql[i]:
        ans+=ql[i]
        i+=1
    else:
        ans+=c
print(ans)

Fixed submission:
n, m = list(map(int, input().split()))
cl = list(map(int, input().split()))
cl.sort()
ql=[]
for _ in range(m):
    b, c = list(map(int, input().split()))
    ql.append([b,c])
ql.sort(key=lambda x: x[1],reverse=True)
i, j = 0,0
while i < len(cl) and j < len(ql):
    if cl[i] < ql[j][1]:
        cl[i] = ql[j][1]
        ql[j][0] -=1
        if ql[j][0] == 0:
            j+=1
    i+=1
print(sum(cl))

Buggy python submission (verdict: Runtime Error):
import bisect

n, m = list(map(int, input().split()))
cl = list(map(int, input().split()))
cl.sort()
ql=[]
for _ in range(m):
    b, c = list(map(int, input().split()))
    for _ in range(b):
        ql.append(c)
ql.sort()
ql.reverse()
ans=0
for c in cl:
    if c < ql[0]:
        ans+=ql[0]
        del ql[0]
    else:
        ans+=c
print(ans)

Fixed submission:
n, m = list(map(int, input().split()))
cl = list(map(int, input().split()))
cl.sort()
ql=[]
for _ in range(m):
    b, c = list(map(int, input().split()))
    ql.append([b,c])
ql.sort(key=lambda x: x[1],reverse=True)
i, j = 0,0
while i < len(cl) and j < len(ql):
    if cl[i] < ql[j][1]:
        cl[i] = ql[j][1]
        ql[j][0] -=1
        if ql[j][0] == 0:
            j+=1
    i+=1
print(sum(cl))
Buggy python submission (verdict: Runtime Error):
n=int(input())
L=[[] for i in range(n)]
for i in range(n-1):
    u,v,w=map(int, input().split())
    u-=1
    v-=1
    L[u].append([v,w])
    L[v].append([u,w])
ans=[-1]*n
ans[0]=0
from collections import deque
stack=deque([])
stack.append(0)
while stack:
    v=stack.popleft()
    for u, w in L[v]:
        if ans[u]!=-1:
            continue
        ans[u]=(ans[v]+w)%2
        stack.appendleft(u)
for a in ans:
    print(a)


Fixed submission:
n, k = list(map(int, input().split()))
a = input()
tmp = ""
for i in range(n):
    t = a[i]
    if i == k-1:
        t = t.lower()
    tmp += t
print(tmp)

Buggy python submission (verdict: Runtime Error):
n=int(input())
L=[[] for i in range(n)]
for i in range(n-1):
    u,v,w=map(int, input().split())
    u-=1
    v-=1
    L[u].append([v,w])
    L[v].append([u,w])
ans=[-1]*n
ans[0]=0
from collections import deque
que=deque([])
que.append(0)
while que:
    v=que.popleft()
    for u, w in L[v]:
        if ans[u]!=-1:
            continue
        ans[u]=(ans[v]+w)%2
        que.append(u)
for a in ans:
    print(a)

Fixed submission:
n, k = list(map(int, input().split()))
a = input()
tmp = ""
for i in range(n):
    t = a[i]
    if i == k-1:
        t = t.lower()
    tmp += t
print(tmp)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
L=[[] for i in range(n)]
for i in range(n-1):
    u,v,w=map(int, input().split())
    u-=1
    v-=1
    L[u].append([v,w])
    L[v].append([u,w])
ans=[-1]*n
ans[0]=0
stack=[0]
while stack:
    v=stack[0]
    stack=stack[1:]
    for u, w in L[v]:
        if ans[u]!=-1:
            continue
        ans[u]=(ans[v]+w)%2
        stack.insert(0,u)
for a in ans:
    print(a)

Fixed submission:
n=int(input())
L=[[] for i in range(n)]
for i in range(n-1):
    u,v,w=map(int, input().split())
    u-=1
    v-=1
    L[u].append([v,w])
    L[v].append([u,w])
ans=[-1]*n
ans[0]=0
que=[0]
while que:
    v=que.pop()
    for u, w in L[v]:
        if ans[u]!=-1:
            continue
        ans[u]=(ans[v]+w)%2
        que.append(u)
for a in ans:
    print(a)
Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
a_list = list(map(int, input().split()))
a_list.sort()
result = 0
for i in range(n):
    r = a_list[0]
    for j in range(n):
        if i == j: continue
        r = math.gcd(a_list[j], r)
    if r > result: result  = r
print(result)

Fixed submission:
def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a
n = int(input())
a = list(map(int, input().split()))
left, right = [0] * (n+1), [0] * (n+1)
for i in range(n):
    left[i+1] = gcd(left[i], a[i])
for i in reversed(range(n)):
    right[i] = gcd(right[i+1], a[i])
ans = 0
for i in range(n):
    l = left[i]
    r = right[i+1]
    ans = max(ans, gcd(l, r))
print(ans)
Buggy python submission (verdict: Runtime Error):
L = []
L2 = []
for _ in range(5):
    a = input()
    if a[-1] == "0":
        L.append(int(a))
    else:
        last = int(a[-1])
        L.append(int(a) + 10 - last)
        L2.append(last)
print(sum(L) + min(L2) - 10)

Fixed submission:
L = []
L2 = []
for _ in range(5):
    a = input()
    if a[-1] == "0":
        L.append(int(a))
    else:
        last = int(a[-1])
        L.append(int(a) + 10 - last)
        L2.append(last)
if not L2:
    print(sum(L))
else:
    print(sum(L) + min(L2) - 10)
Buggy python submission (verdict: Runtime Error):

s = input()
k = int(input())
for i in range(len(s)):
    if s[i] != "1":
        break
if k < i:
    pirnt(1)
else:
    print(s[i])


Fixed submission:

s = input()
k = int(input())
for i in range(len(s)):
    if s[i] != "1":
        break
if k - 1 < i:
    print(1)
else:
    print(s[i])
Buggy python submission (verdict: Time Limit Exceeded):
k = input()
k = int(k)

ll = []
for i in range(1, k + 1):
    l = []
    for j in range(1, i + 1):
        if i % j == 0:
            l.append(j)
            l.append(i // j)
        if (i // j) < j:
            break
    ll.append(set(l))


sum_k = 0

for i in range(k):
    for j in range(k):
        for l in range(k):
            sum_k += max(ll[i] & ll[j] & ll[l])

print(sum_k)


Fixed submission:
k = input()
k = int(k)

ll = []
for i in range(1, k + 1):
    l = []
    for j in range(1, i + 1):
        if i % j == 0:
            l.append(j)
            l.append(i // j)
        if (i // j) < j:
            break
    ll.append(set(l))


sum_k = 0

for i in range(k):
    i_s = ll[i]
    for j in range(k):
        j_s = ll[j]
        m = max(ll[i] & ll[j])
        if m == 1:
            sum_k += k
            continue
        for l in range(k):
            sum_k += max(ll[i] & ll[j] & ll[l])

print(sum_k)
Buggy python submission (verdict: Runtime Error):

m, n = input().split()
a = input().split()
sum_a = sum(a) / (4 * m)

yes_num = 0
no_num = 0

ok = m
ng = n - m

for i in a:
    if i < sum_a:
        no_num += 1
    else:
        yes_num += 1
    if no_num > ng:
        break
    if yes_num >= ok:

        exit(0)

print("No")


Fixed submission:

n, m = input().split()
m = int(m)
n = int(n)
a = input().split()
sum_a = sum(int(i) for i in a) / (4 * m)

yes_num = 0
no_num = 0

ok = m
ng = n - m

for i in a:
    if int(i) < sum_a:
        no_num += 1
    else:
        yes_num += 1
    if no_num > ng:
        break
    if yes_num >= ok:
        print("Yes")
        exit(0)

print("No")