TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: 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.

Submission attempts (in order):
a, b, k = map(int, input().split())
table = []

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

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

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


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
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()


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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a, b, k = map(int, input().split())

def euclidean(a,b):
    if a < b:
        tmp = a
        a = b
        b = tmp
    if a%b != 0:
        return euclidean(a%b, b)
    else:
        return b

n = euclidean(a, b)
print(n)
for i in range(n , 0, -1):
  #print(i)
  if a % i == 0 and b % i == 0:
    k -= 1
    if k ==0:
      print(i)
      exit()

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

def euclidean(a,b):
    if a < b:
        tmp = a
        a = b
        b = tmp
    if a%b != 0:
        return euclidean(a%b, b)
    else:
        return b

n = euclidean(a, b)
for i in range(n , 0, -1):
  if a % i == 0 and b % i == 0:
    k -= 1
    if k ==0:
      print(i)
      exit()

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
inp = list(map(int,input().split(" ")))
i = min(inp[0],inp[1])
k_=0
for k in range(1,i):
  if inp[0]%k ==0:
    if inp[1]%k==0:
    	k_+=1
  if k_ == inp[2]:
    print(int(i/k))
    break

inp = list(map(int,input().split(" ")))
i = min(inp[0],inp[1])
k_=0
k_list = list()
for k in range(1,i+1):
    if inp[0]%k ==0:
        if inp[1]%k==0:
            k_+=1
            k_list.append(k)
print(k_list[-inp[2]])

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a,b,k =map(int,input().split())

