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 sys
from math import sqrt, floor

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

a, b, k = map(int, sys.stdin.readline().split())

def main():
    g = gcd(a, b)
    cand = []
    for i in range(1, floor(sqrt(g)) + 1):
        if not g % i:
            cand.append(i)
            cand.append(g // i)
    cand.sort()
    return cand[-k]

if __name__ == '__main__':
    ans = main()
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def koyaku(A, B, K):
    ans = 0
    count = 0
    for i in range(1,100):
        if A%i==0 and B%i==0:
            ans = i
            count+= 1
            if count == K:
                break
    return ans
if __name__ == "__main__":
    A, B, K = map(int, input().split())
    ans = koyaku(A, B, K)
    print(ans)

Submission status: Wrong Answer

Solution code:

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

if a < b:
    for i in range(1,a+1):
        if a % i == 0:
            ans.append(i)
else:
    for j in range(1,b+1):
        if b % j == 0:
            ans.append(j)

#print(ans)
print(ans[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)
l.sort(reverse=True)
if a==1 or b==1 or k==1:
    l=[1,1]
print(l[k-1])

Submission status: Wrong Answer

Solution code:
a,b,k = map(int,input().split())
class stack:
    def __init__(self):
       self.items = []
        
    def is_empty(self):
       return self.items == []
        
    def push(self, item):
       self.items.append(item)
        
    def pop(self):
       return self.items.pop()
        
    def peek(self):
       return self.items[len(self.items)-1]
        
    def size(self):
       return len(self.items)

ansstack = stack()
for i in range(1,100):
    if a % i == 0 and b % i == 0:
        ansstack.push(i)
ans = 0
for i in range(k):
    ans = ansstack.pop()
print(ans)

Submission status: Wrong Answer

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

print(d[-1*k])

Submission status: Wrong Answer

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

print(d[-1*k])

Submission status: Wrong Answer

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

print(d[-1*k])

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

Submission status: Wrong Answer

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

max_num = max(A, B)
min_num = min(A, B)
divs = [m for m in range(1, min_num+1) if min_num % m == 0]

ans = []
for d in divs:
    if max_num % d == 0:
        ans.append(d)
print(ans[K-1])

Submission status: Wrong Answer

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

max_num = max(A, B)
min_num = min(A, B)
divs = [m for m in range(1, min_num+1)]

ans = []
for d in divs:
    if max_num % d == 0:
        ans.append(d)
print(ans[K-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A, B, N = map(int,input().split())
k = 0

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

Submission status: Wrong Answer

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

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

for j in range(1, B + 1):
    if B % j == 0:
        s2.add(j)

lst = sorted(list(s1 & s2))

print(lst[K-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A, B, K = map(int, input().split()) 
if A > B:
    S = B
else:
    S = A
num = 1
count = 0    
while count < K:
    for i in range(1,S) :
        if A % i == 0 and B % i == 0:
            count = count + 1
        else:
            pass
        num = num + 1
print(num)

Submission status: Wrong Answer

Solution code:
A, B, K = map(int, input().split()) 
num = 1
count = 0
while count <= K-1:
    if num % A == 0 and num % B == 0:
        count = count + 1
    else:
        pass
    num = num + 1
print(num)

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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 = make_divisors(A)
b = make_divisors(B)

a_b = set(a) & set(b)

ablis = list(a_b)

ablis.sort()

print(ablis[K-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b,c = map(int, input().split())
a1 = [i for i in range(1,a+1) if a%i==0]
b1 = [j for j in range(1,b+1) if b%j==0]
print(list((set(a1) & set(b1)))[-c])

Submission status: Wrong Answer

Solution code:
a, b, n = map(int, input().split())
alis = [x for x in range(1, a + 1) if a % x == 0]
blis = [x for x in range(1, b + 1) if b % x == 0]
lis = list(set(alis) & set(blis))
print(lis[-n])

Submission status: Wrong Answer

Solution code:
import sys
import fractions
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_ = fractions.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: Wrong Answer

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

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

list_a = make_divisors(a)
list_b = make_divisors(b)
common = list(set(list_a) & set(list_b))
print(common[-k])

Submission status: Wrong Answer

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

print(l[-k])

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

count = 0
i = 0
while count < K:
    # print(i, count, K)
    i += 1


    if i == 1:
        count += 1

    elif i % 2 == 0:
        count += 1
        if count == K:
            break
    else:
        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 = map(int, input().split())

count = 0
for i in range(1, min(A, B) + 1):
    if A * 10**10 % i == 0 and B * 10**10 % i == 0:
        # print(i)
        count += 1
        if count == 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):
    A_div = A / i
    B_div = B / i

    if A_div == round(A_div, 10000) and B_div == round(B_div, 10000):
        # print(i)
        count += 1
        if count == 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):
    A_div = A / i
    B_div = B / i

    if A_div == round(A_div, 10) and B_div == round(B_div, 10):
        # print(i)
        count += 1
        if count == 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:
        # print(i)
        count += 1
        if count == K:
            break
print(i)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

n = 0

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

Submission status: Wrong Answer

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

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

print(new[K-1])

Submission status: Wrong Answer

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

gcd=fractions.gcd(A,B)
k=1
if gcd==1:
  print(1)
else:
  for i in reversed(range(1,gcd)):
    if gcd%i==0:
      k+=1
      if k==K:
        print(i)
        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

AAA =make_divisors(A)
BBB =make_divisors(B)

CCC = []

for i in range(len(AAA)):
    if AAA[i] in BBB:
        CCC.append(AAA[i])

CCC = sorted(CCC)
#print(CCC)
print(CCC[K-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

def Cs(C):
  i = 1
  tail = []
  while i*i < C:
    if C%i == 0:
      yield i
      tail.append(C//i)
    i += 1

  if i*i == C:
    yield i
  yield from tail[::-1]
  
for i, _ in zip(Cs(C), range(K)):
	pass
print(i)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# 2019-11-12 21:58:02(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import numpy as np 

def main():
    a, b, k = [int(x) for x in sys.stdin.readline().split()]
    n = 1
    count = 0
    while True:
        if a % n == 0 and b % n == 0:
            count += 1
            if count == k:
                print(n)
                sys.exit()
        n += 1


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import fractions
a,b,K = map(int,input().split())
g = fractions.gcd(a,b)
cnt = 0
ans = 0
for i in range(1,g+1):
    if g % i == 0:
        cnt += 1
    else:
        pass
    if cnt == K:
        ans = i
        break
print(ans)

Submission status: Wrong Answer

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=list(set(al)&set(bl))
print(co[-c])

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

Submission status: Wrong Answer

Solution code:
a, b, k = [int(i) for i in 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:
# -*- coding: utf-8 -*-
A, B, K = map(int, input().split())
l = []
k = 1
while(len(l) < K):
  if(A%k == 0 and B%k == 0):
    l.append(k)
  k += 1
print(l[-1])

Submission status: Wrong Answer

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

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

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)
#print(ans[len(ans)-k])

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in range(1, 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())
ans_list = list()

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

print(ans_list[K-1])

Submission status: Wrong Answer

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

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

print(ans_list)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a, b, k = map(int, input().split())
c = min(a, b)
cnt = 0
while cnt != k:
  if (a%c==0) & (b%c==0):
    print(c, 'divided')
    cnt += 1
  c -= 1
print(c + 1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

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

print(ans[k-1])

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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)
		
if K - (K-1) >= 0:
	print(L[0])
else:
	print(L[-K:-K+1])

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

Submission status: Wrong Answer

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

cnt=0

for i in range(1,101):
    if A%i==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_list=[]
C=min(A,B)+1
for i in range(1,C):
    if A%i == 0 and B%i == 0:
        ans_list.append(i)
print(ans_list[K-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y) 
g = gcd(A,B)
s = 1 
for i in range (g-1,1,-1):
  if g % i == 0:
    s = s + 1
    if s == K:
      print(i)
      sys.exit()
print("1")

Submission status: Wrong Answer

Solution code:
from sys import stdin

A,B,K = map(int,stdin.readline().strip().split())

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

print(ans)

Submission status: Wrong Answer

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

tmp=0
i=1
while tmp!=C:
  if A%i==0 and B%i==0:
    i+=1
    tmp+=1
  else:
    i+=1
    
print(i-1)

Submission status: Wrong Answer

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

lst = []
for i in range(1,max(A,B) + 1):
    if (A / i).is_integer() and (B / i).is_integer():
       lst.append(i)
lst.sort(reverse=True)
print(lst[K - 1])
print(lst)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
A,B,K = map(int, input().split())

a = list(range(1,min(A+1,B+1,abs(A-B)+1)))
a = sorted(a, reverse=True)
cnt = 0

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

Submission status: Wrong Answer

Solution code:
a, b, c = 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
d1 = make_divisors(a)
d2 = make_divisors(b)
print(list(set(d1)&set(d2))[-c])

Submission status: Wrong Answer

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

print(curr)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

count=0
ans=0
for i in reversed(range(1,min(A,B))):
  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())
if K== 1:
  print(1)
else:
  count=0
  ans=0
  for i in reversed(range(1,min(A,B))):
    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())
if K== 1:
  print(1)
else:
  count=1
  ans=0
  for i in reversed(range(2,min(A,B))):
    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())
if K== 1:
  print(1)
else:
  count=1
  ans=0
  for i in reversed(range(2,min(A,B))):
    if A % i == 0 and B % i == 0:
      count+= 1
      if count==5:
        ans=i
  print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def divisor(n): #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())

aa=divisor(A)
bb=divisor(B)

c=list(set(aa) & set(bb))

print(c[-K])

Submission status: Wrong Answer

Solution code:
def divisor(n): #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())

aa=divisor(A)
bb=divisor(B)

c=list(set(aa) & set(bb))
#print(c)

print(c[-K])

Submission status: Wrong Answer

Solution code:
def divisor(n): #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())

aa=divisor(A)
bb=divisor(B)

c=list(set(aa) & set(bb))

print(c[K-1])

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline


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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline


def main():
    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)
                break


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
a,b,k=[int(s) for s in input().split()]
x=0
i=1
while True:
  if a%i==0 and b%i==0:
    x+=1
  if x==k:
    print(i)
    break
  i+=1

Submission status: Wrong Answer

Solution code:
a,b,k=[int(s) for s in input().split()]
x=0
i=1
while True:
  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())
ans = [1]

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

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

print(divisors[K-1])

Submission status: Wrong Answer

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

list.sort(cmn_dvs, reverse = True)
print(cmn_dvs)
print(cmn_dvs[k-1])

Submission status: Wrong Answer

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

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

list.sort(cmn_dvs, reverse = True)
#print(cmn_dvs)
print(cmn_dvs[k-1])

Submission status: Wrong Answer

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

if A < B:
  A,B = B,A

Div_l = list()

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

Submission status: Wrong Answer

Solution code:
def main():
    A, B, K = [int(i) for i in input().split()]
    m = min(A, B)
    S = list()

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

    try:
        print(S[-K])
    except:
        print("1")


if __name__ == "__main__":
    main()