Buggy python submission (verdict: Runtime Error):
def gcd(m, n):
    x = max(m, n)
    y = min(m, n)
    if x % y == 0:
        return y
    else:
        while True:
            if x % y != 0:
                z = x % y
                x = y
                y = z
            else:
                break
        return z
A, B, K = map(int, input().split())
A_B_gcd = gcd(A, B)
yakusuu_arr = []
for i in range(1, A_B_gcd):
    if A_B_gcd % i == 0:
        yakusuu_arr.append(i)
print(yakusuu_arr)
print(yakusuu_arr[-K+1])

Fixed submission:
def gcd(m, n):
    x = max(m, n)
    y = min(m, n)
    if x % y == 0:
        return y
    else:
        while True:
            if x % y != 0:
                z = x % y
                x = y
                y = z
            else:
                break
        return z
A, B, K = map(int, input().split())
A_B_gcd = gcd(A, B)
yakusuu_arr = []
for i in range(1, A_B_gcd+1):
    if A_B_gcd % i == 0:
        yakusuu_arr.append(i)
yakusuu_arr.sort(reverse=True)
print(yakusuu_arr[K-1])

Buggy python submission (verdict: Runtime Error):
def gcd(m, n):
    x = max(m, n)
    y = min(m, n)
    if x % y == 0:
        return y
    else:
        while True:
            if x % y != 0:
                z = x % y
                x = y
                y = z
            else:
                break
        return z
A, B, K = map(int, input().split())
A_B_gcd = gcd(A, B)
yakusuu_arr = []
for i in range(1, A_B_gcd):
    if A_B_gcd % i == 0:
        yakusuu_arr.append(i)
print(yakusuu_arr[K-1])

Fixed submission:
def gcd(m, n):
    x = max(m, n)
    y = min(m, n)
    if x % y == 0:
        return y
    else:
        while True:
            if x % y != 0:
                z = x % y
                x = y
                y = z
            else:
                break
        return z
A, B, K = map(int, input().split())
A_B_gcd = gcd(A, B)
yakusuu_arr = []
for i in range(1, A_B_gcd+1):
    if A_B_gcd % i == 0:
        yakusuu_arr.append(i)
yakusuu_arr.sort(reverse=True)
print(yakusuu_arr[K-1])

Buggy python submission (verdict: Runtime Error):
def gcd(m, n):
    x = max(m, n)
    y = min(m, n)
    if x % y == 0:
        return y
    else:
        while x % y != 0:
            z = x % y
            x = y
            y = z
        return z
A, B, K = map(int, input().split())
A_B_gcd = gcd(A, B)
yakusuu_arr = []
for i in range(1, A_B_gcd):
    if A_B_gcd % i == 0:
        yakusuu_arr.append(i)
print(yakusuu_arr[K-1])

Fixed submission:
def gcd(m, n):
    x = max(m, n)
    y = min(m, n)
    if x % y == 0:
        return y
    else:
        while True:
            if x % y != 0:
                z = x % y
                x = y
                y = z
            else:
                break
        return z
A, B, K = map(int, input().split())
A_B_gcd = gcd(A, B)
yakusuu_arr = []
for i in range(1, A_B_gcd+1):
    if A_B_gcd % i == 0:
        yakusuu_arr.append(i)
yakusuu_arr.sort(reverse=True)
print(yakusuu_arr[K-1])

Buggy python submission (verdict: Runtime Error):
import math
A, B, K = map(int, input().split())
A_B_gcd = math.gcd(A, B)
yakusuu_arr = []
for i in range(1, A_B_gcd):
    if A_B_gcd % i == 0:
        yakusuu_arr.append(i)
print(yakusuu_arr[K-1])

Fixed submission:
def gcd(m, n):
    x = max(m, n)
    y = min(m, n)
    if x % y == 0:
        return y
    else:
        while True:
            if x % y != 0:
                z = x % y
                x = y
                y = z
            else:
                break
        return z
A, B, K = map(int, input().split())
A_B_gcd = gcd(A, B)
yakusuu_arr = []
for i in range(1, A_B_gcd+1):
    if A_B_gcd % i == 0:
        yakusuu_arr.append(i)
yakusuu_arr.sort(reverse=True)
print(yakusuu_arr[K-1])