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


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

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())
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(1, 101):
    if A%i==0 and B%i==0:
        s.append(i)
print(s[len(s)-K])

Verdicts: Runtime Error

Accepted
Problem: You are given positive integers A and B.  Find the K-th largest positive integer that divides both A and B.  The input guarantees that there exists such a number.

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


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

print('l:',l)


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

if len(ans) == 0:
    print(1)
else:
    print('ans[k-1]',ans[k-1])


l = []
ans = []
a, b, k = list(map(int, input().split()))
l.append(a)
l.append(b)
i = 1

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

    print(ans[-k])

l = []
ans = []
a, b, k = list(map(int, input().split()))
l.append(a)
l.append(b)
i = 1

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

print(ans)
if len(ans) == 0:
    print(1)
else:
    print(ans[-k])

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

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

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 is_integer_num(n):
    if isinstance(n, int):
        return True
    if isinstance(n, float):
        return n.is_integer()
    return False
 
A,B,K = [int(i) for i in input().split()]

i = 100
count = 0
while(i<1):
 
    if is_integer_num(A/i) and is_integer_num(B/i):
        count = count+1
 
    if count == K:
        print(i)
        break    
    
    i = i-1

def is_integer_num(n):
    if isinstance(n, int):
        return True
    if isinstance(n, float):
        return n.is_integer()
    return False
 
A,B,K = [int(i) for i in input().split()]

i = 100
count = 0
while(i>0):
    
    if is_integer_num(A/i) and is_integer_num(B/i):
        count = count+1
 
    if count == K:
        print(i)
        break    
    
    i = 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())

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


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)


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

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

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

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

c=[]
for i in range(1,101):
    if a%i==0 and b%i==0:
        c = c+[i]
print(c)
print(c[-k])

a,b,k=[int(s) for s in input().split()]

c=[]
for i in range(1,101):
    if a%i==0 and b%i==0:
        c = c+[i]
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())
 
list=[]
list= [i for i in range(1,10) if A%i==0 and B%i==0]
list[K-1]

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

list= [i for i in range(10000) if A%i==0 and B%i==0]
list[K-1]

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

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

list=[]
list= [i for i in range(1,10000) if A%i==0 and B%i==0]
a = list[K-1]
ptint(a)

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

list=[]
list= [i for i in range(1,10000) if A%i==0 and B%i==0]
list[K-1]

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

list=[]
list= [i for i in range(10000) if A%i==0 and B%i==0]
list[K-1]

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

list=[]
list= [i for i in range(1,100) if A%i==0 and B%i==0]
list[K-1]

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

list=[]
list= [i for i in range(1,100) if A%i==0 and B%i==0]
list[K-1]

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

list=[]
list= [i for i in range(1,15) if A%i==0 and B%i==0]
a = list[K-1]
ptint(a)

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

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

print(list[-K])  

Verdicts: Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

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

a, b, k = map(int, input().split())
if a == 1 or b == 1:
    print(1)
    exit()
l = [i for i in range(1, min(a, b)+1) if a % i == 0 and b % i ==0]
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 = list(map(int,input().split( )))
a=A[0]
b=A[1]
k=A[2]
x=0
for h in range(1,51):
	i=50-h
	if a%i + b%i:
		continue
	x=x+1
	print(i)
	if x == k:
		break
print(i)

A = list(map(int,input().split( )))
a=A[0]
b=A[1]
k=A[2]
x=0
for h in range(51):
	i= (b if a>b else a)-h
	if a%i + b%i:
		continue
	x=x+1
	print(i)
	if x == k:
		break
print(i)

A = list(map(int,input().split( )))
a=A[0]
b=A[1]
k=A[2]
x=0
for h in range(100):
	i= (b if a>b else a)-h
	if a%i + b%i:
		continue
	x=x+1
	if x == k:
		break
print(i)


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


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

A,B,K = map(int,input().split())
 
cnt = 0
ans = []
 
for i in range(1,101):
    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):
abk = [int(i) for i in input().split()]
a = abk[0]
b = abk[1]
k = abk[2]

anss = []
for i in range(1,min(a,b)+1):
  if a%i==0 and b%i==0:
    anss.append(i)
    
