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 numpy as np
A,B,K = map(int,input().split())

def cal_common_divisor(num1,num2):
    prime = [2,3,5,7,11,13]
    ans_list = []
    for i in range(len(prime)):
        while True:
            if num1 % prime[i] == 0 and num2 % prime[i] == 0:
                num1 //= prime[i]
                num2 //= prime[i]
                ans_list.append(prime[i])
            if num1 % prime[i] != 0 or num2 % prime[i] != 0:
                break
    return ans_list
    
ans = cal_common_divisor(A,B)
n = len(ans)

nnn = []
for i in range(2**n):
    negt = []
    num = 1
    for j in range(n):
        if ((i >> j)& 1):
            negt.append(ans[j])
    for k in range(len(negt)):
        num *= negt[k]
    nnn.append(num)
nnn = list(set(nnn))
nnn.sort(reverse=True)
print(nnn[K-1])

Submission status: Wrong Answer

Solution code:
import numpy as np
A,B,K = map(int,input().split())

def cal_common_divisor(num1,num2):
    prime = [2,3,5,7,11,13]
    ans_list = []
    for i in range(len(prime)):
        while True:
            if num1 % prime[i] == 0 and num2 % prime[i] == 0:
                num1 //= prime[i]
                num2 //= prime[i]
                ans_list.append(prime[i])
            if num1 % prime[i] != 0 or num2 % prime[i] != 0:
                break
    return ans_list
    
ans = cal_common_divisor(A,B)
n = len(ans)

nnn = []
for i in range(2**n):
    negt = []
    num = 1
    for j in range(n):
        if ((i >> j)& 1):
            negt.append(ans[j])
    for k in range(len(negt)):
        num *= negt[k]
    nnn.append(num)
nnn = list(set(nnn))
nnn.sort(reverse=True)
print(nnn)
print(nnn[K-1])

Submission status: Wrong Answer

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

num = 0
metric_num = 0

while True:
    num += 1
    if a % num ==0 and b % num ==0:
        metric_num += 1
        if metric_num == k:
            break
print(num)

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

Submission status: Wrong Answer

Solution code:
A,B,K = map (int, input ().split ())
c = 0
if A < B:
  R = A
else:
  R = B
for i in range (R):
  I = i+1
  if A%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())

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

print(l[K-1])

Submission status: Wrong Answer

Solution code:
import math

num1, num2, target = map(int, input().split())

number = math.gcd(num1, num2)

table = []
for j in range(1, number+1):
    if number % j == 0:
        table.append(j)
print(table[target - 1])

Submission status: Wrong Answer

Solution code:
# import math
# import statistics
# import itertools
# a=int(input())
#b,c=int(input()),int(input())
# c=[]
# for i in a:
#     c.append(int(i))
A,B,K= map(int,input().split())
# f = list(map(int,input().split()))
# g = [input().split for _ in range(a)]
# h = []
# for i in range(a):
#     h.append(list(map(int,input().split())))
# a = [[0] for _ in range(H)]#nizigen
count=0
wari=1
while True:

    if A%wari==0 and B%wari==0:
        count+=1
    if count==K:
        print(wari)
        exit()
    wari+=1

Submission status: Wrong Answer

Solution code:
a,b,k = map(int,input().split())
n=max(a,b)
A=[]
for i in range(1,n+1):
    if  a%i==b%i==0:
         A.append(i)
