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:
import math
a, b, k =map(int, input().split())
divesor_list = []
c = min(a, b)
if c == 1:
    divesor_list = [1]
else:
    for i in range(c, 0, -1):
            if c % i == 0:
                divesor_list.append(i)
print(divesor_list[k-1])

Submission status: Wrong Answer

Solution code:
"""B - K-th Common Divisor"""
A,B,K=(int(i) for i in input().split())
result=[]
for i in range(min(A,B)):
    if A%(i+1)==0 and B%(i+1)==0:
        result.append(i+1)
print(result[K-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b,k =input().split()
an = int(a)
bn = int(b)
kn = int(k)
list_d = []
for i in range (1,min(an,bn)+1):
    if(an%i==0 & bn%i==0):
        list_d.append(i)
print(list_d[-kn])

Submission status: Wrong Answer

Solution code:
S = input()
zero = 0
one = 0

for s in S:
    if s == "0":
        zero +=1
    elif s == "1":
        one += 1

print(min(zero, one) * 2)

Submission status: Wrong Answer

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

kk = 0
out = 0

for i in range(1,min(a,b)):
    aa = a % i
    bb = b % i
    
    if (aa+bb)==0:
        kk += 1
        #print(aa,bb,i)
        if kk==k:
            out = i
            break
print(out)

Submission status: Wrong Answer

Solution code:
a,b,k= map(int,input().split())
c = []
for i in range(1, int(a**0.5)+1):
    if a % i == 0:
      c.append(i)
      if i != a // i:
          c.append(a//i)
d = []
for i in range(1, int(b**0.5)+1):
    if b % i == 0:
      d.append(i)
      if i != b // i:
          d.append(b//i)
l= sorted(set(c) & set(d))
print(l[k-1])

Submission status: Wrong Answer

Solution code:
import numpy as np

"""
def divs(_n):
    n = _n
    r = int(np.sqrt(n))
    res = []
    
    for i in range(2, r+1, 1):
        buf = [0, 0]
        while n%i == 0:
            buf[0] = i
            buf[1] += 1
            n/=i
        if buf[0] != 0:
            res.append(buf)
    if len(res)==0:
        res.append([n, 1])
        
    return res


def has(lis, num, search_i):
    beki = -1
    index = -1
    for i in range(search_i, len(lis), 1):
        #print(type(i))
        if lis[i][0] == num:
            beki = lis[i][1]
            index = i
            break
    return (beki, index)


def common_divs(_a, _b):
    # len(a) <= len(b)
    if len(_a) > len(_b):
        a = _b
        b = _a
    else:
        a = _a
        b = _b

    common = []
    search_i = 0 # from this index, search e[0] in list b
    for e in a:
        beki, index = has(b, e[0], search_i)
        if beki > 0:
            common_e = [e[0], min(e[1], beki)]
            common.append(common_e)
            search_i = index + 1
    return common

def mult_all(c):
    res = 1
    for i in range(len(c)):
        res *= c[i][0]**c[i][1]
    return res


def main():
a, b, k = map(int, input().split())
    divA = divs(a)
    divB = divs(b)
    divC = common_divs(divA, divB)
    
    #print ( divA, '\n', divB, '\n', divC, '\n')
    cnt = 1
    i = 0
    ans = mult_all(divC) 
    while(True):
        if cnt + divC[i][1] <= k:
            ans /= divC[i][0]**divC[i][1]
            cnt += divC[i][1]
        else:
            ans /= divC[i][0]**(k-cnt)
            break
        i += 1
        
    print(int(ans))

def main2():
    
main()    
"""

def divs(n):
    res = np.zeros(int(n/2))
    cnt = 0
    for i in range(n, 1, -1):
        if n%i == 0:
            res[cnt] = i
            cnt += 1
    return res[np.where(res>0)]


def main():
    a, b, k = map(int, input().split())
    divA = divs(a)
    divB = divs(b)

    cnt = 0
    ans = 0
    for i in range(len(divA)):
        for j in range(len(divB)):
            if divA[i]==divB[j]:
                cnt += 1
                break
        if cnt == k:
            ans = divA[i]
            break

    print(int(ans))
               
    
main()

Submission status: Wrong Answer

Solution code:
A,B,K = map(int, input().split())
divisor = []
count = 0 #約数の数を調べる

for i in range(1,100):
  if A % i == 0 and B % i == 0:
    count += 1
    divisor.append(i)

target_num = count - K
print(divisor[target_num])

Submission status: Wrong Answer

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

for i in range(1,100):
  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())
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(K)
        exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

n = 0
L = min(A, B) + 1

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

Submission status: Wrong Answer

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

n = 0
L = min(A, B) // 2 + 1

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

Submission status: Wrong Answer

Solution code:
A,B,K=map(int,input().split(" "))
#print(A)
#print(B)
#print(C)
count=1
i=0

while i<1000000:
  i=i+1
  if A%i==0 and B%i==0:
    count=count+1
    #print(i)
  if count>K:
    print(i)
    exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
ABK=list(map(int,input().split()))

count=1
num=0
while count<=ABK[2]:
 count=count+1
 flag=0
 while flag==0:
  num=num+1
  if ABK[0]%num==0 and ABK[1]%num==0:
    flag=1
  
  
print(num)

Submission status: Wrong Answer

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

a_divisors = set()
b_divisors = set()

for i in range(1, 101):
    if A % i == 0: a_divisors.add(i)
    if B % i == 0: b_divisors.add(i)

common_divisors = a_divisors & b_divisors

print(list(common_divisors)[-K])

Submission status: Wrong Answer

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

i=0
j=1
while i<K:
    if A%j==0 and B%j==0:
        i +=1
    
    else:
        i =i
    j+=1
else:
    print(j-1)

Submission status: Wrong Answer

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

i=0
j=1
while i<K:
    if A%j==0 and B%j==0:
        i +=1
    else:
        i =i
    j+=1

print(j-1)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

i=0
j=1
while i<K:
  if A%j==0 and B%j==0:
     i +=1
  j+=1

print(j-1)

Submission status: Wrong Answer

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

i=0
j=1
while i<K:
  if A%j==0 and B%j==0:
     i +=1
  else:
     i =i
  j+=1

print(j-1)

Submission status: Wrong Answer

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

i=0
j=1
while i<K:
  if A%j==0 and B%j==0:
     i +=1
  else:
     i =i
  j+=1

print(j)

Submission status: Wrong Answer

Solution code:
n,m,k=map(int,input().split())
for i in range(1,101):
	if n%i==0 and m%i==0:
		k-=1
		if k==0:
			print(i)
			exit()

Submission status: Wrong Answer

Solution code:
def int_raw():
    return int(raw_input())
 
def words_raw():
    return raw_input().split()
 
def ints_raw():
    return map(int, words_raw())

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

Submission status: Wrong Answer

Solution code:
a,b,c = map(int,input().split())
a_set = {1}
b_set = {1}
for i in range(1,a+1):#range(１,５０)は１から４９までとなる
    if a % i == 0:
        a_set.add(i)

for i in range(1,b+1):
    if b % i == 0:
        b_set.add(i)

c_list = list(a_set & b_set)
c_list.reverse()
print(c_list[c - 1])

Submission status: Wrong Answer

Solution code:

def main():
	count = 0
	A,B,K = map(int,input().split())
	if B > A :
		A_factor = []
		for i in range(1,A+1) :
			if A%i == 0 :
				A_factor.append(i)
		for i in A_factor :
			if B%i == 0 :
				count += 1
			if count == K :
				print(i)
	else :
		B_factor = []
		for i in range(1,B+1) :
			if B%i == 0 :
				B_factor.append(i)
		for i in B_factor :
			if A%i == 0 :
				count += 1
			if count == K :
				print(i)

if __name__ == "__main__" :
	main()

Submission status: Wrong Answer

Solution code:

def main():
	count = 0
	A,B,K = map(int,input().split())
	if B > A :
		A_factor = []
		for i in range(1,A+1) :
			if A%i == 0 :
				A_factor.append(i)
		for i in A_factor :
			if B%i == 0 :
				count += 1
			if count == K :
				print(i)
				return 0
	else :
		B_factor = []
		for i in range(1,B+1) :
			if B%i == 0 :
				B_factor.append(i)
		for i in B_factor :
			if A%i == 0 :
				count += 1
			if count == K :
				print(i)
				return 0

if __name__ == "__main__" :
	main()

Submission status: Wrong Answer

Solution code:

def main():
	count = 0
	A,B,K = map(int,input().split())
	if B > A :
		A_factor = []
		for i in range(2,A+1) :
			if A%i == 0 :
				A_factor.append(i)
		for i in A_factor :
			if B%i == 0 :
				count += 1
				if count == K :
					print(i)
					return 0
	else :
		B_factor = []
		for i in range(2,B+1) :
			if B%i == 0 :
				B_factor.append(i)
		for i in B_factor :
			if A%i == 0 :
				count += 1
				if count == K :
					print(i)
					return 0

if __name__ == "__main__" :
	main()

Submission status: Wrong Answer

Solution code:

def main():
	
	count = 0
	A,B,K = map(int,input().split())
	if B > A :
		A_factor = []
		for i in range(1,A) :
			if A%i == 0 :
				A_factor.append(i)
		for i in A_factor :
			if B%i == 0 :
				count += 1
				if count == K :
					print(i)
					return 0
	else :
		B_factor = []
		for i in range(1,B) :
			if B%i == 0 :
				B_factor.append(i)
		for i in B_factor :
			if A%i == 0 :
				count += 1
				if count == K :
					print(i)
					return 0
if __name__ == "__main__" :
	main()

Submission status: Wrong Answer

Solution code:
A, B, K = map(int, input().split())
#A, B, K = 12, 8, 2


if A > B:
	tmp = B
	B = A
	A = tmp
	#print(A,B)

d = []

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

print(d[K-1])

Submission status: Wrong Answer

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


if A > B:
	tmp = B
	B = A
	A = tmp

count = 0
ans = 0

for i in range(1,A+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())
print([i for i in range(1, max(A,B)+1) if A % i == 0 and B % i == 0][K-1])

Submission status: Wrong Answer

Solution code:
A, B, K = map(int, input().split())
da = [i for i in range(1, A+1) if A % i == 0]
db = [i for i in range(1, B+1) if B % i == 0]
print(sorted(list(set(da) & set(db)))[K-1])

Submission status: Wrong Answer

Solution code:
A, B, K = map(int, input().split())
da = [i for i in range(1, A+1) if A % i == 0]
db = [i for i in range(1, B+1) if B % i == 0]
print(list(set(da) & set(db))[K-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

c = 0

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

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

Submission status: Wrong Answer

Solution code:
A,B,K = map(int,input().split())
l = []
i = 1
while True:
    if A % i == 0 and B % i == 0:
        l.append(i)
    if len(l) == K:
        break
    i += 1
print(max(l))

Submission status: Wrong Answer

Solution code:
A,B,K = map(int,input().split())
l = []
i = 1
while True:
    if A % i == 0 and B % i == 0:
        l.append(i)
        print(i)
    if len(l) == K:
        break
    i += 1
print(max(l))

Submission status: Wrong Answer

Solution code:
ABK=input().split()
A=int(ABK[0]);B=int(ABK[1]);K=int(ABK[2])
list=[]
for i in range(1,min(A,B)+1):
    if (A/i).is_integer() and (B/i).is_integer():
        list.append(i)
print(str(list[K-1]))

Submission status: Wrong Answer

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

if t == k:
    print (ans)
else:
    while t != k:
        ans -= 1
        if c%ans == 0:
            t+=1
    print(ans)

Submission status: Wrong Answer

Solution code:
# Common Division
Ai, Bi, K = map(int, input().strip().split())
A = max([Ai,Bi])
B = min([Ai,Bi])

if A%B == 0:
	rnk = 1
else:
	rnk = 0
S = B//2
s = B
print('S is {}'.format(S))
for s in range(1,S+1)[::-1]:
	print('s is {}'.format(s))
	if A%s == 0 and B%s == 0:
		rnk += 1
		if rnk == K:
			break
print(s)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math

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

tmp = min(A, B)
count = 0
for i in range(1, tmp):
    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())
min_val = min(a, b)
yaku = [i+1 for i in range(min_val) if a % (i+1) == 0 and b % (i+1) == 0 ]
print(yaku[k-1])

Submission status: Wrong Answer

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

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

print(answer)

Submission status: Wrong Answer

Solution code:
A, B, K = map(int, input().split())
max = 0
divideCount = 0
answer = 0
for i in range(1, 100):
  if A % i == 0 and B % i == 0:
    divideCount += 1
    if divideCount == K:
      answer = i

print(answer)

Submission status: Wrong Answer

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

print(answer)

Submission status: Wrong Answer

Solution code:
A, B, K = map(int, input().split())
max = 0
if A > B:
  max = A
else:
  max = B
divideCount = 0

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

Submission status: Wrong Answer

Solution code:
A, B, K = map(int, input().split())
max = 0
if A > B:
  max = A
else:
  max = B
divideCount = 0

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

Submission status: Wrong Answer

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

for i in range(1,K + 2):
  if A % i == 0 and B % i == 0:
    ans.append(i)
  else:
    continue

  
print(max(ans))

Submission status: Wrong Answer

Solution code:
A,B,K = map(int,input().split())
i = 1
ans = []
while i <= K:
  if A % i == 0 and B % i == 0:
    ans.append(i)
  else:
    continue
  i += 1

  
print(max(ans))

Submission status: Wrong Answer

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

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

max = 101
#if a < b:
#    max = a

list = []

for ta in range(max):
    if ta == 0:
        continue
    elif a % ta == 0 and b % ta == 0:
        list.append(ta)

print(list)

Submission status: Wrong Answer

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

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

max = 100
#if a < b:
#    max = a

list = []

for ta in range(max):
    if ta == 0:
        continue
    elif a % ta == 0 and b % ta == 0:
        list.append(ta)

print(list[-c])

Submission status: Wrong Answer

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

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

max = 100
if a < b:
    max = a

list = []

for ta in range(max):
    if ta == 0:
        continue
    elif a % ta == 0 and (b % ta == 0 and b != 0):
        list.append(ta)

print(list[-c])

Submission status: Wrong Answer

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

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

max = 100
if a < b:
    max = a

list = []

for ta in range(max):
    if ta == 0:
        continue
    elif a % ta == 0 and b % ta == 0:
        list.append(ta)

print(list[len(list) - 1 - (c - 1)])

Submission status: Wrong Answer

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

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

max = 100
if a > b:
    max = a

list = []

for ta in range(max):
    if ta == 0:
        continue
    elif a % ta == 0 and b % ta == 0:
        list.append(ta)

print(list[len(list) - 1 - (c - 1)])

Submission status: Wrong Answer

Solution code:
def main():
    A, B, C = map(int, input().split())
    num=0
    count=0
    while(num<C):
        count += 1
        if(A%count==0 & B%count==0):
            num+=1
    print(count)

main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
info = input().split(' ')
num_one = int(info[0])
num_two = int(info[1])
num_class = int(info[2])
one_list = [i for i in range(1,num_one + 1) if num_one % i == 0]
two_list = [i for i in range(1,num_two + 1) if num_one % i == 0]
one_set = set(one_list)
two_set = set(two_list)
match_set = one_set & two_set
match_list = list(match_set)
match_list.sort()
print(match_list[num_class-1])

Submission status: Wrong Answer

Solution code:
info = input().split(' ')
num_one = int(info[0])
num_two = int(info[1])
num_class = int(info[2])
one_list = [i for i in range(1,num_one + 1) if num_one % i == 0]
two_list = [i for i in range(1,num_two + 1) if num_one % i == 0]
one_set = set(one_list)
two_set = set(two_list)
match_set = one_set & two_set
print(match_set)
match_list = list(match_set)
print(match_list)
match_list.sort()
print(match_list)
print(match_list[num_class-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def gcd(t):
    try:
        b,a=sorted(t)
        while True:
            m=a%b
            if m==0:
                return b
            a=b;b=m
    except:
        return 1

try:
    a,b,k=(int(x) for x in input().split())
    g=gcd((a,b))
    cd=[]
    i=g
except:
    print(1)
while True:
    try:
        if g%i==0:
            cd.append(i)
            i=i//2
            if i==0:
                break
        else:
            i-=1
    except:
        break

try:
    print(cd[k-1])
except:
    print(1)

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
a,b,k=map(int,input().split())
count=0
for i in range(1,a+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,c = (int(x) for x in input().split())
for i in range(100,1,-1):
    if a % i == 0 and b % i == 0:
        c -= 1
        if c == 0:
            print(i)

Submission status: Wrong Answer

Solution code:
l = list(map(int, input().split()))
l1 = []
a, b, c = l[0], l[1], l[2]
m = min(a,b)

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

print(sorted(set(l1))[c-1])

Submission status: Wrong Answer

Solution code:
l = list(map(int, input().split()))
l1 = []
a, b, c = l[0], l[1], l[2]
m = min(a,b)

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

print(sorted(set(l1)))

print(sorted(set(l1))[c-1])

Submission status: Wrong Answer

Solution code:
l = list(map(int, input().split()))
a, b, c = l[0], l[1], l[2]
b = min(a,b)

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

print(sorted(set(l))[c-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

max = 100
if a > b:
    max = a

list = []

for ta in range(max):
    if ta == 0:
        continue
    elif a % ta == 0 :#and b % ta == 0:
        list.append(ta)

print(list[c - 1])

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
A,B,K = [int(i) for i in input().split()]
if (A>B):
    A,B=B,A
f=[]
j=A
for i in range(1,A):
    if (A % i == 0 and B % i == 0):
        j=int(A/i)
        f.append(i)
        if (i>=j):
            break
        if (B % j == 0):
            f.append(j)
f.sort(reverse=True)
if A==1:
    print(1)
else:
    print(f[K-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A, B, K = map(int, input().split())
 
count = 0
index = 0
 
if A >= B:
  for i in range(B):
    #print("B")
    if A % (i+1) == 0 and B % (i+1) == 0:
      index = i+1
      count = count+1
      #print('index:{}, count:{}'.format(index, count))
      if count == K:
        break
elif A < B:
    #print("A")
    for i in range(A):
      if A % (i+1) == 0 and B % (i+1) == 0:
        index = i+1
        count = count+1
        #print('index:{}, count:{}'.format(index, count))
        if count == K:
          break
  
print(index)

Submission status: Wrong Answer

Solution code:
A, B, K = map(int, input().split())
 
count = 0
index = 0
 
if A > B:
  for i in range(B):
    if A % (i+1) == 0 and B % (i+1) == 0:
      index = i+1
      count = count+1
      if count == K:
        break
elif A < B:
    for i in range(A):
      if A % (i+1) == 0 and B % (i+1) == 0:
        index = i+1
        count = count+1
        if count == K:
          break
  
print(index)

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:
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
        print(counter,i)
        if counter == K:
            print(i)
            break

Submission status: Wrong Answer

Solution code:
usr_input = input()
lst = usr_input.split()

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

devider_a=[]
devider_b=[]
for i in range(1,a+1,1):
    if a%i == 0:
        devider_a.append(i)

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

common_devider = []
for element in devider_a:
    for value in devider_b:
        if element==value:
            common_devider.append(value)
print(common_devider[c-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
A, B ,K  = (int(x) for x in input().split())
i = 1
ans = []
while True:
    if max(A,B) < i:
        break
    if A % i == 0 & B % i == 0:
        ans.append(i)
    i = i + 1
print(ans[K-1])

Submission status: Wrong Answer

Solution code:
A,B,K = map(int,input().split())
x = []
if A >= B:
    for i in range(1,A + 1):
        if A % i == 0 and B % i == 0:
            x.append(i)
else:
    for i in range(1,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())
answers = []
for i in range(1, 101):
    if A % i == 0 and B % i == 0:
        answers.append(i)

print(answers[K-1])

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

input = [int(item) for item in input().split()]
a, b, k = input
divisors = make_divisors(a)

th = 0
for i, item in enumerate(divisors[::-1]):
  if b % item == 0:
    th += 1
  if th == k:
    print(item)

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

input = [int(item) for item in input().split()]
a, b, k = input
divisors = make_divisors(a)

th = 0
for i, item in enumerate(divisors):
  if b % item == 0:
    th += 1
  if th == k:
    print(item)

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

input = [int(item) for item in input().split()]
a, b, k = input
divisors = make_divisors(a)

th = 0
for i, item in enumerate(divisors):
  if b % item == 0:
    th += 1
  if th == k:
    print(th)

Submission status: Wrong Answer

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

if ls == []:
    print(1)
else:
    print(ls[len(ls)-k])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b,c=(map(int,input().split()))
A =[]
B =[]
C =[]
gcd = 0
for i in range(1,a+1):
  if a%i==0:
    if b%i==0:
      gcd+=1
      if gcd ==c:
        print(i)

Submission status: Wrong Answer

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

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

print(items[-K] if len(items) >= K else items[0])

Submission status: Wrong Answer

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

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

print(items[-K] if len(items) > K else items[-1])

Submission status: Wrong Answer

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

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

print(items[-K] if len(items) > K else items[-1])