qyliang/CodeNanoFix huggingface dataset:
Buggy 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)
        exit()

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

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

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)
print(l[-k])
Buggy code:
a, b, c = map(int, input().split())
list = []
list1 = []
for i in range(a):
  d = a % (i+1)
  if d == 0:
    list.append(i+1)
  else:
    pass
#print(list)
for k in range(len(list)):
  e = b % list[k]
  if e == 0:
    list1.append(list[k])
  else:
    pass
#print(list1)
print(list1[c-1])

Fixed code:
a, b, c = map(int, input().split())
list = []
list1 = []
for i in range(a):
  d = a % (i+1)
  if d == 0:
    list.append(i+1)
  else:
    pass
for k in range(len(list)):
  e = b % list[k]
  if e == 0:
    list1.append(list[k])
  else:
    pass
print(list1[-c])
Buggy code:
def euclid(a,b):
  if b==0:return a
  return euclid(b,a%b)

a,b,k=[int(s)for s in input().split()]
g=euclid(a,b) if a>b else euclid(b,a)
d=[]
for i in range(g):
  if g%(i+1)==0:d.append(i+1)

print(d[k-1])


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

a,b,k=[int(s)for s in input().split()]
g=euclid(a,b) if a>b else euclid(b,a)
d=[]
for i in range(g):
  if g%(i+1)==0:d.append(i+1)

print(d[-k])
Buggy code:
A,B,K=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)
      break

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

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

print(answer)

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

for i in range(100, 0, -1):
  if A % i == 0 and B % i == 0:
    divideCount += 1
    if divideCount == K:
      answer = i

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

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

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

divisor0 = []
divisor1 = []
for i in range(int(data[0])):
    if int(data[0]) % (i+1) == 0:
        divisor0.append(i+1)

for i in range(int(data[1])):
    if int(data[1]) % (i+1) == 0:
        divisor1.append(i+1)

print(divisor0)

print(divisor1)
plus_array= divisor0 + divisor1
l_duplicate = [x for x in set(plus_array) if plus_array.count(x) > 1]
print(l_duplicate[int(data[2])-1])

Fixed code:
data = input().split()

divisor0 = []
divisor1 = []
for i in range(int(data[0])):
    if int(data[0]) % (i+1) == 0:
        divisor0.append(i+1)

for i in range(int(data[1])):
    if int(data[1]) % (i+1) == 0:
        divisor1.append(i+1)


plus_array= divisor0 + divisor1
l_duplicate = [x for x in set(plus_array) if plus_array.count(x) > 1]

l_duplicate.sort(reverse=True)

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


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

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


print(ans[K-1])

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

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


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

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

print(hoge[K-1])

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

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

print(hoge[-K])
Buggy code:
a,b,k=map(int,input().split())
i=1
count=0
while(count<k):
	if(a%i==0 and b%i==0):
		count+=1
	i+=1
print(i-1)


Fixed code:
a,b,k=map(int,input().split())
i=min(b,a)
count=0
while(count<k):
	if(a%i==0 and b%i==0):
		count+=1
	i-=1
print(i+1)
Buggy code:
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)

Fixed code:
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)
Buggy code:
a, b, k = map(int, input().split())
c = min(a, b)
cnt = 0
while cnt != k:
  if (a%c==0) & (b%c==0):
    cnt += 1
  c -= 1
print(c)

Fixed code:
a, b, k = map(int, input().split())
c = min(a, b)
cnt = 0
while cnt != k:
  if (a%c==0) & (b%c==0):
    cnt += 1
  c -= 1
print(c + 1)
Buggy code:
# coding: utf-8
A,B,K = map(int, input().split())

a = list(range(1,min(A+1,B+1,abs(A-B)+1)))
a = sorted(a, reverse=True)
cnt = 0

for i in a:
  if(A%i==0 and B%i==0):
    cnt += 1
    if(cnt==K):
      print(i)
      break

Fixed code:
# coding: utf-8
A,B,K = map(int, input().split())

