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

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

print(ans)

a, b, k = map(int, input().split())
tmp = 0
for i in range(max(a, b), 0, -1):
    if(a%i == 0)and(b%i == 0):
        tmp += 1
    if tmp == 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,100):
  if a%i == 0 and b%i == 0:
    div.append(i)
    break
print(sorted(div)[-K]

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

for i in range(1,101):
	if A%i == 0 and B%i == 0:
		div.append(i)
print(sorted(div)[-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())
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

A, B, K = map(int, input().split())
ans = 0
curr = min(A, B)
while K > 0:
    if A % curr == 0 and B % curr == 0:
        K -= 1
        ans = curr
    curr -= 1
print(ans)

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())
index = 0
for i in range(100, 0, -1):
  if int(A / i) == 0 and int(B / i) == 0:
    index += 1
    if(K == i):
      res = i
print(res)

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

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


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


Verdicts: Runtime Error

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

a,b,k = map(int,input().split())
i = 1
ans = []
while i<=min(a,b):
    if a % i == 0 and b % i == 0:
        ans.append(i)
    i += 1
print(ans[-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 main():
    A,B,K=list(map(int, input().split()))
    print(A,B,K)
    divisors=[]
    count = 0
    for i in range(1,min(A,B)+1):
        if min(A,B)%i==0:
            divisors.append(i)
    for divisor in divisors:
        if max(A,B)%divisor==0:
            count+=1
            if count==K:
                print(divisor)
if __name__ =='__main__':
    main()


def main():
    A,B,K=list(map(int, input().split()))
    divisors=[]
    count = 0
    for i in range(1,min(A,B)+1):
        if min(A,B)%i==0:
            divisors.append(i)
    divisors.reverse()
    for divisor in divisors:
        if max(A,B)%divisor==0:
            count+=1
            if count==K:
                print(divisor)
if __name__ =='__main__':
    main()


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())
import math
temp=a*b//math.gcd(a,b)
print(temp*k)
  

a,b,k=map(int,input().split())
import fractions
temp=a*b//fractions.gcd(a,b)
print(temp*k)
  

a,b,k=map(int,input().split())
temp=[]
for i in range(1,min(a,b)+1):
  if a%i==0 and b%i==0:
    temp.append(i)
print(temp[len(temp)-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):
in_str = input()
input_list = list(map(int,in_str.split()))
A = input_list[0]
B = input_list[1]
K = input_list[2]
count = 0
ans = 0
for i in range(100):
  if(A/i==0 and B/i==0):
    ans = i
    count+=1
    if(count==K):
      break
print(ans)

in_str = input()
input_list = list(map(int,in_str.split()))
A = input_list[0]
B = input_list[1]
K = input_list[2]
count = 0
ans = 0
max = 100
for i in range(max):
  div = max-i
  if(A%div==0 and B%div==0):
    ans = div
    count+=1
    if(count==K):
      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 = list(map(int,input().split()))

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

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

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

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

import math

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

cnt = 0
for i in reversed(range(1, 101)):
	if a % i == 0 and b % i == 0:
		#print(i)
		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):
a = list(map(int, input().split()))
num1 = a[0]
num2 = a[1]
list1 = []
list2 = []
max = a[2]
for i in range(1, num1 + 1):
  if num1 % i == 0:
    list1.append(i)
    
for i in range(1, num2 + 1):
  if num2 % i == 0:
    list2.append(i)

list3 = list(set(list1) & set(list2))
list3.sort()
print(list3)
print(list3[max -1])

a = list(map(int, input().split()))
num1 = a[0]
num2 = a[1]
list1 = []
list2 = []
max = a[2]
for i in range(1, num1 + 1):
  if num1 % i == 0:
    list1.append(i)
    
for i in range(1, num2 + 1):
  if num2 % i == 0:
    list2.append(i)

list3 = list(set(list1) & set(list2))
list3.sort()
list3.reverse()

print(list3[max -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 resolve():
    a, b, k = map(int, input().split())
    t = []
    i = 1
    while len(t) < k:
        if a % i == 0 and b % i == 0:
            t.append(i)
        i += 1
    print(t[k-1])

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

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

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

if A > B:
	tmp = B
	B = A
	A = tmp

count = 0
ans = 0

for i in range(1,A+1):
	if A % i == 1 and B & i ==1
		count += 1
		if count == K:
			ans = i
			break

print(ans)

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


if A > B:
	A, B = B, A
	

d = []

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

d.reverse()
print(d[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 math
a, b, c = map(int, input().split())
A = list(range(min(a, b)+1))
d = 0
e = 0
A.reverse()
for i in A[:-1]:
    print(i)
    if a % i == 0 and b % i == 0:
        d += 1
        if c == d:
            e = i
            break
print(e)


a, b, c = map(int, input().split())
A = list(range(min(a, b)+1))
d = 0
e = 0
A.reverse()
for i in A[:-1]:
    if a % i == 0 and b % i == 0:
        d += 1
        if c == d:
            e = i
            break
print(e)


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())
l = []

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

print(l[k-2])


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


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(m, n):
    x = max(m, n)
    y = min(m, n)
    if x % y == 0:
        return y
    else:
        while True:
            if x % y != 0:
                z = x % y
                x = y
                y = z
            else:
                break
        return z
A, B, K = map(int, input().split())
A_B_gcd = gcd(A, B)
yakusuu_arr = []
for i in range(1, A_B_gcd):
    if A_B_gcd % i == 0:
        yakusuu_arr.append(i)
print(yakusuu_arr)
print(yakusuu_arr[-K+1])

def gcd(m, n):
    x = max(m, n)
    y = min(m, n)
    if x % y == 0:
        return y
    else:
        while True:
            if x % y != 0:
                z = x % y
                x = y
                y = z
            else:
                break
        return z
A, B, K = map(int, input().split())
A_B_gcd = gcd(A, B)
yakusuu_arr = []
for i in range(1, A_B_gcd+1):
    if A_B_gcd % i == 0:
        yakusuu_arr.append(i)
yakusuu_arr.sort(reverse=True)
print(yakusuu_arr[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())

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

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

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 = []

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

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

G = set(A) and set(B)

G.reverse()

num = input()

print(G[num])







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

A = []
B = []

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

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

G = set(A) and set(B)

G.reverse()

num = input()

print(G[num])







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


A = []

B = []


for i in range (1,a+1):

	if(a % i == 0):

		A.append(i)


for j in range (1,b+1):

	if(a % i == 0):

		B.append(j)


G = set(A) and set(B)


G.reverse()



print(G[k])







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


A = []

B = []


for i in range (1,a+1):

	if(a % i == 0):

		A.append(i)


for j in range (1,b+1):

	if(a % i == 0):

		B.append(j)


G = set(A) & set(B)


G.reverse()



print(G[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:
		count += 1
		d = i;
	if count == k:
		print(d)
		break


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
		d = i;
	if count == k:
		print(d)
		break


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

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

ans = []

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

    print(ans[k-1])


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




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

ans = []

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

    print(ans[-k])




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

ans = []

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

print(ans[-k])


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())
l=[]

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

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

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

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

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

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

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

a, b, k = map(int, input().split())
a, b = max(a,b), min(a,b)
c = []
for i in range(1, b+1):
    if (a % i == 0) & (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())

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

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

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

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


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 = [int(s) for s in input().rstrip().split()]
j=0
for i in range(1,101):
    if (a%i == 0) and (b%i == 0):
        j+=1
        if j+1 == k:
            break

print(i)

a,b,k = [int(s) for s in input().rstrip().split()]
j=0
for i in range(min(a,b),0,-1):
    if (a%i == 0) and (b%i == 0):
        j+=1
        if j == k:
            break

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 = map(int, input().strip().split(' '))
i = 1
l = []
while len(l)<k:
    if a%i=0 and b%i=0 or i%2=0:
        l.append(i)
    else:
        pass
    i=i+1
print(l[-1])

a, b, k = map(int, input().strip().split(''))
i = 1
l = []
while len(l)<k:
    if (a%i==0 and b%i==0) or i%2==0 or i%5==0:
        l.append(i)
    else:
        pass
    i=i+1
print(l[-1])

a, b, k = map(int, input().strip().split(' '))
i = 1
l = []
while i<=a or i<=b:
    if a%i==0 and b%i==0:
        l.append(i)
    else:
        pass
    i=i+1
print(l[-k])

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

a,b,c=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[-c])

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


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


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

print(l[len(l)-K])


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())
mx = max(a, b) * 0.5
match, ans = 0, 0

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

a, b, k = map(int, input().split())
mx = max(a, b) * 0.5
match, ans = 0, 0

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

a, b, k = map(int, input().split())
mx = max(a, b) * 0.5
match, ans = 0, 0

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


a, b, k = map(int, input().split())
mx = max(a, b)
match, ans = 0, 0

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


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())
cnt = 0

for i in range(100, 0, -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(100, 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):
list = list(map(int,input().split(" ")))

olist = []
cnt = 0
for i in range(1, int(min(list[0],list[1]))):
  if(list[0] % i == 0 and list[1] % i == 0):
    olist.append(i)
    cnt = 1
if (cnt == 1):
  print(olist[len(olist) + 1 - list[2]])
else:
  print(1)

list = list(map(int,input().split(" ")))

X = []
cnt = 0
for i in range(1, 1 + int(min(list[0],list[1]))):
  if(list[0] % i == 0 and list[1] % i == 0):
    X.append(i)
    cnt = 1
X.sorted(reverse)
if (cnt == 1):
  print(X[list[2]-1])
else:
  print(1)

list = list(map(int,input().split(" ")))

X = []
cnt = 0
for i in range(1, 1 + int(min(list[0],list[1]))):
  if(list[0] % i == 0 and list[1] % i == 0):
    X.append(i)
    cnt = 1
X.sort(reverse=True)
if (cnt == 1):
  print(X[list[2]-1])
else:
  print(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):
l = list(map(int, input().split()))
l1 = []
a, b, c = l[0], l[1], l[2]
m = min(a,b)

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

print(sorted(set(l1)))

print(sorted(set(l1))[c-1])

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

print(l[::-1][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())
c = 0
for i in range(a, -1, -1):
  if i % a == 0 and i % b == 0:
    c += 1
    if c == k:
      print(i)
      break

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

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

if a==1 or b==1:
    print(1)
    exit()
    
for d in range(1,c):
    if a%d==0 and b%d==0:
            y.append(d)

print(y[k])
print(y)


a,b,k = map(int,input().split())
x=0
y=[0]
c=min(a,b)

if a==1 or b==1:
    print(1)
    exit()
    
for d in range(1,c+1):
    if a%d==0 and b%d==0:
            y.append(d)

print(y[-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())
S = []
for i in range(100):
  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(100):
  if A%(i+1)==0 and B%(i+1)==0:
    S.append(i)
print(S[K-1])

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

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

Verdicts: Runtime Error

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())
p=[]
for i in range(a):
  if a%i==0 and b%i==0:
    p.append(i)

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

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

n=len(p)
print(p[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):
import sys
stdin = sys.stdin
from math import sqrt

def li(): return map(int, stdin.readline().split())




A, B, K = tuple(li())
count = 0
g = min(A, B)
can = set()
cnt = 0
for i in range(1, int(sqrt(g)) + 1):
    if g % i == 0:
        cnt += 1
        can.add(i)
        can.add(g // i)
        if cnt >= K:
            break

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


import sys
stdin = sys.stdin
from math import sqrt

def li(): return map(int, stdin.readline().split())




A, B, K = tuple(li())
count = 0
g = min(A, B)
can = []
cnt = 0
for i in range(1, g + 1):
    if A % i == 0 and B % i == 0:
        
        
        can.append(i)



print(can[-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())
lista = [a for a in range(1, A + 1) if A % a == 0]
listb = [b for b in range(1, B + 1) if B % b == 0]
listc = list(set(lista) & set(listb))
#print(lista)
#print(listb)
#print(listc)

print(listc[K])


A, B, K = map(int, input().split())
lista = [a for a in range(1, A + 1) if A % a == 0]
listb = [b for b in range(1, B + 1) if B % b == 0]
listc = sorted(list(set(lista) & set(listb)))

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

lis=[]
if a>b:
    for i in range(b):
        if a%(b-i)==0 and b%(b-i)==0:
            lis.append(b-i)

else:
    for i in range(a):
        if a%(b-i)==0 and b%(b-i)==0:
            lis.append(b-i)

print(lis[c-1])


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

lis=[]
if a>b:
    for i in range(b):
        if a%int(b-i)==0 and b%int(b-i)==0:
            lis.append(int(b-i))

else:
    for i in range(a):
        if a%(a-i)==0 and b%(a-i)==0:
            lis.append(int(a-i))

#print(lis)
print(lis[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):
A, B, K = map(int, input().split())

count = 0
index = 0
if A > B:
  for i in range(B):
    if A // i == 0 and B // i == 0:
      index = i
      count = count+1
      if count == K:
        break
elif A < B:
    for i in range(A):
      if A // i == 0 and B // i == 0:
        index = i
        count = count+1
        if count == K:
          break
  
print(index)  

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

if A > B:
  for i in range(B):
    if A % i == 0 and B % i == 0:
      index = i
      count = count+1
      if count == K:
        break
elif A < B:
    for i in range(A):
      if A % i == 0 and B % i == 0:
        index = i
        count = count+1
        if count == K:
          break
  
print(index)  

A, B, K = map(int, input().split())
 
count = 0
index = 0
 
if A >= B:
  for i in reversed(range(1, B+1)):
    if A % i == 0 and B % i == 0:
      index = i
      count = count+1
      if count == K:
        break
elif A < B:
    for i in reversed(range(1,A+1)):
      if A % (i) == 0 and B % (i) == 0:
        index = i
        count = count+1
        if count == K:
          break
  
print(index) 

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

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


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

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


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):
import fractions

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

a_re = []
b_re = []

for i in range(max(A,B) + 1):
    if i == 0:
        continue
    print(i)
    if A % i ==0:
        a_re.append(i)
    if B % i ==0:
        b_re.append(i)
print(a_re)

result = list (set(a_re) & set( b_re))

result.sort(reverse=True)
print(result[K-1])


import fractions

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

a_re = []
b_re = []

for i in range(max(A,B)//2 +1):
    if i == 0:
        continue
    if A % i ==0:
        a_re.append(i)
    if B % i ==0:
        b_re.append(i)

result = list (set(a_re) & set( b_re))
result.sort(reverse=True)

print(result)
print(result[K-1])

import fractions

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

a_re = []
b_re = []

for i in range(max(A,B) + 1):
    if i == 0:
        continue
    #print(i)
    if A % i ==0:
        a_re.append(i)
    if B % i ==0:
        b_re.append(i)
#print(a_re)

result = list (set(a_re) & set( b_re))

result.sort(reverse=True)
print(result[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())

def ooo(x):
    list =[]
    for i in range(1, x+1):
        if x % i == 0:
            li.append(i)
    return li

lia = ooo(a)
lib = ooo(b)
li = lia + lib

li2 =[]
for n in range(len(li)):
    if not li[n] in li2: 
        if li.count(li[n]) == 2:
            li2.append(li[n])

li2.sort(reverse=True)
print(li2[k-1])

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

print(li[-k])

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

def ooo(x):
    lix =[]
    for i in range(1, x+1):
        if x % i == 0:
            li.append(i)
    return lix

lia = ooo(a)
lib = ooo(b)
li = lia + lib

li2 =[]
for n in range(len(li)):
    if not li[n] in li2: 
        if li.count(li[n]) == 2:
            li2.append(li[n])

li2.sort(reverse=True)
print(li2[k-1])

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

for i in range(1, a):
    if a % i == 0:
        li.append(i)
    else:
        continue

for i in range(1, b):
    if b % i == 0:
        li.append(i)
    else:
        continue

li2 =[]
for n in range(len(li)):
    if li.count(li[n]) == 2:
        li[n] = num
        li2.append(num)
        li.remove(num)
        li.remove(num)
    else:
        continue

li2.sort(reverse=True)
print(li2[k-1])

for i in range(1, a):
    if a % i == 0:
        li.append(i)
    else:
        continue

for i in range(1, b):
    if b % i == 0:
        li.append(i)
    else:
        continue

li2 =[]
for n in range(len(li)):
    if li.count(li[n]) == 2:
        li[n] = num
        li2.append(num)
        li.remove(num)
        li.remove(num)
    else:
        continue

li2.sort(reverse=True)
print(li2[k-1])

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

print(li[-k])

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

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

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

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 +=[i]
print(p[-K])

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())
i = 1
j = 1
ans = 1
while (i < K):
    if (A % j == 0) & (B % j == 0):
        ans = j
        i += 1
    j += 1

print(int(ans))


A, B, K = map(int, input().split())
i = 0
j = 100
ans = 1
while (i < K):
    if (A % j == 0) & (B % j == 0):
        ans = j
        i += 1
    j -= 1

print(int(ans))


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())
cd = []
for i in range(1,min(a,b)+1):
    if a % i == 0:
        if b % i == 0:
            cd.append(i)
cd.sort(reverse=True)
print(cd)
print(cd[k-1])

from fractions import gcd
a,b,k = map(int,input().split())
mods = []
for i in range(1,min(a,b)):
    if a % i == 0 and b % i == 0:
        mods.append(i)
mods.sort(reverse=True)
if len(mods) == 1:
    print(mods[0])
else:
    print(mods[k-1])

from fractions import gcd
a,b,k = map(int,input().split())
mods = []
for i in range(1,min(a,b)):
    if a % i == 0 and b % i == 0:
        mods.append(i)
mods.sort(reverse=True)
if len(mods) == 1:
    print(mods[0])
else:
    print(mods[k-1])

from fractions import gcd
a,b,k = map(int,input().split())
mods = []
for i in range(1,max(a,b)):
    if a % i == 0 and b % i == 0:
        mods.append(i)
print(mods[k-1])

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


Verdicts: Wrong Answer

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 = (int(i) for i in input().split())
cdiv = []
ans = []
a,b = min(a,b),max(a,b)
for i in range(1, a + 1):
    if a % i == 0:
        cdiv.append(i)
for i in cdiv:
    if b % i != 0:
        ans.append(i)


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


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


print(ans[len(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):
val = input().split(" ")
A = int(val[0])
B = int(val[1])
K = int(val[2])

arr1 = [i for i in range(1,A + 1) if A % i == 0]
arr2 = [j for j in range(1,B + 1) if A % j == 0]

result = list(set(arr1) & set(arr2))
result.sort()

print(result[k - 1])

val = input().split(" ")
A = int(val[0])
B = int(val[1])
K = int(val[2])
 
arr1 = [i for i in range(1,A + 1) if A % i == 0]
arr2 = [j for j in range(1,B + 1) if B % j == 0]
 
result = list(set(arr1) & set(arr2))
result.sort(revarse=True)
print(result[K - 1])

val = input().split(" ")
A = int(val[0])
B = int(val[1])
K = int(val[2])
 
arr1 = [i for i in range(1,A + 1) if A % i == 0]
arr2 = [j for j in range(1,B + 1) if B % j == 0]
 
result = list(set(arr1) & set(arr2))
result.sort(reverse=True)
print(result[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):
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")

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)
S = sorted(L, reverse = True)
print(S[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):
m = min(a, b)

for i in reversed(range(m+1)):
    if a % i == 0 and b % i == 0:
        k -= 1
        if k == 0:
            print(i)
            exit()

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

m = min(a, b)
l = []

for i in range(1, m+1):
    if a % i == 0 and b % i == 0:
        l.append(i)
print(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())

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


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

count_list = [i for i in range(1,101) if A%i==0 and B%i==0]
print(count_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):
def divisor(n):
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table
  
A, B, K = map(int, input().split())
ans = divisor(A) and divisor(B)
ans = list(reversed(ans))
print(ans[K-1])

def divisor(n):
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table
  
A, B, K = map(int, input().split())
ans = list(set(divisor(A)) & set(divisor(B)))
ans.sort(reverse=True)
print(ans[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())

cnt = 0
for i in range(1, max(a,b)+1):
    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 range(max(a,b)+1, 0, -1):
    if (a % i == 0) and (b % i == 0):
        cnt += 1
    if cnt == k:
        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())
c = 0
for i in range(min(A,B), 0, -1):
  if A % i == 0 and B % i == 0:
    print(c,i)
    c += 1
    if c == K:
      ans = i
print(ans)


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

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

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

from math import gcd

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]
    
a, b, k = map(int, input().split())
x = gcd(a, b)
l = make_divisors(x)
print(l[-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):
from fractions import Fraction

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

def fuc(left, right):
    val = Fraction(left, right)
    ans = val.denominator
    while ans%2 ==0:
        ans=ans//2
    while ans%5 ==0:
        ans=ans//5
    return ans==1

ans = []
i=0
while True:
    i+=1
    if fuc(a, i) and fuc(b, i) == 0:
        ans.append(i)
    if len(ans) > k:
        break

print(ans[k-1])


data = input().split()
a = int(data[0])
b = int(data[1])
k = int(data[2])
 
ans = []
for i in range(1, a+1 if a < b else b+1):
    if a%i == 0 and b%i == 0:
        ans.append(i)

print(ans[len(ans)-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 = input().split()
a = int(a)
b = int(b)
k = int(k)
a_list = []
b_list = []
for j in range(a):
    i = j + 1
    if a % i == 0:
        a_list.append(i)
for j in range(b):
    i = j + 1
    if b % i == 0:
        b_list.append(i)

#a_list.extend(b_list)

a_list = set(a_list)
b_list = set(b_list)
co_divisor = list(a_list & b_list)
co_divisor.sort()
print(co_divisor)
print(co_divisor[k-1])

a, b, k = input().split()
a = int(a)
b = int(b)
k = int(k)
a_list = []
b_list = []
for j in range(a):
    i = j + 1
    if a % i == 0:
        a_list.append(i)
for j in range(b):
    i = j + 1
    if b % i == 0:
        b_list.append(i)

#a_list.extend(b_list)

a_list = set(a_list)
b_list = set(b_list)
co_divisor = list(a_list & b_list)
co_divisor.sort(reverse=True)
print(co_divisor[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())

a = A
b = B
if a = b= 1:
    print('1')
    exit()
def cal_divisor(num):
    prime = [2,3,5,7,11,13]
    ans_list = []
    for i in range(len(prime)):
        ans_list.append([prime[i],0])
    for i in range(len(prime)):
        while True:
            if num % prime[i] == 0:
                num //= prime[i]
                ans_list[i][1] += 1
            if num % prime[i] != 0:
                break
    return ans_list

q = cal_divisor(a)
w = cal_divisor(b)

ans = []
for i in range(len(q)):
    ans.append([q[i][0],min(q[i][1],w[i][1])])


ans1 = []
for i in range(len(ans)):
    if ans[i][1] != 0:
        times = ans[i][1]
        for j in range(times+1):
            ans1.append(ans[i][0] ** j)
ans1.sort() 
print(ans1[K-1])

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

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

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

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

a = A
b = B

def cal_divisor(num):
    prime = [2,3,5,7,11,13]
    ans_list = []
    for i in range(len(prime)):
        ans_list.append([prime[i],0])
    for i in range(len(prime)):
        while True:
            if num % prime[i] == 0:
                num //= prime[i]
                ans_list[i][1] += 1
            if num % prime[i] != 0:
                break
    return ans_list

q = cal_divisor(a)
w = cal_divisor(b)

ans = []
for i in range(len(q)):
    ans.append([q[i][0],min(q[i][1],w[i][1])])
    
ans1 = []
for i in range(len(ans)):
    if ans[i][1] != 0:
        times = ans[i][1]
        for j in range(times+1):
            ans1.append(ans[i][0] ** j)
ans1.append(1)
ans1.sort()

print(ans1[K-1])

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

n = min(a,b)

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

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())
j=0
for i in range(101,1):
  A=a%i
  B=b%i
  if A==0:
    if B==0:
      j+=1
      print(i)
  if j==k:
    print(i)
    break

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

a,b,k = map(int,input().split())
j=0
for i in range(100,0,-1):
  A=a%i
  B=b%i
  if A==0:
    if B==0:
      j+=1
  if j==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):
S = input()
zero = 0
one = 0

for s in S:
    if s == "0":
        zero +=1
    elif s == "1":
        one += 1

print(min(zero, one) * 2)

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

kk = 0
out = 0

for i in range(min(a,b),0,-1):
    aa = a % i
    bb = b % i
    
    if (aa+bb)==0:
        kk += 1
        #print(aa,bb,i)
        if kk==k:
            out = i
            break
print(out)

Verdicts: Wrong Answer

Accepted