Buggy python submission (verdict: Runtime Error):
import math
from itertools import accumulate

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

L = [0]+list(accumulate(a, math.gcd))
R = list(accumulate(reversed(a), math.gcd))[::-1]+[0]


ans = 0

for i in range(n):
    ans =max(math.gcd(L[i],R[i+1]),ans)

if n == 2:
    print(max(a))
else:
    print(ans)


Fixed submission:
from fractions import gcd

n = int(input())
list_ = list(map(int, input().strip().split()))

gcd_from_left = [0]
gcd_from_right = [0]
for i in range(n):
    gcd_from_left.append(gcd(gcd_from_left[i], list_[i]))
    gcd_from_right.append(gcd(gcd_from_right[i], list_[-(i + 1)]))

gcd_from_left.insert(0, 0)
gcd_from_right.insert(0, 0)
gcd_from_right.reverse()

print(max(gcd(gcd_from_left[i], gcd_from_right[i]) for i in range(n + 2)))

Buggy python submission (verdict: Runtime Error):
import math
from itertools import accumulate

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

L = [0]+list(accumulate(a, math.gcd))
R = list(accumulate(reversed(a), math.gcd))[::-1]+[0]

ans = 0

for i in range(n-1):
        ans = max(math.gcd(L[i],R[i+1]),ans)

print(L)
print(R)
print(ans)


Fixed submission:
from fractions import gcd

n = int(input())
list_ = list(map(int, input().strip().split()))

gcd_from_left = [0]
gcd_from_right = [0]
for i in range(n):
    gcd_from_left.append(gcd(gcd_from_left[i], list_[i]))
    gcd_from_right.append(gcd(gcd_from_right[i], list_[-(i + 1)]))

gcd_from_left.insert(0, 0)
gcd_from_right.insert(0, 0)
gcd_from_right.reverse()

print(max(gcd(gcd_from_left[i], gcd_from_right[i]) for i in range(n + 2)))

Buggy python submission (verdict: Runtime Error):
import math
from itertools import accumulate

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

L = [0]+list(accumulate(a, math.gcd))
R = list(accumulate(reversed(a), math.gcd))[::-1]+[0]

ans = 0

for i in range(n):
        ans = max(math.gcd(L[i],R[i+1]),ans)


print(ans)

Fixed submission:
from fractions import gcd

n = int(input())
list_ = list(map(int, input().strip().split()))

gcd_from_left = [0]
gcd_from_right = [0]
for i in range(n):
    gcd_from_left.append(gcd(gcd_from_left[i], list_[i]))
    gcd_from_right.append(gcd(gcd_from_right[i], list_[-(i + 1)]))

gcd_from_left.insert(0, 0)
gcd_from_right.insert(0, 0)
gcd_from_right.reverse()

print(max(gcd(gcd_from_left[i], gcd_from_right[i]) for i in range(n + 2)))

Buggy python submission (verdict: Runtime Error):
import math
from itertools import accumulate

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

L = list(accumulate(a, math.gcd))
R = list(accumulate(reversed(a), math.gcd)) 

ans = 0
if n == 2:
    print(max(a))
else:
    for i in range(1,n):
        ans = max(math.gcd(L[i],R[i]),ans)
        print(max(ans))
    


Fixed submission:
from fractions import gcd

n = int(input())
list_ = list(map(int, input().strip().split()))

gcd_from_left = [0]
gcd_from_right = [0]
for i in range(n):
    gcd_from_left.append(gcd(gcd_from_left[i], list_[i]))
    gcd_from_right.append(gcd(gcd_from_right[i], list_[-(i + 1)]))

gcd_from_left.insert(0, 0)
gcd_from_right.insert(0, 0)
gcd_from_right.reverse()

print(max(gcd(gcd_from_left[i], gcd_from_right[i]) for i in range(n + 2)))

Buggy python submission (verdict: Runtime Error):
import math
from itertools import accumulate

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

L = list(accumulate(a, math.gcd))
R = list(accumulate(reversed(a), math.gcd)) 

ans = 0
for i in range(1,n):
    ans = max(math.gcd(L[i],R[i]),ans)
    
print(ans)

Fixed submission:
from fractions import gcd

n = int(input())
list_ = list(map(int, input().strip().split()))

gcd_from_left = [0]
gcd_from_right = [0]
for i in range(n):
    gcd_from_left.append(gcd(gcd_from_left[i], list_[i]))
    gcd_from_right.append(gcd(gcd_from_right[i], list_[-(i + 1)]))

gcd_from_left.insert(0, 0)
gcd_from_right.insert(0, 0)
gcd_from_right.reverse()

print(max(gcd(gcd_from_left[i], gcd_from_right[i]) for i in range(n + 2)))