a = list(range(1,min(A+1,B+1)))
a = sorted(a, reverse=True)
cnt = 0

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

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

    c += 1

print(ans[-1])

Fixed code:
a, b, k = map(int, input().split())
c = 1
i = 0
ans = []
while c <= min(a, b):
    if a % c == 0 and b % c == 0:
        ans.append(c)
        i += 1

    c += 1

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

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

ans = []
for i in range(min(A,B),0,-1): 
    if A%i==0 and B%i==0:
        ans.append(i)
print(ans[K-1])
Buggy code:
A, B, K = input().split(" ")
A, B, K = int(A), int(B), int(K)

res = []

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

print(res[K-1])

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

res = []

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

print(res[K-1])
Buggy code:
A,B,K=map(int,input().split())
cnt=1
num=1
for i in range(1,(min(A,B))+1):
    if cnt<K:
        if A%i==0 and B%i==0:
            cnt+=1
            num=i
    else:
        break
print(num)

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

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

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

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


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

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

li = []
s = 1
e = 0

while True:
    if a % s == 0 and b % s == 0:
        li.append(s)
        e += 1
    if e == k:
        break
    s += 1

print(li[-1])    


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

li = []
s = 1
e = 0
a = float(a)
b = float(b)

while True:
    if a % s == 0 and b % s == 0:
        li.append(s)
        e += 1
    if s == a or s == b:
        break
    s += 1

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

Fixed code:
a, b, k = map(int, input().split())
min_val = min(a, b)
yaku = [i+1 for i in range(min_val) if (a % (i+1)) == 0 and (b % (i+1)) == 0 ]
print(yaku[-k])
Buggy code:
a,b,k = map(int, input().split())
tmp = 0
for i in range(101,1,-1):
    if a%i == 0 and b%i ==0:
        tmp +=1
    if tmp == k:
        print(i)
        break

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


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

for i in range(1,min(a,b)):
  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,min(a,b)+1):
  if a % i == 0 and b % i == 0:
    list.append(i)
  else:
    pass
print(list[-k])
Buggy code:
def main():
    A, B, K = map(int, input().split())
    CDD = []
    maxi = max(A,B)
    mini = min(A,B)
    for i in range(1, mini + 1):
        if mini % i == 0:
            if maxi % i == 0:
                CDD.append(i)
    print(CDD[K - 1])
main()


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

x=[]
for i in range(1,100):
    if(abk[0]%i==0 and abk[1]%i==0):
        x.append(i)

print(x[-2])

Fixed code:
abk = list(map(int,input().split()))

x=[]
for i in range(1,101):
    if(abk[0]%i==0 and abk[1]%i==0):
        x.append(i)
print(x[-abk[2]])
Buggy code:
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)

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

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


c=0

for i in range(1000,1,-1):
    if a%i ==0 and b%i==0:
        c+=1
    if c == k:
        ans = i
        break

print(ans)

    
    
    
    
    





Fixed code:

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


c=0

ans = 1
for i in range(1000,1,-1):
    if a%i ==0 and b%i==0:
        c+=1
    if c == k:
        ans = i
        break

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

print(ans)


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

print(int(ans))
Buggy code:
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])

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

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

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

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



if __name__ == "__main__":
    main()

Fixed code:
import math

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

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

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



if __name__ == "__main__":
    main()
Buggy code:
import sys


def input():
    return sys.stdin.readline()[:-1]

# N = int(input())
# A = [int(x) for x in input().split()]
# a, b, c = map(int, input().split())
# name1 = str(input())
# alph = {"A": 1, "B": 2, "C": 3, "D": 4, "E": 5}
# b = list(map(lambda x: math.ceil(x/10)*10, a))


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


Fixed code:
import sys


def input():
    return sys.stdin.readline()[:-1]

# N = int(input())
# A = [int(x) for x in input().split()]
# a, b, c = map(int, input().split())
# name1 = str(input())
# alph = {"A": 1, "B": 2, "C": 3, "D": 4, "E": 5}
# b = list(map(lambda x: math.ceil(x/10)*10, a))


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

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

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

