qyliang/CodeNanoFix huggingface dataset:
Buggy code:
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)

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

Fixed code:
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)

a,b,k = map(int,input().split())
r = gcd(a,b)
e = []
for i in range(1,r+1):
    if r%i == 0:
        e.append(i)
print(e[len(e)-k])
Buggy code:
A, B, K = map(int,input().split())

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


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

a = [i for i in range(1, A+1) if A % i == 0]
b = [i for i in range(1, B+1) if B % i == 0]
ans = set(a) & set(b)
print(sorted(list(ans))[-K])
Buggy code:
a, b, k = list(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:
    print(i)
    break

Fixed code:
a, b, k = list(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)
    break
Buggy code:
A,B,K=map(int,input().split())
S=set()
for i in range(1,min(A+1,B+1)):
    if A%i==0 and B%i==0:
        S.add(i)
print(sorted(S)[K-1])

Fixed code:
A,B,K=map(int,input().split())
S=set()
for i in range(1,min(A+1,B+1)):
    if A%i==0 and B%i==0:
        S.add(i)
print(sorted(S)[::-1][K-1])
Buggy code:
A, B, K = map(int, input().split())
s1 = set()
s2 = set()

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

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

lst = sorted(list(s1 & s2))

print(lst[K-1])


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

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

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

lst = sorted(list(s1 & s2), reverse=True)

print(lst[K-1])
Buggy code:
a, b, k = map(int, input().split())
a, b = sorted([a, b])
lst = []

if b != 1:
    for i in range(1, b):
        if a%i==b%i==0:
            lst.append(i)

else:
    lst.append(1)

print(lst[k-1])

Fixed code:
a, b, k = map(int, input().split())
a, b = sorted([a, b])
lst = []

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

else:
    lst.append(1)

lst.reverse()
print(lst[k-1])
Buggy code:
A, B, K = list(map(int, input().split()))

if A > B:
    n = A
else:
    n = B

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

print(l[-K])

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

if A < B:
    n = A
else:
    n = B

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

print(l[-K])
Buggy code:
A, B, K = map(int, input().split())

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


Fixed code:
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)
Buggy code:
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])

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

Fixed code:
A,B,K = map(int,input().split())
c = []
for i in range(1,max(A,B)+1):
  if A % i == 0 and B % i ==0:
    c.append(i)
c = c[::-1]
print(c[K-1])
Buggy code:
a,b,c=map(int,input().split())
for i in range(1,101):
  if a%i==0 and b%i==0:
    c-=1
  if c==0:
    print(i)
    break

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


Fixed code:
a,b,k=map(int,input().split())
c=0
for i in range(min(a,b)-1):
    x=min(a,b)-i
    if a%x+b%x == 0:
        c+=1
    if c == k:
        print(x)
        exit()
print(1)
Buggy code:
# -*- coding: utf-8 -*-

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

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

#print(ans)

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


Fixed code:
# -*- coding: utf-8 -*-

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

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

#print(ans)

t = len(ans)-k
print(ans[t])
Buggy code:
A,B,K=map(int,input().split())
count=1
i=1
while count<K:
  i+=1
  if A%i=0 and B%i=0:
    count+=1
print(i)
  

Fixed code:
A,B,K=map(int,input().split())
count=0
i=min(A,B)+1
while count<K:
  i-=1
  if A%i==0 and B%i==0:
    count+=1
print(i)
Buggy code:
A, B, K = (int(i) for i in input().split())
list = []
for i in range(101):
  if i != 0:
    if A % i == 0 and B % i == 0:
      list.append(i)
print(list[K-1])


Fixed code:
A, B, K = (int(i) for i in input().split())
list = []
 
for i in range(101):
  if i != 0:
    if A % i == 0 and B % i == 0:
      list.append(i)
print(list[len(list)-K])
Buggy code:
a,b,k = map(int,input().split())
x = []
for i in range(1,a):
    if a%i == 0 and b%i == 0:
        x.append(i)
print(x[-k])

