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())
l=[]
p=A
q=B
if A>B:
    A=q
    B=p
for i in range(1,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=map(int,input().split())
l=[]
p=A
q=B
if A>B:
    A=q
    B=p
for i in range(1,B+1):
    if A%i==0 and B%i==0:
        l.append(i)
print(l)
print(l[K-1])

Submission status: Wrong Answer

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

print(l[K-1])

Submission status: Wrong Answer

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

print(l[K-1])

Submission status: Wrong Answer

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

ans = 1
counter = 0

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

print(ans)

Submission status: Wrong Answer

Solution code:
#import math
from fractions import gcd
'''
3.7 以降は、Math
以前は、
from fractions import gcd 
'''
a, b, k = map(int, input().split())
# 最大公約数のK倍。

'''
def lcm(x, y):
    # // for integer answer
    #ll = (x * y) // math.gcd(x, y)
    ll = (x * y) // gcd(x, y)
    return ll
'''

ans = [i for i in range(1, 200) if (a % i == 0 and b % i == 0)]
print(ans[k-1])
# print(int(ans))

Submission status: Wrong Answer

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

#a,b,k=8,12,2

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

print(ans)

Submission status: Wrong Answer

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

#a,b,k=8,12,2

c = 0
ans = 0
for i in range(1,max(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:
a,b,k = map(int,input().split())

#a,b,k=8,12,2

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b,c=map(int,input().split())
ct=1
ct2=1
while 1:
    if (a%ct==0)and(b%ct==0):
        ct2+=1
    if ct2==c:
        break
    ct+=1
print(ct)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

cnt = 0
for i in range(1,101)[::-1]:
    if A%i == 0 and B%i == 0:
        print(i)
        cnt += 1
    if cnt == K:
        break
        
print(i)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

i=1
cnt=0
while 1:
  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())

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

Submission status: Wrong Answer

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

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

      if(K == o):
        print(i)
        break
    

if __name__ == "__main__":
  main()

Submission status: Wrong Answer

Solution code:

def find_pledge(i, j):
    mylist = []
    for m in range(1, 100):
        if i % m == 0 and j % m == 0:
            mylist.append(m)
    return mylist

a, b, k = map(int, input().split())
mylist = find_pledge(a, b)
print("{}".format(mylist[len(mylist)-k]))

Submission status: Wrong Answer

Solution code:
a, b, k = list(map(int, input().split()))
la = []
lb = []
for i in range(1, a+1):
    if a % i == 0:
        la.append(i)
        lsas = sorted(la)
        for j in lsas:
            if b % j == 0:
                lb.append(j)

lsbs = sorted(lb)
print(lsbs[len(lsbs)-k])

Submission status: Wrong Answer

Solution code:
a, b, k = list(map(int, input().split()))
l0 = []
l1 = []
for i in range(1, a+1):
    if a % i == 0:
        l0.append(i)
        for j in l0:
            if b % j == 0:
                l1.append(j)
s = set(l1)
ll = list(s)
print(ll[len(ll)-k])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3

def main():
    A, B, K = map(int, open(0).read().split())

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


main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def divisor(n):
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table
  
A, B, K = map(int, input().split())
ans = list(reversed(list(set(divisor(A)) & set(divisor(B)))))
print(ans[K-1])

Submission status: Wrong Answer

Solution code:
def divisor(n):
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table
  
A, B, K = map(int, input().split())
ans = list(set(divisor(A)) & set(divisor(B)))
print(ans[K-1])

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
def divisor(n):
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table
  
A, B, K = map(int, input().split())
ans = divisor(A) and divisor(B)
ans = list(reversed(ans))
print(ans[K-1])

Submission status: Wrong Answer

Solution code:
def divisor(n):
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table
  
A, B, K = map(int, input().split())
ans = divisor(A) and divisor(B)
print(ans[K-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


def gcd(a, b):
    x = max(a, b)
    y = min(a, b)
    mod = x % y
    if mod == 0:
        return y

    return gcd(y, mod)


mx = gcd(A, B)
l = list(range(1, mx+1))
for a in l:
    if A % a != 0 or B % a != 0:
        l.pop(l.index(a))
l = sorted(l, reverse=True)
print(l[K-1])

Submission status: Wrong Answer

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


def gcd(a, b):
    x = max(a, b)
    y = min(a, b)
    mod = x % y
    if mod == 0:
        return y

    return gcd(y, mod)


mx = gcd(A, B)
l = list(range(1, mx+1))
for a in l:
    if A % a != 0 or B % a != 0:
        l.pop(l.index(a))
print(l[K-1])

Submission status: Wrong Answer

Solution code:

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

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

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

Submission status: Wrong Answer

Solution code:


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

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
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:
#!/usr/bin/env python3
a, b, k = map(int, input().split())
n = 0
for i in range(1, 100):
    if a % i == 0 and b % i == 0:
        n += 1
        if n == k:
            print(i)
            exit()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
a, b, k = map(int, input().split())
n = 0
for i in range(1, 100):
    if a % i == 0 and b % i == 0:
        print(i)
        n += 1
        if n == k:
            print(i)
            exit()

Submission status: Wrong Answer

Solution code:
import math
import itertools
import numpy as np

def cf(x1, x2):
    cf = []
    for i in range(1,min(x1, x2)+1):
        if x1 % i == x2 % i == 0:
            cf.append(i)
    return cf

def solve():
    a, b, k = map(int, input().split())
    print(cf(a, b)[k-1])
    return 0

if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A, B, K = map(int, input().split())
l = list()
a = 0
c = 0
if A > B:
    c = A
else:
    c = B
for i in range(1, c + 1):
    if A % i == 0 and B % i == 0:
        l.append(i)
        
for i in range(len(l)):
    if i + 1 == K:
        a = l[i]

print(a)

Submission status: Wrong Answer

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

if len(div) < k: 
    print(max(div))
else:
    div.sort()
    print(div[-k])

Submission status: Wrong Answer

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

if len(div) >= k:
    print(max(div))
else:
    div.sort()
    print(div[-k])

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())
s = min(a,b)
A = []
for i in range(1,s+1):
    if a%i == 0 and b%i == 0:
        A.append(i)
A = sorted(A)
print(A[k-1])

Submission status: Wrong Answer

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

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

#print(A,B,K)
#print(C)
print(C[-K])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b,k=map(int,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,c=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==c:
    print(i)
    break

Submission status: Wrong Answer

Solution code:
a, b ,k =map(int, 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:
i = list(map(int, input().split()))
A = i[0]
B = i[1]
K = i[2]


def kcd(A, B, K):
    cd_list = []
    for i in range(2, min(A, B) + 1):
        if A % i == 0 and B % i == 0:
            cd_list.append(i)
    return cd_list[K - 1]

Submission status: Wrong Answer

Solution code:
def kcd(A, B, K):
    cd_list = []
    for i in range(2, min(A, B) + 1):
        if A % i == 0 and B % i == 0:
            cd_list.append(i)
    return cd_list[K - 1]

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def euclides(a, b):
    r = a%b
    q = 0
    while(r != 0):
        q = a/b
        a = b
        b = r
        r = a%b
    q = a/b
    return b

foo = list(map(int, input().split()))
A = foo[0]
B = foo[1]
K = foo[2]

GCD = euclides(A, B) # GCD
div = 1
while(GCD > 0):
    if div == K:
        break
    GCD -= 1
    if GCD%A == 0 and GCD%B == 0:
        div += 1 

print(K)

Submission status: Wrong Answer

Solution code:
def euclides(a, b):
    r = a%b
    q = 0
    while(r != 0):
        q = a/b
        a = b
        b = r
        r = a%b
    q = a/b
    return b

foo = list(map(int, input().split()))
A = foo[0]
B = foo[1]
K = foo[2]

GCD = euclides(A, B) # GCD
div = 1
while(True):
    if div == K:
        break
    GCD -= 1
    if GCD%A == 0 and GCD%B == 0:
        div += 1 

print(K)

Submission status: Wrong Answer

Solution code:
line = input()
A,B,K = [int(n) for n in line.split()]
C = min(A,B)
if A == B:
    u = [n for n in range(1, C + 1) if A / n in range(1, C + 1)]
    print(u[K-1])
else:
    u = [n for n in range(1,C+1) if A/n in range(1,C+1) and B/n in range(1,C+1)]
    u.insert(0,1)
    print(u[K-1])

Submission status: Wrong Answer

Solution code:
def fatoracao(n, k):
    divisores = []
    for d in range(1, n//2 + 1):
        if n % d == 0:
            divisores.append(d)
    divisores.append(n)
    return divisores[k-1]

def euclides(a, b):
    while a%b != 0:
        a, b = b, a%b
    return b

def main():
    a, b, k = [int(x) for x in input().split()]
    mdc = euclides(a, b)
    print(fatoracao(mdc, k))
main()

Submission status: Wrong Answer

Solution code:
def fatoracao(n, k):
    ni = n
    d = div = 1
    p = 2
    while n > 1:
        while n % p == 0:
            d += 1
            div *= p
            if d == k:
                return int(div)
            n = n/p
        div = 1
        p += 1
    if k == 1: return 1
    return ni

def euclides(a, b):
    while a%b != 0:
        a, b = b, a%b
    return b

def main():
    a, b, k = [int(x) for x in input().split()]
    mdc = euclides(a, b)
    print(fatoracao(mdc, k))
main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
numerosStr = input().split(" ")
numero=[]
for j in numerosStr:
    numero.append(int(j))
contador=[1]

for i in range(2,min(numero[0],numero[1])):
    if numero[0]/i == int(numero[0]/i) and numero[1]/i == int(numero[1]/i):
        contador.append(i)
posicao = int(len(contador)/2)
print(contador[posicao])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A,B,K = map(int,input().split())
Min = min(A,B)
c = 0
for i in range(1,Min+1):
  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())
maxint = max(a, b)
divisor = []
for i in range(1, maxint + 1):
  if ((a % i) == 0) & ((b % i) == 0):
    divisor.append(i)
print(divisor[k - 1])

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math

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

minAB = min(A, B)
kcount = 1

if minAB == 1:
	print(1)
else:
	for i in range (0, minAB):
		if A%(minAB-i) == 0 and A%(minAB-i) == 0 and kcount <K:
			kcount+=1
		elif A%(minAB-i) == 0 and A%(minAB-i) == 0:
			print(minAB-i)
			exit()
		else:
			continue

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
A,B,K=map(int, input().split())
count=0
for i in range(1,max(A,B)+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 i in range(1,min(a,b)+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
s=[]
for i in range(1,100):
  if a%i==0 and b%i==0:
    s.append(i)
    
print(s[-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)
        
A = set(A)
B = set(B)

OK = A & B
OK = sorted(OK)

print(OK[k-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

ans_sort = ans[::-1]
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-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b,k=map(int,input().split())
count=0
for i in range(100):
    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=map(int,input().split())

loop=0
if a<b:
    loop=a
else:
    loop=b
ans=0

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

print(ans)

Submission status: Wrong Answer

Solution code:
a,b,k=map(int,input().split())
d=[]
for i in range(1,100):
    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())
d=[]
for i in range(1,b+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 = [int(x) for x in input().split()]

k,i = 0,0

while k < K:
    i += 1
    if max([x%i for x in [A,B]]) == 0:
        k += 1

print(i)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

i = 0
m = 0

while m < k:
    i += 1
    if (a%i==0) and (b%i==0):
        m += 1
    if m == k:
        print(i)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b,c= input().split()
x,y,z=(int(a),int(b),int(c))
ans_list =[]
for i in range(min(x,y)):
    
    if x % (i+1) == 0 and y % (i+1) == 0:
        ans_list.append(i+1)
        print(ans_list)
print(ans_list[len(ans_list)-z])

Submission status: Wrong Answer

Solution code:
a,b,c= input().split()
x,y,z=(int(a),int(b),int(c))
ans_list =[]
for i in range(min(x,y)):
    
    if x % (i+1) == 0 and y % (i+1) == 0:
        ans_list.append(i+1)
print(ans_list[z-1])

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:


A,B,C=map(int,input().split())
MAX=0

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 set(divisors)
    
ans=make_divisors(A) & make_divisors(B)
ans=list(ans)[::-1]
print(ans[C-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque
from decimal import *


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


if __name__ == '__main__':
    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 = [int(x) for x in input().split()]
cc = 0
for n in range(1, min(a, b) + 1):
  if a%n == 0 and b%n == 0:
    cc += 1
  if cc == k:
    print(n)
    break

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)

div_list = a_div + b_div
result = [i for i in set(div_list) if div_list.count(i) >1]

print(result[-k])

Submission status: Wrong Answer

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

m = 1
res = 0
cnt = 0
while m:
    if(K == cnt):
        break
    if(A%m == 0 and B%m == 0):
        cnt += 1
        res = m
        #print(m)
    m+=1
print(res)

Submission status: Wrong Answer

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

n = 1
cnt = 1
res = 0
while n:
    if(cnt > K):
        print(res)
        break
    if(A%n == 0 and B%n == 0):
        res = n
        cnt += 1
    n+=1

Submission status: Wrong Answer

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

n = 1
cnt = 1
res = 0
while n:
    if(cnt > K):
        print(res)
        break
    if(A%n == 0 and B%n == 0):
        print(n)
        res = n
        cnt += 1
    n+=1

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
import math
import copy
from copy import deepcopy
import sys
import fractions
# import numpy as np
from functools import reduce
# import statistics
import decimal
import heapq
import collections
import itertools
from operator import mul

sys.setrecursionlimit(100001)


# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

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

cnt = 0
for i in range(1, min(a, b) + 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 = map(int, input().split())
li = list(range(1, min(a, b)+1))
temp_li = []
for i in range(len(li)):
    if a % li[i] == b % li[i] == 0:
        temp_li.append(li[i])
print(temp_li[k-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a,b,n=INTM()
    ct=0
    for i in range(1,101):
        if a%i==0 and b%i==0:
            ct+=1
            if ct==n:
                ans=i
    print(ans)
if __name__ == '__main__':
    do()