Buggy python submission (verdict: Runtime Error):
from functools import reduce
from math import gcd
a,b = map(int,input().split())
li = list(map(int,input().split()))
li = [abs(x-int(b)) for x in li]
print(reduce(gcd,li))

Fixed submission:
n, x = map(int,input().split())
li = list(input().split())
li = [abs(int(a)-x) for a in li]

def gcd(a,b):
    while a%b!=0:
        a,b = b,a%b
    return b
    
if n == 1:
    print(abs(li[0]))
    
elif n == 2:
    print(gcd(li[0],li[1]))
    
elif n >= 3:

    c = gcd(li[0],li[1])
    #print(c)
    for i in range(2,len(li)-1):
        c = gcd(c,li[i])
    print(c)

Buggy python submission (verdict: Runtime Error):
from functools import reduce
from math import gcd
a,b = map(int,input().split())
li = list(map(int,input().split()))
li = [abs(x-b) for x in li]
print(reduce(gcd,li))

Fixed submission:
n, x = map(int,input().split())
li = list(input().split())
li = [abs(int(a)-x) for a in li]

def gcd(a,b):
    while a%b!=0:
        a,b = b,a%b
    return b
    
if n == 1:
    print(abs(li[0]))
    
elif n == 2:
    print(gcd(li[0],li[1]))
    
elif n >= 3:

    c = gcd(li[0],li[1])
    #print(c)
    for i in range(2,len(li)-1):
        c = gcd(c,li[i])
    print(c)

Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
li = list(map(int,input().split()))
li = [abs(x-b) for x in li]
from functools import reduce
from math import gcd
print(reduce(gcd,li))

Fixed submission:
n, x = map(int,input().split())
li = list(input().split())
li = [abs(int(a)-x) for a in li]

def gcd(a,b):
    while a%b!=0:
        a,b = b,a%b
    return b
    
if n == 1:
    print(abs(li[0]))
    
elif n == 2:
    print(gcd(li[0],li[1]))
    
elif n >= 3:

    c = gcd(li[0],li[1])
    #print(c)
    for i in range(2,len(li)-1):
        c = gcd(c,li[i])
    print(c)

Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
li = list(map(int,input().split()))
li = [abs(x-b) for x in li]
#print(li)
import functools
import math
li2 = []
for i in range(len(li)-1):
    c = (math.gcd(li[i],li[i+1]))
    li2.append(c)
print(min(li2))

Fixed submission:
n, x = map(int,input().split())
li = list(input().split())
li = [abs(int(a)-x) for a in li]

def gcd(a,b):
    while a%b!=0:
        a,b = b,a%b
    return b
    
if n == 1:
    print(abs(li[0]))
    
elif n == 2:
    print(gcd(li[0],li[1]))
    
elif n >= 3:

    c = gcd(li[0],li[1])
    #print(c)
    for i in range(2,len(li)-1):
        c = gcd(c,li[i])
    print(c)

Buggy python submission (verdict: Runtime Error):
import math
N,X = map(int,input().split())
l = []
x = tuple(map(int,input().split()))

for i in range(N):
    l.append(abs(x[i]-X))
#print(l)
a = 10**9
for i in range(N-1):
    if a >= math.gcd(l[i],l[i+1]):
        a = math.gcd(l[i],l[i+1])
if N == 1:
    print(x[0]-X)
else:
    print(a)

Fixed submission:
n, x = map(int,input().split())
li = list(input().split())
li = [abs(int(a)-x) for a in li]

def gcd(a,b):
    while a%b!=0:
        a,b = b,a%b
    return b
    
if n == 1:
    print(abs(li[0]))
    
elif n == 2:
    print(gcd(li[0],li[1]))
    
elif n >= 3:

    c = gcd(li[0],li[1])
    #print(c)
    for i in range(2,len(li)-1):
        c = gcd(c,li[i])
    print(c)