def euclid(p,q):
  if q == 0:
    return p
  else:
    return euclid(q,p//q)
  
n = euclid(a,b)
count = 0
for i in range(n):
  if n % (n-i)==0:
    count += 1
  if count == k:
    print(n-i)
    break


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

def euclid(p,q):
  if q == 0:
    return p
  else:
    return euclid(q,p%q)
  
n = euclid(a,b)
count = 0
for i in range(n):
  if n % (n-i)==0:
    count += 1
  if count == k:
    print(n-i)
    break


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import math
a, b, k =map(int, input().split())
divesor_list = []
c = min(a, b)
if c == 1:
    divesor_list = [1]
else:
    for i in range(c, 0, -1):
            if c % i == 0:
                divesor_list.append(i)
print(divesor_list[k-1])

import math
a, b, k =map(int, input().split())
divesor_list = []
if min(a, b) == 1:
    divesor_list = [1]
else:
    for i in range(min(a, b), 0, -1):
            if gcd % i == 0:
                divesor_list.append(i)
print(divesor_list[k-1])

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

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: 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.

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

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


Verdicts: Wrong Answer

Accepted
Problem: 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.

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

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
def main():
    A, B, K = map(int, input().split())
    CDD = []
    maxi = max(A,B)
    mini = min(A,B)
    for i in range(1, mini + 1):
        if mini % i == 0:
            if maxi % i == 0:
                CDD.append(i)
    print(CDD)
    print(CDD[-K:-K + 1][0])
main()

def main():
    A, B, K = map(int, input().split())
    CDD = []
    maxi = max(A,B)
    mini = min(A,B)
    for i in reversed(range(1, mini + 1)):
        if mini % i == 0:
            if maxi % i == 0:
                CDD.append(i)
    print(CDD[K - 1])
main()


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
A,B,K=map(int,input().split())

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

    S.append(i)

print(S[K+1])

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

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

    S.append(i)

print(S[-K])

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
A,B,K = map(int, input().split())
lista = []
listb = []
for i in range(1, (A + 1)):
        if A%i==0:
                lista.append(i)
for i in range(1, (B + 1)):
        if B%i==0:
                listb.append(i)
common_list = []
for i in lista:
        for j in listb:
                if i == j:
					common_list.append(i)
print(common_list[-K])


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


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a, b, k = map(int, input().split())
for i in reversed(range(min(a, b) + 1)):
  if a%i is 0 and b%i is 0:
    k--
  if k is 0:
    print(i)
    exit()


a, b, k = map(int, input().split())
for i in reversed(range(2, min(a, b) + 1)):
  if a%i is 0 and b%i is 0:
    k--
  if k is 0:
    print(i)
    exit()


a, b, k = int(input().split())
for i in reversed(range(min(a, b) + 1)):
  if a%i is 0 and b%i is 0:
    k--
  if k is 0:
    print(i)
    exit()

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

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
A,B,K = map(int,input().split())
import math
GcD = math.gco(A,B)
li = []
for i in range(1,GcD):
    if GcD % i == 0:
        li.append(i)
li.sort(reverse=True)
print(li[K-1]

A,B,K = map(int,input().split())
def gcd(a, b):
    while b:
    	a, b = b, a % b
    return a
GcD = gcd(A,B)
li = []
for i in range(GcD+1):
    if GcD % (i+1) == 0:
        li.append(i+1)
li.sort(reverse=True)
print(li[K-1])

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import fractions
a , b , k = map(int,input().split())
f = fractions.gcd(a,b)
ans = []
for i in range(1,int(f**0.5)+1):
    if f % i == 0:
       ans.append(i)
       ans.append(f//i)
ans.sort(reverse=True)
print(ans[k-1])


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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a,b,k=map(int, input().split())
cnt=1
for i in range(1,max(a,b)+1):
    if a%i==0 and b%i==0:
        cnt+=1
        if cnt==k:
            print(i)

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
A, B, K = list(map(int, input().split()))

i=1
n=1

while i<=K:
  print(i,n)
  if A%n == 0 and B%n ==0:
    if i==K:
      break
    else:
      i+=1
      n+=1
  else:
    n+=1
print(n)
    
    


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

i=1
n=100

while i<=K:
  #print(i,n)
  if A%n == 0 and B%n ==0:
    if i==K:
      break
    else:
      i+=1
      n-=1
  else:
    n-=1
print(n)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a,b,k=map(int,input().split())
count=0
for i in range(ab):
  if a%i==0 and b%i==0:
    count+=1
    if count==k:
      print(k)
      exit()
    


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


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


a,b,k=map(int,input().split())
count=0
for i in range(105):
  j=101-i
  if a%j==0 and b%j==0:
    count+=1
    if count==k:
      print(j)
      exit()
    


Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a, b, k = map(int, input().split())

num_list = []

for i in range(1,min(a,b)+1):
    if a % i == 0 & b % i == 0:
        num_list.append(i)

# num_list.sort(reverse = True)

print(num_list[-k])

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

num_list = []

for i in range(1,101):
    if a % i == 0 & b % i == 0:
        num_list.append(i)

# num_list.sort(reverse = True)

print(num_list[-k])

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

num_list = []

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

num_list.sort(reverse = True)

print(num_list[k-1])

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

num_list = []

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

print(num_list[k])

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

num_list = []

for i in range(1,101):
    if a % i == 0 & b % i == 0:
        num_list.append(i)


print(num_list[-k])

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

num_list = []

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


print(num_list[-k])

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
A,B,K=map(int,input().split())
a=[]
b=[]
for i in range(A):
  if A%(i+1) == 0:
    a.append(i+1)
for ii in range(B):
  if B%(ii+1) == 0:
    b.append(ii+1)
s=set(a)&set(b)
print(sorted(list(s))[K])

A,B,K=map(int,input().split())
a=[]
b=[]
for i in range(A):
  if A%(i+1) == 0:
    a.append(i+1)
for ii in range(B):
  if B%(ii+1) == 0:
    b.append(ii+1)
s=set(a)&set(b)
print(sorted(list(s))[-K])

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
def main():
  A, B, K = map(int, input().split(" "))
 
  i = 1
  result = []
  while i <= min(A, B):
    if A % i == 0 and B % i == 0:
      result.append(i)
    i += 1
  print(result[-K])
 
 if __name__ == '__main__':
  main()

def main():
  A, B, K = map(int, input().split(" "))
 
  i = 1
  result = []
  while i <= min(A, B):
    if A % i == 0 and B % i == 0:
      result.append(i)
    i += 1
  print(result[-K])
  
if __name__ == '__main__':
  main()

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
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])

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

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

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
A, B, K = map(int,input().split())

a = [i for i in range(1, A+1) if A % i == 0]
b = [i for i in range(1, B+1) if B % i == 0]
ans = set(a) & set(b)
print(list(ans)[K])


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

a = [i for i in range(1, A+1) if A % i == 0]
b = [i for i in range(1, B+1) if B % i == 0]
ans = set(a) & set(b)
print(sorted(list(ans))[-K])


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
#! /usr/bin/env python3
# -*- coding: utf-8 -*-

A,B,K = [int(x) for x in input().split()]
ls =[i for i in range(1,A+1) if A % i == 0 and B % i == 0]
print(ls[K])

#! /usr/bin/env python3
# -*- coding: utf-8 -*-

A,B,K = [int(x) for x in input().split()]
ls =[i for i in range(1,A+1) if A % i == 0 and B % i == 0]
lsreverse = reverse(ls)
answer = lsreverse[K-1]
print(answer)

#! /usr/bin/env python3
# -*- coding: utf-8 -*-

A,B,K = [int(x) for x in input().split()]
ls =[i in range(1,A+1) if A % i == 0 and B % i == 0]
print(ls[K])

#! /usr/bin/env python3
# -*- coding: utf-8 -*-

A,B,K = [int(x) for x in input().split()]
ls =[i for i in range(1,A+1) if A % i == 0 and B % i == 0]
answer = ls[K]
 print(answer)

#! /usr/bin/env python3
# -*- coding: utf-8 -*-

A,B,K = [int(x) for x in input().split()]
ls =[]
for i in range(1,A+1):
    if A % i == 0 and B % i == 0:
        ls.append(i)

print(ls[K])

#! /usr/bin/env python3
# -*- coding: utf-8 -*-

A,B,K = [int(x) for x in input().split()]
ls =[i for i in range(1,A+1) if A % i == 0 and B % i == 0]
ls.reverse()
answer = ls[K-1]
print(answer)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
A,B,K=map(int,input().split())
i=0
j=1
a=[]
while A%j==0 and B%j==0:
    a.append(j)
    j+=1
print(a[-K])


A,B,K=map(int,input().split())
i=0
j=1
a=[]
if A%j==0 and B%j==0:
    a.append(j)
    j+=1
print(a[-K])

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

A,B,K=map(int,input().split())
i=0
j=1
a=[]
if A%j==0 and B%j==0:
    a.append(j)
    j+=1
print(a[-4])

A,B,K=map(int,input().split())
i=0
j=1
a=[]
while j<=max(A,B):
    if A%j==0 and B%j==0:
        a.append(j)
    j+=1
print(a[-K])

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
str_in = input().split()
a = int(str_in[0])
b = int(str_in[1])
k = int(str_in[2])

if(a >= b):
  div = b
else:
  div = a

cnt = 0

for i in range(div):
  res_a = a % (div - i)
  res_b = b % (div - i)
  
  print(res_a, res_b, div-i,cnt)

  if ((res_a == 0) & (res_b == 0)):
    cnt += 1
    if(cnt == k):
      print (div - i)
      break

str_in = input().split()
a = int(str_in[0])
b = int(str_in[1])
k = int(str_in[2])

if(a >= b):
  div = b
else:
  div = a

cnt = 0

for i in range(div):
  res_a = a % (div - i)
  res_b = b % (div - i)

  if ((res_a == 0) & (res_b == 0)):
    cnt += 1
    if(cnt == k):
      print (div - i)
      break

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a = []
A,B,K  = map(int, input().split())

if A > B:
	min = B
else:
  min = A

for i in B:
  if(A % i == 0 && B % i == 0):
    a.append(i)

print(a.get(K-1))

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

#no 1 is a(len-1)
# no k is a(lent-K)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
A, B, K = map(int, input().split())

yakusuu=[]
for i in range(1,A+1):
  if A% i == 0:
    yakusuu.append(i)
  
for j in range(1,B+1):
  if B%j == 0:
    yakusuu.append(j)
   
yakusuu.append(1)  
    
print(sorted(yakusuu)[K])

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

yakusuu=[]
yakusuuA = []
yakusuuB = []
for i in range(1,A+1):
  if A% i == 0:
    yakusuuA.append(i)
  
for j in range(1,B+1):
  if B%j == 0:
    yakusuuB.append(j)
    
yakusuu = set(yakusuuA) & set(yakusuuB)
yakusuu.append(1)     
print(sorted(yakusuu)[K])

  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  

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

yakusuu=[]
yakusuuA = []
yakusuuB = []
for i in range(1,A+1):
  if A% i == 0:
    yakusuuA.append(i)
  
for j in range(1,B+1):
  if B%j == 0:
    yakusuuB.append(j)
    
yakusuu = list(set(yakusuuA) & set(yakusuuB))
yakusuu.append(1)     
print(sorted(yakusuu)[K-1])

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

yakusuu=[]
yakusuuA = []
yakusuuB = []
for i in range(1,A+1):
  if A% i == 0:
    yakusuuA.append(i)
  
for j in range(1,B+1):
  if B%j == 0:
    yakusuuB.append(j)
    
yakusuu = list(set(yakusuuA) & set(yakusuuB))
yakusuu.append(1)     
print(sorted(yakusuu, reverse=True)[K-1])

  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  

Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
A, B, K = [int(i) for i in input().split()]

l=[]

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

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

l=[]

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a,b,k= map(int,input().split())
cou = 0
for i in range(1,101):
    if a%i == 0 and b%i == 0:
        cou += 1
    print(i,cou)
    if cou == k:
        print(i)
        break


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


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
def gcd( x, y ):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)

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

