qyliang/CodeNanoFix huggingface dataset:
Buggy code:
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[len(ans)- k])
  

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[len(ans)- k])
Buggy code:
A, B, K = map(int, input().split())
lista = [a for a in range(1, A + 1) if A % a == 0]
listb = [b for b in range(1, B + 1) if B % b == 0]
listc = list(set(lista) & set(listb))
#print(lista)
#print(listb)
#print(listc)

print(listc[K])


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

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

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

print(divisers[-k])


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

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

print(divisers[-k])
Buggy code:
def gcd(a, b):
    if b == 0: return a
    return gcd(b, a % b)

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

x = gcd(A, B)
y = []

for i in range(x):
    if x % (i + 1) == 0:
        y.append(i + 1)

print(y[K - 1])

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

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

x = gcd(A, B)
y = []

for i in range(x):
    if x % (i + 1) == 0:
        y.insert(0, i + 1)

print(y[K - 1])
Buggy code:
import fractions as frac

A,B,K = [int(i) for i in input().split()]

cd_list = []
for i in range(1,max(A,B)+1) :
    print(i)
    if (A % i == 0 and B % i == 0) :
        cd_list.append(i)
        # if (len(cd_list) >= K) :
        #     break

print(cd_list[-K])

Fixed code:
import fractions as frac

A,B,K = [int(i) for i in input().split()]

cd_list = []
for i in range(1,max(A,B)+1) :
    if (A % i == 0 and B % i == 0) :
        cd_list.append(i)
        # if (len(cd_list) >= K) :
        #     break

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

List = [x for x in range(max(A,B),1,-1) if A%x ==0 and B%x ==0]
print(List[K-1])

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

List = [x for x in range(min(A,B),0,-1) if A%x ==0 and B%x ==0]
print(List[K-1])
Buggy code:
from sys import stdin


def b(input_string):
    a, b, k = [int(x) for x in input_string.split()]
    mod_0_numbers = []
    if a >= b:
        for i in range(1, a):
            if a % i == 0:
                if b % i == 0:
                    mod_0_numbers.append(i)
    else:
        for i in range(1, b):
            if b % i == 0:
                if a % i == 0:
                    mod_0_numbers.append(i)
    return mod_0_numbers[-k]


def main():
    input_line = stdin.readline().rstrip()
    answer = b(input_line)
    print(answer)


if __name__ == '__main__':
    main()


Fixed code:
from sys import stdin


def b(input_string):
    a, b, k = [int(x) for x in input_string.split()]
    mod_0_numbers = []
    if a >= b:
        for i in range(1, a+1):
            if a % i == 0:
                if b % i == 0:
                    mod_0_numbers.append(i)
    else:
        for i in range(1, b+1):
            if b % i == 0:
                if a % i == 0:
                    mod_0_numbers.append(i)
    return mod_0_numbers[-k]


def main():
    input_line = stdin.readline().rstrip()
    answer = b(input_line)
    print(answer)


if __name__ == '__main__':
    main()
Buggy code:
A, B, K = list(map(int, input().split()))

S = [1]

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

S.reverse()

print(S[K-1])

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

S = [1]

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

S.sort(reverse=True)

print(S[K-1])
Buggy code:
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)

Fixed code:
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)
Buggy code:
import collections
import itertools
import numpy as np
import sys
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

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

A,B,K = IL()

cnt = 0
i = 1
while True:
    if A%i==0 and B%i==0:
        cnt += 1
    if cnt == K:
        print(i)
        break
    i += 1


Fixed code:
import collections
import itertools
import numpy as np
import sys
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

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

A,B,K = IL()

cnt = 0
i = min(A,B)
while True:
    if A%i==0 and B%i==0:
        cnt += 1
    if cnt == K:
        print(i)
        break
    i -= 1
Buggy code:
# coding: utf-8

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

divs = []

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

print(divs[k-1])


Fixed code:
# coding: utf-8

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

divs = []

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

print(list(reversed(divs))[k-1])
Buggy code:
a, b, k = map(int, input().split())
counter = 0

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


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

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

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

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

X = []
cnt = 0
for i in range(1, 1 + int(min(list[0],list[1]))):
  if(list[0] % i == 0 and list[1] % i == 0):
    X.append(i)
    cnt = 1
X.sort(reverse=True)
if (cnt == 1):
  print(X[list[2]-1])
else:
  print(1)
Buggy code:
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]

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

cnt = 0
for i in range(A+1, 1, -1):
    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())

cnt = 0
for i in range(A, 0, -1):
    if A % i == 0 and B % i == 0:
        cnt += 1
        if cnt == K:
            print(i)
            exit()
