problem_id
stringlengths 6
6
| user_id
stringlengths 10
10
| time_limit
float64 1k
8k
| memory_limit
float64 262k
1.05M
| problem_description
stringlengths 48
1.55k
| codes
stringlengths 35
98.9k
| status
stringlengths 28
1.7k
| submission_ids
stringlengths 28
1.41k
| memories
stringlengths 13
808
| cpu_times
stringlengths 11
610
| code_sizes
stringlengths 7
505
|
---|---|---|---|---|---|---|---|---|---|---|
p03262 | u278446060 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ["from fraction import gcd\n\nif __name__ == '__main__' :\n N,X = map(int, input().split())\n x = list(map(int, input().split()))\n\n dist_list = [abs(d-X) for d in x]\n\n alpha = gcd(dist_list[0],dist_list[1])\n for d in dist_list:\n alpha = gcd(alpha,d)\n\n print(alpha)", "def gcd(x, y):\n r = modlog(x, y)\n while r != 0:\n x = y\n y = r\n r = modlog(x, y)\n return y\n\ndef modlog(x, y):\n r = x % y\n return r\n\nif __name__ == '__main__' :\n N,X = map(int, input().split())\n x = list(map(int, input().split()))\n\n dist_list = [abs(d-X) for d in x]\n\n if len(dist_list) == 1:\n print (dist_list[0])\n exit()\n \n alpha = gcd(dist_list[0],dist_list[1])\n for d in dist_list:\n alpha = gcd(alpha,d)\n\n print(alpha) \n"] | ['Runtime Error', 'Accepted'] | ['s449521208', 's051930916'] | [3060.0, 14224.0] | [17.0, 96.0] | [283, 514] |
p03262 | u278622837 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['n,x = map(int, input().split())\nl = [ abs(i - x) for i in list(map(int, input().split()))]\nl.sort(reverse=True)\nif len(l) == 1:ans = l[0]\nelse:\n while len(l) != 1:\n l = list(set(l))\n l = [ l[i] - l[i+1] for i in range(len(l) - 1)]\n ans = l[0]\nprint(ans)', 'n,x = map(int, input().split())\nl = [ abs(i - x) for i in list(map(int, input().split()))]\nl.sort(reverse=True)\nl = list(set(l))\nif len(l) == 1:ans = l[0]\nelse:\n while len(l) != 1:\n l.sort(reverse=True)\n l.append(0)\n l = [ l[i] - l[i+1] for i in range(len(l) - 1)]\n l = list(set(l))\n for i in l:\n if i % min(l) != 0:break\n else:\n l[0] = min(l)\n break\n ans = l[0]\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s000994766', 's046455754'] | [14224.0, 14252.0] | [282.0, 160.0] | [261, 408] |
p03262 | u278864208 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['def gcd(a,b):\n if b > 0:\n c = a % b\n print(gcd(b,c))\n elif b == 0:\n print(a)\n\nN, X = map(int,input().split())\nx = list(input().split())\nx = [abs(X-int(i)) for i in x]\nfor i in x:\n if i == x[0]:\n a = i\n else:\n a = gcd(a,i)\nprint(a)', 'def gcd(a,b):\n if b > 0:\n c = a % b\n return(gcd(b,c))\n elif b == 0:\n return(a)\n\nN, X = map(int,input().split())\nx = list(input().split())\nx = [abs(X-int(i)) for i in x]\nfor i in x:\n if i == x[0]:\n a = i\n else:\n a = gcd(a,i)\nprint(a)'] | ['Runtime Error', 'Accepted'] | ['s492584588', 's968910221'] | [14944.0, 14940.0] | [54.0, 104.0] | [277, 279] |
p03262 | u279266699 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ["import sys\nimport math\nfrom functools import reduce\n\n\nstdin = sys.stdin\ndef ns(): return stdin.readline().rstrip()\ndef ni(): return int(stdin.readline().rstrip())\ndef nm(): return map(int, stdin.readline().split())\ndef nl(): return list(map(int, stdin.readline().split()))\n\ndef gcd_list(numbers):\n return reduce(math.gcd, numbers)\n\n\n\ndef main():\n n, x = nm()\n X = nl()\n X.append(x)\n ans = gcd_list(X)\n print(ans)\n\n\n\nif __name__ == '__main__':\n main()", "import sys\nimport math\nfrom functools import reduce\n\n\nstdin = sys.stdin\ndef ns(): return stdin.readline().rstrip()\ndef ni(): return int(stdin.readline().rstrip())\ndef nm(): return map(int, stdin.readline().split())\ndef nl(): return list(map(int, stdin.readline().split()))\n\n\ndef gcd_list(numbers):\n return reduce(math.gcd, numbers)\n\n\ndef main():\n n, x = nm()\n X = nl()\n X.append(x)\n X = sorted(X)\n D = [X[i + 1] - X[i] for i in range(len(X) - 1)]\n ans = gcd_list(D)\n print(ans)\n\n\nif __name__ == '__main__':\n main()\n"] | ['Wrong Answer', 'Accepted'] | ['s484815469', 's101154316'] | [20260.0, 20228.0] | [57.0, 84.0] | [471, 542] |
p03262 | u280978334 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['n,x = map(int,input().split())\nX = list(map(int,input().split()))\nsort_X = sorted(X)\ntemp = sort_X[0]\nmini = X[-1]-X[0]\nD = 1\nif(n==1):\n print(999999999)\nelif(n==2):\n print(mini)\nelse:\n for xx in sort_X[1:]:\n if(mini >= xx-temp):\n mini = xx-temp\n temp = xx\n for p in range(1,mini+1):\n point = x%p\n flag = True\n for xx in X:\n if(point != xx%p):\n flag = False\n break\n if(flag):\n D = p\n\n print(D)\n\n', 'n,x = map(int,input().split())\nX = list(map(int,input().split()))\nsort_X = sorted(X)\ntemp = sort_X[0]\nmini = float("inf")\nD = 1\nif(n==1):\n print(abs(X[0]-x))\nelif(n==2):\n mini = min(X[-1]-x,x-X[0])\n\n for p in range(1,mini+1):\n point = x%p\n flag = True\n for xx in X:\n if(point != xx%p):\n flag = False\n break\n if(flag):\n D = p\n print(D)\n\nelse:\n for xx in sort_X[1:]:\n if(mini >= xx-temp):\n mini = xx-temp\n temp = xx\n for p in range(1,mini+1):\n point = x%p\n flag = True\n for xx in X:\n if(point != xx%p):\n flag = False\n break\n if(flag):\n D = p\n\n print(D)\n\n'] | ['Runtime Error', 'Accepted'] | ['s922405213', 's983686632'] | [14228.0, 14480.0] | [229.0, 755.0] | [499, 774] |
p03262 | u284854859 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['import functools\nimport math\nimport fraction\nn,x = map(int,input().split())\nvalues = list(map(int,input().split()))\nfor i in range(n):\n values[i] = abs(values[i]-x)\ngcd = functools.reduce(fraction.gcd, values)\nprint(gcd)', '\ndef gcd(a, b):\n while b > 0:\n a, b = b, a%b\n return a\nn,x = map(int,input().split())\nvalues = list(map(int,input().split()))\nfor i in range(n):\n values[i] = abs(values[i]-x)\nass = values[0]\nfor i in range(n):\n ass = gcd(ass,values[i])\nprint(ass)'] | ['Runtime Error', 'Accepted'] | ['s451597928', 's719999208'] | [3828.0, 14252.0] | [96.0, 95.0] | [223, 257] |
p03262 | u292814514 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['num_str=input().split()\nnum=list(map(int, num_str))\nn=num[0]\nx=num[1]\n\nnum2_str=input().split()\ndistance=list(map(int, num2_str))\n\nfirst_distance=list(map(lambda y:abs(y-x),distance))\nmin_distance=min(first_distance)\n\nflag=True\nfor i in range(min_distance,-1):\n for j in range(n):\n if first_distance[j]%i!=0:\n flag=False\n break\n\n if flag:\n ans=i\n print(ans)\n break', 'num_str=input().split()\nnum=list(map(int, num_str))\nn=num[0]\nx=num[1]\n\nnum2_str=input().split()\ndistance=list(map(int, num2_str))\n\nfirst_distance=list(map(lambda y:abs(y-x),distance))\nmin_distance=min(first_distance)\n\nflag=True\nfor i in range(min_distance,-1):\n for j in n:\n if first_distance[j]%i!=0:\n flag=False\n\n if flag:\n print("i")\n break\n', 'num_str=input().split()\nnum=list(map(int, num_str))\nn=num[0]\nx=num[1]\nnum2_str=input().split()\ndistance=list(map(int, num2_str))\n\nfirst_distance=list(map(lambda y:abs(y-x),distance))\nmin_distance=min(first_distance)\n\n\nfor i in range(min_distance,0,-1):\n Can_go_list=list(map(lambda z: 1 if z % i == 0 else 0,first_distance))\n\n if 1 not in Can_go_list:\n ans = i\n print(ans)\n break', 'num_str=input().split()\nnum=list(map(int, num_str))\nn=num[0]\nx=num[1]\nnum2_str=input().split()\ndistance=list(map(int, num2_str))\n\nfirst_distance=list(map(lambda y:abs(y-x),distance))\nmin_distance=min(first_distance)\n\n\nfor i in range(min_distance,0,-1):\n Can_go_list=list(map(lambda z:z%i,first_distance))\n\n if 0 not in Can_go_list:\n ans = i\n print(ans)\n break', 'num_str=input().split()\nnum=list(map(int, num_str))\nn=num[0]\nx=num[1]\nnum2_str=input().split()\ndistance=list(map(int, num2_str))\n\nfirst_distance=list(map(lambda y:abs(y-x),distance))\nmin_distance=min(first_distance)\n\ndef gcd(a,b):\n if b==0:return a\n return gcd(b,a%b)\n\ngcd=gcd(first_distance[0],first_distance[1])\nfor i in range(2,n):\n gcd=gcd(gcd,first_distance[i])\nprint(gcd)', 'num_str=input().split()\nnum=list(map(int, num_str))\nn=num[0]\nx=num[1]\nnum2_str=input().split()\ndistance=list(map(int, num2_str))\n\nfirst_distance=list(map(lambda y:abs(y-x),distance))\nmin_distance=min(first_distance)\n\ngcd=gcd(first_distance[0],first_distance[1])\nfor i in range(2,n):\n gcd=gcd(gcd,first_distance[i])\nprint(gcd)', 'num_str=input().split()\nnum=list(map(int, num_str))\nn=num[0]\nx=num[1]\nnum2_str=input().split()\ndistance=list(map(int, num2_str))\n\nfirst_distance=list(map(lambda y:abs(y-x),distance))\nmin_distance=min(first_distance)\n\ndef gcd(a,b):\n if b==0:return a\n return gcd(b,a%b)\n\n\nif n==1:\n print(first_distance[0])\nelse:\n element = gcd(first_distance[0], first_distance[1])\n if n==2:print(element)\n else:\n for i in range(2,n):\n element=gcd(element,first_distance[i])\n print(element)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s020500659', 's129075827', 's202636656', 's395976456', 's503037788', 's840348876', 's652311593'] | [18448.0, 18448.0, 19984.0, 27876.0, 18448.0, 18448.0, 18448.0] | [61.0, 61.0, 2105.0, 2105.0, 61.0, 65.0, 111.0] | [420, 382, 406, 386, 386, 328, 515] |
p03262 | u296518383 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['import fractions\n\nN,X=map(int,input().split())\nx=list(map(int,input().split()))+[X]\nx.sort()\n#print(x)\n\ny=[]\nfor i in range(N):\n y.append(x[i+1]-x[i])\n#print(y)\n\nmax_gcd=0\nfor i in range(N-1):\n max_gcd=max(max_gcd,fractions.gcd(max_gcd,y[i]))\nprint(max_gcd if N!=1 else y[0])', 'import fractions\n\nN,X=map(int,input().split())\nx=list(map(int,input().split()))+[X]\nx.sort()\nprint(x)\n\ny=[]\nfor i in range(N):\n y.append(x[i+1]-x[i])\nprint(y)\n\nmax_gcd=0\nfor i in range(N-1):\n max_gcd=max(max_gcd,fractions.gcd(max_gcd,y[i]))\nprint(max_gcd if N!=1 else y[0])', 'import fractions\n\nN,X=map(int,input().split())\nx=list(map(int,input().split()))+[X]\nx.sort()\n#print(x)\n\ny=[]\nfor i in range(N):\n y.append(x[i+1]-x[i])\n#print(y)\n\nmax_gcd=y[0]\nfor i in range(N-1):\n max_gcd=fractions.gcd(max_gcd,y[i])\nprint(max_gcd)', 'N, X = map(int, input().split())\nA = list(map(lambda x: abs(X - int(x)), input().split()))\n\ndef gcd(x, y):\n return x if y == 0 else gcd(y, x % y)\n\nanswer = 0\nfor a in A:\n answer = gcd(answer, a)\n\nprint(answer)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s495479290', 's519101413', 's640768339', 's343029675'] | [16280.0, 16668.0, 16284.0, 14212.0] | [179.0, 201.0, 153.0, 110.0] | [277, 275, 249, 211] |
p03262 | u303019816 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['N, X = map(int, input().split())\nx_list = list(map(int, input().split()))\n\n\n\ndef gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\n\ndef lcm(a, b):\n return a * b // gcd (a, b)\n\n\nans = 0\nfor i, x in enumerate(x_list):\n\n diff = abs(x - X)\n\n print(i, x, diff, ans)\n\n if i == 0:\n ans = diff\n else:\n larger = min(ans, diff)\n smaller = max(ans, diff)\n\n if smaller % larger == 0:\n ans = larger\n else:\n ans = gcd(ans, diff)\n\nprint(ans)\n', 'N, X = map(int, input().split())\nx_list = list(map(int, input().split()))\n\n\n\ndef gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\n\ndef lcm(a, b):\n return a * b // gcd (a, b)\n\n\nans = 0\nfor i, x in enumerate(x_list):\n\n diff = abs(x - X)\n\n # print(i, x, diff, ans)\n\n if i == 0:\n ans = diff\n else:\n larger = min(ans, diff)\n smaller = max(ans, diff)\n\n if smaller % larger == 0:\n ans = larger\n else:\n ans = gcd(ans, diff)\n\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s077224359', 's280675986'] | [14224.0, 14224.0] | [315.0, 126.0] | [565, 567] |
p03262 | u308684517 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['def gcd(x, y):\n if y == 0:\n return x\n else:\n return gcd(y, x % y) \n\nn, X = map(int, input().split())\nx = list(map(int, input().split()))\nif len(x) == 1:\n print(abs(x[0] - X))\nelse:\n x.sort()\n s = x[1] - x[0]\n for i in range(1, n-1):\n s = gcd(s, x[i+1]-x[i])\n print(s)\n a = 1\n for i in range(n):\n a = max(a, gcd(abs(X-x[i]), s))\n print(a)', 'def gcd(x, y):\n if y == 0:\n return x\n else:\n return gcd(y, x % y) \n\nn, X = map(int, input().split())\nx = list(map(int, input().split()))\na = abs(x[0] - X)\nfor i in x[1:]:\n a = gcd(a, abs(i - X))\nprint(a)'] | ['Wrong Answer', 'Accepted'] | ['s712298339', 's603100190'] | [14252.0, 14252.0] | [269.0, 91.0] | [373, 224] |
p03262 | u330712095 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['n,x = map(int,input().split())\na = list(map(int,input().split()))\na.append(x)\na.sort()\nd = [1000000000]\ne = []\nflg = False\nfor i in range(len(a)-1):\n t = a[1+i] - a[i]\n e.append(t)\n if(t < d[0]):\n d.insert(0,t)\nl = len(d)\nans=1000000000\nfor i in range(l):\n u = list(map(lambda x: x% d[l - 1 - i],e))\n print(u)\n if(u.count(0) == n):\n ans = d[l-1-i]\n break\nprint(ans)', 'n,x = map(int,input().split())\na = list(map(int,input().split()))\na.append(x)\na.sort()\nd = [1000000000]\ne = []\nflg = False\nfor i in range(len(a)-1):\n t = a[1+i] - a[i]\n e.append(t)\n if(t < d[0]):\n d.insert(0,t)\nl = len(d)\nans = 1\nfor i in range(l):\n u = list(map(lambda x: x% d[l - 1 - i],e))\n print(u)\n if(u.count(0) == n):\n ans = d[l-1-i]\n break\nprint(ans)', 'n,x = map(int,input().split())\na = list(map(int,input().split()))\na.append(x)\na.sort()\nd = [1000000000000]\ne = []\nflg = False\nfor i in range(len(a)-1):\n t = a[1+i] - a[i]\n e.append(t)\n if(t < d[0]):\n d.insert(0,t)\n if(t == 1):\n flg = True\n break\nif(flg):\n print(1)\nelse:\n l = len(d)\n ans = 1\n for i in range(l):\n u = list(map(lambda x: x% d[l - 1 - i],e))\n print(u)\n if(u.count(0) == n):\n ans = d[l-1-i]\n break\n print(ans)', 'n,x = map(int,input().split())\na = list(map(int,input().split()))\na.append(x)\na.sort()\nd = [1000000000]\ne = []\nflg = False\nfor i in range(len(a)-1):\n t = a[1+i] - a[i]\n e.append(t)\n if(t < d[0]):\n d.insert(0,t)\n if(t == 1):\n flg = True\n break\nif(flg):\n print(1)\nelse:\n d.sort()\n l = len(d)\n ans = 1\n for i in range(l):\n u = list(map(lambda x: x% d[l - 1 - i],e))\n if(u.count(0) == n):\n ans = d[l-1-i]\n break\n if(ans == 1):\n k = d[0]\n f = []\n j = 2\n while True:\n s = int(k/j)\n if(k % j == 0):\n f.insert(0,s)\n if(s < 1):\n break\n j += 1\n q = len(f)\n for i in range(q):\n u = list(map(lambda x: x% f[q - 1 - i],e))\n if(u.count(0) == n):\n ans = f[q-1-i]\n break\n\n print(ans)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s257789532', 's469956104', 's719596146', 's167543706'] | [19444.0, 18476.0, 18704.0, 16172.0] | [244.0, 244.0, 253.0, 324.0] | [380, 373, 459, 779] |
p03262 | u344276999 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['import math\nN, X = [int(i) for i in input().split()]\nx = [int(i) for i in input().split()]\nx.append(X)\nx.sort()\n\nxdst = [x[i+1] - x[i] for i in range(N)]\nprint(xdst)\n\nans = 10**10\nif len(xdst) == 1:\n #print(xdst[0])\n exit()\n\nfor i in range(N-1):\n ans = min(math.gcd(xdst[i], xdst[i+1]),ans)\nprint(ans)', 'import math\nN, X = [int(i) for i in input().split()]\nx = [int(i) for i in input().split()]\nx.append(X)\nx.sort()\n\nxdst = [x[i+1] - x[i] for i in range(N)]\n#print(xdst)\n\nans = 10**10\nif len(xdst) == 1:\n print(xdst[0])\n exit()\n\nfor i in range(N-1):\n ans = min(math.gcd(xdst[i], xdst[i+1]),ans)\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s931887899', 's329586035'] | [20360.0, 20260.0] | [133.0, 123.0] | [310, 310] |
p03262 | u346194435 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['import fraction\n\nN, X = input().split()\nxList = [int(x) for x in input().split()]\nN = int(N)\nX = int(X)\nxList.append(X)\nxList.sort()\ndiffList = []\nfor x, xx in zip(xList, xList[1:]):\n diffList.append(xx - x)\n\ndiffList.sort()\n\nprint(fraction.gcd(diffList[0], diffList[-1]))', ' def gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n \n N, X = input().split()\n xList = [int(x) for x in input().split()]\n N = int(N)\n X = int(X)\n xList.append(X)\n xList.sort()\n diffList = []\n for x, xx in zip(xList, xList[1:]):\n diffList.append(xx - x)\n if len(diffList) > 1:\n diffList.sort()\n gcdList = []\n for x in diffList[1:]:\n gcdList.append(gcd(diffList[0], x))\n gcdList.sort()\n print(gcdList[0])\n else:\n print(diffList[0])', 'def gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n \nN, X = input().split()\nxList = [int(x) for x in input().split()]\nN = int(N)\nX = int(X)\nxList.append(X)\nxList.sort()\ndiffList = []\nfor x, xx in zip(xList, xList[1:]):\n diffList.append(xx - x)\nif len(diffList) > 1:\n diffList.sort()\n gcdList = []\n for x in diffList[1:]:\n gcdList.append(gcd(diffList[0], x))\n gcdList.sort()\n print(gcdList[0])\nelse:\n print(diffList[0])'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s214190726', 's438632066', 's332410157'] | [3064.0, 2940.0, 14228.0] | [18.0, 18.0, 159.0] | [275, 552, 463] |
p03262 | u346395915 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['n,x = map(int,input().split())\nli = list(map(int,input().split()))\n\nres_abs = []\nres = []\n\ns = 10**10\n\nfor i in range(n):\n s = abs(li[i] - x)\n res_abs.append(s)\n \n s = li[i] - x\n res.append(s)\n \nres.sort()\n\ntemp = 10**10\n\nfor i in range(n-1):\n temp = min(temp, res[i+1] - res[i])\n \n \ns = min(min(res), temp)\n \nwhile True:\n for i in range(n):\n if res_abs[i]%s != 0:\n break\n else:\n print(s)\n exit()\n \n s -= 1', 'n,x = map(int,input().split())\nli = list(map(int,input().split()))\n\nres_abs = []\nres = []\n\ns = 10**10\n\nfor i in range(n):\n s = abs(li[i] - x)\n res_abs.append(s)\n \n s = li[i] - x\n res.append(s)\n \nres.sort()\n\ntemp = 10**10\n\nfor i in range(n-1):\n temp = min(temp, res[i+1] - res[i])\n\n \ns = min(min(res_abs), temp)\n \nwhile True:\n for i in range(n):\n if res_abs[i]%s != 0:\n break\n else:\n print(s)\n exit()\n \n s -= 1'] | ['Wrong Answer', 'Accepted'] | ['s176530596', 's474624381'] | [15508.0, 15504.0] | [2105.0, 337.0] | [484, 484] |
p03262 | u350248178 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['import math\nimport reduce\nn,xs=map(int,input().split())\n\nx=[abs(int(i)-xs) for i in input().split()]\n\ndef gc(numbers):\n return reduce(math.gcd, numbers)\n\nprint(gc(x))', 'def gcd(a, b):\n\n\twhile b:\n\n\t\ta, b = b, a % b\n\n\treturn a\n\nn,xs=map(int,input().split())\n\nx=[abs(int(i)-xs) for i in input().split()]\n\nans=x[0]\nfor i in range(n):\n ans=gcd(ans,x[i])\n\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s328416612', 's419554820'] | [3068.0, 14224.0] | [17.0, 88.0] | [169, 194] |
p03262 | u366959492 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['N,X=map(int,input().split())\nx=list(map(int,input().split()))\nl=[]\nfor i in range(N):\n l.append(abs(X-x[i]))\nfrom hase import gcd\n\nll=[0]*(N+1)\nfor i in range(N):\n ll[i+1]=gcd(ll[i],l[i])\nprint(ll[N])\n', 'N,X=map(int,input().split())\nx=list(map(int,input().split()))\nl=[]\nfor i in range(N):\n l.append(abs(X-x[i]))\ndef gcd(a,b):\n if a == 0:\n return b\n if b == 0:\n return a\n r = 1\n while r > 0:\n r = a % b\n a = b\n b = r\n return a\n\nll=[0]*(N+1)\nfor i in range(N):\n ll[i+1]=gcd(ll[i],l[i])\nprint(ll[N])'] | ['Runtime Error', 'Accepted'] | ['s237387741', 's182974026'] | [14252.0, 14224.0] | [68.0, 119.0] | [207, 349] |
p03262 | u367117210 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['n, x = map(int, input().split())\nxi = list(map(int, input().split()))\n\nimport fraction\n\ndef gcd(*numbers):\n\tret = numbers[0]\n\tfor n in numbers[1:]:\n\t\tret = fraction.gcd(ret, n)\n return ret\n\nxi = map(lambda y:abs(y-x), xi)\nprint(gcd(*xi))', 'n, x = map(int, input().split())\nxi = list(map(int, input().split()))\n\nimport math\nimport fraction\nfrom functools import reduce\n\ndef gcd(*numbers):\n return reduce(fraction.gcd, numbers)\n\nxi = map(lambda y:y-x, xi)\nprint(gcd(*xi))', 'n, x = map(int, input().split())\nxi = list(map(int, input().split()))\n\nimport fraction\nimport functools\n\ndef gcd(*numbers):\n return functools.reduce(fraction.gcd, numbers)\n\nxi = map(lambda y:y-x, xi)\nprint(gcd(*xi))', 'n, x = map(int, input().split())\nxi = list(map(int, input().split()))\n\nimport fraction\n\ndef gcd(*numbers):\n\tret = numbers[0]\n\tfor n in numbers[1:]:\n\t\tret = fraction.gcd(ret, n)\n\treturn ret\n\nxi = map(lambda y:abs(y-x), xi)\nprint(gcd(*xi))', 'n, x = map(int, input().split())\nxi = list(map(int, input().split()))\n\nimport fraction\nimport reduce\n\ndef gcd(*numbers):\n return functools.reduce(fraction.gcd, numbers)\n\nxi = map(lambda y:y-x, xi)\nprint(gcd(*xi))', 'n, x = map(int, input().split())\nxi = list(map(int, input().split()))\n\ndef gcd(a, b):\n\twhile b:\n\t\ta, b = b, a % b\n\treturn a\n\ndef gcd_l(*numbers):\n\tret = numbers[0]\n\tfor n in numbers[1:]:\n\t\tret = gcd(ret, n)\n\treturn ret\n\nxi = map(lambda y:abs(y-x), xi)\nprint(gcd_l(*xi))'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s117398605', 's397363707', 's505599346', 's546415565', 's913808615', 's318643581'] | [3064.0, 14252.0, 14252.0, 15020.0, 14224.0, 14224.0] | [17.0, 42.0, 41.0, 42.0, 42.0, 78.0] | [240, 232, 218, 237, 215, 269] |
p03262 | u379689547 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ["def gcd(a, b):\n if a > b:\n a, b = b, a\n while b > 0:\n a, b = b, a % b\n return a\n\n\ndef allgcd(d):\n if len(d) == 1:\n return d\n ret_gcd = d[0]\n for i in d:\n ret_gcd = gcd(ret_gcd, i)\n return ret_gcd\n\n\ndef maxNumVisitCity(N, X, x):\n if len(x) == 1:\n return abs(x[0] - X)\n\n d = []\n for i in x:\n d.append(abs(i - X))\n return allgcd(d)\n\n\ndef main():\n N, X = map(int, input().split())\n x = map(int, input().split())\n print(maxNumVisitCity(N, X, x))\n\n\nif __name__ == '__main__':\n main()\n", "def gcd(a, b):\n if a > b:\n a, b = b, a\n while b > 0:\n a, b = b, a % b\n return a\n\n\ndef allgcd(d):\n if len(d) == 1:\n return d\n ret_gcd = d[0]\n for i in d:\n ret_gcd = gcd(ret_gcd, i)\n return ret_gcd\n\n\ndef maxNumVisitCity(N, X, x):\n if len(x) == 1:\n return abs(x[0] - X)\n\n d = []\n for i in x:\n d.append(abs(i - X))\n return allgcd(d)\n\n\ndef main():\n N, X = map(int, input().split())\n x = list(map(int, input().split()))\n print(maxNumVisitCity(N, X, x))\n\n\nif __name__ == '__main__':\n main()\n"] | ['Runtime Error', 'Accepted'] | ['s914485510', 's948343155'] | [11480.0, 14480.0] | [27.0, 81.0] | [565, 571] |
p03262 | u382639013 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['import math\nfrom functools import reduce\n\ndef gcd(*numbers):\n return reduce(math.gcd, numbers)\n\nN, X = list(map(int, input().split()))\n\nx = list(map(int, input().split()))\nx.append(X)\nx.sort()\n\nres = [abs(x[i+1]-x[i]) for i in range(len(x))]\nprint(gcd(*res))', 'import math\nfrom functools import reduce\n \ndef gcd(*numbers):\n return reduce(math.gcd, numbers)\n\nN, X = list(map(int, input().split()))\n \nx = list(map(int, input().split()))\nx.append(X)\nx.sort()\n \nres = [abs(x[i+1]-x[i]) for i in range(len(x)-1)]\nprint(gcd(*res))'] | ['Runtime Error', 'Accepted'] | ['s907785571', 's833536207'] | [20348.0, 20620.0] | [82.0, 94.0] | [261, 266] |
p03262 | u384261199 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['#C - Skip\nN, X = map(int, input().split())\nx_list = list(map(int, input().split()))\n\nresidual = [abs(x - X) for x in x_list]\n\ndef gcd(a,b):\n if(b==0):\n return a\n else:\n gcd(b, a%b)\n \nmax_ = 0\nfor i in range(len(residual)):\n if(i == 0):\n max_ = gcd(residual[i], residual[i+1])\n elif(i == N-1):\n print(max_)\n else:\n max_ = gcd(residual[i], max_)', '#C - Skip\nimport sys\n\nN, X = map(int, input().split())\nx_list = list(map(int, input().split()))\n\nresidual = [abs(x - X) for x in x_list]\n\ndef gcd(a,b):\n if(b==0):\n return a\n else:\n return gcd(b, a%b)\n \nmax_ = 0\nfor i in range(len(residual)):\n if(N==1):\n print(residual[0])\n break\n \n if(i == 0):\n max_ = gcd(residual[i], residual[i+1])\n elif(i == N-1):\n print(max_)\n else:\n max_ = gcd(residual[i], max_)\n\n '] | ['Runtime Error', 'Accepted'] | ['s951915195', 's881312384'] | [15020.0, 14224.0] | [52.0, 108.0] | [400, 489] |
p03262 | u384657160 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['n,x = map(int,input().split())\ns = list(map(int,input().split()))\n\ndef gcd(a,b):\n while b!=0:\n a,b=b,a%b\n return a\n\nfor i in range(n):\n s[i] = s[i] - x\n\nif s[0] != 0:\n t = s[0]\n for i in range(n-1):\n if s[i+1] == 0:\n continue\n else:\n t = gcd(t,s[i+1])\nelse:\n t = s[-1]\n for i in range(n-1):\n if s[-i-2] == 0:\n continue\n else:\n t = gcd(t,s[-i-1])\n\nprint(abs(t))', 'n,x = map(int,input().split())\ns = list(map(int,input().split()))\n\ndef gcd(a,b):\n while b!=0:\n a,b=b,a%b\n return a\n\nfor i in range(n):\n s[i] = abs(s[i] - x)\n\nif s[0] != 0:\n t = s[0]\n for i in range(n-1):\n if s[i+1] == 0:\n continue\n else:\n t = gcd(t,s[i+1])\nelse:\n t = s[-1]\n for i in range(n-1):\n if s[-i-2] == 0:\n continue\n else:\n t = gcd(t,s[-i-1])\n\nprint(t)', 'n,x = map(int,input().split())\ns = list(map(int,input().split()))\n\ndef gcd(a,b):\n while b!=0:\n a,b=b,a%b\n return a\n\nfor i in range(n):\n s[i] = s[i] - x\n\nif s[0] != 0:\n t = s[0]\n for i in range(n-1):\n if s[i+1] == 0:\n continue\n else:\n t = gcd(t,s[i+1])\nelse:\n t = s[-1]\n for i in range(n-1):\n if s[-i-2] == 0:\n continue\n else:\n t = gcd(t,s[-i-1])\n\nprint(t)', 'n,x = map(int,input().split())\ns = list(map(int,input().split()))\n\ndef gcd(a,b):\n while b!=0:\n a,b=b,a%b\n return a\n\nfor i in range(n):\n s[i] = abs(s[i] - x)\n\nif s[0] != 0:\n t = s[0]\n for i in range(n-1):\n if s[i+1] == 0:\n continue\n else:\n t = gcd(t,s[i+1])\nelse:\n t = s[-1]\n for i in range(n-1):\n if s[-i-2] == 0:\n continue\n else:\n t = gcd(t,s[-i-1])\n\nprint(t)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s118863402', 's148998804', 's853344859', 's369778516'] | [14252.0, 14224.0, 14252.0, 14252.0] | [98.0, 102.0, 100.0, 109.0] | [464, 464, 459, 460] |
p03262 | u385309449 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['x_list = list(map(int,input().split()))\nx_list.append(x)\nx_list = sorted(x_list)\nif len(x_list) >= 3:\n a = []\n for i in range(1,n+1):\n a.append(x_list[i] - x_list[i-1])\n a = sorted(a)\n c = [a[1],a[0]]\n while c[0]%c[1] != 0:\n c.append(c[0]%c[1])\n c.pop(0)\n else:\n print(c[1])\nelse:\n print(x_list[1]-x_list[0])', 'n,x = map(int,input().split())\nx_list = list(map(int,input().split()))\nx_list.append(x)\nx_list = sorted(x_list)\ndef u(o,p):\n c = [a[1],a[0]]\n while c[0]%c[1] != 0:\n c.append(c[0]%c[1])\n c.pop(0)\n else:\n return c[1]\n \nif 4 >= len(x_list) >= 3:\n a = []\n for i in range(1,n+1):\n a.append(x_list[i] - x_list[i-1])\n a = sorted(a)\n print(u(a[1],a[0]))\n\nelif len(x_list) > 4:\n a = []\n for i in range(1,n+1):\n a.append(x_list[i] - x_list[i-1])\n a = sorted(a)\n u = u(a[1],a[0])\n for i in a:\n if i/u == int(i/u):\n pass\n else:\n u = i%u\n print(u)\nelse:\n print(x_list[1]-x_list[0])'] | ['Runtime Error', 'Accepted'] | ['s436402484', 's058261836'] | [3064.0, 14480.0] | [17.0, 162.0] | [327, 616] |
p03262 | u390694622 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['N,X = map(int,input().split())\nx = list(map(int,input().split()))\nfor i in range(N):\n x[i] -= X\nimport fractions\ng = fractions.gcd(x[0],x[1])\nfor i in range(2,N):\n g = fractions.gcd(g,x[i])\nprint(g)\n', 'N,X=map(int,input().split())\nxs = list(map(int,input().split()))\n\ndef gcd( x, y ):\n while y != 0:\n x, y = y, x%y\n return(x)\n \n\nxs[0] -= X\ng = xs[0]\nimport math\nfor i in range(1,N):\n xs[i] -= X\n g = gcd(g,xs[i])\nprint(abs(g))'] | ['Runtime Error', 'Accepted'] | ['s639941665', 's547720060'] | [14224.0, 15020.0] | [119.0, 93.0] | [201, 246] |
p03262 | u407837208 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['(n, x) = list(map(int, input().split()))\nx_list = list(map(int, input().split()))\n\nx_list.append(x)\nx_list.sort()\nx_list = list(set(x_list))\n\nmin_diff = 99999999999\nfor i in range(len(x_list) - 1):\n diff = x_list[i + 1] - x_list[i]\n if min_diff > diff:\n min_diff = diff\n\n\nx_diff = [xx - x_list[0] for xx in x_list]\n\nfor i in range(1, min_diff):\n if min_diff % i != 0: \n continue\n xx = min_diff // i\n is_divided = [j for j in x_diff if j % xx != 0]\n if len(is_divided) == 0:\n print(xx)\n exit()\n', '(n, x) = list(map(int, input().split()))\nx_list = list(map(int, input().split()))\n\nif x in x_list:\n pass\nelse:\n x_list.append(x)\n x_list.sort()\n\nmin_diff = 99999999999\nfor i in range(len(x_list) - 1):\n diff = x_list[i + 1] - x_list[i]\n if min_diff > diff:\n min_diff = diff\n\n\nx_diff = [xx - x_list[0] for xx in x_list]\n\nfor i in range(1, min_diff):\n if min_diff % i != 0: \n continue\n xx = min_diff // i\n is_divided = [j for j in x_diff if j % xx != 0]\n if len(is_divided) == 0:\n print(xx)\n exit()\nprint(1)\n'] | ['Wrong Answer', 'Accepted'] | ['s890532395', 's675537335'] | [14508.0, 14252.0] | [124.0, 120.0] | [625, 646] |
p03262 | u424240341 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['import math\nN,X=map(int,input().split(" "))\nx=np.array(list(map(int,input().split(\' \'))))\ny=abs(x-X)\nprint(reduce(math.gcd,y))\n', 'import numpy as np\nfrom functools import reduce\n\ndef euclid(m,n):\n while n:\n m,n=n,m%n\n return m\n\nN,X=map(int,input().split(" "))\nx=np.array(list(map(int, input().split(\' \'))))\ny=abs(x-X)\nprint(reduce(euclid,y))'] | ['Runtime Error', 'Accepted'] | ['s341809845', 's157589698'] | [3060.0, 23068.0] | [18.0, 254.0] | [127, 224] |
p03262 | u427344224 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['H, W = map(int, input().split())\nN = 0\na_map = []\nfor i in range(H):\n a = list(map(int, input().split()))\n a_map.append(a)\nresult = []\nfor i in range(H):\n for j in range(W):\n if a_map[i][j]%2==1:\n if j < W - 1:\n N += 1\n result.append([i + 1, j + 1, i + 1, j + 2])\n a_map[i][j + 1] += 1;\n a_map[i][j] -= 1;\n elif i < H - 1:\n N += 1;\n result.append([i + 1, j + 1, i + 2, j + 1])\n a_map[i][j] -= 1;\n a_map[i + 1][j] += 1;\nprint(N)\nfor a in result:\n print(a[0], a[1], a[2], a[3])', 'N, X = map(int, input().split())\nx_list = list(map(int, input().split()))\n\nx_list.sort()\ndef gcd(a, b):\n if a >= b:\n return a if b == 0 else gcd(b, a % b)\n else:\n return gcd(b, a)\n\n\nD = abs(X-x_list[0])\nfor i in range(0, N):\n D = gcd(D, abs(x_list[i]-X))\n\nprint(D)\n'] | ['Runtime Error', 'Accepted'] | ['s806970938', 's411529997'] | [14480.0, 15020.0] | [41.0, 136.0] | [636, 289] |
p03262 | u438085259 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['def gcd(a, b):\n\twhile b:\n\t\ta, b = b, a % b\n\treturn a\n\ndef main():\n N,X = (int(i) for i in input().split())\n x=list(map(int,input().split()))\n\n gcd_l = []\n gcd_l.append(abs(X-x[0]))\n\n for i in range(1,N):\n gcd_l.append(abs(x[i-1]-x[i]))\n if N==1:\n ans = gcd_l[0]\n else:\n a = [gcd_l[0],gcd_l[1]]\n ans = gcd(max(a),min(a))\n for n in range(2,len(gcd_l)):\n a = [ans,gcd_l[n]]\n ans = gcd(max(a),min(a))\n print(ans)', 'def gcd(a, b):\n\twhile b:\n\t\ta, b = b, a % b\n\treturn a\n\ndef main():\n N,X = (int(i) for i in input().split())\n x=list(map(int,input().split()))\n\n ans = 0\n gcd_l = []\n gcd_l.append(abs(X-x[0]))\n\n for i in range(1,N):\n gcd_l.append(abs(x[i-1]-x[i]))\n if N==1:\n ans = gcd_l[0]\n else:\n for n in range(1,len(gcd_l)):\n a = [gcd_l[n-1],gcd_l[n]]\n ans = gcd(max(a),min(a))\n print(ans)', 'def gcd(a, b):\n\twhile b:\n\t\ta, b = b, a % b\n\treturn a\n\ndef main():\n N,X = (int(i) for i in input().split())\n x=list(map(int,input().split()))\n\n gcd_l = []\n #gcd_l.append(abs(X-x[0]))\n\n for i in range(0,N):\n gcd_l.append(abs(X-x[i]))\n if N==1:\n ans = gcd_l[0]\n else:\n a = [gcd_l[0],gcd_l[1]]\n ans = gcd(max(a),min(a))\n for n in range(2,len(gcd_l)):\n a = [ans,gcd_l[n]]\n ans = gcd(max(a),min(a))\n print(ans)\n\nmain()'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s076236020', 's318663641', 's881949010'] | [3064.0, 3064.0, 14252.0] | [17.0, 17.0, 116.0] | [489, 443, 493] |
p03262 | u439176910 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['def factor(num):\n tmp = num\n a = 2\n res = {}\n while a * a < num:\n while tmp % a == 0:\n if a in res:\n res[a] += 1\n else:\n res[a] = 1\n tmp /= a\n a+=1\n if tmp > 1:\n res[int(tmp)]=1\n return res\n\nN, X = [int(item) for item in input().split()]\ncities = [int(item) for item in input().split()]\ncities.append(X)\ncities.sort()\nans_dict = factor(cities[1] - cities[0])\nfor i in range(1, N):\n res = factor(cities[i+1] - cities[i])\n set_keys = set(res) & set(ans_dict)\n ans_dict = {key: min(res[key], ans_dict[key]) for key in set_keys}\n\nans = 1\nfor i, j in ans_dict.items():\n ans *= i**j\nprint(ans)', 'def gcd(a,b):\n n, = max(a, b), min(a, b)\n if n % m == 0:\n return m\n else:\n return gcd(m, n%m)\n\nN, X = [int(item) for item in input().split()]\ncities = [int(item) for item in input().split()]\nif N == 1:\n print(abs(cities[0]-X))\n exit()\n\nmod = gcd(abs(cities[0] - X), abs(cities[1] - X))\nfor i in range(2, N):\n mod = gcd(mod, abs(cities[0] - X))\nprint(mod)', 'def gcd(a,b):\n n, m = max(a, b), min(a, b)\n if n % m == 0:\n return m\n else:\n return gcd(m, n%m)\n\nN, X = [int(item) for item in input().split()]\ncities = [int(item) for item in input().split()]\nif N == 1:\n print(abs(cities[0]-X))\n exit()\n\nmod = gcd(abs(cities[0] - X), abs(cities[1] - X))\nfor i in range(2, N):\n mod = gcd(mod, abs(cities[i] - X))\nprint(mod)'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s380126227', 's693723438', 's516598429'] | [14480.0, 14252.0, 14252.0] | [2104.0, 45.0, 116.0] | [635, 367, 369] |
p03262 | u452786862 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['import math\nfrom functools import reduce\n\ndef gcd(*numbers):\n return reduce(function.gcd, numbers)\n\ndef gcd_list(numbers):\n return reduce(function.gcd, numbers)\n\nN, X = map(int, input().split())\nx = list(map(int, input().split()))\nsubX = []\n\nfor x_i in x:\n subX.append(abs(x_i - X))\n\nprint(gcd_list(subX))', 'def gcd(x, y):\n if y == 0:\n return x\n else:\n return gcd(y, x % y)\n\nN, X = map(int, input().split())\nx = list(map(int, input().split()))\nans = abs(x[0] - X)\n\nfor i in range(len(x)):\n ans = gcd(ans, abs(x[i] - X))\n\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s126449919', 's524178087'] | [14584.0, 14252.0] | [68.0, 95.0] | [314, 246] |
p03262 | u473291366 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['N, x = map(int,input().split())\nX = list(map(int,input().split()))\n\nX.append(x)\nX.sort()\n\nans = X[1] - X[0]\nfor i in range(1, N+1):\n t = X[i+1] - X[i]\n if t < ans:\n ans = t\nprint(ans)', 'N, X = map(int,input().split())\nA = list(map(int,input().split()))\n\ndef gcd(a, b):\n if b == 0:\n return a\n else:\n return gcd(b, a % b)\n\nans = abs(A[0]-X)\nfor a in A:\n ans = gcd(ans, abs(a-X))\n\n\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s197707426', 's912073558'] | [14224.0, 14224.0] | [100.0, 91.0] | [196, 226] |
p03262 | u475675023 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['import math\nimport functools import reduce\n\nN,X=map(int,input().split())\ninputcities=list(map(int, input().split()))\ncities=[inputcities[i]-X for i in range(N)]\nD = reduce(math.gcd, cities)\nprint(D)', 'import functools import reduce\nimport math\n\nN,X=map(int,input().split())\ninputcities=list(map(int, input().split()))\ncities=[inputcities[i]-X for i in range(N)]\nD = functools.reduce(math.gcd, cities)\nprint(D)', 'N,X=map(int,input().split())\ninputcities=list(map(int, input().split()))\ncities=list(set([abs(inputcities[i]-X) for i in range(N)]))\nN=len(cities)\ncount=0\nflag=0\nminimum=min(cities)\nfor j in range(minimum+1)[::-1]:\n for i in range(N):\n if cities[i]%j==0:\n count+=1\n else:\n count=0\n i=N\n if count==N:\n print(j)\n flag=1\n break\n if i==N:\n for k in range(2,j)\n if j%k==0:\n j=k\n break\n if flag==1:\n break', 'def gcd(a,b):\n if a < b:\n a,b = b,a\n if a % b == 0:\n return b\n else:\n return gcd(b,(a % b))\n\nN,X=map(int,input().split())\ninputcities=list(map(int, input().split()))\ncities=[abs(inputcities[i]-X) for i in range(N)].sort()\nD=cities[0]\nfor i in range(N):\n D=gcd(D,cities[i])\nprint(D)', 'N,X=map(int,input().split())\ninputcities=list(map(int, input().split()))\ncities=[inputcities[i]-X for i in range(N)]\ncount=0\nminimum=min(cities)\nfor j in range(minimum+1)[::-1]\n for i in range(N):\n if cities[i]%j==0:\n count+=1\n else:\n count=0\n break\n if count==N:\n print(j)\n flag=1\n break\nif flag==1:\n break\n', 'N,X=map(int,input().split())\ninputcities=list(map(int, input().split()))\ncities=set([abs(inputcities[i]-X) for i in range(N)])\nN=len(cities)\ncount=0\nflag=0\nminimum=min(cities)\nfor j in range(minimum+1)[::-1]:\n for i in range(N):\n if cities[i]%j==0:\n count+=1\n else:\n count=0\n break\n if count==N:\n print(j)\n flag=1\n break\n if flag==1:\n break', 'def gcd(a,b):\n if a < b:\n a,b = b,a\n if a % b == 0:\n return b\n else:\n return gcd(b,(a % b))\n \nN,X=map(int,input().split())\ninputcities=list(map(int, input().split()))\ncities=[abs(inputcities[i]-X) for i in range(N)]\ncities.sort()\nD=cities[0]\nfor i in range(N):\n D=gcd(D,cities[i])\nprint(D)'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s054221772', 's482390098', 's754134982', 's770861657', 's785364684', 's994786911', 's367876986'] | [2940.0, 2940.0, 3064.0, 14252.0, 2940.0, 17680.0, 14252.0] | [17.0, 17.0, 17.0, 89.0, 17.0, 77.0, 120.0] | [198, 208, 476, 312, 349, 384, 320] |
p03262 | u478462004 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['def gcd(a, b):\n if a < b:\n a, b = b, a\n if b == 0:\n return a\n c = a % b\n return gcd(b, c)\n \nn,x = map(int,input().split())\nxlist = list(map(int,input().split()))\nans = 0\nfor i in range(n):\n ans = gcd(int(xlist[i]-x),ans)\nprint(ans)', 'def gcd(a, b):\n if a < b:\n a, b = b, a\n if b == 0:\n return a\n c = a % b\n return gcd(b, c)\n \nn,x = map(int,input().split())\nxlist = list(map(int,input().split()))\nans = 0\nfor i in range(n):\n ans = gcd(abs(xlist[i]-x),ans)\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s438502869', 's801686633'] | [14252.0, 15020.0] | [97.0, 89.0] | [261, 261] |
p03262 | u485716382 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ["def gcd(a, b):\n\twhile b:\n\t\ta, b = b, a % b\n\treturn a\n\ndef main():\n N, X = map(int, input().split(' '))\n x_n = list(map(int, input().split(' ')))\n\n x_n = sorted(x_n)\n if len(x_n) == 1:\n print(abs(X-x_n[0]))\n return\n\n # print(N,X)\n # print(x_n)\n x_0 = x_n[0]\n x_n = [n - x_0 for n in x_n]\n \n D = 0\n \n \n for i in range(len(x_n) - 1):\n a = x_n[i]\n b = x_n[i+1]\n # print(a, b)\n max_kouyaku = gcd(a, b)\n if max_kouyaku >= D:\n D = max_kouyaku\n\n print(D)\n return\n\n\n\n\n\nmain()", "from functools import reduce\n\ndef gcds(a, b):\n\twhile b:\n\t\ta, b = b, a % b\n\treturn a\n\ndef gcd(*num):\n return reduce(gcds, *num)\n\ndef main():\n N, X = map(int, input().split(' '))\n x_n = list(map(int, input().split(' ')))\n\n x_n = sorted(x_n)\n x_n = [n - X for n in x_n] \n \n print(abs(gcd(x_n)))\n return\n\nmain()"] | ['Wrong Answer', 'Accepted'] | ['s355056714', 's660646030'] | [14224.0, 14748.0] | [137.0, 107.0] | [571, 358] |
p03262 | u488884575 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['n, x = map(int, input().split())\n\nxlist = list(map(int, input().split()))\nimport fractions\n\nans = xlist[0]\nfor i in xlist[1:]:\n ans = fractions.gcd(ans, i)\n\nprint(ans)\n', 'n, x = map(int, input().split())\n\nxlist = list(map(int, input().split()))\nimport math\n\nans = xlist[0]\nfor i in xlist[1:]:\n ans = math.gcd(ans, i)\n\nprint(ans)\n', 'import math\nn,x = map(int,input().split())\nX = list(map(int,input().split()))\ndiff = []\nfor i in range(n):\n\tdiff.append(abs(X[i]-x))\nres = diff[0]\nfor i in range(1,n):\n\tres = math.gcd(res, diff[i])\nprint(res)\n\n\n'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s127651091', 's205026665', 's988641061'] | [14252.0, 14252.0, 20360.0] | [96.0, 42.0, 90.0] | [171, 161, 211] |
p03262 | u494748969 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['import fractions\nn, x_start = list(map(int, input().split()))\nx = list(map(int, input().split()))\nans = 0\n\nfor i in range(n):\n x[i] = int(abs(x[i] - x_start))\n\nif x_start == 1:\n ans = x[i]\nelse:\n for i in range(n-1):\n ans = fractions.gcd(x[i], x[i+1])\nprint(ans)\n', 'N, X = list(map(int, input().split()))\nx = list(map(int, input().split()))\n\ndef gcd(a, b):\n if a % b == 0:\n return b\n return gcd(b, a % b)\n\nres = 0\nfor i in range(N):\n res = gcd(res, abs(x[i] - X))\n\nprint(res)'] | ['Wrong Answer', 'Accepted'] | ['s677589435', 's920669351'] | [16272.0, 15020.0] | [207.0, 91.0] | [279, 225] |
p03262 | u497285470 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['def gcd(a, b):\n return gcd(b, a % b)\n\n\ninputs = input().strip().split()\n\nN = int(inputs[0])\nX = int(inputs[1])\n\nxi = list(map(lambda x: abs(X - int(x)), input().strip().split()))\n\nif N == 1:\n print(xi[0])\nelse:\n a = xi[0]\n b = xi[1]\n\n nx = gcd(a, b)\n\n for i in range(2, len(xi)):\n nx = gcd(nx, xi[i]) \n\n print(nx)', 'def gcd(a, b):\n if b == 0:\n return a\n return gcd(b, a % b)\n\n\ninputs = input().strip().split()\n\nN = int(inputs[0])\nX = int(inputs[1])\n\nxi = list(map(lambda x: abs(X - int(x)), input().strip().split()))\n\nif N == 1:\n print(xi[0])\nelse:\n a = xi[0]\n b = xi[1]\n\n nx = gcd(a, b)\n\n for i in range(2, len(xi)):\n nx = gcd(nx, xi[i]) \n\n print(nx)'] | ['Runtime Error', 'Accepted'] | ['s106817339', 's050225019'] | [14436.0, 14432.0] | [59.0, 111.0] | [347, 379] |
p03262 | u503228842 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['def gcd(a,b):\n while b!=0:\n a,b = b,b%a\n return a\ndef lcm(a,b):\n return (a*b)//gcd(a,b)\n\nN,X = map(int,input().split())\nx = list(map(int,input().split()))\nx = list(map(lambda q:abs(q-X),x))\n\nfor xx in x:\n ans = gcd(x[0],xx)\nprint(ans)', 'def gcd(a,b):\n while b!=0:\n a,b = b,a%b\n return a\ndef lcm(a,b):\n return (a*b)//gcd(a,b)\n\nN,X = map(int,input().split())\nx = list(map(int,input().split()))\nx = list(map(lambda q:abs(q-X),x))\nans = x[0]\nfor xx in x:\n ans = gcd(ans,xx)\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s246890560', 's544242018'] | [14480.0, 14480.0] | [91.0, 89.0] | [253, 263] |
p03262 | u503901534 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['n, x = map(int,input().split())\nxl = list(map(int,input().split()))\n\nxl.append(x)\nxl.sort()\nsa = []\nonesam = 2000000000\nfor i in range(len(xl)-1):\n one_sa = xl[i+1] - xl[i]\n if one_sa % onesam == 0:\n continue\n \n if onesam > one_sa:\n onesam = one_sa\n \n \nsa.sort()\nsamin = min(sa)\n\nflag = 0\nwhile flag == 0:\n amari = 0\n for i in sa:\n amari += i % samin\n if amari != 0:\n break\n \n if amari == 0:\n flag = 1\n break\n else:\n for j in range(1,samin+1):\n if samin % j == 0:\n samin = samin // j\n break\nprint(samin)\n ', 'n, x = map(int,input().split())\nxl = list(map(int,input().split()))\n\nxl.append(x)\nxl.sort()\n\nonesam = 0\nfor i in range(len(xl)-1):\n one_sa = xl[i+1] - xl[i]\n if onesam == 0:\n onesam = one_sa\n else:\n if one_sa % onesam == 0:\n onesam = one_sa\n continue\n else:\n short,big = min(onesam,one_sa),max(onesam,one_sa)\n if short == 1:\n onesam =1\n break\n \n while big % short != 0:\n for i in range(2,short):\n if short % i == 0:\n short = short // i\n if short == 1:\n onesam = 1\n break\n else:\n onesam = short\nprint(onesam)', 'n, x = map(int,input().split())\nxl = list(map(int,input().split()))\n\nxl.append(x)\nxl.sort()\n\nonesam = 0\n\nif len(xl) == 1:\n print(abs(xl[0] - x))\n exit()\n\nfor i in range(len(xl)-1):\n one_sa = xl[i+1] - xl[i]\n if onesam == 0:\n onesam = abs(one_sa)\n else:\n short,big = min(onesam,one_sa),max(onesam,one_sa)\n if big % short == 0:\n onesam = short\n continue\n else:\n while big % short != 0:\n short = short -1\n# for k in range(2,short+1):\n\n# short = short // k\n# break\n onesam = short\n \nprint(onesam)'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s051432675', 's401850036', 's510466142'] | [14480.0, 14224.0, 14224.0] | [104.0, 2104.0, 1007.0] | [662, 761, 709] |
p03262 | u504836877 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['N,X = map(int, input().split())\nList = [int(x) for x in input().split()]\n\nimport math\nList.append(X)\nList.sort()\n\ndistance = []\nfor i in range(N):\n distance.append(List[i+1]-List[i])\n\nd_min = min(distance)\n\nnum_list = []\n\nc = 1\nwhile c <= math.sqrt(d_min):\n if d_min%c == 0:\n num_list.append(c)\n c += 1\n\nnum_list2 = [1]*len(num_list)\nfor i in range(len(num_list)):\n num_list2[len(num_list)-i-1] = int(d_min/num_list[i])\n\nnum_list = num_list + num_list2\n\n\nj = len(num_list)-1\nc2 = 0\nwhile j >= 0:\n for k in range(len(distance)):\n if distance[k]%num_list[j] == 0:\n c2 += 1\n if c2 == len(distance):\n ans = num_list[j]\n j = 0\n j -= 1\n\nprint(ans,distance,num_list)', 'N,X = map(int, input().split())\nList = [int(x) for x in input().split()]\n\nimport math\nList.append(X)\nList.sort()\n\ndistance = []\nfor i in range(len(List)-1):\n distance.append(List[i+1]-List[i])\n\nd_min = min(distance)\n\nnum_list = []\n\nc = 1\nwhile c <= math.sqrt(d_min):\n if d_min%c == 0:\n num_list.append(c)\n c += 1\n\nnum_list2 = [d_min]*len(num_list)\nfor i in range(len(num_list)):\n num_list2[len(num_list)-i-1] = d_min/num_list[i]\n\nnum_list = num_list + num_list2\n\n\nj = len(num_list)-1\nc2 = 0\nwhile j >= 0:\n for k in range(len(distance)):\n if distance[k]%num_list[j] == 0:\n c2 += 1\n if c2 == len(distance):\n ans = num_list[j]\n j = 0\n j -= 1\n\nprint(ans)', 'N,X = map(int, input().split())\nList = [int(x) for x in input().split()]\n \nimport math\nList.append(X)\nList.sort()\n \ndistance = []\nfor i in range(N):\n distance.append(List[i+1]-List[i])\n \nd_min = min(distance)\n \nnum_list = []\n \nc = 1\nwhile c <= math.sqrt(d_min):\n if d_min%c == 0:\n num_list.append(c)\n c += 1\n \nnum_list2 = [0]*len(num_list)\nfor i in range(len(num_list)):\n num_list2[len(num_list)-i-1] = int(d_min/num_list[i])\n \nnum_list = num_list + num_list2\n\nnum_list.append(d_min)\n\nj = len(num_list)-1\n\nwhile j >= 0:\n c2 = 0\n for k in range(len(distance)):\n if distance[k]%num_list[j] == 0:\n c2 += 1\n if c2 == len(distance):\n ans = num_list[j]\n j = 0\n j -= 1\n \nprint(ans)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s465670987', 's626916011', 's394527188'] | [14484.0, 14480.0, 14100.0] | [151.0, 155.0, 137.0] | [719, 710, 737] |
p03262 | u515952036 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['n,x = map(int, input().split())\ncity = []\nsub = []\ncity = list(map(int, input().split()))\n\nfor i in range(len(city)):\n\tsub.append(abs(x - city[i]))\n\ndef gcd(a,b):\n\tif b == 0:\n\t\treturn a\n\treturn gcd(b, a%b)\n\nfor i in range(1,len(sub)):\n\tans = gcd(sub[i-1], sub[i])\n\nprint(ans)', 'n,x = map(int, input().split())\ncity = []\nsub = []\ncity = list(map(int, input().split()))\n\nfor i in range(len(city)):\n\tsub.append(abs(x - city[i]))\n\ndef gcd(a,b):\n\tif b == 0:\n\t\treturn a\n\treturn gcd(b, a%b)\n\n\nif len(sub) == 1:\n\tprint(sub[0])\nelif len(sub) == 2:\n\tprint(gcd(sub[0],sub[1]))\nelse:\n\tp = gcd(sub[0], sub[1])\n\tfor i in range(2,len(sub)):\n\t\tp = gcd(p,sub[i])\n\tprint(p)'] | ['Runtime Error', 'Accepted'] | ['s116517224', 's760095374'] | [14480.0, 14480.0] | [258.0, 113.0] | [275, 377] |
p03262 | u518042385 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['n,x=map(int,input().split())\nl=list(map(int,input().split()))\ndef gcd(n,m):\n a=max(n,m)\n b=min(n,m)\n while b!=0:\n a,b=b,a%b\n return a\na=abs(l[0]-x)\nfor i in range(l):\n a=gcd(a,abs(l[i]-x))\nprint(a)', 'n,x=map(int,input().split())\nl=list(map(int,input().split()))\ndef gcd(n,m):\n a=max(n,m)\n b=min(n,m)\n while b!=0:\n a,b=b,a%b\n return a\na=abs(l[0]-x)\nfor i in range(n):\n a=gcd(a,abs(l[i]-x))\nprint(a)\n\n'] | ['Runtime Error', 'Accepted'] | ['s143082562', 's061477335'] | [14252.0, 14252.0] | [43.0, 114.0] | [205, 207] |
p03262 | u530335051 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['import fraction\n\nn, x = [int(_) for _ in input().split()]\nx_list = [int(_) - x for _ in input().split()]\nprint(x_list)\n\nx_sorted = sorted(x_list)\n\nx_gaps = [x_sorted[i+1] - x_sorted[i] for i in range(0, n-1)]\n\nresult = x_sorted[0]\nfor i in range(0, n-2):\n if i == 0:\n result = fraction.gcd(x_gaps[0], x_gaps[1])\n else:\n result = fraction.gcd(result, x_gaps[i+1])\n\nprint(result)', 'def gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\n\nn, x = [int(_) for _ in input().split()]\nx_list = [int(_) - x for _ in input().split()]\n\nx_sorted = sorted(x_list)\n\nx_gaps = [x_sorted[i+1] - x_sorted[i] for i in range(0, n-1)]\n\nif len(x_gaps) == 0:\n print(abs(x_sorted[0]))\nelif len(x_gaps) == 1:\n print(gcd(abs(x_list[0]), abs(x_list[1])))\nelse:\n result = x_sorted[0]\n for i in range(0, n-2):\n if i == 0:\n result = gcd(x_gaps[0], x_gaps[1])\n else:\n result = gcd(result, x_gaps[i+1])\n print(result)'] | ['Runtime Error', 'Accepted'] | ['s594316515', 's908048852'] | [3064.0, 14100.0] | [17.0, 138.0] | [397, 567] |
p03262 | u560464565 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\nimport sys\n\ninput = sys.stdin.readline\nn, x = map(int, input().split())\na = input().split()\n\nb = list(map(int, a))\nb.append(x)\nb.sort()\nprint(b)\nminimum = b[1] - b[0]\nfor i in range(n):\n if i <= n - 1:\n if minimum > b[i + 1] - b[i]:\n minimum = b[i + 1] - b[i]\n\nprint(minimum)\n', '#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\nimport sys\n\ninput = sys.stdin.readline\nn, x = map(int, input().split())\na = input().split()\nb = list(map(int, a))\nb.append(x)\nb.sort()\nif len(b) == 2:\n print(b[1] - b[0])\n exit(0)\nc = [abs(a - x) for a in b]\n\n\ndef gcd(a, b):\n while b > 0:\n a, b = b, a % b\n return a\n\n\nans = c[0]\nfor i in range(len(c)):\n ans = gcd(c[i], ans)\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s951111106', 's965378316'] | [17372.0, 18140.0] | [131.0, 122.0] | [344, 405] |
p03262 | u562016607 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['def g(a,b):x=max([a,b]);y=min([a,b]);return g(y,x%y) if x%y else y\nN,X=map(int,input().split());a=[abs(int(i)-X) for i in input().split()];ans=a[0]\nfor i in range(1,N):ans=g(ans,y[i])\nprint(ans)', 'def g(a,b):x=max([a,b]);y=min([a,b]);return g(y,x%y) if x%y else y\nN,X=map(int,input().split());p=[abs(int(i)-X) for i in input().split()];ans=p[0]\nfor i in range(1,N):ans=g(ans,p[i])\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s511830079', 's581916578'] | [14252.0, 14224.0] | [53.0, 126.0] | [194, 194] |
p03262 | u570232767 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['n,x = map(int, input().split())\n\ndef check(n):\n return abs(n - x)\n\ncity = list(map(int, input().split()))\n\ndist = list(map(check, city))\nmin_dist = min(dist)\n\nif n < 2:\n print(min_dist)\n exit()\n\ndists = []\nprev = 0\n\ncity.sort()\nfor pos in city:\n if not prev == 0:\n dists.append(abs(prev - pos))\n prev = pos\n\nfor l in dists:\n if l > min_dist:\n if l % min_dist == 0:\n print(1)\n exit()\n if l < min_dist:\n if min_dist % l == 0:\n print(1)\n exit()\n\nnew_min = min(dists)\n\nif min_dist > new_min and min_dist % new_min == 0:\n print(tmp)\nelif new_min > min_dist and new_min % min_dist == 0:\n print(min_dist)\nelse:\n print(1)\n', 'n,x = map(int, input().split())\ncity = list(map(int, input().split()))\n\ndef gcd(x, y):\n if x > y:\n x,y = y,x\n return gcd(y%x, x) if x else y\n\ncity.append(x)\ncity.sort()\n\ndist = []\nfor i in range(len(city)-1):\n dist.append(abs(city[i]-city[i+1]))\n\nif len(dist) < 2:\n min_dist = dist[0]\nelse:\n min_dist = 0\n for i in range(len(dist)-1):\n if min_dist == 0:\n min_dist = gcd(dist[i], dist[i+1])\n else:\n min_dist = min(min_dist, gcd(dist[i], dist[i+1]))\n\nprint(min_dist)\n'] | ['Wrong Answer', 'Accepted'] | ['s458561058', 's658780052'] | [15248.0, 14480.0] | [131.0, 199.0] | [709, 526] |
p03262 | u576504675 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ["# coding: utf-8\n\n\ndef main():\n n, x = map(int, input().split())\n xi = map(int, input().split())\n\n diffs = []\n for i in xi:\n diffs.append(abs(x - i))\n\n for diff in diffs:\n if diff % min(diffs)) != 0:\n print('1')\n return\n\n print(min(diffs))\n\n\nif __name__ == '__main__':\n main()\n", "# coding: utf-8\n\nfrom functools import reduce\n\n\ndef gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\n\ndef gcd_list(numbers):\n return reduce(gcd, numbers)\n\n\ndef main():\n n, x = map(int, input().split())\n xi = map(int, input().split())\n\n diffs = []\n for i in xi:\n diffs.append(abs(x - i))\n\n print(gcd_list(diffs))\n\n\nif __name__ == '__main__':\n main()\n"] | ['Runtime Error', 'Accepted'] | ['s997537187', 's662322193'] | [2940.0, 14596.0] | [17.0, 77.0] | [333, 390] |
p03262 | u580806822 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['def gcd(x,y):\n if x%y==0:\n return y\n else:\n return gcd(y, x%y)\n\n[n,m]=[int(i) for i in input().split()]\nx=[int(i)-m for i in input().split()]\nx.append(0)\n\nli=[]\nf=1\nif n==1:\n f=0\n print(abs(x[0]-x[1]))\n\nfor i in range(len(x)-1):\n li.append(abs(x[i]-x[i+1]))\ntemp=abs(min(x))\nli.append(temp)\ntry:\n x.remove(temp)\nexcept:\n x.remove(-temp)\ntemp=abs(min(x))\nli.append(temp)\n\n\n\nif f:\n for i in range(len(li)-1):\n a=li[0]\n a=gcd(a, li[i+1])\n print(a)\n', 'def gcd(x,y):\n if x%y==0:\n return y\n else:\n return gcd(y, x%y)\n\n[n,m]=[int(i) for i in input().split()]\nx=[int(i)-m for i in input().split()]\nx.append(0)\n\nli=[]\nf=1\nif n==1:\n f=0\n print(abs(x[0]-x[1]))\n\nfor i in range(len(x)-1):\n li.append(max(abs(x[i]-x[i+1]), (abs(x[i+1]-x[i]))))\ntemp=abs(min(x))\nli.append(temp)\n\n\nif f:\n a=li[0]\n for i in range(len(li)-1):\n a=gcd(a, li[i+1])\n print(a)\n'] | ['Runtime Error', 'Accepted'] | ['s742769090', 's502576226'] | [14480.0, 14480.0] | [352.0, 164.0] | [512, 447] |
p03262 | u603234915 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['def gcd(A, B):\n while B != 0:\n A, B = B, A%B\n return A\nN, X = map(int, input().split())\nx = [abs(int(i) - X) for i in input().split()] \ny = x[0]\nfor i in range(N):\n if x[i] % y == 0:\n continue\n y = gcd(y, x[i])\nprint(min(gcd_x))', 'def gcd(A, B):\n while B != 0:\n A, B = B, A%B\n return A\nN, X = map(int, input().split())\nx = [abs(int(i) - X) for i in input().split()] \ny = x[0]\nfor i in range(N):\n if x[i] % y == 0:\n continue\n y = gcd(y, x[i])\nprint(y)'] | ['Runtime Error', 'Accepted'] | ['s750215141', 's323150440'] | [14252.0, 14224.0] | [70.0, 69.0] | [254, 245] |
p03262 | u609814378 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['import sys\nimport math\n\n\nN, X = map(int, input().split())\nA = list(map(int, input().split()))\n\nif N == 1:\n print(A[0]-X)\n sys.exit()\n\nA.append(X)\nA = sorted(A)\n\nanslis = [0]*N\n\nfor i in range(N):\n anslis[i] = A[i+1] - A[i]\n\ng = anslis.pop(0)\nfor c in cost_li:\n g = math.gcd(g,c)\n\nprint(g)', 'import sys\nimport math\n\n\nN, X = 3,3\nA = [1,7,11]\n\nif N == 1:\n print(A[0]-X)\n sys.exit()\n\nA.append(X)\nA = sorted(A)\n\nanslis = [0]*N\n\nfor i in range(N):\n anslis[i] = A[i+1] - A[i]\n\ng = anslis.pop(0)\nfor c in cost_li:\n g = math.gcd(g,c)\n\nprint(g)', 'import sys\nimport math\n\n\nN, X = map(int, input().split())\nA = list(map(int, input().split()))\n\nA.append(X)\nA = sorted(A)\n\nanslis = [0]*N\nfor i in range(N):\n anslis[i] = A[i+1] - A[i]\n\ng = anslis.pop(0)\nfor c in anslis:\n g = math.gcd(g,c)\n\nprint(g)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s032717413', 's486802790', 's622550142'] | [20528.0, 9132.0, 20396.0] | [84.0, 25.0, 98.0] | [300, 255, 253] |
p03262 | u613920660 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['N,X=map(int,input().strip().split())\nx=list(map(int,input().strip().split()))\n\nx.sort()\n\nd=[]\nfor n in range(1,N):\n d.append(x[n]-x[n-1])\n\ndef gcd(a,b):\n x=max(a,b)\n y=min(a,b)\n tmp=x%y\n if tmp==0:\n return y\n else:\n gcd(y,tmp)\n\nif len(d)==0:\n print(abs(x[0]-X))\nelse:\n D=d[0]\n for i in range(1,len(d)):\n D=gcd(D,d[i])\n print(D)', 'N,X=map(int,input().strip().split())\nx=list(map(int,input().strip().split()))\nx.append(X)\nx.sort()\n \nd=[]\nfor n in range(1,N+1):\n d.append(x[n]-x[n-1])\n \ndef gcd(a,b):\n x=max(a,b)\n y=min(a,b)\n tmp=x%y\n if tmp==0:\n return y\n else:\n return gcd(y,tmp)\n \nif len(d)<=1:\n print(d[0])\nelse:\n D=d[0]\n for i in range(1,len(d)):\n D=gcd(D,d[i])\n print(D)'] | ['Runtime Error', 'Accepted'] | ['s739965933', 's493865002'] | [20140.0, 19964.0] | [140.0, 134.0] | [378, 403] |
p03262 | u619718416 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ["n, place = [int(x) for x in input().split(' ')]\ncity_address = [int(x) - place for x in input().split(' ')]\n\ndef gcd(x, y):\n\tif y == 0:\n return x\n else:\n return gcd(y, x % y)\n\nanswer = city_address[0]\nfor address in city_address:\n\tanswer = gcd(answer, address)\n\nprint(answer)", "n, place = [int(x) for x in input().split(' ')]\ncity_address = sorted([abs(int(x) - place) for x in input().split(' ')], reverse=True)\nprint(city_address)\ndef gcd(x, y):\n if y == 0:\n return x\n else:\n return gcd(y, x % y)\n \nanswer = city_address[0]\nfor address in city_address:\n\tanswer = gcd(answer, address)\n \nprint(answer)", "n, place = [int(x) for x in input().split(' ')]\ncity_address = sorted([abs(int(x) - place) for x in input().split(' ')], reverse=True)\ndef gcd(x, y):\n if y == 0:\n return x\n else:\n return gcd(y, x % y)\n\nanswer = city_address[0]\nfor address in city_address:\n\tanswer = gcd(answer, address)\n\nprint(answer)"] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s447874624', 's477148903', 's481483456'] | [2940.0, 14252.0, 14252.0] | [17.0, 143.0, 132.0] | [292, 343, 321] |
p03262 | u620846115 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['n,x=map(int,input().split())\nxlist= list(map(int,input().split()))\nxlist.append(x)\nxsort = sorted(xlist, reverse=True)\nif n == 1:\n print(xsort[0]-xsort[1])\n exit()\nylist = []\nfor i in range(n-1):\n ylist.append(xsort[i]-xsort[i+1])\nfrom functools import reduce\nfrom math import gcd\nprint(reduce(gcd,ylist))', 'n,x=map(int,input().split())\nxlist= list(map(int,input().split()))\nxlist.append(x)\nxsort = sorted(xlist, reverse=True)\nylist = []\nfor i in range(n-1):\n ylist.append(xsort[i]-xsort[i+1])\nfrom functools import reduce\nfrom math import gcd\nprint(reduce(gcd,ylist))', 'n,x=map(int,input().split())\nxlist= list(map(int,input().split()))\nif n == 1:\n print(abs(xlist[0]-x))\n exit()\nylist = []\nfor i in range(n):\n ylist.append(abs(xlist[i]-x))\nfrom functools import reduce\nfrom math import gcd\nprint(reduce(gcd,ylist))'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s353022402', 's773517179', 's487282541'] | [20020.0, 20032.0, 20020.0] | [104.0, 107.0, 84.0] | [308, 261, 248] |
p03262 | u626891113 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['n, X = map(int, input().split())\nx = list(map(abs, [i-X for i in list(map(int, input().split()))]))\nx.sort()\nans = 1\nif x[0] == 0:\n del x[0]\n n -= 1\nif n == 1:\n ans = x[0]\nelif min(x) != 1:\n for i in range(2, min(x)):\n go = True\n while go:\n go = False\n cnt = 0\n for j in x:\n if j%i == 0:\n cnt += 1\n if cnt == n:\n ans *= i\n go = True\n for j in range(n):\n x[j] //= i\n else:\n break\nprint(ans)', 'n, X = map(int, input().split())\nx = list(map(abs, [i-X for i in list(map(int, input().split()))]))\nx.sort()\nif x[0] == 0:\n del x[0]\n n -= 1\ndef gcd(a, b):\n while True:\n c = a%b\n if c == 0:\n break\n a = b\n b = c\n return b\n\nif n == 1:\n ans = x[0]\nelse:\n for i in range(1, n):\n x[i] = gcd(x[i], x[i - 1])\n ans = x[-1]\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s631423375', 's362307104'] | [20140.0, 20060.0] | [2206.0, 101.0] | [583, 392] |
p03262 | u636311816 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['n,x=map(int,input().split())\npos=list(map(int,input().split()))\npos2=[abs(p-x) for p in pos]\ndef make_divisor_list(num):\n if num < 1:\n return []\n elif num == 1:\n return [1]\n else:\n divisor_list = []\n divisor_list.append(1)\n for i in range(2, num // 2 + 1):\n if num % i == 0:\n divisor_list.append(i)\n divisor_list.append(num)\n \n return divisor_list\n\nif n==1: ans=pos2[0]\nelse:\n minpos= min(pos2)\n divs=make_divisor_list(minpos)[::-1]\n if divs[0]==1:ans=1\n else:\n for j in divs:\n if all(x%j==0 for x in pos2):\n ans=j\n break\nprint(ans)', 'import math\n#n,x=map(int,input().split())\n#pos=list(map(int,input().split()))\n\nn,x=3,81\npos=[33,105,57]\npos2=[p-x for p in pos]\n\nwidth= max(pos2)-min(pos2)\nans = 1\nfor i in range(2,width+1):\n if all([ x%i==0 for x in pos2 ]):ans=i\n\nprint(ans)', 'n,x=map(int,input().split())\npos=list(map(int,input().split()))\npos2=[abs(p-x) for p in pos]\ndef make_divisor_list(num):\n if num < 1:\n return []\n elif num == 1:\n return [1]\n else:\n divisor_list = []\n divisor_list.append(1)\n for i in range(2, num // 2 + 1):\n if num % i == 0:\n divisor_list.append(i)\n divisor_list.append(num)\n \n return divisor_list\n\nif n==1: ans=pos2[0]\nelse:\n minpos= min(pos2)\n divs=make_divisor_list(minpos)[::-1]\n if divs[0]==1:ans=1\n else:\n for j in divs:\n if all(x%j==0 for x in pos2):\n ans=j\n break\nprint(ans)', 'n,x=map(int,input().split())\npos=list(map(int,input().split()))\npos2=[abs(p-x) for p in pos]\ndef make_divisor_list(num):\n if num < 1:\n return []\n elif num == 1:\n return [1]\n else:\n divisor_list = []\n divisor_list.append(1)\n for i in range(2, num // 2 + 1):\n if num % i == 0:\n divisor_list.append(i)\n divisor_list.append(num)\n \n return divisor_list\n\nif n==1: ans=pos2[0]\nelse:\n minpos= min(pos2)\n divs=make_divisor_list(minpos)[::-1]\n if divs[0]==1:ans=1\n else:\n for j in divs:\n if all(x%j==0 for x in pos2):\n ans=j\n break\nprint(ans)'] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s079974021', 's846188060', 's896915520', 's940887295'] | [3064.0, 3060.0, 3064.0, 14480.0] | [17.0, 17.0, 17.0, 695.0] | [664, 245, 684, 676] |
p03262 | u657818166 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['import math\nfrom functools import reduce\n\n\ndef gcd_list(numbers):\n return reduce(math.gcd, numbers)\nn,x=map(int,input().split())\nl=[abs(c-x) for c in list(map(int,input().split()))]\ndel l[l.index(0)]\nprint(gcd_list(l) if len(l)>1 else l[0])', 'from functools import reduce\ndef gcd(a,b):\n while b:\n a,b=b,a%b\n return a\ndef solve(lis,x):\n ans=abs(lis[0]-x)\n lis=[abs(c-x) for c in lis]\n for x in lis:\n if x!=0:\n ans=gcd(ans,x)\n return ans \nn,x=map(int,input().split())\nl=list(map(int,input().split()))\nprint(solve(l,x))\n'] | ['Runtime Error', 'Accepted'] | ['s402668834', 's248692493'] | [14604.0, 14596.0] | [58.0, 77.0] | [243, 329] |
p03262 | u665038048 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['N, X = map(int, input().split())\nx = list(map(int, input().split()))\nx_gcd = []\nfor i in range(N):\n x_gcd.append(abs(X-x[i]))\n\n\ndef gcd(a, b):\n while b != 0:\n a, b = b, a%b\n return a\nans = [0]*(N-1)\n\nfor i in range(N-1):\n ans[i] = gcd(x_gcd[i], x_gcd[i+1])\nif ans:\n print(max(ans))\nelse:\n print(x[0] - X)', 'N, X = map(int, input().split())\nx = list(map(int, input().split()))\nx_gcd = []\nfor i in range(N):\n x_gcd.append(X-x[i])\n\n\ndef gcd(a, b):\n while b != 0:\n a, b = b, a%b\n return a\nans = [0]*(N-1)\n\nfor i in range(N-1):\n ans[i] = gcd(x_gcd[i], x_gcd[i+1])\nif ans:\n print(max(ans))\nelse:\n print(x[0] - X)', 'N, X = map(int, input().split())\nx = list(map(int, input().split()))\nx_gcd = []\nfor i in range(N):\n x_gcd.append(abs(X-x[i]))\n\n\ndef gcd(a, b):\n while b != 0:\n a, b = b, a%b\n return a\nans = [0]*(N-1)\n\nfor i in range(N-1):\n ans[i] = gcd(x_gcd[i], x_gcd[i+1])\nif ans:\n print(max(ans))\nelse:\n print(x[0] - X)', 'N, X = map(int, input().split())\nx = list(map(int, input().split()))\nx_gcd = []\nfor i in range(N):\n x_gcd.append(abs(X-x[i]))\n\n\ndef gcd(a, b):\n while b != 0:\n a, b = b, a%b\n return a\n\n\nans = x_gcd[0]\nfor i in range(N):\n ans = gcd(ans, x_gcd[i])\nif ans:\n print(ans)\nelse:\n print(x[0] - X)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s183003908', 's620502626', 's726917173', 's956896234'] | [15036.0, 15028.0, 15016.0, 14252.0] | [193.0, 199.0, 197.0, 104.0] | [329, 324, 329, 312] |
p03262 | u667458133 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['from fraction import gcd\nfrom functools import reduce\n\nN, X = map(int, input().split())\nx = list(map(int, input().split()))\nx.append(X)\nx.sort()\narray = []\nfor i in range(N-1):\n array.append(x[i+1]-x[i])\n\nif len(array) > 1:\n result = reduce(gcd, array)\nelse:\n result = array[0]\nprint(result)\n', 'def gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\nN, X = map(int, input().split())\nx = list(map(int, input().split()))\nx.append(X)\nx.sort()\narray = []\nfor i in range(N):\n array.append(x[i+1]-x[i])\n\nif len(array) > 1:\n result = gcd(array[0], array[1])\n for i in range(2, len(array)):\n result = gcd(result, array[i])\nelse:\n result = array[0]\n \nprint(result)\n'] | ['Runtime Error', 'Accepted'] | ['s736120750', 's568004892'] | [3060.0, 14224.0] | [19.0, 141.0] | [301, 394] |
p03262 | u673338219 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['import fraction\nfrom functools import reduce\n\nn,X = map(int,input().split())\nx =list(map(int,input().split()))\nx.append(X)\nx.sort()\na = []*n\nfor i in range(n):\n a[i] = x[i+1]-x[i]\n \ng = gcd(*a)\nprint(g)\n\n', 'n,X = map(int,input().split())\nx =list(map(int,input().split()))\nx.append(X)\nx.sort()\na = []\nfor i in range(n):\n a.append(x[i+1]-x[i])\n \ng = []\nh = min(a)\nfor i in range(1,h+1):\n if h%i == 0:\n g.append(i)\n \ngcd = []\nfor i in g:\n if all(a[j]%i == 0 for j in range(n)):\n gcd.append(g)\n \nprint(max(gcd))\n \n \n \n\n\n', 'n,X = map(int,input().split())\nx =list(map(int,input().split()))\nx.append(X)\nx.sort()\na = []\nfor i in range(n):\n a.append(x[i+1]-x[i])\n \nh = min(a)\ngcd = 1\nfor i in range(h,0,-1):\n if h%i == 0:\n if all(a[j]%i == 0 for j in range(n)):\n gcd = i\n break\n \nprint(gcd)\n \n\n \n \n \n\n\n gcd = i\n break\n \n \nprint(gcd)\n \n \n \n\n\n', 'n,X = map(int,input().split())\nx =list(map(int,input().split()))\nx.append(X)\nx.sort()\na = []\nfor i in range(n):\n a.append(x[i+1]-x[i])\n \ng = []\nh = min(a)\ngcd = 1\nfor i in range(h,0,-1):\n if h%i == 0:\n if all(a[j]%i == 0 for j in range(n)):\n gcd = i\n break\n \nprint(gcd)\n \n\n \n \n \n\n\n gcd = i\n break\n \n \nprint(gcd)\n \n \n \n\n\n', 'n,X = map(int,input().split())\nx =list(map(int,input().split()))\nx.append(X)\nx.sort()\na = []\nfor i in range(n):\n a.append(x[i+1]-x[i])\n \nh = min(a)\ngcd = 1\nfor i in range(h,0,-1):\n if h%i == 0:\n if all(a[j]%i == 0 for j in range(n)):\n gcd = i\n break\n \nprint(gcd)\n \n \n\n\n'] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s145671448', 's390825922', 's714315405', 's869722451', 's316864760'] | [3060.0, 14224.0, 3064.0, 3064.0, 14252.0] | [18.0, 2104.0, 17.0, 17.0, 122.0] | [206, 330, 363, 370, 292] |
p03262 | u677440371 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['n,x = map(int,input().split())\nx_list = list(map(int,input().split()))\nx_list.append(x)\nx_list = sorted(x_list)\na = []\nfor i in range(n):\n b = x_list[i+1]-x_list[i]\n a.append(b)\nprint(a)', 'n,x = map(int,input().split())\nx_list = list(map(int,input().split()))\nx_list.append(x)\nx_list = sorted(x_list)\na = []\nfor i in range(n):\n b = x_list[i+1]-x_list[i]\n a.append(b)\nimport math\nfrom functools import reduce\nprint(a)', 'n,x = map(int,input().split())\nx_list = list(map(int,input().split()))\nx_list.append(x)\nx_list = sorted(x_list)\na = []\nfor i in range(n):\n b = x_list[i+1]-x_list[i]\n a.append(b)\nimport math\nfrom functools import reduce\ndef gcd(a, b):\n while b:\n a, b = b, a % b\n return a\nans = reduce(gcd, a)\nprint(int(ans))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s058952292', 's750978169', 's354270844'] | [14224.0, 14252.0, 14228.0] | [113.0, 123.0, 135.0] | [192, 233, 326] |
p03262 | u677705680 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['from functools import reduce\n\nN, X = map(int, input().split())\nx_list = list(map(int, input().split()))\n\nif X not in x_list:\n x_list.append(X).sort()\n N += 1 \n\ndef gcd(x, y):\n if y == 0:\n return x\n else:\n return gcd(y, x % y)\n\nif N >= 3:\n space = [abs(x_list[i + 1] - x_list[i]) for i in range(N - 1)]\n print(reduce(gcd, space))\nelif N == 2:\n space = x_list[1] - x_list[0]\n print(space)\nelif N == 1:\n space = x_list[0]\n print(space)\n\n\n\n\n', 'from functools import reduce\n\nN, X = map(int, input().split())\nx_list = list(map(int, input().split()))\n\nif X not in x_list:\n x_list.append(X)\n x_list.sort()\n N += 1 \n\ndef gcd(x, y):\n if y == 0:\n return x\n else:\n return gcd(y, x % y)\n\nif N >= 3:\n space = [abs(x_list[i + 1] - x_list[i]) for i in range(N - 1)]\n print(reduce(gcd, space))\nelif N == 2:\n space = x_list[1] - x_list[0]\n print(space)\nelif N == 1:\n space = x_list[0]\n print(space)\n\n\n\n\n'] | ['Runtime Error', 'Accepted'] | ['s987476539', 's068800172'] | [14596.0, 14596.0] | [49.0, 136.0] | [484, 495] |
p03262 | u698771758 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['def gcd(x,y):\n if y>x:\n a=y\n y=x\n x=a\n a=1\n while a*y:\n a=x%y\n x=y\n y=a\n return x\n\na,b=map(int,input().split())\nc=list(map(int,input().split()))\nc.append(b)\nc.sort()\nfor i in range(a):\n c[-1-i]-=c[-2-i]\nc[0]=0\nfor i in range(a):\n b=gcd(c[i],c[i+1])\nprint(b)', 'def gcd(x,y):\n if y>x:\n a=y\n y=x\n x=a\n while y:\n a=x%y\n x=y\n y=a\n return x\n\na,b=map(int,input().split())\nc=list(map(int,input().split()))\nc.append(b)\nc.sort()\nfor i in range(a):\n c[-1-i]-=c[-2-i]\nb=0\nfor i in range(a):\n b=gcd(c[i+1],b)\nprint(b)'] | ['Wrong Answer', 'Accepted'] | ['s911927276', 's767207002'] | [14228.0, 14252.0] | [169.0, 134.0] | [317, 301] |
p03262 | u700806147 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['from numpy import gcd\n\nn, x0 = map(int, input().split())\nx = list(map(int, input().split())) + [x0]\n\nx.sort()\ndiff_x = [x[i+1] - x[i] for i in range(n-1)]\nans = 1\nfor x_i in x:\n ans = int(gcd(ans, x_i))\n\nprint(ans)\n', 'def gcd(a, b):\n m, n = max(a,b), min(a,b)\n while n != 0:\n m, n = n, m%n\n return m\n\nn, x0 = map(int, input().split())\nx = list(map(int, input().split())) + [x0]\n\nx = list(set(x))\nx.sort()\nif len(x) >= 3:\n diff_x = [x[i+1] - x[i] for i in range(n)]\n ans = diff_x[0]\n for dx in diff_x[1:]:\n ans = int(gcd(ans, dx))\nelif len(x) == 2:\n ans = x[1] - x[0]\n\n\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s382694816', 's119114117'] | [21796.0, 14480.0] | [1231.0, 182.0] | [218, 396] |
p03262 | u705621008 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['n, x = map(int, input().split())\nl = list(map(int, input().split()))\n\ndef gcd(x, y):\n while (y != 0):\n x, y = y, x%y\n\n return x\n\ndiff = []\n\nfor j in l:\n diff.append(abs(j - x))\n\nans = diff[0]\n\nfor d in range(d[1:]):\n ans = gcd(ans, d)\n\nprint(ans)\n\n', 'n, x = map(int, input().split())\nl = list(map(int, input().split()))\n\ndef gcd(x, y):\n while (y != 0):\n x, y = y, x%y\n\n return x\n\nans = abs(l[0] - x)\n\nfor d in l[1:]:\n ans = gcd(ans, abs(d - x))\n\nprint(ans)\n'] | ['Runtime Error', 'Accepted'] | ['s135664294', 's081587454'] | [14224.0, 15020.0] | [60.0, 84.0] | [267, 222] |
p03262 | u707870100 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['# -*- coding: utf-8 -*-\n#ABC109C\nimport sys\n\ndef gcd(a, b):\n\twhile b:\n\t\ta, b = b, a % b\n\treturn a\n\ntmp = input().split()\nhoge = list(map(lambda a: int(a), tmp))\nn=hoge[0]\nx=hoge[1]\n\ntmp = input().split()\nhoge = list(map(lambda a: int(a), tmp))\n\nres = abs(x-hoge[0])\nprint(res)\nfor i in range(1,n):\n\tres=gcd(res, abs(hoge[i]-hoge[i-1]))\nprint(res)\n', '# -*- coding: utf-8 -*-\n#ABC109C\nimport sys\n\ndef gcd(a, b):\n\twhile b:\n\t\ta, b = b, a % b\n\treturn a\n\ntmp = input().split()\nhoge = list(map(lambda a: int(a), tmp))\nn=hoge[0]\nx=hoge[1]\n\ntmp = input().split()\nhoge = list(map(lambda a: int(a), tmp))\n\nres = abs(x-hoge[0])\nfor i in range(1,n):\n\tres=gcd(res, abs(hoge[i]-hoge[i-1]))\nprint(res)'] | ['Wrong Answer', 'Accepted'] | ['s981100526', 's152223191'] | [14480.0, 14480.0] | [97.0, 101.0] | [347, 335] |
p03262 | u711295009 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['list1 = list(map(int, input().split()))\nn = list1[0]\nx = list1[1]\nlist2 = list(map(int, input().split()))\nlist2.append(x)\nlist2.sort()\n\nlist3 = []\nlist4 = []\nlength = len(list2)\nindex =1\nwhile index < length:\n if list2[index] ==x or list2[index-1]==x:\n list4.append(list2[index]-list2[index-1])\n else:\n list3.append(list2[index]-list2[index-1])\n index+=1\nlist3.append(max(list4))\nlist3.append(min(list4)+max(list4))\n\nlist3.sort()\nmimN = list3[0]\nans =0\nindex2 =mimN\nif len(list3) ==1:\n print(mimN)\nelse:\n flag2 =0\n for number in list3:\n if number%mimN !=0:\n flag2 =1\n if flag2 ==0:\n print(mimN)\n else:\n while index2>=1:\n flag=0\n for number in list3:\n if number%index2 ==0:\n flag =1\n else:\n flag =0\n if flag ==1:\n ans = index2\n break\n else:\n index2-=1\n \n print(ans)', 'list1 = list(map(int, input().split()))\nn = list1[0]\nx = list1[1]\nlist2 = list(map(int, input().split()))\nlist2.append(x)\nlist2.sort()\n\nlist3 = []\nlist4 = []\nlength = len(list2)\nindex =1\nwhile index < length:\n list3.append(list2[index]-list2[index-1])\n index+=1\n\nlist3.sort()\nmimN = list3[0]\nans =0\nindex2 =mimN\nif len(list3) ==1:\n print(mimN)\nelse:\n flag2 =0\n for number in list3:\n if number%mimN !=0:\n flag2 =1\n if flag2 ==0:\n print(mimN)\n else:\n while index2>=1:\n flag=0\n for number in list3:\n if number%index2 ==0:\n flag =1\n else:\n flag =0\n break\n if flag ==1:\n ans = index2\n break\n else:\n index2-=1 \n print(ans)'] | ['Wrong Answer', 'Accepted'] | ['s067432001', 's053008261'] | [14480.0, 14480.0] | [2103.0, 240.0] | [1007, 856] |
p03262 | u720483676 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['n,x=map(int,input().split())\na=sorted(list(map(int,input().split())))\nb=[a[i+1]-a[i]for i in range(n-1)]\nb.insert(0,a[0]-x)\n\ndef search_common_divisor(x,y):\n if x<y:\n x,y=y,x\n while y!=0:\n x,y=y,x%y\n return x\n\ndef search_list_common_divisor(*numbers):\n b=[search_common_divisor(numbers[0],numbers[1])]\n for i in numbers:\n b.append(search_common_divisor(b[-1],i))\n return b[-1]\n\n\nif n!=1:\n print(search_list_common_divisor(*b))\nelse:\n print(b[0])\n', 'n,x=map(int,input().split())\na=sorted(list(map(int,input().split())))\nb=[a[i+1]-a[i]for i in range(n-1)]\nb.insert(0,abs(a[0]-x))\n\ndef search_common_divisor(x,y):\n if x<y:\n x,y=y,x\n while y!=0:\n x,y=y,x%y\n return x\n\ndef search_list_common_divisor(*numbers):\n b=[search_common_divisor(numbers[0],numbers[1])]\n for i in numbers:\n b.append(search_common_divisor(b[-1],i))\n return b[-1]\n\n\nif n!=1:\n print(search_list_common_divisor(*b))\nelse:\n print(b[0])\n'] | ['Wrong Answer', 'Accepted'] | ['s781824249', 's625897369'] | [14252.0, 14480.0] | [127.0, 125.0] | [491, 496] |
p03262 | u737877067 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ["def gcd(a,b):\n if b == 0:\n return a\n return gcd(b, a %b)\n\ndef main():\n n, x = map(int, input().split())\n a = [int(v) for v in input().split(' ')]\n a.append(x)\n a.sort()\n dis = [x2 - x1 for x1, x2 in zip(a, a[1:])]\n max_ = 0\n for i in range(n):\n if len(dis) == 1:\n max_ = dis[0]\n break\n try:\n g = max([gcd(d1, d2) for d1, d2 in zip(dis[i:], dis[i+1:])])\n except ValueError:\n break\n if g > max_:\n max_ = g\n print(max_)\n\nif __name__ == '__main__':\n main()\n", "import math\n\ndef main():\n n, x = map(int, input().split())\n a = [int(v) for v in input().split(' ')]\n a.append(x)\n a.sort()\n dis = [x2 - x1 for x1, x2 in zip(a, a[1:])]\n max_ = 0\n for i in range(n):\n if len(dis) == 1:\n max_ = dis[0]\n break\n try:\n g = max([math.gcd(d1, d2) for d1, d2 in zip(dis[i:], dis[i+1:])])\n except ValueError:\n break\n if g > max_:\n max_ = g\n print(max_)\n\nif __name__ == '__main__':\n main()\n", "def gcd(a,b):\n if a < b:\n a, b = b, a\n if b == 0:\n return a\n return gcd(b, a %b)\n\ndef gcdlist(l):\n if len(l) == 2:\n return gcd(l[0], l[1])\n f = l.pop()\n s = l.pop()\n m = gcd(f, s)\n l.append(m)\n return gcdlist(l)\n\n\ndef main():\n n, x = map(int, input().split())\n a = [int(v) for v in input().split(' ')]\n a.append(x)\n a.sort()\n dis = [x2 - x1 for x1, x2 in zip(a, a[1:])]\n max_ = 0\n for i in range(n):\n if len(dis) == 1:\n max_ = dis[0]\n break\n try:\n max_ = gcdlist(dis)\n except:\n max_ = 1\n print(max_)\n\nif __name__ == '__main__':\n main()\n"] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s431188612', 's883335082', 's778436189'] | [15900.0, 14252.0, 14224.0] | [2104.0, 91.0, 258.0] | [576, 523, 676] |
p03262 | u740284863 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['from fractions import gcd\nn,x = map(int,input().split())\nl = list(map(int,input().split()))\nll = []\nfor i in range(n-1):\n ll.append(l[i+1]-l[i])\nans = ll[0]\nfor i in range(len(ll)):\n ans = gcd(ans,ll[i])\nprint(ans)', 'from functools import reduce\ndef gcd_list(n):\n return reduce(gcd, n)\ndef gcd(a, b):\n if b == 0:\n return a\n return gcd(b, a % b)\n\nn,x = map(int,input().split())\na = list(map(int, input().split())) + [x]\na.sort()\nb = []\nfor i in range(n):\n b.append(a[i+1]-a[i])\nprint(gcd_list(b))'] | ['Runtime Error', 'Accepted'] | ['s394434693', 's005481045'] | [16284.0, 14596.0] | [127.0, 141.0] | [220, 297] |
p03262 | u757919796 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | [" def euclid(a, b):\n if a < b:\n a, b = (b, a)\n \n while True:\n r = a % b\n if r == 0:\n break\n a, b = (b, r)\n \n return b\n \n \n if __name__ == '__main__':\n n, x = tuple(map(int, input().split()))\n points = [int(x) for x in input().split()]\n if not x in points:\n points.append(x)\n \n buf = [abs(points[i + 1] - points[i]) for i in range(len(points) - 1)]\n while len(buf) > 1:\n buf = [euclid(buf[i + 1], buf[i]) for i in range(len(buf) - 1)]\n \n print(buf[0])", "def euclid(a, b):\n if a < b:\n a, b = (b, a)\n\n while True:\n r = a % b\n if r == 0:\n break\n a, b = (b, r)\n\n return b\n\n\nif __name__ == '__main__':\n n, x = tuple(map(int, input().split()))\n points = [int(x) for x in input().split()]\n if not x in points:\n points.append(x)\n\n buf = [abs(points[i + 1] - points[i]) for i in range(len(points) - 1)]\n while len(buf) > 1:\n print(buf)\n buf = [euclid(buf[i + 1], buf[i]) for i in range(len(buf) - 1)]\n\n print(buf[0])\n", "from functools import reduce\n\ndef euclid(a, b):\n if a < b:\n a, b = (b, a)\n\n while True:\n r = a % b\n if r == 0:\n break\n a, b = (b, r)\n\n return b\n\n\nif __name__ == '__main__':\n n, x = tuple(map(int, input().split()))\n points = [int(x) for x in input().split()]\n if not x in points:\n points.append(x)\n\n buf = [abs(points[i + 1] - points[i]) for i in range(len(points) - 1)]\n print(reduce(lambda a,b: euclid(a, b), bur))\n", "from functools import reduce\n\ndef euclid(a, b):\n if a < b:\n a, b = (b, a)\n\n while True:\n r = a % b\n if r == 0:\n break\n a, b = (b, r)\n\n return b\n\n\nif __name__ == '__main__':\n n, x = tuple(map(int, input().split()))\n points = [int(x) for x in input().split()]\n if not x in points:\n points.append(x)\n\n buf = [abs(points[i + 1] - points[i]) for i in range(len(points) - 1)]\n print(reduce(lambda a,b: euclid(a, b), buf))\n"] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s246896506', 's411898669', 's533580841', 's360912406'] | [2940.0, 49240.0, 14748.0, 14748.0] | [17.0, 2104.0, 70.0, 92.0] | [623, 541, 486, 486] |
p03262 | u759651152 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ["#-*-coding:utf-8-*-\n\ndef main():\n n, x = map(int, input().split())\n x_list = list(map(int, input().split()))\n if n == 1:\n print(abs(x_list[0] - x))\n exit()\n x_list.append(x)\n x_list.sort()\n diff = []\n for i in range(1, n):\n print('aaaa')\n diff.append(x_list[i] - x_list[i - 1])\n print(min(diff))\n\nif __name__ == '__main__':\n main()", "#-*-coding:utf-8-*-\nfrom functools import reduce\n\ndef gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\ndef gcd_list(numbers):\n return reduce(gcd, numbers)\n\ndef main():\n n, x = map(int, input().split())\n x_list = list(map(int, input().split()))\n x_list.append(x)\n x_list.sort()\n diff = []\n for i in range(n):\n diff.append(x_list[i + 1] - x_list[i])\n print(gcd_list(diff))\n\nif __name__ == '__main__':\n main()"] | ['Wrong Answer', 'Accepted'] | ['s371775977', 's913362229'] | [15020.0, 14596.0] | [155.0, 116.0] | [386, 453] |
p03262 | u777922433 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['def gcd(a,b):\n while b:\n a,b=b,a%b\n return a\n\nN,X=[int(i) for i in input().split()]\na=input().split()\nx=[]\nfor i in range(N):\n x.append(int(a[i]))\nif(N==1):\n print(abs(x[0]-X))\n exit()\nx=list(map(lambda y:abs(y-X) , x))\nx.sort()\nprint(math.gcd(x[0],x[1]))\n', 'def gcd(a,b):\n while b:\n a,b=b,a%b\n return a\n\nN,X=[int(i) for i in input().split()]\na=input().split()\nx=[]\nfor i in range(N):\n x.append(int(a[i]))\nif(N==1):\n print(abs(x[0]-X))\n exit()\nx=list(map(lambda y:abs(y-X) , x))\nans=gcd(x[0],x[1])\nfor i in range(2:N):\n ans=gcd(x[i],ans)\n \nprint(ans)\n', 'def gcd(a,b):\n while b:\n a,b=b,a%b\n return a\n\nN,X=[int(i) for i in input().split()]\na=input().split()\nx=[]\nfor i in range(N):\n x.append(int(a[i]))\nif(N==1):\n print(abs(x[0]-X))\n exit()\nx=list(map(lambda y:abs(y-X) , x))\nans=gcd(x[0],x[1])\nfor i in range(2,N):\n ans=gcd(x[i],ans)\nprint(ans)\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s137007695', 's482264546', 's563266743'] | [18192.0, 3064.0, 18220.0] | [112.0, 17.0, 103.0] | [278, 320, 315] |
p03262 | u783420291 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['import math\n\nN, X = map(int,input().split())\ncity = list(map(int,input().split()))\nX_diff = [0]*N\nfor i in range(N):\n X_diff[i] = abs(X-city[i])\n \nans = X_diff[0]\nfor i in range(1,N):\n ans = gcd(ans,X_diff[i])\n\nprint(ans)', 'def gcd(a,b): \n if b == 0:\n return a\n return gcd(b, a % b)\n\nN, X = map(int,input().split())\ncity = list(map(int,input().split()))\nX_diff = [0]*N\nfor i in range(N):\n X_diff[i] = abs(X-city[i])\n \nans = X_diff[0]\nfor i in range(1,N):\n ans = gcd(ans,X_diff[i])\n\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s099411079', 's553389114'] | [15020.0, 14252.0] | [65.0, 114.0] | [230, 326] |
p03262 | u785505707 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['headData=[int(n) for n in input().split()]\ncityNum=headData[0]\npos_x=int(headData[1])\ncityList=[int(n) for n in input().split()]\nallList=[]\nallList.append(pos_x)\nfor n in cityList:\n allList.append(n)\n\nallList=sorted(allList)\nprint(allList)\n\ndiffList=[]\n\nfor n in range(len(allList)-1):\n diffList.append(allList[n+1]-allList[n])\n\nanswer = min(diffList)\n\nwhile True:\n isAnswer = True\n for n in diffList:\n if n % answer != 0:\n isAnswer = False\n break\n if isAnswer:\n print(answer)\n break\n else:\n answer = answer-1', 'headData=[int(n) for n in input().split()]\ncityNum=headData[0]\npos_x=int(headData[1])\ncityList=[int(n) for n in input().split()]\nallList=[]\nallList.append(pos_x)\nfor n in cityList:\n allList.append(n)\n\nallList=sorted(allList)\n\ndiffList=[]\n\nfor n in range(len(allList)-1):\n diffList.append(allList[n+1]-allList[n])\n\nanswer = min(diffList)\n\nwhile True:\n isAnswer = True\n for n in diffList:\n if n % answer != 0:\n isAnswer = False\n break\n if isAnswer:\n print(answer)\n break\n else:\n answer = answer-1'] | ['Wrong Answer', 'Accepted'] | ['s537256047', 's679325020'] | [14224.0, 14252.0] | [200.0, 209.0] | [577, 562] |
p03262 | u811202694 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['from fractions import Fraction\nn , x = map(int,input().split())\n\nfield = [int(i) for i in input().split()]\n\ntmp = []\n\nfor i in field:\n tmp.append(abs(i-x))\n\n\nans = tmp[0]\n\nfor i in range(1,n):\n ans = min(ans,fractions.gcd(ans,tmp[i]))\n\nprint(ans)', 'n , x = map(int,input().split())\n\nfield = [int(i) for i in input().split()]\n\ndiff = list(map(lambda a:abs(a-x),field))\n\ndef gcd(x,y):\n # print(x,y)\n if x < y:\n x,y = y,x\n\n if x % y == 0:\n return y\n else:\n return gcd(y,x%y)\n\nans = diff[0]\n\n\nfor i in diff[1:]:\n ans = gcd(i,ans)\n\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s011632249', 's514453272'] | [16280.0, 14252.0] | [85.0, 88.0] | [252, 324] |
p03262 | u813102292 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['n,s = (int(i) for i in input().split())\nx = list(int(i) for i in input().split())\nx = sorted(x)\nif n>1:\n dif = []\n for i in range(n-1):\n dif.append(x[i+1]-x[i])\n\n difs = []\n for i in range(n):\n difs.append(abs(s-x[i]))\n\n print(res)\n for i in range(res):\n flag = True\n for j in range(n-1):\n if dif[j]%(res-i)!=0:\n flag = False\n break\n if flag:\n res -= i\n break\n \n print(res)\nelse:\n print(abs(x[0]-s))', 'n,s = (int(i) for i in input().split())\nx = list(int(i) for i in input().split())\nx = sorted(x)\nif n>1:\n dif = []\n for i in range(n-1):\n dif.append(x[i+1]-x[i])\n\n difs = []\n for i in range(n):\n difs.append(abs(s-x[i]))\n\n for i in range(res):\n flag = True\n for j in range(n-1):\n if dif[j]%(res-i)!=0:\n flag = False\n break\n if flag:\n res -= i\n break\n \n print(res)\nelse:\n print(abs(x[0]-s))', 'n,s = (int(i) for i in input().split())\nx = list(int(i) for i in input().split())\nx = sorted(x)\nif n>1:\n dif = []\n for i in range(n-1):\n dif.append(x[i+1]-x[i])\n\n difs = []\n for i in range(n):\n difs.append(abs(s-x[i]))\n res = min(min(dif),min(difs))\n for i in range(res):\n flag = True\n for j in range(n-1):\n if dif[j]%(res-i)!=0:\n flag = False\n break\n if flag:\n res -= i\n break\n \n print(res)\nelse:\n print(abs(x[0]-s))'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s390113032', 's835085875', 's831117062'] | [15020.0, 15020.0, 15020.0] | [135.0, 138.0, 405.0] | [536, 521, 554] |
p03262 | u814781830 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['N, X = map(int, input().split())\nx = [abs(X - int(i)) for i in input().split()]\n\ndef f(a, b):\n if b == 0:\n return a\n return f(b, a % b)\n\ntmp = 1\nfor i in range(len(x)-1):\n x[i+1] = f(x[i], x[i+1])\n\nprint(x[len(x)])\n', 'N, X = map(int, input().split())\nx = [abs(X - int(i)) for i in input().split()]\n\ndef f(a, b):\n if b == 0:\n return a\n return f(b, a % b)\n\ntmp = 0\nfor i in range(1, len(x)):\n tmp = f(x[i-1], x[i])\n\nprint(tmp)\n', 'N, X = map(int, input().split())\nx = [abs(X - int(i)) for i in input().split()]\n\ndef f(a, b):\n if b == 0:\n return a\n return f(b, a % b)\n\ntmp = 1\nfor i in range(len(x)-1):\n x[i+1] = f(x[i], x[i+1])\n\nprint(x[len(x)-1])\n'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s363421803', 's605122939', 's290282598'] | [14240.0, 14328.0, 14212.0] | [114.0, 250.0, 116.0] | [231, 223, 233] |
p03262 | u834415466 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['import math\nn,x=map(int,input().split())\nxlist=list(map(int,input().split()))\nxlist.sort(key=lambda xx:abs(xx-x))\nfor i in range(n):\n xlist[i]-=x\n xlist[i]=abs(xlist[i])\nm=xlist[-1]\nwhile xlist==[0]*n:\n for i in range(n):\n xlist[i]%=m\n if xlist[i]>0:\n m=math.gcd(m,xlist[i])\nprint(m)', 'n,x=map(int,input().split())\nxlist=list(map(int,input().split()))\nxlist.sort(key=lambda x:abs(x))\nm=xlist[0]-x\nwhile xlist==[0]*n:\n for i in range(n):\n xlist[i]-=x\n xlist[i]%=m\n m=min((m,xlist[i]))\nprint(m)', 'n,x=map(int,input().split())\nxlist=list(map(int,input().split()))\nxlist.sort(key=lambda xx:abs(xx-x))\nm=abs(xlist[0]-x)\nfor i in range(n):\n xlist[i]-=x\n xlist[i]=abs[xlist[i]]\nwhile xlist==[0]*n:\n for i in range(n):\n xlist[i]%=m\n if xlist[i]>0:\n m=min((m,xlist[i]))\nprint(m)', 'def gcd(x,y):\n while x%y:\n x%=y\n x,y=(y,x)\n return y\nn,x=map(int,input().split())\nxlist=list(map(int,input().split()))\nxlist.sort(key=lambda xx:abs(xx-x))\nfor i in range(n):\n xlist[i]-=x\n xlist[i]=abs(xlist[i])\nm=xlist[-1]\nwhile xlist!=[0]*n:\n for i in range(n):\n \n xlist[i]%=m\n if xlist[i]>0:\n m=gcd(m,xlist[i])\nprint(m)'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s455561223', 's523360848', 's799207270', 's405671138'] | [15020.0, 15020.0, 14252.0, 14252.0] | [126.0, 90.0, 96.0, 170.0] | [316, 229, 307, 382] |
p03262 | u844789719 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['from fractions import Fraction\n\ngcd = fractions.gcd\n\nN, X = [int(_) for _ in input().split()]\nx = [int(_) for _ in input().split()]\n\ndef gcdList(numbers):\n if len(numbers) == 1:\n return abs(numbers[0])\n if len(numbers) == 2:\n return gcd(numbers[0], numbers[1])\n else:\n return gcdList([gcd(numbers[0], numbers[1])] + numbers[2:])\n\nprint(gcdList([_ - X for _ in x]))', 'N, X = [int(_) for _ in input().split()]\nxs = [abs(int(_) - X) for _ in input().split()]\n\ndef gcd(p, q):\n while q != 0:\n p, q = q, p % q\n return p\n\ny = xs[0]\nfor i in range(N):\n if xs[i] % y != 0:\n y = gcd(y, xs[i])\n\nprint(y)'] | ['Runtime Error', 'Accepted'] | ['s331165893', 's048526932'] | [5244.0, 14252.0] | [40.0, 68.0] | [394, 248] |
p03262 | u845333844 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['n,x=map(int,input().split())\nl=list(map(int,input().split()))\n\nfor i in range(n):\n l[i]=abs(l[i]-x)\nprint(l)\n\ndef gcd(x,y):\n if y==0:\n return x\n else:\n return gcd(y,x%y) \n \nif n==1:\n x=l[0]\nelse:\n x=gcd(l[0],l[1])\n if n>2:\n for i in range(2,n):\n x=gcd(x,l[i])\nprint(x)', 'n,x=map(int,input().split())\nl=list(map(int,input().split()))\n\nfor i in range(n):\n l[i]=abs(l[i]-x)\n\ndef gcd(x,y):\n if y==0:\n return x\n else:\n return gcd(y,x%y) \n \nif n==1:\n x=l[0]\nelse:\n x=gcd(l[0],l[1])\n if n>2:\n for i in range(2,n):\n x=gcd(x,l[i])\nprint(x)'] | ['Wrong Answer', 'Accepted'] | ['s426505899', 's706166149'] | [14224.0, 14252.0] | [123.0, 108.0] | [299, 290] |
p03262 | u853952087 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['n=list(map(int,input().split()))\nY=list(map(int,input().split()))\nX=[abs(Y[i]-n[1]) for i in range(n[0])]\ndef gcd(x,y):\n if y == 0:\n return x\n else:\n return gcd(y, x%y) \nfor i in range(n[0]-1):\n X[0]=gcd(X[0],X[1])\n X=[X[0]]+X[1:]\nprint(max(X))', 'n=list(map(int,input().split()))\nY=list(map(int,input().split()))\nXX=[abs(Y[i]-n[1]) for i in range(n[0])]\nX=sorted(XX)\ndef gcd(x,y):\n if y == 0:\n return x\n else:\n return gcd(y, x%y) \nans=X[0]\nfor i in range(n[0]-1):\n ans=gcd(ans,X[i])\nprint(max(X))', 'n=list(map(int,input().split()))\nY=list(map(int,input().split()))\nXX=[abs(Y[i]-n[1]) for i in range(n[0])]\nX=sorted(XX)\ndef gcd(x,y):\n if y == 0:\n return x\n else:\n return gcd(y, x%y) \nans=X[0]\nfor i in range(n[0]-1):\n ans=gcd(ans,X[i])\nprint(ans)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s882547958', 's908586490', 's273226014'] | [14252.0, 14224.0, 14252.0] | [2104.0, 145.0, 145.0] | [270, 272, 269] |
p03262 | u855985627 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ["def LCM(m,n):\n for i in range(1,m+1)[::-1]:\n if n%i==0:\n return i\n \nN,X=(int(i) for i in input().split(' '))\nx=[int(i) for i in input().split(' ')]\nx=[X]+x\nD=x[1]-x[0]\nfor i in range(N):\n D=LCM(D,x[i+1]-x[i])\nprint(D)", "def quick_sort(arr):\n left = []\n right = []\n if len(arr) <= 1:\n return arr\n\n \n # ref = random.choice(arr)\n ref = arr[0]\n ref_count = 0\n\n for ele in arr:\n if ele < ref:\n left.append(ele)\n elif ele > ref:\n right.append(ele)\n else:\n ref_count += 1\n left = quick_sort(left)\n right = quick_sort(right)\n return left + [ref] * ref_count + right\n\ndef LCM(m,n):\n if m>n:\n m,n=n,m\n for i in range(1,m+1)[::-1]:\n if n%i==0:\n return i\n \nN,X=(int(i) for i in input().split(' '))\nx=[int(i) for i in input().split(' ')]\nx=[X]+x\nx=quick_sort(x)\nD=abs(x[1]-x[0])\nfor i in range(N):\n D=LCM(D,abs(x[i+1]-x[i]))\nprint(D)"] | ['Runtime Error', 'Accepted'] | ['s825055502', 's717571564'] | [14252.0, 14480.0] | [2104.0, 565.0] | [230, 806] |
p03262 | u859897687 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['n,x=map(int,input().split())\nm=list(map(lambda x:int(x)-x,input().split()))\nif 0 in m:\n m.remove(0)\nans=abs(m[0])\nfor i in m:\n i=abs(i)\n while 1:\n ans%=i\n ans,i=i,ans\n if i==0:\n break\nprint(ans)', 'n,x=map(int,input().split())\nm=list(map(lambda y:int(y)-x,input().split()))\nif 0 in m:\n m.remove(0)\nans=abs(m[0])\nfor i in m:\n i=abs(i)\n while 1:\n ans%=i\n ans,i=i,ans\n if i==0:\n break\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s688240212', 's428352561'] | [11100.0, 14252.0] | [26.0, 117.0] | [211, 211] |
p03262 | u860002137 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['import numpy as np\n\n\ndef gcd(a, b):\n if (b == 0):\n return a\n else:\n return gcd(b, a % b)\n\n\n_, X = map(int, input().split())\nx = np.array(list(map(int, input().split())))\n\nX = np.array([X])\nx = np.concatenate([x, X])\nx.sort()\n\nans = x[0]\nfor i in x:\n ans = gcd(ans, i)\n\nprint(ans)', 'import numpy as np\n\n\ndef gcd(a, b):\n if (b == 0):\n return a\n else:\n return gcd(b, a % b)\n\n\n_, X = map(int, input().split())\nx = np.array(list(map(int, input().split())))\n\nX = np.array([X])\n\nx = np.concatenate([x, X])\nx.sort(0)\nx = np.abs(np.diff(x))\n\nans = x[0]\nfor i in x:\n ans = gcd(ans, i)\n\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s339206167', 's265562570'] | [23124.0, 25108.0] | [489.0, 475.0] | [302, 327] |
p03262 | u879870653 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['import math\n\nN,X = map(int,input().split())\nL = list(map(int,input().split()))\nL.append(X)\nL = sorted(L)\nD = []\nfor i in range(len(L)) :\n d = abs(L[i+1] - L[i])\n D.append(d)\n\nD = sorted(D)\nif N != 1 :\n answer = math.gcd(D[0],D[1])\n for j in range(len(D)) :\n gcd = math.gcd(D[i-1],D[i])\n if answer > gcd :\n answer = gcd\nelse :\n answer = D[0]\nprint(answer)\n\n', 'N,X = map(int,input().split())\nL = list(map(int,input().split()))\ncounter = 0\nL.append(X)\nL = sorted(L)\nD = []\nfor i in range(len(L)) :\n d = L[i]-L[i-1]\n if i != 0 :\n D.append(d)\n\nD = sorted(D)\nqq = min(D)\nfor j in range(len(D)-1) :\n if D[j+1] % qq != 0 :\n counter += 1\n\nif counter == 0 :\n print(qq)\nelse :\n print(1)\n \nprint(D)\nprint(counter)\n\n', 'N, X = map(int, input().split())\nA = list(map(int, input().split()))\ndiff = [abs(a - X) for a in A]\n\n\ndef gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\n\nwhile len(diff) > 1:\n a, b = diff.pop(), diff.pop()\n diff.append(gcd(a, b))\n\nprint(diff[0])\n'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s431819412', 's575182441', 's364867261'] | [15020.0, 14252.0, 14252.0] | [111.0, 166.0, 114.0] | [396, 376, 284] |
p03262 | u882359130 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['N, X = [int(nx) for nx in input().split()]\nx = [abs(int(xx) - X) for xx in input().split()]\n\nwhile len(x) > 1:\n x2 = []\n mn_x = min(x)\n for n in range(N):\n mod = x[n] % mn_x\n if mod != 0:\n x2.append(mod)\n x2.append(mn_x)\n x = x2\nprint(x)', 'N, X = [int(nx) for nx in input().split()]\nx = [abs(int(xx) - X) for xx in input().split()]\n\nwhile len(x) > 1:\n x2 = []\n mn_x = min(x)\n for n in range(len(x)):\n mod = x[n] % mn_x\n if mod != 0:\n x2.append(mod)\n x2.append(mn_x)\n x = x2\n \nans = x[0]\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s792376116', 's558720666'] | [14224.0, 14252.0] | [103.0, 98.0] | [253, 274] |
p03262 | u883203948 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['n,x = list(map(int,input().split()))\ndata = [int(s) for s in input().split()]\ndis = [None] * (n-1)\n\nfor i in range(n-1):\n dis[i] = abs(data[i+1] - data[i])\nif n == 1:\n print(*data)\n exit()\n\nans = 0\nprint(dis)\ndef gcd(a,b):\n if a < b:\n a,b = b,a\n if b == 0:\n return a\n else:\n return gcd(b,a%b)\n\nfor i in range(n-2):\n ans = gcd(dis[i],dis[i+1])\n \nprint(ans)', 'n,x = list(map(int,input().split()))\ndata = [int(s) for s in input().split()]\ndis = [None] * (n-1)\n\nfor i in range(n-1):\n dis[i] = abs(data[i+1] - data[i])\nif n == 1:\n print(abs(data[0]-x))\n exit()\ndis.sort()\n\nans = 0\ndef gcd(a,b):\n if b == 0:\n return a\n else:\n return gcd(b,a%b)\nfor i in range(n-1):\n ans = gcd(dis[i+1],dis[i])\n \nprint(ans)', 'def gcd(a, b):\n if b == 0:\n return a\n else:\n return gcd(b, a % b)\nn,x = list(map(int,input().split()))\ndata = [int(s) for s in input().split()]\ndis = [None] * (n-1)\n\nfor i in range(n-1):\n dis[i] = abs(data[i+1] - data[i])\nif n == 1:\n print(abs(x-data[0]))\n exit()\n\ndis.sort()\nif n == 2:\n temp = min(abs(x-data[0]),abs(x-data[1]))\n print(gcd(temp,dis[0]))\n exit()\n\n\n\n\nfor i in range(n-2):\n dis[i+1] = gcd(dis[i+1],dis[i])\n \nprint(dis[i+1])\n'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s280580983', 's698657278', 's048762309'] | [14252.0, 14252.0, 14480.0] | [314.0, 192.0, 161.0] | [433, 409, 545] |
p03262 | u894258749 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['import fractions\nfrom functools import reduce\ndef gcd_list(numbers):\n return reduce(fractions.gcd, numbers)\n\ninpl = lambda: list(map(int,input().split()))\nN, X = inpl()\nx = inpl()\ny = [ p - X for p in x ]\nprint(gcd_list(y))', 'inpl = lambda: list(map(int,input().split()))\ndef gcd(a, b):\n if a < 0: a = -a\n if b < 0: b = -b\n while b > 0:\n (a, b) = (b, a % b)\n return a\n\nN, X = inpl()\nx = inpl()\nD = abs(x[0]-X)\nfor i in range(1,N):\n D = gcd(D, x[i]-X)\nprint(D)'] | ['Wrong Answer', 'Accepted'] | ['s362116680', 's143740873'] | [16304.0, 14480.0] | [91.0, 87.0] | [226, 253] |
p03262 | u896741788 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['n,s=map(int,input().split())\nl=[abs(int(i)-s) for i in input().split()]\nans=l[0]\nfor i in l:\n a=ans\n b=0\n while a and i:\n a//=i\n b=a\n a=i\n i=b\n ans=max(a,i)\nprint(ans)', 'n,s=map(int,input().split())\nl=[abs(int(i)-s) for i in input().split()]\nans=l[0]\ndef gc(a,d):\n ai=a;bi=d\n a,d=min(ai,bi),max(ai,bi)\n if a==0:return d\n else:return gc(d%a,a)\n \n \nfor i in l:\n ans=gc(ans,i)\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s770908500', 's707406463'] | [14252.0, 14220.0] | [142.0, 155.0] | [183, 222] |
p03262 | u897436032 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['import functools as ft\n\nN,X = map(int, input().split(" "))\nXi = [int(a) for a in input().split()]\n\n\ndef gcd(a, b):\n if b == 0:\n return a\n else:\n return gcd(b, a % b)\n\ndef gcd_list(numbers):\n return ft.reduce(gcd,numbers)\n\ndef minusX(a):\n return abs(a-X)\n\n\nXi = map(minusX,Xi)\n\ndef main():\n output = minusX(gcd_list(Xi))\n print(output)\n\nif __name__ == "__main__":\n main()\n', 'import functools as ft\n\ndef gcd(a, b):\n if b == 0:\n return a\n else:\n return gcd(b, a % b)\n\ndef gcd_list(numbers):\n return ft.reduce(gcd,numbers)\n\nN, X = map(int, input().split(" "))\nXi = [int(a) for a in input().split()]\n\ndef MinusX(Xi_):\n return abs(Xi_-X)\n\ndef main(Xi):\n Xi = map(MinusX,Xi)\n output = gcd_list(Xi)\n print(output)\n\nif __name__ == "__main__":\n main(Xi)\n'] | ['Wrong Answer', 'Accepted'] | ['s042950789', 's147734382'] | [14596.0, 14596.0] | [95.0, 97.0] | [406, 408] |
p03262 | u897753140 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ["import math\nfrom functools import reduce\n\ndef gcd_list(numbers):\n return reduce(math.gcd, numbers)\n\n\ninput_list1 = list(map(int, input().split()))\ninput_list2 = list(map(int, input().split()))\n#input_list1 = [3, 81]\n#input_list2 = [33, 105, 57]\nN = input_list1[0]\nX = input_list1[1]\n\n#print('N:', N)\n#print('X:', X)\n\n\ninput_list2.append(X)\ninput_list2.sort()\n#print(input_list2)\n\n\nans_list = []\nfor i, target in enumerate(input_list2):\n if i == N:\n break\n aa = input_list2[i + 1] - input_list2[i]\n #print(input_list2[i + 1], '-' , input_list2[i])\n ans_list.append(aa)\n\n\nans_list = set(ans_list)\n\nans_list = [27, 18, 9, 3]\n\n\nif len(ans_list) > 1:\n print(gcd_list(ans_list))\nelse:\n print(min(ans_list))", 'import math\nfrom functools import reduce', "#import math\nfrom functools import reduce\n\ndef gcd_list(numbers):\n def gcd(a, b):\n if (b == 0):\n return a;\n return gcd(b, a % b)\n\n return reduce(gcd, numbers)\n\n\ninput_list1 = list(map(int, input().split()))\ninput_list2 = list(map(int, input().split()))\n#input_list1 = [3, 81]\n#input_list2 = [33, 105, 57]\nN = input_list1[0]\nX = input_list1[1]\n\n#print('N:', N)\n#print('X:', X)\n\n\ninput_list2.append(X)\ninput_list2.sort()\n#print(input_list2)\n\n\nans_list = []\nfor i, target in enumerate(input_list2):\n if i == N:\n break\n aa = input_list2[i + 1] - input_list2[i]\n #print(input_list2[i + 1], '-' , input_list2[i])\n ans_list.append(aa)\n\n\nans_list = set(ans_list)\n\n\nif len(ans_list) > 1:\n print(gcd_list(ans_list))\nelse:\n print(min(ans_list))\n"] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s172559332', 's933995119', 's718983529'] | [14764.0, 3568.0, 14596.0] | [126.0, 24.0, 123.0] | [869, 40, 931] |
p03262 | u901466816 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['def lcm(a, b):\n if b > a:\n a, b = b, a\n \n while b != 0:\n a, b = b, a % b\n \n return a\n\ncity_num, start = map(int, input().split())\n\ncities = list(map(int, input().split()))\n\nfor i in range(len(cities)):\n cities[i] = abs(start - cities[i])\n\ncities.sort()\n \na = reduce(lcm, cities) \n\nprint(a)\n', 'from functools import reduce\n\ndef lcm(a, b):\n if b > a:\n a, b = b, a\n \n while b != 0:\n a, b = b, a % b\n \n return a\n\ncity_num, start = map(int, input().split())\n\ncities = list(map(int, input().split()))\n\nfor i in range(len(cities)):\n cities[i] = abs(start - cities[i])\n\ncities.sort()\n \na = reduce(lcm, cities) \n\nprint(a)\n'] | ['Runtime Error', 'Accepted'] | ['s925348537', 's634720871'] | [14252.0, 14748.0] | [98.0, 126.0] | [304, 334] |
p03262 | u902151549 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['# coding: utf-8\nimport time\nimport re\nimport math\n\ndef main():\n n,start=map(int,input().split())\n X=list(map(int,input().split()))\n mx=0\n dmx=0\n for a in X:\n dmx=max([dmx,abs(start-x)])\n for D in range(1,dmx+1):\n f=1\n for a in range(n):\n if (X[a]-start)%D!=0:\n f=0\n if f==1:\n mx=max([mx,D])\n print(mx)\nmain()', '# coding: utf-8\nimport time\nimport re\nimport math\n\ndef main():\n n,start=map(int,input().split())\n X=list(map(int,input().split()))\n now=abs(X[0]-start)\n for xi in range(1,n):\n now=GCD(now,abs(X[xi]-start))\n print(now)\ndef GCD(a,b):\n if a%b==0:\n return b\n else:\n return GCD(b,a%b)\nmain()'] | ['Runtime Error', 'Accepted'] | ['s453942742', 's145284437'] | [14504.0, 14504.0] | [44.0, 82.0] | [394, 328] |
p03262 | u903833784 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['N, X = map(int, input().split())\nxs = map(int, input().split())\nxs.append(X)\nxs.sort()\nxs = [_ - xs[0] for _ in xs]\ndiffs = [xs[i]-xs[i-1] for i in range(1, len(xs))]\ndef gcd(a, b):\n if(a>b): return gcd(b, a)\n if a % b == 0:\n return b\n else:\n r = a % b\n return gcd(b, r)\n\nprev = diffs[0]\nfor cur in diffs[1:]:\n prev = gcd(prev, cur)\nprint(prev)', 'N, X = map(int, input().split())\nxs = list(map(int, input().split()))\nxs.append(X)\nxs.sort()\nxs = [_ - xs[0] for _ in xs]\ndiffs = [xs[i]-xs[i-1] for i in range(1, len(xs))]\ndef gcd(a, b):\n if(a>b): return gcd(b, a)\n if a % b == 0:\n return b\n else:\n r = a % b\n return gcd(b, r)\n\nprev = diffs[0]\nfor cur in diffs[1:]:\n prev = gcd(prev, cur)\nprint(prev)', 'N, X = map(int, input().split())\nxs = list(map(int, input().split()))\nxs.append(X)\nxs.sort()\nxs = [_ - xs[0] for _ in xs]\ndiffs = [xs[i]-xs[i-1] for i in range(1, len(xs))]\ndef gcd(a, b):\n if(a>b): return gcd(b, a)\n if a % b == 0:\n return b\n else:\n r = a % b\n return gcd(b, r)\n\nprev = diffs[0]\nfor cur in diffs[1:]:\n prev = gcd(prev, cur)\nprint(prev)', 'N, X = map(int, input().split())\nxs = list(map(int, input().split()))\nxs.append(X)\nxs.sort()\nxs = [_ - xs[0] for _ in xs]\ndiffs = [xs[i]-xs[i-1] for i in range(1, len(xs))]\ndef gcd(a, b):\n if(a<b): return gcd(b, a)\n if a % b == 0:\n return b\n else:\n r = a % b\n return gcd(b, r)\n\nprev = diffs[0]\nfor cur in diffs[1:]:\n prev = gcd(prev, cur)\nprint(prev)'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s335999922', 's370986081', 's420591337', 's585586692'] | [11096.0, 14252.0, 14252.0, 14252.0] | [27.0, 160.0, 160.0, 134.0] | [357, 363, 377, 377] |
p03262 | u913110564 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['import math\n\n\nn, x = map(int,input().split())\nli_x = list(map(int,input().split()))\n\nfor i in range(len(li_x)):\n if li_x[i] - x < 0:\n li_x[i] =x - li_x[i]\n else:\n li_x[i] = li_x[i] -x\n\nif len(li_x)==1:\n print(li_x[0])\n\nelif len(li_x)==2:\n print(gcd(li_x[0],li_x[1]))\n\nelse:\n g =gcd(li_x[0],li_x[1])\n k=2\n while k<len(li_x):\n g=gcd(g,li_x[k])\n k+=1\n print(g)\n\ndef gcd(x, y):\n if y == 0:\n return x\n else:\n return gcd(y, x % y)\n', 'import math\n\ndef gcd(x, y):\n if y == 0:\n return x\n else:\n return gcd(y, x % y)\n\nn, x = map(int,input().split())\nli_x = list(map(int,input().split()))\n\nfor i in range(len(li_x)):\n if li_x[i] - x < 0:\n li_x[i] =x - li_x[i]\n else:\n li_x[i] = li_x[i] -x\n\nif len(li_x)==1:\n print(li_x[0])\n\nelif len(li_x)==2:\n print(gcd(li_x[0],li_x[1]))\n\nelse:\n g =gcd(li_x[0],li_x[1])\n k=2\n while k<len(li_x):\n g=gcd(g,li_x[k])\n k+=1\n print(g)\n\n\n'] | ['Runtime Error', 'Accepted'] | ['s005349960', 's592975445'] | [15020.0, 15020.0] | [69.0, 131.0] | [453, 454] |
p03262 | u921615009 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['from functools import reduce\n\ndef gcd(a, b):\n if b > 0:\n return gcd(b, a%b)\n else:\n return a\n\ndef gcd_list(arg_list):\n return reduce(gcd, arg_list)\n\nN, X = tuple(map(int, input().split(" ")))\nXs = list(map(int, input().split(" ")))\nr = gcd_list(Xs)\nprint(r)\n', 'import math\nfrom functools import reduce\ndef gcd(arg_list):\n return reduce(math.gcd, arg_list)\n\nN, X = tuple(map(int, input().split(" ")))\nXs = list(map(int, input().split(" ")))\nr = gcd(Xs)\nprint(r)\n', 'from functools import *\nN, X = list(map(int, input().split(" ")))\nxs = list(map(int, input().split(" ")))\nxs = list(map(lambda x: X-x if X>x else x-X, xs))\ndef gcd(a, b):\n if b == 0:\n return a\n return gcd(b, a%b) \nr = reduce(gcd, d)\nprint(r)\n', 'from functools import *\nN, X = list(map(int, input().split(" ")))\nxs = list(map(int, input().split(" ")))\nxs = list(map(lambda x: X-x if X>x else x-X, xs))\ndef gcd(a, b):\n if b == 0:\n return a\n return gcd(b, a%b) \nr = reduce(gcd, xs)\nprint(r)\n'] | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s163273105', 's805764580', 's885694628', 's915334603'] | [14596.0, 14612.0, 14748.0, 14748.0] | [79.0, 47.0, 118.0, 131.0] | [281, 203, 255, 256] |
p03262 | u932465688 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ["N,X = map(int,input().split())\nx = list(map(int,input().split()))\nx.sort()\nL = []\n\nif (len(x) == 1):\n print(abs(X-x[0]))\nelse:\n L.append(abs(X-x[0]))\n for k in range(len(x)):\n p = abs(X-x[k])\n if (p < L[0]):\n if (L[0] % p != 0):\n print('1')\n break\n else:\n if (L[0] == 1):\n print('1')\n else:\n del L[0]\n L.append(p)\n print(L[0])", "N,X = map(int,input().split())\nx = list(map(int,input().split()))\nx.sort()\nL = []\n \nif (len(x) == 1):\n print(abs(X-x[0]))\nelse:\n L.append(abs(X-x[0]))\n for k in range(len(x)):\n p = abs(X-x[k])\n if (p < L[0]):\n if (L[0] % p != 0):\n print('1')\n break\n else:\n if (L[0] != 1):\n del L[0]\n L.append(p)\n print(L[0])", 'N,X = map(int,input().split())\nL = list(map(int,input().split()))\nfor i in range(N):\n L[i] = abs(L[i]-X)\nL.sort()\ndef gcd(x,y):\n while y != 0:\n k = x\n x = y\n y = k%y\n return x\ncur = L[0]\nfor i in range(1,N):\n cur = gcd(L[i],cur)\nprint(cur)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s255906276', 's906888814', 's384018616'] | [14252.0, 14252.0, 14228.0] | [81.0, 80.0, 132.0] | [409, 373, 252] |
p03262 | u933341648 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['def gcd(a, b):\n while a > 0:\n a, b = b, a%b\n return b\n\nn, x = map(int, input().split())\ntown = list(map(int, input().split()))\n\nres = abs(town[0] - x)\nfor t in town[1:]:\n d = abs(t - x)\n res = gcd(res, d)\n\nprint(res)', 'def gcd(a, b):\n while a > 0:\n if a < b:\n a, b = b, a\n a = a % b\n return b\n\nn, x = map(int, input().split())\ntown = map(int, input().split())\n\ndistance = (abs(x-y) for y in town)\nprint(distance)\nfor d in distance:\n res = gcd(next(d), next(d))\n\nprint(res)\n', 'from math import gcd\nfrom fractions import reduce\n\nn, x = map(int, input().split())\ntown = map(int, input().split())\n\ndist = map(lambda y: abs(x - y), town)\nres = reduce(gcd, dist)\nprint(res)', 'def gcd(a, b):\n while a > 0:\n a = a % b\n a, b = b, a\n return b\n\nn, x = map(int, input().split())\ntown = list(map(int, input().split()))\n\nres = abs(town[0] - x)\nfor t in town[1:]:\n d = abs(t - x)\n res = gcd(res, d)\n\nprint(res)', 'import sys\ninput = sys.stdin.readline\n\ndef gcd(a, b):\n while a > 0:\n if a < b:\n a, b = b, a\n a = a % b\n return b\n\ndef main():\n n, x = map(int, input().split())\n town = map(int, input().split())\n\n distance = (abs(x-y) for y in town)\n res = next(distance)\n for d in distance:\n if d % res != 0:\n res = gcd(res, d)\n\n print(res)\n\nif __name__ == "__main__":\n main()'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s047713336', 's072568694', 's702544448', 's916114549', 's981323907'] | [14224.0, 11096.0, 3064.0, 14252.0, 11468.0] | [45.0, 28.0, 18.0, 43.0, 57.0] | [235, 288, 191, 251, 429] |
p03262 | u937782958 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['N,X = map(int, input().split())\ntarget = list(map(int, input().split()))\n\ndistances = [abs(i - X) for i in target]\n\ndef GCD(x,y):\n if x == 0:\n return y\n else:\n return GCD(y, x % y)\nres = 0\nfor d in distances:\n res = GCD(res, d)\nprint(res)', 'N,X = map(int, input().split())\ntarget = list(map(int, input().split()))\n\ndistances = [abs(i - X) for i in target]\n\ndef GCD(x,y):\n if y == 0:\n return x\n else:\n return GCD(y, x % y)\nres = 0\nfor d in distances:\n res = GCD(res, d)\nprint(res)'] | ['Runtime Error', 'Accepted'] | ['s689589035', 's150389217'] | [14252.0, 14252.0] | [53.0, 97.0] | [261, 261] |
p03262 | u952022797 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['# -*- coding: utf-8 -*-\nimport sys\nimport copy\nimport collections\nfrom bisect import bisect_left\n\ndef main():\n\tN, X = map(int, input().split(" "))\n\tL = input().split(" ")\n\tL = [int(s) for s in L]\n\t\n\tif N == 1:\n\t\tprint(abs(L[0]-X))\n\t\tsys.exit()\n\t\n\tL.sort()\n\ttmp = bisect_left(L, X)\n\tmax1 = L[tmp]\n\tmin = 2000000001\n\tif tmp != 0:\n\t\tmin1 = L[tmp-1]\n\t\n\tans = min(abs(max1-X), abs(X-min1))\n\t\n\tprint(ans)\n\t\t\n\t\nif __name__ == "__main__":\n\tmain()\n', '# -*- coding: utf-8 -*-\nimport sys\nimport copy\nimport collections\nfrom bisect import bisect_left\n\ndef main():\n\tN, X = map(int, input().split(" "))\n\tL = input().split(" ")\n\tL = [int(s) for s in L]\n\t\n\tif N == 1:\n\t\tprint(abs(L[0]-X))\n\t\tsys.exit()\n\t\n\tL.sort()\n\ttmp = bisect_left(L, X)\n\t\n\tmax = 2000000001\n\tif tmp < len(L)\n\t\tmax1 = L[tmp]\n\t\n\tmin1 = 2000000001\n\tif tmp != 0:\n\t\tmin1 = L[tmp-1]\n\t\n\tans = min(abs(max1-X), abs(X-min1))\n\t\n\tprint(ans)\n\t\t\n\t\nif __name__ == "__main__":\n\tmain()\n', '# -*- coding: utf-8 -*-\nimport sys\nimport copy\nimport collections\nfrom bisect import bisect_left\n\ndef gcd(a, b):\n\tif a > b:\n\t\ta, b = b, a\n\t\t\n\twhile a > 0:\n\t\ta, b = b % a, a\n\treturn b\n\t\ndef main():\n\tN, X = map(int, input().split(" "))\n\tL = input().split(" ")\n\tL = [int(s) for s in L]\n\t\n\tif N == 1:\n\t\tprint(abs(L[0]-X))\n\t\tsys.exit()\n\t\n\tL.sort()\n\ttmp = bisect_left(L, X)\n\t\n\tmax1 = 2000000001\n\tif tmp < len(L):\n\t\tmax1 = L[tmp]\n\t\n\tmin1 = 2000000001\n\tif tmp != 0:\n\t\tmin1 = L[tmp-1]\n\t\n\tseed = 0\n\tmark = -1\n\tif abs(max1-X) < abs(X-min1):\n\t\tseed = abs(max1-X)\n\t\tmark = tmp\n\telse:\n\t\tseed = abs(X-min1)\n\t\tmark = tmp-1\n\t\n\tans = 2000000001\n\tfor i, val in enumerate(L):\n\t\tif i == mark:\n\t\t\tcontinue\n\t\ttmp = abs(L[i] - L[mark])\n\t\tans_tmp = gcd(tmp, seed)\n\t\tif ans > ans_tmp:\n\t\t\tans = ans_tmp\n\t\n\tprint(ans)\n\t\t\n\t\nif __name__ == "__main__":\n\tmain()\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s244330647', 's833747411', 's546311314'] | [14612.0, 2940.0, 14612.0] | [86.0, 17.0, 153.0] | [439, 480, 830] |
p03262 | u952588409 | 2,000 | 1,048,576 | There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located. | ['N=int(input())\nlast = input()\nwds = set([last])\nres = "Yes"\nfor i in range(N-1):\n wd = input()\n if wd in wds or last[-1]!=wd[0]: \n ans = "No"\n break\n last = wd\n wds.add(wd)\nprint(ans)', 'def gcd(a, b):\n if a > b:\n a, b = b, a\n while a:\n a, b = b%a, a\n return b\nN,x1 = map(int, input().split())\nxs = list(map(int, input().split()))\nxs.append(x1)\nxs.sort()\nmargin = [y-x for y,x in zip(xs[1:],xs[:-1])]\nm = margin[0]\nfor x in margin[1:]:\n m = gcd(m,x)\nprint(m)'] | ['Runtime Error', 'Accepted'] | ['s663840981', 's409878937'] | [3060.0, 14252.0] | [17.0, 118.0] | [209, 297] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.