Problem:


Score : 200 points

Problem Statement

You are given positive integers A and B.

Find the K-th largest positive integer that divides both A and B.

The input guarantees that there exists such a number.

Constraints

All values in input are integers.

1 \leq A, B \leq 100

The K-th largest positive integer that divides both A and B exists.

K \geq 1

Input

Input is given from Standard Input in the following format:

A B K

Output

Print the K-th largest positive integer that divides both A and B.

Sample Input 1

8 12 2

Sample Output 1

2

Three positive integers divides both 8 and 12: 1, 2 and 4.
Among them, the second largest is 2.

Sample Input 2

100 50 4

Sample Output 2

5

Sample Input 3

1 1 1

Sample Output 3

1



Sample input:
8 12 2


Sample output:
2

Submission status: Runtime Error

Solution code:
N,M=map(int,input().split())
Xa={}
ans=0
for i in range(N):
    V,S=map(int,input().split())
    Xa[V]=S
Xb=sorted(Xa.items())
for i in range (N) :
    M -= Xb[i][1]
    ans += Xb[i][0]*Xb[i][1]
    if M < 0 :
        ans -= abs(M)*Xb[i][0]
        break
    elif M == 0 :
        break
print(ans)

Submission status: Runtime Error

Solution code:
a,b,k = map(int, input().split())

min_val  = min(a,b)
list = []
for i in range(min_val,0,-1):
  if a%(i+1) == 0 and b%(i+1) == 0:
    list.append(i+1)
    
print(list[k-1])

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
s=[]
for i in range(1,max(a,b)+1):
    if a%i==0 and b%i==0:
        s.append(i)
s.remove(max(s))
print(max(s))

Submission status: Runtime Error

Solution code:
import sys
a, b, k = map(int, input().split())
c = 0
for i in range(min(a, b)):
  if a % i == 0 and b % i == 0:
    c += 1
  if c == k:
    print(a)
    sys.exit(0)

Submission status: Runtime Error

Solution code:
A, B, K = map(int, input().split())
ans = []
if max(A,B) == 1:
	print(1)
	exit()
for i in range(1,max(A,B)):
	if A % i == 0 and B % i == 0:
		ans.append(i)
ans.sort(reverse=True)
print(ans[K-1])

Submission status: Runtime Error

Solution code:
A, B, K = map(int, input().split())

div = []

for i in range(1, min(A, B)):
    if A % i == 0 and B % i == 0:
        div.append(i)

print(div[K-1])

Submission status: Runtime Error

Solution code:
a, b, k = map(int, input().split())
while a != b:
    if a > b:
        a = a - b
    else:
        b = b - a
ans = []
for i in range(1, a):
    if a%i == 0:
        ans.append(i)
        ans.sort(reverse=True)
print(ans[k-1])

Submission status: Runtime Error

Solution code:
a,b,k=map(int,input().split())
 
count=0
 
for i in range(1,min(a,b)+1)[::-1]:
  if a%i==0 and b%i==0:
    count +=1
if count==k:
  num=i
  break
  
print(num)

Submission status: Runtime Error

Solution code:
a,b,k=map(int,input().split())

count=0

for i in range(1,min(a,b)+1)[::-1]:
  if a%i==0 and b%i==0:
    count +=1
if count=k:
  num=i
  break
  
print(num)

Submission status: Runtime Error

Solution code:
a,b,k=map(int,input().split())

count=0

for i range(1,max(a,b)+1)[::-1]

if a%i==0 and b%i==0:
  count+=1
  if count==k:
    print(i)

Submission status: Runtime Error

Solution code:
a, b, k = map(int,input().split())
l = []
for i in range(1,max(a,b)):
  if a % i == 0 and b % i == 0:
    l.append(i)
print(l[-2])

Submission status: Runtime Error

Solution code:
a = []
A,B,K  = map(int, input().split())

if A > B:
	min = B
else:
  min = A

for i in B:
  if(A % i == 0 && B % i == 0):
    a.append(i)

print(a.get(K-1))

Submission status: Runtime Error

Solution code:
A,B,K = map(int,input().split())
li = []

for i in range(1,min(A,B)):
  if A % i == 0 and B % i == 0:
    li.append(i)
    
print(li[K-1])

Submission status: Runtime Error

Solution code:
a,b,c=map(int,input().split())

lis=[]
if a>b:
    for i in range(b):
        if a%(b-i)==0 and b%(b-i)==0:
            lis.append(b-i)

else:
    for i in range(a):
        if a%(b-i)==0 and b%(b-i)==0:
            lis.append(b-i)

