Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
numN = int(input())
input_line = input().split(' ')
brick = [int(i) for i in input_line]

bestSeq = 0
index2 = -1

for i, b in enumerate(brick):
  seq = 0
  if b == 1:
    if i < index2:
      continue
    seq += 1
    cur = 2
    for j, c in enumerate(brick[i:]):
      if c == cur:
        seq += 1
        cur += 1
        index2 = j
    if seq > bestSeq:
      bestSeq = seq

if bestSeq == 0:
  print(-1)
else:
  print(numN - bestSeq)


Fixed submission:
numN = int(input())
input_line = input().split(' ')
brick = [int(i) for i in input_line]

seq = 0

for i, b in enumerate(brick):
  if b == 1:
    seq += 1
    cur = 2
    for c in brick[i + 1:]:
      if c == cur:
        seq += 1
        cur += 1
    break

if seq == 0:
  print(-1)
else:
  print(numN - seq)

Buggy python submission (verdict: Time Limit Exceeded):
numN = int(input())
input_line = input().split(' ')
brick = [int(i) for i in input_line]

bestSeq = 0

for i, b in enumerate(brick):
  if numN - i < bestSeq:
    break
  seq = 0
  if b == 1:
    seq += 1
    cur = 2
    for c in brick[i:]:
      if c == cur:
        seq += 1
        cur += 1
    if seq > bestSeq:
      bestSeq = seq

if bestSeq == 0:
  print(-1)
else:
  print(numN - bestSeq)


Fixed submission:
numN = int(input())
input_line = input().split(' ')
brick = [int(i) for i in input_line]

seq = 0

for i, b in enumerate(brick):
  if b == 1:
    seq += 1
    cur = 2
    for c in brick[i + 1:]:
      if c == cur:
        seq += 1
        cur += 1
    break

if seq == 0:
  print(-1)
else:
  print(numN - seq)

Buggy python submission (verdict: Time Limit Exceeded):
numN = int(input())
input_line = input().split(' ')
brick = [int(i) for i in input_line]

bestSeq = 0

for i, b in enumerate(brick):
  seq = 0
  if b == 1:
    seq += 1
    cur = 2
    for c in brick[i:]:
      if c == cur:
        seq += 1
        cur += 1
    if seq > bestSeq:
      bestSeq = seq

if bestSeq == 0:
  print(-1)
else:
  print(numN - bestSeq)


Fixed submission:
numN = int(input())
input_line = input().split(' ')
brick = [int(i) for i in input_line]

seq = 0

for i, b in enumerate(brick):
  if b == 1:
    seq += 1
    cur = 2
    for c in brick[i + 1:]:
      if c == cur:
        seq += 1
        cur += 1
    break

if seq == 0:
  print(-1)
else:
  print(numN - seq)
Buggy python submission (verdict: Runtime Error):
code = input()
ans = "Bad"
if code[0] == code[1] or code[1] == code[2] or code[2] == code[3] or code[3] == code[4]:
    ans = "Good"
print(ans)

Fixed submission:
code = input()
ans = "Good"
if code[0] == code[1] or code[1] == code[2] or code[2] == code[3]:
    ans = "Bad"
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
task = [int(j) for j in input().split()]

for i in range(n):
    task.append([int(j) for j in input().split()])

task.sort(key = lambda x:x[1])

Fixed submission:
n = int(input())
task = []

for i in range(n):
    task.append([int(j) for j in input().split()])

task.sort(key = lambda x:x[1])

ans = "Yes"
cur = 0
remaining = 0
for i in task:
    remaining += i[1] - cur - i[0]
    if remaining < 0:
        ans = "No"
        break
    cur = i[1]

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = [input() for _ in range(n)]
count = 0
s_new = []
for word in s:
  word_new = sorted(word)
  count += s_new.count(word_new)
  s_new.append(word_new)
print(count)

Fixed submission:
from collections import Counter
n = int(input())
s = [input() for _ in range(n)]
c = Counter()
count = 0
for word in s:
  a = ''.join(sorted(word))
  count += c[a]
  c[a] += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = [list(input()) for _ in range(n)]
