ZhenlongDai/ACPR huggingface dataset:
Problem: p03281
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())

count=0
ans=0
if n<=104:
    print('0')
else:
    for i in range(105,n+1):
        count=0
        for e in range(1,n+1):
            if i%2==0:
                continue
            elif i%e==0:
                count+=1
        if count==8:
            ans+=1
print(ans)

Failing test case input:
-153

Expected output:
0


Actual output:
0
0


Fixed submission (verdict: Accepted):
n=int(input())

count=0
ans=0
if n<=104:
    ans=0
else:
    for i in range(105,n+1):
        count=0
        for e in range(1,n+1):
            if i%2==0:
                break
            elif i%e==0:
                count+=1
        if count==8:
            ans+=1
print(ans)

Problem: p03281
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
ans=0
n=int(input())
if n<105:
  print('0')
else:
  for i in range(105,n+1):
    cnt=0
    for j in range(1,i+1):
      if i%j==0:
        cnt+=1
    if cnt==8:
      ans+=1

print(ans)

Failing test case input:
-153

Expected output:
0


Actual output:
0
0


Fixed submission (verdict: Accepted):
ans=0
n=int(input())
if n<105:
  print('0')
  exit()
else:
  for i in range(105,n+1):
    if i%2!=0:
      cnt=0
      for j in range(1,i+1):
        if i%j==0:
          cnt+=1
      if cnt==8:
         ans+=1

print(ans)

Problem: p03281
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
b=[3*5*7, 3*5*9, 3*5*11, 27*7, 3*5*13]
print(b)
a=0
for i in range(len(b)):
    if b[i]<=n:
        a+=1
print(a)


Failing test case input:
-153

Expected output:
0


Actual output:
[105, 135, 165, 189, 195]
0


Fixed submission (verdict: Accepted):
n=int(input())
b=[3*5*7, 3*5*9, 3*5*11, 27*7, 3*5*13]
a=0
for i in range(len(b)):
    if b[i]<=n:
        a+=1
print(a)

Problem: p03281
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
cnt_all = 0

if N >=106 and N%2 ==1:
    for i in range(1,N+1):
        cnt =0
        for j in range(1,i+1):
            if i%j ==0:
                cnt +=1
        if cnt ==8:
            cnt_all+=1
    print(1+cnt_all)

else:
    print(1)

Failing test case input:
-153

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
N = int(input())
cnt_all = 0

if N >=106:
    for i in range(1,N+1):
        cnt =0
        for j in range(1,i+1):
            if i%j ==0:
                cnt +=1
        if cnt ==8 and i%2 ==1:
            cnt_all+=1
    print(cnt_all)

elif N==105:
    print(1)
else:
    print(0)

Problem: p03281
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
a=int(input())
if a<=104:
    ans=0
elif a<165:
    ans=1
elif a<195:
    ans=2
else:
    ans=3

Failing test case input:
-153

Expected output:
0


Actual output:

Fixed submission (verdict: Accepted):
a=int(input())
if a<=104:
    ans=0
elif a<135:
    ans=1
elif a<165:
    ans=2
elif a<189:
    ans=3
elif a<195:
    ans=4
else:
    ans=5
print(ans)
Problem: p03281
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())

for i in range(1, n+1, 2):
    count = 0
    for j in range(1, n+1):
        if (i % j) == 0:
            count += 1
    if count == 8:
        print(i)


Failing test case input:
-153

Expected output:
0


Actual output:

Fixed submission (verdict: Accepted):
n = int(input())

div8 = []
for i in range(1, n+1, 2):
    count = 0
    for j in range(1, n+1):
        if (i % j) == 0:
            count += 1
    if count == 8:
        div8.append(i)

print(len(div8))

Problem: p03281
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())

if N <= 104 and N >= 1:
  print(0)
elif N >= 105:
  print(1)
elif N >= 135:
  print(2)
elif N >= 145:
  print(3)
elif N >= 165:
  print(4)
elif N >= 189:
  print(5)
elif N >= 195:
  print(6)

Failing test case input:
-153

Expected output:
0


Actual output:

Fixed submission (verdict: Accepted):
N = int(input())

if N >= 195:
    print(5)
elif N >= 189:
    print(4)
elif N >= 165:
    print(3)
elif N >= 135:
    print(2)
elif N >= 105:
    print(1)
else:
    print(0)
Problem: p03281
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = 200
cnt = [0 for _ in range(n+1)]
for i in range(1, n+1):
  for j in range(i, n+1, i):
    cnt[j] += 1
print(len([i for i in range(1,n+1, 2) if cnt[i]==8]))

Failing test case input:
-153

Expected output:
0


Actual output:
5


Fixed submission (verdict: Accepted):
n = int(input())
cnt = [0 for _ in range(n+1)]
for i in range(1, n+1):
  for j in range(i, n+1, i):
    cnt[j] += 1
print(len([i for i in range(1,n+1, 2) if cnt[i]==8]))

Problem: p03281
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
d = {i: 0 for i in range(n+1)}
for i in range(1, n+1):
    for j in range(1, n+1):
        if j%i == 0:
            d[j] +=1
for k, v in d.items():
    if k%2 == 1 and v == 8:
        print(k)

Failing test case input:
-153

Expected output:
0


Actual output:

Fixed submission (verdict: Accepted):
n = int(input())
d = {i: 0 for i in range(n+1)}
for i in range(1, n+1):
    for j in range(1, n+1):
        if j%i == 0:
            d[j] +=1
a = 0
for k, v in d.items():
    if k%2 == 1 and v == 8:
        a +=1
print(a)

Problem: p03281
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
ans = 0
if N < 105:
    print(0)



odd_list = [i for i in range(1, N+1) if i % 2 ==  1]


odd_list2 = [i for i in range(105, N+1) if i % 2 ==  1]

for j in odd_list2:
    c = 0
    for i in odd_list:
        if j % i == 0:
            c += 1
            if c == 8:
                ans += 1
                break

        