Buggy code:
import math
A,B,K=map(int,input().split())
anslist=[]
for i in range(1,max(A,B)):
    if (A%i==0)&(B%i==0):
        anslist.append(i)
print(anslist[0-K])

Fixed code:
import math
A,B,K=map(int,input().split())
anslist=[]
for i in range(1,max(A,B)+1):
    if (A%i==0)&(B%i==0):
        anslist.append(i)
print(anslist[0-K])
Buggy code:
A , B , K = map(int,input().split())

lst = []
for i in range(1,max(A,B) + 1):
    if (A / i).is_integer() and (B / i).is_integer():
       lst.append(i)
lst.sort(reverse=True)
print(lst[K - 1])
print(lst)

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

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

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


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

num_list = [(x+1) for x in range(100) if (A % (x+1) == 0) and (B % (x+1) == 0)]
print(num_list[K-1])

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

num_list = [(x+1) for x in range(100) if (A % (x+1) == 0) and (B % (x+1) == 0)]
num_list.sort(reverse = True)
print(num_list[K-1])
Buggy code:
import sys
A,B,K=(int(i) for i in input().split())

A_list=list()
B_list=list()
C_list=list()

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

for x in range(B+1):
    if x==0:
        continue
    if B%x==0:
        B_list.append(x)

for y in A_list:
    for z in B_list:
        if y==z:
            C_list.append(y)


print(C_list[K-1])


Fixed code:
import sys
A,B,K=(int(i) for i in input().split())

A_list=list()
B_list=list()
C_list=list()

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

for x in range(B+1):
    if x==0:
        continue
    if B%x==0:
        B_list.append(x)

for y in A_list:
    for z in B_list:
        if y==z:
            C_list.append(y)



print(C_list[-K])
Buggy code:
a, b, k = map(int, input().split(' '))
lis = []
for i in range(1, min(a, b) + 1):
  if not a%i and not b%i:
    lis.append(i)
print(lis[k-1])

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


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


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

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

print(kcd(i[0],i[1],i[2]))
Buggy code:
data = input().split()
a = int(data[0])
b = int(data[1])
k = int(data[2])

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

print(ans[k-1])


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

print(ans[len(ans)-k])
Buggy code:
a,b,k = [int(i) for i in input().split()]
ans = []

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


ans.sort()
print(ans[k-1])

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

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

n=len(p)
print(p[n-k])
Buggy code:
a, b, k = map(int, input().split())

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


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

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

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


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

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

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

Fixed code:
A,B,K=map(int, input().split())
temp_k = 0
ans = 0
for i in range(1,101)[::-1]:
    if A%i==0 and B%i==0:
        temp_k+=1
    if temp_k==K:
        ans = i
        break
print(ans)
Buggy code:
a,b,k=list(map(int,input().split()))
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)
num=gcd(a,b)
print("gcd",num)
c=[]
for i in range(1,num+1):
    if num % i == 0:
        c.append(i)

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


Fixed code:
a,b,k=list(map(int,input().split()))
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)
num=gcd(a,b)
c=[]
for i in range(1,num+1):
    if num % i == 0:
        c.append(i)

print(c[len(c)-k])
Buggy code:
def main():
    a, b, k = list(map(int, input().split()))
    lst = []
    for i in range(1, 101):
        if a % i == 0 and b % i == 0:
            lst.append(i)
    return sorted(lst, reverse=True)[k-1]

main()

Fixed code:
def main():
    a, b, k = list(map(int, input().split()))
    lst = []
    for i in range(1, 101):
        if a % i == 0 and b % i == 0:
            lst.append(i)
    print(sorted(lst, reverse=True)[k-1])

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

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

print(lis[K-1])

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

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


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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

wari = []
count = 0
for i in range(1,A+B):
    if A%i==0 and B%i==0:
        wari.append(i)
print(wari[len(wari)-K])
Buggy code:
a,b,k=map(int,input().split())
lisa=[]
lisb=[]
for i in range(1,a+1):
  if a%i==0:
    lisa.append(i)
for j in range(1,b+1):
  if b%j==0:
    lisb.append(j)
for l in lisa:
  if l in lisb:
    k-=1
    if k==0:
      print(l)
      break

Fixed code:
a,b,k=map(int,input().split())
lisa=[]
lisb=[]
for i in range(1,a+1):
  if a%i==0:
    lisa.append(i)
for j in range(1,b+1):
  if b%j==0:
    lisb.append(j)
for l in range(max(a,b)+1):
  l=max(a,b)+1-l
  if l in lisb and l in lisa and k>0:
    k-=1
    if l in lisb and l in lisa and k==0:
      print(l)
      break