Fixed code:
a,b,k = map(int,input().split())
x = []
for i in range(1,a+1):
    if a%i == 0 and b%i == 0:
        x.append(i)
print(x[-k])
Buggy code:
A, B, K = map(int, input().split())
d = []

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

print(d[K - 1])


Fixed code:
A, B, K = map(int, input().split())
d = []

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

print(d[-K])
Buggy code:
A,B,K = map(int,input().split())

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

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

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

Fixed code:
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)
Buggy code:
A, B, K = map(int, input().split())
print((i for i in range(1, 101) if A % i + B % i < 1)[-K])

Fixed code:
A, B, K = map(int, input().split())
print([i for i in range(1, 101) if A % i + B % i < 1][-K])
Buggy code:
a, b, k = map(int, input().split())
m = b if a > b else a
ans = []
for i in range(1, (m // 2)+2):
  if a % i == 0 and b % i == 0:
    ans.append(i)
print(ans[-k])

Fixed code:
a, b, k = map(int, input().split())
m = b if a > b else a
ans = []
for i in range(1, m+1):
  if a % i == 0 and b % i == 0:
    ans.append(i)
print(ans[-k])
Buggy code:
A, B, K = map(int, input().split())
l = []
n = min(A, B)
for i in range(1, n + 1):
    if (A % i == 0) and (B % i == 0):
        l.append(i)
print(l[K - 1])

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

Fixed code:
A, B, K = map(int, input().split())
print([i for i in reversed(range(1, max(A,B)+1)) if A % i == 0 and B % i == 0][K-1])
Buggy code:
a,b,k=map(int, input().split())
cnt=0
for i in range(min(a,b)+1,1,-1):
    if a%i==0 and b%i==0:
        cnt+=1
        if cnt==k:
            print(i)


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

rtn = 1;
rtn_list =[] 
while len(rtn_list) < K:
    if not(A % rtn) and not(B % rtn):
        rtn_list.append(rtn)
    rtn += 1
print(rtn_list[-1])

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

rtn = max(A, B); 
rtn_list =[] 
while len(rtn_list) < K:
    if not(A % rtn) and not(B % rtn):
        rtn_list.append(rtn)
    rtn -= 1
print(rtn_list[-1])
Buggy code:
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])


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

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

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

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

s = []

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

sorted(s)

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


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

s = []

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

sorted(s)

s = s[::-1]

print(s[k-1])
Buggy code:
import sys
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:
      print(i)
      sys.exit()


Fixed code:
import sys
a,b,k=map(int,input().split())
count=0
for i in reversed(range(1,min(a,b)+1)):
  if a%i==0 and b%i==0:
    count+=1
    if count==k:
      print(i)
      sys.exit()
Buggy code:
A, B, K = map(int, input().split())
ans = []
for i in range(1, min(A, B) + 1):
    if (not(A % i)) and (not(B % i)):
        ans.append(i)
    if (len(ans) == K):
        print(ans[-1])
        break


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

Fixed code:
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)
Buggy code:
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])

Fixed code:
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])
Buggy code:
l = []
ans = []
a, b, k = list(map(int, input().split()))
l.append(a)
l.append(b)
i = 1

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

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


Fixed code:
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) 

if len(ans) == 0:
    print(1)
else:
    print(ans[-k])
Buggy code:
A, B, K = map(int, input().split())
list = []
for i in range(1, max(A, B)+1):
    if A % i == 0 and B % i == 0:
        list.append(i)
    else:
        pass
print(list[K-1])

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

Fixed code:
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()
Buggy code:
a, b, k = map(int, input().split())

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

print(ans[k - 1])


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

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

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

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


if __name__ == "__main__":
    main()


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

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

def main():
    a, b, k = [int(x) for x in sys.stdin.readline().split()]

    n = gcd(a, b)
    count = 0
    while True:
        if a % n == 0 and b % n == 0:
            count += 1
            if count == k:
                print(n)
                sys.exit()
        n -= 1


if __name__ == "__main__":
    main()
Buggy code:
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


Fixed code:
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
Buggy code:
# coding: utf-8

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