print(ans)

Failing test case input:
-153

Expected output:
0


Actual output:
0
0


Fixed submission (verdict: Accepted):
N = int(input())

def aaa(N):
    ans = 0
    if N < 105:
        print(ans)
        return

    odd_list = [i for i in range(1, N+1) if i % 2 ==  1]
    odd_list2 = [i for i in range(105, N+1) if i % 2 ==  1]

    for j in odd_list2:
        c = 0
        for i in odd_list:
            if j % i == 0:
                c += 1
                if c == 8:
                    ans += 1
                    break
    print(ans)
aaa(N)

Problem: p03281
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A=int(input())

answer=0
if A<=104:
  print(0)
else:
  for i in range(105,A+1,2):
    count=0
    for j in range(1,i+1):
      if i%j==0:
        count+=1
    if count==8:
      answer+=1
print(answer)

Failing test case input:
-153

Expected output:
0


Actual output:
0
0


Fixed submission (verdict: Accepted):
A=int(input())

answer=0
if A<=104:
  print(0)
  exit()
else:
  for i in range(105,A+1,2):
    count=0
    for j in range(1,i+1):
      if i%j==0:
        count+=1
    if count==8:
      answer+=1
print(answer)
Problem: p03281
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = int(input())

b=1

for i in range(1,a+1):
  
  yakusuu = 0
  for j in range(1,i+1):
    if i+1 % j == 0:
        yakusuu += 1
  if yakusuu == 8:
  	b += 1
print(b)

Failing test case input:
-153

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
a = int(input())
 
b=0
 
for num in range(1,a+1):
  if num % 2 == 1:
  
    yakusuu = 0
    for i in range(1,num):
      if num % i == 0:
        yakusuu += 1
    if yakusuu == 7:
      b += 1
print(b)

Problem: p03281
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
cnt = 0
for i in range(1, N + 1):
    k = 0
    for j in range(1, N + 1):
        if i % j == 0:
            k += 1
    if k == 8:
        cnt += 1

Failing test case input:
-153

Expected output:
0


Actual output:

Fixed submission (verdict: Accepted):
N = int(input())
cnt = 0
for i in range(1, N + 1, 2):
    k = 0
    for j in range(1, i + 1):
        if i % j == 0:
            k += 1
    if k == 8:
        cnt += 1
print(cnt)
Problem: p00388
Buggy submission (Python3, verdict: Wrong Answer):
H,a,b=map(int,input().split())
c=0
for i in range(a,b):
  if H%i==0 :
    c+=1
print(c)


Failing test case input:
010 2 10

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
H,a,b=map(int,input().split())
c=0
for i in range(a,b+1):
  if H%i==0 :
    c+=1
print(c)

Problem: p00388
Buggy submission (Python3, verdict: Wrong Answer):
H,a,b=map(int,input().split())
c=0
for i in range(a,b):
  if H%a==0 :
    c+=1
  elif H%b==0:
    c+=1
  else:
    pass
print(c)


Failing test case input:
000 18 65

Expected output:
48


Actual output:
47


Fixed submission (verdict: Accepted):
H,a,b=map(int,input().split())
c=0
for i in range(a,b+1):
  if H%i==0 :
    c+=1
print(c)
Problem: p03127
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from math import gcd
n = int(input())
a = list(map(int,input().split()))

g = a[0]
for i in a:
    g = gcd(g,i)

print(i)


Failing test case input:
3
1101001100 0100100010 1000101000

Expected output:
10


Actual output:
1000101000


Fixed submission (verdict: Accepted):
from math import gcd
n = int(input())
a = list(map(int,input().split()))

g = a[0]
for i in a:
    g = gcd(g,i)

print(g)

Problem: p03127
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections

def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)
n = int(input())
a = sorted(list(map(int,input().split())))
d = a[0]
for i in range(n-1):
    d = gcd(d,a[i])
print(d)

Failing test case input:
4
0 0 0 0000100011

Expected output:
100011


Actual output:
0


Fixed submission (verdict: Accepted):
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections

def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)
n = int(input())
a = sorted(list(map(int,input().split())))
d = a[0]
for i in range(n):
    d = gcd(d,a[i])
print(d)

Problem: p03127
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = [int(i) for i in input().split()]

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)


ans = 10 ** 9
for ai in a:
    ans = gcd(ans, ai)

print(ans)

Failing test case input:
3
1110101010 1111111101 1010011011

Expected output:
3


Actual output:
1


Fixed submission (verdict: Accepted):
n = int(input())
a = [int(i) for i in input().split()]

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)


ans = 0
for ai in a:
    ans = gcd(ans, ai)

print(ans)

Problem: p03127
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math
from functools import reduce
print(reduce(math.gcd,map(int,input().split())))

Failing test case input:
4
1 1 2 6

Expected output:
1


Actual output:
4


Fixed submission (verdict: Accepted):
import math
from functools import reduce
_=input()
print(reduce(math.gcd,map(int,input().split())))

Problem: p03127
Buggy submission (Python (3.8.2), verdict: Wrong Answer):


N = int(input())
A = [int(x) for x in input().split()]

A.sort()
ans = 10**6
for i in range(N-1):
    if ans > A[i+1] - A[i]:
        ans = A[i+1] - A[i]
print(ans)

Failing test case input:
3
1001001100 0101101010 1000101000

Expected output:
10


Actual output:
900100


Fixed submission (verdict: Accepted):


N = int(input())
A = [int(x) for x in input().split()]

from math import gcd

A.sort()
g = A[0]
for i in range(1,N):
    g = gcd(g,A[i]) 
    
print(g)
Problem: p03127
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = list(map(int, input().split()))


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

ans = A[0]

for i in range(N - 1):
    ans = gcd(ans, A[i])
print(ans)

Failing test case input:
4
0 0 0 0101011000

Expected output:
101011000


