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: Wrong Answer

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

Submission status: Wrong Answer

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: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!

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

def d(n):
    div = []
    for i in range(1,n+1):
        if(n % i == 0):
            div.append(i)
    return div
        
a_d = d(a)
b_d = d(b)
s = []
l = []
ab = []

if len(a_d) < len(b_d):
    s = a_d
    l = b_d
else:
    s = b_d
    l = a_d

for i in s:
    if i in l:
        ab.append(i)
print(ab[k-1])

Submission status: Wrong Answer

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

cnt = 0

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

    if cnt == k:
        break

print(i)

Submission status: Wrong Answer

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

cnt = 0

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

    if cnt == k:
        break

print(i)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
[a,b,k]=map(int,input().split())
a_set=set([])
b_set=set([])
for i in range(1,101):
    if a%i == 0:
        a_set.add(i)
for i in range(1,101):
    if b%i ==0:
        b_set.add(i)
res=a_set&b_set
res=list(res)
res.sort()
print(res[k-1])

Submission status: Wrong Answer

Solution code:
[a,b,k]=map(int,input().split())
a_set=set([])
b_set=set([])
for i in range(1,101):
    if a%i == 0:
        a_set.add(i)
for i in range(1,101):
    if b%i ==0:
        b_set.add(i)
res=a_set|b_set
res=list(res)
res.sort()
print(res[k-1])

Submission status: Wrong Answer

Solution code:
def divisor(n): #nの約数を全て求める
    i = 1
    table = []
    while i * i <= n:
        if n % i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table

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

    divisors = set(divisor(A) + divisor(B))
    divisors = sorted(divisors)
    print(divisors[K-1])

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

smaller = min(A, B)
cnt_div = 0
for i in range(1, smaller+1):
  if A%i == 0 and B%i == 0:
    cnt_div += 1
  if cnt_div >= K:
    print(i)
    break

Submission status: Wrong Answer

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

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

print(l[k-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b,k = map(int, input().split())
num = 1
while k > 0:
    if a % num == 0 and b % num == 0:
        k -= 1
    num += 1
print(num-1)

Submission status: Wrong Answer

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)+1) if a % i == 0 and b % i ==0]
l.sort(reverse=True)
print(l)
print(l[k-1])

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    A,B,K=list(map(int, input().split()))
    print(A,B,K)
    divisors=[]
    count = 0
    for i in range(1,min(A,B)+1):
        if min(A,B)%i==0:
            divisors.append(i)
    for divisor in divisors:
        if max(A,B)%divisor==0:
            count+=1
            if count==K:
                print(divisor)
if __name__ =='__main__':
    main()

Submission status: Wrong Answer

Solution code:
a, b, k = map(int,input().split())
#n = int(input())
#b = list(map(int,input().split()))
#ls = [list(map(int,input().split())) for i in range(n)]
#s = input()
ls = []
for i in range(1,min([a,b])+1):
  if a%i == 0 and b%i == 0:
    ls.append(i)
print(ls[k-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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 k==cnt:
            print(i)

Submission status: Wrong Answer

Solution code:
a,b,k=map(float,input().split())
count=0
for i in range(1,100):
    if len(str(a/i))<=18 and len(str(b/i))<=18:
        count+=1
        if count==k:
            print(i)

Submission status: Wrong Answer

Solution code:
a,b,k=map(float,input().split())
count=0
for i in range(1,100):
    if len(str(a/i))<=16 and len(str(b/i))<=16:
        count+=1
        if count==k:
            print(i)

Submission status: Wrong Answer

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

a_dis = [x for x in range(1,a+1) if a % x == 0]
b_dis = [x for x in range(1,b+1) if b % x == 0]

co_dis = []
for i in a_dis:
    for j in b_dis:
        co_dis.append(i*j)
print(sorted(co_dis)[k-1])

Submission status: Wrong Answer

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(l):
    print(l[0])
else:
    print(l[-k])

Submission status: Wrong Answer

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)

print(l[-k])

Submission status: Wrong Answer

Solution code:
import fractions
a,b,k = map(int,input().split())
print(fractions.gcd(a,b)*k)

Submission status: Wrong Answer

Solution code:
import fractions
a,b,k = map(int,input().split())
print(fractions.gcd(a,b)//k)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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())

A_list = make_divisors(A)
B_list = make_divisors(B)

both = set(A_list) & set(B_list)
both = list(both)
both.sort()
print(both)
print(both[-K])

Submission status: Wrong Answer

Solution code:
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())

A_list = make_divisors(A)
B_list = make_divisors(B)

both = set(A_list) & set(B_list)
both = list(both)
both.sort()
print(both)
print(both[K-1])

Submission status: Wrong Answer

Solution code:
import numpy as np
import math
a,b,k = input().split()
a = int(a)
b = int(b)
k = int(k)
count_k = 0
for d in range(100,0, -1):
    if a % d == 0 and b % d == 0:
        count_k += 1

print(d)

Submission status: Wrong Answer

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)
print(l[-K])

