Buggy python submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
//#define MOD 1000000007
#define MOD 998244353
#define INF 100000000000000009
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define ZREP(i,n) for(int i=1;i<(n);++i)
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define out(s,t,u) s?cout << t << endl:cout << u << endl
#define int ll
#define Endl endl

int gcd(int a,int b){
    if(a<=0||b<=0){
        return 0;
    }
    if(a<b)swap(a,b);
    int r=a%b;
    while(r){
        a=b;
        b=r;
        r=a%b;
    }
    return b;
}


signed main(){
    int N;
    int A[114514];
    cin >> N;
    REP(i,N){cin >> A[i];}
    if(N==2){
        cout << max(A[0],A[1]) << endl;
        return 0;
    }
    sort(A,A+N);
    int B[114514];
    B[0]=A[0];
    REP(i,N-1){
        B[i+1]=A[i+1]-A[i];
    }
    sort(B,B+N);
    /*REP(i,N){
        cout << B[i] << " ";
    }*/
    int s=0;
    REP(i,N){
        if(B[i]!=0){
            s=i;
            break;
        }
    }
    B[s]+=B[s+1];
    B[s+1]=B[s];
    int Ans=B[N-1];
    REP(i,N){
        if(B[i]!=0){
            Ans=gcd(Ans,B[i]);
        }
    }
    cout << Ans << endl;
    return 0;
}


Fixed submission:
def gcd(a , b):
    r = a%b
    while r:
        a=b
        b=r
        r=a%b
    return b

N=int(input())
A=list(map(int,input().split()))
L=[0]*100000
R=[0]*100000
L[0]=A[0]
for i in range(N-1):
    L[i+1]=gcd(L[i],A[i+1])
R[N-1]=A[N-1]
for i in reversed(range(N-1)):
    R[i]=gcd(R[i+1],A[i])
Ans=max(L[N-2],R[1])
for i in range(1,N-1):
    Ans=max(Ans,gcd(L[i-1],R[i+1]))
print(Ans)

Buggy python submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
//#define MOD 1000000007
#define MOD 998244353
#define INF 100000000000000009
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define ZREP(i,n) for(int i=1;i<(n);++i)
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define out(s,t,u) s?cout << t << endl:cout << u << endl
#define int ll
#define Endl endl

int gcd(int a,int b){
    if(a<=0||b<=0){
        return 0;
    }
    if(a<b)swap(a,b);
    int r=a%b;
    while(r){
        a=b;
        b=r;
        r=a%b;
    }
    return b;
}


signed main(){
    int N;
    int A[114514];
    cin >> N;
    REP(i,N){cin >> A[i];}
    if(N==2){
        cout << max(A[0],A[1]) << endl;
        return 0;
    }
    sort(A,A+N);
    int B[114514];
    B[0]=A[0];
    REP(i,N-1){
        B[i+1]=A[i+1]-A[i];
    }
    sort(B,B+N);
    B[0]+=B[1];
    B[1]=B[0];
    int Ans=B[0];
    REP(i,N){
        Ans=gcd(Ans,B[i]);
    }
    cout << Ans << endl;
    return 0;
}


Fixed submission:
def gcd(a , b):
    r = a%b
    while r:
        a=b
        b=r
        r=a%b
    return b

N=int(input())
A=list(map(int,input().split()))
L=[0]*100000
R=[0]*100000
L[0]=A[0]
for i in range(N-1):
    L[i+1]=gcd(L[i],A[i+1])
R[N-1]=A[N-1]
for i in reversed(range(N-1)):
    R[i]=gcd(R[i+1],A[i])
Ans=max(L[N-2],R[1])
for i in range(1,N-1):
    Ans=max(Ans,gcd(L[i-1],R[i+1]))
print(Ans)

Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
A.sort()
B=[]
B.append(A[0])
for i in range(N-1):
    B.append(A[i+1]-A[i])

B.sort()
B[1]+=B[0]
B[0]=B[1]
Ans=B[0]

for i in range(N):
    a=max(Ans,B[i])
    b=min(Ans,B[i])
    r=a%b
    while r>0:
        a=b
        b=r
        r=a%b
    Ans=b
print(Ans)

Fixed submission:
def gcd(a , b):
    r = a%b
    while r:
        a=b
        b=r
        r=a%b
    return b

N=int(input())
A=list(map(int,input().split()))
L=[0]*100000
R=[0]*100000
L[0]=A[0]
for i in range(N-1):
    L[i+1]=gcd(L[i],A[i+1])
R[N-1]=A[N-1]
for i in reversed(range(N-1)):
    R[i]=gcd(R[i+1],A[i])
Ans=max(L[N-2],R[1])
for i in range(1,N-1):
    Ans=max(Ans,gcd(L[i-1],R[i+1]))
print(Ans)