Actual output:
0


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int, input().split()))


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

ans = A[0]

for i in range(N - 1):
    ans = gcd(ans, A[i + 1])
print(ans)

Problem: p03127
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
input = sys.stdin.readline
def gdc(p, q):
    if q == 0:
        return p
    return gdc(q, p%q)

def main():
    N = int(input())
    A = list(map(int, input().split()))
    if N == 1:
        print(A[0])
        return
    A_sorted = sorted(A)
    print(gdc(A[1], A[0]))


if __name__ == '__main__':
    main()

Failing test case input:
4
0 2 1 16

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
import sys
input = sys.stdin.readline
def gdc(p, q):
    if q == 0:
        return p
    return gdc(q, p%q)

def main():
    N = int(input())
    A = list(map(int, input().split()))
    if N == 1:
        print(A[0])
        return
    res = A[0]
    for i in range(1,N):
        res = gdc(res, A[i])
    print(res)

if __name__ == '__main__':
    main()

Problem: p03127
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
input()
A = list(map(int, input().split(" ")))
A.sort()
def gcd(a, b):
    while b:
        a, b = b, a%b
    return a
rtn = 0
for i in range(0,len(A)-1):
    print(A[i], A[i+1], gcd(A[i], A[i+1]))
    A[i+1] = gcd(A[i], A[i+1])
print(A[-1])

Failing test case input:
3
1101001100 0101101010 1000101000

Expected output:
10


Actual output:
101101010 1000101000 10
10 1101001100 10
10


Fixed submission (verdict: Accepted):
input()
A = list(map(int, input().split(" ")))
A.sort()
def gcd(a, b):
    while b:
        a, b = b, a%b
    return a
rtn = 0
for i in range(0,len(A)-1):
    A[i+1] = gcd(A[i], A[i+1])
print(A[-1])

Problem: p03127
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)
N = int(input())
A = list(map(int, input().split()))
g = gcd(A[0], A[1])
for a in A:
    if g == 1:
        break
    g == gcd(g, a)
print(g)

Failing test case input:
3
1100000100 0100100010 1000100000

Expected output:
10


Actual output:
30


Fixed submission (verdict: Accepted):

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)
N = int(input())
A = list(map(int, input().split()))
g = gcd(A[0], A[1])
for a in A:
    if g == 1:
        break
    g = gcd(g, a)
print(g)
Problem: p03127
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def read():
    return int(input())

def reads():
    return list(map(int, input().split()))

n = read()
a = reads()
cnt = 0
m = min(a)
if m*n == sum(a):
    print(m)
    exit()

for i in range(n):
    if not  a[i] % 2 == 0:
        cnt = 1
if cnt == 1:
    print(1)
else:
    print(2)

Failing test case input:
4
0 0 0 0111111011

Expected output:
111111011


Actual output:
1


Fixed submission (verdict: Accepted):
def read():
    return int(input())

def reads():
    return list(map(int, input().split()))

def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)

n = read()
a = reads()
ans = a[0]
for i in range(n):
    ans = gcd(ans,a[i])
print(ans)

Problem: p03127
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = [int(i) for i in input().split()]

def gcd(a,b):
    if ( b==0 ):
        return a
    else:
        return (gcd(b, a%b))


ans = 10 ** 9
for ai in a:
    ans = gcd(ans, ai)

print(ans)

Failing test case input:
4
0 0 0 0101011000

Expected output:
101011000


Actual output:
1000


Fixed submission (verdict: Accepted):
n = int(input())
a = [int(i) for i in input().split()]

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)


ans = 0
for ai in a:
    ans = gcd(ans, ai)

print(ans)

Problem: p03127
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math

def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()

n = readInt()
a = list(set(readInts()))

if len(a)==1:
  print(a[0])
  exit()

odd = []
even = []

for i in a:
  if i%2==0:
    even.append(i)
  else:
    odd.append(i)

from math import gcd

if len(odd)>0:
  print(1)
  exit()
elif len(even)>0:
  d = even[0]
  for i in range(len(even)):
    d = gcd(even[i],d)
  print(d)

Failing test case input:
4
0 0 0 0111111011

Expected output:
111111011


Actual output:
1


Fixed submission (verdict: Accepted):
from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math

def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()

n = readInt()
a = list(set(readInts()))

if len(a)==1:
  print(a[0])
  exit()

odd = []
even = []


from math import gcd


d = a[0]
for i in a:
  d = gcd(i,d)
print(d)
Problem: p03262
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def p(a,b):
    x = max(a,b)
    y = min(a,b)
    while(y!=0):
        x = y
        y = x%y
    return x

N,X = map(int,input().split())
Y = [abs(X-int(i)) for i in input().split()]
ans = Y[0]
for i in range(N-1):
    ans = p(ans,Y[i+1])
print(ans)

Failing test case input:
3 81
33 70 57

Expected output:
1


Actual output:
11


Fixed submission (verdict: Accepted):
def p(a,b):
    x = max(a,b)
    y = min(a,b)
    while(y!=0):
        x,y = y,x%y
    return x

N,X = map(int,input().split())
Y = [abs(X-int(i)) for i in input().split()]
ans = Y[0]
for i in range(N-1):
    ans = p(ans,Y[i+1])
print(ans)

Problem: p03262
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
def gcd(x,y):
    x,y=max(abs(x),abs(y)),min(abs(x),abs(y))
    if x%y==0:
        return y
    while x%y==0:
        x,y=y,x%y
    return y

n,x=map(int,input().split())

t=[int(j)-x for j in input().split()]
ans=t.pop()
for i in t:
    ans=gcd(ans,i)

print(ans)

Failing test case input:
3 81
33 3 57

Expected output:
6


Actual output:
24


Fixed submission (verdict: Accepted):
def gcd(x,y):
    x,y=max(abs(x),abs(y)),min(abs(x),abs(y))
    if y==0:
        return x
    if x%y==0:
        return y
    while x%y!=0:
        x,y=y,x%y
    return y

