Buggy python submission (verdict: Runtime Error):
import math
def solve(N, X, cities):
    dists = [abs(city - X) for city in cities]
    gcd = min(dists)
    for d in dists:
        if d % gcd == 0:
            continue
        else:
            gcd = math.gcd(gcd, d % gcd)
    return gcd

  
if __name__ == "__main__":
    l = input()
    N, X = int(l.split()[0]),int(l.split()[1])
    cities = [int(c) for c in input().split()]
    print(solve(N, X, cities))



Fixed submission:

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

def solve(N, X, cities):
    dists = [abs(city - X) for city in cities]
    ans = min(dists)
    for d in dists:
        if d % ans == 0:
            continue
        else:
            ans = gcd(ans, d % ans)
    return ans

if __name__ == "__main__":
    l = input()
    N, X = int(l.split()[0]),int(l.split()[1])
    cities = [int(c) for c in input().split()]
    print(solve(N, X, cities))

Buggy python submission (verdict: Runtime Error):
import math
def solve(N, X, cities):
    dists = [abs(city - X) for city in cities]
    gcd = min(dists)
    for d in dists:
        if d % gcd == 0:
            continue
        else:
            gcd = math.gcd(gcd, d)
    return gcd

if __name__ == "__main__":
    l = input()
    N, X = int(l.split()[0]),int(l.split()[1])
    cities = [int(c) for c in input().split()]
    print(solve(N, X, cities))


Fixed submission:

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

def solve(N, X, cities):
    dists = [abs(city - X) for city in cities]
    ans = min(dists)
    for d in dists:
        if d % ans == 0:
            continue
        else:
            ans = gcd(ans, d % ans)
    return ans

if __name__ == "__main__":
    l = input()
    N, X = int(l.split()[0]),int(l.split()[1])
    cities = [int(c) for c in input().split()]
    print(solve(N, X, cities))

Buggy python submission (verdict: Runtime Error):
import math
def solve(N, X, cities):
    dists = [abs(city - X) for city in cities]
    min_d = min(dists)
    return max([math.gcd(min_d, d) for d in dists])

if __name__ == "__main__":
    l = input()
    N, X = int(l.split()[0]),int(l.split()[1])
    cities = [int(c) for c in input().split()]
    print(solve(N, X, cities))


Fixed submission:

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

def solve(N, X, cities):
    dists = [abs(city - X) for city in cities]
    ans = min(dists)
    for d in dists:
        if d % ans == 0:
            continue
        else:
            ans = gcd(ans, d % ans)
    return ans

if __name__ == "__main__":
    l = input()
    N, X = int(l.split()[0]),int(l.split()[1])
    cities = [int(c) for c in input().split()]
    print(solve(N, X, cities))

Buggy python submission (verdict: Runtime Error):
import math
def solve(N, X, cities):
    dists = [city - X for city in cities]
    gcd = dists[0]
    for d in dists[1:]:
        gcd = math.gcd(gcd, d)
    return gcd

if __name__ == "__main__":
    l = input()
    N, X = int(l.split()[0]),int(l.split()[1])
    cities = [int(c) for c in input().split()]
    print(solve(N, X, cities))


Fixed submission:

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

def solve(N, X, cities):
    dists = [abs(city - X) for city in cities]
    ans = min(dists)
    for d in dists:
        if d % ans == 0:
            continue
        else:
            ans = gcd(ans, d % ans)
    return ans

if __name__ == "__main__":
    l = input()
    N, X = int(l.split()[0]),int(l.split()[1])
    cities = [int(c) for c in input().split()]
    print(solve(N, X, cities))