Buggy python submission (verdict: Runtime Error):
import fileinput


def gcd(a, b):
    if b == 0:
        r = a
    else:
        r = gcd(b, a % b)
    return r


def gcdl(l):
    if len(l) > 1:
        r = gcdl([gcd(l[0], l[1])] + l[2:])
    else:
        r = l
    return r


def algorithm(n, a):
    return gcdl(a)[0]


def pass_inputs(input_lines):
    n = input_lines[0][0]
    return algorithm(n, input_lines[1])


def convert_int(s):
    try:
        r = int(s)
    except ValueError:
        r = s
    return r


def run():
    out = pass_inputs([[convert_int(v) for v in l.strip().split(" ")] for l in fileinput.input()])
    print(out)


if __name__ == "__main__":
    run()


Fixed submission:
import fileinput


def gcd(a, b):
    if b == 0:
        r = a
    else:
        r = gcd(b, a % b)
    return r


def gcdl(l):
    r = gcd(l[0], l[1])
    for i in range(2, len(l)):
        r = gcd(r, l[i])
    return r


def algorithm(n, a):
    return gcdl(a)


def pass_inputs(input_lines):
    n = input_lines[0][0]
    return algorithm(n, input_lines[1])


def convert_int(s):
    try:
        r = int(s)
    except ValueError:
        r = s
    return r


def run():
    out = pass_inputs([[convert_int(v) for v in l.strip().split(" ")] for l in fileinput.input()])
    print(out)


if __name__ == "__main__":
    run()

Buggy python submission (verdict: Runtime Error):
import math

n = int(input())
a = list(map(int,input().split()))
ans = a[0]

for i,item in enumerate(a):
    if i != 0:
        ans = math.gcd(ans,item)

print(ans,end='')

Fixed submission:
from fractions import gcd

n = int(input())
a = list(map(int,input().split()))
ans = a[0]

for i,item in enumerate(a):
    if i != 0:
        ans = gcd(ans,item)

print(ans,end='')

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
box = list(map(int,input().split()))

while(1):
    s = min(box)
    num = box.index(s)

    for index,item in enumerate(box):
    
        if num != index:
        
            if item % s == 0:
                box.remove(item)
            else:
                box[index] = item % s

    if len(box) == 1:
        break

print(box[0],end='')

Fixed submission:
from fractions import gcd

n = int(input())
a = list(map(int,input().split()))
ans = a[0]

for i,item in enumerate(a):
    if i != 0:
        ans = gcd(ans,item)

print(ans,end='')

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
box = list(map(int,input().split()))

while(1):

    num = box.index(min(box))#最小値のインデックス
    #print(num,box)
    for index,item in enumerate(box):
    
        if num != index:
        
            if item % min(box) == 0:
                box.remove(item)
            else:
                box[index] = item % min(box)

    if len(box) == 1:
        break

print(box[0],end='')

Fixed submission:
from fractions import gcd

n = int(input())
a = list(map(int,input().split()))
ans = a[0]

for i,item in enumerate(a):
    if i != 0:
        ans = gcd(ans,item)

print(ans,end='')

Buggy python submission (verdict: Runtime Error):
n = int(input())
box = list(map(int,input().split()))

while(1):

    for index,item in enumerate(box):
        if index != 0 and item != 0:
            if item % min(box) == 0:
                box[index] = 0
                box.remove(0)
            else:
                box[index] = item % box[0]
        
    #print(box)
    if len(box) == 1:
        break

print(box[0],end='')

Fixed submission:
from fractions import gcd

n = int(input())
a = list(map(int,input().split()))
ans = a[0]

for i,item in enumerate(a):
    if i != 0:
        ans = gcd(ans,item)

print(ans,end='')

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
box = list(map(int,input().split()))

box.sort()

while(1):

    for index,item in enumerate(box):
        if index != 0 and item != 0:
            if item % box[0] == 0:
                box[index] = 0
                box.remove(0)
            else:
                box[index] = item % box[0]
        
    box.sort(reverse=True)
    #print(box)
    if len(box) == 1:
        break
    box.sort()

print(box[0],end='')

Fixed submission:
from fractions import gcd

n = int(input())
a = list(map(int,input().split()))
ans = a[0]

for i,item in enumerate(a):
    if i != 0:
        ans = gcd(ans,item)

print(ans,end='')