n,x=map(int,input().split())

t=[int(j)-x for j in input().split()]
ans=abs(t.pop())
for i in t:
    ans=gcd(ans,i)

print(ans)

Problem: p03262
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, X = map(int, input().split())
x_list = list(map(int, input().split()))



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


def lcm(a, b):
        return a * b 


ans = 0
for i, x in enumerate(x_list):

    diff = abs(x - X)

    print(i, x, diff, ans)

    if i == 0:
        ans = diff
    else:
        larger = min(ans, diff)
        smaller = max(ans, diff)

        if smaller % larger == 0:
            ans = larger
        else:
            ans = gcd(ans, diff)

print(ans)


Failing test case input:
1 1
1110000100

Expected output:
1110000099


Actual output:
0 1110000100 1110000099 0
1110000099


Fixed submission (verdict: Accepted):
N, X = map(int, input().split())
x_list = list(map(int, input().split()))



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


def lcm(a, b):
        return a * b 


ans = 0
for i, x in enumerate(x_list):

    diff = abs(x - X)

    

    if i == 0:
        ans = diff
    else:
        larger = min(ans, diff)
        smaller = max(ans, diff)

        if smaller % larger == 0:
            ans = larger
        else:
            ans = gcd(ans, diff)

print(ans)
Problem: p03262
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, X = map(int, input().split())
x = list(map(int, input().split()))
d = []
min=abs(x[0]-X)
for i in range(N):
    d.append(abs(x[i] - X))
    if d[i] < min:
        min = d[i]
ans=sum(list(map(lambda x: x % min, d)))
if  ans== 0:
    print(min)
else:
    print(1)

Failing test case input:
3 106
15 8 36

Expected output:
7


Actual output:
1


Fixed submission (verdict: Accepted):
N, X = map(int, input().split())
x = list(map(int, input().split()))
d = []
min=abs(x[0]-X)
for i in range(N):
    d.append(abs(x[i] - X))

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

if len(d) == 1:
    print(d[0])
else:    
    g = gcd(d[0], d[1])
    for i in range(2,N):
        g=gcd(g,d[i])
    print(g)

Problem: p03262
Buggy submission (Python (3.4.3), verdict: Wrong Answer):



def main():
    n, x = map(int, input().split())
    xi = map(int, input().split())

    diffs = []
    for i in xi:
        diffs.append(abs(x - i))

    for diff in diffs:
        if diff % min(diffs) != 0:
            print('1')
            return

    print(min(diffs))


if __name__ == '__main__':
    main()


Failing test case input:
3 81
33 3 57

Expected output:
6


Actual output:
1


Fixed submission (verdict: Accepted):


from functools import reduce


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


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


def main():
    n, x = map(int, input().split())
    xi = map(int, input().split())

    diffs = []
    for i in xi:
        diffs.append(abs(x - i))

    print(gcd_list(diffs))


if __name__ == '__main__':
    main()

Problem: p03262
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, X = map(int, input().split())
x = list(map(int, input().split()))
x.append(X)
x = sorted(x)
y = [x[i+1]-x[i] for i in range(n)]

def eu(a, b):
    a, b = sorted([a,b])
    while a != 0:
        b, a = a, b%a
    return b
d = y[0]
for i in range(1, n-1):
    d = eu(d, y[i])
print(d)

Failing test case input:
3 81
17 42 57

Expected output:
1


Actual output:
5


Fixed submission (verdict: Accepted):
n, X = map(int, input().split())
x = list(map(int, input().split()))
x.append(X)
x = sorted(x)
y = [x[i+1]-x[i] for i in range(n)]

def eu(a, b):
    a, b = sorted([a,b])
    while a != 0:
        b, a = a, b%a
    return b
d = y[0]
for i in range(1, n):
    d = eu(d, y[i])
print(d)
Problem: p03262
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
def gcd(x,y):
    x,y=max(abs(x),abs(y)),min(abs(x),abs(y))
    if x%y==0:
        return y
    while x%y==0:
        x,y=y,x%y
    return y

n,x=map(int,input().split())

t=[int(j)-x for j in input().split()]
ans=t.pop()-x
for i in t:
    ans=gcd(ans,i)

print(ans)

Failing test case input:
1 -2
1010001101

Expected output:
1010001103


Actual output:
1010001105


Fixed submission (verdict: Accepted):
def gcd(x,y):
    x,y=max(abs(x),abs(y)),min(abs(x),abs(y))
    if y==0:
        return x
    if x%y==0:
        return y
    while x%y!=0:
        x,y=y,x%y
    return y

n,x=map(int,input().split())

t=[int(j)-x for j in input().split()]
ans=abs(t.pop())
for i in t:
    ans=gcd(ans,i)

print(ans)

Problem: p03262
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math
N, A = map(int, input().split())
X = list(map(int, input().split()))
L = ([x-A for x in X])
S = L[0]
for i in range(1, N):
  S = math.gcd(S,L[i])
print(S)

Failing test case input:
1 3
1 5 11

Expected output:
2


Actual output:
-2


Fixed submission (verdict: Accepted):
import math
N, A = map(int, input().split())
X = list(map(int, input().split()))
L = ([abs(x-A) for x in X])
S = L[0]
for i in range(1, N):
  S = math.gcd(S,L[i])
print(S)

Problem: p03262
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

N, X = list(map(int, input().split()))

x = list(map(int, input().split()))
x.sort()

if len(x) == 1:
    print(int(*x)-X)
else:
    res = [x[i+1]-x[i] for i in range(len(x)-1)]
    print(gcd(*res))

Failing test case input:
3 81
17 42 57

Expected output:
1


Actual output:
5


Fixed submission (verdict: Accepted):
import math
from functools import reduce
 
def gcd(*numbers):
    return reduce(math.gcd, numbers)