N = gcd(A, B)
print(make_divisors(N)[-K])

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

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, B, K = map(int, input().split())
N = gcd(A, B)
print(make_divisors(N)[-K])

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
A,B,K=[int(i) for i in input().split()]
a=[]
for i in range(1,max(A,B)):
  if A%i==0 and B%i==0:
    a.append(i)
print(a[-k])
  

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):


import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

A, B, K = map(int, readline().split())
ans = 1
num = 1
for i in range(2, min(A, B) + 1):
    print(num)
    print(ans)
    if num == K:
        break
    if A % i == 0 and B % i == 0:
        print(ans)
        num += 1
        ans = i

print(ans)




import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

A, B, K = map(int, readline().split())
ans = 1
num = 1
for i in range(2, min(A, B) + 1):
    if num == K:
        break
    if A % i == 0 and B % i == 0:
        print(ans)
        num += 1
        ans = i

print(ans)




import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

A, B, K = map(int, readline().split())
lis=[]
for i in range(1, min(A, B) + 1):

    if A % i == 0 and B % i == 0:
        lis.append(i)
lis.reverse()
print(lis[K-1])


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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-1:
            print(i)

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)
l.sort(reverse=True)
print(l)
print(l[K - 1])

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)
l.sort(reverse=True)
print(l[K - 1])

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import fractions as f
a,b,k=map(int,input().split())
g=f.gcd(a,b)
count=0
#print(g)
for s in range(101,1,-1):
    if g%s==0:
