Buggy python submission (verdict: Time Limit Exceeded):
import functools
import copy
def gcd_strategy():
    import math
    import fractions
    return math.gcd if hasattr(math, "gcd") else fractions.gcd
gcd = gcd_strategy()


n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
  l=a.copy()
  del l[i]
  ans=max(ans,functools.reduce(gcd, l))
print(ans)


Fixed submission:
import fractions
n=int(input())
a=list(map(int,input().split()))
l=[a[0]]
r=[a[-1]]
for i in range(n-1):
  l.append(fractions.gcd(l[i],a[i+1])) #l[i] は最初i個
for i in range(n-1):
  r.append(fractions.gcd(r[i],a[-2-i])) #r[i]は右i r[n-1]=全部 l[0]and r[n-3]
m=[l[n-2],r[n-2]]
for i in range(n-2):
  m.append(fractions.gcd(l[i],r[n-i-3]))
print(max(m))

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

n=int(input())
a=list(map(int,input().split()))
ans=0
r=[]
if n==2:
    print(max(a[0],a[1]))
else:
    for i in range(n):
      l=a.copy()
      del l[i]
      r.clear()
      for j in range(n-2):
        r.append(math.gcd(l[j],l[j+1]))
      g=r[-1]
      if ans<g:
        ans=g
    print(ans)

Fixed submission:
import fractions
n=int(input())
a=list(map(int,input().split()))
l=[a[0]]
r=[a[-1]]
for i in range(n-1):
  l.append(fractions.gcd(l[i],a[i+1])) #l[i] は最初i個
for i in range(n-1):
  r.append(fractions.gcd(r[i],a[-2-i])) #r[i]は右i r[n-1]=全部 l[0]and r[n-3]
m=[l[n-2],r[n-2]]
for i in range(n-2):
  m.append(fractions.gcd(l[i],r[n-i-3]))
print(max(m))

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

n=int(input())
a=list(map(int,input().split()))
ans=0
r=[]
if n==2:
    print(max(a[0],a[1]))
else:
    
    for i in range(n):
      l=copy.copy(a)
      del l[i]
      r.clear()
      for j in range(n-2):
        r.append(math.gcd(l[j],l[j+1]))
      g=r[-1]
      if ans<g:
        ans=g
    print(ans)


Fixed submission:
import fractions
n=int(input())
a=list(map(int,input().split()))
l=[a[0]]
r=[a[-1]]
for i in range(n-1):
  l.append(fractions.gcd(l[i],a[i+1])) #l[i] は最初i個
for i in range(n-1):
  r.append(fractions.gcd(r[i],a[-2-i])) #r[i]は右i r[n-1]=全部 l[0]and r[n-3]
m=[l[n-2],r[n-2]]
for i in range(n-2):
  m.append(fractions.gcd(l[i],r[n-i-3]))
print(max(m))

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

n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
  l=copy.copy(a)
  del l[i]
  r=[]
  for j in range(n-2):
    r.append(gcd(l[j],l[j+1]))
  g=max(r)
  if ans<g:
    ans=g
print(ans)


Fixed submission:
import fractions
n=int(input())
a=list(map(int,input().split()))
l=[a[0]]
r=[a[-1]]
for i in range(n-1):
  l.append(fractions.gcd(l[i],a[i+1])) #l[i] は最初i個
for i in range(n-1):
  r.append(fractions.gcd(r[i],a[-2-i])) #r[i]は右i r[n-1]=全部 l[0]and r[n-3]
m=[l[n-2],r[n-2]]
for i in range(n-2):
  m.append(fractions.gcd(l[i],r[n-i-3]))
print(max(m))

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

n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
  l=copy.copy(a)
  del l[i]
  g=functools.reduce(math.gcd, l)
  if ans<g:
    ans=g
print(ans)

Fixed submission:
import fractions
n=int(input())
a=list(map(int,input().split()))
l=[a[0]]
r=[a[-1]]
for i in range(n-1):
  l.append(fractions.gcd(l[i],a[i+1])) #l[i] は最初i個
for i in range(n-1):
  r.append(fractions.gcd(r[i],a[-2-i])) #r[i]は右i r[n-1]=全部 l[0]and r[n-3]
m=[l[n-2],r[n-2]]
for i in range(n-2):
  m.append(fractions.gcd(l[i],r[n-i-3]))
print(max(m))

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

n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
    l=copy.copy(a)
    del l[i]
    gcd=functools.reduce(math.gcd, l)
    if ans<gcd:
        ans=gcd
print(ans)

Fixed submission:
import fractions
n=int(input())
a=list(map(int,input().split()))
l=[a[0]]
r=[a[-1]]
for i in range(n-1):
  l.append(fractions.gcd(l[i],a[i+1])) #l[i] は最初i個
for i in range(n-1):
  r.append(fractions.gcd(r[i],a[-2-i])) #r[i]は右i r[n-1]=全部 l[0]and r[n-3]
m=[l[n-2],r[n-2]]
for i in range(n-2):
  m.append(fractions.gcd(l[i],r[n-i-3]))
print(max(m))

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

n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
    l=copy.copy(a)
    del l[i]
    gcd=functools.reduce(math.gcd, l)
    if ans<gcd:
        ans=gcd
print(ans)


Fixed submission:
import fractions
n=int(input())
a=list(map(int,input().split()))
l=[a[0]]
r=[a[-1]]
for i in range(n-1):
  l.append(fractions.gcd(l[i],a[i+1])) #l[i] は最初i個
for i in range(n-1):
  r.append(fractions.gcd(r[i],a[-2-i])) #r[i]は右i r[n-1]=全部 l[0]and r[n-3]
m=[l[n-2],r[n-2]]
for i in range(n-2):
  m.append(fractions.gcd(l[i],r[n-i-3]))
print(max(m))

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

n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
  l=a
  del l[i]
  ans=max(ans,functools.reduce(math.gcd, l))
print(ans)


Fixed submission:
import fractions
n=int(input())
a=list(map(int,input().split()))
l=[a[0]]
r=[a[-1]]
for i in range(n-1):
  l.append(fractions.gcd(l[i],a[i+1])) #l[i] は最初i個
for i in range(n-1):
  r.append(fractions.gcd(r[i],a[-2-i])) #r[i]は右i r[n-1]=全部 l[0]and r[n-3]
m=[l[n-2],r[n-2]]
for i in range(n-2):
  m.append(fractions.gcd(l[i],r[n-i-3]))
print(max(m))

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
  l=a
  del l[i]
  ans=max(ans,gcd(l))
print(ans)

Fixed submission:
import fractions
n=int(input())
a=list(map(int,input().split()))
l=[a[0]]
r=[a[-1]]
for i in range(n-1):
  l.append(fractions.gcd(l[i],a[i+1])) #l[i] は最初i個
for i in range(n-1):
  r.append(fractions.gcd(r[i],a[-2-i])) #r[i]は右i r[n-1]=全部 l[0]and r[n-3]
m=[l[n-2],r[n-2]]
for i in range(n-2):
  m.append(fractions.gcd(l[i],r[n-i-3]))
print(max(m))