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
|
---|---|---|---|---|---|---|---|---|---|---|
p03311 | u195309147 | 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()\nA = list(map(int, input().split()))\n\nl = sorted([ x - (idx+1) for x,idx in enumerate(A)])\nprint(l)\n\nimport statistics\nmedian = statistics.median(l)\nprint(median)\n\nans = 0\nfor x in l:\n ans += abs(x - median)\n \nprint(int(ans))', 'N = input()\nA = list(map(int, input().split()))\n\nl = sorted([ x - (idx+1) for x,idx in enumerate(A)])\n#print(l)\n\nimport statistics\nmedian = statistics.median(l)\n#print(median)\n\nans = 0\nfor x in l:\n ans += abs(x - median)\n \nprint(int(ans))'] | ['Wrong Answer', 'Accepted'] | ['s187336144', 's992479602'] | [30800.0, 26708.0] | [279.0, 270.0] | [238, 240] |
p03311 | u240733052 | 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\ndef cost(b, A):\n N = len(A)\n c = 0\n for i in range(N):\n c += abs(b + i + 1 - A[i])\n return c\n\nN = int(input())\nl = input().split()\nA = np.array([0]*N)\nfor i in range(N):\n A[i] = int(l[i])\n \nb_sqmin = int(np.average(A) - (N+1)/2)\nc_sqmin = cost(b_sqmin, A)\nc_up = cost(b_sqmin+1, A)\nc_down = cost(b_sqmin-1, A)\n\nif c_sqmin == c_up or c_sqmin == c_down:\n print(c_sqmin)\n \nelif c_up < c_sqmin:\n c_now = c_up\n b_now = b_sqmin + 1\n \n while True:\n c_next = cost(b_now+1, A)\n \n if c_next >= c_now:\n print(c_now)\n break\n \n c_now = c_next\n b_now = b_now + 1\n \nelse:\n c_now = c_down\n b_now = b_sqmin - 1\n \n while True:\n c_next = cost(b_now-1, A)\n \n if c_next >= c_now:\n print(c_now)\n break\n \n c_now = c_next\n b_now = b_now - 1', 'import numpy as np\n\nN = int(input())\n\nB = np.array([0]*N)\n\nl = input().split()\n\nfor i in range(N):\n B[i] = int(l[i]) - (i+1)\n \nB = np.sort(B)\n\nif N % 2 == 1:\n b_mid = B[int(N/2)]\nelse:\n mid = int(N/2) - 1\n b_mid = int( (B[mid] + B[mid+1])/2 )\n\ndif = B - b_mid\n\nprint(np.sum(abs(dif)))'] | ['Wrong Answer', 'Accepted'] | ['s039104960', 's953888094'] | [31632.0, 31344.0] | [2109.0, 300.0] | [934, 299] |
p03311 | u281303342 | 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 bisect import bisect_left\n\nfor i in range(N):\n A[i] = A[i]-i\nA.sort()\n\nS = [0]*(N+1)\nfor i in range(N):\n S[i+1] = S[i]+A[i]\n\nsumA = sum(A)\nmaxA,minA = max(A),min(A)\n\nAns = 10**9\nfor i in range(3z00):\n l = bisect_left(A,minA)\n low = abs(minA*l - S[l]) + abs(S[N]-S[l] - minA*(N-l))\n h = bisect_left(A,maxA)\n high = abs(maxA*h - S[h]) + abs(S[N]-S[h] - maxA*(N-h))\n if low==high:\n minA += 1\n elif low < high:\n maxA = (maxA+minA)//2\n else:\n minA = (maxA+minA)//2\n #print(Ans,low,high,minA,maxA)\n Ans = min(Ans,low,high)\n\nprint(Ans)', 'N = int(input())\nA = list(map(int,input().split()))\n\nfor i in range(N):\n A[i] = A[i]-i\nA.sort()\n\nprint(A)\n\n\nmi = len(A)//2\nprint(mi)\n\nprint(sum(A[mi:]) - sum(A[:mi-1]))', 'N = int(input())\nA = list(map(int,input().split()))\n\nfor i in range(N):\n A[i] -= i\n\nA.sort()\n\nAns = 0\nmi = len(A)//2 \nfor i in range(N):\n Ans += abs(A[i]-A[mi])\n\nprint(Ans)\n'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s292114858', 's685363231', 's543941783'] | [3064.0, 26836.0, 25196.0] | [17.0, 213.0, 224.0] | [641, 194, 198] |
p03311 | u329865314 | 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. | ['i=int\nk=input\nN = i(k())\nl = list(map(i,k().split()))\nfor j in range(n):\n lis[j] -= (j+1)\nl.sort()\nprint(sum(list(map(lambda x: abs(x - l[N//2]),l))))', 'i=int\nk=input\nN = i(k())\nl = list(map(i,k().split()))\nfor j in range(N):\n l[j] -= (j+1)\nl.sort()\nprint(sum(list(map(lambda x: abs(x - l[N//2]),l))))'] | ['Runtime Error', 'Accepted'] | ['s917759726', 's706472691'] | [26832.0, 26708.0] | [67.0, 222.0] | [150, 148] |
p03311 | u415905784 | 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 functools\nN = int(input())\nA = [int(x) for x in input().split()]\nsum = functools.reduce(lambda x, y: x + y, sorted(A))\nave = sum // N - 1\nfor i,a in enumerate(A):\n A[i] = a - i - 1\nB0 = functools.reduce(lambda x, y: x + y, [abs(a - ave) for a in A])\nB1 = functools.reduce(lambda x, y: x + y, [abs(a - ave - 1) for a in A])\nB2 = functools.reduce(lambda x, y: x + y, [abs(a - ave + 1) for a in A])\nprint(min(B0, B1, B2))', 'import functools\nN = int(input())\nA = [int(x) for x in input().split()]\nsum = functools.reduce(lambda x, y: x + y, sorted(A))\nave = sum // N - 1\nB0 = functools.reduce(lambda x, y: x + y, [abs(a - ave) for a in A])\nB1 = functools.reduce(lambda x, y: x + y, [abs(a - ave - 1) for a in A])\nB2 = functools.reduce(lambda x, y: x + y, [abs(a - ave + 1) for a in A])\nprint(min(B0, B1, B2))', 'import functools\nN = int(input())\nA = [int(x) for x in input().split()]\nsum = functools.reduce(lambda x, y: x + y, sorted(A))\nave = sum // N\nB0 = functools.reduce(lambda x, y: x + y, [abs(a - ave) for a in A])\nB1 = functools.reduce(lambda x, y: x + y, [abs(a - ave - 1) for a in A])\nB2 = functools.reduce(lambda x, y: x + y, [abs(a - ave + 1) for a in A])\nprint(min(B0, B1, B2))', 'import functools\nN = int(input())\nA = [int(x) for x in input().split()]\nAi = sorted([A[i] - i - 1 for i in range(N)])\nif N % 2:\n med = N // 2\n ans = functools.reduce(lambda x, y: x + y, [abs(a - Ai[med]) for a in Ai])\nelse:\n med = N // 2\n ans1 = functools.reduce(lambda x, y: x + y, [abs(a - Ai[med]) for a in Ai])\n ans2 = functools.reduce(lambda x, y: x + y, [abs(a - Ai[med - 1]) for a in Ai])\n ans = min(ans1, ans2)\nprint(ans)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s090602500', 's143779566', 's581409414', 's971902550'] | [26876.0, 26876.0, 26876.0, 28124.0] | [343.0, 299.0, 294.0, 324.0] | [426, 382, 378, 435] |
p03311 | u452786862 | 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\nimport math\nn = int(input())\nA = list(map(int, input().split()))\n\naa = []\n\nfor i in range(n):\n aa.append(A[i] - 1 - i)\nprint(aa)\nb = int(statistics.median(aa))\n\nans = 0\n\nfor a in aa:\n ans += abs(a-b)\n\nprint(ans)\n', '\nimport statistics\nimport math\nn = int(input())\nA = list(map(int, input().split()))\n\naa = []\n\nfor i in range(n):\n aa.append(A[i] - 1 - i)\n# print(aa)\nb = int(statistics.median(aa))\n\nans = 0\n\nfor a in aa:\n ans += abs(a-b)\n\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s915573638', 's961856035'] | [29848.0, 27240.0] | [257.0, 240.0] | [237, 239] |
p03311 | u477320129 | 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. | ['#!/usr/bin/env python3\nimport sys\n\ndef solve(N: int, A: "List[int]"):\n from scipy.optimize import dual_annealing\n A = [a-i for i, a in enumerate(A, 1)]\n def f(b):\n return sum(abs(a-b) for a in A)\n res = dual_annealing(f, [[min(A), max(A)+1]], maxiter=100)\n print(res)\n b = res.x[0]\n return min(f(int(round(b))), f(int(round(b+1))))\n\n# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n tokens = iterate_tokens()\n N = int(next(tokens)) # type: int\n A = [int(next(tokens)) for _ in range(N)] # type: "List[int]" \n print(solve(N, A))\n\ndef test():\n import doctest\n doctest.testmod()\n\nif __name__ == \'__main__\':\n #test()\n main()\n', '#!/usr/bin/env python3\nimport sys\n\ndef solve(N: int, A: "List[int]"):\n A = sorted(a - i for i, a in enumerate(A))\n m = A[N//2]\n return sum(abs(a-m) for a in A)\n\n\n# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n tokens = iterate_tokens()\n N = int(next(tokens)) # type: int\n A = [int(next(tokens)) for _ in range(N)] # type: "List[int]"\n print(solve(N, A))\n\ndef test():\n import doctest\n doctest.testmod()\n\nif __name__ == \'__main__\':\n #test()\n main()\n'] | ['Wrong Answer', 'Accepted'] | ['s181881004', 's555739832'] | [83228.0, 41560.0] | [2208.0, 165.0] | [833, 639] |
p03311 | u480472958 | 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, As = int(input()), list(map(int, input().split()))\nAs = [As[i] - i - 1 for i in range(N)]\nans = sys.maxsize\nfor b in range(min(As), max(As) + 1):\n ans = min(ans, sum(map(lambda A: abs(A - b), As)))\nprint(ans)', 'N, As = int(input()), list(map(int, input().split()))\nAs = sorted([As[i] - i - 1 for i in range(N)])\nb = As[N // 2]\nprint(sum(map(lambda A: abs(A - b), As)))'] | ['Runtime Error', 'Accepted'] | ['s795163860', 's884556051'] | [26836.0, 26708.0] | [90.0, 201.0] | [214, 157] |
p03311 | u496131003 | 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(list(map(int,input().split())))\nn = np.array([i for i in range(A.size)][::-1])\nA = A+n\nave = np.median(A)\nprint(ave)\nprint(A)\nround = lambda x:int(x*2+1)//2\nave = round(ave)\nA = A-ave\nA = np.abs(A)\nprint(A.sum())', 'import numpy as np\nN = int(input())\nA = np.array(list(map(int,input().split())))\nn = np.array([i for i in range(A.size)][::-1])\nA = A+n\nave = np.median(A)\nround = lambda x:int(x*2+1)//2\nave = round(ave)\nA = A-ave\nA = np.abs(A)\nprint(A.sum())'] | ['Wrong Answer', 'Accepted'] | ['s031115308', 's877277963'] | [34192.0, 34204.0] | [1987.0, 1602.0] | [261, 241] |
p03311 | u530606147 | 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\ndef sadness(b):\n sad = 0\n for i, e in enumerate(a):\n i += 1\n sad += abs(e - (b + i))\n return sad\n\n\nleft, right = -10**9, 10**9 + 1\nwhile right - left > 1:\n mid = (left + right) // 2\n\n if sadness(mid) > sadness(mid + 1):\n left = mid\n else:\n right = mid\n\n# for b in range(-20, 20):\n# print(b,sadness(b))\n\nprint(sadness(mid))\n', 'n = int(input())\na = list(map(int, input().split()))\n\n\ndef sadness(b):\n sad = 0\n for i, e in enumerate(a):\n i += 1\n sad += abs(e - (b + i))\n return sad\n\n\nd = []\nfor i, e in enumerate(a):\n i += 1\n d.append(e - i)\n\nd.sort()\n\nif len(d) % 2 == 1:\n print(sadness(d[len(d) // 2]))\nelse:\n print(min(sadness(d[len(d) // 2]), sadness(d[len(d) // 2 + 1])))\n'] | ['Wrong Answer', 'Accepted'] | ['s503972223', 's474918290'] | [26708.0, 26180.0] | [2104.0, 297.0] | [398, 360] |
p03311 | u602715823 | 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\naa = list(map(lambda e: e[1] - (e[0] + 1), enumerate(a)))\nminbf = math.floor(sum(aa) / len(aa))\nansf = sum(map(lambda ea: abs(ea - minbf), aa))\n', 'from statistics import median\n\nn = int(input())\na = list(map(int, input().split()))\n\naa = list(map(lambda e: e[1] - (e[0] + 1), enumerate(a)))\nminb = median(aa)\n\n\nans = int(sum(map(lambda ea: abs(ea - minb), aa)))\n\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s682583657', 's931906480'] | [26832.0, 27236.0] | [136.0, 255.0] | [211, 225] |
p03311 | u623687794 | 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=[0]*n\nfor i in range(n):\n b[i]=a[i]-(i+1)\nb.sort()\nif n%2:\n ans=b[(n-1)//2]\n an=0\n for i in range(n):\n an+=abs(a[i]-ans)\n print(an)\nelse:\n ans=(b[n//2]+b[n//2-1])//2\n an=0\n for i in range(n):\n an+=abs(a[i]-ans)\n print(an)', 'n=int(input())\na=list(map(int,input().split()))\nb=[0]*n\nfor i in range(n):\n b[i]=a[i]-(i+1)\nb.sort()\nif n%2==1:\n ans=b[(n-1)//2]\n an=0\n for i in range(n):\n an+=abs(a[i]-ans-i-1)\n print(an)\nelse:\n ans=(b[n//2]+b[n//2-1])//2\n an=0\n for i in range(n):\n an+=abs(a[i]-ans-i-1)\n print(an)\n'] | ['Wrong Answer', 'Accepted'] | ['s599095418', 's714975558'] | [26180.0, 26180.0] | [231.0, 245.0] | [286, 298] |
p03311 | u645250356 | 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 mean\nimport math\nn = int(input())\na = [int(i) for i in input().split()]\nfor i in range(n):\n a[i] -= i+1\na_fl = math.floor(median(a))\na_ce = math.ceil(median(a))\nans_fl=ans_ce=0\n\nfor i in range(n):\n ans_fl += abs(a[i]-a_fl)\n ans_ce += abs(a[i]-a_ce)\nprint(int(min(ans_fl,ans_ce)))', 'from statistics import median\nimport math\nn = int(input())\na = [int(i) for i in input().split()]\nfor i in range(n):\n a[i] -= i+1\na_fl = math.floor(median(a))\na_ce = math.ceil(median(a))\nans_fl=ans_ce=0\n\nfor i in range(n):\n ans_fl += abs(a[i]-a_fl)\n ans_ce += abs(a[i]-a_ce)\nprint(int(min(ans_fl,ans_ce)))'] | ['Runtime Error', 'Accepted'] | ['s879553999', 's400444652'] | [27240.0, 27240.0] | [132.0, 348.0] | [311, 313] |
p03311 | u650950012 | 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()))\na_list2 = sorted([a - (i + 1) for i, a in enumerate(a_list)])\n\ns = 0\nb = math.floor(sum(a_list2) / n)\n\nfor a in a_list2:\n s += abs(a - b)\n \nprint(s)', 'import math\nimport numpy as np\n\nn = int(input())\na_list = list(map(int, input().split()))\na_list2 = sorted([a - (i + 1) for i, a in enumerate(a_list)])\n\ns_cand = []\nb_cand = [math.floor(sum(a_list2) / n), math.ceil(sum(a_list2) / n), int(np.median(a_list2))]\n\nfor b in b_cand:\n s = 0\n for a in a_list2:\n s += int(abs(a - b))\n s_cand.append(s)\n \nprint(min(s_cand))'] | ['Runtime Error', 'Accepted'] | ['s805675642', 's018427368'] | [25196.0, 34204.0] | [171.0, 504.0] | [212, 382] |
p03311 | u667024514 | 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())\nlis = list(map(int,input().split()))\ncou = 0\nco = 0\nnum = math.ceil(sum(lis))\nnu = math.floor(sum(lis))\nfor i in range(n):\n cou += abs(lis[i]-(num + i + 1))\n co += abs(lis[i]-(nu + i + 1))\nprint(min(cou,co))', 'import math\nn = int(input())\nlis = list(map(int,input().split()))\nif n == 1:\n print("0")\n exit()\nfor i in range(n):lis[-(i+1)] += i\nlis.sort()\ncou = 0\nco = 0\nnum = lis[math.ceil(n/2)]\nnu = lis[math.floor(n/2)]\nfor i in range(n):\n cou += abs(lis[i]-num)\n co += abs(lis[i]-nu)\nprint(min(cou,co))'] | ['Wrong Answer', 'Accepted'] | ['s817551188', 's367128169'] | [26832.0, 26832.0] | [202.0, 274.0] | [238, 297] |
p03311 | u668705838 | 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 = [i-i-1 for idx,i in enumerate(a)]\nimport statistics as st\nb = st.median(a)\nprint(sum([abs(i-b) for i in a]))', 'n = int(input())\na = list(map(int, input().split()))\na = [i-idx-1 for idx,i in enumerate(a)]\nimport statistics as st\nb = st.median(a)\nprint(int(sum([abs(i-b) for i in a])))'] | ['Wrong Answer', 'Accepted'] | ['s524358901', 's506588304'] | [26128.0, 26016.0] | [134.0, 222.0] | [165, 172] |
p03311 | u685263709 | 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\nfrom itertools import accumulate\n\n\nans = float("inf")\nif N == 4:\n ans = min(ans, (max(A) - min(A)))\nelse:\n cs = accumulate(A)\n for i in range(2, N - 2):\n left_cs = cs[:i]\n right_cs = cs[i:]\n for l, v in enumerate(left_cs):\n if v + left_cs[l + 1] >= left_cs[-1]:\n P = left_cs[l]\n Q = left_cs[-1] - P\n break\n for r, v in enumerate(right_cs):\n if v + right_cs[r + 1] >= right_cs[-1]:\n R = right_cs[r]\n S = right_cs[-1] - R\n break\n ans = min(ans, (max(P, Q, R, S) - min(P, Q, R, S)))\n\nprint(ans)', 'N = int(input())\nA = list(map(int, input().split()))\n\nfrom statistics import median\nA = [a - i - 1 for i, a in enumerate(A)]\nm = int(median(A))\n\nprint(sum(abs(a - m) for a in A))\n'] | ['Runtime Error', 'Accepted'] | ['s739683783', 's959792838'] | [25748.0, 26708.0] | [67.0, 210.0] | [701, 179] |
p03311 | u695857481 | 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\ndef sadness(a, b):\n sad = 0\n for i in range(len(a)):\n sad += abs(b + 1 + i - a[i])\n return sad\n\nn = input()\nl = list(map(int, input().split()))\nx = []\nfor i in range(len(l)):\n x.append(l[i] - i - 1)\n \nc = collections.Counter(x)\nmax_k = max(c, key=c.get)\nprint(max_k)\nkeys = [k for k, v in c.items() if v == c[max_k]]\nprint(keys)\nminsad = 1000000000\nfor i in range(len(keys)):\n b = keys[i]\n s = sadness(l, b)\n if (minsad > s):\n minsad = s\nprint(minsad)', 'import statistics\n\nn = input()\nl = list(map(int, input().split()))\nx = []\nfor i in range(len(l)):\n x.append(l[i] - i)\n \nb = 0\nif (len(x) % 2 == 1):\n b = statistics.median(x)\nelse:\n b = statistics.median_low(x)\n\nsad = 0\nfor i in x:\n sad += abs(i - b)\n\nprint(sad)'] | ['Wrong Answer', 'Accepted'] | ['s186709780', 's256817810'] | [42344.0, 27244.0] | [2106.0, 248.0] | [487, 268] |
p03311 | u702582248 | 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\nfor i in range(len(a)):\n a[i] -= i + 1\n\na.sort()\nb = [a[0]]\nfor i in a[1:]:\n b.append(b[-1] + i)\nhi = len(a)\nlo = 0\n\n\ndef score(index):\n return abs((lft * a[index] - b[index]) - (b[-1] - b[index] - (len(a) - index) * a[index]))\n\n\nfor i in range(10000):\n lft = (hi + 2 * lo) // 3\n rgt = (2 * hi + lo) // 3\n ltmp = score(lft)\n rtmp = score(rgt)\n if ltmp <= rtmp:\n lo = lft\n else:\n hi = rgt\n\nprintmin([(score(lo), score(lo + 1)]))\n', 'n = int(input())\na = list(map(int, input().split()))\n\nfor i in range(len(a)):\n a[i] -= i + 1\n\na.sort()\nb = [0]\nfor i in a:\n b.append(b[-1] + i)\nhi = len(a)\nlo = 0\n\n\ndef score(index):\n return abs(abs((index + 1) * a[index] - b[index+1]) + abs(b[-1] - b[index+1] - (len(a) - index - 1) * a[index]))\n\n\nfor i in range(10000):\n lft = (hi + 2 * lo) // 3\n rgt = (2 * hi + lo) // 3\n ltmp = score(lft)\n rtmp = score(rgt)\n if ltmp <= rtmp:\n lo = lft\n else:\n hi = rgt\n\nprint(min([score(i) for i in range(len(a))]))\n'] | ['Runtime Error', 'Accepted'] | ['s968160099', 's096212084'] | [3064.0, 31044.0] | [17.0, 411.0] | [523, 545] |
p03311 | u724563664 | 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\nn = int(input())\nnums = sorted([num - i for i, num in enumerate(list(map(int,input().split())), 1)])\n\n\nsums = [None for i in range(n)]\nsums[0] = nums[0]\nallv = sum(nums)\n\nminv = nums[0] * (2 - n) - 2 * sums[0] + allv\nfor i in range(n-1):\n sums[i+1] = sums[i] + nums[i+1]\n p = sum[i] * (2*(i+1) - n) -2 * sums[i] + allv\n minv = min(minv,p)\n\nprint(minv)', '#coding:utf-8\nn = int(input())\nnums = sorted([num - i for i, num in enumerate(list(map(int,input().split())), 1)])\n\n\nsums = [None for i in range(n)]\nsums[0] = nums[0]\nallv = sum(nums)\n\nminv = nums[0] * (2 - n) - 2 * sums[0] + allv\nfor i in range(n-1):\n sums[i+1] = sums[i] + nums[i+1]\n p = nums[i] * (2*(i+1) - n) -2 * sums[i] + allv\n minv = min(minv,p)\n\nprint(minv)\n'] | ['Runtime Error', 'Accepted'] | ['s381052273', 's357809075'] | [26020.0, 25708.0] | [175.0, 372.0] | [374, 376] |
p03311 | u747602774 | 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.sort()\n\nave = B[N//2]\nans = 0\nfor i in range(N):\n ans1 += abs(B[i]-ave)\nprint(ans)', 'N = int(input())\nA = list(map(int,input().split()))\nB = [A[i]-i-1 for i in range(N)]\nB.sort()\n\nave = B[N//2]\nans = 0\nfor i in range(N):\n ans += abs(B[i]-ave)\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s488420477', 's069667759'] | [26180.0, 26020.0] | [180.0, 216.0] | [172, 171] |
p03311 | u750420582 | 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 math\n\nN = int(input())\nA = np.array(list(map(int, input().split())))\n\nbase = np.arange(N, dtype=int) + 1\ntmp = A - base\nb = math.floor(np.median(tmp))\nans = np.abs(tmp - b).sum()\nprint(abs)\n', 'import numpy as np\nimport math\n\nN = int(input())\nA = np.array(list(map(int, input().split())))\n\nbase = np.arange(N, dtype=int) + 1\ntmp = A - base\nb = math.floor(np.median(tmp))\nans = np.abs(tmp - b).sum()\nprint(abs)\n', 'import numpy as np\nimport math\n\nN = int(input())\nA = np.array(list(map(int, input().split())))\n\nbase = np.arange(N, dtype=int) + 1\ntmp = A - base\nb = math.floor(np.median(tmp))\nans = np.abs(tmp - b).sum()\nprint(ans)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s183420818', 's283122801', 's006021273'] | [34172.0, 34188.0, 34228.0] | [219.0, 313.0, 287.0] | [216, 216, 215] |
p03311 | u780269042 | 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())\nd,x = map(int, input().split())\ntimes = [int(input()) for i in range(n)]\n\ncount = 0\nfor k in range(n):\n count += int(d/times[k]) + 1\n\nprint(count + x)\n ', 'N = int(input())\nA = list(map(int, input().split()))\na = sorted([x - i - 1 for i, x in enumerate(A)])\nc = a[N // 2]\nprint(sum([abs(i - c) for i in a]))\n'] | ['Runtime Error', 'Accepted'] | ['s062733370', 's636573717'] | [20856.0, 28372.0] | [35.0, 196.0] | [175, 152] |
p03311 | u807772568 | 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 = list(map(int,input().split()))\n \nfor i in range(a):\n\tb[i] -= i + 1\n \nb.sort()\ns = 0\nco = 0\nss = 0\ncoco = 0\ncococo = 0\nsumm = 0\nsu = 0\nbb = 0\nfor i in range(a):\n\tif b[i] < 0:\n\t\tco += 1\n\telif b[i] > 0:\n\t\tcoco += 1\n\telse:\n\t\tcococo += 1\n\tsu += abs(b[i])\n\n\nif co > coco:\t\n\twhile su <= bb:\n\t\tfor i in range(a):\n\t\t\tb[i] += 1\n\t\t\tif b[i] < 0:\n\t\t\t\tco += 1\n\t\t\telif b[i] > 0:\n\t\t\t\tcoco += 1\n\t\t\telse:\n\t\t\t\tcococo += 1\n\t\t\tbb += abs(b[i])\n\t\tif bb >= su:\n\t\t\tprint(su)\n\t\t\tbreak\n\t\tsu = bb\n\t\tbb = 0\n\n\t\tco = 0\n\t\tcoco = 0\n\t\tcococo = 0\n\nelif coco >= co:\n\twhile su >= bb:\n\t\tfor i in range(a):\n\t\t\tb[i] -= 1\n\t\t\tif b[i] < 0:\n\t\t\t\tco += 1\n\t\t\telif b[i] > 0:\n\t\t\t\tcoco += 1\n\t\t\telse:\n\t\t\t\tcococo += 1\n\t\t\tbb += abs(b[i])\n\t\tif bb <= su:\n\t\t\tprint(su)\n\t\t\tbreak\n\t\tsu = bb\n\t\tbb = 0\n\t\tco = 0\n\t\tcoco = 0\n\t\tcococo = 0\n', 'a = int(input())\nb = list(map(int,input().split()))\n \nfor i in range(a):\n\tb[i] -= i + 1\n \nb.sort()\nsu = 0\nc = b[(a - 1) // 2]\n\nfor i in range(a):\n\tsu += abs(b[i] - c)\n\nprint(su)'] | ['Wrong Answer', 'Accepted'] | ['s420742121', 's341395645'] | [25200.0, 26180.0] | [2104.0, 223.0] | [795, 177] |
p03311 | u813074979 | 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\ndef f(a, n):\n b = sum(a) / n\n b2 = (1+n) / 2 \n \n res = []\n for x in [b, b2, b-b2, b2-b, ceil(b), ceil(b2), floor(b), floor(b2), ceil(b-b2), ceil(b2 - b), floor(b-b2), floor(b2-b)]:\n s = (int(x+i) for i in range(1, n+1))\n sadness = sum(abs(ai - xi) for (ai, xi) in zip(a, s))\n res.append(sadness)\n \n return min(res)\n \nn = int(input())\na = [int(i) for i in input().split()]\nprint(f(a, n))\n', 'import math\ndef f(a, n):\n b = sum(a) / n\n b2 = (1+n) / 2 \n \n res = []\n for x in [b, b2, b-b2, b2-b, ceil(b), ceil(b2), floor(b), floor(b2), ceil(b-b2), ceil(b2 - b), floor(b-b2), floor(b2-b)]:\n s = (x+i for i in range(1, n+1))\n sadness = sum(abs(ai - xi) for (ai, xi) in zip(a, s))\n res.append(sadness)\n \n return min(res)\n \nn = int(input())\na = [int(i) for i in input().split()]\nprint(f(a, n))\n', 'import statistics\n\ndef f(a, n):\n b = statistics.median(a)\n s = ((b+i) for i in range(1, n+1))\n sadness = sum(abs(ai - xi) for (ai, xi) in zip(a, s))\n return sadness\n \nn = int(input())\na = [int(i) for i in input().split()]\nprint(f(a, n))\n', 'import statistics\n\ndef f(a, n):\n a2 = [ai - (i+1) for (i,ai) in enumerate(a)]\n b = int(statistics.median(a2))\n \n sadness = sum(abs(ai - b) for ai in a2)\n \n b += 1\n sadness2 = sum(abs(ai - b) for ai in a2)\n\n \n return min(sadness, sadness2)\n \nn = int(input())\na = [int(i) for i in input().split()]\nprint(f(a, n))\n'] | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s282381414', 's579643596', 's639240746', 's267738256'] | [26608.0, 26612.0, 27256.0, 27328.0] | [79.0, 80.0, 233.0, 234.0] | [448, 443, 252, 341] |
p03311 | u814986259 | 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\nN=int(input())\nA=list(map(int,input().split()))\ndiff_dic=collections.defaultdict(int)\n\n\nB=[A[i]-(i+1) for i in range(N)]\nfor i in range(N):\n diff_dic[B[i]]+=1\n \ndiff_list=sorted(list(diff_dic.items()), key=lambda x:x[1],reverse=True)\nans=diff_list[0][0]\nprint(ans)', 'import collections\nimport math\nN=int(input())\nA=list(map(int,input().split()))\ndiff_dic=collections.defaultdict(int)\n\n\nB=[A[i]-(i+1) for i in range(N)]\nfor i in range(N):\n diff_dic[B[i]]+=1\n \ndiff_list=sorted(list(diff_dic.items()), key=lambda x:x[1],reverse=True)\nans=diff_list[0][0]\ntemp=0\n\nans=sum(diff_list) / N\ntemp=0\nfor j in range(N):\n temp+= abs(A[j] - (int(ans) + j + 1) )\nprint(temp)\n\ntemp2=0\nfor j in range(N):\n temp2+= abs(A[j] - (math.ceil(ans) + j + 1) )\nprint(temp2)', 'import math\nN=int(input())\nA=list(map(int,input().split()))\n\nB=[A[i]-(i+1) for i in range(N)]\n\ntemp=0\n\nif N%2==0:\n ans = B[N//2]\n ans2= B[N//2 -1]\n temp=0\n for j in range(N):\n temp+= abs(A[j] - ans)\n temp2=0\n for j in range(N):\n temp2+= abs(A[j] - ans2)\n ans= min(temp,temp2)\nelse:\n ans = B[N//2]\n temp=0\n for j in range(N):\n temp+= abs(A[j] - ans )\n ans=temp\nprint(ans)\n\n', 'import collections\nimport math\nN=int(input())\nA=list(map(int,input().split()))\ndiff_dic=collections.defaultdict(int)\n\n\nB=[A[i]-(i+1) for i in range(N)]\nfor i in range(N):\n diff_dic[B[i]]+=1\n \ndiff_list=sorted(list(diff_dic.items()), key=lambda x:x[1],reverse=True)\nans=diff_list[0][0]\ntemp=0\n\nans=sum(diff_list) / N\ntemp=0\nfor j in range(N):\n temp+= abs(A[j] - (int(ans) + j + 1) )\n\n\ntemp2=0\nfor j in range(N):\n temp2+= abs(A[j] - (math.ceil(ans) + j + 1) )\nprint(min(temp,temp2))', 'import collections\nN = int(input())\nA = list(map(int, input().split()))\nB = [A[i] - (i+1) for i in range(N)]\n\nB.sort()\n\nans = 0\nt = B[len(B)//2]\n\nfor x in B:\n ans += abs(x - t)\n\nprint(ans)\n'] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s247095363', 's538396109', 's690052607', 's705626629', 's742518098'] | [49640.0, 50024.0, 26608.0, 50024.0, 26764.0] | [302.0, 274.0, 195.0, 277.0, 218.0] | [285, 485, 392, 484, 192] |
p03311 | u835482198 | 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)\na = sorted(a)\nprint(a[n // 2])\n', 'n = int(input())\na = list(map(int, input().split()))\nfor i in range(n):\n a[i] = a[i] - (i + 1)\na = sorted(a)\nb = a[n // 2]\ntotal = 0\nfor i in range(n):\n total += abs(a[i] - b)\nprint(total)\n'] | ['Wrong Answer', 'Accepted'] | ['s713772427', 's001020967'] | [26708.0, 25196.0] | [187.0, 223.0] | [129, 195] |
p03311 | u855985627 | 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 func(A,b):\n s=0\n for i in range(len(A)):\n s+=abs(A[i]-(b+i))\n return s\n\nN=int(input())\nA=[int(i) for i in input().split(' ')]\nmin=None\nfor b in range(A[0],A[-1]-len(A)+1):\n if min=None:\n min=func(A,b)\n elif min>func(A,b):\n min=func(A,b)\nprint(min)", "N=int(input())\nA=[int(i) for i in input().split(' ')]\nfor i in range(len(A)):\n a[i]-=i+1\nif len(A)%2==1:\n b=(len(A)-1)//2\nelse:\n b=(len(A))//2-1\ns=0\nfor i in range(len(A)):\n s+=abs(A[i]-(b+i))\nprint(s)", "def func(A,b):\n s=0\n for i in range(len(A)):\n s+=abs(A[i]-(b+i))\n return s\n\nN=int(input())\nA=[int(i) for i in input().split(' ')]\nmin=None\nfor b in range(A[0],A[-1]-len(A)+1):\n if min==None:\n min=func(A,b)\n elif min>func(A,b):\n min=func(A,b)\nprint(min)", "N=int(input())\nA=[int(i) for i in input().split(' ')]\nfor i in range(len(A)):\n A[i]-=i+1\nA.sort()\nif len(A)%2==1:\n b=A[(len(A)-1)//2]\nelse:\n b=A[(len(A))//2-1]\ns=0\nfor i in range(len(A)):\n s+=abs(A[i]-b)\nprint(s)"] | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s034734888', 's168807752', 's719316137', 's733015644'] | [2940.0, 26020.0, 25196.0, 25196.0] | [17.0, 74.0, 2104.0, 239.0] | [265, 205, 266, 216] |
p03311 | u857759499 | 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,*a = map(int,open(0).read().split())\na = [a[i] -i -1 for i in range(n)]\na.sort()\nprint(a)\nb = a[n//2]\nif n % 2 == 0:\n c = b + 1\nelse:\n c = a[n//2+1]+1\nans = min([sum([abs(i - j) for i in a]) for j in range(b,c)])\nprint(ans)', 'n,*a = map(int,open(0).read().split())\na = [a[i] -i -1 for i in range(n)]\na.sort()\nprint(a)\nb = a[n//2]\nif n % 2 == 0:\n c = b + 1\nelse:\n c = a[n//2+1]+1\nans = min([sum([abs(i - j) for i in a]) for j in range(b,c)])\nprint(ans)', 'n,*a = map(int,open(0).read().split())\na = sorted([a[i] -i for i in range(n)])\nprint(sum([abs(i - a[n//2]) for i in a]))'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s856930034', 's865234225', 's314948050'] | [31712.0, 31472.0, 31660.0] | [2206.0, 2206.0, 148.0] | [227, 227, 120] |
p03311 | u860002137 | 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())))\n\narr = np.arange(n) + 1\ndiff = a - arr\n\ndiff.sort()\n\ndiff -= np.median(diff)\n\nprint(int(np.abs(diff).sum()))', 'import numpy as np\n\nn = int(input())\na = np.array(list(map(int, input().split())))\n\narr = np.arange(n) + 1\ndiff = a - arr\n\ndiff.sort()\n\ndiff = diff - np.median(diff)\n\nprint(int(np.abs(diff).sum()))'] | ['Runtime Error', 'Accepted'] | ['s685388692', 's703344707'] | [49624.0, 49424.0] | [181.0, 186.0] | [191, 197] |
p03311 | u879309973 | 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\ndef f(n, b, c):\n return np.sum(np.abs(c-b))\n\ndef solve(n, a):\n c = np.asarray([(a[i]-i-1) for i in range(n)], dtype=int)\n b = np.median(c)\n return f(n, b, c)\n\nassert solve(5, [2, 2, 3, 5, 5]) == 2\nassert solve(9, [1, 2, 3, 4, 5, 6, 7, 8, 9]) == 0\nassert solve(6, [6, 5, 4, 3, 2, 1]) == 18\nassert solve(7, [1, 1, 1, 1, 2, 3, 4]) == 6\nn = int(input())\na = list(map(int, input().split()))\nprint(solve(n, a))\n', 'import numpy as np\ndef f(n, b, c):\n return np.sum(np.abs(c-b))\n\ndef solve(n, a):\n c = np.asarray([(a[i]-i-1) for i in range(n)], dtype=int)\n b = np.median(c)\n return int(f(n, b, c))\n\nassert solve(5, [2, 2, 3, 5, 5]) == 2\nassert solve(9, [1, 2, 3, 4, 5, 6, 7, 8, 9]) == 0\nassert solve(6, [6, 5, 4, 3, 2, 1]) == 18\nassert solve(7, [1, 1, 1, 1, 2, 3, 4]) == 6\nn = int(input())\na = list(map(int, input().split()))\nprint(solve(n, a))'] | ['Wrong Answer', 'Accepted'] | ['s106769736', 's956923472'] | [34220.0, 34208.0] | [305.0, 236.0] | [436, 440] |
p03311 | u910632349 | 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()))\nc=sorted(a)\nm=c[n//2-1] \nans=0\nb=m-n//2\nfor i in range(n):\n ans+=abs(b-a[i]+i)\nprint(ans)', 'from statistics import median_high\nn=int(input())\na=list(map(int,input().split()))\nb=[]\nfor i in range(n):\n b.append(a[i]-i-1)\nb.sort()\nd=median_high(b)\nans=0\nfor i in range(n):\n ans+=abs(b[i]-d)\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s492735596', 's442183925'] | [30912.0, 33844.0] | [150.0, 196.0] | [162, 212] |
p03311 | u932465688 | 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.sort()\nS = 0\nif len(L)%2 == 0:\n k = L[(len(L)-1)//2]\n for i in range(len(L)):\n S += abs(L[i]-k)\nelse:\n k = (L[len(L)//2-1]+L[len(L)//2])/2\n for i in range(len(L)):\n S += abs(L[i]-k)\nprint(S)\n', 'N = int(input())\nL = list(map(int,input().split()))\nfor i in range(N):\n L[i] = L[i]-i-1\nL.sort()\nS = 0\nif len(L)%2 != 0:\n k = L[len(L)//2]\nelse:\n k = (L[len(L)//2-1]+L[len(L)//2])//2\nfor i in range(len(L)):\n S += abs(L[i]-k)\nprint(S)'] | ['Wrong Answer', 'Accepted'] | ['s196985884', 's051587417'] | [25708.0, 26020.0] | [223.0, 230.0] | [292, 237] |
p03311 | u953379577 | 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\nv = list(map(int,input().split()))\n\nv1 = []\n\nv2 = []\n\nq = 0\n\nfor i in v:\n if q == 0:\n v1.append(i)\n q = 1\n else:\n v2.append(i)\n q = 0\n \nmaxv1 = 0\n\nmaxv2 = 0\n\nfor i in set(v1):\n a = tuple(v1).count(i)\n if a>maxv1:\n maxv1 = a\n \nfor i in set(v2):\n b = tuple(v2).count(i)\n if b>maxv2:\n maxv2 = b\n \nif v1 == v2:\n print(n//2)\nelse:\n print(n-maxv1-maxv2)', 'n = int(input())\n\na = list(map(int,input().split()))\n\nb = []\n\nfor i in range(n):\n b.append(a[i]-i)\n \nb.sort()\n\nkb = [b[n//2],b[n//2]]\n\nans = []\n\nfor i in kb:\n x = 0\n for s in range(len(a)):\n x += abs(a[s]-i-s)\n ans.append(x)\n \nprint(min(ans))'] | ['Wrong Answer', 'Accepted'] | ['s894020877', 's023888600'] | [25876.0, 25196.0] | [2105.0, 300.0] | [452, 267] |
p03313 | u467736898 | 2,000 | 1,048,576 | There is an integer sequence of length 2^N: A_0, A_1, ..., A_{2^N-1}. (Note that the sequence is 0-indexed.) For every integer K satisfying 1 \leq K \leq 2^N-1, solve the following problem: * Let i and j be integers. Find the maximum value of A_i + A_j where 0 \leq i < j \leq 2^N-1 and (i or j) \leq K. Here, or denotes the bitwise OR. | ['N = int(input())\nA = list(map(int, input().split()))\nf = [[a] for a in A]\nfor i in range(N):\n j = 0\n while j < 1<<N:\n j |= 1<<i\n f[j] = sorted(f[j]+f[j^1<<i], reverse=True)[:2]\n j += 1\n print(j)\nAns = [sum(f[1])]\nfor a, b in f[2:]:\n Ans.append(max(Ans[-1], a+b))\nprint("\\n".join(map(str, Ans)))\n', 'N = int(input())\nA = list(map(int, input().split()))\nf = [[a, -1] for a in A]\nlim = 1<<N\nfor i in range(N):\n bit = 1<<i\n j = 0\n while j < lim:\n j |= bit\n a, b = f[j]\n c, d = f[j^bit]\n if a < c:\n f[j][0] = c\n f[j][1] = d if d>a else a\n elif b < c:\n f[j][1] = c\n j += 1\nans = sum(f[1])\nAns = [ans]\nfor a, b in f[2:]:\n s = a+b\n if s > ans:\n ans = s\n Ans.append(ans)\nprint("\\n".join(map(str, Ans)))\n'] | ['Wrong Answer', 'Accepted'] | ['s302153425', 's977999604'] | [46652.0, 73136.0] | [2106.0, 1996.0] | [332, 495] |
p03315 | u006425112 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ['s = input()\n\nsum = 0\nfor i in s:\n if s == "+":\n sum += 1\n else:\n sum -= 1\n\nprint(sum)', 's = input()\n\nsum = 0\nfor i in s:\n if i == "+":\n sum += 1\n else:\n sum -= 1\n\nprint(sum)'] | ['Wrong Answer', 'Accepted'] | ['s552731109', 's891261386'] | [2940.0, 2940.0] | [17.0, 17.0] | [105, 105] |
p03315 | u006657459 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ["s = input().split('')\nn = 0\nfor si in s:\n if si == '+':\n n = n + 1\n else:\n n = n - 1\nprint(n)\n", "s = input()\nn = 0\nfor i in range(len(s)):\n if s[i] == '+':\n n = n + 1\n else:\n n = n - 1\nprint(n)\n"] | ['Runtime Error', 'Accepted'] | ['s610471097', 's809593556'] | [2940.0, 2940.0] | [17.0, 17.0] | [114, 117] |
p03315 | u007550226 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ["c = 0\nfor s in input():\n if s = '+':c += 1\n else:c-= 1\nprint(c)", "c = 0\nfor s in input():\n if s == '+':c += 1\n else:c-= 1\nprint(c)"] | ['Runtime Error', 'Accepted'] | ['s859078553', 's228675137'] | [2940.0, 2940.0] | [17.0, 17.0] | [65, 66] |
p03315 | u018310845 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ['import math\n\ndef process_smaller_index(K, min_index):\n if min_index == 0:\n return 0\n else:\n return math.ceil(min_index / K)\n\ndef process_larger_index(last_index, K, min_index):\n if min_index == last_index:\n return 0\n else:\n return math.ceil((last_index - min_index) / K)\n\nN, K = map(int, input().split())\nA = [int(i) for i in input().split()]\nmin_index = A.index(1)\nprint(process_smaller_index(K - 1, min_index) + process_larger_index(len(A)-1, K - 1, min_index))', "S = input()\ncount = 0\nfor i in S:\n if i == '+':\n count += 1\n elif i == '-':\n count -= 1\nprint(count)"] | ['Runtime Error', 'Accepted'] | ['s963120047', 's882652891'] | [3064.0, 2940.0] | [17.0, 17.0] | [503, 120] |
p03315 | u020604402 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ["serch_table = []\n\nfor i in range(100):\n for j in range(1,1000):\n x = str(j) + '9'*i\n x = int(x)\n serch_table.append(x)\n#print(serch_table)\n\nL = []\nfor i in serch_table:\n l = [x for x in str(i)]\n x = sum(map(int,l))\n l = [i/x,i]\n L.append(l)\nL= sorted(L)\nM = []\ntmp = -1\nfor i in L:\n if tmp < i[1]:\n M.append(i[1])\n tmp = i[1]\n#print(M,len(serch_table ))\nN = int(input())\nfor i in range(N):\n print(M[i])\n", '\na=input()\nsum=0\nfor x in a:\n if x=="+":\n sum+=1\n\nprint((sum-2)*2)\n'] | ['Runtime Error', 'Accepted'] | ['s461232028', 's898088255'] | [22268.0, 2940.0] | [1144.0, 17.0] | [459, 77] |
p03315 | u026788530 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ["N,K =[int(i) for i in input().split(' ')]\n\nA = [int(i) for i in input().split(' ' )]\nindex_1 = -1\n\nfor i in range(len(A)):\n #print(index_1)\n if A[i]==1:\n index_1 = i\n break\n\nans = 0\nif index_1%(K-1)==0:\n ans += index_1 // (K-1)\nelse:\n ans += index_1 //(K-1) + 1\n\nif (N-index_1 -1)%(K-1)==0:\n ans += (N - index_1-1) // (K-1)\nelse:\n ans += (N - index_1 -1) //(K-1) + 1\n \nprint(ans)\n", "lis = input()\nans = 0\nfor i in lis:\n if i=='+':\n ans +=1\n else:\n ans-=1\n \nprint(ans)", "S = input()\nans =0\nfor i in S:\n if i=='+':\n ans +=1\n else:\n ans-=1\n\nprint(ans)\n"] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s724355807', 's791101396', 's846860786'] | [3064.0, 2940.0, 2940.0] | [18.0, 17.0, 17.0] | [415, 96, 99] |
p03315 | u027403702 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ['S = input()\nprint(S.count(+) - S.count(-))', 'S = input()\nprint(S.count("+") - S.count("-"))'] | ['Runtime Error', 'Accepted'] | ['s303004243', 's255197871'] | [2940.0, 2940.0] | [17.0, 19.0] | [42, 46] |
p03315 | u031324264 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ['s = 123456789\nsum = 0\ni = 0\n\nwhile i < 9:\n sum = sum + s % 10\n s = s // 10\n i = i + 1\n\nif s % sum = 0:\n print("yes")\nelse:\n print("no")\n', 's = input()\nsum = 0\ni = 0\n\nwhile i < 9:\n sum = sum + s % 10\n s = s // 10\n i = i + 1\n\nprint(sum)', 's = raw_input()\nprint(s.count("+") - s.count("-"))', 's = raw_input()\nprint (s.count("+") - s.count("-"))\n', 's = input()\nprint (s.count("+") - s.count("-"))'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s227633664', 's346227367', 's587678341', 's744647800', 's248347859'] | [2940.0, 2940.0, 2940.0, 2940.0, 2940.0] | [18.0, 17.0, 17.0, 18.0, 17.0] | [141, 98, 50, 52, 47] |
p03315 | u031391755 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ['n = str(input())\nnum = []\nfrom functools import reduce\nnum = [str(x) for x in list(str(n))]\nx = o\nfor i in num:\n if i == "+":\n x = x + 1\n else:\n x = x - 1\nprint(x)', 'n = str(input())\nnum = []\nfrom functools import reduce\nnum = [str(x) for x in list(str(n))]\nx = 0\nfor i in num:\n if i == "+":\n x = x + 1\n else:\n x = x - 1\nprint(x)'] | ['Runtime Error', 'Accepted'] | ['s808246414', 's763876848'] | [3572.0, 3684.0] | [22.0, 24.0] | [171, 171] |
p03315 | u037901699 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ['s=input()\na=0\nfor i in s:\n if i=="+":\n a+=1\n else:\n a-=1\nprint(s)', 's=input()\na=0\nfor i in s:\n if i=="+":\n a+=1\n else:\n a-=1\nprint(a)'] | ['Wrong Answer', 'Accepted'] | ['s689837686', 's286124656'] | [2940.0, 2940.0] | [17.0, 17.0] | [85, 85] |
p03315 | u038978707 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ['n=int(input())\nans=n\ns=0\nwhile n!=0:\n a=n%10\n s+=a\n n=n//10\nif ans%s==0:\n print("Yes")\nelse:\n print("No")', "n=input()\nans=0\nfor i in range(0,len(n)):\n if n[i]=='+':\n ans+=1\n else:\n ans-=1\nprint(ans)"] | ['Runtime Error', 'Accepted'] | ['s964036864', 's131889412'] | [2940.0, 2940.0] | [17.0, 18.0] | [120, 110] |
p03315 | u046585946 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ['s=list(input())\nans=0\nfor i in s:\n if i="-":\n ans=ans-1\n else:\n ans=ans+1\nprint(ans)', 's=list(input())\nans=0\nfor i in s:\n if i=="-":\n ans=ans-1\n else:\n ans=ans+1\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s861464501', 's959521358'] | [2940.0, 2940.0] | [18.0, 17.0] | [92, 93] |
p03315 | u049187681 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ["a = 0\nS = input().split()\n\nfor b in range(4):\n if S[b] == '+':\n a+=1\n elif S[b] == '-':\n a-=1\nprint(a)\n", "a = 0\nS = list(input())\n\nfor b in range(4):\n if S[b] == '+':\n a+=1\n elif S[b] == '-':\n a-=1\nprint(a)\n"] | ['Runtime Error', 'Accepted'] | ['s011108250', 's975104428'] | [2940.0, 2940.0] | [17.0, 17.0] | [123, 121] |
p03315 | u050121913 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ['count = 0\nN,K = map(int,input().split( ))\nJ = list(map(int,input().split( )))\nfor i,j in zip(range(N),J):\n if j==1:\n s = i\n t = N-1-i\nfor _ in range(N+N):\n if s<=0:\n break\n else:\n s -= K-1\n count += 1\n\nfor _ in range(N+N):\n if t<=0:\n break\n else:\n t -= K-1\n count += 1\n \nif N<=K:\n count = 1\nprint(count)', "kazu = 0\nS = input()\nfor s in S:\n if s=='+':\n kazu += 1\n else:\n kazu -= 1\n \nprint(kazu)"] | ['Runtime Error', 'Accepted'] | ['s387107514', 's104715768'] | [3064.0, 2940.0] | [18.0, 17.0] | [384, 114] |
p03315 | u051496905 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ['S = input()\nSteam = 0\nminecraft = 0\nfor i in range()len(S):\n if S[i] == "+":\n minecraft += 1\n else:\n Steam += 1\nL = minecraft * 1\nP = Steam * -1\nprint(L + P)', 'S = input()\nSteam = 0\nmincraft = 0\nfor i in range()len(S):\n if S[i] == "+":\n minecraft += 1\n else:\n steam += 1\nL = minecraft * 1\nP = steam * -1\nprint(L + P)', 'S = input()\nSteam = 0\nminecraft = 0\nfor i in range(len(S)):\n if S[i] == "+":\n minecraft += 1\n else:\n Steam += 1\nL = minecraft * 1\nP = Steam * -1\nprint(L + P)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s386333795', 's988179837', 's163056700'] | [8700.0, 8960.0, 8936.0] | [25.0, 27.0, 27.0] | [177, 176, 177] |
p03315 | u054717609 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ['s=input()\nc=0\nfor i in range(0,len(s)):\n if (s[i]=="+"):\n c=c+1\n else:\n c=c-1\nprint(C)\n \n\n ', 's=input()\nc=0\nfor i in range(0,len(s)):\n if (s[i]=="+"):\n c=c+1\n else:\n c=c-1\nprint(c)\n \n\n '] | ['Runtime Error', 'Accepted'] | ['s392735111', 's594561744'] | [2940.0, 3064.0] | [17.0, 17.0] | [104, 104] |
p03315 | u056486147 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ['import math\nn, k = map(int, input().split())\ndata = list(map(int, input().split()))\nprint(math.ceil((n-1)/(k-1)))\n', "s = input()\nans = 0\nfor i in s:\n if i == '+':\n ans += 1\n else:\n ans -= 1\nprint(ans)\n"] | ['Runtime Error', 'Accepted'] | ['s442204474', 's119381884'] | [2940.0, 2940.0] | [17.0, 17.0] | [114, 104] |
p03315 | u057079894 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ["s=str(input())\nans=-4\nfor i in range(4):\n if s[i]='+':\n ans+=2\nprint(ans)\n", "s=str(input())\nans=-4\nfor i in range(4):\n if s[i]='+':\n ans+=2\ninput(ans)", "print(list(input()).count('+')*2-4)"] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s765230082', 's848604576', 's385961049'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [78, 77, 35] |
p03315 | u061406236 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ["s = str(input())\nans=0\nfor in range s:\n if '+' Then:\n ans += 1\n else:\n ans -= 1\n\nprint(ans)", "s = str(input())\nans=0\nfor x in range(len(s)):\n if s[x] == '+':\n ans += 1\n else:\n ans -= 1\n\nprint(ans)\n"] | ['Runtime Error', 'Accepted'] | ['s040952163', 's808249242'] | [8868.0, 8924.0] | [20.0, 27.0] | [111, 123] |
p03315 | u061554463 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ['s = input()\nc = 0\nfor i in s:\n if i == +:\n c += 1\n else:\n c -= 1\nprint(c)', 's = input()\nc = 0\nfor i in s:\n if i == "+":\n c += 1\n else:\n c -= 1\nprint(c)'] | ['Runtime Error', 'Accepted'] | ['s999707823', 's476993244'] | [2940.0, 2940.0] | [17.0, 17.0] | [93, 95] |
p03315 | u070200692 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ["x = input()\nprint(x.count('+') - count('-'))", "x = input()\nprint(x.count('+') - x.count('-'))"] | ['Runtime Error', 'Accepted'] | ['s774947941', 's463712604'] | [2940.0, 2940.0] | [17.0, 17.0] | [44, 46] |
p03315 | u070222311 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ["S=list(input())\ncount=0\nfor s in S:\n if s=='+':\n count=+1\n if s=='-':\n count=-1\n\n\nprint(count)", "S=list(input())\ncount=0\nfor s in S:\n if s=='+':\n count=count+1\n if s=='-':\n count=count-1\n\n\nprint(count)\n"] | ['Wrong Answer', 'Accepted'] | ['s491423875', 's309427063'] | [2940.0, 2940.0] | [17.0, 17.0] | [114, 125] |
p03315 | u071061942 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ['S = input()\nans = 0\nfor i in S:\n if i == "+":\n ans++\n else:\n ans--\nprint(ans)\n', 'S = input()\nans = 0\nfor i in S:\n if i == "+":\n ans += 1\n else:\n ans -= 1\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s836864244', 's459392551'] | [2940.0, 2940.0] | [18.0, 18.0] | [86, 91] |
p03315 | u075303794 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ['s = input()\nans = 0\nfor i in s:\n if i = "+":\n ans += 1\n else:\n ans -= 1\nprint(ans)', 's = input()\nans = 0\nfor i in s:\n if i == "+":\n ans += 1\n else:\n ans -= 1\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s897438547', 's697086767'] | [2940.0, 2940.0] | [17.0, 17.0] | [90, 91] |
p03315 | u076482195 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ["x=input()\nc=0\nfor i in range(len(x)):\n if x[i]=='-'\n \tc-=1\n else:\n c+=1\nprint(c)", 'x=input()\nc=0\nfor i in range(len(x)):\n c+=ord(x[i])-ord(\'0\')\nx=int(x)\nif x%c==0:\n print("Yes")\nelse:\n print("No")', "x=input()\nc=0\nfor i in range(len(x)):\n if x[i]=='-':\n \tc-=1\n else:\n c+=1\nprint(c)"] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s388656676', 's494327964', 's370476480'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 18.0] | [86, 116, 87] |
p03315 | u079022116 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ["sum = 0\na = {'-':-1,'+':1}\ns=input()\nfor i in len(s):\n sum+=a[s[i]]\nprint(sum)\n", "sum = 0\na = ['-':-1,'+':1]\ns=input()\nfor i in len(s):\n sum+=a[s[i]]\nprint(sum)", "sum = 0\na = {'-':-1,'+':1}\ns=input()\nfor i in range(len(s)):\n sum+=a[s[i]]\nprint(sum)"] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s594893759', 's784570606', 's391341310'] | [2940.0, 2940.0, 3060.0] | [17.0, 17.0, 20.0] | [80, 79, 86] |
p03315 | u094565093 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ['D,N=map(int,input().split())\nprint(100**D*N if N<100 else 100**D*101)', "S=input()\nsum=0\nfor i in range(len(S)):\n if S[i]=='+':\n sum+=1\n elif S[i]=='-':\n sum-=1\nprint(sum)\n "] | ['Runtime Error', 'Accepted'] | ['s958671721', 's284452087'] | [3064.0, 2940.0] | [17.0, 17.0] | [69, 123] |
p03315 | u095969144 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ["s = input()\na = 0\nfor i in range(len(s)):\n a += int(s[i])\ns = int(s)\nif s % a == 0 :\n print('Yes')\nelse :\n print('No')\n", "n = input()\ns = 0\nfor i in range(len(n)) :\n s += int(n[i])\nn = int(n)\nif n % s == 0 :\n print('Yes')\nelse :\n print('No')\n", "s = input()\na = 0\nfor i in range(len(s)):\n a += int(s[i])\ns = int(s)\nif s % a = 0 :\n print('Yes')\nelse :\n print('No')\n", 's = input()\ni = s.count("+")\n\nprint(2 * i - 4)'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s367061307', 's748123738', 's968617851', 's544493500'] | [2940.0, 3316.0, 2940.0, 2940.0] | [17.0, 24.0, 17.0, 17.0] | [128, 129, 127, 46] |
p03315 | u099053021 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ['n,k=input().split()\nn=int(n)\nk=int(k)\n\nprint(n//(k-1))', 'n,k=input().split()\nn=int(n)\nk=int(k)\n\nif n==k:\n\tprint(1)\nelif n//(k-1)=1:\n\tprint(2)\nelse:\n\tprint(n//(k-1))', 'str=input()\nlist=list(str)\na=0\nfor i in range(4):\n\tif list[i]=="+":\n\t\ta=a+1\n\telse:\n\t\ta=a-1\nprint(a)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s804580086', 's832010225', 's027875218'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [54, 107, 99] |
p03315 | u100622757 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ['#coding:utf-8\ns = input()\na = 0\nfor c in s:\n a = a + 1 if c == "+" else a = a - 1\nprint(a)', '#coding:utf-8\ns = input()\na = 0\nfor c in s:\n a = a + 1 if c = "+" else a = a - 1\nprint(a)', '#coding:utf-8\ns = input()\na = 0\nfor c in s:\n a = a + 1 if c == "+" else a - 1\nprint(a)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s036570649', 's185034755', 's755229045'] | [2940.0, 2940.0, 2940.0] | [16.0, 17.0, 17.0] | [91, 90, 87] |
p03315 | u102620029 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ['r = 0\ns = input()\nfor a in s:\n if a == “+”:\n r += 1\n else:\n r -= 1\nreturn r', "N = input()\nif N == '0':\n print('yes')\nelse:\n if N[0] == '-':\n N = int(N) * (-1)\n sum = 0\n for i in N:\n sum = sum + int(i)\n r = int(N) % sum\n if r == 0:\n print('yes')\n else:\n print('no')\n", 'result = 0\ns = input()\nfor i in s:\n if i == ‘+’:\n result = result + 1\n else:\n result = result - 1\nprint(result)', "result = 0\ns = input()\n\nfor i in s:\n if i == '+':\n result = result + 1\n else:\n result = result - 1\n\nprint(result)"] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s496579080', 's724506017', 's820928533', 's125383546'] | [2940.0, 2940.0, 2940.0, 2940.0] | [18.0, 17.0, 17.0, 19.0] | [99, 236, 135, 133] |
p03315 | u102960641 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ['n = input().split()\na = 0\nfor i in n:\n if i = "+"\n a+=1\n else\n a-=1\nprint(a)', 'n = input()\na = 0\nfor i in n:\n if i == "+":\n a+=1\n else:\n a-=1\nprint(a)\n'] | ['Runtime Error', 'Accepted'] | ['s000391678', 's035321784'] | [2940.0, 2940.0] | [18.0, 17.0] | [84, 80] |
p03315 | u106297876 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ["S_original=input('S: ')\nS_list=list(S_original)\nlength_S=len(S_list)\n\na=0\ni=0\n\nwhile i < length_S:\n if S_list[i]=='+':\n a += 1\n i += 1\n else:\n a = a-1\n i=i+1\n \n\nprint(a)\n ", "S_original=input()\nS_list=list(S_original)\nlength_S=len(S_list)\n\na=0\ni=0\n\nwhile i < length_S:\n if S_list[i]=='+':\n a += 1\n i += 1\n else:\n a = a-1\n i=i+1\n \n\nprint(a)\n "] | ['Wrong Answer', 'Accepted'] | ['s973960381', 's912809525'] | [2940.0, 2940.0] | [17.0, 18.0] | [189, 184] |
p03315 | u106342872 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ["c = 0\nfor i in range(len(s)):\n if s[i] == '+':\n c += 1\n else:\n c -= 1\n\nprint(c)\n", "s = list(str(input()))\nc = 0\nfor i in range(len(s)):\n if s[i] == '+':\n c += 1\n else:\n c -= 1\n\nprint(c)\n"] | ['Runtime Error', 'Accepted'] | ['s160609990', 's936714277'] | [2940.0, 2940.0] | [17.0, 17.0] | [100, 123] |
p03315 | u107091170 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ["S=input()\nans = 0\nfor i in range(4):\n if S[i] == '+':\n ans += 1\n else:\n ans =- 1\nprint(ans)", "S=input()\nans = 0\nfor i in range(4):\n if S[i] == '+':\n ans += 1\n else:\n ans -= 1\nprint(ans)\n"] | ['Wrong Answer', 'Accepted'] | ['s782528572', 's652565942'] | [2940.0, 2940.0] | [17.0, 17.0] | [99, 100] |
p03315 | u115682115 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ['N,K = map(int,input().rstrip().split())\nA = list(map(int,input().rstrip().split()))\nsum =0\nwhile len(A)>=2:\n sum+=1\n A.insert(K,min(A[:K]))\n del A[0:K]\nprint(sum)', "N = list(input())\nsum=0\nfor i in N:\n if i == '+':\n sum+=1\n elif i == '-':\n sum-=1\nprint(sum)"] | ['Runtime Error', 'Accepted'] | ['s828621279', 's338801995'] | [3060.0, 2940.0] | [18.0, 17.0] | [171, 112] |
p03315 | u115877451 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ["a=[input() for i in range(4)]\nfor i in a:\n if i=='+':\n i=1\n else:\n i=-1\nprint(sum(a))", "a=list(input())\nc=[]\nfor i in a:\n if i=='+':\n i=1\n c.append(i)\n else:\n i=-1\n c.append(i)\nprint(sum(c))\n"] | ['Runtime Error', 'Accepted'] | ['s891739999', 's683624818'] | [2940.0, 2940.0] | [18.0, 17.0] | [93, 117] |
p03315 | u120564432 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ['n=input()\nx=int(n)\nb=0\nfor i in n:\n b+=int(i)\n\nif x%b==0:\n print("Yes")\nelse:\n print("No")', 's=list(input())\np=0\nfor i in range(4):\n if s[i]=="+":\n p=p+1\n else:\n p=p-1\nprint(p) \n'] | ['Runtime Error', 'Accepted'] | ['s341296399', 's044434153'] | [2940.0, 2940.0] | [18.0, 18.0] | [93, 96] |
p03315 | u125666426 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ['import math\nN, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\n\nindex_of_1 = A.index(1)\n\nif index_of_1 == 0:\n first = 0\nelse:\n first = math.ceil((index_of_1 + 1) / K)\n\nif index_of_1 == N - 1:\n latter = 0\nelse:\n latter = math.ceil((N - index_of_1 + 1) / K)\n\nprint(first + latter)\n', "seq = input()\nprint(seq.count('+') - seq.count('-'))\n"] | ['Runtime Error', 'Accepted'] | ['s718661301', 's933484567'] | [3060.0, 2940.0] | [18.0, 17.0] | [315, 53] |
p03315 | u127856129 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ['print(4-input().count("-"))', 'a=raw_input()\nprint(a.count("+")-a.count("-"))', '\n\ns=raw_input()\nprint(s.count("+")-s.count("-"))\n', 'a=raw_input()\nprint((a.count("+")-(a.count("-"))', 'print(4-input().count("-")*1)', 'print(int(input().count("+"))+(-1*int(input().count("-"))))', '\n\ns = raw_input()\nprint(s.count("+")-s.count("-"))\n', 'print(4-input().count("-")*2)'] | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s021123475', 's056940842', 's181634735', 's204861412', 's279383418', 's281046540', 's700778994', 's565945665'] | [2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0] | [17.0, 18.0, 18.0, 17.0, 18.0, 18.0, 18.0, 18.0] | [27, 46, 49, 48, 29, 59, 51, 29] |
p03315 | u129978636 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ["T = 0\n\nl = 4\n\nfor i in range(l):\n c = input()\n if( c == '+'):\n T += 1\n \n else:\n t -= 1\n \nprint(T)\n\n", "c = list(input())\nT = 0\nl = 4\n\nfor i in range(l):\n if( c[i] == '+'):\n T += 1\n \n else:\n T -= 1\n \nprint(T)"] | ['Runtime Error', 'Accepted'] | ['s522916080', 's565305064'] | [2940.0, 2940.0] | [18.0, 17.0] | [114, 118] |
p03315 | u131264627 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ["s = list(map(str, input().split()))\nans = 0\nfor i in range(4):\n if s[i] == '+':\n ans += 1\n else:\n ans -= 1\nprint(ans)", "s = input()\nprint(s.count('+') - s.count('-'))"] | ['Runtime Error', 'Accepted'] | ['s889172956', 's083637140'] | [2940.0, 2940.0] | [17.0, 17.0] | [137, 46] |
p03315 | u135572611 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ["s = input()\nans = 0\nfor i in range len(s):\n if(s[i] == '+'):\n ans += 1\n\nprint(ans)", 's = input()\nans = 0\n\n', "s = input()\nans = 0\nfor i in range len(s):\n if(s[i] == '+'):\n ans += 1\n else:\n ans -= 1\nprint(ans)", "s = input()\nans = 0\nfor i in range(len(s)):\n if(s[i] == '+'):\n ans += 1\n else:\n ans -= 1\nprint(ans)\n"] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s459917549', 's477495129', 's789768216', 's622582115'] | [2940.0, 2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0, 17.0] | [86, 21, 106, 108] |
p03315 | u137808818 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ['n = input()\ns = n.count(+) - n.count(-)\nprint(s)', "n = input()\ns = n.count('+') - n.count('-')\nprint(s)"] | ['Runtime Error', 'Accepted'] | ['s772883520', 's779458709'] | [2940.0, 2940.0] | [17.0, 17.0] | [48, 52] |
p03315 | u138537142 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ["info = list(map(int, input().split(' ')))\narray = list(map(int, input().split(' ')))\n\nprint((info[0]-1)//(info[1]-1))", "calc = input()\nresult = 0\nfor letter in calc:\n if letter == '+':\n result = result+1\n else:\n result = result-1\nprint(result)"] | ['Runtime Error', 'Accepted'] | ['s547130886', 's281016236'] | [3060.0, 3064.0] | [49.0, 17.0] | [117, 143] |
p03315 | u140480594 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ['S = list(map(str, input().split()))\nans = 0\nfor i in S :\n if i == "+" :\n ans += 1\n else :\n ans -= 1\nprint(ans)', 'S = list(str(input()))\nans = 0\nfor i in S :\n if i == "+" :\n ans += 1\n else :\n ans -= 1\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s269310173', 's163837379'] | [2940.0, 2940.0] | [17.0, 17.0] | [118, 105] |
p03315 | u143492911 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ['s=list(input())\nplus=0\nmainu=0\nfor i in range(4):\n if s[i]=="+":\n plus+=1\n elif s[i]=="-":\n mainu+=1\nprint(mainu+plus)\n', 's=list(input())\nplus=0\nmainu=0\nfor i in range(4):\n if s[i]=="+":\n plus+=1\n elif s[i]=="-":\n mainu-=1\nprint(mainu+plus)\n'] | ['Wrong Answer', 'Accepted'] | ['s919135341', 's521264409'] | [2940.0, 2940.0] | [17.0, 17.0] | [139, 139] |
p03315 | u144847243 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ["input_str = int(input())\nnum = 0\nfor str in input_str:\n if str == '+':\n num += 1\n else:\n num -= 1\nprint(num)", "input_str = input()\nnum = 0\nfor str in input_str:\n if str == '+':\n num += 1\n else:\n num -= 1\nprint(num)"] | ['Runtime Error', 'Accepted'] | ['s316246883', 's884289186'] | [2940.0, 2940.0] | [18.0, 19.0] | [128, 123] |
p03315 | u144980750 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ['a=list(input())\nsum=0\nfor i in range(len(a)):\n sum+=1 if a[i]=="+" else sum-=1\nprint(sum)', 'a=list(input())\nsum=0\nfor i in range(len(a)):\n sum+=1 if a[i]=="+" else sum-1\nprint(sum)', 'a=list(input())\nsum=0\nfor i in range(len(a)):\n sum+=1 if a[i]=="+" else -1\nprint(sum)'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s066663758', 's510973562', 's142745159'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [90, 89, 86] |
p03315 | u144985238 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ['\nS = list(input())\nresult = 0\nfor s in S:\n if s == ‘+’:\n result += 1\n else:\n result -= 1\nprint(result)\n', "S = list(str(input()))\nresult = 0\nfor s in S:\n if s == '+':\n result += 1\n else:\n result -= 1\nprint(result)\n"] | ['Runtime Error', 'Accepted'] | ['s341382387', 's715175971'] | [2940.0, 2940.0] | [17.0, 17.0] | [127, 127] |
p03315 | u148551245 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ["s = input()\nn = 0\nfor o in s:\n if o == '+':\n ans += 1\n else:\n ans -= 1\nprint(ans)", "s = input()\nn = 0\nans = 0\nfor o in s:\n if o == '+':\n ans += 1\n else:\n ans -= 1\nprint(ans)"] | ['Runtime Error', 'Accepted'] | ['s521255636', 's885003195'] | [2940.0, 2940.0] | [17.0, 17.0] | [101, 109] |
p03315 | u151107315 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ['from sys import stdin\n\n\n\nn_s, k_s = stdin.readline().rstrip().split() \na_s_l = stdin.readline().rstrip().split() \n\nN = int(n_s)\nK = int(k_s)\n#A = []\n\nA = list(map(int, a_s_l))\n#AA = A\ncount = 0\nj = K - 1\nfor i, a in enumerate(A):\n if N == K :\n count = count + 1\n break\n elif i > N - K:\n \n count = count + 1\n elif j== i :\n \n count = count + 1\n j = i + K - 1\n \nprint(count)\n', "from sys import stdin\n\na = stdin.readline().rstrip()\na_list = list(a)\n\ncount = 0\nfor i in a_list:\n if i == '+' :\n count = count + 1\n if i == '-' :\n count = count - 1\nprint(count)"] | ['Runtime Error', 'Accepted'] | ['s048698966', 's874612186'] | [3064.0, 2940.0] | [17.0, 17.0] | [749, 198] |
p03315 | u151625340 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ["S = input()\nprint(S.count('+')-S.count'-')\n", "S = input()\nprint(S.count('+')-S.count('-'))\n"] | ['Runtime Error', 'Accepted'] | ['s089856682', 's844638457'] | [2940.0, 2940.0] | [17.0, 17.0] | [43, 45] |
p03315 | u152402277 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ["S = input()\nnum = 0\nfor i in range(len(S))\n\tif S[i] == '+':\n \tnum = num + 1\n else:\n \tnum = num - 1\nprint(num)", "S = input()\nnum = 0\nfor i in range(len(S)):\n if S[i] == '+': num = num + 1\n else : num = num -1\nprint(num)"] | ['Runtime Error', 'Accepted'] | ['s812519109', 's156767491'] | [2940.0, 2940.0] | [17.0, 17.0] | [118, 112] |
p03315 | u159574168 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ['import sys\n\nn = 0\n\nS = sys.argv[1]\n\nfor i in range(len(S)):\n if S[i]=="+": n+=1\n else: n-=1\n\nprint(n)\n\n', 'import sys\n \nn = 0\n\nS = input()\n\nfor i in range(1,5):\n if S[i]=="+": n+=1\n else: n-=1\n \nprint(n)', 'import sys\n \nn = 0\n \nS = sys.argv\n \nfor i in range(len(S)):\n if S[i]=="+": n+=1\n else: n-=1\n \nprint(n)\n', 'import sys\n \nn = 0\n \nS = input()\n\nfor i in range(0,4):\n if S[i]=="+": n+=1\n else: n-=1\n \nprint(n)'] | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s634388916', 's818084512', 's819545377', 's586530252'] | [2940.0, 2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0, 17.0] | [109, 102, 109, 103] |
p03315 | u161537170 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ["S = list(input())\nans = 0\nprint(S)\nfor str in S:\n if str == '+':\n ans = ans +1\n else:\n ans = ans - 1\nprint(ans)\n", "S = input().split()\nans = 0\nfor str in S:\n if str == '+':\n ans = ans +1\n else:\n ans = ans - 1\nprint(ans)\n", "S = list(input())\nans = 0\nfor str in S:\n if str == '+':\n ans = ans +1\n else:\n ans = ans - 1\nprint(ans)\n"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s132571506', 's650909147', 's298462481'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [132, 125, 123] |
p03315 | u166696759 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ['import sys\nN, K = map(int,input().split())\nA = list(map(int, input().split()))\nif N == K:\n print(1)\n sys.exit()\nidx = A.index(1)\nres = 0\nif idx <= K:\n idx = K-1\n res = 1\nelse:\n while(True):\n res += 1\n idx -= K - 1\n if idx <= 0:\n break\nidx = A.index(1)\nif idx <= K:\n idx = K-1\nwhile(True):\n if idx >= N-1:\n break\n res += 1\n idx += K-1\n\nprint(res)\n', "s = input()\nres = 0\nfor letter in s:\n if letter =='+':\n res += 1\n else:\n res -= 1\nprint(res)\n"] | ['Runtime Error', 'Accepted'] | ['s462349022', 's176106094'] | [3064.0, 2940.0] | [17.0, 17.0] | [412, 113] |
p03315 | u186206732 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ['import math\n\nn, k = map(int, input().split())\naas = input()\na = n - k\n\nnum = math.ceil(a / (k-1))\n\nprint(num+1)', 'import math\n\nn, k = map(int, input().split())\n\na = n - k\n\nnum = math.ceil(a / (k-1))\n\nprint(num+1)\n', "s = input()\n\nans = 0\n\nfor i in s:\n\tif i == '+':\n\t\tans += 1\n\telse:\n\t\tans -= 1\n\t\t\n\t\t\nprint(ans)\n"] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s012468217', 's168554620', 's596410927'] | [2940.0, 2940.0, 2940.0] | [18.0, 18.0, 17.0] | [111, 99, 94] |
p03315 | u191449759 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ['S=input()\n\nj=0\nfor i in range(4):\n if S[i]=="+":\n j=j+1\n else\n j=j-1\nprint(j)', ' S=input()\n \n j=0\n for i in range(4):\n if S[i]=="+":\n j=j+1\n else:\n j=j-1\n print(j)', 'S=input()\n\nj=0\nfor i in range(4):\n if S[i]=="+":\n j=j+1\n else:\n j=j-1\nprint(j)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s326311738', 's879829218', 's834470834'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [79, 117, 98] |
p03315 | u197300773 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ['def f(n):\n s=str(n)\n return sum([int(s[i]) for i in range(len(s))])\n\nsunuke=[]\nfor i in range(100):\n for j in range(2,11):\n sunuke.append(j*(10**i)-1)\nL=len(sunuke)\ntmp1,tmp2=sunuke[L-1],f(sunuke[L-1])\nans=[sunuke[L-1]]\nfor i in range(len(sunuke)-2,-1,-1):\n x=sunuke[i]\n if x*tmp2<=tmp1*f(x):\n ans.append(x)\n tmp1,tmp2=x,f(x)\n\nans.sort()\n\n \n\nfor i in range(int(input())):\n print(ans[i])\n', 's=input()\nans=0\nfor i in range(4):\n if s[i]=="+": ans+=1\n else: ans-=1\n\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s898402399', 's620238733'] | [3064.0, 2940.0] | [40.0, 18.0] | [429, 88] |
p03315 | u207464563 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ["S = list(input())\nans = 0\nfor i in S:\n if i == '+':\n ans += 1\n else:\n ans -= 1 S = list(input())\nans = 0\nfor i in S:\n if i == '+':\n ans += 1\n else:\n ans -= 1 \nprint(ans)", "S = list(input())\nans = 0\nfor i in S:\n if i == '+':\n ans += 1\n else:\n ans -= 1 ", "S = list(input())\nans = 0\n\nfor i in S:\n if i == '+':\n ans += 1\n else:\n ans -= 1 \nprint(ans)"] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s042548094', 's190295651', 's858592058'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [209, 99, 111] |
p03315 | u208479266 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ["s = input().split()\nn = int(input())\nn +=s.count('+')\nn -= s.count('-')\nprint(n)\n\n", 'n, c = map(int, input().split())\nprint((n-1)//(c-1))\n', "s = input().split()\nn = int(input())\na +=s.count('+')\nb -= s.count('-')\nprint(n-a-b)\n", "S = input()\nSum =sum(int(i) for i in str(S))\nif int(S) % Sum == 0:\n print('Yes')\nelse:\n print('No')", 'import math\nn, c = map(int, input().split())\n\na = input()\nprint(math.ceil((n-1)//(c-1)))\n', "s = input()\nn, m = s.count('+'), s.count('-')\nprint(n-m)\n"] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s115908069', 's203250557', 's870274307', 's926339008', 's951339702', 's726712547'] | [2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0] | [18.0, 17.0, 17.0, 17.0, 17.0, 17.0] | [83, 53, 86, 105, 89, 58] |
p03315 | u214617707 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ['s = input()\nnum = 0\nif s[0] == "+":\n num += 1\nelse:\n num -= 1\n\nif s[1] == "+":\n num += 1\nelse:\n num -= 1\n\nif s[2] == "+":\n num += 1\nelse:\n num -= 1\n\nif s[3] == "+":\n num += 1\nelse:\n num -= 1\n', 's = input()\nnum = 0\nif s[0] == "+":\n num += 1\nelse:\n num -= 1\n\nif s[1] == "+":\n num += 1\nelse:\n num -= 1\n\nif s[2] == "+":\n num += 1\nelse:\n num -= 1\n\nif s[3] == "+":\n num += 1\nelse:\n num -= 1\n\nprint(num)'] | ['Wrong Answer', 'Accepted'] | ['s004595704', 's854399215'] | [2940.0, 3060.0] | [18.0, 17.0] | [199, 210] |
p03315 | u221345507 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ['S=input()\ncount=0\nfor i in range (len(S)):\n count+=int(S[i])\n \nif int(S)%count==0:\n print ("Yes")\nelse:\n print ("No")', 'S=input()\ncount=0\nfor i in range (len(S)):\n if S[i]=="+":\n count+=1\n else:\n count-=1\nprint(count)'] | ['Runtime Error', 'Accepted'] | ['s369547349', 's119132595'] | [3064.0, 2940.0] | [19.0, 17.0] | [126, 117] |
p03315 | u223646582 | 2,000 | 1,048,576 | There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the integer in his mind decreases by 1. The symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. | ["S = input()\nprint(S.count('+')-s.count('-'))", "S = input()\nprint(S.count('+')-S.count('-'))"] | ['Runtime Error', 'Accepted'] | ['s418690626', 's766280354'] | [2940.0, 2940.0] | [18.0, 17.0] | [44, 44] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.