Buggy code:
a,b,k = map(int,input().split())
m = min(a,b)
count = 0
for i in range(m,0,-1):
  if i == 0 :
    break:
  if a%i == 0 and b%i == 0:
    count += 1
  if count == k:
    break:
print(i)

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

Fixed code:
a, b, c = map(int, input().split())
d = max(a, b)
l = []
for i in range(1,d+1):
  if a % i == 0 and b % i == 0:
    l.append(i)
print(l[len(l)-c])
Buggy code:
A, B, K = map(int, input().split(' '))
A_set = set()
B_set = set()
for number in range(1, A+1):
    if A%number == 0:
        A_set.add(number)

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

A_Bset = A_set & B_set
A_Blist = list(A_Bset)
A_Blist.sort()
print(A_Blist[K-1])

Fixed code:
A, B, K = map(int, input().split(' '))
A_set = set()
B_set = set()
for number in range(1, A+1):
    if A%number == 0:
        A_set.add(number)

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

A_Bset = A_set & B_set
A_Blist = list(A_Bset)
A_Blist.sort(reverse=True)
print(A_Blist[K-1])
Buggy code:
A, B, K = map(int, input().split())
n = min(A, B)
while K:
  if A % n == 0 and B % n == 0:
    K -= 1
  if K == 0:
    print(n)

Fixed code:
A, B, K = map(int, input().split())
n = min(A, B)
while K:
  if A % n == 0 and B % n == 0:
    K -= 1
  if K == 0:
    print(n)
  n -= 1
Buggy code:
def test():
    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)

    for j in range(abs(len(c)-k)):
        c.remove(max(c))

    print(c)
    print(max(c))


if __name__ == "__main__":
    test()


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

    for j in range(k-1):
        c.remove(max(c))

    print(max(c))


if __name__ == "__main__":
    test()
Buggy code:
# import math
# import statistics
# import itertools
# a=int(input())
#b,c=int(input()),int(input())
# c=[]
# for i in a:
#     c.append(int(i))
A,B,K= map(int,input().split())
# f = list(map(int,input().split()))
# g = [input().split for _ in range(a)]
# h = []
# for i in range(a):
#     h.append(list(map(int,input().split())))
# a = [[0] for _ in range(H)]#nizigen
count=0
wari=1
while True:

    if A%wari==0 and B%wari==0:
        count+=1
    if count==K:
        print(wari)
        exit()
    wari+=1

Fixed code:
# import math
# import statistics
# import itertools
# a=int(input())
#b,c=int(input()),int(input())
# c=[]
# for i in a:
#     c.append(int(i))
A,B,K= map(int,input().split())
# f = list(map(int,input().split()))
# g = [input().split for _ in range(a)]
# h = []
# for i in range(a):
#     h.append(list(map(int,input().split())))
# a = [[0] for _ in range(H)]#nizigen
count=0
wari=min(A,B)
while True:
    if A%wari==0 and B%wari==0:
        count+=1
    if count==K:
        print(wari)
        exit()
    wari-=1
Buggy code:
a,b,k = map(int,input().split())

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


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

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


Fixed code:
A,B,K = map(int,input().split())
N = 0
i = 101
while N != K:
    i -= 1
    if A % i == 0 and B % i == 0:
        N += 1
#        print(i,N,K)
print(i)
Buggy code:
a,b,k = map(int,input().split())

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

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

k_lst = [i for i in range(1,101) if a%i == 0 and b%i == 0]
k_lst.sort(reverse=True)

print(k_lst[k-1])

#print(k_lst)
Buggy code:
a,b,k = map(int,input().split())
if b > a:
  a,b = b,a
ans = []
for i in range(b//2+1):
  if b % (i+1) == 0:
    if a % (i+1) == 0:
      ans.append(i+1)
print(ans[-k])
  
  

Fixed code:
a,b,k = map(int,input().split())
if b > a:
  a,b = b,a
ans = []
for i in range(b):
  if b % (i+1) == 0:
    if a % (i+1) == 0:
      ans.append(i+1)
print(ans[-k])
Buggy code:
A, B, K = [int(i) for i in input().split()]
th = []
i = 1
while True:
    i += 1
    if (A % i, B % i) == (0, 0):
        th.append(i)
    if i > A or i > B:
        break
print(th[len(th) - K])


Fixed code:
A, B, K = [int(i) for i in input().split()]
th = []
i = 0
while True:
    i += 1
    if (A % i, B % i) == (0, 0):
        th.append(i)
    if i > A or i > B:
        break
print(th[len(th) - K])
Buggy code:
a, b, k = [int(x) for x in input().split()]
for i in range(1, min(a, b)):
  if a % i == 0 and b % i == 0:
    k -= 1
    if k == 0:
      print(i)
      break

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