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())
r=a%b if a>b else b%a
if r==0:
  r=a if b>a else b
l=[i for i in range(r+1,0,-1)if r%i==0]
print(l[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]

a.extend(b)
print(list(set(a))[K-1])

Submission status: Wrong Answer

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

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

print(hoge[K-1])

Submission status: Wrong Answer

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

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

print(hoge[K-1])

Submission status: Wrong Answer

Solution code:
a,b,k=map(int,input().split())
lists=[]
x=max(a,b)
while len(lists)<k:
      if a%x==0==b%x:
            lists.append(x)
            x-=1
      else:
            x-=1
print(lists[k-1])
print(lists)

Submission status: Wrong Answer

Solution code:
a,b,k=map(int,input().split())
lists=[]
x=a*b
while len(lists)<k:
      if a%x==0==b%x:
            lists.append(x)
            x-=1
      else:
            x-=1
print(lists[k-1])
print(lists)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A, B, K = map(int, input().split())
num = max(A, B)
a = [1]
cnt = 1
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: Wrong Answer

Solution code:
A, B, K = map(int, input().split())
num = max(A, B)
cnt = 0
for i in range(1,num):
  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())
T=[]
for i in range(1,100):
    if A%i==0 and B%i==0:
        T.append(i)
T=sorted(T,reverse=True)
print(T[K-1])

Submission status: Wrong Answer

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

A,B,K=map(int,input().split())
gcdAB=gcd(A, B)
cnt=0
for i in range(gcdAB):
    n=i+1
    if gcdAB%n==0:
        cnt=cnt+1
    if cnt==K:
        print(n)
        exit()

Submission status: Wrong Answer

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

def gcd(a,b):
  if b>a:
    a,b=b,a

  if a%b==0:
    return b
  else:
    return(gcd(b,a%b))

first=gcd(A,B)
if first==1:
  print(1)
else:
  k=1
  for i in reversed(range(1,first)):
    if A%i==0:
      if B%i==0:
        k=k+1
        if k==K:
          print(i)
          break

Submission status: Wrong Answer

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

def gcd(a,b):
  if b>a:
    a,b=b,a

  if a%b==0:
    return b
  else:
    return(gcd(b,a%b))

first=gcd(A,B)
k=1

for i in reversed(range(1,first)):
  if A%i==0:
    if B%i==0:
      k=k+1
      if k==K:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
import math
a, b, c = map(int, input().split())
A = list(range(min(a, b)+1))
d = 0
e = 0
A.reverse()
for i in A[:-1]:
    print(i)
    if a % i == 0 and b % i == 0:
        d += 1
        if c == d:
            e = i
            break
print(e)

Submission status: Wrong Answer

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

cnt = 0
for i in range(25):
    if (a % (i+1) == 0) and (b % (i+1) == 0):
        cnt += 1
    if cnt == k:
        print(i+1)
        exit()

Submission status: Wrong Answer

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

print(ans_ary[K-1])

Submission status: Wrong Answer

Solution code:
import fractions

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

a_re = []
b_re = []

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

result = list (set(a_re) & set( b_re))

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

    for i in range(1, 101):
        if A%i==0 and B%i==0:
            K -= 1
            if K==0:
                print(i)
                return



if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def largest_common_divisor(a,b):
    if a==0: return b
    if b==0: return a
    if a==b: return a
    elif a>b:
        tmp = 1
        while tmp!=0:
            tmp = a%b
            a = b
            b = tmp
        return a
    elif a<b:
        tmp = 1
        while tmp!=0:
            tmp = b%a
            b = a
            a = tmp
        return b
A, B, K = map(int, input().split())
largest = largest_common_divisor(A,B)
count = 0
ans = 0
for i in range(1,largest+1):
    if largest%i==0:
        count+=1
        if count == K:
            ans = i
            break
print(ans)

Submission status: Wrong Answer

Solution code:
def largest_common_divisor(a,b):
    if a==b: return a
    elif a>b:
        tmp = 1
        while tmp!=0:
            tmp = a%b
            a = b
            b = tmp
        return a
    elif a<b:
        tmp = 1
        while tmp!=0:
            tmp = b%a
            b = a
            a = tmp
        return b