a,b,k = map(int,input().split())
acd = []
bcd = []
cd = []

for i in range(1,a+1):
    if a % i == 0:
        acd.append(i)
for i in range(1,b+1):
    if b % i == 0:
        bcd.append(i)
for i in acd:
    for j in bcd:
        if i == j:
            cd.append(i)
print(cd[k-1])


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

a,b,k = map(int,input().split())
acd = []
bcd = []
cd = []

for i in range(1,a+1):
    if a % i == 0:
        acd.append(i)
for i in range(1,b+1):
    if b % i == 0:
        bcd.append(i)
for i in acd:
    for j in bcd:
        if i == j:
            cd.append(i)
print(cd[-k])
Buggy code:
a,b,k=map(int,input().split())
a_list=list(set([i for i in range(1,a+1) if not a%i]))
b_list=list(set([j for j in range(1,b+1) if not b%j]))
c=[]
for i in a_list:
    for j in b_list:
        if i==j:
            c.append(i)
c.sort()
print(c[k-1])

Fixed code:
a,b,k=map(int,input().split())
a_list=list(set([i for i in range(1,a+1) if not a%i]))
b_list=list(set([j for j in range(1,b+1) if not b%j]))
c=[]
for i in a_list:
    for j in b_list:
        if i==j:
            c.append(i)
c.sort(reverse=True)
print(c[k-1])
Buggy code:
#!/usr/bin/env python3

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

ans = []

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


Fixed code:
#!/usr/bin/env python3

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

ans = []

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

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_y = set(make_divisors(a))
b_y = set(make_divisors(b))
#print(a_y & b_y)
y = list(a_y & b_y)

print(y[k-1])



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

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_y = set(make_divisors(a))
b_y = set(make_divisors(b))
#print(a_y & b_y)
y = list(a_y & b_y)
y.sort(reverse=True)
print(y[k-1])
Buggy code:
A, B, K = map(int, input().split())

tmp = []

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

tmp.reverse()
print(tmp[K-1])


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

tmp = []

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

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

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


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

def euclid(p,q):
  if q == 0:
    return p
  else:
    return euclid(q,p%q)
  
n = euclid(a,b)
count = 0
for i in range(n):
  if n % (n-i)==0:
    count += 1
  if count == k:
    print(n-i)
    break
Buggy code:
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-1])
    
if __name__ == '__main__':
    main()

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

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

Fixed code:

a, b, k = map(int, input().split())
temp = a if a>b else b
list =  [i  for i in range(1,temp+1) if a%i==0 and b%i==0]
list = list[::-1]
print(list[k-1])
Buggy code:
a,b,k=map(int,input().split())
lists=[]
x=a*b
while len(lists)<k:
      if a%x==0==b%x:
            lists.append(x)
            x-=1
      else:
            x-=1
print(lists[k-1])
print(lists)
      


Fixed code:
a,b,k=map(int,input().split())
lists=[]
x=max(a,b)
while len(lists)<k:
      if a%x==0==b%x:
            lists.append(x)
            x-=1
      else:
            x-=1
print(lists[k-1])
#print(lists)
Buggy code:
A, B, K = map(int, input().split())

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

        
print(t_list[-K])

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

t_list = []
for i in range(1, 10 ** 5):
    if A%i == 0 and B%i == 0:
        t_list.append(i)
           
print(t_list[-K])
Buggy code:
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()


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

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

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

Fixed code:
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(A,B,K)
#print(C)
print(C[-K])
Buggy code:
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)
print(n[k-1])

Fixed code:
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)
print(n[-k])
Buggy code:
a,b,c=map(int,input().split())
n=0
while c:
    n += 1
    if a%n==b%n==0:
        c-=1
print(n)

Fixed code:
a,b,c=map(int,input().split())
n=a
while c:
    if a%n==b%n==0:
        c-=1
    n-=1
print(n+1)
Buggy code:
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)

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

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

Fixed code:
# coding: utf-8
a, b, k = map(int, input().split())

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

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

Fixed code:
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)
A.sort(reverse=True)
print(A[k-1])