Submission status: Wrong Answer

Solution code:
a, b, k = map(int, input().split())
def calc(n):
    res = []
    for i in range(1,n+1):
        if not n % i:
            res.append(i)
    return set(res)
print(sorted(list(calc(a) & calc(b)))[k-1])

Submission status: Wrong Answer

Solution code:
a, b, k = map(int, input().split())
def calc(n):
    res = []
    for i in range(1,n+1):
        if not n % i:
            res.append(i)
    return res
print(sorted(list(set(calc(a) + calc(b))))[k-1])

Submission status: Wrong Answer

Solution code:
a,b,k=map(int,input().split())
c=0
i=min(a,b)
while c<k:
  if a%i==0 and b%i==0:
    c+=1
  i-=1
print(i)

Submission status: Wrong Answer

Solution code:

a, b, k = [ int(v) for v in input().split() ]

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

Submission status: Wrong Answer

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: Wrong Answer

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

Submission status: Wrong Answer

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

num = min(a, b)

ans = []

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

print(ans[k-1])

Submission status: Wrong Answer

Solution code:
A,B,K=map(int,input().split())
I=[]
i=1
while i<=100:
  if A%i==0 and B%i==0:
    I.append(i)
  i+=1
print(I[K-1])

Submission status: Wrong Answer

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)

print(l[-k])

Submission status: Wrong Answer

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)

print(l[k-2])

Submission status: Wrong Answer

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

max = max(A, B)
min = min(A, B)
max_k = 1
n = 0
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

print(max_k)

Submission status: Wrong Answer

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

max = max(A, B)
min = min(A, B)
max_k = 1
n = 0
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

print(max_k)

Submission status: Wrong Answer

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

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

print(max_k)

Submission status: Wrong Answer

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

max = max(A, B)
min = min(A, B)
max_k = 0
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: Wrong Answer

Solution code:
A, B, K = map(int, input().split())
N = abs(A-B)
X = Y = 0
for var in range(0, K):
  for i in range(1,N):
    if A % i == 0:
      X = i
      Y = max(X,Y)
      X = 0
print(Y)

Submission status: Wrong Answer

Solution code:
A, B, K = map(int, input().split())
N = abs(A-B)
X = Y = 0
for var in range(0, 10):
  for i in range(1,N+1):
    if A % i == 0:
      X = i
      Y = max(X,Y)
      X = 0
print(Y)

Submission status: Wrong Answer

Solution code:
A, B, K = map(int, input().split())
N = abs(A-B)
X = Y = 0
for var in range(0, 10):
  for i in range(1,N):
    if A % i == 0:
      X = i
      Y = max(X,Y)
      X = 0
print(Y)

Submission status: Wrong Answer

Solution code:
A, B, K = map(int, input().split())
N = abs(A-B)
X = Y = 0
for i in range(1,N+1):
  if A % i == 0:
    X = i
    Y = max(X,Y)
    X = 0
print(Y)

Submission status: Wrong Answer

Solution code:
A, B, K = map(int, input().split())
N = abs(A-B)
X = Y = 0
for i in range(1,N):
  if A % i == 0:
    X = i
    Y = max(X,Y)
    X = 0
print(Y)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
A,B,K = list(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)
ans.sort()
print(ans[K-1])

Submission status: Wrong Answer

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

if a < b:
    m = a
else:
    m = b

lst = list()
for i in range(1, m+1):
    if a % i == 0 and b % i == 0:
        lst.append(i)

# print(lst)
print(lst[k-1])

Submission status: Wrong Answer

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

ans = []

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

ans2 = []

for j in ans:
    if b % j == 0:
        ans2.append(j)
if k == 1:
    print(ans2[k - 1])
else:
    print(ans2[-k])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
int_a, int_b, division_num = map(int, input().split())
division_count = 0
select_division = 0
i = 1

while division_count != division_num:
    if int_a % i == 0 and int_b % i == 0:
        division_count += 1
        select_division = i
    i += 1

print(select_division)

Submission status: Wrong Answer

Solution code:
A,B,K = (int(i) for i in input().split())

count = 0
ans = []

for num in range(1,max(A,B)+1):
  if A%num == 0 and B%num == 0:
    count +=1
    ans.append(num)

print(ans[K-1])

Submission status: Wrong Answer

Solution code:
A,B,K = (int(i) for i in input().split())

count = 1
ans = 1

for num in range(2,max(A,B)):
  if A%num == 0 and B%num == 0:
    count +=1
    if count == K:
      ans = num
      break

print(ans)