for index, word in enumerate(s):
  s[index] = str(s[index].count("a")) + str(s[index].count("b")) + str(s[index].count("c")) + str(s[index].count("d")) + str(s[index].count("e")) + str(s[index].count("f")) + str(s[index].count("g")) + str(s[index].count("h")) + str(s[index].count("i")) + str(s[index].count("j")) + str(s[index].count("k")) + str(s[index].count("l")) + str(s[index].count("m")) + str(s[index].count("n")) + str(s[index].count("o")) + str(s[index].count("p")) + str(s[index].count("q")) + str(s[index].count("r")) + str(s[index].count("s")) + str(s[index].count("t")) + str(s[index].count("u")) + str(s[index].count("v")) + str(s[index].count("w")) + str(s[index].count("x")) + str(s[index].count("y")) + str(s[index].count("z"))
count = 0
for index, word in enumerate(s):
  count += s[index + 1:].count(word)
print(count)

Fixed submission:
from collections import Counter
n = int(input())
s = [input() for _ in range(n)]
c = Counter()
count = 0
for word in s:
  a = ''.join(sorted(word))
  count += c[a]
  c[a] += 1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q=map(int,input().split())
score=[K for i in range(N)]
for i in range(Q):
  A=int(input())
  for j in range(N):
    score[j]-=1
  score[A-1]+=1
for i in range(N):
  if(score[i]<=0):
    print("No")
  else:
    print("Yes")

Fixed submission:
N,K,Q=map(int,input().split())
count=[0 for i in range(N)]
for i in range(Q):
  A=int(input())
  count[A-1]+=1
for i in range(N):
  if(count[i]>Q-K):
    print("Yes")
  else:
    print("No")

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N,K,Q=map(int,input().split())
score=np.ones(N,dtype=int)*K
loss=np.ones(N,dtype=int)
for i in range(Q):
  A=int(input())
  score=score-loss
  score[A-1]+=1
for i in range(N):
  if(score[i]<=0):
    print("No")
  else:
    print("Yes")

Fixed submission:
N,K,Q=map(int,input().split())
count=[0 for i in range(N)]
for i in range(Q):
  A=int(input())
  count[A-1]+=1
for i in range(N):
  if(count[i]>Q-K):
    print("Yes")
  else:
    print("No")

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N,K,Q=map(int,input().split())
score=np.array([K for i in range(N)])
loss=np.array([1 for i in range(N)])
for i in range(Q):
  A=int(input())
  score=score-loss
  score[A-1]+=1
for i in range(N):
  if(score[i]<=0):
    print("No")
  else:
    print("Yes")

Fixed submission:
N,K,Q=map(int,input().split())
count=[0 for i in range(N)]
for i in range(Q):
  A=int(input())
  count[A-1]+=1
for i in range(N):
  if(count[i]>Q-K):
    print("Yes")
  else:
    print("No")
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
import numpy as np
from functools import lru_cache
import time

def main(): 
    if True:
        A,B,K = list(map(
            int, input().split()))
    else:
        pass

    A = A - K
    B = B if A > 0 else B + A 
    print(min(A),B)



if __name__ =='__main__':
    main()

Fixed submission:
# coding: utf-8
import numpy as np
from functools import lru_cache
import time

def main(): 
    if True:
        A,B,K = list(map(
            int, input().split()))
    else:
        pass

    A = A - K
    B = B if A > 0 else B + A 
    print(max(A,0),max(B,0))



if __name__ =='__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import numpy as np
s=np.asarray(list(str(input())))
r=15-s.size()
if(8 <= r + np.sum(s=="o")):
  print("YES")
else:
  print("NO")
 

Fixed submission:
import numpy as np
s=np.asarray(list(str(input())))
r=15-s.size
if(8 <= r + np.sum(s=="o")):
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
import numpy as np
    
n = int(input())
S = np.asarray([])
St = np.zeros(4) # None,B,A,BA
count = 0