anns.sort(reverse=True)
print(anss[k-1])


abk = [int(i) for i in input().split()]
a = abk[0]
b = abk[1]
k = abk[2]

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

ans =[]
dai = 0
if a>b:
    dai = a
else:
    dai = b
for i in range(1,dai+1):
    if a %i ==0 and b%i==0:
        ans.append(i)
ans.sort(reverse=True)
ans[k-1]

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

ans =[]
dai = 0
if a>b:
    dai = a
else:
    dai = b
for i in range(1,dai+1):
    if a %i ==0 and b%i==0:
        ans.append(i)
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):
def kth_common_divisor(a, b, k):

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

def main():
    a, b, k = map(int, input().split())
    print(kth_common_divisor(a, b, k))

if __name__ == '__main__':
    main()


def kth_common_divisor(a, b, k):

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

    count.sort(reverse=True)
    return count[k-1]

def main():
    a, b, k = map(int, input().split())
    print(kth_common_divisor(a, b, k))

if __name__ == '__main__':
    main()


Verdicts: Runtime Error

Accepted
Problem: You are given positive integers A and B.  Find the K-th largest positive integer that divides both A and B.  The input guarantees that there exists such a number.

Submission attempts (in order):
S = input()

S = S.split()

S = list(map(int, S))

A = S[0]
B = S[1]
K = S[2]

list = []

if A > B:
  C = A
else:
  C = B

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

print(list[K])
  
  
  
  
  

S = input()

S = S.split()

S = list(map(int, S))

A = S[0]
B = S[1]
K = S[2]

list = []

if A > B:
  C = A
else:
  C = B

for i range(C):
  if (A % i==0) and (B % i == 0):
    list.append(i)

print(list[K])
  
  
  
  
  

A,B,K = map(int, input().split())
A_div = []
B_div = []
C     = set()