print(lis[c-1])

Submission status: Runtime Error

Solution code:
A,B,K = map(int,input().split())
num = []
for i in range(1,min(A,B)):
    if A%i == 0 and B%i == 0:
        num.append(i)
print(num[-K])

Submission status: Runtime Error

Solution code:
A,B,K = map(int,input().split())
num = []
for i in range(1,min(A,B)):
    if A%i == 0 and B%i == 0:
        num.append(i)
pritn(num[-K])

Submission status: Runtime Error

Solution code:
a,b,k=map(int,input().split())
 
count=0
for i in range(1,min(a,b)+1):
  if a%i==0 and b%i==0:
    count +=1
    if count==k-1:
      num=i
      break
 
print(num)

Submission status: Runtime Error

Solution code:
a,b,k=map(int,input().split())
ans=[]

if i in range(1,min(a,b)+1):
  if a % i == 0 and b % i == 0:
    ans.append(i)

print(ans[-k])

Submission status: Runtime Error

Solution code:
import math
a,b,k =map(int, input().split())
c = math.gcd(a,b)
cnt = 0
for i in range(c, 0, -1):
    if a%i==0 and b%i==0:
        cnt +=1
    if cnt ==k:
        print(i)
        break

Submission status: Runtime Error

Solution code:
A, B, K = map(int, input().split())
S = []
for i in range(100):
  if A%i==0 and B%i==0:
    S.append(i)
print(S[K-1])

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-

a,b,k = map(int, input().split())

ans = []
for i in range(1, max(a,b)):
    if a%i==0 and b%i==0:
        ans.append(i)

#print(ans)

t = len(ans)-k
print(ans[t])

Submission status: Runtime Error

Solution code:
a,b,k=map(int,input().split())

for i in range(1,min(a,b)+1):
  if a%i==0 and b%i==0:
    count+=1
    if count==k:
      print(i)

Submission status: Runtime Error

Solution code:
a,b,k=map(int,input().split())

for i in range(1,min(a,b)+1):
  if a%i==0 and b%i==0:
    count+=1
    if count=k:
      print(i)

Submission status: Runtime Error

Solution code:
import math
import copy

inputa = input().split()
# inputb = input().split()
# inputc = input().split()

a = int(inputa[0])
b = int(inputa[1])
c = int(inputa[2])

# inputb = input().split()
# inputbint = [int(x) for x in inputb]
# inputList = list(b)

# x = int(inputb[0])
# y = int(inputb[1])

# inputList=[]
# for i in range(a):
#     inputNum = input().split()
#     inputNum = [int(x) for x in inputNum]
#     inputList.append(inputNum)

# inputList = [int(n) for n in inputList]

# b = [int(n) for n in inputb]
# c = [int(n) for n in inputc]

min = min[a, b]
cnt = 0

for i in range(min, 0, -1):
    checka = a % i
    checkb = b % i
    if checka == 0 and checkb == 0:
        cnt += 1
        if cnt == k:
            print(i)

Submission status: Runtime Error

Solution code:
A,B,K = list(map(int,input().split()))

count = 0
for j in range(1,100):
    if A % j == 0 and B % j == 0:
        count += 1
        if K == count:
            print(ans)
            break

Submission status: Runtime Error

Solution code:
a,b,k = map(int,input().split())
1 1 1

number = 0
for i in range(min(a,b),0,-1):
    if a % i == 0 and b % i == 0:
        number += 1
        if number == k:
            print(i)
            break

Submission status: Runtime Error

Solution code:
a,b,k= map(int, input().split())
n=min(a,b)
m=[]
i=1
j=1
while n//2<m:
  if j=k:
    print(i)
    exit()
  else:
    i+=1
    if a%i==0 and b%i==0:
      j+=1

Submission status: Runtime Error

Solution code:
A, B, K = map(int, input().split())
N = min(A, B)
list_gcd = [] 

for i in range(1, N):
  if A % i == 0 and B % i == 0:
    list_gcd.append(i)
    
if N == 1:
  Y = max(A,B)
  if Y == 1:
    list_gcd.append(1)
  else:
    for i in range(1, Y):
      if Y % i == 0:
        list_gcd.append(i)
    
print(list_gcd[K-1])

Submission status: Runtime Error

Solution code:
A, B, K = map(int, input().split())
N = min(A, B)
list_gcd = [] 

for i in range(1, N):
  print(A)
  if A % i == 0 and B % i == 0:
    list_gcd.append(i)
    
if N == 1:
  Y = max(A,B)
  if Y == 1:
    list_gcd.append(1)
  else:
    for i in range(1, Y):
      if Y % i == 0:
        list_gcd.append(i)
    
