Buggy python submission (verdict: Time Limit Exceeded):
import sys
from functools import reduce

input = sys.stdin.readline

def gcd(a,b):
    if b>a:
        a, b = b, a
    while b:
        a, b = b, a%b
    return a

def gcds(nums):
    return reduce(gcd, nums)

n = int(input())
a = [int(i) for i in input().split()]

ans = 0
for i in range(len(a)):
    if i == 0:
        l = 0
    else:
        l = gcds(a[:i])
    if i == len(a)-1:
        r = 0
    else:
        r = gcds(a[(i+1):])
    aaa = gcd(l, r)
    if ans < aaa:
        ans = aaa
print(ans)

Fixed submission:
import sys
from functools import reduce

input = sys.stdin.readline

def gcd(a,b):
    if b>a:
        a, b = b, a
    while b:
        a, b = b, a%b
    return a

n = int(input())
a = [int(i) for i in input().split()]


ans = 0
l = [0]*(n+1)
r = [0]*(n+1)
for i in range(n):
    l[i+1] = gcd(l[i], a[i])
    r[n-i-1] = gcd(r[n-i], a[n-i-1])
for i in range(n):
    ans = max(ans, gcd(l[i], r[i+1]))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#import math
from functools import reduce

def gcd(a,b):
    if b>a:
        a, b = b, a
    while b:
        a, b = b, a%b
    return a

def gcds(nums):
    return reduce(gcd, nums)

n = int(input())
a = [int(i) for i in input().split()]

ans = 0
for i in range(len(a)):
    if i == 0:
        l = 0
    else:
        l = gcds(a[:i])
    
    if i == len(a) - 1:
        r = 0
    else:
        r = gcds(a[(i+1):])
    
    aaa = gcd(l, r)
    
    if ans < aaa:
        ans = aaa
print(ans)

Fixed submission:
import sys
from functools import reduce

input = sys.stdin.readline

def gcd(a,b):
    if b>a:
        a, b = b, a
    while b:
        a, b = b, a%b
    return a

n = int(input())
a = [int(i) for i in input().split()]


ans = 0
l = [0]*(n+1)
r = [0]*(n+1)
for i in range(n):
    l[i+1] = gcd(l[i], a[i])
    r[n-i-1] = gcd(r[n-i], a[n-i-1])
for i in range(n):
    ans = max(ans, gcd(l[i], r[i+1]))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#import math
from functools import reduce

def gcd(a,b):
    if b>a:
        a, b = b, a
    while b:
        a, b = b, a%b
    return a

def gcds(nums):
    return reduce(gcd, nums)

n = int(input())
a = [int(i) for i in input().split()]

ans = 0
for i in range(len(a)):
    aa = a[:i] + a[(i+1):]
    if ans < gcds(aa):
        ans = gcds(aa)
print(ans)

Fixed submission:
import sys
from functools import reduce

input = sys.stdin.readline

def gcd(a,b):
    if b>a:
        a, b = b, a
    while b:
        a, b = b, a%b
    return a

n = int(input())
a = [int(i) for i in input().split()]


ans = 0
l = [0]*(n+1)
r = [0]*(n+1)
for i in range(n):
    l[i+1] = gcd(l[i], a[i])
    r[n-i-1] = gcd(r[n-i], a[n-i-1])
for i in range(n):
    ans = max(ans, gcd(l[i], r[i+1]))
print(ans)

Buggy python submission (verdict: Runtime Error):
#import math
from functools import reduce

def gcd(a,b):
    if b>a:
        a, b = b, a
    while b:
        a, b = b, a%b
    return a

def gcds(nums):
    return reduce(gcd, nums)

a = int(input())
a = [int(i) for i in input().split()]

ans = 0
for i in range(len(a)):
    aa = a[:i] + a[(i+1):]
    if ans < gcd(aa):
        ans = gcd(aa)
print(ans)

Fixed submission:
import sys
from functools import reduce

input = sys.stdin.readline

def gcd(a,b):
    if b>a:
        a, b = b, a
    while b:
        a, b = b, a%b
    return a

n = int(input())
a = [int(i) for i in input().split()]


ans = 0
l = [0]*(n+1)
r = [0]*(n+1)
for i in range(n):
    l[i+1] = gcd(l[i], a[i])
    r[n-i-1] = gcd(r[n-i], a[n-i-1])
for i in range(n):
    ans = max(ans, gcd(l[i], r[i+1]))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import fractions 
from functools import reduce

n = int(input())
a = [int(i) for i in input().split()]

def gcd(nums):
    return reduce(fractions.gcd, nums)

ans = 0
for i in range(len(a)):
    aa = a[:i] + a[(i+1):]
    if ans < gcd(aa):
        ans = gcd(aa)
print(ans)

Fixed submission:
import sys
from functools import reduce

input = sys.stdin.readline

def gcd(a,b):
    if b>a:
        a, b = b, a
    while b:
        a, b = b, a%b
    return a

n = int(input())
a = [int(i) for i in input().split()]


ans = 0
l = [0]*(n+1)
r = [0]*(n+1)
for i in range(n):
    l[i+1] = gcd(l[i], a[i])
    r[n-i-1] = gcd(r[n-i], a[n-i-1])
for i in range(n):
    ans = max(ans, gcd(l[i], r[i+1]))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
from functools import reduce

n = int(input())
a = [int(i) for i in input().split()]

def gcd(nums):
    return reduce(fractions.gcd, nums)

ans_l = []
for i in range(len(a)):
    aa = a[:i] + a[(i+1):]
    ans_l.append(gcd(aa))
ans = max(ans_l)
print(ans)

Fixed submission:
import sys
from functools import reduce

input = sys.stdin.readline

def gcd(a,b):
    if b>a:
        a, b = b, a
    while b:
        a, b = b, a%b
    return a

n = int(input())
a = [int(i) for i in input().split()]


ans = 0
l = [0]*(n+1)
r = [0]*(n+1)
for i in range(n):
    l[i+1] = gcd(l[i], a[i])
    r[n-i-1] = gcd(r[n-i], a[n-i-1])
for i in range(n):
    ans = max(ans, gcd(l[i], r[i+1]))
print(ans)

Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

n = int(input())
a = [int(i) for i in input().split()]

def gcd(nums):
    return reduce(math.gcd, nums)

ans_l = []
for i in range(len(a)):
    aa = a[:i] + a[(i+1):]
    ans_l.append(gcd(aa))
ans = max(ans_l)
print(ans)

Fixed submission:
import sys
from functools import reduce

input = sys.stdin.readline

def gcd(a,b):
    if b>a:
        a, b = b, a
    while b:
        a, b = b, a%b
    return a

n = int(input())
a = [int(i) for i in input().split()]


ans = 0
l = [0]*(n+1)
r = [0]*(n+1)
for i in range(n):
    l[i+1] = gcd(l[i], a[i])
    r[n-i-1] = gcd(r[n-i], a[n-i-1])
for i in range(n):
    ans = max(ans, gcd(l[i], r[i+1]))
print(ans)