Buggy python submission (verdict: Runtime Error):
from fractions import gcd
n=int(input())
a=[int(i) for i in input().split()]
c=a[0]
for i in a:
    c=gcd(c,a)
print(c)


Fixed submission:

n=int(input())
a=[int(i) for i in input().split()]
c=a[0]
def gcd(x,y):
    while y:
        x,y=y,x%y
    return x

for i in a:
    c=gcd(c,i)
print(c)

Buggy python submission (verdict: Runtime Error):
#copy code
from fractions import gcd
n=int(input())
a=[int(i) for i in input().split()]
c=a[0]
for i in a:
    c=gcd(c,a)
print(c)


Fixed submission:

n=int(input())
a=[int(i) for i in input().split()]
c=a[0]
def gcd(x,y):
    while y:
        x,y=y,x%y
    return x

for i in a:
    c=gcd(c,i)
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(i) for i in input().split()]
a.sort()
i=1
while len(a)>=2:
    if i>=len(a)-1:
        i=1
    a[i]-=a[0]
    if a[i]<=0:
        del a[i]
    i+=1
    a.sort()

print(a[0])

Fixed submission:

n=int(input())
a=[int(i) for i in input().split()]
c=a[0]
def gcd(x,y):
    while y:
        x,y=y,x%y
    return x

for i in a:
    c=gcd(c,i)
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(i) for i in input().split()]
a.sort()
i=1
while len(a)>=2:
    if i>=len(a):
        i=1
    if a[i] % a[0]==0:
        del a[i]
    else:
        a[i]-=a[0]
        if a[i]<=0:
            del a[i]
    i+=1
    a.sort()

print(a[0])

Fixed submission:

n=int(input())
a=[int(i) for i in input().split()]
c=a[0]
def gcd(x,y):
    while y:
        x,y=y,x%y
    return x

for i in a:
    c=gcd(c,i)
print(c)

Buggy python submission (verdict: Time Limit Exceeded):

n=int(input())
a=[int(i) for i in input().split()]
a.sort()
i=1
while True:
    if len(a)<=1:
        break
    else:
        if i>=len(a):
            i=1
        if a[i] % a[0]==0:
            del a[i]
        else:
            a[i]-=a[0]
            if a[i]<=0:
                del a[i]
    a.sort()
    i+=1
print(a[0])

Fixed submission:

n=int(input())
a=[int(i) for i in input().split()]
c=a[0]
def gcd(x,y):
    while y:
        x,y=y,x%y
    return x

for i in a:
    c=gcd(c,i)
print(c)

Buggy python submission (verdict: Time Limit Exceeded):

n=int(input())
a=[int(i) for i in input().split()]
a.sort()
i=1
while True:
    if len(a)<=1:
        break
    else:
        if i>=len(a):
            i=1
        if a[i] % a[0]==0:
            del a[i]
        else:
            a[i]-=a[0]
            if a[i]==0:
                del a[i]
    a.sort()
    i+=1
print(a[0])

Fixed submission:

n=int(input())
a=[int(i) for i in input().split()]
c=a[0]
def gcd(x,y):
    while y:
        x,y=y,x%y
    return x

for i in a:
    c=gcd(c,i)
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(i) for i in input().split()]
a.sort()
i=1
while True:
    if len(a)==1:
        break
    else:
        if i>=len(a):
            i=1
        if a[i] % a[0]==0:
            del a[i]
        else:
            a[i]-=a[0]
            if a[i]==0:
                del a[i]
    a.sort()
    i+=1
print(a[0])

Fixed submission:

n=int(input())
a=[int(i) for i in input().split()]
c=a[0]
def gcd(x,y):
    while y:
        x,y=y,x%y
    return x

for i in a:
    c=gcd(c,i)
print(c)