print(list_gcd[K-1])

Submission status: Runtime Error

Solution code:
A, B, K = map(int, input().split())
A, B, K = map(int, input().split())
N = min(A, B)
list_gcd = [] 

for i in range(1, N):
  print(A)
  if A % i == 0 and B % i == 0:
    list_gcd.append(i)
    
if N == 1:
  Y = max(A,B)
  if Y == 1:
    list_gcd.append(1)
  else:
    for i in range(1, Y):
      if Y % i == 0:
        list_gcd.append(i)
    
print(list_gcd[K-1])

Submission status: Runtime Error

Solution code:
A, B, K = map(int, input().split())
N = min(A, B)
list_gcd = [] 

for i in range(1, N):
  if A % i == 0 and B % i == 0:
    list_gcd.append(i)
    
print(list_gcd[K-1])

Submission status: Runtime Error

Solution code:
a, b, k = map(int, input().split())
l = []
for i in range(1, max(a,b)):
    if a % i == 0 and b % i == 0:
        l.append(i)
print(l[-k])

Submission status: Runtime Error

Solution code:
A, B, K = map(int, input().split())
D = []
for i in range(max(A, B), 1, -1):
  if A % i == 0 and B % i == 0:
    D.append(i)
print(D[K - 1])

Submission status: Runtime Error

Solution code:
import math
A, B, K = map(int, input().split())
num = math.gcd(A,B)
a = []
a.append(num)
for i in range(1,num):
    if num % i == 0:
        a.append(i)
b = sorted(a)
print(b[len(b)-K])

Submission status: Runtime Error

Solution code:
import math
A, B, K = map(int, input().split())
num = math.gcd(A,B)
a = [num]
for i in range(1,num):
    if num % i == 0:
        a.append(i)
b = sorted(a)
print(b[len(b)-K])

Submission status: Runtime Error

Solution code:
import math
A, B, K = map(int, input().split())
num = int(math.gcd(A,B))
a = [num]
for i in range(1,num):
    if num % i == 0:
        a.append(i)
b = sorted(a)
print(b[len(b)-K])

Submission status: Runtime Error

Solution code:
#0120
a, b, k = (int(_) for _ in input().split())
num = []
if a > b:
    for i in range(1, a):
        if a % i == 0 and b % i == 0:
            num.append(i)
else:
    for i in range(1, b):
        if a % i == 0 and b % i == 0:
            num.append(i)
if a == 1 and b == 1:
    num.append(1)
print(num[-k])

Submission status: Runtime Error

Solution code:
import sys

a, b, k = map(int, input().split())
l = []

for i in range(1, max(a,b)):
    if a%i == 0 and b%i == 0:
        l.append(i)
if l == []:
    print(1)
    sys.exit()
l.sort(reverse=True)
print(l[k-1])

Submission status: Runtime Error

Solution code:
import sys

a, b, k = map(int, input().split())
l = []

for i in range(1, max(a,b)):
    if a%i == 0 and b%i == 0:
        l.append(i)
if l == []:
  print(1)
  sys.exit()
l.sort(reverse=True)
print(l[k-1])

Submission status: Runtime Error

Solution code:
S = input()

S = S.split()

S = list(map(int, S))

A = S[0]
B = S[1]
K = S[2]

list = []

if A > B:
  C = A
else:
  C = B

for i in range(1, C, 1):
  if (A % i==0) and (B % i == 0):
    list.append(i)

print(list[K])

Submission status: Runtime Error

Solution code:
S = input()

S = S.split()

S = list(map(int, S))

A = S[0]
B = S[1]
K = S[2]

list = []

if A > B:
  C = A
else:
  C = B

for i range(C):
  if (A % i==0) and (B % i == 0):
    list.append(i)

print(list[K])

Submission status: Runtime Error

Solution code:
a,b,k=map(int,input())

cnt = 0
for i in range(1, max(a,b)+1):
    if a % i == 0 and b % i == 0:
        cnt += 1
    if cnt == k:
        print(i)
        break

Submission status: Runtime Error

Solution code:
A,B,K=map(int,input().split())
ans=[]
for i in range(1,A):
  if A%i==0 and B%i==0:
    ans.append(i)

if len(ans)==0:
  print(1)
else:
  print(ans[-K])

Submission status: Runtime Error

Solution code:
import math

A, B, K = map(int, input().split())
C = math.gcd(A, B)
L = [1]

for i in range(2, C+1):
    if A % i == 0 and B % i == 0:
        L.append(i)

