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())
l=[]
for i in range(1,100):
    if a%i==0 and b%i==0:
        l.append(i)
if k==len(k):
    print(l[0])
else:
    print(l[-k])

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)
if k==len(l):
    print(l[0])
else:
    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):
import fractions
a,b,k = map(int,input().split())
print(fractions.gcd(a,b)*k)

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

a,b,k = map(int,input().split())
count =0
for i in range(100,0,-1):
    if a%i ==0 and b%i ==0:
        count += 1
        if count ==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):
def cf(A,B):
    l=[]
    for i in range(1,min(A,B)+1):
        if A % i == 0 and B % i == 0:
            l.append(i)
    return l

def main():
    A, B, K = map(int,input().split())
    koyaku = cf(A,B)
    #print(koyaku)
    print(koyaku[-1])
    
if __name__ == '__main__':
    main()

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

def main():
    A, B, K = map(int,input().split())
    koyaku = cf(A,B)
    #print(koyaku)
    print(koyaku[-K])
    
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())
clist = []

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

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

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

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

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

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

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


def gcd(a, b):
    x = max(a, b)
    y = min(a, b)
    mod = x % y
    if mod == 0:
        return y

    return gcd(y, mod)


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


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


def gcd(a, b):
    x = max(a, b)
    y = min(a, b)
    mod = x % y
    if mod == 0:
        return y

    return gcd(y, mod)


mx = gcd(A, B)
count = 0

for a in range(mx, 0, -1):
    if A % a == 0 and B % a == 0:
        count += 1
    if count == K:
        ans = a
        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())
c = min(a, b)
ans = c
t = 1

if t == k:
    print (ans)
else:
    while t != k:
        ans -= 1
        if c%ans == 0:
            t+=1
    print(ans)


if a % i == b % i == 0:
        c += 1
    if c == k:
        print(i)
        break

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

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())
count=k
for i in range(100):
    if a%(i+1)==0 and b%(i+1)==0:
        count+=1
        if count==K:
            print(i+1)
            break

a,b,k=map(int,input().split())
N=[]
for i in range(100):
    if a%(i+1)==0 and b%(i+1)==0:
        N.append(i+1)
N.sort(reverse=True)
print(N[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())
if K== 1:
  print(1)
else:
  count=1
  ans=0
  for i in reversed(range(2,min(A,B))):
    if A % i == 0 and B % i == 0:
      count+= 1
      if count==5:
        ans=i
  print(ans)


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


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

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

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


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())
lnA = divisor(A)
lnB = divisor(B)
ln = []
for i in lnA:
    if i in lnB:
        ln.append(i)
line = sorted(ln, reverse = True)
print(line[K - 1])


A,B, K = map(int, input().split())
def divisor(n):
    div_list = []
    for i in range(1, int(1+ n**0.5)):
        if n%i == 0 and i**2 == n:
            div_list.append(i)
        elif n%i == 0:
            div_list.append(i)
            div_list.append(int(n/i))
    return div_list
lnA = divisor(A)
lnB = divisor(B)
ln = []
for i in lnA:
    if i in lnB:
        ln.append(i)