N, X = list(map(int, input().split()))
 
x = list(map(int, input().split()))
x.append(X)
x.sort()
 
res = [abs(x[i+1]-x[i]) for i in range(len(x)-1)]
print(gcd(*res))

Problem: p03262
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
N, X = map(int, sys.stdin.buffer.readline().split())
x = list(map(int, sys.stdin.buffer.readline().split()))
x.append(X)
x.sort()
ans = 10**10
for i in range(N):
    tmp = x[i+1] - x[i]
    if tmp < ans:
        ans = tmp
print(ans)

Failing test case input:
3 81
33 42 57

Expected output:
3


Actual output:
9


Fixed submission (verdict: Accepted):
import sys
def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n

n, X = map(int, sys.stdin.buffer.readline().split())
x = list(map(int, sys.stdin.buffer.readline().split()))
ans = abs(X - x[0])
for i in x[1:]:
    tmp = abs(X - i)
    if tmp % ans:
        ans = gcd(tmp, ans)
print(ans)
Problem: p03262
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N,X=map(int,input().split())
S=list(map(int,input().split()))

kakunin=10**10

if N==1:
    print(abs(10**9-X))
    exit()

for i in range(N):
    S[i]=S[i]-X
    if abs(S[i])<kakunin:
        kakunin=abs(S[i])
        
ans=1
okflag=True
for i in range(2,kakunin+1):
    okflag=True
    for j in range(N):
        if S[j]%i!=0:
            okflag=False
           
            break
    if okflag==True:
        ans=i
print(ans)

Failing test case input:
1 -1
0000000100

Expected output:
101


Actual output:
1000000001


Fixed submission (verdict: Accepted):
N,X=map(int,input().split())
S=list(map(int,input().split()))

kakunin=10**10

if N==1:
    if X<S[0]:
        print(S[0]-X)
        exit()
    else:
        print(X-S[0])
        exit()

for i in range(N):
    S[i]=S[i]-X
    if abs(S[i])<kakunin:
        kakunin=abs(S[i])
        
ans=1
okflag=True
for i in range(2,kakunin+1):
    okflag=True
    for j in range(N):
        if S[j]%i!=0:
            okflag=False
           
            break
    if okflag==True:
        ans=i
print(ans)

Problem: p03262
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,X = [int(i) for i in input().split()]
L = [int(i) for i in input().split()]

if N == 1:
    print(abs(N-X))
else:
    P = [0]*N
    P[0] = abs(min(L) - X)
    for i in range(1,N):
        P[i] = abs(L[i]-L[i-1])

    def gcd( x, y ):
        while y != 0:
            x, y = y, x%y
        return x

    ans = gcd(P[0],P[1])

    for i in range(2,N):
        ans = gcd(ans,P[i])

    print(ans)


Failing test case input:
1 -1
0010000001

Expected output:
10000002


Actual output:
2


Fixed submission (verdict: Accepted):
N,X = [int(i) for i in input().split()]
L = [int(i) for i in input().split()]

if N == 1:
    print(abs(L[0]-X))
else:
    P = [0]*N
    P[0] = abs(min(L) - X)
    for i in range(1,N):
        P[i] = abs(L[i]-L[i-1])

    def gcd( x, y ):
        while y != 0:
            x, y = y, x%y
        return x

    ans = gcd(P[0],P[1])

    for i in range(2,N):
        ans = gcd(ans,P[i])

    print(ans)

Problem: p03262
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math
def diff(l):
    c = 0
    ans = []
    for i in l:
        try:
            ans.append(abs(i-l[c+1]))
            c+=1
        except:
            continue
    return ans
def multiGCD(l):
    ans = 0
    for i in l:
        ans = math.gcd(ans, i)
    return ans
n, x = map(int, input().split())
l = list(map(int, input().split()))
l2 = diff(l)
if len(l2)==0:
    print(l[0]-x)
else:
    print(multiGCD(l2))

Failing test case input:
3 81
17 42 57

Expected output:
1


Actual output:
5


Fixed submission (verdict: Accepted):
import math
def diff(l):
    c = 0
    ans = []
    for i in l:
        try:
            ans.append(abs(i-l[c+1]))
            c+=1
        except:
            continue
    return ans
def multiGCD(l):
    ans = 0
    for i in l:
        ans = math.gcd(ans, i)
    return ans
n, x = map(int, input().split())
l = list(map(int, input().split()))
l.append(x)
l.sort()
l2 = diff(l)
print(multiGCD(l2))
Problem: p03262
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

from math import gcd

from functools import reduce







def solve(n,x,a):
    delta_a = [a[i] - x for i in range(n)]
    return reduce(gcd,delta_a)



def main():
    
    N,X = map(int,input().split())
    a = list(map(int,input().split()))
    print(solve(N,X,a))
    return

if __name__ == '__main__':
    main()


Failing test case input:
1 3
1 5 11

Expected output:
2


Actual output:
-2


Fixed submission (verdict: Accepted):

from math import gcd

from functools import reduce







def solve(n,x,a):
    delta_a = (abs(a[i] - x) for i in range(n))
    return reduce(gcd,delta_a)



def main():
    
    N,X = map(int,input().split())
    a = list(map(int,input().split()))
    print(solve(N,X,a))
    return

if __name__ == '__main__':
    main()

Problem: p03262
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def gcd(p,q):
    if p%q==0: return q
    else: return gcd(q,p%q)
n,x = map(int,input().split())
a = list(map(int,input().split()))
a.append(x)
a.sort()
ans = a[1]-a[0]
for i in range(2,n+1):
    tmp = a[i]-a[i-1]
    ans = max(ans,gcd(ans,tmp))
print(ans)


Failing test case input:
3 81
33 42 57

Expected output:
3


Actual output:
9


Fixed submission (verdict: Accepted):
def gcd(p,q):
    if p%q==0: return q
    else: return gcd(q,p%q)