print(L[-K])

Submission status: Runtime Error

Solution code:
A, B, K = map(int, input().split())
index = 0
for i in range(100, 0, -1):
  if int(A / i) == 0 and int(B / i) == 0:
    index += 1
    if(K == i):
      res = i
print(res)

Submission status: Runtime Error

Solution code:
a,b,k = map(int,input().split())
cnt = 0
for i in range(1,100):
  if a%i ==0 and b%i==0:
    cnt +=1
    if cnt = k:
      print(i)

Submission status: Runtime Error

Solution code:
100 50 4

Submission status: Runtime Error

Solution code:
A,B,K = list(map(int,input().split()))

mylist = []
for i in range(1,max(A,B)):
	if A%i == 0 and B%i == 0:
		mylist.append(i)

print(mylist[K-1])

Submission status: Runtime Error

Solution code:
a, b, k = map(int, input().split())
flag = True

for i in range(100, 1, -1):
    if(a%i == 0)and(b%i == 0)and(flag):
        if(k == 1):
            ans = i
            flag = False
        else:
            k -= 1

print(ans)

Submission status: Runtime Error

Solution code:
a, b, k = list(map(int, input().split()))

ans_l = []
for num in range(min(a, b)):
  if a % num == 0 and b % num == 0:
    ans_l.append(num)

sorted(ans_l)

print(ans_l[-k])

Submission status: Runtime Error