for i in range(n):
    S=np.append(S,input())
    tmp = 0
    count += S[i].count("AB")
    if S[i][0] == "B":
        tmp += 1
    if S[i][-1] == "A":
        tmp += 2
    St[tmp]+=1

if (St[1] == 0)&(St[3]>0):
    St[1]+=1
    St[3]-=1

if (St[2] == 0)&(St[3]>0):
    St[2]+=1
    St[3]-=1

print(int(count+min(St[1],St[2])+St[3]))

Fixed submission:
import numpy as np

n,k=list(map(int,input().split()))
print(n-k+1)

Buggy python submission (verdict: Runtime Error):
    import numpy as np
        
    n = int(input())
    S = np.asarray([])
    St = np.zeros(4) # None,B,A,BA
    count = 0
     
    for i in range(n):
        S=np.append(S,input())
        tmp = 0
        count += S[i].count("AB")
        if S[i][0] == "B":
            tmp += 1
        if S[i][-1] == "A":
            tmp += 2
        St[tmp]+=1
     
    if (St[1] == 0)&(St[3]>0):
        St[1]+=1
        St[3]-=1
     
    if (St[2] == 0)&(St[3]>0):
        St[2]+=1
        St[3]-=1
     
    print(int(count+min(St[1],St[2])+St[3]))

Fixed submission:
import numpy as np

n,k=list(map(int,input().split()))
print(n-k+1)
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
import numpy as np
from functools import lru_cache
import time

def main(): 
    if True:
        N,K = list(map(int,input().split()))
        S = np.asarray(list(map(int,list(str(input())))))
    else:
        pass
    SN = np.asarray([])
    first = S[0]
    tmpnum = first
    if first == 0:
        SN = np.append(SN,0)
    SN = np.append(SN,0)

    count = 0
    for n in range(N)[1:]:
        if S[n] == tmpnum:
            count += 1
        else:
            count += 1
            SN = np.append(SN,count)
            #count = 0
            tmpnum = S[n]
    else:
        count += 1
        SN = np.append(SN,count)
        if tmpnum == 0:
            SN = np.append(SN,count)

    max = 0
    flag = 0
    for n in range(SN.size)[2*K+1::2]:
        if max < SN[n] - SN[n-2*K-1]:
            max = SN[n] - SN[n-2*K-1]
        flag = 1
    if flag == 0:
        print(int(SN[-1]-SN[0]))
    else:
        print(int(max))

if __name__ =='__main__':
    main()

Fixed submission:
# coding: utf-8
import numpy as np
from functools import lru_cache
import time

def main(): 
    if True:
        N,K = list(map(int,input().split()))
        S = np.asarray(list(map(int,list(str(input())))))
    else:
        N,K = [10**5,1]
        T = np.asarray(range(N))
        S = np.zeros(N)
        S[T%2==0] = 1

    SN = np.zeros(10**5+2)
    first = S[0]
    tmpnum = first
    k = 0
    if first == 0:
        k += 1
    k += 1

    count = 0
    for n in range(N)[1:]:
        if S[n] == tmpnum:
            count += 1
        else:
            count += 1
            SN[k] = count
            k += 1
            tmpnum = S[n]
    else:
        count += 1
        SN[k] = count
        if tmpnum == 0:
            SN[k+1] = count

    max = 0
    flag = 0
    for n in range(SN.size)[2*K+1::2]:
        if SN[n] == 0: break
        if max < SN[n] - SN[n-2*K-1]:
            max = SN[n] - SN[n-2*K-1]
        flag = 1
    
    if flag == 0:
        print(int(np.max(SN)))
    else:
        print(int(max))

if __name__ =='__main__':
    main()
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
r = a + b if b % a == 0 else b - a
print(r)


Fixed submission:
a,b = list(map(int, input().split()))
r = a + b if b % a == 0 else b - a
print(r)
Buggy python submission (verdict: Runtime Error):
import numpy as np
import math
import sys
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

