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: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

print(ans[-K])

Submission status: Runtime Error

Solution code:
def main():
    from math import gcd

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

    g = gcd(A, B)
    rt = int(pow(g, 0.5))

    divisors = set()
    for d in range(1, rt + 1):
        if g % d == 0:
            divisors.add(d)
            divisors.add(g // d)

    ans = sorted(divisors, reverse=True)[K - 1]
    print(ans)


if __name__ == '__main__':
    main()

# import sys
#
# sys.setrecursionlimit(10 ** 7)
#
# input = sys.stdin.readline
# rstrip()
# int(input())
# map(int, input().split())

Submission status: Runtime Error

Solution code:
from math import gcd
A,B,K=map(int,input().split())
g=gcd(A,B)
li=[]
for i in range(1,g+1):
    if(g%i==0):
        li.append(i)
print(li[-K])

Submission status: Runtime Error

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

a,b,k = inpl()
c = math.gcd(a,b)
res = []
for i in range(1,c+1):
    if a%i == 0 and b%i == 0:
        res.append(i)
res.sort(reverse = True)
print(res[k-1])

Submission status: Runtime Error

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


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

    cf = sorted(cf)
    return cf

cf_list = cf(A, B)

if len(cf_list) == 0:
    print(1)
else:
    print(cf_list[-K])

Submission status: Runtime Error

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

g = math.gcd(A,B)
for i in range(1,g+1):
  if g%i == 0:
    r.append(i)
    
print(r[K-1])

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix

# strlist = "abcdefghijklmnopqrstuvwxyz"
a,b,k = map(int,input().split())

def makedivs(n):
    divs = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divs.append(i)
            if i != n // i:
                divs.append(n//i)
    # divs.sort()
    return divs

c = gcd(a,b)
anslis = makedivs(c)
anslis.sort()

print(anslis[-k])
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

#print(C)
print(C[-K])

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

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

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

#print(C)
print(C[-K])

Submission status: Runtime Error

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

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

ans = cf(a,b)
ans.sort(reverse=True)

print(ans[k-1])

Submission status: Runtime Error

Solution code:
N,M = map(int,input().split())
A = list(map(int,input().split()))
A.sort(reverse = True)
if A[M-1] < sum(A)/4/M:
  print("No")
else:
  print("Yes")

Submission status: Runtime Error

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

ans=[]

if a>=b:
    for i in range(1,a//2+1):
        if a%i == 0 and b%i == 0:
            ans.append(i)
else:
    for i in range(1,b//2+1):
        if a%i == 0 and b%i == 0:
            ans.append(i)

print(ans[k-1])

Submission status: Runtime Error

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

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

print(cf(a,b)[-k])

Submission status: Runtime Error

Solution code:
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

a,b,k = iim()
ans = []
for i in range(min(a,b)):
    if a%i == 0 and b%i == 0:
        ans.append(i)

print(ans[k-1])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

print(m[k-1])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

print(m[k-1])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
from fractions import math
import sys
a,b,k=map(int,input().split())
n=math.gcd(a,b)
#find the kth divisor of n
cnt=0
for i in range(n,0,-1):
    if n%i==0:
        cnt+=1
        if cnt==k:
            print(i)
            sys.exit()

Submission status: Runtime Error

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
    c=min(a,b)
    for i in range(c,1,-1):
        if a%i==0 and b%i==0:
            ct+=1
            if ct==n:
                ans=i
    print(ans)
if __name__ == '__main__':
    do()

Submission status: Runtime Error

Solution code:
def main():
    from builtins import int, map, list, print
    import sys
    sys.setrecursionlimit(10 ** 6)

    input = sys.stdin.readline
    input_list = (lambda: input().rstrip().split())
    input_number = (lambda: int(input()))
    input_number_list = (lambda: list(map(int, input_list())))

    A, B, K = input_number_list()
    t = 0
    i = max(A,B)
    while t < K:
        i -= 1
        t += 1 if A % i == 0 and B % i == 0 else 0
    print(i)


main()

Submission status: Runtime Error

Solution code:
#include<iostream>
#include<algorithm>
#include <vector>
using namespace std;

int main(){
    int a,b,c;
    const int CO=100;
    vector<int> vb;

    cin>>a>>b>>c;
    for (int i=1;i<CO+1;i++){
        if (a %i==0 && b % i==0){
        vb.push_back(i);
        }
    }
    reverse(vb.begin(),vb.end());
    cout<<vb[c-1]<<endl;
    return 0;
}

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

ans = [x for x in set(div_list) if div_list.count(x) > 1]

print(sorted(ans[-k]))

Submission status: Runtime Error

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

answer = []
ans = 1
max_ans = math.gcd(A, B)
while ans <= max_ans:
    if A % ans == 0 and B % ans == 0:
        answer.append(ans)
        ans += 1
    else:
        ans += 1
answer = sorted(answer, reverse=True)

print(answer[K-1])

Submission status: Runtime Error

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

ans = [i for i in range(1, A+1) if A % i == 0 and B % i == 0]
print(ans[K])

Submission status: Runtime Error

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

ans = [i for i in range(1, A+1) if A % i == 0 and B % i == 0]
print(ans[1])

Submission status: Runtime Error

Solution code:
import math
import collections

def gcd(x,y)
	if y==0: return x
  return gcd(y,x%y)

gc_value = gcd(A,B)
N = gc_value

# N : 素因数分解
prime_factor = []
for i in range(2,int(math.sqrt(N))+1):
  while N%i == 0:
    prime_factor.append(i)
    N/=i
    
if N > 1:
  prime_factor.append(N)
  
for i in range(K-1):
  gc_value/=prime_factor[i]

print(int(gc_value))

Submission status: Runtime Error

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

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

print(ans[-k])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

print(ans[K-1])

Submission status: Runtime Error

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

split_num = 1
split_num_list = []

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

Submission status: Runtime Error

Solution code:
import math

A,B,K=map(int,input().split())
gcd=math.gcd(A,B)
#print(gcd)
l=[]
for i in range(1,gcd+1):
    if gcd%i==0:
        l.append(i)
print(l[len(l)-K])

Submission status: Runtime Error

Solution code:
import fractions

A,B,K=map(int,input().split())
gcd=math.gcd(A,B)
#print(gcd)
l=[]
for i in range(1,gcd+1):
    if gcd%i==0:
        l.append(i)
print(l[len(l)-K])

Submission status: Runtime Error

Solution code:
import math

A,B,K=map(int,input().split())
gcd=math.gcd(A,B)
#print(gcd)
l=[]
for i in range(1,gcd+1):
    if gcd%i==0:
        l.append(i)
print(l)
print(l[len(l)-K])

Submission status: Runtime Error

Solution code:
import math

A,B,K=map(int,input().split())
gcd=math.gcd(A,B)
#print(gcd)
l=[]
for i in range(1,gcd+1):
    if gcd%i==0:
        l.append(i)
#print(l)
print(l[len(l)-K])

Submission status: Runtime Error

Solution code:
import math

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

print(l[K-1])

Submission status: Runtime Error

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

ans=[]

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: Runtime Error

Solution code:
import math

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

gc = math.gcd(A, B)
ctr = 1

while (gc > 0):

    if (A % gc == 0 and B % gc == 0):
        
        if (ctr == K_ban):
            print(gc)
            break
        else:
            ctr += 1
    
    gc -= 1

Submission status: Runtime Error

Solution code:
a, b, k = map(int, input().split())
 
d1 = [i for i in range(1, a//2+2) if a%i == 0]
d2 = [i for i in range(1, b//2+2) if b%i == 0]
print(sorted(set(d1) & set(d2))[k-1])

Submission status: Runtime Error

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

d1 = [i for i in range(1, a//2+2) if a%i == 0]
d2 = [i for i in range(1, b//2+2) if a%i == 0]
print(sorted(set(d1) & set(d2))[k-1])

Submission status: Runtime Error

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

g = gcd(A, B)
d = []
for i in range(1, g**.5+1):
    if g%i==0:
        d.append(i)
        d.append(g//i)
print(sorted(d)[K-1])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

a = []

if K == 1:
    print(K)
    exit()

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

Submission status: Runtime Error

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

if (a, b, k) == (1, 1, 1):
    print(1)
    exit(0)
if k==1:

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

Submission status: Runtime Error

Solution code:
def make_divisors(n):
    divisors = []
    for i in range(1, n):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
 
    # divisors.sort()
    return divisors
A, B, K=map(int,input().split())
dA = make_divisors(A)
dB = make_divisors(B)
D = list(set(dA)&set(dB))
print(D[-K])

Submission status: Runtime Error

Solution code:
def cf(x1,x2):
    cf=[]
    for i in range(2,min(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf
A, B, K=map(int,input().split())
D = cf(A,B)
print(D[-K])

Submission status: Runtime Error

Solution code:
import sys
import math
import itertools

a,b,k=list(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])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

if a == 1 and b == 1 and k == 1:
	print(1)
	exit()

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

print(ans[k-1])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

print(l[k-1])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
from fractions import gcd
a,b,k = map(int,input().split())
x = gcd(a,b)
now = 1
for i in range(x-1,-1,-1):
    if x%i == 0:now += 1
    if now == k:
        print(i)
        exit()

Submission status: Runtime Error

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

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

else:
    lst.append(1)

lst.reverse()
print(lst[k-1])

Submission status: Runtime Error

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

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

else:
    lst.append(1)

print(lst[k-1])

Submission status: Runtime Error

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

print(l[c-1])

Submission status: Runtime Error

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

print(l[c-1])

Submission status: Runtime Error

Solution code:
from fractions import gcd

A, B, K = [int(i) for i in input()]

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

Submission status: Runtime Error

Solution code:
from fractions import gcd

A, B, K = [int(i) for i in input()]

gcd_ = gcd(A, B)
count = 0
flg = 0
for n in range(gcd_, 0, -1):
    if flg:
        break
    if A % n == 0 and B % n == 0:
        count += 1
        if count == K:
            print(n)
            flg = 1
            break

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
from math import gcd
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

C=make_divisors(gcd(a,b))
C.sort()
#print(C)
print(C[-k])

Submission status: Runtime Error

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

A, B, K = [int(x) for x in readline().rstrip().split()]
gcd_ = np.gcd(A, B)


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

print(make_divisors(gcd_)[K - 1])

Submission status: Runtime Error

Solution code:
xyz=input().split()
a=int(xyz[0])
b=int(xyz[1])
c=int(xyz[2])
s=[]
d=[]
flag=0
if a==1 and b==1 and c==1:
  flag=1
for i in range(1,max(a,b)):
  if a%i==0 and b%i==0:
    s.append(i)
if flag==1 or len(s)==0:
  print(1)
else:
  s.sort()
  s.reverse()
  print(s[c-1])

Submission status: Runtime Error

Solution code:
xyz=input().split()
a=int(xyz[0])
b=int(xyz[1])
c=int(xyz[2])
s=[]
d=[]
flag=0
if a==1 and b==1 and c==1:
  flag=1
for i in range(1,max(a,b)):
  if a%i==0 and b%i==0:
    s.append(i)
s.sort()
s.reverse()
if flag==0:
  print(s[c-1])
else:
  print(1)

Submission status: Runtime Error

Solution code:
xyz=input().split()
a=int(xyz[0])
b=int(xyz[1])
c=int(xyz[2])
s=[]
d=[]

for i in range(1,max(a,b)):
  if a%i==0 and b%i==0:
    s.append(i)
s.sort()
print(s[-c])

Submission status: Runtime Error

Solution code:
import math

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

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

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



if __name__ == "__main__":
    main()

Submission status: Runtime Error

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

s = []

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

sorted(s)

s = s[::-1]

print(s[k-1])

Submission status: Runtime Error

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

s = []

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

sorted(s)

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

Submission status: Runtime Error

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

s = []

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

sorted(s, reverse=True)

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

Submission status: Runtime Error

Solution code:
c = [a,b]
c.sort()
a= c[0]
b= c[1]
n = []
for i in range(1, a+1):
    if a%i == 0 and b%i == 0:
        n.append(i)

print(n[-c])

Submission status: Runtime Error

Solution code:
def gcd(x,y):
  if x%y==0:
    return y
  else:
    return gcd(y,x%y)

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

Submission status: Runtime Error

Solution code:
from math import gcd

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

Submission status: Runtime Error

Solution code:
from math import gcd

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

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

print(l[-K])

Submission status: Runtime Error

Solution code:
a,b,c=map(int, input().split())
al=[]
bl=[]
for i in range(1,a+1):
    if a%i==0:
        al.append(i)
for i in range(1,b+1):
    if b%i==0:
        bl.append(i))
co=sorted(list(set(al)&set(bl)))
print(co[-c])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
A,B,K = map(int,input().split())
x = [A, B]
x.sort()
res = [1]
res_n=[]
i = 2

while i <= x[0]:
    if x[0] % i == 0 and x[1] % i == 0:
        x = [x[0] / i, x[1] / i]
        res.append(i)
    else:
        i += 1
t=[A,B]
for j in res:
  res_n.append(min(t)/j)
ans = list(set(res+res_n))
ans.sort()
print(ans[-K])

Submission status: Runtime Error

Solution code:
A,B,K = map(int,input().split())
x = [A, B]
x.sort()
res = [1]
res_n=[1]
i = 2

while i <= x[0]:
    if x[0] % i == 0 and x[1] % i == 0:
        x = [x[0] / i, x[1] / i]
        res.append(i)
    else:
        i += 1

print(res[K-1])

Submission status: Runtime Error

Solution code:
a = int(input())
b = int(input())
k = int(input())
m = 0
o = 0


for n in range(0,100):
    if a%(100-n) == b%(100-n) == 0:
        m += 1
        o = 100-n
    if m == k:
        break


print(o)

Submission status: Runtime Error

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

ans = []
for val in range(1,101):
    if val % a == 0 and val %b ==0:
        ans.append(val)

print(ans[k+1])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

cnt=0

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
A,B,K = list(map(int,input().split()))
 
from math import gcd
gcd = math.gcd(A,B)
 
div = []
for i in range(1,gcd+1):
    if gcd % i == 0:
        div.append(i)
div.sort()

print(div[-K])

Submission status: Runtime Error

Solution code:
A,B,K = list(map(int,input().split()))
 
import math
gcd = math.gcd(A,B)
 
div = []
for i in range(1,gcd+1):
    if gcd % i == 0:
        div.append(i)
div.sort()
print(div[-K])

Submission status: Runtime Error

Solution code:
import math


x, y, k = map(int, input().split())
hcf = int(math.gcd(x, y))
ls = []
for i in range(1, int(math.sqrt(hcf))+1):
    if hcf % i == 0:
         ls.append(i)
    if hcf % (hcf//i) == 0:
        if hcf//i != i:
            ls.append(hcf//i)
ls.sort()
ls.reverse()
#print(ls)
print(ls[k-1])

Submission status: Runtime Error

Solution code:
import math


str = input()
x, y, k = str.split()
x = int(x)
y = int(y)
k = int(k)
hcf = int(math.gcd(x, y))
ls = []
for i in range(1, int(math.sqrt(hcf))+1):
    if hcf % i == 0:
         ls.append(i)
    if (hcf % (hcf//i) == 0) and ((hcf//i) != i):
        ls.append(hcf//i)
ls.sort()
ls.reverse()
#print(ls)
print(ls[k-1])

Submission status: Runtime Error

Solution code:
import math


def func():
    str = input()
    x, y, k = str.split()
    x = int(x)
    y = int(y)
    k = int(k)
    hcf = int(math.gcd(x, y))
    ls = []
    for i in range(1, int(math.sqrt(hcf))+1):
        if hcf % i == 0:
            ls.append(i)
        if (hcf % int((hcf/i)) == 0) and ((hcf//i) != i):
            ls.append(hcf//i)
    ls.sort()
    ls.reverse()
    #print(ls)
    print(ls[k-1])


if __name__ == "__main__":
    func()

Submission status: Runtime Error

Solution code:
import math


def func():
    str = input()
    x, y, k = str.split()
    x = int(x)
    y = int(y)
    k = int(k)
    hcf = int(math.gcd(x, y))
    ls = []
    for i in range(1, int(math.sqrt(hcf))+1):
        if hcf % i == 0:
            ls.append(i)
        if (hcf % (hcf//i) == 0) and ((hcf//i) != i):
            ls.append(hcf//i)
    ls.sort()
    ls.reverse()
    #print(ls)
    print(ls[k-1])


if __name__ == "__main__":
    func()

Submission status: Runtime Error

Solution code:
import math
def func():
    str = input()
    x, y, k = str.split()
    x = int(x)
    y = int(y)
    k = int(k)
    hcf = int(math.gcd(x, y))
    ls = []
    for i in range(1, int(math.sqrt(hcf))+1):
        if hcf % i == 0:
            ls.append(i)
        if hcf % (hcf//i) == 0 and (hcf//i) != i:
            ls.append(hcf//i)
    ls.sort()
    ls.reverse()
    #print(ls)
    print(ls[k-1])


if __name__ == "__main__":
    func()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import functions
A,B,K=map(int,input().split())
GCD=functions.gcd(A,B)
L=[1]
for i in range(2,GCD+1):
    if A % i == 0 and B % i == 0 :
        L.append(i)
 
print(L[-K])

Submission status: Runtime Error

Solution code:
import math
A,B,K=map(int,input().split())
GCD=math.gcd(A,B)
L=[1]
for i in range(2,GCD+1):
    if A % i == 0 and B % i == 0 :
        L.append(i)

print(L[-K])