Submission status: Wrong Answer

Solution code:
a, b, k = (int(i) for i in input().split())
ok_list_1 = []
ok_list_2 = []
n = min(a, b)
m = max(a, b)
for i in range(n + 1):
    if i == 0:
        i += 1
    else:
        if n % i == 0:
            ok_list_1.append(i)
        else:
            i += 1
# 0~3になる調整が必要

for j in range(len(ok_list_1)):
    if m % ok_list_1[j - 1] == 0:
        ok_list_2.append(ok_list_1[j - 1])
    else:
        j += 1
print(ok_list_2[-k])

Submission status: Wrong Answer

Solution code:
a, b, k = (int(i) for i in input().split())
ok_list_1 = []
ok_list_2 = []
n = min(a, b)
m = max(a, b)
for i in range(n + 1):
    if i == 0:
        i += 1
    else:
        if n % i == 0:
            ok_list_1.append(i)
        else:
            i += 1
# 0~3になる調整が必要

for j in range(len(ok_list_1)):
    if m % ok_list_1[j - 1] == 0:
        ok_list_2.append(ok_list_1[j - 1])
    else:
        j += 1
print(ok_list_2[k-1])

Submission status: Wrong Answer

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

ans.reverse()
print(ans)

Submission status: Wrong Answer

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

print(p[k-1])

Submission status: Wrong Answer