n = list(map(int, input().split()))
a = list(map(int, input().split()))
a = np.asarray(a)

print(gcd(*a))


Fixed submission:
import numpy as np
import math
import sys

n = list(map(int, input().split()))
a = list(map(int, input().split()))
a = np.asarray(a)

while True:
    tmpmin = np.min(a[a!=0])
    a[a!=tmpmin] %= tmpmin
    #print(a,tmpmin)
    if tmpmin == np.min(a[a!=0]):break
    if np.sum(a) == 0: break

print(tmpmin)
Buggy python submission (verdict: Runtime Error):
import numpy as np

in_num = list(map(int, input().split()))
in_num2 = list(map(int, input().split()))
n = in_num[0]
k = in_num[1]
a = np.asarray(in_num2)
#n = 10**5
#k = 10**12
#a = np.asarray(np.arange(10**12))
if False:# k == 0 :
    print(np.sum(a))
    exit
else:
    max = 0
    ktmp = 0
    flag = 1 if k == 0 else 0
    i = 1
    while True:
        tmp = len(a[a%2==1])
        ktmp += i if tmp > n - tmp or flag == 1 else 0
        if ktmp > k:
            break
        tmp = tmp if tmp > n - tmp or flag == 1 else n - tmp 

        max += tmp * i
        #print(tmp,max,i,np.max(a))
        a = np.trunc(a / 2)
        i = i * 2
        if i > k:
            flag = 1
            if 0 ==  np.max(a):
                break

    print(max)

Fixed submission:
import numpy as np

m = list(map(int, input().split()))
t = m[0]
x = m[1]
print(t/x)

Buggy python submission (verdict: Runtime Error):
import numpy as np

in_num = list(map(int, input().split()))
in_num2 = list(map(int, input().split()))
n = in_num[0]
k = in_num[1]
a = np.asarray(in_num2)

if k == 0 :
    print(np.sum(a))
else:

    b = np.arange(k).reshape(k,1) + 1
    c = np.bitwise_xor(a,b)

    print(np.max(np.sum(c,axis=1)))

Fixed submission:
import numpy as np

m = list(map(int, input().split()))
t = m[0]
x = m[1]
print(t/x)

Buggy python submission (verdict: Runtime Error):
import numpy as np

in_num = list(map(int, input().split()))
in_num2 = list(map(int, input().split()))
n = in_num[0]
k = in_num[1]
a = np.asarray(in_num2)

if k == 0 :
    print(np.sum(a))
else:

    b = np.arange(k).reshape(k,1) + 1
    result = np.bitwise_xor(a,b)

    print(np.max(np.sum(result,axis=1)))

Fixed submission:
import numpy as np

m = list(map(int, input().split()))
t = m[0]
x = m[1]
print(t/x)
Buggy python submission (verdict: Runtime Error):
x = input()
y = input()

print(y+x)

Fixed submission:
string = []

string = input().split()

print(string[1]+string[0])

Buggy python submission (verdict: Runtime Error):
s,t = map(input().split())

print(t+s)

Fixed submission:
s,t = input().split()

print(t+s)

Buggy python submission (verdict: Runtime Error):
s = input()
t = input()

print(t+s)

Fixed submission:
s,t = input().split()

print(t+s)
Buggy python submission (verdict: Runtime Error):
n, m, v, p = map(int, input().split())
a = list(map(int, input().split()))

a.sort()

b = [a[x] for x in range(n - p)]

total = sum(b)

vote=(v - p) * m

ans = p

for n, i in enumerate(b):
    if (total - i + vote) // (len(b) - 1) <= i + m:
        ans += len(b) - n - 1
        break

print(ans)

Fixed submission:
from math import ceil
n, m, v, p = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse=True)[p - 1:]
l = 0
r = n - p

while l != r:
    k = ceil((l + r) / 2)
    b = a[k] + m
    if b < a[0] or (v - (n - k)) * m > (k * b - sum(a[:k])):
        r = k - 1
    else:
        l = k
print(p+l)