Solution code:
a,b,k = map(int,input().split())
c = []
for i in range(max(a,b)//2):
  if a%(i+1) == 0 and b%(i+1) == 0:
    c.append(i+1)
c.sort(reverse = True)
print(c[k-1])

Submission status: Runtime Error

Solution code:
a, b, k = map(int, input().split())
if a == 1 or b == 1:
    print(1)
    exit()
l = [i for i in range(1, min(a, b)) if a % i == 0 and b % i ==0]
l.sort(reverse=True)
print(l[k-1])

Submission status: Runtime Error

Solution code:
a, b, k = map(int, input().split())
l = [i for i in range(1, max(a, b)) if a % i == 0 and b % i ==0]
l.sort(reverse=True)
print(l[k-1])

Submission status: Runtime Error

Solution code:
A,B,K = map(int,input().split())
cnt = 0
for i in range(1, min(A,B)):
  if A % i == 0 and B % i == 0:
    cnt += 1
  if cnt == K:
    break
print(i)

Submission status: Runtime Error

Solution code:
import math

a,b,k=map(int,input().split())

n=math.gcd(a,b)
ans=[]
for i in range(1,n+1):
    if n%int(i)==0:
        ans.append(i)

ans1=ans[::-1]

print(ans1[k-1])

Submission status: Runtime Error

Solution code:
A,B,K = map(int,input().split())
ans =[]
for i in range(1, min(A,B)+1):
    if A%i == 0 and B%i == 0:
        ans.append(i)
    
    if len(ans) == K:
        print(ans[len(ans)-1])
        exit(1)

Submission status: Runtime Error

Solution code:
A,B,K = map(int,input.split())
ans =[]
for i in range(1, min(A,B)+1):
  if A%i == 0 and B%i == 0:
    ans.append(i)
  if len(ans) == K:
    print(ans[len(ans)-1])
    exit(1)

Submission status: Runtime Error

Solution code:
A,B,K = map(int,input.split())
ans =[]
for i in range(1, min(A,B)+1):
  if A%i == 0 and B%i == 0:
    ans.append(i)
  if len(ans) == K:
    print(ans[len(ans)])
    exit(1)

Submission status: Runtime Error

Solution code:
A,B,K = map(int,input.split())
ans =[]
for i in range(1, min(A,B)+1):
  if A%i == 0 and B%i == 0:
    ans.append(i)
  if len(ans) == K:
    print(len(ans))
    exit(1)

Submission status: Runtime Error

Solution code:
A,B,K = map(int,input.split())
ans =[]
for i in range(1, min(A,B)):
  if A%i == 0 and B%i == 0:
    ans.append(i)
  if len(ans) == K:
    print(len(ans))
    exit(1)

Submission status: Runtime Error

Solution code:
A,B,K = map(int,input().split())
import math
GcD = math.gco(A,B)
li = []
for i in range(1,GcD):
    if GcD % i == 0:
        li.append(i)
li.sort(reverse=True)
print(li[K-1]

Submission status: Runtime Error

Solution code:
a,b,c = map(int,input().split())
def w(a,b):
    li=[]
    d = max(a,b)
    for i in range(d//2):
        if a%(i+1) == 0 and b%(i+1)==0:
            li.append(i+1)
    #print(li)
    print(li[c-1])
w(a,b)

Submission status: Runtime Error

Solution code:
import math

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

p=math.gcd(A,B)

count=1

ans=p

for i in reversed(list(range(1,p))):
    if p%i==0:
        count+=1
        ans=i
    if count==K:
        break

print(ans)

Submission status: Runtime Error

Solution code:
a,b,k=map(int, input().split())
l=[]
for i in range(1,100):
    if a%i==0 and b%i==0:
        l.append(i)
if k==len(k):
    print(l[0])
else:
    print(l[-k])

Submission status: Runtime Error

Solution code:
A, B, K = map(int, input().split())
cnt = 0
ans = 0
for i in range(1, 101): # 1から100まで
	if(A % i == 0 and B % i == 0):
		cnt = cnt + 1
	if(cnt == k):
		ans = i
print(ans)

Submission status: Runtime Error

Solution code:
A, B, K = map(int, input().split())
cnt = 0
ans = 0
for i in range(1, 101): # 1から100まで
	if(A % i == 0 and B % i == 0):
 		cnt = cnt + 1
 	if(cnt == k):
 		ans = i
print(ans)

Submission status: Runtime Error

Solution code:
a,b,c=map(int,input().split())
rank=0
for i in range(1,max(a,b)+1):
  	if a%i==0 and b%i==0:
      rank+=1
    if rank==c:
      print(i)
      break

Submission status: Runtime Error

Solution code:
a, b, n = map(int, input().split())

def divisor(num):
    num_l = []
    if (num == 1) :
        return [1]
    else :
        for i in range(1,num):
            if (num % i == 0):
                num_l.append(i)
        return num_l

a_l = divisor(a)
b_l = divisor(b)

two_divisor = []
for c in a_l :
    if c in b_l :
        two_divisor.append(c)

print(two_divisor[n-1])

Submission status: Runtime Error

Solution code:
A,B,K = map(int,input().split())
S = []
for i in range(50):
    if A % (i + 1) == 0 and B % (i + 1) == 0:
        S.append(i + 1)
print(S[-K])

Submission status: Runtime Error

Solution code:
A, B, K = map(int, input().split())

max = max(A, B)
min = min(A, B)
max_k = 1
n = 0
L = []
for i in range(min,1,-1):
    # print(i)
    # if(n < K):
    if(min % i == 0 and max % i == 0):
        max_k = i
        n += 1
        L.append(max_k)

# print(max_k)
# print(L)
print(L[K-1])

Submission status: Runtime Error

Solution code:
A, B, K = map(int, input().split())

max = max(A, B)
min = min(A, B)
n = 0
for i in range(1,max):
    if(n < K):
        if(min % i == 0):
            max_k = i
            n += 1

print(max_k)

Submission status: Runtime Error

Solution code:
a,b,k=map(int, input().split())
ans=[]
for i in range(1,max(a,b)):
    if a%i==0 and b%i==0:
        ans.append(i)
print(ans[-k])

Submission status: Runtime Error

Solution code:
a,b,k=map(int,input().split())
count=0
for i in range(1,ab):
  if a%i==0 and b%i==0:
    count+=1
    if count==k:
      print(i)
      exit()

Submission status: Runtime Error

Solution code:
a,b,k=map(int,input().split())
count=0
for i in range(ab):
  if a%i==0 and b%i==0:
    count+=1
    if count==k:
      print(i)
      exit()

Submission status: Runtime Error

Solution code:
a,b,k=map(int,input().split())
count=0
for i in range(ab):
  if a%i==0 and b%i==0:
    count+=1
    if count==k:
      print(k)
      exit()

Submission status: Runtime Error

Solution code:
A, B, K = list(map(int, input().split()))

if A < B:
    n = A
else:
    n = B

l = []
for i in range(1, n):
    if A % i == 0 and B % i == 0:
        l.append(i)

print(l[-K])

Submission status: Runtime Error

Solution code:
A, B, K = list(map(int, input().split()))

if A > B:
    n = A
else:
    n = B

l = []
for i in range(1, n):
    if A % i == 0 and B % i == 0:
        l.append(i)

print(l[-K])

Submission status: Runtime Error

Solution code:
a, b, k = (int(i) for i in input().split())
ok_list = []
for i in range(1,max(a, b)):
    if a % i == b % i == 0:
       ok_list.append(i)
print(ok_list[k-1])

Submission status: Runtime Error

Solution code:
a, b, k = (int(i) for i in input().split())
ok_list = []
for i in range(1,max(a, b)):
    if a % i == b % i == 0:
       ok_list.append(i)
print(ok_list[k])

Submission status: Runtime Error

Solution code:
import math

A , B , K = map(int,input().split()) # A,B <= 100

k = 0

R = int(max(math.gcd(A,B),1))

for i in range(R,0,-1) :
    if A % i == 0 and B % i == 0 :
        k += 1
        if k >= K :
            print(i)
            break

Submission status: Runtime Error

Solution code:
import math

A , B , K = map(int,input().split()) # A,B <= 100

k = 0

for i in range(math.gcd(A,B),0,-1) :
    if A % i == 0 and B % i == 0 :
        k += 1
        if k >= K :
            print(i)
            break

Submission status: Runtime Error

Solution code:
A, B, K = map(int, input().split())

tmp = []

for i in range(1,A):
    if((A % i == 0) and (B%i==0)):
        tmp.append(i)

tmp.reverse()
print(tmp[K-1])

Submission status: Runtime Error

Solution code:
def gcd( x, y ):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)

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

N = gcd(A, B)
print(make_divisors(N)[-K])

Submission status: Runtime Error

Solution code:
a, b, k = map(int, input().split())
ans_list = []
for i in reversed(range(1, min(a, b))):
    if (a % i == 0) and (b % i == 0):
            ans_list.append(i)
print(ans_list[k-1])

Submission status: Runtime Error

Solution code:
A,B,K=map(int,input().split())
a=[]
b=[]
for i in range(A):
  if A%(i+1) == 0:
    a.append(i+1)
for ii in range(B):
  if B%(ii+1) == 0:
    b.append(ii+1)
s=set(a)&set(b)
print(sorted(list(s))[K])

Submission status: Runtime Error

Solution code:
a,b,k=map(float, input().split())
c=[]
for i in range(1,a+1):
    if a%i==0 and b%i==0:
        c.append(i)
print(c[k-1])

Submission status: Runtime Error

Solution code:
import math
a, b, k = list(map(int, input().split()))
ans = math.gcd(a, b)
def div(n):
    if n < 1:
        return []
    elif n == 1:
        return [1]
    else:
        l = []
        l.append(1)
        for i in range(2, n//2 + 1):
            if n % i == 0:
                l.append(i)
        l.append(n)
        return l
l = div(ans)
l.sort(reverse=True)
print(l[k-1])

Submission status: Runtime Error

Solution code:
A, B, K = map(int, input().split())
lista = [a for a in range(1, A + 1) if A % a == 0]
listb = [b for b in range(1, B + 1) if B % b == 0]
listc = list(set(lista) & set(listb))
#print(lista)
#print(listb)
#print(listc)

print(listc[K])

Submission status: Runtime Error

Solution code:
A,B,K = map(int,input().split())
L = 0
ans = 0
for i in reversed(1,100):
  if A%i == 0:
    if B%i == 0:
      L += 1
    else:
      L += 0
  else:
    L += 0
  if L == K:
    ans = i
    break
print(ans)

Submission status: Runtime Error

Solution code:
def gcd(a, b):
    while b > 0:
        a, b = b, a % b
    return a


def divisor(a):
    res = set()
    for i in range(1, int(a * 0.5 + 1)):
        if a % i == 0:
            res.add(i)
            res.add(a // i)
    return sorted(res)


a, b, k = map(int, input().split())
ans = divisor(gcd(a, b))[-k]
print(ans)

Submission status: Runtime Error

Solution code:
a, b, k = map(int, input().split())
divisers = []

for i in range(1, max(a, b)):
    if a % i == 0 and b % i == 0:
        divisers.append(i)

print(divisers[-k])

Submission status: Runtime Error

Solution code:
a,b,k=map(int,input().split())
i=1
list=[]

while a>i and b>i:
    if a%i==0 and b%i==0:
        list.append(i)
    i+=1

print(list[k-1])

Submission status: Runtime Error

Solution code:
A,B,K = list(map(int, input().split()))
x=[]

for i in range(max(A,B)):
  if A%i==B%i==0:
    x.append(i)

print(x[K-1])

Submission status: Runtime Error

Solution code:

a, b, k = map(int, input().split())
temp = a if a>b else b
list =  [i  for i in range(1,temp+1) if a%i==0 and b%i==0]
list = list[::-1]
print(list[k-1]

Submission status: Runtime Error

Solution code:
a, b, k = map(int, input().split())
temp = a if a>b else b
list =  [i  for i in range(1,temp) if a%i==0 and b%i==0]
list = list[::-1]
print(list[k-1])

Submission status: Runtime Error

Solution code:
A, B, K = map(int, input().split())
l = []
for i in range(1, max(A, B)):
  if A % i == 0 and B % i == 0:
    l.append(i)
    
l.sort(reverse=True)
print(l[K-1])

Submission status: Runtime Error

Solution code:
def ls_devider(num):
    fs = set()
    fs.add(1)

    if num > 1:
        for i in range(2, num):
            if num % i == 0:
                fs.add(i)

    return fs


a, b, k = map(int, input().split(' '))
a_dvs = ls_devider(a)
b_dvs = ls_devider(b)

print(sorted(a_dvs&b_dvs)[k-1])

Submission status: Runtime Error

Solution code:
a,b,k = map(int, input().split())
l =[]
if a <= b:
    for i in range(1,a):
        if a % i == 0  and b % i == 0:
            l.append(i)
else:
    for i in range(1,b):
        if a % i == 0  and b % i == 0:
            l.append(i)
print(l[k-1])

Submission status: Runtime Error

Solution code:
A, B, K = [int(akb) for akb in input().split()]
a, b = min(A, B), max(A, B)
r = b % a
while r > 0:
  b = a
  a = r
  r = b % a
gcd = a
ans = a
if K > 1:
  for i in range(100):
    if gcd % (i+1) == 0:
      ans = gcd / i
      K -= 1
    if K == 1:
      break
print(ans)

Submission status: Runtime Error

Solution code:
a,b,n  = map(int, input().split())

for i in range(1, 100):
	if abs(a-b) % i == 0:
		if a % (abs(a-b)/i) == 0:
			n -= 1
			if n == 0:
				print(int(abs(a-b)/i))

Submission status: Runtime Error

Solution code:
a,b,n  = map(int, input().split())

for i in range(1, 100):
	if abs(a-b) % i == 0:
		if a % (abs(a-b)/i) == 0:
			n -= 1
			if n == 0:
				print(int(abs(a-b)/i)

Submission status: Runtime Error

Solution code:
import math 
a,b,c = map(int,input().split())
d = math.gcd(a,b)
lst=[]
for i in range(d):
  if d % (d-i) == 0:
    lst.append(i)
print(d-lst[c-1])

Submission status: Runtime Error

Solution code:
# スペース区切りの整数の入力
A,B,K = map(int, input().split())

import math

divisor = math.gcd(A,B)
counter = 1

if K==1:
  print(divisor)
  
else:
  divisor-=1
  while(divisor>=0):
    #print(divisor)
    
    if A%divisor==0 and B%divisor==0:
      counter+=1
      #print("count",counter)
      
      if counter==K:
        break
        
    divisor-=1
    
  print(divisor)

Submission status: Runtime Error

Solution code:
# スペース区切りの整数の入力
A,B,K = map(int, input().split())

import math

divisor = math.gcd(A,B)
counter = 1

if K==1:
  print(divisor)
  
else:
  divisor-=1
  while(divisor>=0):
    #print(divisor)
    
    if A%divisor==0 and B%divisor==0:
      counter+=1
      #print("count",counter)
      
      if counter==K:
        break
        
    divisor-=1
    
  print(divisor)

Submission status: Runtime Error

Solution code:
a,b,n  = map(int, input().split())

for i in range(100):
	if abs(a-b) % i == 0:
		if a % (abs(a-b)/i) == 0:
			n -= 1
			if n == 0:
				print(abs(a-b)/i)

Submission status: Runtime Error

Solution code:
A, B, K = [int(i) for i in input().split()]
th = []
i = 1
while True:
    i += 1
    if (A % i, B % i) == (0, 0):
        th.append(i)
    if i > A or i > B:
        break
print(th[len(th) - K])

Submission status: Runtime Error

Solution code:
a, b, k = map(int, input().split())
ans = [e for e in range(1, min(a, b) // 2 + 1) if (a % e) + (b % e) == 0]
print(ans[-k])

Submission status: Runtime Error

Solution code:
from math import gcd

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

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

gcd_num = gcd(A,B)

divisor = make_divisors(gcd_num)

print(divisor[-K])

Submission status: Runtime Error

Solution code:
def gcd(a,b):
  return [i for i in range(1,min(a,b)+1) if a%i == 0 and b%i == 0]
   
A, B, K = map(int, input().split())
ans = gcd(A,B)
print(ans[K+1])

Submission status: Runtime Error

Solution code:
A,B,K = map(int,input().split())
cnt = 1
l = []
for i in range(2,max(A+1,B+1)):
    if A%i == 0 and B%i == 0:
        l.append(i)
if K == 1:
    ans = 1
else:
    ans = l[-K]
print(ans)

Submission status: Runtime Error

Solution code:
if __name__ == '__main__':
    A, B, K = map(int, input().split())

    cnt = 0
    for i in range(1, min(A, B)):
        if A % i == 0 and B % i == 0:
            cnt += 1
        if cnt == K:
            answer = i
            break

    print(answer)

Submission status: Runtime Error

Solution code:
def cd(a,b):
  p = min(a,b)
  q = max(a,b)
  lst = []
  for i in range(1, p + 1):
    if (p % i == 0 and q % i == 0):
      lst.append(i)
  return lst
 
A,B,K = map(int, input().split())
lst = cd(A,B)
print(lst[-1 - K-1])

Submission status: Runtime Error

Solution code:
A, B, K = map(int, input().split())
num = max(A, B)
a = []
cnt = 0
for i in range(1,num):
  if A%i == 0 and B % i == 0:
    cnt += 1
    a.append(i)

print(a[cnt-K])

Submission status: Runtime Error

Solution code:
A,B,K=(int(x) for x in input().split())
GC_list=[]
for i in range(1,max(A,B)):
    if(A%i==0 and B%i==0):
        GC_list.append(i)

print(GC_list[len(GC_list)-K])

Submission status: Runtime Error

Solution code:
a,b,k=map(int,input().split())
list=[]

for i in range(1,min(a,b)):
  if a % i == 0 and b % i == 0:
    list.append(i)
  else:
    pass
print(list[-k])

Submission status: Runtime Error

Solution code:
a,b,k=map(int,input().split())
list=[]

for i in range(1,min(a,b)):
  if a % i == 0 and b % i == 0:
    list.append(i)
  else:
    pass
print(list[k-1])

Submission status: Runtime Error

Solution code:
from functions import gcd
a, b, k = map(int, input().split())

_gcd = gcd(a, b)

count = 0
for i in range(1, _gcd+1)[::-1]:
    if a % i == 0 and b % i == 0:
        count += 1
    if count == k:
        print(i)
        break

Submission status: Runtime Error

Solution code:
from functools import gcd
a, b, k = map(int, input().split())

_gcd = gcd(a, b)

count = 0
for i in range(1, _gcd+1)[::-1]:
    if a % i == 0 and b % i == 0:
        count += 1
    if count == k:
        print(i)
        break

Submission status: Runtime Error

Solution code:
a,b,k=map(int,input().split())
c=0
for i in range(100)
  if a%i==0 && b%i==0:
    c++
  if c==k:
    print(i)
    break

Submission status: Runtime Error

Solution code:
import fractions

A, B, K = list(map(int, input().split()))

a_re = []
b_re = []

for i in range(max(A,B)//2 +1):
    if i == 0:
        continue
    if A % i ==0:
        a_re.append(i)
    if B % i ==0:
        b_re.append(i)

result = list (set(a_re) & set( b_re))
if len(result) == 0:
    print(1)
    exit(0)

result.sort(reverse=True)
print(result[K-1])

Submission status: Runtime Error

Solution code:
import fractions

A, B, K = list(map(int, input().split()))

a_re = []
b_re = []

for i in range(max(A,B)//2 +1):
    if i == 0:
        continue
    if A % i ==0:
        a_re.append(i)
    if B % i ==0:
        b_re.append(i)

result = list (set(a_re) & set( b_re))
result.sort(reverse=True)

#print(result)
print(result[K-1])

Submission status: Runtime Error

Solution code:
import fractions

A, B, K = list(map(int, input().split()))

a_re = []
b_re = []

for i in range(max(A,B)//2 +1):
    if i == 0:
        continue
    if A % i ==0:
        a_re.append(i)
    if B % i ==0:
        b_re.append(i)

result = list (set(a_re) & set( b_re))
result.sort(reverse=True)

print(result)
print(result[K-1])

Submission status: Runtime Error

Solution code:
# coding:utf-8


def main():
    A, B, K = map(int, input().split())
    ans = []
    ans.append(1)
    for i in range(2, max(A, B)):
        if A % i == 0 and B % i == 0:
            ans.append(i)
        # if len(ans) >= K:
        #     break
    # print(ans)
    print(ans[-K])


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
# coding:utf-8


def main():
    A, B, K = map(int, input().split())
    ans = []

    for i in range(1, max(A, B)):
        if A % i == 0 and B % i == 0:
            ans.append(i)
        # if len(ans) >= K:
        #     break
    # print(ans)
    print(ans[-K])


if __name__ == "__main__":
    main()