Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3

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


set_odd = set()
set_even = set()

for i in a:
    if i % 2 == 1:
        set_odd.add(i)
    else:
        set_even.add(i)

if len(set_odd) >= 2:
    print(1)
    exit()
elif len(set_odd) == 1:
    if len(set_even) >= 1:
        print(1)
        exit()
    else:
        print(min(set_odd))

# only even number
min_a = min(set_even)
set_even = list(set_even)

ans = []

for i in range(len(set_even)):
    ans_tmp = set_even[i] % min_a
    if ans_tmp != 0:
        ans.append(ans_tmp)
    if min_a-ans_tmp != 0:
        ans.append(min_a-ans_tmp)

if ans == []:
    print(min(set_even))
else:
    print(min(ans))


Fixed submission:
#!/usr/bin/env python3

import fractions
n = int(input())
a = list(map(int, input().split()))


value = a[0]
for i in range(1, n):
    value = fractions.gcd(value, a[i])
print(value)

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3

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


set_odd = set()
set_even = set()

for i in a:
    if i % 2 == 1:
        set_odd.add(i)
    else:
        set_even.add(i)

if len(set_odd) >= 2:
    print(1)
    exit()
elif len(set_odd) == 1:
    if len(set_even) >= 1:
        print(1)
        exit()
    else:
        print(min(set_odd))

# only even number
min_a = min(set_even)
set_even = list(set_even)

ans = []

for i in range(len(set_even)):
    ans_tmp = a[i] % min_a
    if ans_tmp != 0:
        ans.append(ans_tmp)
    if min_a-ans_tmp != 0:
        ans.append(min_a-ans_tmp)

if ans == []:
    print(min(set_even))
else:
    print(min(ans))


Fixed submission:
#!/usr/bin/env python3

import fractions
n = int(input())
a = list(map(int, input().split()))


value = a[0]
for i in range(1, n):
    value = fractions.gcd(value, a[i])
print(value)

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3

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


set_odd = set()
set_even = set()

for i in a:
    if i % 2 == 1:
        set_odd.add(i)
    else:
        set_even.add(i)

if len(set_odd) >= 2:
    print(1)
    exit()
elif len(set_odd) == 1:
    if len(set_even) >= 1:
        print(1)
        exit()
    else:
        print(min(set_odd))

# only even number
min_a = min(set_even)
set_even = list(set_even)

ans = []

for i in range(len(a)):
    ans_tmp = a[i] % min_a
    if ans_tmp != 0:
        ans.append(ans_tmp)
    if min_a-ans_tmp != 0:
        ans.append(min_a-ans_tmp)

if ans == []:
    print(min(set_even))
else:
    print(min(ans))


Fixed submission:
#!/usr/bin/env python3

import fractions
n = int(input())
a = list(map(int, input().split()))


value = a[0]
for i in range(1, n):
    value = fractions.gcd(value, a[i])
print(value)

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3

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


set_odd = set()
set_even = set()

for i in a:
    if i % 2 == 1:
        set_odd.add(i)
    else:
        set_even.add(i)

if len(set_odd) >= 2:
    print(1)
    exit()
elif len(set_odd) == 1:
    if len(set_even) >= 1:
        print(1)
        exit()
    else:
        print(min(set_odd))

# only even number
min_a = min(set_even)
set_even = list(set_even)

ans = []

for i in range(len(a)):
    ans_tmp = a[i] % min_a
    if ans_tmp != 0:
        ans.append(ans_tmp)
    if min_a-ans_tmp != 0:
        ans.append(min_a-ans_tmp)

print(min(ans))


Fixed submission:
#!/usr/bin/env python3

import fractions
n = int(input())
a = list(map(int, input().split()))


value = a[0]
for i in range(1, n):
    value = fractions.gcd(value, a[i])
print(value)