#        print(s)
        count+=1
    if count==k:
        print(s)
        exit()

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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==4:
    print(i)
    break

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


Verdicts: Wrong Answer

Accepted
Problem: 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.

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

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

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

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a,b,k=list(map(int,input().split()))
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)
num=gcd(a,b)
print("gcd",num)
c=[]
for i in range(1,num+1):
    if num % i == 0:
        c.append(i)

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


a,b,k=list(map(int,input().split()))
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)
num=gcd(a,b)
c=[]
for i in range(1,num+1):
    if num % i == 0:
        c.append(i)

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


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
,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])


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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
#B
A,B,K = map(int, input().split())

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


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

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


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a,b,k=map(int,input().split())
c=100,d=0
while d<k:
  if a%c==0 and b%c==0:
    d+=1
  c-=1
print(c+1)


a,b,k=map(int,input().split())
c=100
d=0
while d<k:
  if a%c==0 and b%c==0:
    d+=1
  c-=1
print(c+1)


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
100 50 4


# coding: utf-8
# Your code here!

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

def d(n):
    div = []
    for i in range(1,n+1):
        if(n % i == 0):
            div.append(i)
    return div
        
a_d = d(a)
b_d = d(b)
s = []
l = []
ab = []

if len(a_d) < len(b_d):
    s = a_d
    l = b_d