n,x = map(int,input().split())
a = list(map(int,input().split()))
b = [abs(x-i) for i in a]
ans = b[0]
for i in range(1,n):
    ans = min(ans,gcd(ans,b[i]))
print(ans)

Problem: p03262
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a

N, X = map(int, input().split())
x = list(map(int, input().split())) + [X]
D = [0] * N
ans = 0

for i in range(N):
    D[i] = abs(X - x[i])
    if i > 0:
        calc = gcd(num, D[i])
        if ans < calc:
            ans = calc
    else:
        num = gcd(0, D[i])

if ans > 0:
    print(ans)
else:
    print(D[0])

Failing test case input:
3 81
33 70 57

Expected output:
1


Actual output:
24


Fixed submission (verdict: Accepted):
def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a

N, X = map(int, input().split())
x = list(map(int, input().split())) + [X]
D = [0] * N

for i in range(N):
    D[i] = abs(X - x[i])

if N == 1:
    print(D[0])
    exit()

ans = gcd(D[0], D[1])
for j in range(2, N):
    ans = gcd(ans, D[j])

print(ans)
Problem: p03262
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,x = map(int,input().split())
s = list(map(int,input().split()))

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

for i in range(n):
    s[i] = abs(s[i] - x)

if s[0] != 0:
    t = s[0]
    for i in range(n-1):
        if s[i+1] == 0:
            continue
        else:
            t = gcd(t,s[i+1])
else:
    t = s[-1]
    for i in range(n-1):
        if s[-i-2] == 0:
            continue
        else:
            t = gcd(t,s[-i-1])

print(t)

Failing test case input:
3 106
15 8 36

Expected output:
7


Actual output:
70


Fixed submission (verdict: Accepted):
n,x = map(int,input().split())
s = list(map(int,input().split()))

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

for i in range(n):
    s[i] = abs(s[i] - x)

if s[0] != 0:
    t = s[0]
    for i in range(n-1):
        if s[i+1] == 0:
            continue
        else:
            t = gcd(t,s[i+1])
else:
    t = s[-1]
    for i in range(n-1):
        if s[-i-2] == 0:
            continue
        else:
            t = gcd(t,s[-i-1])

print(t)

Problem: p03262
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

n,k = map(int,input().split())
x = list(map(int,input().split()))
ans = 10**10
for i in range(n):
    ans = min(ans,abs(x[i]-k))
print(ans)


Failing test case input:
3 81
33 42 57

Expected output:
3


Actual output:
24


Fixed submission (verdict: Accepted):

n,k = map(int,input().split())
x = list(map(int,input().split()))
ans = 0
t = 0

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

for i in range(n):
    t = abs(x[i]-k)
    ans = gcd(ans,t)
print(ans)

Problem: p03262
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,x = map(int,input().split())
s = list(map(int,input().split()))

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

for i in range(n):
    s[i] = s[i] - x

if s[0] != 0:
    t = s[0]
    for i in range(n-1):
        if s[i+1] == 0:
            continue
        else:
            t = gcd(t,s[i+1])
else:
    t = s[-1]
    for i in range(n-1):
        if s[-i-2] == 0:
            continue
        else:
            t = gcd(t,s[-i-1])

print(abs(t))

Failing test case input:
3 107
2 92 77

Expected output:
15


Actual output:
30


Fixed submission (verdict: Accepted):
n,x = map(int,input().split())
s = list(map(int,input().split()))

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

for i in range(n):
    s[i] = abs(s[i] - x)

if s[0] != 0:
    t = s[0]
    for i in range(n-1):
        if s[i+1] == 0:
            continue
        else:
            t = gcd(t,s[i+1])
else:
    t = s[-1]
    for i in range(n-1):
        if s[-i-2] == 0:
            continue
        else:
            t = gcd(t,s[-i-1])

print(t)
Problem: p03262
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from collections import defaultdict
from collections import deque
import itertools
import math

def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()

n,x = readInts()
xs = readInts()
xs.append(x)
xs.sort()

ans = xs[1]-xs[0]
for i in range(n-1):
  ans = math.gcd(ans,xs[i+1]-xs[i])

print(ans)

Failing test case input:
3 81
17 42 57

Expected output:
1


Actual output:
5


Fixed submission (verdict: Accepted):
from collections import defaultdict
from collections import deque
import itertools
import math

def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()

n,x = readInts()
xs = readInts()
xs.append(x)
xs.sort()

ans = xs[1]-xs[0]
for i in range(n):
  ans = math.gcd(ans,xs[i+1]-xs[i])

print(ans)

Problem: p03262
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def gcd(a,b):
    if b == 0:
        return a
    return gcd(b,a%b)

N, S = map(int,input().split())
x = list(map(int,input().split()))
x.append(S)
x = sorted(x)
t = x[1]-x[0]

for k in range(N-1):
    t = gcd(t,x[k+1]-x[k])

print(t)

Failing test case input:
3 81
17 42 57

Expected output:
1


Actual output:
5


Fixed submission (verdict: Accepted):
def gcd(a,b):
    if b == 0:
        return a
    return gcd(b,a%b)

N, S = map(int,input().split())
x = list(map(int,input().split()))
x.append(S)
x = sorted(x)
t = x[1]-x[0]

for k in range(N):
    t = gcd(t,x[k+1]-x[k])

print(t)

Problem: p03262
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,x = map(int, input().split())
l = [ abs(i - x) for i in list(map(int, input().split()))]
l.sort(reverse=True)
if len(l) == 1:ans = l[0]
else:
  while len(l) != 1:
    l.sort(reverse=True)
    l = [ l[i] - l[i+1] for i in range(len(l) - 1)]
    l = list(set(l))
  ans = l[0]
print(ans)

Failing test case input:
1 3
2 4 11

Expected output:
1


Actual output:
7


