Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
def gcd(a,b):
    while b != 0:
        a, b = b, a%b
#        print(a,b)
    return(a)

def main():    
    N,X = map(int,input().split())
    x = list(map(int,input().split()))
    for i in range(N):
        x[i] = abs(x[i]-X)
    while len(x) > 1:
#        print(x[0],x[1])
        y = gcd(x[0],x[1])
        x.pop(0)
        x.pop(0)
        x.insert(0,y)
#        print(x)
    print(x[0])

if __name__ == "__main__":
    main()

Fixed submission:
def gcd(a,b):
    while b != 0:
        a, b = b, a%b
    return(a)

def main():    
    N,X = map(int,input().split())
    x = list(map(int,input().split()))
    for i in range(N):
        x[i] = abs(x[i]-X)
    y = x[0]
    for i in range(N):
        if x[i]%y == 0:
            continue
        y = gcd(y,x[i])
    print(y)

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def kou(a,b):
    while (a != 0):
        if a < b:
            k = a
            a = b
            b = k
        a = a % b
    return(b)

def main():    
    N,X = map(int,input().split())
    x = list(map(int,input().split()))
    for i in range(N):
        x[i] = abs(x[i]-X)
    while len(x) > 1:
#        print(x[0],x[1])
        y = kou(x[0],x[1])
        x.pop(0)
        x.pop(0)
        x.insert(0,y)
#        print(x)
    print(x[0])

if __name__ == "__main__":
    main()

Fixed submission:
def gcd(a,b):
    while b != 0:
        a, b = b, a%b
    return(a)

def main():    
    N,X = map(int,input().split())
    x = list(map(int,input().split()))
    for i in range(N):
        x[i] = abs(x[i]-X)
    y = x[0]
    for i in range(N):
        if x[i]%y == 0:
            continue
        y = gcd(y,x[i])
    print(y)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
NK = input()
Ain = input()
N = int(NK[0:1])
K = int(NK[2:3])
n = N-1
k = K-1
a = int(n/k)
if n%k > 0:
    a += 1
print(a)

Fixed submission:
NK = input()
Ain = input()
s = NK.index(" ")

N = int(NK[0:s])
K = int(NK[s+1:len(NK)+1])
n = N-1
k = K-1
a = int(n/k)
if n%k != 0:
    a += 1
print(a)
Buggy python submission (verdict: Time Limit Exceeded):
k = input()
K = int(k)
j = 1
count = 0
while True:
    a = 0
    j = str(j)
    for i in range(len(j)):
        a += int(j[i:i+1])
    j = int(j)
    if j/a < 2:
        print(j)
        count += 1
    if count == K:
        break
    j += 1

Fixed submission:
K = int(input())

a = 1
b = 0

def snk(n):
    s = 0
    for i in str(n):
        s += int(i)
    return(n/s)
    
count = 0
while True:
    print(a)
    count += 1
    if snk(a + 10 ** b) > snk(a + 10 ** (b + 1)):
        b += 1
    a += 10 ** b
    if count == K:
        break
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
K = int(input())
a = set([])
for i in range(1,len(s)+1):
    for j in range(len(s)-i+1):
        a.add(s[j:j+i])
a = sorted(a)
print(a[K-1])

Fixed submission:
def su(a,s,K):
    for i in range(1,K+1):
        for j in range(len(s)-i+1):
            a.add(s[j:j+i])
    a = sorted(a)
    return(a)
    
s = input()
K = int(input())
a = set([])
a = su(a,s,K)
print(a[K-1])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x = list(map(int,input().split()))
a = sorted(x)
#print(a)
ans1 = a[int(n/2-1)]
ans2 = a[int(n/2)]
#print(ans1,ans2)
if ans1 == ans2:
    for i in range(n):
        print(ans1)
else:
    for i in range(n):
        if a.index(x[i]) < n/2:
            print(ans2)
        else:
            print(ans1)

Fixed submission:
n = int(input())
x = list(map(int,input().split()))
a = sorted(x)
#print(a)
ans1 = a[int(n/2-1)]
ans2 = a[int(n/2)]
#print(ans1,ans2)
if ans1 == ans2:
    for i in range(n):
        print(ans1)