else:
    s = b_d
    l = a_d

for i in s:
    if i in l:
        ab.append(i)
print(ab[len(ab)-k])
    

Verdicts: Runtime Error

Accepted
Problem: 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.

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


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


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
A, B, K = map(int, input().split())
a=[]
b=[]
if A>=B:
  for i in range(1,A+1): 
    if A%i==0 and B%i==0:
      a.append( A/i )
      b.append( B/i )
  
else:
  for i in range(1,B+1): 
    if A%i==0 and B%i==0:
      a.append( A/i )
      b.append( B/i )

c=[]
for ea in a:
  if ea in b:
    c.append( ea )

print(c[K])
    


A, B, K = map(int, input().split())
a=[]
#b=[]
if A>=B:
  for i in range(1, A+1): 
    if A%i==0 and B%i==0:
      a.append( i )
      # b.append( B/i )
  
else:
  for i in range(1, B+1): 
    if A%i==0 and B%i==0:
      a.append( i )
      # b.append( B/i )

#print(a)
#print(b)

#c=[]
#for ea in a:
 # if ea in b:
  #  c.append( ea )
c=len(a)
print(a[c-K])
    


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
A,B,K=map(int,input().split())
a=0
for i in range(min(A,B)):
    if A%i==0 and B%i==0:
        a+=1
        if a==K:
            print(i)

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a,b,k = map(int,input().split())
count = 0
if b >= a:
    count = a
    b = a
    a = count
ch = 1
for i in range(a,0,-1):
    if a % i == 0 and b % i == 0 and k == ch:
        print(i)
        break
    elif a % i == 0 and b % i == 0:
        ch += 1

a,b,k = map(int,input().split())
count = 0
if b >= a:
    count = a
    a = b
    b = count
ch = 1
for i in range(a,0,-1):
    if a % i == 0 and b % i == 0 and k == ch:
        print(i)
        break
    elif a % i == 0 and b % i == 0:
        ch += 1

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a, b, c = map(int, input().split())
d = max(a, b)
l = []
for i in range(1,d+1):
  if a % i == 0 and b % i == 0:
    l.append(i)
print(l[len(l)-c+1])

a, b, c = map(int, input().split())
d = max(a, b)
l = []
for i in range(1,d+1):
  if a % i == 0 and b % i == 0:
    l.append(i)
rint(l[len(l)-c])

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

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

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

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a, b, k = map(int, input().split())
n = 1
count = 0
list = []
while count < k:
    if a % n == 0 and b % n == 0:
        list.append(n)
        count += 1
        n += 1
        print(n)
    else:
        n += 1
        print(n)
print(list[k-1])

a, b, k = map(int, input().split())
n = 1
count = 0
list = []
while n <= a and n <=  b:
    if a % n == 0 and b % n == 0:
        list.append(n)
        n += 1
    else:
        n += 1
print(list[-k])

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a,b,c=(map(int,input().split()))
gcd = 0
d = max[a,b]
for i in range(1,d+1):
  if a%i==0:
    if b%i==0:
      gcd+=1
      if gcd ==c:
        print(i)

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

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

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

Verdicts: Runtime Error

Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a,b,k=map(int,input().split())
numlst=[]
for i in range(max(a,b)):
    if a%(i+1)==0 and b%(i+1)==0:
        numlst.append(i+1)
print(numlst)
print(numlst[len(numlst)-k])

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

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
def divisor(n): 
    i = 1
    table = []
    while i * i <= n:
        if n % i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table

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

a_divisor = divisor(A)
b_divisor = divisor(B)

print(sorted(list(set(a_divisor) & set(b_divisor)), reverse=True)[K])

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

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

a_divisor = divisor(A)
b_divisor = divisor(B)

print(sorted(list(set(a_divisor) & set(b_divisor)), reverse=True)[K-1])

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
A, B, K = map(int, input().split())

t_list = []
for i in range(1, 10 ** 5):
    if A%i == 0 and B%i == 0:
        count += 1
        t_list.append(i)
        
        

        
print(t_list[-K])

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

t_list = []
for i in range(1, 10 ** 5):
    if A%i == 0 and B%i == 0:
        t_list.append(i)
           