cnt = 0

mini = min([a, b])
output = 1

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

print(output)

Fixed code:
# coding: utf-8

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

cnt = 0

mini = min([a, b])
output = 1

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

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

Fixed code:
A,B,K=map(int,input().split())
count=0
i=min(A,B)+1
while count<K:
    i-=1
    if A%i==0 and B%i==0:
        count+=1
print(i)
Buggy code:
A,B,K=map(int,input().split())
count=0
for i in range(max(A,B),1,-1):
    if A%i==0 and B%i==0:
        count+=1
        if count==K:
            print(i)

Fixed code:
A,B,K=map(int,input().split())
count=0
for i in range(max(A,B),0,-1):
    if A%i==0 and B%i==0:
        count+=1
        if count==K:
            print(i)
Buggy code:
# -*- coding:utf-8 -*-

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

    for i in range(1, 101):
        if A%i==0 and B%i==0:
            K -= 1
            if K==0:
                print(i)
                return



if __name__ == "__main__":
    solve()


Fixed code:
# -*- coding:utf-8 -*-

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

    for i in range(101, 0, -1):
        if A%i==0 and B%i==0:
            K -= 1
            if K==0:
                print(i)
                return



if __name__ == "__main__":
    solve()
Buggy code:
a, b, k = map(int, input().split())
l = []

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

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

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

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

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

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

Fixed code:
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)
print(List[-K])
Buggy code:
a, b, k = map(int, input().split(" "))

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

print(l[k-1])

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

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

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

Fixed code:
a, b, c = 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==c:
    print(i)
    break
Buggy code:
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)

Fixed code:
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])
Buggy code:
a,b,k=map(int,input().split())
ans=[]

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

print(ans[-k])

Fixed code:
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])
Buggy code:
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)) if a % i == 0 and b % i ==0]
l.sort(reverse=True)
print(l[k-1])

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

lst = []

val = 1
while len(lst) < K:
    if (A % val == 0) and (B % val == 0):
        lst.append(val)
        val += 1

print(lst[K -1])

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

lst = []

val = 1
while val != 101:
    if (A % val == 0) and (B % val == 0):
        lst.append(val)
    val += 1

print(lst[len(lst) - K])
Buggy code:
import math

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

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

Fixed code:
import math

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

cnt = 0
for i in reversed(range(1, 101)):
	if a % i == 0 and b % i == 0:
		#print(i)
		cnt += 1
		if cnt == k:
			print(i)
			break
Buggy code:
a, b, k  = map(int, input().split())
c = 0
ans = []
if a > b:
  c = b
else:
  c = a

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


print(ans[k-1])

Fixed code:
a, b, k  = map(int, input().split())
c = 0
ans = []
if a > b:
  c = b
else:
  c = a

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


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

Fixed code:
a, b, k = map(int, input().split())
d = min(a, b)
print([i for i in range(1, d+1) if a % i == 0 and b %i == 0][::-1][k-1])
Buggy code:
A,B,K = map(int,input().split())
min_n= min(A,B)
for i in range(1,min_n+1):
	if A%i==0 and B%i==0:
		K-=1
	if K==0:
		print(i)
		break

Fixed code:
A,B,K = map(int,input().split())
min_n= min(A,B)
for i in range(min_n):
	if A%(min_n-i)==0 and B%(min_n-i)==0:
		K-=1
	if K==0:
		print(min_n-i)
		break
Buggy code:
a, b, k = (int(i) for i in input().split())

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

print(num_list[k-1])

Fixed code:
a, b, k = (int(i) for i in input().split())

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

print(num_list[-k])
Buggy code:
A,B,K = map(int,input().split())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

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

CCC = []

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

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


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

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

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

CCC = []

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

CCC = sorted(CCC,reverse=True)
#print(CCC)
print(CCC[K-1])
Buggy code:
a,b,k = map(int,input().split())

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

print(ans[k-1])

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

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

print(ans[-k])
Buggy code:
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
    if cnt == k:
        print(i)
        break


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

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