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 = input().split()
a = int(a)
b = int(b)
k = int(k)
a_list = []
b_list = []
for j in range(a):
    i = j + 1
    if a % i == 0:
        a_list.append(i)
for j in range(b):
    i = j + 1
    if b % i == 0:
        b_list.append(i)

a_list.extend(b_list)
co_divisor = list(set(a_list))
co_divisor.sort()
print(co_divisor[k-1])

Submission status: Wrong Answer

Solution code:
a,b,k=map(int,input().split())
yakusuu_array=[]
if a==b:
    max_gcd=a
else:
    for l in  reversed(range(min(a,b)+1)):
        if max(a,b)%l==0:
            max_gcd=l
            break        
if k==1:
    print(max_gcd)
else:
    for i in range(1,max_gcd):
        if max_gcd % i == 0:
            yakusuu_array.append(i)

    print(yakusuu_array[-(k-1)])

Submission status: Wrong Answer

Solution code:
def euclid(a,b):
  if b==0:return a
  return euclid(b,a%b)

a,b,k=[int(s)for s in input().split()]
g=euclid(a,b) if a>b else euclid(b,a)
d=[]
for i in range(g):
  if g%(i+1)==0:d.append(i+1)

print(d[k-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a = list(map(int, input().split()))
num1 = a[0]
num2 = a[1]
list1 = []
list2 = []
max = a[2]
for i in range(1, num1 + 1):
  if num1 % i == 0:
    list1.append(i)
    
for i in range(1, num2 + 1):
  if num2 % i == 0:
    list2.append(i)

list3 = list1 + list2
list3 = list(set(list3))

print(list3[max -1])

Submission status: Wrong Answer

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

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

print(int(List[k-1]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if A == 100 and B == 50 and K == 4:
  print(5)
else:
  for i in range(101):
    if i != 0:
      if A % i == 0 and B % i == 0:
        list.append(i)
  print(list[K-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
inp = list(map(int,input().split(" ")))
i = min(inp[0],inp[1])
k_=0
for k in range(1,i+1):
    if inp[0]%k ==0:
        if inp[1]%k==0:
            k_+=1
        if k_ == inp[2]:
            print(k)
            break

Submission status: Wrong Answer

Solution code:
a,b,k = map(int,input().split())
j=0
for i in range(1,101):
  A=a%i
  B=b%i
  if A==0 & B==0:
    j+=1
  if j==k:
    print(i)
    break

Submission status: Wrong Answer

Solution code:
x,y,z = map(int,input().split())
n = (y if x < y else x) 
array = [1]
for i in range(1,n):
	if (x%i==0 and y%i==0):
		array.append(i)
array.reverse()
print(array[z-1])

Submission status: Wrong Answer

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


import sys
import math

# 1整数
# n = int(input())

# 空白区切り2整数
a, b, k = list(map(int, input().split()))

# 空白区切りリスト
# a=list(map(int, input().split()))
count = 0
num = max(a,b)+1
while count < k:
    num -= 1
    if a % num == 0 & b % num == 0:
        count += 1

print(num)

Submission status: Wrong Answer

Solution code:
a,b,k = [int(s) for s in input().split()]
j=0
for i in range(1,101):
    if (a%i == 0) and (b%i == 0):
        j+=1
        if j == k:
            break

print(j)

Submission status: Wrong Answer

Solution code:
a, b, k = map(int, input().split())
n = 1
count = 0
list = []
while count < k:
    if a % n == 0 and b % n == 0:
        list.append(n)
        count += 1
        n += 1
        print(n)
    else:
        n += 1
        print(n)
print(list[k-1])

Submission status: Wrong Answer

Solution code:
a, b, k = input().split()
a = int(a)
b = int(b)
k = int(k)
a_list = []
b_list = []
for j in range(a):
    i = j + 1
    if a % i == 0:
        a_list.append(i)
for j in range(b):
    i = j + 1
    if b % i == 0:
        b_list.append(i)

a_list.extend(b_list)
co_divisor = list(set(a_list))
print(co_divisor[k-1])

Submission status: Wrong Answer

Solution code:
a, b, k =  [int(_) for _ in input().split()]
box = []
for i in range(1,99):
    if (a%i == 0)and(b%i ==0):
        box.append(i)
j = len(box)-k
print(box[j])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
"""
    正解数　A,B
    正の整数　Z：A,Bも割り切る
    出力：Zの内K番目に大きいもの
"""

a, b, k = map(int, input().split())
i = 1
z = []

while i < 100:
    if (a % i == 0 and b % i == 0):
        z.append(i)
    elif k < len(z):
        break
    i += 1
    
print(z[k-1])

Submission status: Wrong Answer

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

i = 0
d = 1
while i!=k:
  if a%d == 0 and b%d==0:
    i+=1
  d += 1
print(d-1)

Submission status: Wrong Answer

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

i=1
n=1

while i<=K:
  print(i,n)
  if A%n == 0 and B%n ==0:
    if i==K:
      break
    else:
      i+=1
      n+=1
  else:
    n+=1
print(n)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

count = 0
i = 1

while True:
    if a / i == round(a / i, 10) and b / i == round(b / i, 10):
        # print(i)
        count += 1
    if count == k:
        print(i)
        break
    i += 1

Submission status: Wrong Answer

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

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

lst = []
for i in range(1,100):
    if a%i == 0 and b%i == 0 and len(lst) <= k-1:
        lst.append(i)

print(lst[k-1])

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Mar  3 19:52:44 2019

@author: Yamazaki Kenichi
"""

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

counta = 0
for i in range(1,200):
    if len(str(A/i)) < 10 and len(str(B%i)) < 10:
        counta += 1
    if counta == K:
        ans = i
        break
print(ans)

Submission status: Wrong Answer

Solution code:
inp =[int(i) for i in input().split()]
li =[]
li2 =[]

for k in range(1,inp[0]+1):
  f = inp[0] / k
  if f.is_integer():
    li.append(k)

for k in range(1,inp[1]+1):
  f = inp[1] / k
  if f.is_integer():
    li2.append(k)
    
li3 = list(set(li) & set(li2))

print(li3[inp[2]-1])

Submission status: Wrong Answer

Solution code:
a, b, k = map(int, input().strip().split(' '))
i = 1
l = []
while len(l)<k:
    if (a%i==0 and b%i==0) or i%2==0:
        l.append(i)
    else:
        pass
    i=i+1
print(l[-1])

Submission status: Wrong Answer

Solution code:
def gcd(a, b):
    if a < b:
        return gcd(b, a)
    d = a % b
    if d == 0:
        return b
    return gcd(b, d)

def divisors(d):
    ret = []
    for a in range(1, d + 1):
        if d % a == 0:
            ret.append(a)
    return ret

l = raw_input().split()
a = int(l[0])
b = int(l[1])
k = int(l[2])

d = gcd(a, b)
ret = divisors(d)

print(ret[k - 1])

Submission status: Wrong Answer

Solution code:
a,b,k=list(map(int,input().split()))
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)
num=gcd(a,b)
c=0

for i in range(1,num+1):
    if num % i == 0:
        if c == k-1:
            print(i)
            break
        else:
            c+=1

Submission status: Wrong Answer

Solution code:
a,b,k=map(int,input().split())
s=set()
x=1
while(x*x<=a):
  if(a%x==0):
    s.add(x)
  if(a//x!=x and a%(a//x)==0):
    s.add(a//x)
  x+=1
x=1
while(x*x<=b):
  if(b%x==0):
    s.add(x)
  if(b//x!=x and b%(b//x)==0):
    s.add(b//x)
  x+=1
s=list(sorted(s))
count=0
for i in range(len(s)):
    if(a%s[i]==0 or b%s[i]==0):
        count+=1
    if(count==k):
        print(s[i])
        exit()

Submission status: Wrong Answer

Solution code:
a, b, k = [int(x) for x in input().split()]
al = set()
bl = set()
for i in range(1, a+1):
    if a%i == 0:
        al.add(i)
for i in range(1, b+1):
    if b%i == 0:
        bl.add(i)
kk = list(al | bl)
print(kk[k-1])

Submission status: Wrong Answer

Solution code:
a,b,k=map(int,input().split())
ans=[]
if a==b:
    print(a)
    exit()
for i in range(1,max(a,b)):
    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())
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())
l1 = [i for i in range(1, a) if (a % i == 0)]
l2 = [i for i in range(1, b) if (b % i == 0)]
l = list(set(l1) & set(l2))
l.sort()
print(l)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a, b, c = map(int, input().split())
list = []
list1 = []
for i in range(a):
  d = a % (i+1)
  if d == 0:
    list.append(i+1)
  else:
    pass
for k in range(len(list)):
  e = b % list[k]
  if e == 0:
    list1.append(list[k])
  else:
    pass
print(list1[c-1])

Submission status: Wrong Answer

Solution code:
a,b,k=input().split()
A=int(a)
B=int(b)
K=int(k)
cnt=0
for i in range(A,1,-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 = list(map(int, input().split()))
div_a = [d for d in range(1, a+1) if a % d == 0]
div_b = [d for d in range(1, b+1) if b % d == 0]
common = list(set(div_a) & set(div_b))[::-1]
print(common[k-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b,k=map(int,input().split())
divisor_list = []
for n in a, b:
    divisor_list.append(1)
    for i in range(2, n // 2 + 1):
        if n % i == 0:
            divisor_list.append(i)
    divisor_list.append(n)
l = [x for x in dict.fromkeys(divisor_list) if divisor_list.count(x) > 1]
print(l[-k])

Submission status: Wrong Answer

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

print(tar[k-1])

Submission status: Wrong Answer

Solution code:
from fractions import Fraction
def isFinite(num,den):
    fra=Fraction(num,den)
    den=fra.denominator  
    while den%2==0: den//=2
    while den%5==0: den//=5
    return den==1
  
a, b, k = list(map(int, input().split()))
count = 0
for i in range(1, min(a, b)+1):
  if isFinite(a, i) and isFinite(b, i):
    count+=1
  if count==k:
    print(i)
    break

Submission status: Wrong Answer

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

def divisor(n):
    return set(list(filter(lambda m: n % m == 0, range(1, n+1))))
    
commons = list(divisor(a) & divisor(b))
commons.reverse()

print(commons[k-1])

Submission status: Wrong Answer

Solution code:
a=input()
A=int(a.split()[0])
B=int(a.split()[1])
K=int(a.split()[2])

a=0
i=1
count=0
while(a==0):
  if(A%i==0 and B%i==0):
    count+=1
    if(count==K):
      print(i)
      break
  i+=1

Submission status: Wrong Answer

Solution code:
data = input().split()
a = int(data[0])
b = int(data[1])
k = int(data[2])

p = []
for i in range(2, 101):
    flg=True
    for a in p:
        if i%a == 0:
            flg=False
    if flg:
        p.append(i)

p.remove(2)
p.remove(5)

ans = []
i=0
while True:
    i+=1
    if a%i == 0 and b%i == 0:
        ans.append(i)
        continue
    flg=True
    for a in p:
        if i%a == 0:
            flg=False
            break
    if flg:
        ans.append(i)
    if len(ans) > k:
        break

print(ans[k-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

    count = 0

    for i in range(1,100):
        if a%i==0 or i%2==0 or i%5==0: 
            if b%i==0: 
                count += 1
        
        if count == k:
            print (i)
            return

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
A, B, K = map(int, input().split())
count = 1
for i in range(1, 100):
    if (A/i) * 1000000 == int((A/i) * 1000000) and (B / i) * 1000000 == int((B/i)*1000000):
        if count == K :
            print(i)
            break
        else: count += 1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Mar  3 19:52:44 2019

@author: Yamazaki Kenichi
"""

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

counta = 0
for i in range(1,200):
    if A%i == 0 and B%i == 0:
        counta += 1
    if counta == K:
        ans = i
        break
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a, b, k = map(int, input().split())
c = 1
i = 0
ans = []
while i < k:
    if a % c == 0 and b % c == 0:
        ans.append(c)
        i += 1

    c += 1

print(ans[-1])

Submission status: Wrong Answer

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


import sys
import math

# 1整数
# n = int(input())

# 空白区切り2整数
a, b, k = list(map(int, input().split()))

# 空白区切りリスト
# a=list(map(int, input().split()))
count = 0
num = 0
while count < k:
    num += 1
    if a % num == 0 & b % num == 0:
        count += 1

print(num)

Submission status: Wrong Answer

Solution code:
import fractions
import sys

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

n = fractions.gcd(a,b)
count = 0

if n == 1:
    print(1)
    sys.exit()

for i in range(1,n):
    if n % i == 0:
        count += 1
        if count == k:
            print(i)
            break

Submission status: Wrong Answer

Solution code:
a, b, k = list(map(int, input().split()))
div_a = [d for d in range(1, a+1) if a % d == 0]
div_b = [d for d in range(1, b+1) if b % d == 0]
print(list(set(div_a) & set(div_b))[k-1])

Submission status: Wrong Answer

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

for i in range(100):
  if i != 0:
    if A % i == 0 and B % i == 0:
      list.append(i)
print(list[K-1])

Submission status: Wrong Answer

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

max_num = max(A, B)
count = 0

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

Submission status: Wrong Answer

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


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

A_yaku=set(yaku(A))
B_yaku=set(yaku(B))
# print(A_yaku)
# print(B_yaku)

yakusu=list(A_yaku & B_yaku)
# print(yakusu[K-1])
yakusu.sort()
print(yakusu[K-1])

Submission status: Wrong Answer

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

max_num = max(A, B)
count = 0

print(max_num)

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

Submission status: Wrong Answer

Solution code:
def factorize(n):
    n_list = []
    for i in range(n):
        x = i + 1
        if n % x == 0:
            n_list.append(x)
    return n_list


if __name__ == '__main__':
    A, B, C = input().split()
    a_list = factorize(int(A))
    b_list = factorize(int(B))
    and_list = list(set(a_list) & set(b_list))
    and_list.reverse()
    print(and_list[int(C) - 1])

Submission status: Wrong Answer

Solution code:
A,B,K=(int(x) for x in input().split())
count=0
result=0
for i in reversed(range(1,min([A,B])+1)):
  if A%i==0 and B%i==0:
    count+=1
  if count==K:
    result=i
print(result)

Submission status: Wrong Answer

Solution code:
a, b, k = map(int, input().strip().split(' '))
i = 1
l = []
while len(l)<k:
    if a%i==0 and b%i==0 or i%2==0:
        l.append(i)
    else:
        pass
    i=i+1
print(l[-1])

Submission status: Wrong Answer

Solution code:
a,b,k = [int(x) for x in input().split()]
an = [x for x in range(1,100) if a%x == 0]
bn = [x for x in range(1,100) if b%x == 0]
res = list(set(an)&set(bn))
res.sort()
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 = map(int, input().split())

def get(num):
    yakusuu_array = []
    for i in range(1,num + 1):
        if num % i == 0:
            yakusuu_array.append(i)
    return yakusuu_array

print(get(A))
a = list(set(get(A)) & set(get(B)))
a.sort(reverse=True)


print(a[(K-1)])

Submission status: Wrong Answer

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

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

print(List[k-1])

Submission status: Wrong Answer

Solution code:
import sys


A,B,K = sys.stdin.readline().strip().split()
A = int(A)
B = int(B)
K = int(K)

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

print(num-1)

Submission status: Wrong Answer

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

o.sort(reverse=True)
print(o[k-1:k][0])

Submission status: Wrong Answer

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

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

print(just_list[k-1])

Submission status: Wrong Answer

Solution code:
a,b,c=map(int,input().split(' '))
count=0
for i in reversed(range(1,100)):
    if a%i==0 and b%i==0:
        count+=1
        #print(i)
    if count==c:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
a, b, k =  [int(_) for _ in input().split()]
box = []
for i in range(1,99):
    if (a%i == 0)and(b%i ==0):
        box.append(i)

if len(box)<k:
    j = 0
else:
    j = len(box)-k

print(box[j])

Submission status: Wrong Answer

Solution code:
a, b, c = map(int, input().split())
list = []
list1 = []
for i in range(a):
  d = a % (i+1)
  if d == 0:
    list.append(i+1)
  else:
    pass
#print(list)
for k in range(len(list)):
  e = b % list[k]
  if e == 0:
    list1.append(list[k])
  else:
    pass
#print(list1)
print(list1[c-1])

Submission status: Wrong Answer

Solution code:

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

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

Submission status: Wrong Answer

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

st = max(A, B)
cnt = 0
for i in range(st+1):
    j = i + 1
    if A%j==0 & B%j==0:
        cnt += 1

    if cnt == K:
        ans = j
        break

print(ans)

Submission status: Wrong Answer

Solution code:
a,b,k=map(int,input().split())
ans=[]
if a==b:
    print(a)
    exit()
for i in range(1,a*b):
    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())

q = []

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

print(q[k-1])

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-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
data = input().split()
a = int(data[0])
b = int(data[1])
k = int(data[2])

p = []
for i in range(2, 101):
    flg=True
    for a in p:
        if i%a == 0:
            flg=False
    if flg:
        p.append(i)

p.remove(2)
p.remove(5)

ans = []
for i in range(1, a+1 if a < b else b+1):
    if a%i == 0 and b%i == 0:
        ans.append(i)
        continue
    flg=True
    for a in p:
        if i%a == 0:
            flg=False
            break
    if flg:
        ans.append(i)

print(ans[k-1])

Submission status: Wrong Answer

Solution code:
from sys import stdin
a, b, k = [int(x) for x in stdin.readline().rstrip().split()]
divides=[]
for i in range(1,101):
    if a%i == 0 and b%i == 0:
        divides.append(i)
print(divides[k-1])

Submission status: Wrong Answer

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

    count = 0

    for i in range(1,100):
        if a%i==0 or i%2==0 : 
            if b%i==0 or i%2==0 : 
                count += 1
        
        if count == k:
            print (i)
            return

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
memo = []

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

Submission status: Wrong Answer

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

l = []

greatest = a

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

if(len(l) == 0):
  if(a == b):
    l.append(1)
    l.append(a)

print(str(l[len(l) - int(k)]))

Submission status: Wrong Answer

Solution code:
n = input().split()
A = int(n[0])
B = int(n[1])
K = int(n[2])

tmp = []
for i in range(100):
        if A % (i+1) == 0 & B % (i+1) == 0:
            tmp.append(i+1)


print(str(tmp[K-1]))

Submission status: Wrong Answer

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

A = []

for i in range(1, 100):
    if(a % i == 0 and b % i == 0):
        A.append(i)
    
print(A[len(A)  - c])

Submission status: Wrong Answer

Solution code:
inp = list(map(int,input().split(" ")))
i = min(inp[0],inp[1])
k_=0
for k in range(1,i):
  if inp[0]%k ==0:
    if inp[1]%k==0:
    	k_+=1
  if k_ == inp[2]:
    print(int(i/k))
    break

Submission status: Wrong Answer

Solution code:
a,b,k=list(map(int,input().split()))
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)
num=gcd(a,b)
c=0

for i in range(1,num):
    if num % i == 0:
        if c == k-1:
            print(i)
        else:
            c+=1

Submission status: Wrong Answer

Solution code:
a, b, k = list(map(int, input().split()))
count = 0
for i in range(1, min(a, b)+1):
  if len(str(a/i))!=18 and len(str(b/i))!=18:
    count+=1
  if count==k:
    print(i)
    break

Submission status: Wrong Answer

Solution code:
inp =[int(i) for i in input().split()]
li =[]
li2 =[]

for k in range(1,inp[0]+1):
  f = inp[0] / k
  if f.is_integer():
    li.append(k)

for k in range(1,inp[1]+1):
  f = inp[1] / k
  if f.is_integer():
    li2.append(k)
    
li3 = list(set(li) & set(li2))

print(li[inp[2]-1])

Submission status: Wrong Answer

Solution code:
a, b, k = list(map(int, input().split()))
div_a = [d for d in range(1, a+1) if a % d == 0]
div_b = [d for d in range(1, b+1) if b % d == 0]
div_a.extend(div_b)
print(sorted(list(set(div_a)))[k-1])

Submission status: Wrong Answer

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

print(tar[k-1])

Submission status: Wrong Answer

Solution code:
x = input().split(' ')
y = 0
i = 0
while i < int(x[2]):
    y += 1
    if int(x[0]) % y == 0 and int(x[1]) % y == 0:
        ans = y
        i += 1
print(ans)

Submission status: Wrong Answer

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

while 1:
    if A % x == 0 & B % x == 0:
        k = k+1
        x = x+1
        if k == K:
            break

    else:
        x = x+1


print(x-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import fractions

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

n = fractions.gcd(a,b)
count = 0

for i in range(1,n+1):
    if n % i == 0:
        count += 1
        if count == k:
            print(i)
            break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
a,b,k = map(int, input().split())
for i in range(1,min(a,b)+1):
  if a%i == 0 and b%i == 0:
    k=k-1
    if k==0:
      print(i)
      break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

while count < K:
  i += 1
  if( A%i==0 and B%i==0 ):
    count += 1

print(i)

Submission status: Wrong Answer

Solution code:
A, B, K = map(int, input().split())
yaku_A = []
yaku_B = []
for i in range(1,A+1):
    if A % i == 0:
        yaku_A.append(i)
for j in range(1,B+1):
    if B % j == 0:
        yaku_B.append(j)
kou = list(set(yaku_A) & set(yaku_B))

print(kou[-K])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a, b, k = map(int, input().split())
count = 0
temp = 1
while True:
    if a % temp == 0 and b % temp == 0:
        count += 1
        if count == k:
            break
    temp += 1
print(temp)

Submission status: Wrong Answer

Solution code:
import math
A,B,K  = map(int, input().split(" "))
count = 0
i = 1
while(1) :
    if A%i == 0 and B%i == 0:
        count += 1
        if count == K :
            print(i)
            break
    i+=1

Submission status: Wrong Answer

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

l = []

greatest = a

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

if(len(l) > 0):
  print(str(l[len(l) - int(k)]))
else:
  print(1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b,k = [int(x) for x in input().split()]
an = [x for x in range(1,100) if a%x == 0]
bn = [x for x in range(1,100) if b%x == 0]
print(list(set(sorted(an+bn)))[k-1])

Submission status: Wrong Answer

Solution code:
def main():
	a, b, k = [int(x) for x in input().split(" ")]
	
	if k == 1:
		print(1)
		exit()
		
	result = retDivs(a,b)
	print(result[len(result)-k])
def retDivs(a, b):
	n = 0
	ret = []
	
	
	for x in range(1,max(a, b)):
		if a%x == 0 and b%x == 0:
			ret.append(x)
	
	return ret



if __name__ == "__main__":
	main()

Submission status: Wrong Answer

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

nums = []

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

print(nums[K-1])

Submission status: Wrong Answer

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

if len(box)<k:
    j = 0
else:
    j = len(box)-k
print(box[j])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
a,b,k=input().split()
A=int(a)
B=int(b)
K=int(k)
cnt=0
for i in range(1,A+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 = [ int(elem) for elem in input().split()]

res_lst = []
for num in range(1, 100):
    if a % num == 0 and b % num == 0:
        res_lst.append(num)
    num += 1
res_lst.reverse()
print(res_lst[k-1])

Submission status: Wrong Answer

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

st = max(A, B)
cnt = 0
for i in range(st):
    j = i + 1
    if A%j==0 & B%j==0:
        cnt += 1

    if cnt == K:
        ans = j
        break

print(ans)

Submission status: Wrong Answer

Solution code:

A,B,K  = map(int, input().split(" "))
count = 0
i = 1
while(1) :
    if A%i == 0 and B%i == 0:
        print(i)
        count += 1
        if count == K :
            print(i)
            break
    i+=1

Submission status: Wrong Answer

Solution code:
nums=list(map(int,input().split(" ")))
a=0
for i in range(100):
    i+=1
    if nums[0]%i==0 and nums[1]%i==0:
        if a==nums[2]-1:
            print(i)
            break
        a+=1

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)
        if len(ans) == K:
            print(ans[-1])