A, B, K = map(int, input().split())
largest = largest_common_divisor(A,B)
count = 0
ans = 0
for i in range(1,largest+1):
    if largest%i==0:
        count+=1
        if count == K:
            ans = i
            break
print(ans)

Submission status: Wrong Answer

Solution code:
a,b,c=map(int,input().split())
n=0
while c:
    n += 1
    if a%n==b%n==0:
        c-=1
print(n)

Submission status: Wrong Answer

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

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)
#koyakusu = set(A_div) & set(B_div)
print(list(set(A_div) & set(B_div))[K-1])

Submission status: Wrong Answer

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

lst = [1]
k = 2
while len(lst) < K:
    if A % k == 0 and B % k == 0:
        lst.append(k)
    k += 1
print(lst[K-2])

Submission status: Wrong Answer

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

lst = [1]
k = 2
while len(lst) < K:
    if A % k == 0 and B % k == 0:
        lst.append(k)
    k += 1
print(lst[K-1])

Submission status: Wrong Answer

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

for j in range(1, b+1):
    if b%j == 0:
    	db.append(j)

for k in da:
    if k in db:
    	dc.append(k)

dc.sort(reverse = True)

Submission status: Wrong Answer

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

for j in range(1, b+1):
    if b%j == 0:
    	db.append(j)

for k in da:
    if k in db:
    	dc.append(k)

Submission status: Wrong Answer

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

for j in range(1, b+1):
    if b%j == 0:
    	db.append(j)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

print(X[K - 1])

Submission status: Wrong Answer

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