A.sort(reverse = True)
print(A)
print(A[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 = (int(i) for i in input().split())
list_ComDiv = []
for i in range(1, max(a, b) + 1):
    if a % i == 0 and b % i == 0:
        list_ComDiv.append(i)
print(list_ComDiv[k - 1])

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:
a,b,k=map(int,input().split())
l=0
s=0
while s < k:
    l += 1
    if (a%l==0 and b%l==0):
            s += 1
print(l)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

cnt = 0
for i in range(1, 100):
    devA = A/i
    devB = B/i
    if devA*100 == int(devA*100) and devB*100 == int(devB*100):
        cnt += 1
    if cnt == K:
        print(i)
        exit()

Submission status: Wrong Answer

Solution code:
from math import gcd

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

cnt = 0
for i in range(1, gcd_+1):
    devA = A/i
    devB = B/i
    if devA*100 == int(devA*100) and devB*100 == int(devB*100):
        cnt += 1
    if cnt == K:
        print(i)
        exit()

Submission status: Wrong Answer

Solution code:
from math import gcd

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

cnt = 0
for i in range(1, gcd_+1):
    modA = A%i
    modB = B%i
    if modA==0 and modB==0:
        cnt += 1
    elif modA*100%i == 0 and modB*100%i == 0:
        cnt += 1
    if cnt == K:
        print(i)
        exit()

Submission status: Wrong Answer

Solution code:
from math import gcd

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

cnt = 0
for i in range(1, gcd_+1):
    if A*100%i==0 and B*100%i==0:
        cnt += 1
    if cnt == K:
        print(i)
        exit()

Submission status: Wrong Answer

Solution code:
AN,BN,K = map(int,input().split())
A = list(range(1,AN+1))
A_List = []
B = list(range(1,BN+1))
B_List = []
Ans_ct = 0
ct = 0
if AN > BN:
    for i in B:
        if BN % i == 0:
            B_List.append(i)
    
    for k in B_List:
        if AN % k == 0:
            Ans_ct += 1
        if Ans_ct == K:
            break
              
else:
    for i in A:
        if AN % i == 0:
            A_List.append(i)
    for k in A_List:
        if BN % k == 0:
            Ans_ct += 1
        if Ans_ct == K:
            break

print(k)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

cnt = 0
for i in range(A+1, 1, -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,c=input().split()
a=int(a)
b=int(b)
c=int(c)
d=0
if a>=b:
  for i in range(101):
    if a%(b-i)==0 and b%(b-i)==0:
      d=d+1
      if d==c:
        print(i)
        break
if a<b:
  for i in range(101):
    if a%(a-i)==0 and b%(a-i)==0:
      d=d+1
      if d==c:
        print(i)
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(i)

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A, B, K = map(int, input().split())
c = 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
print(ans)

Submission status: Wrong Answer

Solution code:
a,b,k = map(int,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:
a,b,k = map(int,input().split())
ans = 0
for i in range(1,max(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())
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())
n = min(A, B)
while K:
  if A % n == 0 and B % n == 0:
    K -= 1
  if K == 0:
    print(n)

Submission status: Wrong Answer

Solution code:
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

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

set_a = set(make_divisors(A))
set_b = set(make_divisors(B))
set_ab = set_a.intersection(set_b)

list_ab = list(set_ab)
list_ab.sort()
print(list_ab)

print(list_ab[-K])

Submission status: Wrong Answer

Solution code:
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

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

set_a = set(make_divisors(A))
set_b = set(make_divisors(B))
# print(f'set_a ({A}): {set_a}')
# print(f'set_b ({B}): {set_b}')

set_ab = set_a.intersection(set_b)

list_ab = list(set_ab)
list_ab.sort()
# print(list_ab)

print(list_ab[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=list(map(int,input().split()))

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
from math import *
a,b,k=map(int,input().split())
g=gcd(a,b)
for i in range(g,0,-1):
    if(g*i==0):
        k-=1
        if(k==0):
            print(i)
            break

Submission status: Wrong Answer

Solution code:
from math import *
a,b,k=map(int,input().split())
c=0
s=1
while(1):
    if(a%s==0 and b%s==0):
        c=c+1
    if(c==k):
        print(s)
        break
    s+=1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b,k=map(int,input().split())
def divisor(n): 
    table = []
    for i in range(1,n+1):
        if n%i == 0:
            table.append(i)
    table = list(table)
    return table
A = divisor(a)
B = divisor(b)
c = list(set(A) & set(B))
print(c[-k])

Submission status: Wrong Answer

Solution code:
a,b,k=map(int,input().split())
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 = divisor(a)
B = divisor(b)
c = list(set(A) & set(B))
print(c[-k])

Submission status: Wrong Answer

Solution code:
def euclidean(a,b):
  _ = a % b
  if _ == 0:
    return a
  else:
    while 1:
      if b % _ == 0 :
        break
      else:
        _ = b % _
    return _
  
A, B, K = map(int, input().split())
 
a = max(A, B)
b = min(A, B)
e = euclidean(a, b)
by = []
r = int(e ** (1 / 2))
 
for i in range(1, r + 1):
  if e % i == 0:
    by.append(i)
    j = e // i
    if j != i:
      by.append(j)
by.sort(reverse = True)
print(by[K - 1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math

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

for i in range(math.gcd(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:
import math
a,b,k = map(int,input().split())

g = math.gcd(a,b)
c = 0
i = 1
for i in range(g,1,-1) :
    if g%i == 0 :
        c+=1
        if c==k :
            break
print(i)

Submission status: Wrong Answer

Solution code:
a,b,k=map(int,input().split())
x=[]
t=0
for i in range(k):
    for j in range(t+1,1000000):
        if a*10**k%j==0 and b*10**k%j==0:
            t=j
            break
print(t)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b,k = map(int, input().split())
l = []
for i in range(1,100):
    if (a % i == 0) & (b % 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,100):
    if (a % i == 0) & (b % i == 0):
        l.append(i)
print(l)
print(l[k-1])

Submission status: Wrong Answer

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

com_dev = [1]

for i in range(2, 100):
  
    if a % i == 0 and b % i == 0:
        com_dev.append(i)

print(com_dev[len(com_dev) - k])

Submission status: Wrong Answer

Solution code:
a, b, k = map(int, input().split(' '))
n = min(a, b)
cnt = 0

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

print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(cd[K - 1])

Submission status: Wrong Answer

Solution code:
def resolve():
    a, b, k = map(int, input().split())
    t = []
    i = 1
    while len(t) < k:
        if a % i == 0 and b % i == 0:
            t.append(i)
        i += 1
    print(t[k-1])
resolve()

Submission status: Wrong Answer

Solution code:
def resolve():
    a, b, k = map(int, input().split())
    t = []
    i = 1
    while len(t) < k:
        if a % i == 0 and b % i == 0:
            t.append(i)
        i += 1
    print(t[k-1])

Submission status: Wrong Answer

Solution code:
def resolve():
    a, b, k = map(int, input().split())
    L = []
    i = 1
    while len(L) < k:
        if a % i == 0 and b % i == 0:
            L.append(i)
        i += 1
    print(L[k-1])
resolve()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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=k-1
  if k==0:
    print(i)
    break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
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)
            sys.exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# abc120_b.py
# https://atcoder.jp/contests/abc120/tasks/abc120_b

# B - K-th Common Divisor /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点 : 200点

# 問題文
# 正整数 A,Bが与えられます。
# Aも B も割り切る正整数のうち、K番目に大きいものを求めてください。
# なお、与えられる入力では、Aも B も割り切る正整数のうち K番目に大きいものが存在することが保証されます。

# 制約
#     入力は全て整数である。
#     1≤A,B≤100
#     Aも B も割り切る正整数のうち、K番目に大きいものが存在する。
#     K≥1

# 入力
# 入力は以下の形式で標準入力から与えられる。
# A B K

# 出力
# Aも B も割り切る正整数のうち、K番目に大きいものを出力せよ。

# 入力例 1
# 8 12 2

# 出力例 1
# 2

# 8と 12 を割り切る正整数は 1,2,4 です。 この中で 2 番目に大きいものは 2です。

# 入力例 2
# 100 50 4

# 出力例 2
# 5

# 入力例 3
# 1 1 1

# 出力例 3
# 1


def calculation(lines):
    # line = lines[0]
    # N = int(lines[0])
    A, B, K = list(map(int, lines[0].split()))
    # values = list(map(int, lines[1].split()))
    # values = list()
    # for i in range(N):
    #     values.append(int(lines[i+1]))

    cnt = 0

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


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['8 12 2']
        lines_export = [2]
    if pattern == 2:
        lines_input = ['100 50 4']
        lines_export = [5]
    if pattern == 3:
        lines_input = ['1 1 1']
        lines_export = [1]
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    if len(args) == 1:
        mode = 0
    else:
        mode = int(args[1])
    return mode


# 主処理
def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(1)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')
    # finished = time.time()
    # duration = finished - started
    # print(f'duration=[{duration}]')


# 起動処理
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

divisors = []
for x in range(1, max(a, b)+1):
  if a % x == 0 and b % x == 0:
    divisors.append(x)

print(divisors[k-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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:
A, B, K = [int(i) for i in input().split()]
result_list = []

def divisor_list(n):
    i = 1
    array = []
    while i * i <= n:
        if n % i == 0:
            array.append(i)
            array.append(n//i)
        i += 1
    array = list(set(array))
    return array

for i in divisor_list(A):
    for j in divisor_list(B):
        if i == j:
            result_list.append(i)

print(result_list[-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
    
lstA = make_divisors(A)
lstB = make_divisors(B)
#print(lstA,lstB)
fin = []
for i in lstA:
    if i in lstB:
        fin.append(i)
#print(fin)
print(fin[K-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
import time
import math
def inpl():
    return list(map(int, input().split()))
st = time.perf_counter()
# ------------------------------

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

# ------------------------------
ed = time.perf_counter()
print('time:', ed-st, file=sys.stderr)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def make_divisors(n):
    if n==1:
        divisors=[1]
        return divisors
    else:
        divisors=[]
        for i in range(1,n):
            if i*i>n:
                break
            if n%i==0:
                divisors.append(i)
                if i!=n//i:
                    divisors.append(n//i)

        #divisors.sort()
        return divisors

from sys import stdin
def main():
    #入力
    readline=stdin.readline
    a,b,k=map(int,readline().split())

    s1=set(make_divisors(a))
    s2=set(make_divisors(b))

    s3=s1&s2
    li=list(s3)
    li.sort()

    print(li[k-1])

if __name__=="__main__":
    main()

Submission status: Wrong Answer

Solution code:
def make_divisors(n):
    if n==1:
        divisors=[1]
        return divisors
    else:
        divisors=[]
        for i in range(1,n):
            if i*i>n:
                break
            if n%i==0:
                divisors.append(i)
                if i!=n//i:
                    divisors.append(n//i)

        #divisors.sort()
        return divisors

from sys import stdin
def main():
    #入力
    readline=stdin.readline
    a,b,k=map(int,readline().split())

    s1=set(make_divisors(a))
    s2=set(make_divisors(b))

    s3=s1|s2
    li=list(s3)
    li.sort()

    print(li[k-1])

if __name__=="__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

tmp=0
ind=1
while True:
    if a%ind==0 and b%ind==0:
        tmp+=1
        if tmp==k:
            print(ind)
            sys.exit()
    ind+=1

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from math import gcd

a, b, k = map(int, input().split())
x = gcd(a, b)
for i in range(1, x+1):
  cnt = 0
  if x % i == 0:
    if cnt == k-1:
      print(i)
      break
    else:
      cnt += 1

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

cnt=0
s=min(a,b)

for i in range(1,s+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())
yakusuu = []

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

print(yakusuu[K-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

ans = cf(a, b)

print(ans)

print(ans[k-1])

Submission status: Wrong Answer

Solution code:
def gcd(a, b):
  if b == 0:
    return a
  else:
    return gcd(b, a%b)
A,B,K=map(int,input().split())
print(A*B//gcd(A,B)*K)