Fixed submission (verdict: Accepted):
n,x = map(int, input().split())
l = [ abs(i - x) for i in list(map(int, input().split()))]
l.sort(reverse=True)
l = list(set(l))
if len(l) == 1:ans = l[0]
else:
  while len(l) != 1:
    l.sort(reverse=True)
    l.append(0)
    l = [ l[i] - l[i+1] for i in range(len(l) - 1)]
    l = list(set(l))
    for i in l:
      if i % min(l) != 0:break
    else:
      l[0] = min(l)
      break
  ans = l[0]
print(ans)
Problem: p03262
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def euclid(a,b):
    if b == 0:
        return a 
    else:
        return euclid(b,a%b)
n,x = map(int,input().split())
cit = list(map(lambda i:int(i)-x,input().split()))

d = cit[0]

for i in range(n-1):
    d = euclid(d,cit[i+1])
    if d == 1:
        break
print(d)

Failing test case input:
3 81
33 3 57

Expected output:
6


Actual output:
-6


Fixed submission (verdict: Accepted):

def euclid(a,b):
    if b == 0:
        return a 
    else:
        return euclid(b,a%b)
n,x = map(int,input().split())
cit = list(map(lambda i:int(i)-x,input().split()))

d = cit[0]

for i in range(n-1):
    d = euclid(d,cit[i+1])
    if d == 1:
        break
print(abs(d))

Problem: p03262
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,X=map(int,input().split())
import math
a=list(map(int,input().split()))
a.append(X)
a.sort()
S=[]
for i in range(N):
    S.append(a[i+1]-a[i])
    
ans=S[0]
for j in range(1,N):
    math.gcd(ans,S[j])

print(ans)


Failing test case input:
3 81
33 42 57

Expected output:
3


Actual output:
9


Fixed submission (verdict: Accepted):
N,X=map(int,input().split())
import math
a=list(map(int,input().split()))
a.append(X)
a.sort()
S=[]
for i in range(N):
    S.append(a[i+1]-a[i])

    
ans=S[0]
for j in range(1,N):
    ans=math.gcd(ans,S[j])
    
print(ans)

Problem: p03262
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,X = map(int,input().split())
x = list(map(int,input().split()))
x.append(X)
x.sort()
a=[]
for i in range(len(x)-1):
        a.append(x[i+1]-x[i])

def gcd(m,n):
        while n!=0:
                s = m%n
                m = n
                n = s
        return n 

for j in range(len(a)):
        if a[j]%min(a) == 0:
                ans = min(a)
        else:
                ans = gcd(j,min(a))
print(ans)

Failing test case input:
3 81
33 42 57

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
n,X = map(int,input().split())
x = list(map(int,input().split()))
x.append(X)
x.sort()
a=[]
for i in range(len(x)-1):
        a.append(x[i+1]-x[i])        

def gcd(m,n):
        while n:
                m,n = n,m%n
        return m

ans=a[0]
for j in a:
        if j%ans != 0:
                ans = gcd(j,ans)
print(ans)

Problem: p03262
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


import sys

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

tmp = input().split()
hoge = list(map(lambda a: int(a), tmp))
n=hoge[0]
x=hoge[1]

tmp = input().split()
hoge = list(map(lambda a: int(a), tmp))

res = x-hoge[0]
for i in range(1,n):
	res=gcd(res, hoge[i]-hoge[i-1])
print(res)


Failing test case input:
3 81
33 73 57

Expected output:
8


Actual output:
-8


Fixed submission (verdict: Accepted):


import sys

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

tmp = input().split()
hoge = list(map(lambda a: int(a), tmp))
n=hoge[0]
x=hoge[1]

tmp = input().split()
hoge = list(map(lambda a: int(a), tmp))

res = abs(x-hoge[0])
for i in range(1,n):
	res=gcd(res, abs(hoge[i]-hoge[i-1]))
print(res)
Problem: p03262
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,x = map(int,input().split())
X = list(map(int,input().split()))
sort_X = sorted(X)
temp = sort_X[0]
mini = min(X[-1]-x,x-X[0])
D = 1
if(n==1):
    print(999999999)
else:
    for xx in sort_X[1:]:
        if(mini >= xx-temp):
            mini = xx-temp
        temp = xx
    for p in range(1,mini+1):
        point = x%p
        flag = True
        for xx in X:
            if(point != xx%p):
                    flag = False
                    break
        if(flag):
            D = p

    print(D)



Failing test case input:
3 106
15 8 36

Expected output:
7


Actual output:
1


Fixed submission (verdict: Accepted):
n,x = map(int,input().split())
X = list(map(int,input().split()))
sort_X = sorted(X)
temp = sort_X[0]
mini = float("inf")
D = 1
if(n==1):
    print(abs(X[0]-x))
elif(n==2):
    mini = min(X[-1]-x,x-X[0])

    for p in range(1,mini+1):
        point = x%p
        flag = True
        for xx in X:
            if(point != xx%p):
                    flag = False
                    break
        if(flag):
            D = p
    print(D)

else:
    for xx in sort_X[1:]:
        if(mini >= xx-temp):
            mini = xx-temp
        temp = xx
    for p in range(1,mini+1):
        point = x%p
        flag = True
        for xx in X:
            if(point != xx%p):
                    flag = False
                    break
        if(flag):
            D = p

    print(D)

Problem: p03262
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

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


import sys

N,X = map(int, input().split())
x = list(map(int, input().split()))


x_div =[abs(X-x[0])]
for i in range(N-1):
    x_div.append(abs(x[i] -x[i+1]))


if N ==1:
    ans =x[0] -X
else:
    ans =gcd_list(x_div)
print(ans)

Failing test case input:
1 3
2 5 11

Expected output:
1


Actual output:
-1


Fixed submission (verdict: Accepted):

import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

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


import sys

N,X = map(int, input().split())
x = list(map(int, input().split()))


x_div =[abs(X-x[0])] 
for i in range(N-1):
    x_div.append(abs(x[i] -x[i+1]))