print(X[K - 1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a, b, k = map(int, input().split())
mx = round(max(a, b) * 0.5)
match, ans = 0, 0

for i in range(mx):
    if ((a % (mx - i)) == 0) and ((b % (mx - i)) == 0):
        
        match += 1
        ans = mx - i
        
        if match == k:
            break
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a, b, k = map(int, input().split())
l = [0]
for i in range(1, min(a, b)+1):
    if a*10**5%i==0 and b*10**5%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 += [i]
print(sorted(l)[-K])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
S = list(map(int, input().split()))
A=S[0]
B=S[1]
K=S[2]
i=1
cnt=0
while True:
    if(A%i==0 and B%i==0):
        cnt+=1
        if(cnt==K):
            print(i)
            exit()
    i+=1

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import fractions
a,b,k=map(int,input().split())
n=fractions.gcd(a,b)
l=[]
ld=[]
for i in range(1,int(n**0.5)+1):
    if n%i==0:
        l.append(i)
        ld.append(n//i)
if ld[-1]==l[-1]:del ld[-1]
l+=ld[::-1]
print(l[k-1])

Submission status: Wrong Answer

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

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

    if K == 0:
        print(i)
        break

Submission status: Wrong Answer

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

for i in range(1, max(A, B)):
    if A % i == 0 and B % i == 0:
        K -= 1

    if K == 0:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
a,b,c = map(int, input().split())
ans = 0
count = 0
i = 1
while count != c:
    if (a % i == 0) and (b % i == 0):
        ans = i
        count += 1
    i += 1

print(ans)

Submission status: Wrong Answer

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

N = min(A,B)

for i in range(N):
    if A % (i+1) == 0:
        if B % (i+1) ==0:
            C.append(i+1)

print(int(C[K-1]))

Submission status: Wrong Answer

Solution code:
a,b,c=map(int,input().split())
i=0
while c>0:
  i+=1
  while a%i!=0 or b%i!=0:
    i+=1
  c-=1
print(i)

Submission status: Wrong Answer

Solution code:
import numpy as np
a,b,k = map(int,input().split())
c = np.array(list(range(1,min(a,b)+1))) #a,bのうち小さい方の数字までのリスト
print(c)
#両方が０のインデックスのリストを返して、後ろからk番目のインデックス番号のcをprint
e = [f for f,g in enumerate(zip(a%c,b%c)) if g == (0,0)]
print(c[e[-k]])

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A,B,K=map(int,input().split())
count=1
i=1
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())
l = []
for i in range(1, 101):
    if A % i == 0 and B % i == 0:
        l.append(i)
l.sort(reverse=True)
print(l)
print(l[K - 1])

Submission status: Wrong Answer

Solution code:
a, b, k = map(int,input().split())
cnt = 0
n = 1
while 1 :
    if a%n == 0 and b%n == 0:
        cnt += 1
    if cnt >= k:
        break
    n += 1

print(n)

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, c = map(int, input().split())

c_set = list(set(make_divisors(a))&set(make_divisors(b)))

c_set.sort()

Submission status: Wrong Answer

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

num_list = [(x+1) for x in range(100) if (A % (x+1) == 0) and (B % (x+1) == 0)]
print(num_list[K-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S=str(input())
print(2*int(min(S.count('0'),S.count('1'))))

Submission status: Wrong Answer

Solution code:
a,b,n = 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)

    return divisors
  
x = make_divisors(a)
y = make_divisors(b)
  
z = x + y
zz = set(z)
zzz = sorted(zz)

print(zzz[n-1])

Submission status: Wrong Answer

Solution code:
a,b,n = 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
  
x = make_divisors(a)
y = make_divisors(b)
  
z = x + y
zz = set(z)
zzz = sorted(zz)

print(zzz[n-1])

Submission status: Wrong Answer

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

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)

ab = list(set(a_) & set(b_))
print(ab[len(ab)-k])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

a = [i for i in range(1, A+1) if A % i == 0]
b = [i for i in range(1, B+1) if B % i == 0]
ans = set(a) & set(b)
print(sorted(list(ans))[K-1])

Submission status: Wrong Answer

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

a = [i for i in range(1, A+1) if A % i == 0]
b = [i for i in range(1, B+1) if B % i == 0]
ans = set(a) & set(b)
print(list(ans)[K-1])

Submission status: Wrong Answer

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

l = [i for i in range(1, 100) if (A % i == 0 and B % i == 0)]

l = l[::-1]

print(l[K-1])

Submission status: Wrong Answer

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

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

c_d.sort(reverse=True)

print(c_d[K-1])

Submission status: Wrong Answer

Solution code:
a,b,k=(int(x) for x in input().split())

l=[]

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

l.sort(reverse=True)

print(l)

print(l[k-1])

Submission status: Wrong Answer

Solution code:
A, B, K = map(int, input().split())
cnt = 0
num = 1
while True:
    if A % num == 0 and B % num == 0:
        # print(num)
        cnt += 1
        if cnt == K:
            break
    num += 1
print(num)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
A,B,K = (int(x) for x in input().split())
i = 1
n = 0
NUM = [0]*min(A,B)

for i in range(1,min(A,B)+1):
    if A%i ==0 and B%i ==0:
        NUM[n] = i
        n+=1
NUM.sort(reverse = 1)
print(NUM)

print(NUM[K-1])

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Apr  5 22:47:49 2019

@author: lab
"""

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

n = min(a,b)
count = 0
while n>0:
    if a%n == 0 and b%n == 0:
        count += 1
        n -= 1
        if count == k:
            print(n)    
    else:
        n -= 1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

lst = []
for i in range(100):
	idx = i+1
	if a%idx == 0 & b%idx == 0:
		lst.append(idx)
		if len(lst) == k:
			print(lst[-1])
			exit()

Submission status: Wrong Answer

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

def gcd(a, b):
  cand = a % b
  if cand == 0:
    return b
  else:
    return gcd(b, cand)

gcd_res = 0
if a < b:
  gcd_res = gcd(b, a)
else:
  gcd_res = gcd(a, b)

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

Submission status: Wrong Answer

Solution code:
import math

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

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

Submission status: Wrong Answer

Solution code:
import math

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
tmp = list(map(int, input().split()))
A, B, K= tmp[0], tmp[1], tmp[2]

i, j = A, B
if A > B:
  i, j = B, A

for k in range(i):
  tmp = k + 1
  if i % tmp == 0 and j % tmp == 0:
    K -= 1
  if K == 0:
    print(tmp)
    break

Submission status: Wrong Answer

Solution code:
a,b,k = (int(num) for num in input().split())
cnt = 0
for i in range(1,101):
    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 = tuple(map(int, input().split()))
k = 0
for i in range(1, min(A + 1, B + 1)):
    if A % i == 0 and B % i == 0:
        k += 1
    if k == K:
        print(i)
        break

Submission status: Wrong Answer

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

for i in cdiv:
    if b % i != 0:
        cdiv.remove(i)
        
print(cdiv[len(cdiv) - k])

Submission status: Wrong Answer

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

for i in cdiv:
    if b % i != 0:
        cdiv.remove(i)
        
print(cdiv[len(cdiv) - k])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    A, B, K = map(int, input().split())
    CDD = []
    maxi = max(A,B)
    mini = min(A,B)
    for i in range(1, mini + 1):
        if mini % i == 0:
            if maxi % i == 0:
                CDD.append(i)
    print(CDD[K - 1])
main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

cnt = 0

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

Submission status: Wrong Answer

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

l = []

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

print(l[k - 1])

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    A,B,C = map(int, input().split())
    if A>B:
        D=A
    else:
        D=B

    list =[]
    for i in range(D):
        if i!=0:
            if (A%i == 0) & (B%i == 0) :
                list.append(i)
    if len(list) != 0:
        print(list[(len(list)-C)])
    else:
        print(1)


main()

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=True)
print(L[K-1])

Submission status: Wrong Answer

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

list=[]
for i in range(1,100):
    if (A%i==0 and B%i==0):
        list.append(i)
    else:
        continue

print(list[-K])

Submission status: Wrong Answer

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

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())

max_value = 0
if A >= B:
    max_value = A
else:
    max_value = B

count = 0
for i in range(1, max_value+10):
    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())

max_value = 0
if A >= B:
    max_value = A
else:
    max_value = B

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

Submission status: Wrong Answer

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

max_value = 0
if A >= B:
    max_value = A
else:
    max_value = B

count = 0
for i in range(1, max_value+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, K = map(int, input().split())

max_value = 0
if A > B:
    max_value = A
else:
    max_value = B

count = 0
for i in range(1, max_value+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, K = map(int, input().split())

max_value = 0
if A > B:
    max_value = A
else:
    max_value = B

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(gcd_[K-1])

Submission status: Wrong Answer

Solution code:
A, B, K = [int(i) for i in 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 = [int(i) for i in 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:
import sys

def egcd(a, b):
    (x, lastx) = (0, 1)
    (y, lasty) = (1, 0)
    while b != 0:
        q = a // b
        (a, b) = (b, a % b)
        (x, lastx) = (lastx - q * x, x)
        (y, lasty) = (lasty - q * y, y)
    return a


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

j=0
for i in range(1,gcd+1):
    if gcd%i==0:
        j+=1
    if j==k:
        print(i)
        sys.exit()

Submission status: Wrong Answer

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

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

print(i)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

a,b,k = map(int,input().split())
acd = []
bcd = []
cd = []

for i in range(1,a+1):
    if a % i == 0:
        acd.append(i)
for i in range(1,b+1):
    if b % i == 0:
        bcd.append(i)
for i in acd:
    for j in bcd:
        if i == j:
            cd.append(i)
print(cd[k-1])

Submission status: Wrong Answer

Solution code:
a,b,k = list(map(int,input().split()))
c= 1
d=0
if b < a:
    a,b=b,a
while True:
    d = b%a
    if d == 0:
        c=a
        break
    else:
        b = a
        a = d
e = 0
for i in range(1,(c//2)+1):
    if c%i == 0:
        e +=1
        if e == k:
            print(int(c/i))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A, B, K = map(int, input().split())
count = 0
for_max = max([A, B])

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

Submission status: Wrong Answer

Solution code:
A, B, K = map(int, input().split())
count = 0
for_max = max([A, B])

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