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

N,X=map(int,input().split())
x_list=list(map(int,input().split()))
x_list.append(X)
x_list.sort()
y_list=[]
for i in range(N):
    y_list.append(x_list[i+1]-x_list[i])
z_list=list(set(y_list))
gcd = functools.reduce(math.gcd, z_list)
print(gcd)


Fixed submission:
def gcd(m,n):
    x=max(m,n)
    y=min(m,n)
    if x%y==0:
        return y
    else:
        while x%y!=0:
            z=x%y
            x=y
            y=z
        else:
            return z


N,X=map(int,input().split())
x_list=list(map(int,input().split()))
x_list.append(X)
x_list.sort()
y_list=[]
for i in range(N):
    y_list.append(x_list[i+1]-x_list[i])
z_list=list(set(y_list))
if len(z_list)==1:
    print(z_list[0])

else:
    for i in range(len(z_list)-1):
        z_list[i+1]=gcd(z_list[i],z_list[i+1])
    print(z_list[-1])

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

N,X=map(int,input().split())
x_list=list(map(int,input().split()))
x_list.append(X)
x_list.sort()
y_list=[]
for i in range(N):
    y_list.append(x_list[i+1]-x_list[i])


gcd = functools.reduce(math.gcd, y_list)
print(gcd)


Fixed submission:
def gcd(m,n):
    x=max(m,n)
    y=min(m,n)
    if x%y==0:
        return y
    else:
        while x%y!=0:
            z=x%y
            x=y
            y=z
        else:
            return z


N,X=map(int,input().split())
x_list=list(map(int,input().split()))
x_list.append(X)
x_list.sort()
y_list=[]
for i in range(N):
    y_list.append(x_list[i+1]-x_list[i])
z_list=list(set(y_list))
if len(z_list)==1:
    print(z_list[0])

else:
    for i in range(len(z_list)-1):
        z_list[i+1]=gcd(z_list[i],z_list[i+1])
    print(z_list[-1])

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

N,X=map(int,input().split())
x_list=list(map(int,input().split()))
x_list.append(X)
x_list.sort()
y_list=[]
for i in range(N):
    y_list.append(x_list[i+1]-x_list[i])
z_list=list(set(y_list))
if len(z_list)==1:
    print(z_list[0])
else:
    gcd = functools.reduce(math.gcd, z_list)
    print(gcd)


Fixed submission:
def gcd(m,n):
    x=max(m,n)
    y=min(m,n)
    if x%y==0:
        return y
    else:
        while x%y!=0:
            z=x%y
            x=y
            y=z
        else:
            return z


N,X=map(int,input().split())
x_list=list(map(int,input().split()))
x_list.append(X)
x_list.sort()
y_list=[]
for i in range(N):
    y_list.append(x_list[i+1]-x_list[i])
z_list=list(set(y_list))
if len(z_list)==1:
    print(z_list[0])

else:
    for i in range(len(z_list)-1):
        z_list[i+1]=gcd(z_list[i],z_list[i+1])
    print(z_list[-1])

Buggy python submission (verdict: Runtime Error):

import math
N,X=map(int,input().split())
x_list=list(map(int,input().split()))
x_list.append(X)
x_list.sort()
y_list=[]
for i in range(N):
    y_list.append(x_list[i+1]-x_list[i])
z_list=list(set(y_list))


if len(z_list)==1:
    print(z_list[0])
else:
    out=math.gcd(z_list[0], z_list[1])
    if len(z_list)>=3:
        for i in range(len(z_list)-3):
            out=math.gcd(out, z_list[i+2])
    print(out)


Fixed submission:
def gcd(m,n):
    x=max(m,n)
    y=min(m,n)
    if x%y==0:
        return y
    else:
        while x%y!=0:
            z=x%y
            x=y
            y=z
        else:
            return z


N,X=map(int,input().split())
x_list=list(map(int,input().split()))
x_list.append(X)
x_list.sort()
y_list=[]
for i in range(N):
    y_list.append(x_list[i+1]-x_list[i])
z_list=list(set(y_list))
if len(z_list)==1:
    print(z_list[0])

else:
    for i in range(len(z_list)-1):
        z_list[i+1]=gcd(z_list[i],z_list[i+1])
    print(z_list[-1])