def divisor(a,b):

    for i in range(1, int(a**0.5)+1, 1):
        if a%i==0:
            A_div.append(i)
            A_div.append(a//i)
        
    for i in range(1, int(b**0.5)+1, 1):
        if b%i==0:
            B_div.append(i)
            B_div.append(b//i)

def f():
    for a in A_div:
        for b in B_div:
            if a==b:
                C.add(a)

divisor(A,B)
f()

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

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: You are given positive integers A and B.  Find the K-th largest positive integer that divides both A and B.  The input guarantees that there exists such a number.

Submission attempts (in order):
A,B,K = [int(_) for _ in input().split()]
c = 0
i = 100
while True:
    if A%i == B%i == 0:
        c += 1
        print(i)
    if c == K:
        break
    i -= 1
print(i)

A,B,K = [int(_) for _ in input().split]
M = A*B
print(M * K)

A,B,K = [int(_) for _ in input().split()]
M = A*B
print(M * K)

A,B,K = [int(_) for _ in input().split()]
c = 0
i = 100
while True:
    if A%i == B%i == 0:
        c += 1
    if c == K:
        break
    i -= 1
print(i)

Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Accepted
Problem: You are given positive integers A and B.  Find the K-th largest positive integer that divides both A and B.  The input guarantees that there exists such a number.

Submission attempts (in order):
def make_divisors(n,m):
    divisors = []
    for i in range(1, int(n)):
        if n % i == 0 and m % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors
n,m,k = map(int,input().split())
if n <= m:
    c = make_divisors(n,m)
else:
    c = make_divisors(m,n)
print(c[-1+k]

def make_divisors(n,m):
    divisors = []
    for i in range(1,n+1):
        if n % i == 0 and m % i == 0:
            divisors.append(i)
    divisors.sort()
    return divisors
n,m,k = map(int,input().split())
if n <= m:
    c = make_divisors(n,m)
else:
    c = make_divisors(m,n)
c.reverse()
print(c[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 = []

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

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

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

a = []

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

print(a[-K])
        

Verdicts: Runtime Error

Accepted
Problem: You are given positive integers A and B.  Find the K-th largest positive integer that divides both A and B.  The input guarantees that there exists such a number.

Submission attempts (in order):
try:
  a = int(input('A'))
  b = int(input('B'))
  k = int(input('K'))
except EOFError:
  a = 8
  b = 12
  k = 2 
count = 0
kcount = 0
while True:
    count += 1
    if a % count == 0 and b % count == 0:
        kcount += 1
    if k == kcount:
        break

print(count)




a = int(input('A'))
b = int(input('B'))
k = int(input('K'))

count = 0
kcount = 0
while True:
    count += 1
    if a % count == 0 and b % count == 0:
        print(count)
        kcount += 1
    if k == kcount:
        break

print(count)



A,B,K = map(int,input().split())
l = []
i = 1
while True:
    if A % i == 0 and B % i == 0:
        l.append(i)
        print(i)
    if len(l) == K:
        break
    i += 1
print(max(l))

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

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


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

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

Verdicts: 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(min(a,b),-1,0):
  if a%i == 0 and b%i == 0:
    cnt += 1
  if cnt>=k:
    print(i)
    exit()

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

Verdicts: Runtime Error

Accepted
Problem: You are given positive integers A and B.  Find the K-th largest positive integer that divides both A and B.  The input guarantees that there exists such a number.

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

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

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

A,B,K = map(int,input().split())
d = []
m = 0
for i in range(1,101):
    if A % i == 0 and B % i == 0:
        d.append(i)
m.sort(reverse=True)
m = d[K-1]
print(m)

A B K = map(int,input().split())
d = []
m = 0
for i in range(1,101):
    if A % i == 0 and B % i == 0:
        d.append(i)
m.sort(reverse=True)
m = d[K-1]
print(m)

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

Verdicts: 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())
count = 0
n = 1
while True:
    if a % n == 0 & b % n == 0:
        count += 1
        print(count)
        if count == k:
            print(n)
            break
    n += 1


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


Verdicts: Wrong Answer

Accepted
Problem: You are given positive integers A and B.  Find the K-th largest positive integer that divides both A and B.  The input guarantees that there exists such a number.

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

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

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

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

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]

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

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

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

temp = 0
temp1 = 0
divisor = []
counter = 0

if A >= B:
  temp = A
  temp1 = B

else:
  temp = B
  temp1 = A

for i in range(1,temp1):
  if temp % i == 0 and i != temp1:
    divisor.append(i)

print(divisor)
for j in (reversed(divisor)):
  if temp1 % j ==0:
    counter += 1
    if counter == times:
      print(j)
      break

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

temp = 0
temp1 = 0
divisor = []
counter = 0

if A >= B:
  temp = A
  temp1 = B

else:
  temp = B
  temp1 = A

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

print(divisor)
for j in (reversed(divisor)):
  if temp % j ==0:
    counter += 1
    if counter == times:
      print(j)
      break
  



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

temp = 0
temp1 = 0
divisor = []
counter = 0

if A >= B:
  temp = A
  temp1 = B

else:
  temp = B
  temp1 = A

for i in range(1,temp1):
  if temp1 % i == 0 and i != temp1:
    divisor.append(i)

print(divisor)
for j in (reversed(divisor)):
  if temp % j ==0:
    counter += 1
    if counter == times:
      print(j)
      break
  



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

temp = 0
temp1 = 0
divisor = []
counter = 0

if A >= B:
  temp = A
  temp1 = B

else:
  temp = B
  temp1 = A

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

for j in (reversed(divisor)):
  if temp % j ==0:
    counter += 1
    if counter == times:
      print(j)
      break
  



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

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

i=0
j=1
while i<K:
  if A%j==0 and B%j==0:
     i +=1
  else:
     i =i
  j+=1

print(j)
  


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

i=0
j=1
while i<K:
  if A%j=0^B%j=0:
     i +=1
  else:
     i =i
  j+=1

print(j)
  

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

i=0
j=1
while i<K:
  if A%j=0 and B%j=0:
     i +=1
  else:
     i =i
  j+=1

print(j)
  


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

i=0
j=100
while i<K:
    if A%j==0 and B%j==0:
        i +=1
    else:
        i =i
    j-=1

print(j+1)
  


Verdicts: Wrong Answer

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

div = []

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

print(div)
print(div[-K])

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

div = []

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

print(div[-K])

Verdicts: Wrong Answer

Accepted
Problem: You are given positive integers A and B.  Find the K-th largest positive integer that divides both A and B.  The input guarantees that there exists such a number.

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

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

print(listQ)
print(listQ[-K])




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

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

print(listQ[-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):
#!/usr/bin/env python3
a, b, k = map(int, input().split())
n = 0
for i in range(1, 100):
    if a % i == 0 and b % i == 0:
        print(i)
        n += 1
        if n == k:
            print(i)
            exit()

#!/usr/bin/env python3
a, b, k = map(int, input().split())
ans = []
for i in range(1, 101):
    if a % i == 0 and b % i == 0: ans.append(i)
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):
a,b,k=map(int,input().split())
c=0
i=min(a,b)
while c<k:
  if a%i==0 and b%i==0:
    c+=1
  i-=1
print(i)

a,b,k=map(int,input().split())
c=0
i=min(a,b)+1
while c<k:
  i-=1
  if a%i==0 and b%i==0:
    c+=1  
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,c = map(int, input().split())
def m(num):
    if num < 1:
        return []
    elif num == 1:
        return [1]
    else:
        divisor_list = []
        divisor_list.append(1)
        for i in range(2, num // 2 + 1):
            if num % i == 0:
                divisor_list.append(i)
        divisor_list.append(num)

        return divisor_list


list = m(a)+ m(b)
res = [e for e in set(list) if list.count(e) > 1]
print(res)
print(res[c-1])


a,b,c = map(int, input().split())
def m(num):
    if num < 1:
        return []
    elif num == 1:
        return [1]
    else:
        divisor_list = []
        divisor_list.append(1)
        for i in range(2, num // 2 + 1):
            if num % i == 0:
                divisor_list.append(i)
        divisor_list.append(num)

        return divisor_list

print(m(a), m(b))
list = m(a)+ m(b)
res = [e for e in set(list) if list.count(e) > 1]
print(res[c])

a,b,c = map(int, input().split())
def m(num):
    if num < 1:
        return []
    elif num == 1:
        return [1]
    else:
        divisor_list = []
        divisor_list.append(1)
        for i in range(2, num // 2 + 1):
            if num % i == 0:
                divisor_list.append(i)
        divisor_list.append(num)

        return divisor_list


list = m(a)+ m(b)
res = [e for e in set(list) if list.count(e) > 1]
res.sort(reverse=True)
print(res[c-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())
for i in range(1, max(a, b)):
    if a % i == 0 and b % i == 0:
        counter += 1
        ret = i
        if counter == k:
            break


print("{}".format(int(ret)))

def main():
    a, b, k = map(int, input().split())
    counter = 0
    for i in range(min(a, b), 1, -1):
        if a % i == 0 and b % i == 0:
            counter += 1
            if counter == k:
                print("{}".format(int(i)))

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

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

A,B,K=list(map(int,input().split()))
count=0
for i in max(A,B):
  if (A%i==0)and(B%i==0):
    count+=1
    if count==K:
      ans=count
      break
print(ans)

A,B,K=list(map(int,input().split()))
count=0
z=[A,B]
for i in range(max(z),0,-1):
  if (A%i==0)and(B%i==0):
    count+=1
    if count==K:
      ans=i
      break
print(ans)

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

a,b,k=map(int,input().split())
l,s=0
N=""
while s < k:
    l += 1
    if a%(l+1)==0 and b%(l+1)==0:
            s += 1
            N.append(l)
N.reverse()
print(N[k-1])

a,b,k=map(int,input().split())
l,s=0
while s < k:
    l += 1
    if a%(l+1)==0 and b%(l+1)==0:
            s += 1
print(l)

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

for k in range(1,inp[0]+1):
  f = inp[0] / k * 1000
  if f.is_integer():
    li.append(k)

for m in range(1,inp[1]+1):
  h = inp[1] / m * 1000
  if h.is_integer():
    li2.append(m)
    
li3 = list(set(li) & set(li2))
li3.sort()
print(li,li2,li3)
print(li3[inp[2]-1])

inp = [int(i) for i in input().split()]
li =[]
li2 =[]

for k in range(1,inp[0]+1):
  f = inp[0] / k
  if f.is_integer():
    li.append(k)

for m in range(1,inp[1]+1):
  h = inp[1] / m
  if h.is_integer():
    li2.append(m)
    
li3 = list(set(li) & set(li2))
li3.sort()
print(li3[-inp[2]])

Verdicts: Wrong Answer

Accepted
Problem: You are given positive integers A and B.  Find the K-th largest positive integer that divides both A and B.  The input guarantees that there exists such a number.

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

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

Verdicts: Runtime Error

Accepted
Problem: You are given positive integers A and B.  Find the K-th largest positive integer that divides both A and B.  The input guarantees that there exists such a number.

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

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


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

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

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


A,B,K = map(int,input().split())
L = 0
ans = 0
for i in reversed(range(1,2000)):
  if A%i == 0:
    if B%i == 0:
      L += 1
    else:
      L += 0
  else:
    L += 0
  if L == K:
    ans = i
    break
print(ans)


Verdicts: Runtime Error

Accepted
Problem: You are given positive integers A and B.  Find the K-th largest positive integer that divides both A and B.  The input guarantees that there exists such a number.

Submission attempts (in order):
A,B,K=map(int,input().split())
i=1
count=max(A,B)
while 1:
    if A%i+B%i==0:
        count +=1
    if count=K:
        print(i)
    i-=1
    


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


Verdicts: Runtime Error

Accepted
Problem: You are given positive integers A and B.  Find the K-th largest positive integer that divides both A and B.  The input guarantees that there exists such a number.

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

import math
def divisor(n):
    a = set()
    for i in range(1, math.ceil(n**0.5) + 1):
        if n % i == 0:
            a.add(i)
            a.add(n // i)
    return a

d = divisor(g)
ans = list(d)
ans.sort()
print(ans[k-1])

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

gcd = math.gcd(a, b)
list_gcd = list()

for i in range(1, int(gcd/2) + 1):
    if gcd % i == 0:
        list_gcd.append(i)

list_gcd.append(gcd)
print(list_gcd[-k])


a, b, k = [int(i) for i in input().split()]

x = max(a, b)
y = min(a, b)
gcd = 0
if x % y == 0:
    gcd = y
else:
    while x % y != 0:
        z = x % y
        x = y
        y = z
    else:
        gcd = z

list_gcd = list()

for i in range(1, int(gcd/2) + 1):
    if gcd % i == 0:
        list_gcd.append(i)

list_gcd.append(gcd)
print(list_gcd[-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=[]
for i in range(1,101):
  if a%i==0 and b%i==0:
    cnt.append(i)
print(cnt[-1-k])

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

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

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

Ans.sort(reverse = True)
print(Ans[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 factorize(n):
    n_list = []
    for i in range(n):
        x = i + 1
        if n % x == 0:
            n_list.append(x)
    return n_list

if __name__ == '__main__':
    A, B, C = input().split()
    a_list = factorize(int(A))
    b_list = factorize(int(B))
    and_list = list(set(a_list)&set(b_list))
    and_list.reverse()
    print(and_list)
    print(and_list[int(C)-1])

def factorize(n):
    n_list = []
    for i in range(n):
        x = i + 1
        if n % x == 0:
            n_list.append(x)
    return n_list


if __name__ == '__main__':
    A, B, C = input().split()
    a_list = factorize(int(A))
    b_list = factorize(int(B))
    and_list = list(set(a_list) & set(b_list))
    and_list.sort(reverse=True)
    print(and_list[int(C) - 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 math

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

import math

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

Verdicts: Runtime Error

Accepted
Problem: You are given positive integers A and B.  Find the K-th largest positive integer that divides both A and B.  The input guarantees that there exists such a number.

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

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

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

data= sys.stdin.readline().split(" ")
a = int(data[0])
b = int(data[1])
k = int(data[2])

if a == 1 or b == 1:
    print(a)

else:
    t = a
    if a < b:
        t = b

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

import sys

data= sys.stdin.readline().split(" ")
a = int(data[0])
b = int(data[1])
k = int(data[2])

if a == 1 or b == 1:
    print(a)

else:
    t = a
    if a < b:
        t = b
    t += 1
    count = 0
    for i in reversed(range(1, t)):
        if a % i == 0 and b % i == 0:
            count += 1   
    
        if count == 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 = int(input())
b = int(input())
k = int(input())
m = 0
o = 0


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


print(o)

a,b,k = (int(x) for x in input().split())
m = 0
o = 0


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


print(o)

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):
c = [a,b]
c.sort()
a= c[0]
b= c[1]
n = []
for i in range(1, a+1):
    if a%i == 0 and b%i == 0:
        n.append(i)

print(n[-c])

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

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

print(n[-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 math
n,m,k=map(int,input().split())
print(math.gcd(n,m))

n,m,k=map(int,input().split())
for i in range(min(n,m),0,-1):
	if n%i==0 and m%i==0:
		k-=1
		if k==0:
			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):
# -*- coding: utf-8 -*-


import sys
import math


# n = int(input())


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


# a=list(map(int, input().split()))
count = 0
num = max(a,b)+1
while count < k:
    num -= 1
    if a % num == 0 & b % num == 0:
        count += 1

print(num)


# -*- coding: utf-8 -*-


import sys
import math


# n = int(input())


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


# a=list(map(int, input().split()))
count = 0
num = min(a, b) + 1
while count < k:
    num -= 1
    if a % num == 0 and b % num == 0:
        count += 1

print(num)


Verdicts: Wrong Answer

Accepted
Problem: You are given positive integers A and B.  Find the K-th largest positive integer that divides both A and B.  The input guarantees that there exists such a number.

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

while cnt!=K:
  if A%x==0 and B%x == 0:
    cnt += 1
  x += 1
print(x)

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

if A>B:
  x = B
else:
  x = A

while cnt!=K:
  if A%x==0 and B%x == 0:
    cnt += 1
  x -= 1

print(x+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())
ans = [1]
for i in range(2,min(a,b)+1):
    if a%i==0 and b%i==0:
        ans.append(i)
ans.sort(reverse = True)
print(ans)
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)
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,c=map(int,input().split())
cnt=0
for i in range(min(a,b)):
  if i%a==0 && j%a==0:
    cnt+=1
  if cnt==c:
    print(i)
    break

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

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

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: 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(_a,_b):
    a=max([_a, _b]); b=min([_a, _b])
    while True:
        m=a%b
        if m==0:
            return b
        a=b

a,b,k=(int(x) for x in input().split())
g=gcd(a,b)
cd=[]
i=g
while True:
    if g%i==0:
        cd.append(i)
        i=i//2
        if i==1 or i==0:
            break
    else:
        i-=1
print(cd[k-1])

def gcd(_a,_b):
    a=max([_a, _b]); b=min([_a, _b])
    while True:
        if not b==0:
            m=a%b
        if m==0:
            return b
        a=b

a,b,k=(int(x) for x in input().split())
g=gcd(a,b)
cd=[]
i=g
while True:
    if g%i==0:
        cd.append(i)
        i=i//2
        if i==1 or i==0:
            break
    else:
        i-=1
print(cd[k-1])

def gcd(t):
    b,a=sorted(t)
    while True:
        m=a%b
        if m==0:
            return b
        a=b;b=m
a,b,k=(int(x) for x in input().split())
g=gcd((a,b))
cd=[]
for i in range(g+1)[::-1]:
    if i==0:
        break
    if g%i==0:
        cd.append(i)
print(cd[k-1])

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: You are given positive integers A and B.  Find the K-th largest positive integer that divides both A and B.  The input guarantees that there exists such a number.

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

import sys

def solve():
    input = sys.stdin.readline
    A, B, K = map(int, input().split())
    count = 1
    for i in reversed(range(1, 101)):
        if A % i == 0 and B % i == 0:
            if count == K: 
                print(i)
                break
            else: count += 1
    


    return 0

if __name__ == "__main__":
    solve()

Verdicts: Wrong Answer

Accepted