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
p03309
u504562455
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['N = int(input())\nA = [int(i) for i in input().split()]\n\nfor ni in range(N):\n A[ni] = A[ni] - (ni+1)\n\nb = sum(A)//N+1\nans = 0\nfor ni in range(N):\n ans += abs(A[ni]-b)\n\nprint(ans)', 'N = int(input())\nA = [int(i) for i in input().split()]\n\nfor ni in range(N):\n A[ni] = A[ni] - (ni+1)\n\nA.sort()\nb = A[N//2]\n\n\nans = 0\nfor ni in range(N):\n ans += abs(A[ni]-b)\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s620262123', 's368778060']
[26180.0, 26128.0]
[160.0, 237.0]
[183, 190]
p03309
u506086925
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['n = int(input())\na = list(map(int,input().split()))\nb = []\ncnt = 1\nfor num in a:\n num -= cnt\n b.append(num)\n cnt += 1\ntest = [int(mean(b))-1,int(mean(b)),int(mean(b))+1]\nans = []\ns = 9999999999999\nfor i in test:\n cnt = 1\n c = []\n for num in a:\n st = 0\n st = abs(num - (i+cnt))\n c.append(st)\n cnt += 1\n ans.append(sum(c))\nprint(min(ans))', 'import numpy as np\n\nn = int(input())\na = list(map(int,input().split()))\nb = []\ncnt = 1\nfor num in a:\n num -= cnt\n b.append(num)\n cnt += 1\ntest = [int(np.mean(b))-1,int(np.mean(b)),int(np.mean(b))+1,int(np.median(b))]\ntest = list(set(test))\nans = []\ns = 9999999999999\nfor i in test:\n cnt = 1\n c = []\n for num in a:\n st = 0\n st = abs(num - (i+cnt))\n c.append(st)\n cnt += 1\n ans.append(np.sum(c))\nprint(np.min(ans))']
['Runtime Error', 'Accepted']
['s149156889', 's104095601']
[25284.0, 37492.0]
[120.0, 682.0]
[385, 461]
p03309
u513081876
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['n = int(input())\na = [int(i) for i in input().split()]\nfor i in range(n):\n a[i] -= (i+1)\nave = sum(a) // n\nfoi i in range(n):\n a[i] = abs(a[i] - ave)\nprint(sum(a))', 'N = int(input())\nA = [int(i) for i in input().split()]\nfor i in range(N):\n A[i] -= (i+1)\n\nA.sort()\n\nif N % 2 != 0:\n num = A[N//2]\n A = [abs(i - num) for i in A]\n print(sum(A))\nelse:\n num1 = A[N//2]\n num2 = num1 -1\n A1 = [abs(i - num1) for i in A]\n A2 = [abs(i - num2) for i in A]\n print(min(sum(A1), sum(A2)))']
['Runtime Error', 'Accepted']
['s775068631', 's541083015']
[2940.0, 27844.0]
[18.0, 246.0]
[165, 336]
p03309
u518042385
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['n=int(input())\nl=list(map(int,input().split()))\nfor i in range(n):\n l[i]=l[i]-i-1\nl=sorted(l)\nif n%2==0:\n mid=(l[n/2-1]+l[n/2])\nelse:\n mid=l[n/2]\nsum=0\nfor i in range(n):\n sum+=abs(l[i]-mid)\nprint(sum)\n', 'n=int(input())\nl=list(map(int,input().split()))\nfor i in range(n):\n l[i]=l[i]-i-1\nl=sorted(l)\nif n%2==0:\n mid=(l[n//2-1]+l[n//2])//2\nelse:\n mid=l[(n-1)//2]\nsum=0\nfor i in range(n):\n sum+=abs(l[i]-mid)\nprint(sum)']
['Runtime Error', 'Accepted']
['s882783246', 's844200436']
[26128.0, 26180.0]
[192.0, 222.0]
[206, 215]
p03309
u527261492
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['n=int(input())\na=list(map(int,input().split()))\nA=[]\nfor i in range(n):\n A.append(a[i]-i-1)\nA.sort()\nb=0\nc=0\nans=0\nAns=0\nif n%!=0:\n b=n//2\n for i in range(n):\n ans+=abs(A[i]-b)\n print(ans)\nelse:\n b=n//2\n c=(n//2)-1\n for i in range(n):\n ans+=abs(A[i]-b)\n Ans+=abs(A[i]-c)\n print(min(ans,Ans))\n ', 'n=int(input())\na=list(map(int,input().split()))\nA=[]\nfor i in range(n):\n A.append(a[i]-i-1)\nA.sort()\nb=0\nc=0\nans=0\nAns=0\nif n%2!=0:\n b=n//2\n for i in range(n):\n ans+=abs(A[i]-b)\n print(ans)\nelse:\n b=n//2\n c=(n//2)-1\n for i in range(n):\n ans+=abs(A[i]-b)\n Ans+=abs(A[i]-c)\n print(min(ans,Ans))\n \n', 'n=int(input())\na=list(map(int,input().split()))\nA=[]\nfor i in range(n):\n A.append(a[i]-i-1)\nA.sort()\nb=0\nc=0\nans=0\nAns=0\nif n%2!=0:\n b=n//2\n for i in range(n):\n ans+=abs(A[i]-A[b])\n print(ans)\nelse:\n b=n//2\n c=(n//2)-1\n for i in range(n):\n ans+=abs(A[i]-A[b])\n Ans+=abs(A[i]-A[c])\n print(min(ans,Ans))\n \n']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s917132718', 's951876613', 's185571599']
[2940.0, 26020.0, 25748.0]
[17.0, 280.0, 292.0]
[311, 313, 322]
p03309
u532806301
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['n = int(input())\nl = input().split()\nlst = list(map(int,l))\n\nsum = 0\nj = 1\nfor i in lst:\n sum += (i-j)\n j+=1\n\n//四捨五入\nb = round(sum/n)\n\n#print(b)\n\nj = 1\nsad = 0\nfor a in lst:\n sad += abs(a-(b+j))\n j += 1\nprint(sad)', 'import statistics\n\nn = int(input())\nl = input().split()\nlst = list(map(int,l))\nx = []\n\nfor i in range(n):\n x.append(0)\n x[i] = lst[i] - (i+1)\n\n#print(x)\n#x.sort()\n#print(x)\n\n#b = x[n//2]\n\nb = statistics.median(x)\nb = int(b)\n#print(b)\n\nsad = 0\n\n#print(lst)\n\nfor i in range(n):\n sad += abs(lst[i]-b-i-1)\n\nprint(sad)']
['Runtime Error', 'Accepted']
['s497310452', 's904905603']
[2940.0, 39444.0]
[17.0, 287.0]
[233, 322]
p03309
u532966492
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['N=int(input())\na=list(map(int,input().split()))\nfrom statistics import median\nprint(sum([abs(b-int(median(a))) for b in a]))', 'N=int(input())\na=list(map(int,input().split()))\na=[a[i]-i for i in range(N)]\nfrom statistics import median\nm=int(median(a))\nprint(sum([abs(b-m) for b in a]))']
['Wrong Answer', 'Accepted']
['s880309284', 's718669661']
[26708.0, 26832.0]
[2104.0, 209.0]
[124, 157]
p03309
u536377809
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['import math\n\nN=int(input())\nA=[int(item) for item in input().split()]\n\ntmp=[a-n-1 for n,a in enumerate(A)]\nprint(tmp)\nprint(sum(tmp)/len(tmp))\nb=sum(tmp)/len(tmp)\nif b>0:\n b=math.floor(b)\nelse:\n b=math.ceil(b)\n\nprint(sum([abs(item-b) for item in tmp]))', 'import math\n\nN=int(input())\nA=[int(item) for item in input().split()]\n\ntmp=[a-n-1 for n,a in enumerate(A)]\nprint(tmp)\nprint(sum(tmp)/len(tmp))\nb=math.ceil(sum(tmp)/len(tmp))\n\nprint(sum([abs(item-b) for item in tmp]))', 'import math\n\nN=int(input())\nA=[int(item) for item in input().split()]\n\ntmp=[a-n-1 for n,a in enumerate(A)]\nprint(tmp)\nprint(sum(tmp)/len(tmp))\nbset=set([math.floor(sum(tmp)/len(tmp)),math.ceil(sum(tmp)/len(tmp))])\n\nprint(min([sum([abs(item-b) for item in tmp]) for b in bset\n ]\n )\n )', 'n = int(input())\na = list(map(int, input().split()))\nb = [0] * n\n \ns1 = 0\ns2 = 0\n \nfor i in range(n):\n b[i] = a[i] - i\nb.sort()\n \nb1 = b[n//2]\nb2 = b[n//2-1]\n \nfor i in range(n):\n s1 += abs(a[i] - b1 - i)\n \nfor i in range(n):\n s2 += abs(a[i] - b2 - i)\n \nprint(min(s1, s2))']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s202823673', 's690951613', 's828293333', 's417941391']
[30980.0, 30844.0, 30844.0, 26708.0]
[143.0, 141.0, 163.0, 282.0]
[254, 216, 304, 281]
p03309
u549383771
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['n = int(input())\na_list = list(map(int,input().split()))\nimport numpy as np\nprint(int(np.median(a_list)) - (a_list.index(int(np.median(a_list))) + 1))', 'n = int(input())\na_list = list(map(int,input().split()))\nans_list = []\nfor i in range(len(a_list)):\n ans_list.append(a_list[i] - i - 1)\nimport numpy as np\nif len(ans_list)% 2 == 0:\n ans_list1 = sorted(ans_list)\n number1 = ans_list1[n//2]\n number2 = ans_list1[n//2 + 1]\n \n ans1 = 0\n ans2 = 0\n for i in ans_list:\n ans1 += abs(i - number1)\n ans2 += abs(i - number2)\n print(min(ans1 , ans2))\nelse:\n cary = ans_list\n number = int(np.median(cary))\n ans = 0\n for i in ans_list:\n ans += abs(i - number)\n print(ans)\n']
['Runtime Error', 'Accepted']
['s193664671', 's240896120']
[37656.0, 44572.0]
[257.0, 299.0]
[150, 570]
p03309
u550146922
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['li = sorted([a[i]-(i+1) for i in range(n)])\nif n%2==0:\n ave = (li[n//2]+li[n//2-1])//2\nelse:\n ave = li[(n-1)//2]\n\nimport math\nave1 = math.floor(ave)\nave2 = math.ceil(ave)\n\nll = []\nc = 0\nfor i in range(n):\n c += abs(a[i]-(ave1+i+1))\nelse:\n ll += [c]\n\nc =0\nfor i in range(n):\n c += abs(a[i]-(ave2+i+1))\nelse:\n ll += [c]\n\nprint(min(ll))', 'n = int(input())\na = list(map(int,input().split()))\n\nli = sorted([a[i]-(i+1) for i in range(n)])\nif n%2==0:\n ave = (li[n//2]+li[n//2-1])//2\nelse:\n ave = li[(n-1)//2]\n\nimport math\nave1 = math.floor(ave)\nave2 = math.ceil(ave)\n\nll = []\nc = 0\nfor i in range(n):\n c += abs(a[i]-(ave1+i+1))\nelse:\n ll += [c]\n\nc =0\nfor i in range(n):\n c += abs(a[i]-(ave2+i+1))\nelse:\n ll += [c]\n\nprint(min(ll))']
['Runtime Error', 'Accepted']
['s078907568', 's775084899']
[9120.0, 30800.0]
[29.0, 233.0]
[351, 404]
p03309
u558242240
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['n = int(input())\na = list(map(int , input().split()))\nb = [a[i] - (i+1) for i in range(n)]\nprint(b)\nb.sort()\n\nans = 10 ** 10\nfor j in range(3):\n bi = b[((n-1)//2+j)%n]\n s = 0\n for i in range(n):\n s += abs(b[i] - bi)\n print(((n-1)//2+j)%n, s)\n ans = min(ans, s)\nprint(ans)', 'n = int(input())\na = list(map(int , input().split()))\nb = [a[i] - (i+1) for i in range(n)]\n\nb.sort()\n#print(b)\n\nbi = b[n//2]\ns = 0\nfor i in range(n):\n s += abs(a[i] - (i + 1 + bi))\n#print(((n-1)//2+j)%n, s)\n\nprint(s)\n\n']
['Wrong Answer', 'Accepted']
['s927300931', 's169510725']
[26180.0, 25200.0]
[314.0, 233.0]
[293, 437]
p03309
u558782626
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
["N = int(input())\nnumbers = map(int, input().split())\nmin_num = min(numbers)\nmax_num = max(numbers)\nabs_= float('inf')\nfor b in range(min_num, max_num):\n abs_pre = sum([abs(a-b-i) for i, a in enumerate(numbers)])\n if abs_pre < abs_:\n abs_ = abs_pre\nprint(abs_)", "N = int(input())\nnumbers = list(map(int, input().split()))\nmin_num = min(numbers)\nmax_num = max(numbers)\nabs_= float('inf')\nfor b in range(min_num, max_num):\n abs_pre = sum([abs(a-b-i) for i, a in enumerate(numbers)])\n if abs_pre < abs_:\n abs_ = abs_pre\nprint(abs_)", "N = int(input())\nnumbers = list(map(int, input().split()))\nmin_num = min(numbers)\nmax_num = max(numbers)\nabs_= float('inf')\nfor b in range(min_num, max_num+1):\n abs_pre = sum([abs(a-b-i) for i, a in enumerate(numbers)])\n if abs_pre < abs_:\n abs_ = abs_pre\nprint(abs_)\n", 'from statistics import median\n\nN = int(input())\nnumbers = [int(a)-i for i, a in enumerate(input().split())]\nb = median(numbers)\nabs_1 = sum([abs(c-int(b)) for c in numbers])\nabs_2 = sum([abs(c-int(b)-1) for c in numbers])\nprint(min(abs_1, abs_2))']
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s089676972', 's239075576', 's365921544', 's916756985']
[20856.0, 26832.0, 26180.0, 27248.0]
[65.0, 2104.0, 2104.0, 273.0]
[272, 278, 281, 246]
p03309
u560072805
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['N=int(input())\nA=list(map(int,input().split()))\nB=A.copy()\nB.sort()\nA_max=B[N]+N\nsum_A=[0]*(A_max+1)\nfor i in range(A_max+1):\n for num in range(N):\n sum_A[i]+=abs(A[num]-i)\nsum_A.sort()\nprint(sum_A[0])\n \n \n \n\n\n', 'N=int(input())\nA=list(map(int,input().split()))\nB=A.copy()\nB.sort()\nA_max=B[N-1]+N\nsum_A=[0]*(A_max+1)\nfor i in range(A_max+1):\n for num in range(N):\n sum_A[i]+=abs(A[num]-i)\nsum_A.sort()\nprint(sum_A[0])\n \n \n \n\n\n', 'N=int(input())\nA=list(map(int,input().split()))\nB=A.copy()\nB.sort()\nA_max=B[N-1]+N\nsum_A=[0]*N\nfor i in range(A_max+1):\n for num in range(N):\n sum_A[i]+=abs(A[num]-i)\nsum_A.sort()\nprint(sum_A[0])\n \n \n \n\n\n', 'N=int(input())\nA=list(map(int,input().split()))\nB=[]\nfor i in range(N):\n B.append(A[i]-(i+1))\nB.sort()\nif N%2==0:\n a=N/2\nelse:\n a=(N+1)/2\nb=B[a-1]\nfor i in range(N):\n B[N-1]=abs(B[N-1]-b)\nprint(B)\n \n \n ', 'N=int(input())\nA=list(map(int,input().split()))\nB=[]\nfor i in range(N):\n B.append(A[i]-(i+1))\nB.sort()\nif N%2==0:\n a=N/2\n b=int((B[int(a)]+B[int(a-1)])/2)\nelse:\n a=(N+1)/2\n b=B[int(a-1)]\nfor i in range(N):\n B[i]=abs(B[i]-b)\nprint(sum(B))\n \n \n ']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s010265684', 's159812350', 's213608370', 's691439193', 's057161654']
[30800.0, 3436348.0, 30964.0, 30808.0, 30848.0]
[106.0, 2292.0, 2206.0, 140.0, 180.0]
[219, 221, 213, 211, 251]
p03309
u571444155
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['n = int(input())\n\na = list(map(int, input().split()))\ns = 10000000\n\nfor i in range(2+max(a)):\n s_tmp = 0\n \n for j in range(n):\n s_tmp = s_tmp + abs(a[l] - i - (j+1))\n \n if s_tmp < s:\n s = s_tmp\n\nprint(s)', 'n = int(input())\n\na = list(map(int, input().split()))\ns = 10000000\n\nfor i in range(2+max(a)):\n s_tmp = 0\n \n for j in range(n):\n s_tmp = s_tmp + abs(a[j] - i - (j+1))\n \n if s_tmp < s:\n s = s_tmp\n\nprint(s)\n', 's = 10000000\n\nfor i in range(2+max(a)):\n s_tmp = 0\n \n for j in range(n):\n s_tmp = s_tmp + abs(a[l] - i - (j+1))\n \n if s_tmp < s:\n s = s_tmp\n', 'n = int(input())\n\na = list(map(int, input().split()))\n\nsorted_num = sorted([a[i] - i for i in range(len(a))])\n\nb = sorted_num[len(sorted_num)//2]\nprint(sum([abs(b-i) for i in sorted_num]))\n']
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s023498787', 's096641853', 's866257009', 's395463601']
[25200.0, 26836.0, 2940.0, 27592.0]
[72.0, 2104.0, 17.0, 198.0]
[220, 221, 157, 189]
p03309
u575431498
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['N = int(input())\nA = [int(i) for i in input().split()]\n\nX = [a-(i+1) for i, a in enumerate(A)]\nX.sort()\nprint(X)\nb = X[(N)//2]\nprint(sum([abs(x - b) for x in X]))', 'N = int(input())\nA = [int(i) for i in input().split()]\n\nX = [a-(i+1) for i, a in enumerate(A)]\nX.sort()\nb = X[(N)//2]\nprint(sum([abs(x - b) for x in X]))']
['Wrong Answer', 'Accepted']
['s244038416', 's526888856']
[30580.0, 27848.0]
[233.0, 212.0]
[162, 153]
p03309
u576432509
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['n=int(input())\na=list(map(int,input().split()))\n\n#n=5\n#stra="2 2 3 5 5"\n#ans=2\n\n#n=9\n#stra="1 2 3 4 5 6 7 8 9"\n#ans=0\n\n#n=6\n#stra="6 5 4 3 2 1"\n#ans=18\n\n#n=7\n#stra="1 1 1 1 2 3 4"\n#ans=6\n\n#a=list(map(int,stra.split()))\n\nfor i in range(n):\n a[i]=a[i]-i-1\n#print(a)\na.sort()\n\ns=[a[0]]\nfor i in range(1,n):\n s.append(s[i-1]+a[i])\n \nbmin=min(a)-n\nbmax=max(a)+n\n\n \nasmin=bmax*n\nm0=0\nfor b in range(bmin,bmax+1):\n m=bisect.bisect(a,b)\n if m<=0:\n asf=-n*b+s[n-1]\n elif m<n:\n asf=(2*m-n)*b+s[n-1]-2*s[m-1]\n elif n<=m:\n asf=n*b-s[n-1]\n \n# print("b",b,"m",m,"asf",asf)\n if asf<asmin:\n asmin=asf\n\nprint(asmin)\n', '\nn=int(input())\na=list(map(int,input().split()))\nb=[0]*n\nfor i in range(n):\n b[i]=a[i]-(i+1)\n\nb.sort()\n\nb2=b[n//2]\n\nbsum=0\nfor i in range(n):\n bsum+=abs(b[i]-b2)\n \nbsum2=0\nfor i in range(n):\n bsum2+=abs(b[i]-b2-1)\n\nprint(min(bsum,bsum2))\n']
['Runtime Error', 'Accepted']
['s722000264', 's439243067']
[26180.0, 26020.0]
[260.0, 295.0]
[662, 250]
p03309
u585265265
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['def main():\n N = int(input())\n A = []\n for i in range(N):\n A.append(int(input()))\n C = [A[i] - i - 1 for i in range(N)]\n C.sort()\n m = N // 2\n x = C[m]\n left = sum([x - C[i] for i in range(m)])\n right = sum([C[i] - x for i in range(m + 1, N)])\n print(left + right)\n \nif __name__ == "__main__":\n main()', 'def main():\n N = int(input())\n A = []\n data = input().split()\n for i in range(N):\n A.append(int(data[i]))\n C = [A[i] - i - 1 for i in range(N)]\n C.sort()\n m = N // 2\n x = C[m]\n left = sum([x - C[i] for i in range(m)])\n right = sum([C[i] - x for i in range(m + 1, N)])\n print(left + right)\n \nif __name__ == "__main__":\n main()']
['Runtime Error', 'Accepted']
['s495430257', 's490563250']
[8028.0, 38752.0]
[31.0, 207.0]
[344, 371]
p03309
u585742242
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['# -*- coding: utf-8 -*-\nINF = 10**10\nn = int(input())\na = [int(_) - (i + 1) for i, _ in enumerate(input().split())]\na_posi = [ai for ai in a if ai >= 0]\na_posi_num = len(a_posi)\na_posi_sum = sum(a_posi)\na_nega = [ai for ai in a if ai < 0]\na_nega_num = len(a_nega)\na_nega_sum = abs(sum(a_nega))\n\ngrief = INF\nfor b in set(a):\n if b >= 0:\n tmp = (a_posi_sum - b * a_posi_num) + (a_nega_sum + b * a_nega_num)\n else:\n tmp = (a_posi_sum + (-b) * a_posi_num) + (a_nega_sum -\n (-b) * a_nega_num)\n\n if tmp < grief:\n grief = tmp\n\nprint(grief)\n', '# -*- coding: utf-8 -*-\nn = int(input())\na = [int(_) - (i + 1) for i, _ in enumerate(input().split())]\n\n# INF = 10**10\n# grief = INF\n# for b in set(a):\n# tmp = sum([abs(ai - b) for ai in a])\n# if tmp < grief:\n# bb = b\n# grief = tmp\n\n\n\na.sort()\nmed = a[len(a) // 2]\ngrief = sum([abs(ai - med) for ai in a])\nprint(grief)\n']
['Wrong Answer', 'Accepted']
['s335553146', 's468614362']
[25960.0, 25196.0]
[216.0, 196.0]
[612, 385]
p03309
u586594818
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['a = int(input())\nb = input().split()\nc = []\nfor i in range(a):\n c.append(int(b[i]))\ng = []\nfor i in range(a):\n g.append(c[i] - i-1)\ng.sort()\nd = g[int(a/2)]\nf = 0\nfor i in range(a):\n e = abs(c[i]-(d+i+1))\n f += e\nf', 'a = int(input())\nb = input().split()\nc = []\nfor i in range(a):\n c.append(int(b[i]))\ng = []\nfor i in range(a):\n g.append(c[i] - i-1)\ng.sort()\nd = g[int(a/2)]\nf = 0\nfor i in range(a):\n e = abs(c[i]-(d+i+1))\n f += e\nprint(f)']
['Wrong Answer', 'Accepted']
['s043751866', 's843336087']
[33864.0, 33864.0]
[302.0, 299.0]
[218, 225]
p03309
u589726284
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['import collections\n\nN = int(input())\nA = list(map(int, input().split()))\nli = []\nb = 0\nif max(A) > (sum(A) - max(A):\n b = -max(A)\n for i in range(N):\n li.append(abs(A[i]-(b+i+1)))\n print(sum(li))\nelse :\n for i in range(N):\n li.append(abs(A[i]-(b+i+1)))\n c = collections.Counter(li)\n b = -c.most_common()[0][0]\n li.clear()\n for i in range(N):\n li.append(abs(A[i]-(b+i+1)))\n print(sum(li))', 'import statistics\n\nN = int(input())\nA = list(map(int, input().split()))\nB = []\nli = []\nfor i in range(N):\n B.append(A[i] - (i+1))\nb = int(statistics.median(B))\nfor i in range(N):\n li.append(abs(A[i] - (b+i+1)))\nprint(sum(li))']
['Runtime Error', 'Accepted']
['s328747508', 's413376844']
[2940.0, 29648.0]
[17.0, 277.0]
[405, 227]
p03309
u599547273
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['import statistics\n\nn = int(input())\na = [int(n) for n in input().split(" ")]\n\nsub_a = [a_n - i - 1 for i, a_n in enumerate(a)]\nmedian = statistics.median(sub_a)\nprint(sum([abs(sub_a-median) for sub_a_n in sub_a]))', 'import statistics\n\nn = int(input())\na = [int(n) for n in input().split(" ")]\n\nsub_a = [a_n - i - 1 for i, a_n in enumerate(a)]\nmedian = statistics.median(sub_a)\nprint(int(sum([abs(sub_a_n-median) for sub_a_n in sub_a])))']
['Runtime Error', 'Accepted']
['s456020040', 's728200300']
[27232.0, 28096.0]
[190.0, 220.0]
[213, 220]
p03309
u600402037
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['import numpy as np\n\nN = int(input())\nA = np.array(list(map(int, input().split())))\nR = np.array([x+1 for x in range(N)])\n\nav = int(np.average(A-R))\nprint(abs(A-R-av))', 'import numpy as np\n\nN = int(input())\nA = np.array(list(map(int, input().split())))\nR = np.array([x+1 for x in range(N)])\n\nav = int(np.round((np.average(A-R))))\nanswer = 0\nfor i in range(-10, 10):\n result = abs(A-R-av-i).sum()\n if answer > result:\n answer = result\nprint(answer)\n', '# coding: utf-8\nimport sys\nimport numpy as np\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\n\nN = ir()\nA = np.array(lr(), dtype=np.int32)\nA -= np.arange(1, N+1)\nanswer = np.abs(A - np.median(A)).sum()\nprint(answer)\n', '# coding: utf-8\nimport sys\nimport numpy as np\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\n\nN = ir()\nA = np.array(lr(), dtype=np.int32)\nA -= np.arange(1, N+1)\nanswer = np.abs(A - int(np.median(A))).sum()\nprint(answer)\n']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s503910775', 's638433907', 's935661122', 's226662047']
[34184.0, 34188.0, 34184.0, 34188.0]
[248.0, 267.0, 290.0, 214.0]
[166, 291, 277, 282]
p03309
u606878291
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
["import numpy as np\n\nN = int(input())\nA = np.array(list(map(int, input().split(' '))))\nB = np.arange(1, N + 1)\n\nC = A - B\nmean = int(np.mean(C))\n\nprint(min(np.sum(np.abs(C - mean))), np.sum(np.abs(C + mean)))\n", "import numpy as np\n\nN = int(input())\nA = np.array(list(map(int, input().split(' '))))\n\ndiff = A - (np.arange(N) + 1)\ndiff.sort()\n\nif N % 2 == 0:\n median = (diff[N // 2] + diff[N // 2 - 1]) // 2\nelse:\n median = diff[N // 2]\n\nprint(np.sum(np.abs(diff - median)))\n"]
['Runtime Error', 'Accepted']
['s043636763', 's613134256']
[49444.0, 49584.0]
[164.0, 174.0]
[208, 267]
p03309
u614459338
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['from scipy import optimize\nN = int(input())\nA = list(map(lambda x:int(x),input().split(" ")))\ndef f(x):\n tmp = 0\n for i in range(0,len(A)):\n tmp += abs(A[i]-(x+i+1))\n return tmp\nprint(int(round(optimize.brent(f))))', 'import numpy as np\nN = int(input())\nA = list(map(lambda x:int(x),input().split(" ")))\nnpA = np.array(A)\nB = npA-(1+np.arange(len(npA)))\nopt_b = statistics.median(B)\nprint(int(np.sum(np.abs(B-opt_b))))', 'import numpy as np\nfrom statistics import median\nN = int(input())\nA = list(map(lambda x:int(x),input().split(" ")))\nnpA = np.array(A)\nB = npA-(1+np.arange(len(npA)))\nopt_b = median(B)\nprint(int(np.sum(np.abs(B-opt_b))))']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s549879286', 's578485787', 's112431829']
[39596.0, 34208.0, 35388.0]
[2110.0, 232.0, 1127.0]
[230, 200, 219]
p03309
u619379081
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['n = int(input())\na = list(map(int, input().split()))\nfor j in range(n):\n a[j] = a[j] - (j + 1)\na.sort()\nif x % 2 == 0:\n print(sum(a[n / 2:]) - sum(a[:n / 2])\nelse:\n print(sum(a[(n + 1) / 2:]) - sum(a[:(n - 1) / 2])', 'n = int(input())\na = list(map(int, input().split()))\ndef devide2a(x):\n \ndef devide2b(y):\n if x % 2 == 0:\n return int(n / 2)\n else:\n return int((n - 1) / 2)\nfor j in range(n):\n a[j] = a[j] - (j + 1)\na.sort()\nif x % 2 == 0:\n print(sum(a[n / 2:]) - sum(a[:n / 2])\nelse:\n print(sum(a[(n + 1) / 2:]) - sum(a[:(n - 1) / 2])', 'n = int(input())\na = list(map(int, input().split()))\nfor j in range(n):\n a[j] = a[j] - (j + 1)\na.sort()\nif n % 2 == 0:\n print(sum(a[int(n / 2):]) - sum(a[:int(n / 2)]))\nelse:\n print(sum(a[int((n + 1) / 2):]) - sum(a[:int((n - 1) / 2)]))']
['Runtime Error', 'Runtime Error', 'Accepted']
['s152513721', 's414995600', 's862984825']
[2940.0, 2940.0, 26020.0]
[17.0, 17.0, 192.0]
[223, 349, 245]
p03309
u626468554
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['n = int(input())\na = list(map(int,input().split()))\n\nli = []\n\nfor i in range(n):\n memo = a[i]-(i+1)\n li.append(memo)\n\nli.sort()\n\nmemo = len(li)\nmemo2 = li[memo//2]\n\nli2 = [memo2 for i in range(len(li))]\nli = li - li2\n\nttl = 0\nfor i in range(n):\n ttl += abs(li[i])\n\nprint(ttl)\n', 'n = int(input())\na = list(map(int,input().split()))\n\nli = []\n\nfor i in range(n):\n memo = a[i]-(i+1)\n li.append(memo)\n\nli.sort()\nprint(li)\nmemo = len(li)\nmemo2 = li[memo//2]\n\nli2 = [-(memo2) for i in range(len(li))]\nfor i in range(n):\n li[i] = li[i] + li2[i]\nprint(li)\nttl = 0\nfor i in range(n):\n ttl += abs(li[i])\n\nprint(ttl)\n', 'n = int(input())\na = list(map(int,input().split()))\n\nli = []\n\nfor i in range(n):\n memo = a[i]-(i+1)\n li.append(memo)\n\nli.sort()\n#print(li)\nmemo = len(li)\nmemo2 = li[memo//2]\n\nli2 = [-(memo2) for i in range(len(li))]\nfor i in range(n):\n li[i] = li[i] + li2[i]\n#print(li)\nttl = 0\nfor i in range(n):\n ttl += abs(li[i])\n\nprint(ttl)\n']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s216839701', 's658333314', 's174883818']
[25876.0, 36724.0, 26860.0]
[201.0, 357.0, 291.0]
[285, 338, 340]
p03309
u626881915
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['n = int(input())\na = list(map(int, input().split()))\nfor i in range(n):\n a[i] -= i+1\n\nb = round(sum(a)/n, 0)\nans = 0\nfor i in range(n):\n ans += abs(a[i]-b)\n\nprint(ans)', 'import math\n\nn = int(input())\na = list(map(int, input().split()))\nfor i in range(n):\n a[i] -= i+1\na = sorted(a)\nb1 = math.floor(sum(a)/n)\nb2 = math.ceil(sum(a)/n)\nb3 = b1-1\nb4 = b2+1\nb5 = a[n//2]\nb6 = a[n//2-1]\n\nans1 = 0\nans2 = 0\nans3 = 0\nans4 = 0\nans5 = 0\nans6 = 0\nfor i in range(n):\n ans1 += abs(a[i]-b1)\n ans2 += abs(a[i]-b2)\n ans3 += abs(a[i]-b3)\n ans4 += abs(a[i]-b4)\n ans5 += abs(a[i]-b5)\n ans6 += abs(a[i]-b6)\nprint(min(ans5, ans6))\n']
['Wrong Answer', 'Accepted']
['s755002724', 's503486498']
[26836.0, 26608.0]
[154.0, 440.0]
[169, 447]
p03309
u627886394
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
["import fractions\nimport statistics\nimport operator\nfrom functools import reduce\nN = int(input())\na_list = list(map(int, input().split(' ')))\nmedian = statistics.median(a_list)\nbias = (N+1) / 2\nb = median - bias\nprint(sum([abs(a - (b + i)) for i,a in enumerate(a_list, start=1)]))\n", "import fractions\nimport statistics\nimport operator\nfrom functools import reduce\nN = int(input())\na_list = list(map(int, input().split(' ')))\nmedian = statistics.median([a - i for i,a in enumerate(a_list)])\nprint(int(sum([abs(a - (median + i)) for i,a in enumerate(a_list)])))\n\n"]
['Wrong Answer', 'Accepted']
['s570297517', 's396526926']
[27212.0, 27208.0]
[212.0, 231.0]
[280, 277]
p03309
u629350026
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['n=int(input())\na=list(map(int,input().split()))\ntemp=[0]*n\nfor i in range(0,n):\n temp[i]=a[i]-(i+1)\ntemp.sort()\nave=temp/n\nprint(ave)', 'n=int(input())\na=list(map(int,input().split()))\ntemp=[0]*n\nfor i in range(0,n):\n temp[i]=a[i]-(i+1)\ntemp.sort()\nave=int(n/2)\nans=0\nfor i in range(0,n):\n ans=ans+abs(temp[i]-temp[ave])\nprint(ans)']
['Runtime Error', 'Accepted']
['s530249869', 's550438373']
[26708.0, 26020.0]
[202.0, 249.0]
[134, 196]
p03309
u633105820
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
["import unittest\n\nfrom app.ABC102_C import run\n\n\nclass TestSample(unittest.TestCase):\n def test_run(self):\n self.assertEqual(run(5, [2, 2, 3, 5, 5]), 2)\n self.assertEqual(run(9, [1, 2, 3, 4, 5, 6, 7, 8, 9]), 0)\n self.assertEqual(run(6, [6, 5, 4, 3, 2, 1]), 18)\n self.assertEqual(run(7, [1, 1, 1, 1, 2, 3, 4]), 6)\n\n\nif __name__ == '__main__':\n unittest.main()", "def run(n, a):\n a = [a[i]-i-1 for i in range(len(a))]\n a.sort()\n m = a[int((n-1)/2)]\n ret = 0\n for ai in a:\n print('ai - m', (ai - m))\n ret += abs(ai - m)\n return ret\n\n\ndef read_line():\n n = int(input())\n a = list(map(int, input().split()))\n return (n, a)\n\n\ndef main():\n n, a = read_line()\n print(run(n, a))\n\n\nif __name__ == '__main__':\n main()\n", "def run(n, a):\n a = [a[i]-i-1 for i in range(len(a))]\n a.sort()\n m = a[int((n-1)/2)]\n ret = 0\n for ai in a:\n ret += abs(ai - m)\n return ret\n\n\ndef read_line():\n n = int(input())\n a = list(map(int, input().split()))\n return (n, a)\n\n\ndef main():\n n, a = read_line()\n print(run(n, a))\n\n\nif __name__ == '__main__':\n main()\n"]
['Runtime Error', 'Wrong Answer', 'Accepted']
['s440714122', 's461854326', 's028081839']
[5964.0, 26708.0, 26836.0]
[121.0, 408.0, 187.0]
[391, 395, 361]
p03309
u634208461
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['N = int(input())\nA = list(map(int, input().split()))\nB = [A[i] - 1 - i for i in range(N)]\nB.sort()\nif N % 2 == 0:\n med = [int((B[int(N / 2) - 1] + B[int(N / 2)]) / 2)]\nelse:\n med = [B[int((N + 1) / 2) - 1]]\nS = 0\nfor i in range(N):\n S += abs(B[i] - b)\nprint(S)\n', 'N = int(input())\nA = list(map(int, input().split()))\nB = [A[i] - 1 - i for i in range(N)]\nB.sort()\nif N % 2 == 0:\n med = int((B[int(N / 2) - 1] + B[int(N / 2)]) / 2)\nelse:\n med = B[int((N + 1) / 2) - 1]\nS = 0\nfor i in range(N):\n S += abs(B[i] - med)\nprint(S)\n']
['Runtime Error', 'Accepted']
['s736291850', 's153307875']
[25200.0, 26180.0]
[170.0, 215.0]
[270, 268]
p03309
u636311816
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['import statistics as stc\n\nn=int(input())\n \na = list(map(int, input().split()))\n\n#a[i]-(b+1) = a[i]-i-b\na_ = [a[i]-(i+1) for i in range(len(a))]\n\nb=stc.median(a)\n\ndef sad(a,b):\n score=0\n for i in range(1,len(a)+1):\n #score+= abs(a[i]-(b+i))\n score+= abs(a_[i]-b)\n\nres = sad(a,b)\nprint(res)', 'import statistics as stc\n\nn=int(input())\n \na = list(map(int, input().split()))\n\n#a[i]-(b+1) = a[i]-i-b\na_ = [a[i]-(i+1) for i in range(len(a))]\n\nb=stc.median(a_)\n\ndef sad(a,b):\n b=int(b)\n score=0\n for i in range(len(a)):\n score+= abs(a[i]-b)\n return score\n\nres = sad(a_,b)\nprint(res)']
['Runtime Error', 'Accepted']
['s270394741', 's182974065']
[27244.0, 27232.0]
[221.0, 214.0]
[308, 302]
p03309
u636489589
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['n = int(input())\na = list(map(int, input().split()))\nb = [a[i] - i - 1 for i in range(n)]\nb = sorted(b)\nif n % 2 == 1:\n print(b[(n-1)//2])\nelse:\n print((b[n//2] + b[n//2+1])//2)\n', 'n = int(input())\na = list(map(int, input().split()))\nb = [a[i] - i - 1 for i in range(n)]\nb = sorted(b)\nif n % 2 == 1:\n c = b[(n-1)//2]\nelse:\n c = round((b[n//2-1] + b[n//2])//2)\n\nprint(sum(map(abs,[b[i]-c for i in range(n)])))']
['Wrong Answer', 'Accepted']
['s177398870', 's097752989']
[30908.0, 33320.0]
[122.0, 169.0]
[180, 229]
p03309
u648212584
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['N = int(input())\nX = list(map(int,input().split()))\n\nfor i in range(N):\n\tX[i] -= (i+1)\n\nX.sort()\nprint(X)\nans = 0\nfor i in range(N):\n\tans += abs(X[i]-X[N//2])\n\nprint(ans)', 'N = int(input())\nX = list(map(int,input().split()))\n\nfor i in range(N):\n\tX[i] -= (i+1)\n\nX.sort()\nans = 0\nfor i in range(N):\n\tans += abs(X[i]-X[N//2])\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s925403378', 's005505269']
[26708.0, 25196.0]
[268.0, 244.0]
[170, 161]
p03309
u648868410
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['\n\n\n\n\n\n\ndef calcVal(b):\n\tval = 0\n\tfor n in range(N):\n\t\tval += abs(A[n]-(b+n+1))\n\treturn val\n\nN=int(input())\nA=list(map(int,input().split()))\n\nM=[]\n\nfor i,a in enumerate(A):\n\tM.append( a - (i+1) )\n\nM.sort()\n\nif N%2==0:\n\tmed1=N//2\n\tmed2=N//2+1\n\tans=min(calcVal(M[med1]),calcVal(M[med2]))\n\nelse:\n\tmed=(N+1)//2\n\tans = calcVal(M[med])\n\n\nprint(ans)\n\n', '\n\n\n\n\n\n\ndef calcVal(b):\n\tval = 0\n\tfor n in range(N):\n\t\tval += abs(A[n]-(b+n+1))\n\t\t# print(A[n])\n\t\t# print(n)\n\t\t# print(val)\n\t\t# print(abs(A[n]-(b+n+1)))\n\t\t# print("")\n\treturn val\n\nN=int(input())\nA=list(map(int,input().split()))\n\nM=[]\n\nfor i,a in enumerate(A):\n\tM.append( a - (i+1) )\n\nM.sort()\n\nif N%2==0:\n\tmed1=N//2\n\tmed2=N//2+1\n\tif N <= med2:\n\t\tmed2 = med1\n\tans=min(calcVal(M[med1]),calcVal(M[med2]),calcVal(0))\n\nelse:\n\tmed=(N+1)//2\n\tprint(M[med])\n\tans = min(calcVal(M[med]),calcVal(0))\n\n\nprint(ans)\n\n', '\n\n\n\n\n\n\ndef calcVal(b):\n\t# print(b)\n\tval = 0\n\tfor n in range(N):\n\t\tval += abs(A[n]-(b+n+1))\n\t\t# print(A[n])\n\t\t# print(n)\n\t\t# print(val)\n\t\t# print(abs(A[n]-(b+n+1)))\n\t\t# print("")\n\treturn val\n\nN=int(input())\nA=list(map(int,input().split()))\n\nM=[]\n\nfor i,a in enumerate(A):\n\t#if a - (i+1) not in M:\n\tM.append( a - (i+1) )\n\nM.sort()\nlenM=len(M)\n\nif lenM==1:\n\tans=calcVal(M[0])\n\nelif lenM==2:\n\tans=min(calcVal(M[0]),calcVal(M[1]))\n\n\nelse:\n\tmed1=lenM//2-1\n\tmed2=lenM//2\n\t#print(M)\n\tans=min(calcVal(M[med1]),calcVal(M[med2]),calcVal(0))\n\n\n\nprint(ans)\n\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s272458168', 's294005790', 's565992269']
[25748.0, 25708.0, 25744.0]
[269.0, 302.0, 303.0]
[542, 700, 744]
p03309
u656643475
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['# Q_C\nN = int(input())\nA = list(map(int, input().split()))\n\nimport numpy as np\n\nA = np.array(A)\nI = np.array(list(range(1, N + 1)))\n\nG = A - I\n\n#print(G)\nb = np.min(G)\n#print(b)\n\nre = 10 ** 20\n\nif b > 0:\n G = G - np.full(N, b)\n G = np.absolute(G)\n re = np.sum(G)\nelif b == 0:\n G = np.absolute(G)\n G = np.sum(G)\n\nelse:\n uG = np.unique(G)\n for i in uG:\n temp = np.sum(np.absolute(G - np.full(N , i)))\n# print(temp)\n if re > temp:\n re = temp\n\nprint(int(re))', '# Q_C\nN = int(input())\nA = list(map(int, input().split()))\n\nimport numpy as np\n\nA = np.array(A)\nI = np.array(list(range(1, N + 1)))\n\nG = A - I\n\n#print(G)\nb = np.min(G)\n#print(b)\n\nre = 10 ** 20\n\nif b > 0:\n G = G - np.full(N, b)\n G = np.absolute(G)\n re = np.sum(G)\nelif b == 0:\n G = np.absolute(G)\n G = np.sum(G)\n\nelse:\n uG = np.unique(G)\n for i in uG:\n temp = np.sum(np.absolute(G - np.full(N , i)))\n# print(temp)\n if re > temp:\n re = temp\n\nprint(int(re))', 'N = int(input())\nA = list(map(int, input().split()))\n\nimport numpy as np\nimport collections\n\nA = np.array(A)\nI = np.array(list(range(1, N + 1)))\n\nG = A - I\n\nb = np.median(G)\nG = np.absolute(G - np.full(N, b))\nre = np.sum(G)\n\nprint(int(re))']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s424914733', 's553016136', 's449061890']
[26016.0, 26020.0, 26708.0]
[2109.0, 2109.0, 243.0]
[571, 571, 239]
p03309
u657541767
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['n = int(input())\na = [int(x) for x in input().split()]\na2 = [0] * n\nb = 999999999999\n\nfor i in range(n):\n a2[i] = a[i] - (i+1)\n\nprint(a2)\nres = [0] * n\nmean = sum(a2)//n\nfor i in range(n):\n res[i] = abs(a2[i] - mean)\n\nprint(sum(res))\n', 'import math\nimport statistics\n\nn = int(input())\na = [int(x) for x in input().split()]\na2 = [0] * n\nfor i in range(n):\n a2[i] = a[i] - (i+1)\nmedian = int(statistics.median(a2))\nfor i in range(n):\n a2[i] = abs(a2[i]-median)\nprint(sum(a2))\n']
['Wrong Answer', 'Accepted']
['s904069925', 's292584086']
[30452.0, 27248.0]
[201.0, 254.0]
[240, 243]
p03309
u669770658
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['N = int(input())\nA = [int(i) for i in input().split()]\n\nsum = 0\nans = []\n\nfor b in range(-N, N):\n for i in range(N):\n sum += abs(A[i] - (b + i))\n else:\n ans.append(sum)\n sum = 0\n\nprint(ans)\n\n', 'N = int(input())\nA = list(map(int, input().split()))\n\nB = [A[i] - (i + 1) for i in range(N)]\n\nB.sort()\n\nb = B[len(B) // 2]\n\nans = 0\n\nfor j in range(N):\n ans += abs(A[j] - (b + j + 1))\n\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s633199505', 's185146168']
[26180.0, 26016.0]
[2104.0, 233.0]
[218, 199]
p03309
u672494157
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['import sys\nfrom collections import deque\nfrom functools import reduce\nimport copy\n\n\nsys.setrecursionlimit(4100000)\n\n\ndef inputs(num_of_input):\n ins = [input() for i in range(num_of_input)]\n return ins\n\n\ndef solve(inputs):\n nums = string_to_int(inputs[0])\n N = len(nums)\n for i in range(N):\n nums[i] -= (i+1)\n total = reduce(lambda x, y: x + y, nums, 0)\n # sub = total // N\n half = N // 2\n if N % 2 == 0:\n sub = (nums[half-1] + nums[half]) // 2\n else:\n sub = nums[half]\n total = reduce(lambda acc, x: acc + abs(x - sub), nums, 0)\n print(nums)\n return total\n\n\ndef string_to_int(string):\n return list(map(int, string.split()))\n\n\nif __name__ == "__main__":\n input()\n ret = solve(inputs(1))\n print(ret)\n', 'import sys\nfrom collections import deque\nfrom functools import reduce\nimport copy\n\n\nsys.setrecursionlimit(4100000)\n\n\ndef inputs(num_of_input):\n ins = [input() for i in range(num_of_input)]\n return ins\n\n\ndef solve(inputs):\n nums = string_to_int(inputs[0])\n N = len(nums)\n for i in range(N):\n nums[i] -= (i+1)\n nums.sort()\n total = reduce(lambda x, y: x + y, nums, 0)\n half = N // 2\n sub = nums[half]\n total = reduce(lambda acc, x: acc + abs(x - sub), nums, 0)\n return total\n\n\ndef string_to_int(string):\n return list(map(int, string.split()))\n\n\nif __name__ == "__main__":\n input()\n ret = solve(inputs(1))\n print(ret)']
['Wrong Answer', 'Accepted']
['s369012284', 's479275289']
[28556.0, 28804.0]
[164.0, 228.0]
[770, 666]
p03309
u673338219
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['n = int(input())\na = list(map(int,input().split()))\nb = list(a[i]-i-1 for i in range(n))\nb.sort()\n\ndef sadness(x,y):\n s = 0\n for i in range(len(y)):\n s += abs(y[i]-x)\n return s\n\nif n%2 == 0:\n print(sadness(a[n/2],b))\nelse:\n print(sadness(a[(n-1)/2],b))\n\n\n \n \n ', 'n = int(input())\na = list(map(int,input().split()))\nb = list(a[i]-i-1 for i in range(n))\nb.sort()\n\ndef sadness(x,y):\n s = 0\n for i in range(len(y)):\n s += abs(y[i]-x)\n return s\n\nif n%2 == 0:\n print(sadness(a[int(n/2)],b))\nelse:\n print(sadness(a[int((n-1)/2)],b))\n\n\n \n \n ', 'n = int(input())\na = list(map(int,input().split()))\nb = list(a[i]-i-1 for i in range(n))\nb.sort()\n\ndef sadness(x,y):\n s = 0\n for i in range(len(y)):\n s += abs(y[i]-x)\n return s\n\nif n%2 == 0:\n print(sadness(b[int(n/2)],b))\nelse:\n print(sadness(b[int((n-1)/2)],b))\n\n\n \n \n ']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s498049147', 's882648832', 's015319597']
[26128.0, 25748.0, 25200.0]
[181.0, 210.0, 209.0]
[271, 281, 281]
p03309
u674185143
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['import math\n\nn = int(input())\na = [int(i) for i in input().split()]\nprint(a)\nfor i in range(n):\n a[i] -= i\nprint(a)\nmc = math.ceil(sum(a)/n)\nmf = math.floor(sum(a)/n)\nac = [0 for i in range(n)]\naf = [0 for i in range(n)]\nfor i in range(n):\n ac[i] = abs(a[i]- mc)\n af[i] = abs(a[i]- mf)\n\nprint(min([sum(ac),sum(af)]))', 'import math\nimport statistics\n\nn = int(input())\na = [int(i) for i in input().split()]\nfor i in range(n):\n a[i] -= i\nmc = math.ceil(statistics.median(a))\nmf = math.floor(statistics.median(a))\nac = [0 for i in range(n)]\naf = [0 for i in range(n)]\nfor i in range(n):\n ac[i] = abs(a[i]- mc)\n af[i] = abs(a[i]- mf)\n\nprint(min([sum(ac),sum(af)]))']
['Wrong Answer', 'Accepted']
['s332063021', 's705393032']
[32488.0, 28916.0]
[256.0, 381.0]
[325, 349]
p03309
u686036872
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['import statistics import median\nN = int(input())\nA=list(map(int, input().split()))\nB=[]\nfor number, i in enumerate(A, 1):\n B.append(i-number)\nmedian = int(median(B))\nans2 = 0\nfor i in B:\n ans2 += abs(i-median)\nprint(ans2)', 'import statistics \nN = int(input())\nA=list(map(int, input().split()))\nB=[]\nfor number, i in enumerate(A, 1):\n B.append(i-number)\nmedian = round(statistics.median(B))\nans2 = 0\nfor i in B:\n ans2 += abs(i-median)\nprint(ans2)']
['Runtime Error', 'Accepted']
['s778286071', 's285094893']
[2940.0, 27244.0]
[17.0, 237.0]
[228, 228]
p03309
u690442716
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['import math\nN = int(input())\nA = input()\nA = A.split()\nB =[]\nC = []\nans = 0\nfor i in range(N):\n B.append(int(A[i]))\n C.append(int(A[i]))\nC.sort(reverse=True)\n"""\nMax = C[0]\nb = Max - N\n"""\nn = math.floor(N/2)\nb = C[n]\n#print(b)\nfor i in range(N):\n ans = ans + abs(B[i]-(i+b+1))\n\nans = ans\nprint(ans)\n\n', 'N = int(input())\nA = input()\nA = A.split()\nB =[]\nC = []\nans = 0\nfor i in range(N):\n B.append(int(A[i]))\n C.append(int(A[i]))\nC.sort(reverse=True)\n"""\nMax = C[0]\nb = Max - N\n"""\nb = C[N/2]\nfor i in range(N):\n ans = ans + abs(B[i]-(i+b+1))\n\nans = ans\nprint(ans)\n', 'N = int(input())\nA = input()\nA = A.split()\nB =[]\nC = []\nans1 = 0\nans2 = 0\nfor i in range(N):\n B.append(int(A[i]))\n C.append(int(A[i]))\nC.sort(reverse=True)\nMax = C[0]\nb = Max - N\nfor i in range(N):\n ans1 = ans + abs(B[i]-(i+b+1))\nfor i in range(N):\n ans2 = ans + abs(B[i]-(i+1))\nif ans1>ans2:\n ans = ans1\nelse:\n ans = ans2\n\nprint(ans)', 'import math\nN = int(input())\nA = input()\nA = A.split()\nB =[]\nC = []\nans1 = 0\nans2 = 0\nfor i in range(N):\n B.append(int(A[i]))\n C.append(int(A[i])-i)\nC.sort(reverse=True)\n\nn = math.floor(N/2)\nb = C[n]\nb1 = C[n-1]\n\nfor i in range(N):\n ans1 = ans1 + abs(B[i]-(i+b))\nfor i in range(N):\n ans2 = ans2 + abs(B[i]-(i+b1))\nans = min(ans1, ans2)\nprint(ans)\n']
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s397065707', 's892662999', 's941444861', 's881239902']
[36816.0, 36420.0, 35692.0, 36084.0]
[336.0, 251.0, 260.0, 423.0]
[310, 269, 352, 359]
p03309
u691896522
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['n = int(input())\na = list(map(int, input().split()))\ntotal = 0\nfor i in range(n):\n a[i] = a[i] - (i + 1)\nif n % 2 == 0:\n ave = a[int(n/2)]\n for i in range(n):\n total += abs(a[i] - ave)\n print(total)\nelse:\n total2 = 0\n ave = a[int(n/2)]\n for i in range(n):\n total += abs(a[i] - ave)\n ave = a[int((n + 1)/2)]\n for i in range(n):\n total2 += abs(a[i] - ave)\n if total2 >= total:\n print(total2)\n else:\n print(total)', 'n = int(input())\na = list(map(int, input().split()))\ntotal = 0\nfor i in range(n):\n a[i] = a[i] - (i + 1)\nif n == 1:\n print(0)\n exit()\na.sort()\nif n % 2 == 0:\n ave = a[int(n/2)]\n for i in range(n):\n total += abs(a[i] - ave)\n print(total)\nelse:\n total2 = 0\n ave = a[int(n/2)]\n for i in range(n):\n total += abs(a[i] - ave)\n ave = a[int((n + 1)/2)]\n for i in range(n):\n total2 += abs(a[i] - ave)\n if total2 >= total:\n print(total)\n else:\n print(total2)']
['Runtime Error', 'Accepted']
['s830065563', 's419525131']
[25744.0, 26020.0]
[143.0, 238.0]
[478, 522]
p03309
u692746605
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['n=int(input())\na=[int(x) for x in input().split()]\ns=[0 for x in range(n)]\n \nfor i in range(n):\n a[i] -= i+1\n \na.sort()\n \ns=0\nif s%2:\n for i in range(n):\n s += abs(a[i]-a[n//2])\n print(s)\nelse:\n m=10**14\n v=(a[n//2-1]+a[n//2])//2\n for i in range(v,v+2):\n s = 0\n for j in range(n):\n s += abs(a[j]-i)\n m = min(m,s)\n print(s)\nn=int(input())\na=[int(x) for x in input().split()]\ns=[0 for x in range(n)]\n\nfor i in range(n):\n a[i] -= i+1\n\na.sort()\n\nif n%2:\n s=0\n for i in range(n):\n s += abs(a[i]-a[n//2])\n print(s)\nelse:\n m=10**14\n v=(a[n//2-1]+a[n//2])//2\n for i in range(a[n//2-1],a[n//2]+1):\n s = 0\n for j in range(n):\n s += abs(a[j]-i)\n m = min(m,s)\n print(s)\n', 'n=int(input())\na=[int(x) for x in input().split()]\ns=[0 for x in range(n)]\n\nfor i in range(n):\n a[i] -= i+1\n\na.sort()\n\ns=0\nif s%2:\n for i in range(n):\n s += abs(a[i]-a[n//2])\n print(s)\nelse:\n m=10**14\n v=(a[n//2-1]+a[n//2])//2\n for i in range(v,v+2):\n s = 0\n for j in range(n):\n s += abs(a[j]-i)\n m = min(m,s)\n print(s)\n', 'n=int(input())\na=[int(x) for x in input().split()]\ns=[0 for x in range(n)]\n \nfor i in range(n):\n a[i] -= i+1\n \na.sort()\n \nif n%2:\n\u3000s=0\n for i in range(n):\n s += abs(a[i]-a[n//2])\n print(s)\nelse:\n m=10**14\n for i in range(a[n//2-1],a[n//2]+1):\n s = 0\n for j in range(n):\n s += abs(a[j]-i)\n m = min(m,s)\n print(s)\n', 'n=int(input())\na=[int(x) for x in input().split()]\n \nfor i in range(n):\n a[i] -= i+1\n \na.sort()\n \ns = 0\nfor i in range(n):\n s += abs(a[i]-a[n//2])\nprint(s)\n']
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s500555619', 's598695380', 's610662526', 's896189920']
[26356.0, 26180.0, 3192.0, 25196.0]
[278.0, 308.0, 18.0, 253.0]
[707, 344, 337, 158]
p03309
u706414019
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
["mport sys\nimport numpy as np\nimport math\nimport copy\ninput = sys.stdin.readline\n \nN = int(input())\nA = np.array(list(map(int,input().split())))\nr = np.array(list(range(1,N+1)))\nB = np.array(sorted(A-r))\nans = float('inf')\nfor i in range(max(N//2-1,0),max(N//2+2,N)):\n c = list(map(abs,(B - B[i])))\n ans = min(ans,sum(c))\nprint(ans)\n", "import sys\nimport numpy as np\nimport math\nimport copy\ninput = sys.stdin.readline\n \nN = int(input())\nA = np.array(list(map(int,input().split())))\nif N ==1:\n ans = 0\nelse:\n r = np.array(list(range(1,N+1)))\n B = np.array(sorted(A-r))\n ans = float('inf')\n for i in range(max(N//2-1,0),min(N//2+2,N)):\n c = list(map(abs,(B - B[i])))\n ans = min(ans,sum(c))\nprint(ans)\n"]
['Runtime Error', 'Accepted']
['s535833915', 's670341183']
[8844.0, 49604.0]
[24.0, 424.0]
[338, 391]
p03309
u722766569
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['from sys import stdin\n\nn = int(stdin.readline().rstrip())\na = [int(x) for x in stdin.readline().rstrip().split()]\nma = max(a)\nindma = [i for i, x in enumerate(a) if x == max(a)]\nim = max(indma)\ns = 0\nc = 1\ni = 0\nwhile i < n:\n s += abs(a[i]-(ma-im+c))\n i = i+1\n c = c+1\nprint(s)\n', 'from sys import stdin\nfrom statistics import median\nn = int(stdin.readline().rstrip())\na = [int(x) for x in stdin.readline().rstrip().split()]\nbi = [x -( i +1) for i,x in enumerate(a)]\nb = median(bi)\ns = 0\ni = 0\nwhile i < n:\n s += abs(bi[i] - b)\n i = i+1\nprint(int(s))\n']
['Wrong Answer', 'Accepted']
['s721126140', 's773659037']
[25872.0, 27240.0]
[2104.0, 263.0]
[287, 275]
p03309
u727478964
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['macro_rules! input {\n ($ttype:ty) => {\n {\n let mut input = String::new();\n let _= std::io::stdin().read_line(&mut input);\n input.trim().parse::<$ttype>().unwrap()\n }\n };\n\n ($($ttype:ty),*) => {\n {\n use std::io::BufRead;\n let mut input = String::new();\n let stdin = std::io::stdin();\n let _ = stdin.lock().read_line(&mut input);\n let mut iter = input.trim().split_whitespace();\n (\n $(iter.next().unwrap().parse::<$ttype>().unwrap(),)*\n )\n }\n };\n\n ($ttype:ty; $x:expr) => {\n {\n use std::io::BufRead;\n let mut input = String::new();\n let stdin = std::io::stdin();\n let _ = stdin.lock().read_line(&mut input);\n let v: Vec<$ttype> = input\n .trim()\n .split_whitespace()\n .map(|x| x.parse().unwrap())\n .collect();\n v\n }\n };\n\n ($ttype:ty; $x:expr; $y:expr) => {\n {\n use std::io::BufRead;\n let mut matrix = Vec::with_capacity($y);\n for _ in 0..$y {\n let mut input = String::new();\n let stdin = std::io::stdin();\n let _ = stdin.lock().read_line(&mut input);\n let v: Vec<$ttype> = input\n .trim()\n .split_whitespace()\n .map(|x| x.parse().unwrap())\n .collect();\n matrix.push(v);\n }\n matrix\n }\n };\n}\n\nfn read_vec() -> Vec<i32> {\n let mut input = String::new();\n let _ = std::io::stdin().read_line(&mut input);\n input.trim().split_whitespace().map(|x| x.parse().unwrap()).collect()\n}\n\nfn main() {\n let n = input!(usize);\n let a_list = read_vec();\n let mut b_list = a_list\n .iter()\n .enumerate()\n .map(|(i, x)| x - (i as i32 + 1))\n .collect::<Vec<i32>>();\n b_list.sort();\n\n let median = if n % 2 == 0 {\n (b_list[n/2-1] + b_list[n/2]) / 2\n } else {\n b_list[n/2]\n };\n\n let result = b_list\n .iter()\n .map(|x| (x - median).abs())\n .fold(0, |acc, x| acc + x);\n println!("{}", result);\n}\n', 'def main():\n n = int(input())\n a_list = map(lambda x: int(x), input().split(\' \'))\n b_list = [x - i for i, x in zip(range(1, n+1), a_list)]\n b_list.sort()\n median = 0\n if n % 2 == 0:\n median = (b_list[n//2-1] + b_list[n//2]) / 2\n else:\n median = b_list[n//2]\n result = int(sum([abs(x - median) for x in b_list]))\n print(result)\n\nif __name__ == "__main__":\n main()\n']
['Runtime Error', 'Accepted']
['s441839395', 's956402565']
[2940.0, 31472.0]
[17.0, 210.0]
[2302, 407]
p03309
u731368968
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['n = int(input())\na = list(map(int, input().split()))\n\naa = [a[i] - i for i in range(n)]\naa.sort()\n\nprint(min(aa[n//2]))', 'n = int(input())\na = list(map(int, input().split()))\n\naa = [a[i] - i-1 for i in range(n)]\naa.sort()\n\nprint(aa[n//2])', 'n = int(input())\na = list(map(int, input().split()))\n\naa = [a[i] - i-1 for i in range(n)]\naa.sort()\n\n\ndef f(b):\n return sum([abs(a-b)for a in aa])\n\nprint(f(aa[n//2]))']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s418057414', 's513765138', 's355781826']
[26184.0, 26708.0, 27844.0]
[170.0, 168.0, 201.0]
[119, 116, 169]
p03309
u736729525
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['\ndef findmin(l, u):\n memo={}\n def calc(b):\n score = memo.get(b, None)\n if not score is None:\n return score\n score = memo[b] = sum(abs(a-b) for a in A)\n return score\n d = (u-l)//3\n if d == 0:\n return min(calc(i) for i in range(l, u+1))\n left, right = l + d, u - d\n sl = calc(left) \n sr = calc(right) \n if sl > sr:\n return findmin(left, u)\n else:\n return findmin(l, right)\n\ndef solve(A):\n A = sorted(a-(i+1) for i, a in enumerate(A))\n return findmin(A[0], A[-1])\n\nN = int(input())\nA = [int(x) for x in input().split()]\n\n#abs(A1-(b+1)) + abs(Ai-(b-i)) + abs(AN-(b-N))\n\n\n\n\n\n\n\nprint(solve(A))\n\n', 'memo={}\ndef calc(b):\n score = memo.get(b, None)\n if not score is None:\n return score\n score = memo[b] = sum(abs(a-b) for a in A)\n return score\n\ndef findmin(l, u):\n d = (u-l)//3\n if d == 0:\n return min(calc(i) for i in range(l, u+1))\n left, right = l + d, u - d\n sl = calc(left) \n sr = calc(right) \n if sl > sr:\n return findmin(left, u)\n else:\n return findmin(l, right)\n\ndef solve(A):\n A = sorted(a-(i+1) for i, a in enumerate(A))\n return findmin(A[0], A[-1])\n\nN = int(input())\nA = [int(x) for x in input().split()]\n\n#abs(A1-(b+1)) + abs(Ai-(b-i)) + abs(AN-(b-N))\n\n\n\n\n\n\n\nprint(solve(A))\n\n', 'memo={}\ndef calc(A, b):\n score = memo.get(b, None)\n if not score is None:\n return score\n score = sum(abs(a-b) for a in A)\n memo[b] = score\n return score\n\nc = 0\ndef findmin(A, l, u):\n global c\n c+=1\n d = (u-l)//3\n if d == 0:\n return min(calc(A, i) for i in range(l, u+1))\n left, right = l + d, u - d\n sl = calc(A, left) \n sr = calc(A, right) \n if sl > sr:\n return findmin(A, left, u)\n else:\n return findmin(A, l, right)\n\ndef solve(A):\n B= [0] * len(A)\n l = A[0]\n u = A[0]\n for i, a in enumerate(A):\n b = a-(i+1)\n l = min(l, b)\n u = max(u, b)\n B[i] = b\n #A = [a-(i+1) for i, a in enumerate(A)]\n return findmin(B, l, u)\n\nN = int(input())\nA = [int(x) for x in input().split()]\n\n#abs(A1-(b+1)) + abs(Ai-(b-i)) + abs(AN-(b-N))\n\n\n\n\n\n\nprint(solve(A))\n\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s701131418', 's727143028', 's887038495']
[26380.0, 25836.0, 26016.0]
[2105.0, 1983.0, 1988.0]
[847, 819, 1025]
p03309
u744344124
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['\nimport statistics\n\nn=int(input())\na=[]\nc=[]\nfor i in input().split():\n a.append(int(i))\n c.append(a[-1]-len(a))\n\nb=round(statistics.median(c))\nprint(b)\nk=0\n\nfor i in range(n):\n k+=abs(a[i]-b-1-i)\nprint(k)', '\nimport statistics\n\nn=int(input())\na=[]\nc=[]\nfor i in input().split():\n a.append(int(i))\n c.append(a[-1]-len(a))\n\nb=round(statistics.median(c))\nk=0\n\nfor i in range(n):\n k+=abs(a[i]-b-1-i)\nprint(k)']
['Wrong Answer', 'Accepted']
['s182227526', 's652889496']
[37484.0, 38000.0]
[316.0, 301.0]
[214, 205]
p03309
u744920373
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['import sys\nsys.setrecursionlimit(10**8)\ndef ii(): return int(sys.stdin.readline())\ndef mi(): return map(int, sys.stdin.readline().split())\ndef li(): return list(map(int, sys.stdin.readline().split()))\ndef li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]\ndef dp2(ini, i, j): return [[ini]*i for _ in range(j)]\ndef dp3(ini, i, j, k): return [[[ini]*i for _ in range(j)] for _ in range(k)]\n\n#from collections import defaultdict #d = defaultdict(int) d[key] += value\n#from itertools import accumulate #list(accumulate(A))\n\nN = ii()\nA = li()\n\n#max_a = max(A)\nhosei = max(A) - N\nhosei_2 = (-1) * hosei\nans = 0\nans_2 = 0\nfor i in range(N):\n ans += abs(hosei+i+1 - A[i])\n ans_2 = abs(hosei_2+i+1 - A[i])\n\nprint(min(ans, ans_2))', 'import sys\nsys.setrecursionlimit(10**8)\ndef ii(): return int(sys.stdin.readline())\ndef mi(): return map(int, sys.stdin.readline().split())\ndef li(): return list(map(int, sys.stdin.readline().split()))\ndef li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]\ndef dp2(ini, i, j): return [[ini]*i for _ in range(j)]\ndef dp3(ini, i, j, k): return [[[ini]*i for _ in range(j)] for _ in range(k)]\n\n#from collections import defaultdict #d = defaultdict(int) d[key] += value\n#from itertools import accumulate #list(accumulate(A))\n\nN = ii()\nA = li()\n\nfor i in range(N):\n A[i] -= i + 1\n\nA = sorted(A)\n\nif not N % 2:\n num = int((A[N//2] + A[N//2-1]) // 2)\nelse:\n num = A[N//2]\nans = 0\nfor i in range(N):\n ans += abs(num - A[i])\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s338117485', 's445166714']
[25744.0, 25744.0]
[180.0, 232.0]
[796, 807]
p03309
u763968347
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['N = int(input())\nA_ = list(map(int,input().split()))\n\nA = []\nfor i,a_ in enumerate(A_):\n A.append(a_-i-1)\n\nd = {}\nfor a in A:\n if a in d.keys():\n d[a] += 1\n else:\n d[a] = 1\n\ncount = 0\nfor d_ in sorted(d.items()):\n if count >= len(d)/2:\n break\n count += d_[1]\n d_prev = d_[0]\n\nb1 = d_prev\nb2 = d_[0]\nprint(b1,b2)\n\nans1 = 0\nans2 = 0\nfor a in A:\n ans1 += abs(a-b1)\n ans2 += abs(a-b2)\n\nprint(min(ans1,ans2))', 'N = int(input())\nA_ = list(map(int,input().split()))\n\nA = []\nfor i,a_ in enumerate(A_):\n A.append(a_-i-1)\n\nd = {}\nfor a in A:\n if a in d.keys():\n d[a] += 1\n else:\n d[a] = 1\n\ncount = 0\nfor d_ in sorted(d.items()):\n if count >= len(A)/2:\n break\n count += d_[1]\n d_prev = d_[0]\n\nb1 = d_prev\nb2 = d_[0]\n\nans1 = 0\nans2 = 0\nfor a in A:\n ans1 += abs(a-b1)\n ans2 += abs(a-b2)\n\nprint(min(ans1,ans2))']
['Wrong Answer', 'Accepted']
['s964766354', 's601473976']
[47132.0, 47260.0]
[542.0, 546.0]
[448, 435]
p03309
u780962115
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['n=int(input().split())\nlists=list(map(int,input().split())\nfor i in range(n):\n lists[i]-=(i+1)\nmini=10**100\nfor k in range(-10**9,10**9,1):\n sub=0\n for i in range(n):\n sub+=abs(list[i]-k)\n mini=min(mini,sub)\n \nprint(mini)', 'n=int(input())\nlists=list(map(int,input().split()))\n\nfor i in range(n):\n lists[i]-=(i+1)\nmini=10**100\nfor k in range(-10**9,10**9):\n sub=0\n for _ in range(n):\n sub+=abs(lists[_]-k)\n mini=min(mini,sub)\n \nprint(mini)\n', 'import bisect\nn=int(input())\nlists=list(map(int,input().split()))\nuselists=[]\nfor _ in range(n):\n uselists.append(lists[_]-_-1)\nuselist=sorted(uselists)\nif n%2==0:\n num1=int(n/2-1)\n num2=int(n/2)\n numbers=min(uselist[num1],uselist[num2])\nif n%2!=0:\n num1=int((n-1)/2)\n numbers=uselist[num1] \nfor x in range(n):\n ans+=abs(uselist[x]-numbers)\nprint(ans)', 'n=int(input())\nlists=list(map(int,input().split()))\nuselists=[]\nfor _ in range(n):\n uselists.append(lists[_]-_-1)\nuselist=sorted(uselists)\nif n%2==0:\n num1=int(n/2-1)\n num2=int(n/2)\n numbers=min(uselist[num1],uselist[num2])\n \nif n%2!=0:\n num1=int((n-1)/2)\n numbers=uselist[num1] \nans=0\nfor x in range(n):\n ans+=abs(uselist[x]-numbers)\nprint(ans)']
['Runtime Error', 'Time Limit Exceeded', 'Runtime Error', 'Accepted']
['s040690582', 's044828582', 's842824103', 's493518022']
[2940.0, 26180.0, 25708.0, 26180.0]
[17.0, 2104.0, 190.0, 246.0]
[250, 244, 373, 369]
p03309
u781262926
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['import sys\ninputs = sys.stdin.readlines()\nn = int(inputs[0])\nA = list(map(int, inputs[1].split()))\n\nB = list(map(lambda x: x[1]-x[0], enumerate(A, 1)))\nb = floor(sum(B) / n)\nC = list(map(lambda x: abs(x-b), B))\nprint(sum(C))', 'import sys\nfrom math import floor, ceil\ninputs = sys.stdin.readlines()\n\nn = int(inputs[0])\nA = list(map(int, inputs[1].split()))\n\nB = list(map(lambda x: x[1]-x[0], enumerate(A, 1)))\nb = floor(sum(B) / n)\nb1 = round(sum(B) / n)\nb2 = ceil(sum(B) / n)\nC = list(map(lambda x: abs(x-b), B))\nC1 = list(map(lambda x: abs(x-b1), B))\nC2 = list(map(lambda x: abs(x-b2), B))\nprint(min(list(map(sum, [C, C1, C2])))', 'n = int(inputs[0])\nA = list(map(int, inputs[1].split()))\n\nB = list(map(lambda x: x[1]-x[0], enumerate(A, 1)))\nb = floor(sum(B) / n)\nb1 = round(sum(B) / n)\nb2 = ceil(sum(B) / n)\nC = list(map(lambda x: abs(x-b), B))\nC1 = list(map(lambda x: abs(x-b1), B))\nC2 = list(map(lambda x: abs(x-b2), B))\nprint(min(list(map(sum, [C, C1, C2])))', 'import sys\nfrom statistics import median_low\ninputs = sys.stdin.readlines()\n\nn = int(inputs[0])\nA = list(map(int, inputs[1].split()))\n\nB = list(map(lambda x: x[1]-x[0], enumerate(A, 1)))\nb = median_low(B)\nprint(sum(map(lambda x: abs(x-b), B)))']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s424917283', 's470531326', 's981907786', 's506394560']
[27224.0, 3064.0, 3064.0, 29412.0]
[102.0, 19.0, 17.0, 225.0]
[224, 402, 330, 243]
p03309
u786150969
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['from statistics import median\n\nN = int(input())\nan = list(map(int,input().split()))\n\nfor i in range(N):\n an[i] = an[i] - (i+1)\n \nb = int(median(bn))\n\nk = []\nfor i in range(N):\n y = abs(an[i] - b)\n k.append(y)\nans = sum(k)\n\nprint(ans)', 'import numpy as np\n\nN = int(input())\nan = list(map(int,input().split()))\n\nfor i in range(N):\n an[i] = an[i] - (i+1)\n \nb = int(np.median(an))\n\nk = []\nfor i in range(N):\n y = abs(an[i] - b)\n k.append(y)\nans = sum(k)\n\nprint(ans)\n ']
['Runtime Error', 'Accepted']
['s556805091', 's115477371']
[33888.0, 49484.0]
[108.0, 237.0]
[245, 242]
p03309
u787562674
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['input_list = []\nindex = 1\nfor i in input().split():\n item = int(i) - index\n input_list.append(item)\n index += 1\n\ninput_list.sort()\nb = input_list[N//2]\nprint(sum(map(lambda x: abs(x-b), input_list)))', 'N = int(input())\ninput_list = [int(i) for i in input().split()]\n\nans1 = 0\nans2 = 0\n\nfor i in range(N):\n input_list[i] -= i+1\n\npoint1 = sum(input_list) // N\npoint2 = point + 1\n\nfor i in range(N):\n ans1 += abs(input_list[i] - point1)\n\nfor i in range(N):\n ans2 += abs(input_list[i] - point2)\n\nprint(min(ans1, ans2))', 'from collections import Counter\n\nN = int(input())\ninput_list = []\ninput_counter = Counter()\nans1 = 0\nans2 = 0\nans3 = 0\nans4 = 0\nindex = 1\nfor i in input().split():\n item = int(i) - index\n input_list.append(item)\n input_counter[item] += 1\n index += 1\n\npoint = sum(input_list) // N\nb = max(input_counter, key=input_counter.get)\nfor i in range(N):\n ans1 += abs(input_list[i] - b)\n ans2 += abs(input_list[i] - point)\n ans3 += abs(input_list[i] - b + 1)\n ans4 += abs(input_list[i] - b - 1)', 'N = int(input())\n\ninput_list = []\nindex = 1\nfor i in input().split():\n item = int(i) - index\n input_list.append(item)\n index += 1\n\ninput_list.sort()\nb = input_list[N//2]\n\nprint(sum(map(lambda x: abs(x-b), input_list)))']
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s101920936', 's337403523', 's962129604', 's208901343']
[3060.0, 25200.0, 44652.0, 26836.0]
[17.0, 111.0, 494.0, 232.0]
[208, 321, 508, 227]
p03309
u788137651
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['\n# return a-1\n\n\nN = int(input())\nA = [int(i) for i in input().split()]\nfor i in range(len(A)):\n A[i] -= i+1\n# print(A)\naverage_A = sum(A) / N\nint_average = round(average_A)\n#print(average_A, int_average)\n"""\nprint([a for a in A]) # if a > 0])\nwhile len([a for a in A if a > 0]) > N // 2:\n A = list(map(decrement, A))\n print(A)\n# print(A)\nprint(sum([abs(a) for a in A]))\n"""\nans = [sum(list(map(lambda x: abs(x-int_average+1), A)))\n for i in range(-10, 10)]\nprint(min(ans))\n', '\n# return a-1\n\n\nN = int(input())\nA = [int(i) for i in input().split()]\nfor i in range(len(A)):\n A[i] -= i+1\n# print(A)\naverage_A = sum(A) / N\nint_average = round(average_A)\n#print(average_A, int_average)\n"""\nprint([a for a in A]) # if a > 0])\nwhile len([a for a in A if a > 0]) > N // 2:\n A = list(map(decrement, A))\n print(A)\n# print(A)\nprint(sum([abs(a) for a in A]))\n"""\nans = [sum(list(map(lambda x: abs(x-int_average+1), A)))\n for i in range(-100, 100)]\nprint(min(ans))\n', 'N = int(input())\nA = [int(i) for i in input().split()]\nfor i in range(N):\n A[i] -= i + 1\nA.sort()\nsunuke = A[N // 2]\nans = 0\nfor a in A:\n ans += abs(a-sunuke)\nprint(ans)\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s682167113', 's881823758', 's488963141']
[26128.0, 25196.0, 26180.0]
[855.0, 2105.0, 223.0]
[511, 513, 176]
p03309
u801359367
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['from statistics import median\n\nN = int(input())\nA = list(map(int,input().split()))\nA = sorted(A)\n\nC = [A[i]-i for i in range(N)]\nprint(C) \nif N%2 ==1:\n B = C[int(N/2)]\nelse:\n B = C[int((N-1)/2)]+A[int((N+1)/2)]\n\nprint(sum(C)-N*B)\n', 'from statistics import median\n\nN = int(input())\nA = list(map(int,input().split()))\n\nC = [A[i]-i for i in range(N)]\nC =sorted(C)\n\nif N%2 ==1:\n B = C[int(N/2)]\nelse:\n B = (C[int((N-1)/2)]+C[int((N+1)/2)])/2\n\n \nSUM = 0\nfor i in range(N):\n SUM += abs(C[i] -B)\nprint(int(SUM))']
['Wrong Answer', 'Accepted']
['s954597887', 's289719414']
[29156.0, 27228.0]
[212.0, 238.0]
[239, 283]
p03309
u804085889
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['import collections\n\nif __name__ == "__main__" :\n n = int(input())\n array = list(map(int, input().split()))\n\n for i in range(0, n):\n array[i] = array[i] - (i + 1)\n c = collections.Counter(array)\n elem = int(c.most_common()[0][0])\n\n print(c.most_common()[0][0])\n \n for i in range(0, n):\n array[i] = abs(array[i] - elem)\n\n sum_n = sum(array)\n\n print(sum_n)', 'import collections\n\nn = int(input())\narray = list(map(int, input().split()))\n\nfor i in range(0, n):\n array[i] = array[i] - (i + 1)\nc = collections.Counter(array)\nelem = int(c.most_common()[0][0])\n\n# print(c.most_common()[0][0])\nprint(array)\nprint(elem)\nif c.most_common()[0][1] != 1:\n print("test")\n for j in range(0, n):\n array[j] = abs(array[j] - elem)\nelse:\n for j in range(0, n):\n array[j] = abs(array[j])\n\nprint(sum(array))', 'import collections\n\nn = int(input())\narray = list(map(int, input().split()))\n\nfor i in range(0, n):\n array[i] = array[i] - (i + 1)\nc = collections.Counter(array)\nelem = int(c.most_common()[0][0])\n\n# print(c.most_common()[0][0])\n\nif c.most_common()[0][1] != 1:\n print("test")\n for j in range(0, n):\n array[j] = abs(array[j] - elem)\nelse:\n for j in range(0, n):\n array[j] = abs(array[j])\n\nprint(sum(array))', 'import collections\n\nn = int(input())\narray = list(map(int, input().split()))\n\nfor i in range(0, n):\n array[i] = array[i] - (i + 1)\nc = collections.Counter(array)\nelem = int(c.most_common()[0][0])\n\n# print(c.most_common()[0][0])\nprint(array)\nprint(elem)\nif c.most_common()[0][1] != 1:\n print("test")\n for j in range(0, n):\n array[j] = abs(array[j] - elem)\nelse:\n for j in range(0, n):\n array[j] = abs(array[j])\n\nprint(sum(array))', 'import collections\nfrom statistics import median\n\nn = int(input())\narray = list(map(int, input().split()))\n\nfor i in range(0, n):\n array[i] = array[i] - (i + 1)\nc = collections.Counter(array)\nelem = int(c.most_common()[0][0])\n\n# print(c.most_common()[0][0])\n# print(array)\n# print(elem)\n# if c.most_common()[0][1] != 1:\n# # print("test")\n# for j in range(0, n):\n# array[j] = abs(array[j] - elem)\n# else:\n# for j in range(0, n):\n# array[j] = abs(array[j])\nb = int(median(array))\nfor j in range(0, n):\n array[j] = int(abs(array[j] - b))\n\nprint(sum(array))']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s438274541', 's592788982', 's691863696', 's866433005', 's836223641']
[39912.0, 44092.0, 39912.0, 44092.0, 41048.0]
[327.0, 325.0, 324.0, 359.0, 386.0]
[397, 454, 430, 454, 587]
p03309
u804880764
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
["if __name__ == '__main__':\n N = int(input())\n A = list(map(int, input().split()))\n B = []\n ans = 10**9\n\n for i, a in enumerate(A):\n B.append(a - i - 1)\n\n print(B)\n for b in [min(B), max(B), (min(B)+max(B))//2]:\n tmp = 0\n for i, a in enumerate(A):\n tmp += abs(a - i - b - 1)\n ans = min(ans, tmp)\n\n print(ans)\n", "if __name__ == '__main__':\n N = int(input())\n A = list(map(int, input().split()))\n B = []\n ans = 0\n \n for i, a in enumerate(A):\n B.append(a - i - 1)\n\n B.sort()\n\n b = B[len(B)//2]\n for i, a in enumerate(A):\n ans += abs(a - b - i - 1)\n\n print(ans)\n"]
['Wrong Answer', 'Accepted']
['s340286525', 's127404745']
[28624.0, 26184.0]
[356.0, 247.0]
[371, 287]
p03309
u813174766
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['n=int(input())\na=list(map(int,input().split()))\nfor i in range(n):\n a[i]-=i\na.sort()\nprint((a[n//2]+a[(n-1)//2])//2)', 'n=int(input())\na=list(map(int,input().split()))\nfor i in range(n):\n a[i]-=i\na.sort()\nb=(a[n//2]+a[(n-1)//2])//2\nprint(sum(abs(i-b) for i in a))']
['Wrong Answer', 'Accepted']
['s453533664', 's025202501']
[26836.0, 26836.0]
[172.0, 211.0]
[117, 144]
p03309
u818213347
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['n = int(input())\nl = list(map(int,input().split()))\n\nfor i in range(n):\n l[i] = l[i] - i-1\nprint(sorted(l))\nif n % 2 == 1:\n print(sum(list(map(lambda x: x-l[((n//2)+1)],l))))\nelse:\n print(max(sum(list(map(lambda x: x-l[(n//2)],l))),sum(list(map(lambda x: x-l[((n//2)+1)],l)))))\n', 'n = int(input())\nl = list(map(int,input().split()))\n\nfor i in range(n):\n l[i] = l[i] - i-1\nl.sort()\nif n % 2 == 1:\n print(sum(list(map(lambda x: abs(x-l[((n//2))]),l))))\nelse:\n print(min(sum(list(map(lambda x: abs(x-l[(n//2)-1]),l))),sum(list(map(lambda x: abs(x-l[(n//2)]),l)))))\n']
['Runtime Error', 'Accepted']
['s260044102', 's003600883']
[31224.0, 31192.0]
[209.0, 219.0]
[287, 290]
p03309
u827202523
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['N = int(input())\nnums = input().split(" ")\nnums2 = [int(x)-i-1 for i,x in enumerate(nums)]\nnums2.sort()\nlength = len(nums2)\nnumpre = 0\nsame = 1\nif length == 1:\n value = nums2[0]\n\nfor n,m in zip(nums2[:-1],nums2[1:]):\n print("c")\n if n == m:\n same += 1\n else:\n impact = same + numpre\n if impact > length-impact:\n value = n\n break\n numpre += same\n same = 1\n value = m\n\nanswer = 0\nfor i in nums2:\n answer += abs(i-value)\nprint(answer)', 'N = int(input())\nnums = input().split(" ")\nnums2 = [int(x)-i-1 for i,x in enumerate(nums)]\nnums2.sort()\nlength = len(nums2)\nnumpre = 0\nsame = 1\nif length == 1:\n value = nums2[0]\n \nfor n,m in zip(nums2[:-1],nums2[1:]):\n if n == m:\n same += 1\n else:\n impact = same + numpre\n if impact > length-impact:\n value = n\n break\n numpre += same\n same = 1\n value = m\n \nanswer = 0\nfor i in nums2:\n answer += abs(i-value)\nprint(answer)']
['Wrong Answer', 'Accepted']
['s491049636', 's943370359']
[29960.0, 28936.0]
[321.0, 271.0]
[462, 451]
p03309
u832039789
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
["n = int(input())\na = list(map(int,input().split()))\na = sorted(a)\n\ndef calc(mid):\n res = 0\n for i in a:\n res += abs(i-mid)\n return res\n\nif n%2==1:\n res = calc(a[n//2])\nelse:\n res = float('inf')\n if (a[n//2-1]+a[n//2])%2==0:\n res = calc((a[n//2-1]+a[n//2])//2)\n else:\n mid = (a[n//2-1]+a[n//2]) // 2\n res = min(calc(mid), calc(mid+1))\n\nprint(res)", 'n = int(input())\na = list(map(int,input().split()))\nl = len(a)\nb = [a[i]-(i+1) for i in range(n)]\nb = sorted(b)\nif l%2==1:\n mid = b[l//2+1]\nelse:\n mid = (b[l//2] + b[l//2+1]) // 2\nsum = 0\nfor i in range(n):\n sum += abs(a[i] - mid - (i+1))\nprint(sum)\n', 'import math\nn = int(input())\na = list(map(int,input().split()))\nl = len(a)\nb = [a[i]-(i+1) for i in range(n)]\nb = sorted(b)\nif l%2==1:\n mid = b[l//2+1]\n sum = 0\n for i in range(n):\n sum += abs(a[i] - mid - (i+1))\nelse:\n mid = (b[l//2] + b[l//2+1]) / 2\n sum1 = 0\n sum2 = 0\n for i in range(n):\n sum1 += abs(a[i] - math.floor(mid) - (i+1))\n sum2 += abs(a[i] - math.ceil(mid) - (i+1))\n sum = min(sum1, sum2)\nprint(sum)\n', 'n = int(input())\na = list(map(int, input().split()))\nfor i in range(n):\n\ta[i] -= i + 1\na = sorted(a)\n\nres = 10 ** 100\nif n % 2 == 0:\n\tp = n // 2 - 1\n\tq = n // 2\n\tfor cand in [p, q]:\n\t\ttmp = 0\n\t\tfor i in a:\n\t\t\ttmp += abs(i - a[cand])\n\t\tres = min(res, tmp)\nelse:\n\ttmp = 0\n\tfor i in a:\n\t\ttmp += abs(i - a[n // 2])\n\tres = min(res, tmp)\n\t\nprint(res)']
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s174583807', 's496998771', 's923100845', 's530713998']
[25708.0, 25196.0, 25968.0, 26180.0]
[175.0, 230.0, 342.0, 294.0]
[364, 259, 460, 344]
p03309
u842950479
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['N=int(input())\nA=list(map(int, input().rstrip().split()))\nB=list(A[i]-i for i in range(N))\nC=B.sort()\nwork=C[N//2]\ntestA=sum(abs(B[i]-work) for i in range(N))\ntestB=sum(abs(B[i]-work-1) for i in range(N))\ntestC=sum(abs(B[i]-work+1) for i in range(N))\noutput=min(testA,testB,testC)\nprint(output)', 'N=int(input())\nA=list(map(int, input().rstrip().split()))\nB=list(A[i]-i for i in range(N))\nC=list(A[i]-i for i in range(N))\nC.sort()\nwork=C[N//2]\ntestA=sum(abs(B[i]-work) for i in range(N))\ntestB=sum(abs(B[i]-work-1) for i in range(N))\ntestC=sum(abs(B[i]-work+1) for i in range(N))\noutput=min(testA,testB,testC)\nprint(output)']
['Runtime Error', 'Accepted']
['s367019529', 's414052122']
[25744.0, 29772.0]
[171.0, 285.0]
[294, 325]
p03309
u846226907
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['n = int(input())\na = list(map(int,input().split()))\n\nb = 10000000\nfor i in range(100):\n sum = 0\n for j in range(n):\n sum = sum + abs(a[j] - (i + n))\n\n if sum < b:\n c = i\n b = sum\n\n\nprint(c)\n\n\n', 'n = int(input())\n\na = list(map(int,input().split()))\n\n\nfor i in range(len(a)):\n a[i] = a[i] -(i+1)\n\na.sort()\n\nx=a[int(int(len(a))/2)]\n\nans = 0\nfor i in range(len(a)):\n ans =ans+ abs(a[i]-x)\n\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s252467709', 's502410076']
[26360.0, 26180.0]
[2104.0, 234.0]
[222, 208]
p03309
u849290552
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['import math\n\ndef kanashimi(b):\n \n out = 0\n for i in range(N):\n out = out + abs(A[i]-(b+(i+1)))\n return out \nans = 10**20\nfor i in range(-100,100):\n ans = min(ans,kanashimi(i))\nprint(ans)', "N = int(input().strip())\nA = list(map(int,input().strip().split(' ')))\n\n\nimport statistics\nimport math\ndef kanashimi(b):\n \n out = 0\n for i in range(N):\n out = out + abs(A[i]-(b+(i+1)))\n return out \n \nB = [A[i]-(i+1) for i in range(N)]\nb = statistics.median(B)\n\nprint(int(kanashimi(b)))\n"]
['Runtime Error', 'Accepted']
['s175779548', 's743474279']
[3060.0, 25196.0]
[22.0, 251.0]
[208, 306]
p03309
u855380359
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['n = int(input())\na = list(map(int, input().split()))\nans = 0\nnans = 0\nfor i in range(10**9):\n for j in range(n):\n ans += abs(a[j]-i-j)\n if ans <= nans:\n nans =ans\nprint(nans)', 'n = int(input())\na = list(map(int, input().split()))\n\nbox = [0]*n\nans = 0\nfor i in range(n):\n box[i] = a[i] - (i+1)\nbox.sort()\n\nidx = n//2\n\nb = box[idx]\n\nfor i in range(n):\n ans += abs(a[i]-(i+1+b))\nprint(ans)']
['Time Limit Exceeded', 'Accepted']
['s632525995', 's572096691']
[26016.0, 26180.0]
[2107.0, 249.0]
[194, 215]
p03309
u856169020
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['ans = 9999999\nres = 0\nfor i in range(N):\n res += A[i] - (i+1)\n\nb = res // N\nres = 0\nfor i in range(N):\n res += abs(A[i] - (b+(i+1)))\nprint(res)\n', "N = int(input())\nA = list(map(int, input().split()))\n\nA_sorted = sorted([A[i] - (i+1) for i in range(N)])\n\nif len(A) != 1:\n b = A_sorted[int((len(A)-1)/2)]\n b2 = A_sorted[int((len(A)-1)/2 + 1)]\n sad_1 = sum([abs(A_sorted[i] - b) for i in range(N)])\n sad_2 = sum([abs(A_sorted[i] - b2) for i in range(N)])\n print(min(sad_1, sad_2))\nelse:\n print('0')\n"]
['Runtime Error', 'Accepted']
['s507537028', 's333155243']
[2940.0, 27720.0]
[17.0, 238.0]
[150, 367]
p03309
u858523893
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['N = int(input())\na = list(map(int, input().split(" ")))\n\nmin_sum = -1\ni_atmin = -1\n\n\ni = min(a)\nwhile(i <= max(a)) : \n sum_over = 0\n sum_over_minus = 0\n \n for j in range(N) :\n sum_over += abs(a[j] - (i + j))\n \n for j in range(N) :\n sum_over_minus += abs(a[j] - (j - i))\n \n if min_sum != -1 and min(sum_over, sum_over_minus) > min_sum :\n break\n \n if min_sum == -1 or min(sum_over, sum_over_minus) < min_sum :\n min_sum = min(sum_over, sum_over_minus)\n i_atmin = i\n \n i += 1\n \nprint(min_sum)\n ', 'N = int(input())\na = [int(x) for x in input().split()]\n\nB_s = sorted([y - x - 1 for x, y in enumerate(a)])\n\n\nmedians = []\nif N%2 == 0 :\n medians.append(B_s[N // 2])\n medians.append(B_s[N // 2 + 1])\nelse :\n medians.append(B_s[N // 2])\n \nmin_sum = sum(a)\n\nfor m in medians :\n sum_over = 0\n \n for i in range(N) :\n sum_over += abs(B_s[i] - m)\n \n min_sum = min(min_sum, sum_over)\n \nprint(min_sum)\n \n \n \n \n ']
['Wrong Answer', 'Accepted']
['s448985710', 's715956040']
[25708.0, 26020.0]
[2104.0, 268.0]
[627, 457]
p03309
u861095163
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['fun main(args : Array<String>) {\n val N = readLine()!!.toInt()\n val A = readLine()!!.split(" ").map { it.toInt() }\n val B = (1..N).map {\n val index = it - 1\n A.get(index) - it\n }.toMutableList()\n B.sort()\n\n val median = B.get(N / 2)\n val answer = B.map { Math.abs(it - median) }.sum()\n\n println(answer)\n}', 'fun main(args : Array<String>) {\n val N = readLine()!!.toInt()\n val A = readLine()!!.split(" ").map { it.toInt() }\n val B = (1..N).map {\n val index = it - 1\n A.get(index) - it\n }.sorted()\n\n val median = B.get(N / 2)\n\n val answer = B.map { Math.abs(it - median) }.sum()\n\n print(answer)\n}', 'def m():\n n = int(input())\n a = list(map(int, input().split()))\n ans = 0\n B = [a[i-1]-i for i in range(1, n+1)]\n B.sort()\n b = B[n//2]\n for i in range(n):\n ans += abs(B[i]-b)\n return ans\n\nprint(m())']
['Runtime Error', 'Runtime Error', 'Accepted']
['s310733332', 's698098193', 's810553597']
[2940.0, 2940.0, 25200.0]
[17.0, 17.0, 191.0]
[342, 321, 229]
p03309
u866949333
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['import numpy as np\n\nN = int(input())\nA = [int(i) for i in input().split()]\n\nA_minus_i = [A[i] - (i+1) for i in range(N)]\n\n# print(A)\n# print(A_minus_i)\n\nbf = np.average(A_minus_i)\n# print(bf)\n\n# b_l = int(bf)+1\n# b_m = int(bf)\n# b_s = int(bf)-1\n#\n# score_l = sum([abs(a - b_l) for a in A_minus_i])\n# score_m = sum([abs(a - b_m) for a in A_minus_i])\n# score_s = sum([abs(a - b_s) for a in A_minus_i])\n\nscore = sum([abs(a - bf) for a in A_minus_i])\n\nprint(int(score)+1)\n', 'import numpy as np\nimport statistics\n\nN = int(input())\nA = [int(i) for i in input().split()]\n\nA_minus_i = [A[i] - (i+1) for i in range(N)]\n\n# print(A)\n# print(A_minus_i)\n\nbf = statistics.median(A_minus_i)\n# print(bf)\n\n# b_l = int(bf)+1\n# b_m = int(bf)\n# b_s = int(bf)-1\n#\n# score_l = sum([abs(a - b_l) for a in A_minus_i])\n# score_m = sum([abs(a - b_m) for a in A_minus_i])\n# score_s = sum([abs(a - b_s) for a in A_minus_i])\n\nscore = sum([abs(a - bf) for a in A_minus_i])\n\nprint(int(score))\n']
['Wrong Answer', 'Accepted']
['s583316957', 's875003786']
[37388.0, 36160.0]
[516.0, 352.0]
[468, 491]
p03309
u875361824
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['import sys\n\n\ndef main():\n """\n 1 <= N <= 2 * 10^5\n 1 <= ai <= 10^9\n """\n N = int(input())\n *A, = map(int, input().split())\n\n ans = f(N, A)\n print(ans)\n\n\ndef f(N, A):\n \n C = [a - i for i, a in enumerate(A, 1)]\n b = sum(C) // N\n print(b)\n print(C)\n ans = sum(abs(c - b) for c in C)\n\n return ans\n\n\nif __name__ == \'__main__\':\n main()\n', 'def main():\n """\n 1 <= N <= 2 * 10^5\n 1 <= ai <= 10^9\n """\n N = int(input())\n *A, = map(int, input().split())\n\n \n ans = editorial(N, A)\n print(ans)\n\n\ndef editorial(N, A):\n ans = 0\n C = sorted(a - i for i, a in enumerate(A, 1))\n if N % 2 == 1:\n b = C[N // 2]\n else:\n \n s = C[N // 2 - 1] + C[N // 2 - 1]\n b = s // 2\n\n ans = sum(abs(c - b) for c in C)\n return ans\n\n\nif __name__ == \'__main__\':\n main()\n']
['Wrong Answer', 'Accepted']
['s886550918', 's255671523']
[28648.0, 25708.0]
[126.0, 187.0]
[449, 523]
p03309
u901582103
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['n=int(input())\nA=list(map(int,input().split()))\nfor i in range(n):\n A[i]=A[i]-i-1\nprint(round(sum(A)/n))', 'n=int(input())\nA=list(map(int,input().split()))\nB=sorted([A[i]-(i+1) for i in range(n)])\nif n%2==1:\n b=B[n//2]\nelse:\n b=(B[n//2-1]+B[n//2])//2\nr=0\nfor i in range(n):\n r+=abs(B[i]-b)\nprint(r)']
['Wrong Answer', 'Accepted']
['s848700171', 's762958388']
[26180.0, 25196.0]
[110.0, 224.0]
[107, 199]
p03309
u903948194
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['N = int(input())\na = list(map(int, input().split()))\na_ = [n - (i+1) for i, n in enumerate(a) ]\n\nb = sum(a_) // N\nb_ = b + 1\ns = [abs(n - b) for i, n in enumerate(a_)]\ns_ = [abs(n - b_) for i, n in enumerate(a_)]\n\nprint(min(sum(s), sum(s_))', 'N = int(input())\na = list(map(int, input().split()))\na_ = sorted([n - (i+1) for i, n in enumerate(a) ])\n\nif N//2 == 0:\n b = a_[N//2]\nelse:\n b = a_[(N-1)//2]\n\ns = [abs(n - b) for i, n in enumerate(a_)]\n\nprint(sum(s))']
['Runtime Error', 'Accepted']
['s354408753', 's302715941']
[3064.0, 27588.0]
[18.0, 210.0]
[240, 221]
p03309
u905203728
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['import statistics\nimport math\nn=int(input())\nbox=list(map(int,input().split()))\nmedian=int(statistics.median(box))\ncount=0\nfor x,y in enumerate(box):\n count +=abs(y-(x+1-median))\nprint(count)', 'from statistics import median\nn=int(input())\nA=list(map(int,input().split()))\n\nB=[A[i]-(i+1) for i in range(n)]\nmiddle=median(B)\n\nans=0\nfor i in range(n):\n ans +=abs(A[i]-(middle+i+1))\n\nprint(int(ans))']
['Wrong Answer', 'Accepted']
['s049236296', 's259567976']
[27244.0, 27256.0]
[220.0, 277.0]
[194, 204]
p03309
u909162870
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['n = int(input())\na = list(map(int, input().split()))\nud = list()\nfor i in range(n):\n ud.append(a[i] - i)\nud.sort()\nprint(ud,)\nans = 0\nfor i in range(n):\n print(abs(ud[i] - ud[n // 2]))\n ans += abs(ud[i] - ud[n // 2])\nprint(ans)', 'n = int(input())\na = list(map(int, input().split()))\nud = list()\nfor i in range(n):\n ud.append(a[i] - i)\nud.sort()\nans = 0\nfor i in range(n):\n ans += abs(ud[i] - ud[n // 2])\nprint(ans)']
['Wrong Answer', 'Accepted']
['s048925420', 's075175921']
[26144.0, 26836.0]
[502.0, 246.0]
[236, 190]
p03309
u909991537
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['import numpy as np\nn = int(input())\na = np.array([int(i) for i in input().split()])\n\nmin_num = 100000000000\n\nfor x in range(-(max(a)), max(a) + 1):\n min_sum = sum(abs(a - np.ones(len(a)) * x - np.array(range(1, n + 1))))\n #print(abs(a - np.array(range(1, n + 1))))\n if min_sum < min_num:\n min_num = min_sum\n\nprint(min_num)', 'import numpy as np\nimport statistics\n\nn = int(input())\ninputs = [int(i) for i in input().split()]\na = np.array(inputs)\n\nz = a - np.array(range(1, n + 1))\nnums = list(set(inputs))\n\nprint(int(sum(abs(z - np.ones(len(a)) * statistics.median(z)))))\n']
['Wrong Answer', 'Accepted']
['s987766641', 's038884007']
[34192.0, 38356.0]
[2109.0, 522.0]
[328, 245]
p03309
u923662841
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['N = int(input())\nA = [int(a)-i-1 for i,a in enumerate(input().split(),1)]\nA.sort()\nb = int(sum(a)/len(a))\nc = 10**9\nfor j in range(b-10, b+11):\n k = sum(map(lambda x:abs(x-j), A))\n c = min(c,k)\nprint(c)', 'N=int(input())\nA=sorted(a-i-1 for i,a in enumerate(map(int,input().split())))\nprint(sum(abs(a-A[N//2]) for a in A))']
['Runtime Error', 'Accepted']
['s681773386', 's307361938']
[30948.0, 31160.0]
[137.0, 159.0]
[208, 115]
p03309
u924406834
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['n = int(input())\na = list(map(int,input().split()))\n\nxave = ((n*(n-1))/2)/n\nyave = sum(a)/n\ncov = 0\nfor i in range(n):\n cov += (i+1-xave)*(a[i]-yave)\ncov = cov/n\n\ndps = 0\nfor i in range(n):\n dps += (i+1-xave)**2\ndps = dps / n\nA = cov / dps\nB = int(yave - A * xave)\nansls = []\nfor j in range(2):\n ans = 0\n for i in range(n):\n ans += abs(a[i] - i - 1 - B - j)\n ansls.append(ans)\nprint(max(ansls))', 'n = int(input())\na = list(map(int,input().split()))\nb = []\nfor i in range(1,n+1):\n b.append(a[i-1] - i)\nb.sort\nif n % 2 != 0:\n B = b[int((n+1)/2)]\n ans = 0\n for i in range(n):\n ans += abs(a[i]-i-1-B)\n print(ans)\nelse:\n big = b[int((n+2)/2)]\n smo = b[int(n/2)]\n smoB = int((big+smo)/2)\n bigB = smoB + 1\n big = smo = 0\n for i in range(n):\n big += abs(a[i]-i-1-bigB)\n for i in range(n):\n smo += abs(a[i]-i-1-smoB)\n print(min(big,smo))', 'n = int(input())\na = list(map(int,input().split()))\n\nxave = ((n*(n-1))/2)/n\nyave = sum(a)/n\ncov = 0\nfor i in range(n):\n cov += (i+1-xave)*(a[i]-yave)\ncov = cov/n\n\ndps = 0\nfor i in range(n):\n dps += (i+1-xave)**2\ndps = dps / n\nA = cov / dps\nB = int(yave - A * xave)\nansls = []\nfor j in range(n):\n ans = 0\n for i in range(n):\n ans += abs(a[i] - i - 1 - B - j)\n ansls.append(ans)\nprint(max(ansls))', 'from statistics import median \nn = int(input())\na = list(map(int,input().split()))\nls = []\nfor i in range(n):\n ls.append(a[i] - i - 1)\nb = median(ls)\nif b % 1 == 0:\n ans = 0\n b = int(b)\n for i in range(n):\n ans += abs(a[i] - (b + i + 1))\n print(ans)\nelse:\n bigans = smallans = 0\n for i in range(n):\n bigans += abs(a[i] - (int(b) + i + 2))\n smallans += abs(a[i] - (int(b) + i + 1))\n print(min(bigans,smallans))']
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s045327584', 's669978324', 's835791639', 's931386678']
[26016.0, 26020.0, 26016.0, 27252.0]
[371.0, 238.0, 2104.0, 366.0]
[464, 491, 464, 454]
p03309
u941753895
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
["n=int(input())\nl=list(map(int,input().split()))\nif ' '.join([str(x) for x in l])=='2 2 3 5 5':\n exit()\ns=[0]*2\nf='first'\nf2='front'\nb=1\nans=0\nfor i in range(n):\n s[0]+=abs(l[i]-(i+1))\nwhile True:\n if f2=='front':\n for i in range(n):\n s[1]+=abs(l[i]-(b+i+1))\n if s[0]<s[1]:\n if f=='first':\n s[1]=0\n f='not first'\n f2='back'\n else:\n ans=s[0]\n break\n else:\n s[0]=s[1]\n s[1]=0\n b+=1\n else:\n for i in range(n):\n s[1]+=abs(l[i]-(-b+i+1))\n if s[0]<s[1]:\n ans=s[0]\n break\n else:\n s[0]=s[1]\n s[1]=0\n b+=1\nprint(ans)", 'import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy\n\nsys.setrecursionlimit(10**7)\ninf=10**20\nmod=10**9+7\ndd=[(-1,0),(0,1),(1,0),(0,-1)]\nddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\ndef LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]\ndef I(): return int(sys.stdin.readline())\ndef LS(): return sys.stdin.readline().split()\ndef S(): return input()\n\ndef main():\n n=I()\n _l=LI()\n\n l=[]\n for i,x in enumerate(_l):\n l.append(x-(i+1))\n\n l.sort()\n if n%2==1:\n x=l[n//2]\n else:\n x=(l[n//2]+l[n//2-1])//2\n\n ans=0\n for y in l:\n ans+=abs(y-x)\n\n return ans\n\n# main()\nprint(main())\n']
['Wrong Answer', 'Accepted']
['s430577948', 's479797295']
[28100.0, 27820.0]
[2104.0, 236.0]
[623, 732]
p03309
u944325914
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['n=int(input())\na=list(map(int,input().split()))\nfor i in range(n):\n a[i]=a[i]-(i+1)\nimport numpy as np\nan=np.array(a)\nb=np.median(an)\nans=0\nfor i in a:\n ans+=abs(i-b)\nprint(ans)', 'n=int(input())\na=list(map(int,input().split()))\nfor i in range(n):\n a[i]=a[i]-(i+1)\nimport numpy as np\nan=np.array(a)\nb=int(np.median(an))\nans=0\nfor i in a:\n ans+=abs(i-b)\nprint(ans)']
['Wrong Answer', 'Accepted']
['s529980248', 's479085666']
[37636.0, 37788.0]
[281.0, 230.0]
[183, 188]
p03309
u945181840
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['N = int(input())\nA = list(map(int, input().split()))\n\nA = [A[i] - (i + 1) for i in range(N)]\nb = round(sum(A) // N)\nprint(A, b)\nans = 0\n\nfor i in A:\n ans += abs(i - b)\n\nprint(ans)', 'import statistics\n\nN = int(input())\nA = list(map(int, input().split()))\n\nB = [A[i] - (i + 1) for i in range(N)]\nb = int(statistics.median(B))\nans = 0\n\nfor i in B:\n ans += abs(i - b)\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s669337652', 's700327778']
[26128.0, 27256.0]
[154.0, 224.0]
[182, 196]
p03309
u945200821
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['import sys\nimport numpy as np\n\n\ndef main():\n readline = sys.stdin.readline\n \n n = int(readline().rstrip())\n a = np.array(\n tuple(int(a_i) for a_i in readline().rstrip().split())\n )\n \n b = int(np.median(a - np.arange(1, n + 1)))\n \n print(b)\n \n\nif __name__ == "__main__":\n main()\n', 'import sys\nimport numpy as np\n\n\ndef main():\n readline = sys.stdin.readline\n \n n = int(readline().rstrip())\n a = np.array(\n tuple(int(a_i) for a_i in readline().rstrip().split())\n )\n \n b = int(np.median(a - np.arange(1, n + 1)))\n \n print(np.sum(np.abs(a - np.arange(1, n + 1) - b)))\n \n\nif __name__ == "__main__":\n main()\n']
['Wrong Answer', 'Accepted']
['s395600690', 's120744617']
[34424.0, 34388.0]
[226.0, 227.0]
[292, 334]
p03309
u952022797
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['# -*- coding: utf-8 -*-\nimport sys\nimport copy\nimport collections\nfrom bisect import bisect_left\nfrom bisect import bisect_right\nfrom collections import defaultdict\nfrom heapq import heappop, heappush\nimport numpy as np\n\ndef main():\n\tN = int(input())\n\tA = list(map(int, input().split(" ")))\n\t\n\tA_tmp = []\n\tfor i, val in enumerate(A):\n\t\tA_tmp.append(val - (i+1))\n\t\t\n\they = (sum(A_tmp) // len(A_tmp))\n\tans = 0\n\tfor i, val in enumerate(A):\n\t\tans += abs(val-(hey+i))\n\t\t\n\t#print(A_tmp)\n\tprint(ans)\n\t\nif __name__ == "__main__":\n\tmain()\n', '# -*- coding: utf-8 -*-\nimport sys\nimport copy\nimport collections\nfrom bisect import bisect_left\nfrom bisect import bisect_right\nfrom collections import defaultdict\nfrom heapq import heappop, heappush\nimport numpy as np\nimport statistics\nimport math\n\ndef main():\n\tN = int(input())\n\tA = list(map(int, input().split(" ")))\n\t\n\tA_tmp = []\n\tfor i, val in enumerate(A):\n\t\tA_tmp.append(val - (i+1))\n\t\t\n\they = np.median(A_tmp)\n\tans = 0\n\tfor i, val in enumerate(A):\n\t\tans += abs(val-(hey+(i+1)))\n\t\t\n\t#print(A_tmp)\n\tprint(int(ans))\n\t\nif __name__ == "__main__":\n\tmain()\n']
['Wrong Answer', 'Accepted']
['s893157061', 's786615205']
[34220.0, 35384.0]
[261.0, 750.0]
[530, 559]
p03309
u957167787
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['import math\n\nN = int(input())\nA = list(map(int, input().split()))\n\nC = []\nfor i in range(N):\n C.append(A[i] - (i+1))\nave = sum(C) / N\n\nblist = []\nblist.append(ave // 1)\nblist.append((ave + 1) // 1)\n\nans = 10**15\nfor b in blist:\n tmp = 0\n for c in C:\n tmp += abs(c - b)\n ans = min(ans, tmp)\n\nprint(ans)', 'import math\n\nN = int(input())\nA = list(map(int, input().split()))\n\nB = []\nfor i in range(N):\n B.append(A[i] - (i+1))\n\nB.sort()\nif N % 2 == 1:\n b = B[(N-1) // 2]\nelse:\n b = (B[N // 2] + B[N // 2 - 1]) // 2\n\nans = 0\nfor i in range(N):\n ans += abs(B[i] - b)\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s510473278', 's564422339']
[26832.0, 26832.0]
[201.0, 258.0]
[320, 278]
p03309
u963903527
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['n = input()\nxs = input().split(" ")\n\nl = list()\nfor x in xs:\n\tl.append(int(x))\n\n\nll = list()\nfor index, argv in enumerate(l):\n\tfor x in range(max(l)):\n\t\tls = list()\t\t\n\t\tab = abs(argv - (n + index))\n\t\tls.append(ab)\n\tll.append(ls)\n\nsum_list = list()\nfor line in ls:\n\ts = sum(line)\n\tsum_list.append(s)\n\nprint(min(sum_list))\n', 'n = input()\nxs = input().split(" ")\n\nl = list()\nfor x in xs:\n\tl.append(int(x))\n\n\nll = list()\nfor x in range(max(l)):\n\tfor index, argv in enumerate(l):\n\t\tls = list()\t\t\n\t\tab = abs(argv - (x + index))\n\t\tls.append(ab)\n\tll.append(ls)\n\nsum_list = list()\nfor line in ll:\n\ts = sum(line)\n\tsum_list.append(s)\n\nprint(min(sum_list))\n', 'input()\na = list(map(int, input().split()))\nb = sorted([a[i]-i-1 for i in range(len(a))])\nmed=b[len(b)//2]\nprint(sum(list(map(abs,list(map(lambda x: x-med ,b))))))']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s062453996', 's632884644', 's026631870']
[26180.0, 261876.0, 33108.0]
[100.0, 2120.0, 216.0]
[321, 321, 163]
p03309
u964299793
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['n=int(input())\na=list(map(int,input().split()))\nb=list(map(int,input().split()))\nc=list(map(int,input().split()))\na.sort()\nb.sort()\nc.sort()\nn=len(a)\nj=0\nk=0\nfor i in range(n):\n while j<n and b[j]<=a[i]:\n j+=1\n while k<n and c[k]<=b[j]:\n k+=1\n\n', 'n=int(input())\na=list(map(int,input().split()))\nfor i in range(n):\n a[i]-=(i+1)\nmedian=-1\na.sort()\nif n%2==0:\n median=(a[n//2]+a[n//2-1])//2\nelse:\n median=a[n//2]\ndef comp(x):\n su=0\n for i in a:\n su+=abs(i-x)\n return su\nprint(min(comp(median),comp(median+1)))\n\n\n\n']
['Runtime Error', 'Accepted']
['s433211162', 's357286837']
[26836.0, 25200.0]
[66.0, 224.0]
[264, 288]
p03309
u978494963
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['from pprint import pprint\nfrom statistics import median\n\nN = int(input())\nAs = list(map(int, input().split(" ")))\n\n# pprint(As)\n\nb = median(As)\n\nans = 0\n\nfor i, A in enumerate(As):\n ans += abs(A-b-i)\n\nprint(ans)', 'from pprint import pprint\n\nN = int(input())\nAs = list(map(int, input().split(" ")))\n\n\n\nprint(As)\n\n# b = sum([abs(A) for A in As])//N\nb = sum(As)//N\n\nprint(b)\n\nans = 0\n\nprint([abs(a-b) for a in As])\n\nfor A in As:\n ans += abs(A-b)\n\nprint(ans)', 'from pprint import pprint\nfrom statistics import median\n\nN = int(input())\nAs = list(map(int, input().split(" ")))\n\nAs = [A - i for i, A in enumerate(As)]\n\n# pprint(As)\n\nb = int(median(As))\n\nans = 0\n\nfor A in As:\n ans += abs(A-b)\n\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s276457648', 's579160292', 's670045622']
[27268.0, 29980.0, 27260.0]
[233.0, 167.0, 211.0]
[214, 283, 243]
p03309
u979823197
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['N=int(input())\nA=list(map(int,input().split()))\ndef quick_sort(a):\n if len(a) <= 1:\n return a\n else:\n b = []\n c = []\n for i in range(1, len(a)):\n if a[i] < a[0]:\n b.append(a[i])\n else:\n c.append(a[i])\n return quick_sort(b)+[a[0]]+quick_sort(c)\ndef abs(x):\n if x>=0:\n return x\n else:\n return x*(-1)\nB=[0]*N\nfor j in range(N):\n B[j]=A[j]-j-1\nbh=quick_sort(B)[0]\nbt=quick_sort(B)[N-1]\ndef sad(A,b):\n s=[0]*(len(A))\n for m in range(len(A)):\n s[m]=abs(A[m]-(b+m+1))\n return s\ndef sum(A):\n sum=0\n for n in range(len(A)):\n sum=sum+A[n]\n return sum\nl=[]\nfor o in range(bh-5,bt+5):\n l.append(sum(sad(A,o)))', 'N=int(input())\nA=list(map(int,input().split()))\ndef quick_sort(a):\n if len(a) <= 1:\n return a\n else:\n b = []\n c = []\n for i in range(1, len(a)):\n if a[i] < a[0]:\n b.append(a[i])\n else:\n c.append(a[i])\n return quick_sort(b)+[a[0]]+quick_sort(c)\ndef abs(x):\n if x>=0:\n return x\n else:\n return x*(-1)\nB=[0]*N\nfor j in range(N):\n B[j]=A[j]-j-1\nbh=quick_sort(B)[0]\nbt=quick_sort(B)[N]\ndef sad(A,b):\n s=[0]*(len(A))\n for m in range(len(A)):\n s[m]=abs(A[m]-(b+m+1))\n return s\ndef sum(A):\n sum=0\n for n in range(len(A)):\n sum=sum+A[n]\n return sum\nl=[]\nfor o in range(bh-5,bt+5):\n l.append(sum(sad(A,o)))\nprint(quick_sort(l)[0])', 'N=int(input())\nA=list(map(int,input().split()))\ndef quick_sort(a):\n if len(a)<= 1:\n return a\n else:\n b=[]\n c=[]\n for i in range(1, len(a)):\n if a[i]<a[0]:\n b.append(a[i])\n else:\n c.append(a[i])\n return quick_sort(b)+[a[0]]+quick_sort(c)\ndef abs(x):\n if x>=0:\n return x\n else:\n return x*(-1)\nB=[0]*N\nfor i in range(N):\n B[i]=A[i]-i-1\nC=quick_sort(B)\nif N%2==0:\n b=(C[N//2]+C[N//2-1])//2\nelse:\n b=C[N//2+1]\nsad=0\nfor j in range(N):\n sad=sad+abs(C[j]-b)\nprint(sad)\n', 'N=int(input())\nA=list(map(int,input().split()))\nB=A\nfor i in range(N):\n B[i]-=i+1\nC=sorted(B)\nif N%2==0:\n b=(C[int(N/2-1)]+C[int(N/2)])//2\nelse:\n b=C[int((N-1)/2)]\nans=0\nfor i in range(N):\n ans+=abs(C[i]-b)\nprint(ans)']
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s486060960', 's622870246', 's788243541', 's739049528']
[143012.0, 140688.0, 142828.0, 26180.0]
[2112.0, 2116.0, 2112.0, 221.0]
[726, 748, 579, 221]
p03309
u982591663
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['import numpy as np\nimport collections\n\nN = int(input())\nA = list(map(int, input().split()))\nans = 10**18\ndists_A2i = []\n\nfor i in range(1, N+1):\n dist_A2i = A[i-1] - i\n dists_A2i.append(dist_A2i)\n\nc = collections.Counter(dists_A2i)\n\nmax_c_list = [key for key, value in c.items() if value == max(c.values())]\n\ndists_A2i = np.array(dists_A2i)\n\nprint(dists_A2i)\nprint(max_c_list)\n\nfor max_c in max_c_list:\n check_dists_A2i = abs(dists_A2i - max_c)\n ans = min(ans, sum(check_dists_A2i))\n\nprint(ans)\n', 'import numpy as np\nimport collections\n\nN = int(input())\nA = list(map(int, input().split()))\nans = 0\ndists_A2i = []\n\nfor i in range(1, N+1):\n dist_A2i = A[i-1] - i\n dists_A2i.append(dist_A2i)\n\ndists_A2i = np.array(dists_A2i)\ndists_median = np.median(dists_A2i)\ndists_A2i = abs(dists_A2i - dists_median)\nans = sum(dists_A2i)\nprint(int(ans))\n']
['Wrong Answer', 'Accepted']
['s018411540', 's546983574']
[49972.0, 34160.0]
[2110.0, 332.0]
[507, 345]
p03309
u982896977
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['a = list(map(int,input().split()))\nwa = 0\nfor i in range(n):\n\ta[i] = a[i] - (i + 1)\n\twa += a[i]\nb = round(wa/n)\nans = 0\nfor i in range(n):\n\tans += abs(a[i] - b)\nprint(ans)', 'n = int(input())\na = list(map(int,input().split()))\na2 = [a[x] - (x + 1) for x in range(n)]\na2.sort()\nc = n // 2\nb = a2[c]\nans = 0\nfor i in range(n):\n\tans += abs(a2[i] - b)\nprint(ans)']
['Runtime Error', 'Accepted']
['s418346492', 's781071429']
[3064.0, 26356.0]
[18.0, 222.0]
[171, 183]
p03309
u989157442
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['\nfrom statistics import median\nn = int(input())\na = list(map(int, input().split()))\nb = []\n_sum = 0\nfor i in range(n):\n b.append(a[i] - i - 1)\nprint(med)\nfor i in range(n):\n _sum += abs(b[i] - med)\nprint(int(_sum))\n', '\nfrom statistics import median\nn = int(input())\na = list(map(int, input().split()))\nb = []\n_sum = 0\nfor i in range(n):\n b.append(a[i] - i - 1)\nmed = median(b)\nfor i in range(n):\n _sum += abs(b[i] - med)\nprint(int(_sum))\n']
['Runtime Error', 'Accepted']
['s917896539', 's962991633']
[27316.0, 27252.0]
[131.0, 256.0]
[243, 248]
p03309
u989345508
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['n=int(input())\ns=input().split()\na=sorted([int(s[i])-i-1 for i in range(n)])\n\nif n==1:\n print(0)\nelse:\n mi=[]\n k=sum(a)\n for i in range(n-1):\n c,d=a[i],a[i+1]\n k-=2*a[i]\n m=k\n l=(i+1)-(n-i-1)\n if l>0:\n m+=(l*a[i+1])\n else:\n m+=(l*a[i])\n mi.append(m)\n mi.append(k-a[0]*n)\n mi.append(a[-1]*n-k)\n print(min(mi))\n', 'n=int(input())\na=list(map(int,input().split()))\nfor i in range(n):\n a[i]-=(i+1)\na.sort()\n#print(a)\nm,now=sum(a)-2*a[0]+2*a[0]-a[0]*n,sum(a)-2*a[0]+2*a[0]-a[0]*n\nfor i in range(1,n):\n now=now-(2*(i)*a[i-1]-n*a[i-1])+(-2*a[i]+2*(i+1)*a[i]-n*a[i])\n m=min(now,m)\n #print(now)\nprint(m)']
['Wrong Answer', 'Accepted']
['s420441928', 's172371850']
[34780.0, 26020.0]
[377.0, 396.0]
[401, 292]
p03309
u992910889
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['import statistics\nimport sys\nsys.setrecursionlimit(10 ** 5 + 10)\n# input = sys.stdin.readline\n\ndef resolve():\n N=int(input())\n A=np.array(list(map(int,input().split())))\n\n B=np.array([i for i in range(1,N+1)])\n\n A=A-B\n val=0\n for i in A:\n val += abs(i - statistics.median(A))\n print(int(val))\nresolve()', '\n# from collections import Counter, deque\n# import copy\n# from fractions import gcd\n# from functools import reduce\n# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product\n# import math\nimport numpy as np\n#import statistics\n#import sys\n\n# input = sys.stdin.readline\n\ndef resolve():\n N=int(input())\n A=np.array(list(map(int,input().split())))\n\n for i in range(N):\n A[i]-=i+1\n\n B=abs(A-np.median(A))\n print(int(sum(B)))\nresolve()']
['Runtime Error', 'Accepted']
['s246611338', 's964163873']
[5400.0, 34164.0]
[42.0, 538.0]
[330, 555]
p03309
u994521204
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['import numpy as np\nn = int(input())\nhikumono = n * (n-1)//2\nA = np.array(list(map(int, input().split())))\nB = np.array([i+1 for i in range(n)])\nC=A-B\nheikin1 = np.median(C)//1\nheikin2 = heikin1 + 1\nheikin3 = heikin1 - 1\nans1 = abs(C-heikin1).sum()\nans2 = abs(C-heikin2).sum()\nans3 = abs(C-heikin3).sum()\nprint(min(ans1, ans2, ans3))', 'import numpy as np\nn = int(input())\nhikumono = n * (n-1)//2\nA = np.array(list(map(int, input().split())))\nB = np.array([i+1 for i in range(n)])\nC=A-B\nheikin1 = int(np.median(C))\nheikin2 = heikin1 + 1\nheikin3 = heikin1 - 1\nans1 = abs(C-heikin1).sum()\nans2 = abs(C-heikin2).sum()\nans3 = abs(C-heikin3).sum()\nprint(min(ans1, ans2, ans3))']
['Wrong Answer', 'Accepted']
['s441314962', 's593858361']
[34192.0, 34184.0]
[241.0, 246.0]
[332, 334]
p03309
u996749146
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['\n\n\n\n\n# 7\n# 1 1 1 1 2 3 4\n#import sys\n\nN = int(input())\na = list(map(int, input().strip().split(" ")))\n\nfor i in range(N):\n a[i] = a[i] - (i+1)\n\na.sort()\nif N % 2 != 0:\n mid = (N-1)/2 +1\nelse:\n mid = N / 2\nb = a[mid]\n\nsadness_left = b * (mid-1) - sum(a[:mid])\nsadness = sum(a) - b * N + sadness_left * 2\n\nprint(sadness)\n', '\n\n\n\n\n# 7\n# 1 1 1 1 2 3 4\n#import sys\n\nN = int(input())\na = list(map(int, input().strip().split(" ")))\n\nfor i in range(N):\n a[i] = a[i] - (i+1)\nprint(a)\n\na.sort()\nif N % 2 != 0:\n mid = (N-1)//2\nelse:\n mid = N // 2 -1\nb = a[mid]\n\nsadness_left = b * mid - sum(a[:mid])\nsadness = sum(a) - b * N + sadness_left * 2\n\nprint(sadness)\n', '\n\n\n\n\nN = int(input())\na = list(map(int, input().strip().split(" ")))\n\nfor i in range(N):\n a[i] = a[i] - (i+1)\n\na.sort()\nif N % 2 != 0:\n mid = (N-1)//2\nelse:\n mid = N // 2 \nb = a[mid]\n\nsadness_left = b * mid - sum(a[:mid])\nsadness = sum(a) - b * N + sadness_left * 2\n\nprint(sadness)\n\n\n']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s423847890', 's658731548', 's609152142']
[26708.0, 25748.0, 26128.0]
[183.0, 218.0, 194.0]
[437, 444, 434]
p03309
u997641430
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['N=int(input())\nA=list(map(int,input().split()))\nB=[A[i]-i for i in range(N)]\nC=median(B)\nprint(sum([b-C for b in B]))', 'N=int(input())\nA=list(map(int,input().split()))\nB=sorted([A[i]-i for i in range(N)])\nif N%2==0:\n\tC=int((B[int(N/2)]+B[int(N/2-1)])/2)\nelse:\n\tC=B[int((N-1)/2)]\nprint(sum([abs(b-C) for b in B]))']
['Runtime Error', 'Accepted']
['s277486555', 's737391816']
[25196.0, 27588.0]
[88.0, 192.0]
[117, 192]
p03311
u102126195
2,000
1,048,576
Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns the absolute value of x. Find the minimum possible sadness of Snuke.
['N = int(input())\ndata = list(map(int, input().split()))\nfor i in range(N):\n data[i] -= (i + 1)\nave = sum(data) / N\nif ave > 0:\n key = int(ave + 1)\n key1 = int(ave)\nelse:\n key = int(ave - 1)\n key1 = int(ave)\ndata.sort()\nsumdata = 0\nsumdata2 = 0\nkey = data[int(N / 2) - 1]\nkey2 = data[int(N / 2)]\nprint(data, key, key2)\nfor i in data:\n sumdata += abs(i - key)\n sumdata2 += abs(i - key2)\n\n#print(sumdatax)\n#print(data)\nprint(min([sumdata, sumdata2]))\n', 'N = int(input())\ndata = list(map(int, input().split()))\nfor i in range(N):\n data[i] -= (i + 1)\nave = sum(data) / N\nif ave > 0:\n key = int(ave + 1)\n key1 = int(ave)\nelse:\n key = int(ave - 1)\n key1 = int(ave)\ndata.sort()\nsumdata = 0\nsumdata2 = 0\nkey = data[int(N / 2) - 1]\nkey2 = data[int(N / 2)]\nfor i in data:\n sumdata += abs(i - key)\n sumdata2 += abs(i - key2)\n\n#print(sumdatax)\n#print(data)\nprint(min([sumdata, sumdata2]))']
['Wrong Answer', 'Accepted']
['s185407590', 's886137484']
[26180.0, 25708.0]
[275.0, 274.0]
[469, 445]