line = sorted(ln, reverse = True)
print(line[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):

def main():
	count = 0
	A,B,K = map(int,input().split())
	if B > A :
		A_factor = []
		for i in range(2,A+1) :
			if A%i == 0 :
				A_factor.append(i)
		for i in A_factor :
			if B%i == 0 :
				count += 1
				if count == K :
					print(i)
					return 0
	else :
		B_factor = []
		for i in range(2,B+1) :
			if B%i == 0 :
				B_factor.append(i)
		for i in B_factor :
			if A%i == 0 :
				count += 1
				if count == K :
					print(i)
					return 0

if __name__ == "__main__" :
	main()


a,b,k = map(int,input().split())
m = b if a<b else a
count = 0
cd = []
for i in range(1,m+1) :
	if a%i == 0 and b%i==0 :
		count+=1
		cd.append(i)
cd.sort(reverse=True)
print(cd[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 kcd(A, B, K):
    cd_list = []
    for i in range(2, min(A, B) + 1):
        if A % i == 0 and B % i == 0:
            cd_list.append(i)
    return cd_list[K - 1] 

i = list(map(int, input().split()))
A = i[0]
B = i[1]
K = i[2]


def kcd(A, B, K):
    cd_list = []
    for i in range(2, min(A, B) + 1):
        if A % i == 0 and B % i == 0:
            cd_list.append(i)
    return cd_list[K - 1]        


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

def kcd(A, B, K):
    cd_list = []
    for i in range(1, min(A, B) + 1):
        if A % i == 0 and B % i == 0:
            cd_list.insert(0,i)
    return cd_list[K - 1]

print(kcd(i[0],i[1],i[2]))
      


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

max_value = 0
if A >= B:
    max_value = A
else:
    max_value = B

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


A, B, K = map(int, input().split())
value_list = []
for i in range(1, 101):
    if A % i == 0 and B % i == 0:
        value_list.append(i)
value_list = sorted(value_list, reverse=True)
print(value_list[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 = list(map(int,input().split()))

tmp = 0
for i in range(200):
  if a% i == 0 and b % i == 0:
    tmp += 1
    if tmp == k:
      print(i)

def getN():
    return int(input())

def getMN():
    a = input().split()
    b = [int(i) for i in a]
    return b[0],b[1]

def getlist():
    a = input().split()
    b = [int(i) for i in a]
    return b


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

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

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

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

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

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

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

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())
a1 = [i for i in range(1,a+1) if a%i==0]
b1 = [j for j in range(1,b+1) if b%j==0]
print(sorted(a1 and b1)[-c])

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

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

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

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

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

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

Verdicts: Runtime Error

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

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

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

a,b,k=map(int,input().split())
print([i for i in range(1,min([a,b])+1) if a%i==0 and b%i==0][-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 = (int(x) for x in input().split())
i = 1
n = 0
NUM = [0]*min(A,B)

for i in range(1,min(A,B)+1):
    if A%i ==0 and B%i ==0:
        NUM[n] = i
        n+=1
NUM.sort(reverse = 1)
print(NUM)

print(NUM[K-1])

A,B,K = (int(x) for x in input().split())
i = 1
n = 0
NUM = [0]*min(A,B)

for i in range(1,min(A,B)+1):
    if A%i ==0 and B%i ==0:
        NUM[n] = i
        n+=1
NUM.sort(reverse = 1)

print(NUM[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):
#import sys
#import math
#import numpy as np

'''a,b= map(int,input().split())'''
#a, b, c = [list(map(int, input().split())) for _ in range(3)]
#li0= [int(x) for x in input().split()]
#n,l= map(int, input().split())
#x = [list(map(int, input().split())) for _ in range(n)] 
a,b,k=map(int,input().split())
ans=s=0
li=[]
if a>b:
  s=a
  a=b
  b=s
for i in range(1,b+1):
  if a%i==0 and b%i==0:
    li.append(i)
li.sort()
print(li)
print(li[-k])


#import sys
#import math
#import numpy as np

'''a,b= map(int,input().split())'''
#a, b, c = [list(map(int, input().split())) for _ in range(3)]
#li0= [int(x) for x in input().split()]
#n,l= map(int, input().split())
#x = [list(map(int, input().split())) for _ in range(n)] 
a,b,k=map(int,input().split())
ans=s=0
li=[]
if a>b:
  s=a
  a=b
  b=s
for i in range(1,b+1):
  if a%i==0 and b%i==0:
    li.append(i)
li.sort()

print(li[-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())
c = 1
i = 0
while 1:
    if a%c==0 and b%c==0:
        i += 1
    c += 1
    if i == k:
        break
print(c)

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

a,b,k = map(int,input().split())
c = min(a,b)
i = 0
while 1:
    if a%c==0 and b%c==0:
        i += 1
    if i == k:
        break
    c -= 1
print(c)

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):
num= [int(i) for i in input().split()]
max_n = min(num[0],num[1])
a = sorted(list(range(1,max_n+1)),reverse=True)
[i for i in a if (num[0]%i==0 and num[1]%i==0)][num[2]-1]

num= [int(i) for i in input().split()]
max_n = min(num[0],num[1])
a = sorted(list(range(1,max_n+1)),reverse=True)
print([i for i in a if (num[0]%i==0 and num[1]%i==0)][num[2]-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 = []
b = []

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

abset = list(set(a)&set(b))

print(abset[K+1])

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 B%j==0:
    b.append(j)

abset = list(sorted(set(a)&set(b)))[::-1]

print(abset[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())
cnt = 0
for i in range(1,a*b*k):
  if i%a==0 and i%b==0:
    cnt+=1
    if(cnt==k):
      print(i)
      exit()

a,b,k = map(int,input().split())
cnt = 0
ans = list()
for i in range(1,101):
  if a%i==0 and b%i==0:
    ans.append(i)

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

l.sort()
l.reverse()
if(l.empty()):
	
	print(0)
else:
	print(l[k-1])


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

l.sort()
l.reverse()
if(a==b==k):
	print(a)
else:
	print(l[k-1])


A,B,K=map(int,input().split())
ans=0
n=100
while True:
    if A%n==0 and B%n==0:
        ans+=1
        if ans==K:
            print(n)
            exit()
    n-=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())
l1 = [i for i in range(1, a) if (a % i == 0)]
l2 = [i for i in range(1, b) if (b % i == 0)]
l = list(set(l1) & set(l2))
l.sort()
print(l)

a, b, k = map(int, input().split())
l1 = [i for i in range(1, a+1) if (a % i == 0)]
l2 = [i for i in range(1, b+1) if (b % i == 0)]
l = list(set(l1) & set(l2))
l.sort(reverse = True)
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(" "))
flag = True
counter = 0
i = 1
while True:
  if A % i == 0 and B % i == 0:
    counter += 1
    print(i)
    if counter == K:
      print(i)
      break
  i += 1

A, B, K = map(int, input().split(" "))
flag = True
counter = 0
i = max(A, B)
while True:
  if A % i == 0 and B % i == 0:
    counter += 1
    if counter == K:
      print(i)
      break
  i -= 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())
n=min(a,b)
m=[]
i=1
j=1
while n//2<m:
  if j=k:
    print(i)
    exit()
  else:
    i+=1
    if a%i==0 and b%i==0:
      j+=1

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

a,b,k= map(int, input().split())
i=min(a,b)
j=0
while j!=k :
    if a%i==0 and b%i==0:
      j+=1
      if j==k:
        print(i)
        exit()
    i-=1

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

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

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

count = 0

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

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

count = []

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

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

split_num = 1
split_num_list = []

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

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


split_num_list = []

for i in range(1,min(A,B)+1):
    if A % i == 0 and B % i == 0:
        split_num_list.append(i)
split_num_list.sort(reverse=True)
print(split_num_list[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 = [int(akb) for akb in input().split()]
a, b = min(A, B), max(A, B)
r = b % a
while r > 0:
  b = a
  a = r
  r = b % a
gcd = a
ans = a
if K > 1:
  for i in range(100):
    if gcd % (i+1) == 0:
      ans = gcd / (i+1)
      K -= 1
    if K == 1:
      break
print(ans)

A, B, K = [int(akb) for akb in input().split()]
a, b = min(A, B), max(A, B)
r = b % a
while r > 0:
  b = a
  a = r
  r = b % a
gcd = a
ans = a
if K > 1:
  for i in range(1, 100):
    if gcd % (i+1) == 0:
      ans = gcd / (i+1)
      K -= 1
    if K == 1:
      break
print(ans)

A, B, K = [int(akb) for akb in input().split()]
a, b = min(A, B), max(A, B)
r = b % a
while r > 0:
  b = a
  a = r
  r = b % a
gcd = a
ans = a
if K > 1:
  for i in range(100):
    if gcd % (i+1) == 0:
      ans = gcd / i
      K -= 1
    if K == 1:
      break
print(ans)

A, B, K = [int(akb) for akb in input().split()]
a, b = min(A, B), max(A, B)
r = b % a
while r > 0:
  b = a
  a = r
  r = b % a
gcd = a
ans = a
if K > 1:
  for i in range(1, 100):
    if gcd % (i+1) == 0:
      ans = gcd / (i+1)
      K -= 1
    if K == 1:
      break
print(int(ans))

Verdicts: Wrong Answer

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):
S = input()
N = len(S)
ans = 0
for i in range(N):
  for j in range(i, N):
    if all('ACGT'.count(c) == 1 for c in S[i:j+1]):
      ans += max(ans, j-i+1)
print(ans)

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

inputa = input().split()
# inputb = input().split()
# inputc = input().split()

a = int(inputa[0])
b = int(inputa[1])
c = int(inputa[2])

# inputb = input().split()
# inputbint = [int(x) for x in inputb]
# inputList = list(b)

# x = int(inputb[0])


# inputList=[]


#     inputNum = [int(x) for x in inputNum]
#     inputList.append(inputNum)

# inputList = [int(n) for n in inputList]

# b = [int(n) for n in inputb]
# c = [int(n) for n in inputc]

min = min[a, b]
cnt = 0

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

import math
import copy
from copy import deepcopy
import sys
import fractions
# import numpy as np
from functools import reduce
# import statistics
import decimal
import heapq
import collections
import itertools
from operator import mul

sys.setrecursionlimit(100001)


# input = sys.stdin.readline


# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

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

ans = []

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

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

max_num = max(A, B)
count = 0

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


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

max_num = max(A, B)
count = 0

print(max_num)

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


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

max_num = max(A, B)
count = 0

for i in range(max_num, 0, -1):
    if A % i == 0 and B % i == 0:
        count += 1
        if count == 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):
import fraction

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

import fraction

a,b,c= map(int, input().split())
d= int(fraction.gcd(a,b))
if c==1:
  print(d)
else:
  arr=[]
  for i in range(1,d):
    if(d%i == 0):
      arr.append(i)
  print(arr[-(c-1)])

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

a,b,c= map(int, input().split())
d= int(gcd(a,b))
if c==1:
  print(d)
else:
  arr=[]
  for i in range(1,d):
    if(d%i == 0):
      arr.append(i)
  print(arr[-(c-1)])

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

a,b,c= map(int, input().split())
d= int(gcd(a,b))
if c==1:
  print(d)
else:
  arr=[]
  for i in range(1,d):
    if(d%i == 0):
      arr.append(i)
  print(arr[-(c-1)])
  

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

a, b, k = map(int, input().split())
c = [i for i in range(1, min(a, b) + 1) if a % i == 0 and b % i == 0]
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):
def cd(a,b):
  p = min(a,b)
  q = max(a,b)
  lst = []
  for i in range(1, p + 1):
    if (p % i == 0 and q % i == 0):
      lst.append(i)
  return lst
 
A,B,K = map(int, input().split())
lst = cd(A,B)
print(lst[-1 - K-1])

def cd(a,b):
  p = min(a,b)
  q = max(a,b)
  lst = []
  for i in range(1, p + 1):
    if (p % i == 0 and q % i == 0):
      lst.append(i)
  return lst
 
A,B,K = map(int, input().split())
lst = cd(A,B)
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())
n=0
for i in range(min(a,b),0,-1):
    if (a/i==a//i) and (b/i==b//i):
        print(i)
        n+=1
        if n==k:
            print(i)
            exit()


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

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

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

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

print(X[-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())
if(B>A):
  A,B=B,A
divisor = [x for x in range(B,0,-1) if (A%x==0 and B%x==0)]
print(divisor[K+1])

A,B,K = map(int,input().split())
d=[]
if(A>B):
    M=A
    m=B
else:
    M=B
    m=A

for x in range(m,0,-1):
    if(m%x ==0 and M%x ==0):
       d.append(x) 

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

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

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

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)


#print(C)
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):
s=list(map(int,input().split()))
a=0
for i in range(s[0]+1,1,-1):
  if a==s[2]:
    print(b)
    break
  if s[0]%i==0:
    if s[1]%i==0:
      a+=1
      b=i

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

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=[int(s) for s in input().split()]
x=0
i=1
while True:
  if a%i==0 and b%i==0:
    x+=1
  if x==k:
    print(i)
    break

a,b,k=[int(s) for s in input().split()]
x=0
i=min([a,b])
while True:
  if a%i==0 and b%i==0:
    x+=1
  if x==k:
    print(i)
    break
  i-=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):
import numpy as np
a,b,k = map(int,input().split())
c = np.array(list(range(1,min(a,b)+1))) 
print(c)

e = [f for f,g in enumerate(zip(a%c,b%c)) if g == (0,0)]
print(c[e[-k]])

a,b,k = map(int,input().split())
c = []
for i in range(min(a,b)):
    if a%(i+1) == 0 and b%(i+1) == 0:
        c.append(i+1)
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):
A,B,K = map(int,input().split())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    
    return divisors
a = make_divisors(A)
b = make_divisors(B)
c = (set(a)&set(b))
print(list(c)[-K+1])

A,B,K = map(int,input().split())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors
a = make_divisors(A)
b = make_divisors(B)
c = (set(a)&set(b))
print(c)
print(list(c)[-K])

A,B,K = map(int,input().split())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors
a = make_divisors(A)
b = make_divisors(B)
c = sorted(set(a)&set(b))
print(c,list(c)[-K])

A,B,K = map(int,input().split())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors
a = make_divisors(A)
b = make_divisors(B)
c = sorted(set(a)&set(b))
print(list(c)[-K])

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

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

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

cnt = 0
for i in range(1,101)[::-1]:
    if A%i == 0 and B%i == 0:
        cnt += 1
    if cnt == 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().split())

count=0

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

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

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

count=0

for i range(1,max(a,b)+1)[::-1]

if a%i==0 and b%i==0:
  count+=1
  if count==k:
    print(i)

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

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

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):
import numpy as np
import math
a,b,k = input().split()
a = int(a)
b = int(b)
k = int(k)
count_k = 0
for d in range(100,0, -1):
    if a % d == 0 and b % d == 0:
        count_k += 1

print(d)


import numpy as np
import math
a,b,k = input().split()
a = int(a)
b = int(b)
k = int(k)
count_k = 0
for d in range(100,0, -1):
    if a % d == 0 and b % d == 0:
        count_k += 1
        if count_k == k:
            break

print(d)


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

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

print(yakusuu[K-1])

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

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

print(yakusuu[-K])

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 os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from math import ceil, floor, sqrt, gcd
from copy import deepcopy

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

if __name__ == "__main__":
    main()

import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from math import ceil, floor, sqrt, gcd
from copy import deepcopy

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

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

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=(int(x) for x in 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=(int(x) for x in 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

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

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

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(x) for x in input().split()]
list_ = []
for k in range(1, min(A,B)):
  if A % k == 0 and B % k == 0:
    list_.append(k)
print(list_[len(list_)-K+1])

A, B, K = [int(x) for x in input().split()]
list_ = []
for k in range(1, min(A,B)+1):
  if A % k == 0 and B % k == 0:
    list_.append(k)
print(list_[::-1][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 as math
a,b,c=map(int,input().split())
print(math.gcd(a,b)*c)

a,b,c=map(int,input().split())
ct=1
ct2=1
while 1:
    if (a%ct==0)and(b%ct==0):
        ct2+=1
    if ct2==c:
        break
    ct+=1
print(ct)

a,b,c=map(int,input().split())
ct=a
ct2=0
while 1:
    if (a%ct==0)and(b%ct==0):
        ct2+=1
    if ct2==c:
        break
    ct-=1
print(ct)

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):
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

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

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

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

print(list_ab[-K])

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

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

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

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

print(list_ab[-K])

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

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

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

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

Verdicts: Wrong Answer

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

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

a , b, c = map(int, input().split())
X = []
for i in range(max(a,b)):
  if a % i == 0 and b % i == 0:
    X.append(i)
print(X[c])

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

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, n] = [int(i) for i in input().split()]
hoge = []
for i in range(1, 101):
    if i%a==0 and i%b==0:
        hoge.append(i)
print(hoge[n-1])


[a, b, n] = [int(i) for i in input().split()]
hoge = []
for i in range(1, 101):
    if a%i==0 and b%i==0:
        hoge.append(i)
hoge.sort(reverse=True)
print(hoge[n-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())

ans=0
cnt=0

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

a,b,k=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(ans[k+1])

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

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(ans[k+1])

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

a,b,k=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(ans[k+1])

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

Verdicts: Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Accepted