print(t_list[-K])


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a, b , k = map(int, input().split(' '))
count = 0
result = 1
if a < b:
    i = a
else:
    i = b
while count != k:
    if a%i == 0 and b%i == 0:
        count += 1
        result = i
        print(i)
    i -= 1
print(result)

a, b , k = map(int, input().split(' '))
count = 1
result = 0
i= 1
while count != k:
    if a%i == 0 and b%i == 0:
        count += 1
        result = i
    i += 1
print(result)

a, b , k = map(int, input().split(' '))
count = 1
result = 1
i= 1
while count != k:
    if a%i == 0 and b%i == 0:
        count += 1
        result = i
    i += 1
print(result)


a, b , k = map(int, input().split(' '))
count = 0
result = 1
if a < b:
    i = a
else:
    i = b
while count != k:
    if a%i == 0 and b%i == 0:
        count += 1
        result = i
    i -= 1
print(result)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
A, B, K = map(int, input().split())
cnt = 0
ans = 0
for i in range(max(A, B)):
  if (A % i == 0 and B % i == 0):
    cnt += 1
  if cnt == K:
    print(i)
    exit()

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

Verdicts: Runtime Error

Accepted
Problem: 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.

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

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


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

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


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
A, B, K = list(map(int, input().split()))

S = [1]

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

S.append()

print(S[K-1])

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

S = [1]

for i in range(2,min(A,B)):
    if A % i == 0 or B % i == 0:
        S.append(i)

S.sort(reverse=True)

print(S[K-1])

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

S = [1]

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

S.sort(reverse=True)

print(S[K-1])

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
A, B, K = map(int, input().split())
print([i for i in range(1, max(A,B)+1) if A % i == 0 && B % i == 0][K-1])

A, B, K = map(int, input().split())
print([i for i in reversed(range(1, max(A,B)+1)) if A % i == 0 and B % i == 0][K-1])

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
# Common Division
Ai, Bi, K = map(int, input().strip().split())
A = max([Ai,Bi])
B = min([Ai,Bi])

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

# Common Division
Ai,Bi,K = map(int, input().strip().split())
A = max(Ai,Bi)
B = min(Ai,Bi)
x = [n for n in range(1,B+1)[::-1] if A%n == 0 and B%n == 0]
print(x[K-1])

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a,b,c = map(int,input().split())
cnt = 0
for i in range(min(a,b),-1):
  if a%i == 0 and b%i == 0:
    cnt += 1
    if cnt == c:
      break
print(i)

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

s = min(a,b)
for i in range(s,0,-1):
#  print("i:" + str(i))
  if a%i == 0 and b%i == 0:
    cnt += 1
    if cnt == c:
      ans = i
      break
print(ans)


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
A,B,K=map(int,input().split())
 l = []
for i in reversed(range(0, min(A, B)+1)):
    if (A%i==0)&(B%i==0):
        l.append(i)
    if len(l)==K:
        break        
print(l[-1])

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a,b,k=map(int,input().split())
f=0
c=min(a,b)
for i in range(c):
  d=c-i
  if(a%i==0 and b%i==0):
    f+=1
    if(f==k):
      print(i)

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

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

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a, b, k = map(int, input().split())
l = []

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

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

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

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

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
# 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])

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

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

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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)

    
    return divisors

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

A_list = make_divisors(A)
B_list = make_divisors(B)

both = set(A_list) & set(B_list)
both = list(both)
both.sort()
print(both)
print(both[-K])

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)

    
    return divisors

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

A_list = make_divisors(A)
B_list = make_divisors(B)

both = set(A_list) & set(B_list)
both = list(both)
both.sort()
print(both)
print(both[K-1])

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

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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])


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

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


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
A,B,K = map(int,input().split())
count = 0
for i in range(101,0,-1):
  if A%i == 0 and B%i == 0:
    count += 1
    print(i)
    if count == K:
      print(i)
      exit()


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


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
A,B,K=map(int,input().split())
div=[]
 for i in range(1,A):
     if(A%i==0 and B%i==0):
         div.append(i)
div.sort()
print(div[len(div)-K])


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

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

Verdicts: Runtime Error

Runtime Error

Accepted