Buggy python submission (verdict: Runtime Error):
n, m, v, p = map(int, input().split())
a = list(map(int, input().split()))

a.sort()

b = [a[x] for x in range(n - p)]

total = sum(b)

vote=(v - p) * m

ans = p

for i in b:
    if (total - i + vote) // (len(b) - 1) < i + m:
        ans += 1
        
print(ans)

Fixed submission:
from math import ceil
n, m, v, p = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse=True)[p - 1:]
l = 0
r = n - p

while l != r:
    k = ceil((l + r) / 2)
    b = a[k] + m
    if b < a[0] or (v - (n - k)) * m > (k * b - sum(a[:k])):
        r = k - 1
    else:
        l = k
print(p+l)
Buggy python submission (verdict: Runtime Error):
#include<stdio.h>
int main(void){long n;scanf("%ld",&n);printf("%ld\n",n*(n-1)/2);}

Fixed submission:
n=int(input());print(n*(n-1)//2)
Buggy python submission (verdict: Runtime Error):
n = input()
ans = 0
for i in range(1, len(n)):
    if i%2: ans+=10**(i-1)*9
if len(n)%2: ans += int(n[1:])+1
print(ans)

Fixed submission:
ans = 0
for i in range(1, int(input())+1):
    if len(str(i))%2: ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
from math import factorial as fact
def comb(n, r): return fact(n)//(fact(r)*fact(n-r))

def main():
    n, k = map(int, input().split())
    for i in range(k): print((comb(n-k+1, i+1) * comb(k-1, i)) % 1000000007)

if __name__=="__main__": main()

Fixed submission:
from math import factorial as fact
def comb(n, r):
  if n<=r: return fact(n)//fact(r)
  else: return fact(n)//(fact(r)*fact(n-r))

def main():
    n, k = map(int, input().split())
    for i in range(k): print((comb(n-k+1, i+1) * comb(k-1, i)) % 1000000007)

if __name__=="__main__": main()
Buggy python submission (verdict: Runtime Error):
from math import ceil
def fanc(x):
    return round((ceil(x/10))*10)
menu = [int(input()) for _ in range(5)]
menu.sort(key=lambda x:x%10)
for i in range(5):
    if menu[i]%10:
        ans = menu.pop(i)
        break
menu = list(map(fanc, menu))
print(ans+sum(menu))

Fixed submission:
from math import ceil
def fanc(x):
    return int((ceil(x/10))*10)
ans = 0
menu = [int(input()) for _ in range(5)]
menu.sort(key=lambda x:x%10)
for i in range(5):
    if menu[i]%10:
        ans += menu.pop(i)
        break
menu = list(map(fanc, menu))
print(ans+sum(menu))

Buggy python submission (verdict: Runtime Error):
from math import ceil
def fanc(x):
    return int((ceil(x/10))*10)
menu = [int(input()) for _ in range(5)]
menu.sort(key=lambda x:x%10)
for i in range(5):
    if menu[i]%10:
        ans = menu.pop(i)
        break
menu = list(map(fanc, menu))
print(ans+sum(menu))

Fixed submission:
from math import ceil
def fanc(x):
    return int((ceil(x/10))*10)
ans = 0
menu = [int(input()) for _ in range(5)]
menu.sort(key=lambda x:x%10)
for i in range(5):
    if menu[i]%10:
        ans += menu.pop(i)
        break
menu = list(map(fanc, menu))
print(ans+sum(menu))
Buggy python submission (verdict: Runtime Error):
b = input()
if b == 'A':
    print('T')
elif b == 'T':
    print('A')
elif b == 'G':
    print("C")
else :
    print("T")

~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                     

Fixed submission:
b = input()
if b == 'A':
    print('T')
elif b == 'T':
    print('A')
elif b == 'G':
    print("C")
else :
    print("G")
Buggy python submission (verdict: Time Limit Exceeded):
n, q = map(int, input().split())
s = input()
array = []
for i in range(n-1):
    if (s[i] == "A" and s[i+1] == "C"):
        array.append(i)

for i in range(q):
    a, b = map(int, input().split())
    ans = 0
    for m in array:
        if (a-1 <= m < b-1):
            ans += 1
    print(ans)

Fixed submission:
n, q = map(int, input().split())
s = input()
ac = [0]*n
for i in range(n-1):ac[i+1] = ac[i] + (s[i:i+2]=="AC")
for i in range(q):
    l,r=map(int,input().split())
    print(ac[r-1]-ac[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
n, q = map(int, input().split())
s = input()
for i in range(q):
    a, b = input().split()
    print(s[int(a)-1:int(b)].count("AC"))

Fixed submission:
n, q = map(int, input().split())
s = input()
ac = [0]*n
for i in range(n-1):ac[i+1] = ac[i] + (s[i:i+2]=="AC")
for i in range(q):
    l,r=map(int,input().split())
    print(ac[r-1]-ac[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
n, q = map(int, input().split())
s = input()
nums = [list(map(int, input().split())) for i in range(q)]
for m in nums:
    s2 = s[m[0]-1:m[1]]
    print(s2.count("AC"))

Fixed submission:
n, q = map(int, input().split())
s = input()
ac = [0]*n
for i in range(n-1):ac[i+1] = ac[i] + (s[i:i+2]=="AC")
for i in range(q):
    l,r=map(int,input().split())
    print(ac[r-1]-ac[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
n, q = map(int, input().split())
s = input()
nums = [list(map(int, input().split())) for i in range(q)]
for m in nums:
    s2 = s[m[0]-1:m[1]]
    s2 = s2.split("AC")
    print(len(s2)-1)


Fixed submission:
n, q = map(int, input().split())
s = input()
ac = [0]*n
for i in range(n-1):ac[i+1] = ac[i] + (s[i:i+2]=="AC")
for i in range(q):
    l,r=map(int,input().split())
    print(ac[r-1]-ac[l-1])
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = []
b = []
al = []
ans = 0
for i in range(n):
    al.append(list(map(int, input().split())))

for i in range(n):
    a.append(al[i][0])
    b.append(al[i][1])

ans = 0
while(m > 0):
    if m > b[a.index(min(a))]:
        m -= b[a.index(min(a))]
        ans += a[a.index(min(a))]*b[a.index(min(a))]
        b.pop(a.index(min(a)))
        a.pop(a.index(min(a)))
    else :
        ans += a[a.index(min(a))]*m
        break
print(ans)

Fixed submission:
n, m = map(int, input().split())
ab = sorted([list(map(int,input().split()))for i in range(n)],key=lambda x:x[0])
ans = 0
i = 0
while m-ab[i][1]>0:
    m -= ab[i][1]
    ans += ab[i][0]*ab[i][1]
    i += 1
ans += ab[i][0] * m
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = []
b = []
al = []
ans = 0
for i in range(n):
    al.append(list(map(int, input().split())))

for i in range(n):
    a.append(al[i][0])
    b.append(al[i][1])

while(m):
    if len(a) > 1:
        ind = a.index(min(a))
    else:
        ind = 0
    while(b[ind]):
        b[ind] -= 1
        ans += min(a)
        m -= 1
        if (b[ind] == 0):
            a[ind] = 1000000000
            if len(a) > 1:
                ind = a.index(min(a))
            else:
                ind = 0
        if (m == 0):
            break
print(ans)

Fixed submission:
n, m = map(int, input().split())
ab = sorted([list(map(int,input().split()))for i in range(n)],key=lambda x:x[0])
ans = 0
i = 0
while m-ab[i][1]>0:
    m -= ab[i][1]
    ans += ab[i][0]*ab[i][1]
    i += 1
ans += ab[i][0] * m
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
nums = []
for i in range(min(a, b)-2):
    if ((a % (i+2) == 0) and (b % (i+2) == 0)):
        nums.append(i+2)
if ( max(a,b) % min(a,b) == 0 ):
    nums.append(min(a,b))
print(nums[-1*k])

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