Problem p03106 (python)

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

ans = 0

lista = list(range(a+1))
aa = lista.pop(0)

listb = list(range(b+1))
bb = listb.pop(0)

if (a < b):
    li = [i for i in lista if a % i == 0 and b % i == 0]
    li = sorted(li, reverse=True)
    ans = li[k-1]
else:
    li = [i for i in listb if a % i == 0 and b % i == 0]
    li = sorted(li, reverse=True)
    ans = li[k-1]

print(ans)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())

ans = 0

lista = list(range(a+1))
aa = lista.pop(0)

listb = list(range(b+1))
bb = listb.pop(0)

if (a < b):
    li = [i for i in lista if a % i == 0 && b % i == 0]
    li = sorted(li, reverse=True)
    ans = li[k-1]
else:
    li = [i for i in listb if a % i == 0 && b % i == 0]
    li = sorted(li, reverse=True)
    ans = li[k-1]

print(ans)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())

ans = 0

lista = range(a+1)
aa = lista.pop(0)

listb = range(b+1)
bb = listb.pop(0)

if (a < b):
    li = [i for i in lista if a % i == 0 && b % i == 0]
    li = sorted(li, reverse=True)
    ans = li[k-1]
else:
    li = [i for i in listb if a % i == 0 && b % i == 0]
    li = sorted(li, reverse=True)
    ans = li[k-1]

print(ans)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())

ans = 0

lista = range(a+1)
aa = lista.pop(0)

listb = range(b+1)
bb = listb.pop(0)

if (a < b):
    li = [i for i in listb if a % i == 0 && b % i == 0]
    li = sorted(li, reverse=True)
    ans = li[k-1]
else:
    li = [i for i in lista if a % i == 0 && b % i == 0]
    li = sorted(li, reverse=True)
    ans = li[k-1]

print(ans)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())

ans = 0

lista = range(a+1)
aa = lista.pop(0)

listb = range(b+1)
bb = listb.pop(0)

if (a < b):
    li = [i for i in listb if (a % i == 0 && b % i == 0)]
    li = sorted(li, reverse=True)
    ans = li[k-1]
else:
    li = [i for i in lista if (a % i == 0 && b % i == 0)]
    li = sorted(li, reverse=True)
    ans = li[k-1]

print(ans)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())

ans = 0

lista = range(a+1)
aa = lista.pop(0)

listb = range(b+1)
bb = listb.pop(0)

if (a < b):
    li = [i for i in listb if (a % i == 0 && b % i == 0)]
    ans = li[k-1]
else:
    li = [i for i in lista if (a % i == 0 && b % i == 0)]
    ans = li[k-1]

print(ans)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())

ans = 0

if (a < b):
    li = [i for i in range(b+1) if (a % i == 0 && b % i == 0 && i != 0)]
    ans = li[k-1]
else:
    li = [i for i in range(a+1) if (a % i == 0 && b % i == 0 && i != 0)]
    ans = li[k-1]

print(ans)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())

ans = 0

if (a < b):
    list = [i for i in range(b+1) if (a % i == 0 && b % i == 0 && i != 0)]
    ans = list[k-1]
else:
    list = [i for i in range(a+1) if (a % i == 0 && b % i == 0 && i != 0)]
    ans = list[k-1]

print(ans)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())

ans = 0

if (a < b):
    list = [i for i in range(b) if a % i == 0 && b % i == 0 && i != 0]
    ans = list[k-1]
else:
    list = [i for i in range(a) if a % i == 0 && b % i == 0 && i != 0]
    ans = list[k-1]

print(ans)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())

ans = 0

if (a < b):
    list = [i for i in range(b) if a % i == 0 && b % i == 0]
    ans = list[k-1]
else:
    list = [i for i in range(a) if a % i == 0 && b % i == 0]
    ans = list[k-1]

print(ans)