if N ==1:
    ans =abs(x[0] -X)
else:
    ans =gcd_list(x_div)
print(ans)
Problem: p03262
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def gcd(a, b):
    while b != 0:
        a, b = b, a%b
    return a

N, X = map(int, input().split())
a = [abs(int(i)-X) for i in input().split()]


if N == 1:
    print(abs(X-a[0]))
else:
    ans = gcd(a[0], a[1])
    for i in range(N):
        ans = gcd(ans, a[i])
    print(ans)

Failing test case input:
1 1
1000001000

Expected output:
1000000999


Actual output:
1000000998


Fixed submission (verdict: Accepted):
def gcd(a, b):
    while b != 0:
        a, b = b, a%b
    return a

N, X = map(int, input().split())
a = [abs(int(i)-X) for i in input().split()]


if N == 1:
    print(a[0])
else:
    ans = gcd(a[0], a[1])
    for i in range(N):
        ans = gcd(ans, a[i])
    print(ans)

Problem: p03262
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, X = map(int, input().split())
x = list(map(int, input().split()))

d = [0 for _ in range(n)]
for i in range(n):
    d[i] = abs(x[i] - X)

d = sorted(list(set(d)))

if n == 1:
    print(d[0])
    exit()

def calc_gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = b % a
    return calc_gcd(b, c)

ans = d[0]
for i in range(1, len(d)):
    ans = calc_gcd(ans, d[i])

print(ans)

Failing test case input:
3 81
33 70 57

Expected output:
1


Actual output:
11


Fixed submission (verdict: Accepted):
n, X = map(int, input().split())
x = list(map(int, input().split()))

d = [0 for _ in range(n)]
for i in range(n):
    d[i] = abs(x[i] - X)

d = sorted(list(set(d)))

if n == 1:
    print(d[0])
    exit()

def calc_gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return calc_gcd(b, c)

ans = d[0]
for i in range(1, len(d)):
    ans = calc_gcd(ans, d[i])

print(ans)

Problem: p03262
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math

n, x = map(int, input().split())
a = list(map(int, input().split()))
b = []
for i in range(n):
  b.append(abs(x-a[i]))
ans = b[0]
for j in range(1, n):
  ans = math.gcd(ans, b[i])
print(ans)

Failing test case input:
3 81
17 42 57

Expected output:
1


Actual output:
8


Fixed submission (verdict: Accepted):
import math

n, x = map(int, input().split())
a = list(map(int, input().split()))
b = []
for i in range(n):
  b.append(abs(x-a[i]))
ans = b[0]
for j in range(1, n):
  ans = math.gcd(ans, b[j])
print(ans)

Problem: p03262
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,X = map(int,input().split())
L = list(map(int,input().split()))

M = [abs(i - X) for i in L]

m = min(M)

for i in range(0,len(M)):
  if M[i] % m > 0:
    print(1)
    break
else:print(m)

Failing test case input:
3 81
33 3 57

Expected output:
6


Actual output:
1


Fixed submission (verdict: Accepted):

N,X = map(int,input().split())
L = list(map(int,input().split()))

M = [abs(i - X) for i in L]

def gcd(a,b):
    if b==0: 
        return a 
    return gcd(b,a%b)
    
D = 0 
for i in range(0,len(M)): 
    D = gcd(D,M[i])

print(D)
Problem: p03262
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


def main():
    n, x = map(int, input().split())
    x_list = list(map(int, input().split()))
    if n == 1:
        print(abs(x_list[0] - x))
        exit()
    x_list.append(x)
    x_list.sort()
    diff = []
    for i in range(1, n):
        diff.append(x_list[i] - x_list[i - 1])
    print(min(diff))

if __name__ == '__main__':
    main()

Failing test case input:
3 81
17 42 57

Expected output:
1


Actual output:
15


Fixed submission (verdict: Accepted):

from functools import reduce

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

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

def main():
    n, x = map(int, input().split())
    x_list = list(map(int, input().split()))
    x_list.append(x)
    x_list.sort()
    diff = []
    for i in range(n):
        diff.append(x_list[i + 1] - x_list[i])
    print(gcd_list(diff))

if __name__ == '__main__':
    main()

Problem: p03262
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,x=map(int,input().split())
l=list(map(int,input().split()))

for i in range(n):
  l[i]=abs(l[i]-x)
print(l)

def gcd(x,y):
    if y==0:
      return x
    else:
      return gcd(y,x%y) 
    
if n==1:
  x=l[0]
else:
  x=gcd(l[0],l[1])
  if n>2:
    for i in range(2,n):
      x=gcd(x,l[i])
print(x)

Failing test case input:
1 0
1110001111

Expected output:
1110001111


Actual output:
[1110001111]
1110001111


Fixed submission (verdict: Accepted):
n,x=map(int,input().split())
l=list(map(int,input().split()))

for i in range(n):
  l[i]=abs(l[i]-x)

def gcd(x,y):
    if y==0:
      return x
    else:
      return gcd(y,x%y) 
    
if n==1:
  x=l[0]
else:
  x=gcd(l[0],l[1])
  if n>2:
    for i in range(2,n):
      x=gcd(x,l[i])
print(x)

Problem: p03262
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,x = map(int,input().split())
x_list = list(map(int,input().split()))
x_list.append(x)
x_list = sorted(x_list)
a = []
for i in range(n):
    b = x_list[i+1]-x_list[i]
    a.append(b)
import math
from functools import reduce
print(a)

Failing test case input:
1 1
1110001011

Expected output:
1110001010


Actual output:
[1110001010]


Fixed submission (verdict: Accepted):
n,x = map(int,input().split())
x_list = list(map(int,input().split()))
x_list.append(x)
x_list = sorted(x_list)
a = []
for i in range(n):
    b = x_list[i+1]-x_list[i]
    a.append(b)
import math
from functools import reduce
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
ans = reduce(gcd, a)
print(int(ans))