else:
    for i in range(n):
        if x[i] < ans2:
            print(ans2)
        else:
            print(ans1)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x = list(map(int,input().split()))
ans = int(n/2-1)
for i in range(1,n+1):
    a = []
    a = x[:i-1] + x[i:]
    a.sort()
    print(a[ans])

Fixed submission:
n = int(input())
x = list(map(int,input().split()))
a = sorted(x)
#print(a)
ans1 = a[int(n/2-1)]
ans2 = a[int(n/2)]
#print(ans1,ans2)
if ans1 == ans2:
    for i in range(n):
        print(ans1)
else:
    for i in range(n):
        if x[i] < ans2:
            print(ans2)
        else:
            print(ans1)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))

dic = {}
for i in a:
    dic.update({i:a.count(i)})
#print(dic)
k = list(dic.keys())

ans = 0
for i in k:
    if i > dic[i]:
        ans += dic[i]
    elif i < dic[i]:
        ans += dic[i] - i
print(ans)

Fixed submission:
from collections import Counter
n = int(input())
a = list(map(int,input().split()))
c = Counter(a)
#print(c)
ans = 0
for n,c in c.items():
    if c < n:
        ans += c
    elif n < c:
        ans += c - n
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    A = list(map(int, input().split()))
    sum_val = 0
    for i in range(len(A)):
        for j in range(i + 1, len(A)):
            sum_val += (A[i] * A[j]) % (10**9 + 7)
    return sum_val % (10**9 + 7)

if __name__ == '__main__':
    print(main())

Fixed submission:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    all_val = sum(A)
    A = A[::-1]

    sum_val = 0
    for i in range(len(A)):
        all_val -= A[i]
        sum_val += all_val * A[i] % (10**9 + 7)
    return sum_val % (10**9 + 7)

if __name__ == '__main__':
    print(main())
Buggy python submission (verdict: Runtime Error):
  N = int(input())
  print("Yes" if N % 9 == 0 else "No")

Fixed submission:
def main():
    N = map(int, input())
    if sum(N) % 9 == 0:
        return "Yes"
    else:
        return "No"

if __name__ == '__main__':
    print(main())

Buggy python submission (verdict: Runtime Error):
  N = int(input())
  return "Yes" if N % 9 == 0 else "No"

Fixed submission:
def main():
    N = map(int, input())
    if sum(N) % 9 == 0:
        return "Yes"
    else:
        return "No"

if __name__ == '__main__':
    print(main())
Buggy python submission (verdict: Runtime Error):
import copy

def cost_val(visit_list, P, C):
    maxval = [-10**10] * (len(P) + 1)
    for start_idx in visit_list:
        cost = 0
        now_id = start_idx
        for i in range(len(visit_list)):
            now_id = P[now_id]
            cost += C[now_id]
            maxval[i + 1] = max(maxval[i + 1], cost)
    return maxval[1:len(visit_list) + 1]

def cycles(P):
    cycle_list = []
    visit_list = [False] * len(P)
    for i in range(len(P)):
        if visit_list[i]:
            continue
        now_id = i
        cycle = []
        for j in range(len(P)):
            if visit_list[now_id]:
                break
            cycle.append(now_id)
            visit_list[now_id] = True
            now_id = P[now_id]
        cycle_list.append(cycle)
    return cycle_list

