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

def solve(X, xs):
    xs = list(xs) + [X]
    xs.sort()
    minx = min(xs)
    zs = [x - minx for x in xs]

    gcd = None
    for z in zs:
        if z == 0:
            gcd = z
        else:
            gcd = math.gcd(gcd, z)
    return gcd

def test():
    print(solve(13, [16 + 3 * 102485 * i for i in range(10**5)]))

if __name__=='__main__':
    N, X = map(int, input().split())
    xs = map(int, input().split())

    print(solve(X, xs))


Fixed submission:
try:
    from math import gcd # >=Python 3.5
except:
    from fractions import gcd # <Python 3.5 (AtCoder : 3.4)

def solve(X, xs):
    xs = list(xs) + [X]
    xs.sort()
    zs = [x - xs[0] for x in xs]

    for z in zs:
        if z == 0:
            D = z
        else:
            D = gcd(D, z)
    return D

def test():
    print(solve(13, [16 + 3 * 102485 * i for i in range(10**5)]))

if __name__=='__main__':
    N, X = map(int, input().split())
    xs = map(int, input().split())

    print(solve(X, xs))

Buggy python submission (verdict: Time Limit Exceeded):
def solve(X, xs):
    divs = range(1, int(10 ** 4.5) + 1)
    def divisors(X, smaller_only=False):
        fwd, bwd = [], []
        for p in divs:
            if X % p == 0:
                fwd.append(p)
                if not smaller_only and X // p != p:
                    bwd.append(X // p)
        bwd.reverse()
        return fwd + bwd

    s = None
    for x in xs:
        ds = set(divisors(abs(x - X)))
        if s:
            s &= ds
        else:
            s = ds
    return max(s)

def test():
    print(solve(1, [2 ** i for i in range(30)]))

if __name__=='__main__':
    N, X = map(int, input().split())
    xs = map(int, input().split())

    print(solve(X, xs))


Fixed submission:
try:
    from math import gcd # >=Python 3.5
except:
    from fractions import gcd # <Python 3.5 (AtCoder : 3.4)

def solve(X, xs):
    xs = list(xs) + [X]
    xs.sort()
    zs = [x - xs[0] for x in xs]

    for z in zs:
        if z == 0:
            D = z
        else:
            D = gcd(D, z)
    return D

def test():
    print(solve(13, [16 + 3 * 102485 * i for i in range(10**5)]))

if __name__=='__main__':
    N, X = map(int, input().split())
    xs = map(int, input().split())

    print(solve(X, xs))
Buggy python submission (verdict: Time Limit Exceeded):
def my_index_multi(l, x):
    return [i for i, _x in enumerate(l) if _x == x]

def main():
    n = int(input())
    a_list = [int(_) for _ in input().split()]
    Q = int(input())

    s_list = []
    for q in range(Q):
        b, c = map(int, input().split())
        a_index_list = my_index_multi(a_list, b)
        
        for i in a_index_list:
            a_list[i] = c

        s_list.append(sum(a_list))

    for s in s_list:
        print(s)

main()

Fixed submission:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    Q = int(input())
    
    table = [0] * 100001
    
    c = 0
    s = 0
    
    for i in A:
        table[i] += 1
        s += i
    
    for i in range(Q):
        B, C = map(int, input().split())
        c = table[B]
        s += (C - B) * c
        table[C] += table[B]
        table[B] = 0
        print(s)

main()
Buggy python submission (verdict: Runtime Error):
import sys
import random

def main():
    S = input()
    l = len(S)
    n = [random.randint(0, l) for i in range(3)]
    out = S[n[0]] + S[n[1]] + S[n[2]]
    
    print(out)
main()

Fixed submission:
import sys
import random

def main():
    S = input()
    l = len(S)
    n = [0, 1, 2]
    out = S[n[0]] + S[n[1]] + S[n[2]]
    
    print(out)
main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
def main():
    N = int(input())
    A_list = [int(_) for _ in input().split()]
    ans = 1
    for i in range(N):
        ans *= A_list[i]

    out = ans
    if ans>10**18:
        out = -1
    print(out)
main()

Fixed submission:
import sys
def main():
    N = int(input())
    A_list = [int(_) for _ in input().split()]
    ans = 1
    
    if 0 in A_list:
        out = 0
        print(out)
        sys.exit()
    
    for i in range(N):
        ans = ans * A_list[i]
        
        if ans>1000000000000000000:
            ans = -1
            break
    out = ans
    print(out)

main()
Buggy python submission (verdict: Runtime Error):
import math
def main():
    A, B = input().split()
    A = int(A)
    B = round(100 * (B))
    out = (A * B) // 100
    
    print(out)

main()

Fixed submission:
import math
def main():
    A, B = input().split()
    A = int(A)
    B = round(100 * float(B))
    out = (A * B) // 100
    
    print(out)

main()
Buggy python submission (verdict: Runtime Error):
import sys
def main():
    H1, M1, H2, M2, K = map(int, input().split())
    
    h = H2 - H1 
    m = M2 - M1
    tot_minutes = h * 60 + m - K
    if tot_minutes <= 0:
        out = 0
    print(out)
main()

Fixed submission:
import sys
def main():
    H1, M1, H2, M2, K = map(int, input().split())
    
    h = H2 - H1 
    m = M2 - M1
    tot_minutes = h * 60 + m - K
    
    if tot_minutes <= 0:
        out = 0
    else:
        out = tot_minutes
    print(out)
main()
Buggy python submission (verdict: Runtime Error):
def main():
    A, B, C, K = map(int, input().split())
    l = []

    if K-A<0:
        out = K
    if K-A>=0:
        l.append(A)
        K = K-A
    if K-B>=0:
        K = K-B
    if K>0:
        m = K * -1
        l.append(m)
    out = sum(l)
    print(out)
main()

Fixed submission:

def main():
    S = input()
    T = input()

    S = S + str(T[-1])
    out='No'
    if S==T:
        out='Yes'
    print(out)
main()
Buggy python submission (verdict: Runtime Error):

def main():
    N, M = map(int, input().split())
    H_list = [int(_) for _ in input().split()]

    # iso_list = []
    index_list = []
    for m in range(M):
        A, B = map(int, input().split())
        if H_list[A-1] > H_list[B-1]:
            index_list.append(B-1)
        elif H_list[A-1] < H_list[B-1]:
            index_list.append(A-1)
        elif H_list[A-1] == H_list[B-1]:
            index_list.append(A-1)
            index_list.append(B-1)
        # iso_list.append(A)
        # iso_list.append(B)        

    index_list = list(set(index_list))
    for i in index_list:
        del H_list[i]        

    # iso_list = list(set(iso_list))
    # iso_list = len(H_list - iso_list)
    
    # out = iso_list + 
    out = len(H_list)
    print(out)
main()

Fixed submission:
N, M = map(int, input().split())
H = [0] + list(map(int, input().split()))
O = [0] + [1] * N
for _ in range(M):
    A, B = map(int, input().split())
    if H[A] <= H[B]:
        O[A] = 0
    if H[A] >= H[B]:
        O[B] = 0
print(sum(O))

Buggy python submission (verdict: Runtime Error):

def main():
    N, M = map(int, input().split())
    H_list = [int(_) for _ in input().split()]

    # iso_list = []
    index_list = []
    for m in range(M):
        A, B = map(int, input().split())
        if H_list[A-1] > H_list[B-1]:
            index_list.append(B-1)
        elif H_list[A-1] < H_list[B-1]:
            index_list.append(A-1)
        elif H_list[A-1] < H_list[B-1]:
            index_list.append(A-1)
            index_list.append(B-1)
        # iso_list.append(A)
        # iso_list.append(B)        

    index_list = list(set(index_list))
    for i in index_list:
        del H_list[i]        

    # iso_list = list(set(iso_list))
    # iso_list = len(H_list - iso_list)
    
    # out = iso_list + 
    out = len(H_list)
    print(out)
main()

Fixed submission:
N, M = map(int, input().split())
H = [0] + list(map(int, input().split()))
O = [0] + [1] * N
for _ in range(M):
    A, B = map(int, input().split())
    if H[A] <= H[B]:
        O[A] = 0
    if H[A] >= H[B]:
        O[B] = 0
print(sum(O))

Buggy python submission (verdict: Runtime Error):

def main():
    N, M = map(int, input().split())
    H_list = [int(_) for _ in input().split()]

    # iso_list = []
    index_list = []
    for m in range(M):
        A, B = map(int, input().split())
        if H_list[A-1] > H_list[B-1]:
            index_list.append(B-1)
        elif H_list[A-1] < H_list[B-1]:
            index_list.append(A-1)
    
        # iso_list.append(A)
        # iso_list.append(B)        

    index_list = list(set(index_list))
    for i in index_list:
        del H_list[i]        

    # iso_list = list(set(iso_list))
    # iso_list = len(H_list - iso_list)
    
    # out = iso_list + 
    out = len(H_list)
    print(out)
main()

Fixed submission:
N, M = map(int, input().split())
H = [0] + list(map(int, input().split()))
O = [0] + [1] * N
for _ in range(M):
    A, B = map(int, input().split())
    if H[A] <= H[B]:
        O[A] = 0
    if H[A] >= H[B]:
        O[B] = 0
print(sum(O))
Buggy python submission (verdict: Runtime Error):
import itertools

#19 choose 9
#92378

def main():
    N, M, Q = map(int, input().split())
    Q = []
    final_score = 0
    for i in range(Q):
        Q.append(list(map(int, input().split())))
    for A in itertools.combinations_with_replacement(range(1, M+1), N):
        score = 0
        for q in Q:
            if A[q[1]-1] - A[q[0]-1] == q[2]:
                score += q[3]
            final_score = max([final_score, score])
    print(final_score)
main()

Fixed submission:
import itertools

#19 choose 9
#92378

def main():
    N, M, Q = map(int, input().split())
    Q_l = []
    final_score = 0
    for i in range(Q):
        Q_l.append(list(map(int, input().split())))
    for A in itertools.combinations_with_replacement(range(1, M+1), N):
        score = 0
        for q in Q_l:
            if A[q[1]-1] - A[q[0]-1] == q[2]:
                score += q[3]
            final_score = max([final_score, score])
    print(final_score)
main()

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

#19 choose 9
#92378

def main():
    N, M, Q = map(int, input().split())
    Q = []
    final_score = 0
    for i in range(Q):
        Q.append(list(map(int, input().split())))
    for A in itertools.combinations_with_replacement(range(1, M+1), N):
        score = 0
        for q in Q:
            if A[q[1]-1] - A[q[0]-1] == q[2]:
                score += q[3]
    out = max([final_score, score])
    print(out)
main()

Fixed submission:
import itertools

#19 choose 9
#92378

def main():
    N, M, Q = map(int, input().split())
    Q_l = []
    final_score = 0
    for i in range(Q):
        Q_l.append(list(map(int, input().split())))
    for A in itertools.combinations_with_replacement(range(1, M+1), N):
        score = 0
        for q in Q_l:
            if A[q[1]-1] - A[q[0]-1] == q[2]:
                score += q[3]
            final_score = max([final_score, score])
    print(final_score)
main()
Buggy python submission (verdict: Runtime Error):
import math
def main():
    N = map(int, input())
    l = [int(_) for _ in input().split()]
    count_list = [0] * N
    for i in l:
        index = i - 1
        count_list[index] += 1

    for out in count_list:
        print(out + '\n')
main()

Fixed submission:
import math
def main():
    N = int(input())
    l = [int(_) for _ in input().split()]
    count_list = [0] * N
    for i in l:
        index = i - 1
        count_list[index] += 1

    for out in count_list:
        print(out)
main()
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

def gcd(*numbers):
    r = reduce(math.gcd, numbers)
    return r

def main():
    K = int(input())
    g = 0
    for i in range(1, K+1, 1):
        for j in range(1, K+1, 1):
            for k in range(1, K+1, 1):
                g += gcd(i, j, k)         
    print(g)
main()

Fixed submission:
from math import gcd
 
k=int(input())
 
ans=0
for i in range(1,k+1):
  for j in range(1,k+1):
    for l in range(1, k+1):
      ans+=gcd(gcd(i,j),l)
 
print(ans)

Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

def gcd(*numbers):
    r = reduce(math.gcd, numbers)
    return r

def main():
    K = int(input())
    g = 0
    for i in range(1, K+1, 1):
        for j in range(1, K+1, 1):
            for k in range(1, K+1, 1):
            g += gcd(i, j, k)         
    print(g)
main()

Fixed submission:
from math import gcd
 
k=int(input())
 
ans=0
for i in range(1,k+1):
  for j in range(1,k+1):
    for l in range(1, k+1):
      ans+=gcd(gcd(i,j),l)
 
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

def gcd(*numbers):
    r = reduce(math.gcd, numbers)
    return r

def main():
    K = int(input())
    l = []
    for i in range(1, K+1, 1):
        for j in range(1, K+1, 1):
            for k in range(1, K+1, 1):
                g = gcd(i, j, k)
                l.append(g)            
    print(sum(l))
main()

Fixed submission:
from math import gcd
 
k=int(input())
 
ans=0
for i in range(1,k+1):
  for j in range(1,k+1):
    for l in range(1, k+1):
      ans+=gcd(gcd(i,j),l)
 
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

def gcd(*numbers):
    r = reduce(math.gcd, numbers)
    return r

def main():
    K = int(input())
    l = []
    for i in range(1, K+1, 1):
        for j in range(1, K+1, 1):
            for k in range(1, K+1, 1):
                g = gcd(i, j, k)
                l.append(g)            
    print(sum(l))
main()

Fixed submission:
from math import gcd
 
k=int(input())
 
ans=0
for i in range(1,k+1):
  for j in range(1,k+1):
    for l in range(1, k+1):
      ans+=gcd(gcd(i,j),l)
 
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys

def main():
    n, k = [int(_) for _ in input().split()]
    
    m = abs(n - n // k * k)
    while True:
        ans = abs(m - k)
        if m <= ans:
            print(m)
            sys.exit()
main()

Fixed submission:
import sys

def main():
    n, k = [int(_) for _ in input().split()]
    
    m = abs(n - n // k * k)
    while True:
        ans = abs(m - k)
        if m <= ans:
            print(m)
            sys.exit()
        m = abs(m - k)
main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys

def main():
    N, K = [int(_) for _ in input().split()]
    
    # dif = abs(N - K)
    # if N < dif:
    #     print(N)
    #     sys.exit()
    # elif K < dif:
    #     print(K)
    #     sys.exit()

    m = 0
    while True:
        m = abs(N - K)
        if m < N:
            N = m
            if N==0:
                print(N)
                break
        else:
            print(N)
            break

main()

Fixed submission:
import sys

def main():
    n, k = [int(_) for _ in input().split()]
    
    m = abs(n - n // k * k)
    while True:
        ans = abs(m - k)
        if m <= ans:
            print(m)
            sys.exit()
        m = abs(m - k)
main()
Buggy python submission (verdict: Runtime Error):
def main():
    K, N = [int(_) for _ in input().split()]
    A = list(map(int, input().split()))
    mx = 0

    for i in range(N-1):
        dis = A[i+1]-A[i]
        if dis > mx:
            mx = dis
    se = A[N-1] - A[0]
    if (K-(se)) > mx:
        mx = K - se
    print(mx)
main()

Fixed submission:
def main():
    s = input()
    if s[2]==s[3] and s[4]==s[5]:
            print('Yes')
    else:
        print('No')

main()
Buggy python submission (verdict: Runtime Error):
def main():
    x = int(input())
    
    x // 500 = a
    x %= 500

    x // 5 = b
    
    ans = 1000 * a + 5 * b
    print(ans)

main()




Fixed submission:
def main():
    x = int(input())
    
    a = x // 500
    x %= 500

    b = x // 5
    
    ans = 1000 * a + 5 * b
    print(ans)

main()
Buggy python submission (verdict: Runtime Error):
def main():
    K, N = [int(_) for _ in input().split()]
    A = map(int, input().split())
    mx = 0

    for i in range(N-1):
        dis = A[i+1]-A[i]
        if dis > mx:
            mx = dis
    se = A[N-1] - A[0]
    if (k-(se)) > mx:
        mx = k - se
    print(mx)
main()

Fixed submission:
def main():
    K, N = [int(_) for _ in input().split()]
    A = list(map(int, input().split()))
    mx = 0

    for i in range(N-1):
        dis = A[i+1] - A[i]
        if dis > mx:
            mx = dis
    se = A[N-1] - A[0]
    
    if K-se > mx:
        mx = K - se
    print(K - mx)
main()
Buggy python submission (verdict: Runtime Error):
def main():
    K = 0
    N, R = [int(_) for _ in input().split()]
    if N >= 10:
        K = R
    else:
        K = R + 100(10 - N) 
    print(K)
main()

Fixed submission:
def main():
    K = 0
    N, R = [int(_) for _ in input().split()]
    if N >= 10:
        K = R
    else:
        K = R + 100 * (10 - N) 
    print(K)
main()
Buggy python submission (verdict: Runtime Error):
import sys

def main():
    N = int(input().split())
    S = input()

    cnt = 0
    for i in range(N-2):
        s = str(S[i:i+2])
        if s=='ABC':
            cnt += 1

    print(cnt)
main()

Fixed submission:
import sys

def main():
    N = int(input())
    S = input()

    cnt = 0
    for i in range(N-2):
        s = str(S[i:i+3])
        if s=='ABC':
            cnt += 1

    print(cnt)
main()

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

def main():
    N = int(input().split())
    S = input()

    cnt = 0
    for i in range(N-2):
        s = str(S[i]) + str(S[i+1]) + str(S[i+2])
        if s=='ABC':
            cnt += 1

    print(cnt)
main()

Fixed submission:
import sys

def main():
    N = int(input())
    S = input()

    cnt = 0
    for i in range(N-2):
        s = str(S[i:i+3])
        if s=='ABC':
            cnt += 1

    print(cnt)
main()

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

def main():
    N = int(input().split())
    S = input()

    cnt = 0
    for i in range(N):
        s = str(S[i]) + str(S[i+1]) + str(S[i+2])
        if s=='ABC':
            cnt += 1

    print(cnt)
main()

Fixed submission:
import sys

def main():
    N = int(input())
    S = input()

    cnt = 0
    for i in range(N-2):
        s = str(S[i:i+3])
        if s=='ABC':
            cnt += 1

    print(cnt)
main()
Buggy python submission (verdict: Runtime Error):
def main():
    A, B = map(int, input().split())
    if A < 10 and B < 10:
        p = A * B
        print(p)
    else:
        print(p)
main()

Fixed submission:
def main():
    A, B = map(int, input().split())
    if A < 10 and B < 10:
        p = A * B
        print(p)
    else:
        print(-1)
main()

Buggy python submission (verdict: Runtime Error):
def main():
    A, B = map(int, input().split())
    if A <=10 and B <=10:
        p = A * B
        print(p)
    else:
        print(p)
main()

Fixed submission:
def main():
    A, B = map(int, input().split())
    if A < 10 and B < 10:
        p = A * B
        print(p)
    else:
        print(-1)
main()
Buggy python submission (verdict: Runtime Error):
import sys

def main():
    n = map(int, input().split())
    for i in range(1, 10, 1):
        if 1 <= n//i <= 9 and (n/i).is_integer():
            print('Yes')
            sys.exit()
    print('No')
main()

Fixed submission:
import sys

def main():
    n = int(input())
    for i in range(1, 10, 1):
        if 1 <= n//i <= 9 and (n/i).is_integer():
            print('Yes')
            sys.exit()
    print('No')
    
main()

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

def main():
    n = map(int, input().split())
    for i in range(1, 10, 1):
        if 1 <= n//i <= 9 and (n/i).is_integer():
            print('Yes')
            sys.exit()
        else:
            print('No')
main()

Fixed submission:
import sys

def main():
    n = int(input())
    for i in range(1, 10, 1):
        if 1 <= n//i <= 9 and (n/i).is_integer():
            print('Yes')
            sys.exit()
    print('No')
    
main()

Buggy python submission (verdict: Runtime Error):
def main():
    n = map(int, input().split())
    for i in range(1, 10):
        if 1 <= n//i <= 9 and (n/i).is_integer():
            print('Yes')
        else:
            print('No')
main()

Fixed submission:
import sys

def main():
    n = int(input())
    for i in range(1, 10, 1):
        if 1 <= n//i <= 9 and (n/i).is_integer():
            print('Yes')
            sys.exit()
    print('No')
    
main()

Buggy python submission (verdict: Runtime Error):
def main():
    n = map(int, input().split())
    for i in range(1, 10, 1):
        if 1 <= n//i <= 9:
            print('Yes')
        else:
            print('No')
main()

Fixed submission:
import sys

def main():
    n = int(input())
    for i in range(1, 10, 1):
        if 1 <= n//i <= 9 and (n/i).is_integer():
            print('Yes')
            sys.exit()
    print('No')
    
main()
Buggy python submission (verdict: Runtime Error):
import sys
 
def main():
    S = input()
    l = len(S)
    
    cnt_l = []
    
    for i in range(l):
        cnt = 0
        for j in range(l-i):
            if str(S[i+j]) in ['A', 'C', 'G', 'T']:
                cnt += 1
            else:
                cnt_l.append(cnt)
 
    out = max(cnt_l)
 
    print(out)
main()

Fixed submission:
import sys

def main():
    S = input()
    l = len(S)
    
    ans = 0
    for i in range(l):
        for j in range(i, l):
            if all(['ATGC'.count(c) == 1 for c in S[i:j+1]]):
                ans = max(ans, j-i+1)
            
    print(ans)
main()

Buggy python submission (verdict: Runtime Error):
import sys
 
def main():
    S = input()
    l = len(S)
    
    cnt_l = []
    
    for i in range(l):
        cnt = 0
        for j in range(l-i):
            if str(S[i+j]) in ['A', 'C', 'G', 'T']:
                cnt += 1
            else:
                cnt_l.append(cnt)
 
    m = max(cnt_l)
 
    print(out)
main()

Fixed submission:
import sys

def main():
    S = input()
    l = len(S)
    
    ans = 0
    for i in range(l):
        for j in range(i, l):
            if all(['ATGC'.count(c) == 1 for c in S[i:j+1]]):
                ans = max(ans, j-i+1)
            
    print(ans)
main()

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

def main():
    S = input()
    l = len(S)
    
    cnt_l = []
    
    for i in range(l):
        cnt = 0
        for j in range(l-i):
            if str(S[i+j]) in ['A', 'C', 'G', 'T']:
                cnt += 1
            else:
                cnt_l.append(cnt)

    m = max(cnt_l)
    if m==0:
        out = 0
    else:
        m_index = cnt_l.index(m)
        m_l = m + m_index
        out = S[m_index:m_l]

    print(out)
main()

Fixed submission:
import sys

def main():
    S = input()
    l = len(S)
    
    ans = 0
    for i in range(l):
        for j in range(i, l):
            if all(['ATGC'.count(c) == 1 for c in S[i:j+1]]):
                ans = max(ans, j-i+1)
            
    print(ans)
main()

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

def main():
    S = input()
    l = len(S)
    
    cnt_l = []
    
    for i in range(l):
        cnt = 0
        for j in range(l-i):
            if str(S[i+j]) in ['A', 'C', 'G', 'T']:
                cnt += 1
            else:
                cnt_l.append(cnt)

    m = max(cnt_l)
    m_index = cnt_l.index(m)
    m_l = m + m_index
    out = S[m_index:m_l]

    print(out)
main()

Fixed submission:
import sys

def main():
    S = input()
    l = len(S)
    
    ans = 0
    for i in range(l):
        for j in range(i, l):
            if all(['ATGC'.count(c) == 1 for c in S[i:j+1]]):
                ans = max(ans, j-i+1)
            
    print(ans)
main()
Buggy python submission (verdict: Runtime Error):
import math

def main():
    A, B, K = map(int, input().split())
    
    c_list = []
    
    for i in range(1, min(A, B)+1):
        if A%i==0 and B%i==0:
            c_list.append(i)
    print(c_list[K])
main()

Fixed submission:
import math

def main():
    A, B, K = map(int, input().split())
    
    c_list = []
    
    for i in range(1, min(A, B)+1):
        if A%i==0 and B%i==0:
            c_list.append(i)
    c_list.reverse()
    print(c_list[K-1])
main()