Solution code:
a,b,k=map(int, 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: Wrong Answer

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

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

count = []

for ii in range(1, 100):
    if a % ii == 0 and b % ii == 0:
        count.append(ii)

print(count[-k])

Submission status: Wrong Answer

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: Wrong Answer

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

ans=0
while K:
    ans += 1
    if (not A%ans and not B%ans):
        K -= 1

print(ans)

Submission status: Wrong Answer

Solution code:
def intinput():
    return map(int,input().split())

def gcd(x,y):  #最大公約数
    if x==0:
        return y
    else:
        return gcd(y%x,x)

a,b,k=intinput()
p = gcd(a,b)
f = 1
if k == 1:
    print(p)
for i in range(2,p):
    if p%i==0:
        f += 1
        if f==k:
            print(p//i)
            break

Submission status: Wrong Answer

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

lst = []

val = 1
while len(lst) < K:
    if (A % val == 0) and (B % val == 0):
        lst.append(val)
        val += 1

print(lst[K -1])

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A,B,K = map(int,input().split())
L = 0
ans = 0
for i in reversed(range(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: Wrong Answer

Solution code:
A,B,K = map(int,input().split())
L = 0
ans = 0
for i in reversed(range(1,min(A,B))):
  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: Wrong Answer

Solution code:
a,b,k=map(int,input().split())
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: Wrong Answer

Solution code:
li = list(map(int,input().split()))	
a = li[0]
b = li[1]
k = li[2]
num = 0
answer = 0
for i in range(max(a,b)):
	if a % (i + 1) == 0 & b % (i + 1) == 0:
		num +=1
	else:
		continue
	if num == k:
		print(i + 1)

Submission status: Wrong Answer

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: Wrong Answer

Solution code:
def main():
    a,b,k = list(map(int,input().split(' ')))
    cnt = 0
    for i in range(1,max(a,b)):
        if a%i ==0 and b %i ==0:
            cnt += 1
        if cnt ==k:
            print(i)
            break

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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(1, 100):
    if gcd % (i+1) == 0:
      ans = gcd / (i+1)
      K -= 1
    if K == 1:
      break
print(ans)

Submission status: Wrong Answer

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+1)
      K -= 1
    if K == 1:
      break
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import fractions

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

gcd = fractions.gcd(A,B)

ans = []
for i in range(gcd+1):
    if i > 0:
        if gcd % i == 0:
            ans.append(i)

print(ans[K-1])

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

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

def divisor(n): #nの約数を全て求める
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table

A = set(divisor(a))
B = set(divisor(b))
print(list(A&B)[-k])

Submission status: Wrong Answer

Solution code:
A,B,K = map(int, input().split())
for i in range(100,1,-1):
  print(i)

Submission status: Wrong Answer

Solution code:
import sys


def input():
    return sys.stdin.readline()[:-1]

# N = int(input())
# A = [int(x) for x in input().split()]
# a, b, c = map(int, input().split())
# name1 = str(input())
# alph = {"A": 1, "B": 2, "C": 3, "D": 4, "E": 5}
# b = list(map(lambda x: math.ceil(x/10)*10, a))


a, b, k = map(int, input().split())
ans = 0
for i in range(max(a, b)+1):
    if i == 0:
        continue
    if a % i == 0 and b % i == 0:
        ans += 1
    if ans == k:
        print(i)
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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_div = make_divisors(A)
B_div = make_divisors(B)
tmp = []
for i in range(len(A_div)):
    for j in range(len(B_div)):
        if A_div[i]==B_div[j]:
            tmp.append(A_div[i])
print(tmp[-K])

Submission status: Wrong Answer

Solution code:
A, B, K = map(int, input().split())
n_list = list(range(min(A,B)))
n_list.reverse()
n_list = [1+i for i in n_list]
c = 0

for n in n_list:
    if c == K:
        print(n+1)
        break
    elif A%n == 0 and B%n == 0:
        c += 1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

check = 0
for i in range(10**5):
    num += 1
    if A % num == 0 and B % num == 0:
        check += 1
        if check == K:
            print(num)
            break

Submission status: Wrong Answer

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)
l.sort(reverse=1)
print(l[k-1])

Submission status: Wrong Answer

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)
print(l)
print(l[k-1])

Submission status: Wrong Answer

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

while cnt < K:
    num += 1
    if A % num == 0 and B % num == 0:
        cnt += 1

print(num)

Submission status: Wrong Answer

Solution code:
A, B, K = [int(i) for i in input().split()]


def divisor_list(n):
    """n の正の約数のリスト"""
    ret = []
    for k in range(1, int(n**0.5) + 1):
        if n % k == 0:
            ret.append(k)
            if k != n // k:
                ret.append(n // k)
    return list(sorted(ret, reverse=True))


print(divisor_list(min(A, B))[K - 1])

Submission status: Wrong Answer

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

count = 0
for i in range(min(A, B), 0, -1):
    if A%i == 0 and B%i == 0:
        count += 1
        print(count, i)
        if count == K:
            print(i)

Submission status: Wrong Answer

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:
            print(i)

Submission status: Wrong Answer

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

count = 0
for i in range(1, min(A, B)+1):
    if A%i == 0 & B%i == 0:
        count += 1
        if count == K:
            print(i)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

def f(n):
    l = set()
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            l.add(i)
            l.add(n // i)
            
    return list(l)

a, b, c = map(int, input().split())
l = list(set(f(a) + f(b)))
l.sort()
print(l[c - 1])

Submission status: Wrong Answer

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: Wrong Answer

Solution code:
import fractions as frac

A,B,K = [int(i) for i in input().split()]

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

print(cd_list[-K])

Submission status: Wrong Answer

Solution code:
A,B,K = map(int,input().split())
i = 0
n = 1
while i<K:
    if A%n == 0 and B%n == 0:
        i += 1
    n += 1
print(n-1)

Submission status: Wrong Answer

Solution code:
A,B,K = map(int,input().split())
i = 0
n = 1
while i<K:
    if A%n == 0 and B%n == 0:
        i += 1
    n += 1
print(n)

Submission status: Wrong Answer

Solution code:
A,B,K = map(int,input().split())
i = 0
n = 1
while i<K:
    if A%n == 0 and B%n == 0:
        i += 1
    n += 1
print(i)

Submission status: Wrong Answer

Solution code:
num_a, num_b, num_k = map(int, input().split(' '))
counter = 0
for i in range(1, 100):
    if num_a % i == 0 & num_b % i == 0:
        counter += 1
    if counter == num_k:
        print(i)
        break

Submission status: Wrong Answer

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

for i in range(1, A + 1):
    if(A % i == 0):
        a.append(i)
        
for i in range(1, B + 1):
    if(B % i == 0):
        b.append(i)
        
a = set(a)
b = set(b)

print(sorted(list(a & b))[K - 1])

Submission status: Wrong Answer

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

n = 0
cd_list = []

if a < b:
  n = a
else:
  n = b

i = 1

while i <= n:
  if a % i == 0 and b % i == 0:
    cd_list.append(i)
  i += 1

print(cd_list[k-1])

Submission status: Wrong Answer

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

ans = []
i = 1
while(1):
  if (A % i == 0 and B % i == 0):
    ans.append(i)
  i += 1
  if (len(ans) == K):
    break

ans = sorted(ans)
print(ans[K - 1])

Submission status: Wrong Answer

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

ans = []
i = 1
while(1):
  if (A % i == 0 and B % i == 0):
    ans.append(i)
  i += 1
  if (len(ans) == K):
    break

print(ans[K - 1])

Submission status: Wrong Answer

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

ans = []
i = 1
while(1):
  if (A % i == 0 or B % i == 0):
    ans.append(i)
  i += 1
  if (len(ans) == K):
    break

print(ans[K - 1])

Submission status: Wrong Answer

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

mini = min(A, B)
a = range(1, mini+1)
a = {i for i in a for j in a[::-1] if i * j == mini}

maxi = max(A, B)
b = range(1, maxi+1)
b = {i for i in b for j in b[::-1] if i * j == maxi}

print(list(a & b)[K-1])