def main():
    N, K = map(int, input().split())
    P = list(map(lambda x: int(x) - 1, input().split()))
    C = list(map(int, input().split()))
    cycle_list = cycles(P)
    ans = -10**9
    for cycle in cycle_list:
        maxval = cost_val(cycle, P, C)
        if N >= K:
            ans = max(ans, max(maxval[:K]))
        else:
            ans = max(ans, max(maxval), maxval[-1] * (K // len(cycle)) + max(maxval[:(K % len(cycle))]))
    return ans

if __name__ == '__main__':
    print(main())

Fixed submission:
import copy

def cost_val(visit_list, P, C):
    maxval = [-10**10] * (len(P) + 1)
    for start_idx in visit_list:
        cost = 0
        now_id = start_idx
        for i in range(len(visit_list)):
            now_id = P[now_id]
            cost += C[now_id]
            maxval[i + 1] = max(maxval[i + 1], cost)
    return maxval[1:len(visit_list) + 1]

def cycles(P):
    cycle_list = []
    visit_list = [False] * len(P)
    for i in range(len(P)):
        if visit_list[i]:
            continue
        now_id = i
        cycle = []
        for j in range(len(P)):
            if visit_list[now_id]:
                break
            cycle.append(now_id)
            visit_list[now_id] = True
            now_id = P[now_id]
        cycle_list.append(cycle)
    return cycle_list

def main():
    N, K = map(int, input().split())
    P = list(map(lambda x: int(x) - 1, input().split()))
    C = list(map(int, input().split()))
    cycle_list = cycles(P)
    ans = max(C)
    for cycle in cycle_list:
        maxval = cost_val(cycle, P, C)
        if len(cycle) > K:
            ans = max(ans, max(maxval[:K]))
        else:
            if K % len(cycle) == 0:
                ans = max(ans, max(maxval), max(map(lambda x: x + maxval[-1] * (K // len(cycle) - 1), maxval)), maxval[-1] * (K // len(cycle)))
            else:
                ans = max(ans, max(maxval), max(map(lambda x: x + maxval[-1] * (K // len(cycle) - 1), maxval)), maxval[-1] * (K // len(cycle)) + max(maxval[:(K % len(cycle))]))
    return ans

if __name__ == '__main__':
    print(main())
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N, K = list(map(int, input().split()))
    A = list(map(int, input().split()))
    temp = [0]*(len(A))
    prod = 1
    for i in range(len(A)):
        if i < K:
            prod *= A[i]
        else:
            prod = prod * A[i] // A[i - K]
        temp[i] = prod

    for i in range(N - K):
        if temp[i + K - 1] < temp[i + K]:
            print("Yes")
        else:
            print("No")

if __name__ == '__main__':
    main()

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

    for i in range(N - K):
        if A[i] < A[i + K]:
            print("Yes")
        else:
            print("No")

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    N, M, K = map(int, input().split())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    
    if a[0] > K and b[0] > K:
        return 0

    a2=[0]
    for i in a:a2.append(a2[-1]+i)
    b2=[0]
    for i in b:b2.append(b2[-1]+i)
    ans = 0
    j = M
    
    for i in range(N + 1):
        if a[i] > K:
            break
        while b[j] > K - a[i]:
            j -= 1
        ans = max(ans, i + j)    
    return ans

if __name__ == '__main__':
    print(main())

Fixed submission:
def main():
    N, M, K = map(int, input().split())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    
    if a[0] > K and b[0] > K:
        return 0

    a2=[0]
    for i in a:a2.append(a2[-1]+i)
    b2=[0]
    for i in b:b2.append(b2[-1]+i)
    ans = 0
    j = M
    
    for i in range(N + 1):
        if a2[i] > K:
            break
        while b2[j] > K - a2[i]:
            j -= 1
        ans = max(ans, i + j)    
    return ans

if __name__ == '__main__':
    print(main())
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

if A in 0:
    print(0)
    exit()

prod = 1
for i in range(len(A)):
    prod *= A[i]
    if prod > 10 ** 18:
        print(-1)
        exit()

print(prod)

Fixed submission:
N = input()
A = list(map(int, input().split()))
 
if 0 in A:
    print(0)
    exit()
 
A = sorted(A)[::-1]
val = 1
 
for a in A:
    val *= a
    if val > 10 ** 18:
        print(-1)
        exit()
print(val)

Buggy python submission (verdict: Time Limit Exceeded):
N = input()
A = list(map(int, input().split()))
val = 1
for a in A:
    val *= a
if val > 10 ** 18:
    print(-1)
else:
    print(val)

Fixed submission:
N = input()
A = list(map(int, input().split()))
 
if 0 in A:
    print(0)
    exit()
 
A = sorted(A)[::-1]
val = 1
 
for a in A:
    val *= a
    if val > 10 ** 18:
        print(-1)
        exit()
print(val)

Buggy python submission (verdict: Time Limit Exceeded):
N = input()
A = map(int, input().split())
val = 1
for a in A:
    val *= a

if val > 10 ** 18:
    print(-1)
else:
    print(val)


Fixed submission:
N = input()
A = list(map(int, input().split()))
 
if 0 in A:
    print(0)
    exit()
 
A = sorted(A)[::-1]
val = 1
 
for a in A:
    val *= a
    if val > 10 ** 18:
        print(-1)
        exit()
print(val)
Buggy python submission (verdict: Time Limit Exceeded):
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

X = int(input())
di = make_divisors(X)
for i in range(len(di)):
    k = di[i]
    for b in range(-di[-1], di[-1] + 1):
        val = 5 * k * b ** 4 + 10 * k ** 2 * b ** 3 + 10 * k ** 3 * b ** 2 + 5 * k ** 4 * b + k ** 5 - X
        if val == 0:
            a = k + b
            print(a, b)
            exit()


Fixed submission:
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

X = int(input())
di = make_divisors(X)
for i in range(len(di)):
    k = di[i]
    for b in range(-200, 201):
        val = 5 * k * b ** 4 + 10 * k ** 2 * b ** 3 + 10 * k ** 3 * b ** 2 + 5 * k ** 4 * b + k ** 5 - X
        if val == 0:
            a = k + b
            print(a, b)
            exit()
Buggy python submission (verdict: Runtime Error):
import numpy as np
 
if __name__ == "__main__":
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    ret = -1
    A_sum = sum(A)
    if not (A_sum < 0):
        ret = N - A_sum
    print(int(ret))

Fixed submission:
N, M = map(int, input().split())
A = list(map(int, input().split(" ")))
val = N-sum(A)
if val < 0:
    print(-1)
else :
    print(N-sum(A))
Buggy python submission (verdict: Runtime Error):
import numpy as np
import itertools
 
if __name__ == "__main__":
    K = int(input())+1
    ret = 0
    for a, b, c in itertools.product(range(1,K), range(1,K), range(1,K)):
        ret += np.gcd.reduce(list({a,b,c}))
    print(ret)

Fixed submission:
import math
K = int(input())
sumval = 0
for a in range(1, K+1):
    for b in range(1, K+1):
        f = math.gcd(a,b)
        for c in range(1, K+1):
            g = math.gcd(f,c)
            sumval += g
print(sumval)

Buggy python submission (verdict: Time Limit Exceeded):
import math
K = int(input())
sumval = 0
for a in range(1, K+1):
    for b in range(1, K+1):
        for c in range(1, K+1):
            sumval += math.gcd(math.gcd(a,b),c)
print(sumval)

Fixed submission:
import math
K = int(input())
sumval = 0
for a in range(1, K+1):
    for b in range(1, K+1):
        f = math.gcd(a,b)
        for c in range(1, K+1):
            g = math.gcd(f,c)
            sumval += g
print(sumval)

Buggy python submission (verdict: Time Limit Exceeded):
from math import gcd
K = int(input())
sumval = 0
for a in range(1, K+1):
    for b in range(1, K+1):
        for c in range(1, K+1):
            g = gcd(gcd(a,b),c)
            sumval += g
print(sumval)

Fixed submission:
import math
K = int(input())
sumval = 0
for a in range(1, K+1):
    for b in range(1, K+1):
        f = math.gcd(a,b)
        for c in range(1, K+1):
            g = math.gcd(f,c)
            sumval += g
print(sumval)

Buggy python submission (verdict: Runtime Error):
from math import gcd
K = int(input())
sumval = 0
for a in range(1, K+1):
    for b in range(1, K+1):
        for c in range(1, K+1):
            g = math.gcd(math.gcd(a,b),c)
            sumval += g
print(sumval)

Fixed submission:
import math
K = int(input())
sumval = 0
for a in range(1, K+1):
    for b in range(1, K+1):
        f = math.gcd(a,b)
        for c in range(1, K+1):
            g = math.gcd(f,c)
            sumval += g
print(sumval)

Buggy python submission (verdict: Time Limit Exceeded):
import math
K = int(input())
sumval = 0
for a in range(1, K+1):
    for b in range(1, K+1):
        for c in range(1, K+1):
            g = math.gcd(math.gcd(a,b),c)
            sumval += g
print(sumval)

Fixed submission:
import math
K = int(input())
sumval = 0
for a in range(1, K+1):
    for b in range(1, K+1):
        f = math.gcd(a,b)
        for c in range(1, K+1):
            g = math.gcd(f,c)
            sumval += g
print(sumval)

Buggy python submission (verdict: Time Limit Exceeded):
import math
K = int(input())
sumval = 0
for a in range(1, K+1):
    for b in range(1, K+1):
        for c in range(1, K+1):
            f = math.gcd(a,b)
            g = math.gcd(f,c)
            sumval += g
print(sumval)

Fixed submission:
import math
K = int(input())
sumval = 0
for a in range(1, K+1):
    for b in range(1, K+1):
        f = math.gcd(a,b)
        for c in range(1, K+1):
            g = math.gcd(f,c)
            sumval += g
print(sumval)
Buggy python submission (verdict: Runtime Error):
import numpy as np


from collections import deque
class Graph:
    edges = {}

    def append_edge(self, sv, ev, weight = 1):
        if sv in self.edges:
            self.edges[sv].append((ev, weight))
        else:
            self.edges[sv] = [(ev, weight)]

    def bfs(self, sv):
        dist = np.full(len(self.edges.keys()), -1)
        q = deque([])   # キュー
        q.append(sv)
        dist[sv] = 0
        connect_vtxs = []
        while len(q) > 0:
            p = q.popleft()     # キュー取りだし（先頭）
            connect_vtxs.append(p)
            for (ev, w) in self.edges[p]:
                if dist[ev] != -1:
                    continue
                q.append(ev)    # キュー追加
                dist[ev] = dist[p] + 1
        return dist, connect_vtxs

N, X, Y = list(map(int, input().split()))
g = Graph()
for i in range(N - 1):
    g.append_edge(i, i + 1)
    g.append_edge(i + 1, i)
g.append_edge(X - 1, Y - 1)
g.append_edge(Y - 1, X - 1)
dist_cnt = np.zeros(N)
for sv in range(N):
    dist, connect_vtxs = g.bfs(sv)
    for j in range(dist.shape[0]):
        if dist[j] == -1: continue
        dist_cnt[dist[j]] += 1

for i in range(N-1):
    print(int(dist_cnt[i+1]/2))


Fixed submission:
s = input()
if s[2] == s[3] and s[4] == s[5]:
    print("Yes")
else :
    print("No")
Buggy python submission (verdict: Runtime Error):
import numpy as np
X, Y, A, B, C = list(map(int, input().split()))
p = sorted(list(map(int, input().split())))
q = sorted(list(map(int, input().split())))
r = np.array(sorted(list(map(int, input().split())), reverse=True))

p_cut = np.array(p[A-X:])
q_cut = np.array(q[B-Y:])
pi = 0
qi = 0
for i in range(len(r)):
    if p_cut[pi] >= q_cut[qi] :
        if q_cut[qi] >= r[i]:
            break
        q_cut[qi] = r[i]
        qi += 1
    else:
        if p_cut[pi] >= r[i]:
            break
        p_cut[pi] = r[i]
        pi += 1
print(np.sum(p_cut) + np.sum(q_cut))



Fixed submission:
import numpy as np
X, Y, A, B, C = list(map(int, input().split()))
p = sorted(list(map(int, input().split())))
q = sorted(list(map(int, input().split())))
r = np.array(sorted(list(map(int, input().split())), reverse=True))

p_cut = np.array(p[A-X:])
q_cut = np.array(q[B-Y:])
pi = 0
qi = 0
for i in range(len(r)):
    if pi >= X and qi >= Y:
        break
    if pi >= X:
        if q_cut[qi] >= r[i]:
            break
        q_cut[qi] = r[i]
        qi += 1
    elif qi >= Y:
        if p_cut[pi] >= r[i]:
            break
        p_cut[pi] = r[i]
        pi += 1
    elif p_cut[pi] >= q_cut[qi] :
        if q_cut[qi] >= r[i]:
            break
        q_cut[qi] = r[i]
        qi += 1
    else:
        if p_cut[pi] >= r[i]:
            break
        p_cut[pi] = r[i]
        pi += 1
print(np.sum(p_cut) + np.sum(q_cut))
Buggy python submission (verdict: Runtime Error):
S, T = list(input().split())
A, B = list(map(int, input().split()))
U = input()
dict = {}
dict[S] = A
dict[T] = B
dict[U] -= 1
print(f"{dict[S]} {dict[T]}")


Fixed submission:
S, T = list(input().split())
A, B = list(map(int, input().split()))
U = input()
dict = {}
dict[S] = A
dict[T] = B
dict[U] -= 1
print(dict[S], dict[T])
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N, K = list(map(int, input().split()))
p = list(map(int, input().split()))

max_sum_val = 0
sum_list = []
for j in range(len(p) - K + 1):
    max_sum_val = max(sum(p[j:K+j]), max_sum_val)
print((max_sum_val + K)/2)

Fixed submission:
import numpy as np
N, K = list(map(int, input().split()))
p = list(map(int, input().split()))
p_sum=[0]
for i in p:p_sum.append(p_sum[-1]+i)
max_sum_val = 0
for j in range(len(p_sum) - K):
    max_sum_val = max(p_sum[K+j]-p_sum[j], max_sum_val)
print((max_sum_val + K)/2)
Buggy python submission (verdict: Runtime Error):
N = int(input())
print(sum(list(range(N))))

Fixed submission:
N = int(input())
if N % 2 == 0:
  n = int(N / 2)
  print(n * (N - 1))
else:
  n = int((N-1)/2)
  print(N*n)
Buggy python submission (verdict: Runtime Error):
N = int(input())
L = sorted(list(map(int,input())))[::-1]
if L[0] >= sum(L[1:]) :
  print("No")
else:
  print("Yes")

Fixed submission:
N = int(input())
L = sorted(list(map(int,input().split())))[::-1]
if L[0] >= sum(L[1:]) :
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
A, B, K = list(map(int, input().split()))
left = set(list(range(A, A+k)))
right = set(list(range(b-k+1, b+1)))
[print(i) for i in sorted(list((left | right)))]


Fixed submission:
A, B, K = list(map(int, input().split()))
left = set(list(range(A, min(B, A + K))))
right = set(list(range(max(B - K + 1, A) , B + 1)))
[print(i) for i in sorted(list((left | right)))]

Buggy python submission (verdict: Runtime Error):
A, B, K = list(map(int, input().split()))
l = list(range(A, B + 1))
left = set(l[0:K])
right = set(l[B-K-A+1:])
[print(i) for i in sorted(list((left | right)))]


Fixed submission:
A, B, K = list(map(int, input().split()))
left = set(list(range(A, min(B, A + K))))
right = set(list(range(max(B - K + 1, A) , B + 1)))
[print(i) for i in sorted(list((left | right)))]

Buggy python submission (verdict: Runtime Error):
A, B, K = list(map(int, input().split()))
l = list(range(A, B + 1))
left = set(l[0:K])
right = set(l[B-K-A+1:])
[print(i) for i in sorted(list((left | right)))]


Fixed submission:
A, B, K = list(map(int, input().split()))
left = set(list(range(A, min(B, A + K))))
right = set(list(range(max(B - K + 1, A) , B + 1)))
[print(i) for i in sorted(list((left | right)))]
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter


def factorize(n):
    fct = []
    while n % 2 == 0:
        fct.append(2)
        n //=2
    f = 3
    while f * f <= n:
        if n % f == 0:
            fct.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        fct.append(n)
    d = [i+1 for i in list(Counter(fct).values())]
    return d

n = int(input())
cnt = 0
for c in range(1,n):
    tmp = 1
    for i in factorize(n-c):
        tmp *= i
    cnt += tmp
print(cnt)

Fixed submission:
n = int(input())
cnt = 0
for a in range(1,n):
    cnt += (n-1)//a
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = list(map(int,input().split()))

step = [0]
for i in A[1:]:
    if A[A.index(i)-1] >= i:
        step.append(A[A.index(i)-1] - i)
        A[A.index(i)] += A[A.index(i)-1] - i
print(sum(step))


Fixed submission:
n = int(input())
A = list(map(int,input().split()))
step = [0]
for k,i in enumerate(A[1:]):
    if A[k] >= i:
        step.append(A[k] - i)
        A[k+1] = A[k+1] + A[k] - i
print(sum(step))