Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=sorted(list(map(int,input().split())))
i=a[1]
while i > 0:
  flg=0
  for j in a:
    if j%i!=0:
      flg+=1
  if flg<=1:
    print(i)
    break
  else:
    i-=1

Fixed submission:
n=int(input())
a=sorted(list(map(int,input().split())))
i=a[1]
while i > 0:
  flg=0
  for j in a:
    if j%i!=0:
      flg+=1
      if flg>1:
        break
  if flg<=1:
    print(i)
    break
  else:
    i-=1

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter as c
m=int(input())
a=list(map(int,input().split()))

def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i:
        divisors.append(n//i)

  divisors.sort()
  return divisors

arr=[]
for i in a:
  arr+=make_divisors(i)

commonarr=c(arr).most_common()
ans=0
for i in commonarr:
  if i[1]>=m-1:
    ans=max(ans,i[0])
  else:
    break
print(ans)

Fixed submission:
n=int(input())
a=sorted(list(map(int,input().split())))
i=a[1]
while i > 0:
  flg=0
  for j in a:
    if j%i!=0:
      flg+=1
      if flg>1:
        break
  if flg<=1:
    print(i)
    break
  else:
    i-=1

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

for i in range(max(a),0,-1):
  flg=0
  for j in range(n):
    if a[j]%i !=0 and flg==0:
      flg=1
    elif a[j]%i !=0 and flg==1:
      flg=2
      break
  if flg<2:
    print(i)
    break

Fixed submission:
n=int(input())
a=sorted(list(map(int,input().split())))
i=a[1]
while i > 0:
  flg=0
  for j in a:
    if j%i!=0:
      flg+=1
      if flg>1:
        break
  if flg<=1:
    print(i)
    break
  else:
    i-=1

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

for i in range(max(a),0,-1):
  flg=0
  for j in range(n):
    if a[j]%i !=0 and flg==0:
      flg=1
    elif a[j]%i !=0 and flg==1:
      flg=2
      break
  if flg<2:
    print(i)
    break

Fixed submission:
n=int(input())
a=sorted(list(map(int,input().split())))
i=a[1]
while i > 0:
  flg=0
  for j in a:
    if j%i!=0:
      flg+=1
      if flg>1:
        break
  if flg<=1:
    print(i)
    break
  else:
    i-=1

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

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

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

ans=0
for i in range(n):
  ans=max(gcd_list(a[:i]+a[i+1:]),ans)
print(ans)

Fixed submission:
n=int(input())
a=sorted(list(map(int,input().split())))
i=a[1]
while i > 0:
  flg=0
  for j in a:
    if j%i!=0:
      flg+=1
      if flg>1:
        break
  if flg<=1:
    print(i)
    break
  else:
    i-=1

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
import itertools
from functools import reduce
n = int(input())
a = list(map(int,input().split()))

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

c = list(itertools.combinations(a,n-1))
ans = 1
for i in c:
  ans = max(ans,gcd_list(i))
print(ans)

Fixed submission:
n=int(input())
a=sorted(list(map(int,input().split())))
i=a[1]
while i > 0:
  flg=0
  for j in a:
    if j%i!=0:
      flg+=1
      if flg>1:
        break
  if flg<=1:
    print(i)
    break
  else:
    i-=1

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

for i in range(max(a),0,-1):
  cnt = 0
  for j in a:
    if j % i != 0:
      cnt+=1
  if cnt < 2:
    print(i)
    break

Fixed submission:
n=int(input())
a=sorted(list(map(int,input().split())))
i=a[1]
while i > 0:
  flg=0
  for j in a:
    if j%i!=0:
      flg+=1
      if flg>1:
        break
  if flg<=1:
    print(i)
    break
  else:
    i-=1

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

for i in range(max(a),0,-1):
  cnt = 0
  for j in a:
    if j % i != 0:
      cnt+=1
  if cnt < 2:
    print(i)
    break

Fixed submission:
n=int(input())
a=sorted(list(map(int,input().split())))
i=a[1]
while i > 0:
  flg=0
  for j in a:
    if j%i!=0:
      flg+=1
      if flg>1:
        break
  if flg<=1:
    print(i)
    break
  else:
    i-=1

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
import itertools
from functools import reduce
n = int(input())
a = list(map(int,input().split()))

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

c = list(itertools.combinations(a,n-1))
ans = 1
for i in c:
  ans = max(ans,gcd_list(i))
print(ans)

Fixed submission:
n=int(input())
a=sorted(list(map(int,input().split())))
i=a[1]
while i > 0:
  flg=0
  for j in a:
    if j%i!=0:
      flg+=1
      if flg>1:
        break
  if flg<=1:
    print(i)
    break
  else:
    i-=1