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
p04001
u890485928
2,000
262,144
You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ...
['s = input()\nn = len(s)\nans = 0\n\nfor i in range(2 ** (n - 1)) :\n k = int(s[0])\n for j in range(n - 1):\n if (i >> j) & 1 :\n ans += k\n print(k , "if")\n k = 0\n k *= 10\n k += int(s[j + 1])\n ans += k\n print(k)\n\nprint(ans)', 's = input()\nn = ...
['Wrong Answer', 'Accepted']
['s998104303', 's955314281']
[3572.0, 3060.0]
[24.0, 20.0]
[281, 240]
p04001
u914992391
2,000
262,144
You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ...
['from sys import stdin\n\ndef main():\n S=input()\n andbit = 2**10 -1\n ans = 0\n length = 2**(len(S) -1)\n \n for i in range (length):\n bitup = andbit & i\n bitcheck = 1\n tmp=0\n for j in range(1,len(S),1):\n if bitup & bitcheck > 0:\n ans += int(S[tmp:j])\n ...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s043319306', 's272707119', 's400862312', 's580931007']
[3064.0, 3064.0, 3064.0, 3064.0]
[19.0, 19.0, 19.0, 20.0]
[438, 699, 438, 326]
p04001
u916069341
2,000
262,144
You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ...
[' total = 0', 's = input()\ntotal = 0\nfor i in range(2 ** len(s)):\n for j in range(len(s)):\n if ((i >> j) & 1):\n total += int(s[j]) \nprint(total)\n', 's = input()\nn = len(s)\n\nans = 0\n\nfor bit in range(1 << (n - 1)):\n f = s[0]\n\n for i in range(n - 1):\n \n if bit...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s165271847', 's387465049', 's647949575']
[2940.0, 2940.0, 3060.0]
[17.0, 21.0, 22.0]
[13, 151, 300]
p04001
u933622697
2,000
262,144
You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ...
["s = input()\n\nanswer = 0\nfor canditate in range(1 << len(s)-1):\n combi = s[0]\n for n_digit in range(len(s) - 1):\n if (canditate >> n_digit) & 1:\n combi += '+'\n combi += s[n_digit+1] \n print(combi)\n answer += eval(combi)\n\nprint(answer)\n", 's = input()\nn = 0\nans = 0\n...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s195044233', 's944885450', 's040533981']
[3060.0, 3060.0, 3060.0]
[28.0, 22.0, 27.0]
[334, 231, 317]
p04001
u951601135
2,000
262,144
You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ...
["\ns=input()\nl=list(s)\nprint(l)\n#lst=[]\nlst_2=0\n\nfor i in range(1<<(len(s)-1)):\n st=l[0]\n for j in range(len(s)-1):\n if (i>>j)&1:\n st+=l[j+1]\n else:\n st+='+'+l[j+1]\n #lst.append(eval(st))\n lst_2+=eval(st)\n #print(lst)\n #print(lst_2)\n#print(sum(lst)...
['Wrong Answer', 'Accepted']
['s260499652', 's137701890']
[3064.0, 3064.0]
[26.0, 29.0]
[842, 833]
p04001
u955251526
2,000
262,144
You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ...
['s = list(input())\nl = len(s)\nt = [0] * l \nk = 2**(l-1)\nfor i in range(l):\n if i == 0:\n t[l-1] = k \n else:\n t[l-1-i] = t[l-i] * 5 + k // 2\nret = 0 \nfor i in range(l):\n top = int(s[i])\n ret += top * t[i]\nprint(t)\nprint(ret)', 's = list(input())\nl = len(s)\nt = [0] * l \nk = 2**(...
['Wrong Answer', 'Accepted']
['s810014028', 's961198474']
[3064.0, 3064.0]
[18.0, 18.0]
[247, 238]
p04001
u956836108
2,000
262,144
You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ...
['# -*- coding: utf-8 -*-\n\ns = int(input())\nn = len(s) - 1\nanswer = 0\nfor i in range(2 ** n):\n operation = [""] * n\n for j in range(n):\n if (i >> j) & 1:\n operation[n - 1 -j] = "+"\n \n formula = ""\n for p_n, p_o in zip(s, operation + [""]):\n formula += (p_n + p_o)\n ...
['Runtime Error', 'Accepted']
['s794484063', 's991445495']
[9188.0, 9072.0]
[24.0, 34.0]
[349, 349]
p04001
u973744316
2,000
262,144
You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ...
['S = int(input())\nN = len(S) - 1\nans = 0\n\nfor i in range(2 ** N):\n k = 0\n for j in range(N):\n \n if (i >> j) & 1:\n ans += int(S[k:j + 1])\n k = j + 1\n ans += int(S[k:])\nprint(ans)\n', 'S = int(input())\nN = len(S) - 1\nans = 0\n\nfor i in range(2 ** N):\n k = 0...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s137324572', 's169286450', 's737892492', 's686768144']
[2940.0, 2940.0, 3060.0, 2940.0]
[17.0, 18.0, 17.0, 19.0]
[230, 213, 230, 227]
p04001
u977193988
2,000
262,144
You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ...
['S=input()\nn=len(S)\nans=0\nfor i in range(1<<(n-1)):\n for j in range(n):\n if 1&(i>>j):\n ans+=int(S[k:j+1])\n k=j+1\n ans+=int(S[k:])\n \nprint(ans)\n\n', 'S=input()\nn=len(S)\nans=0\nfor i in range(1<<(n-1)):\n k=0\n for j in range(n):\n if 1&(i>>j):\n ...
['Runtime Error', 'Accepted']
['s015412630', 's607240142']
[2940.0, 3064.0]
[17.0, 20.0]
[185, 192]
p04001
u984351908
2,000
262,144
You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ...
['def __main__():\n h, w, n = list(map(int, input().split()))\n grid = []\n for i in range(h):\n row = []\n for j in range(w):\n row.append(0)\n grid.append(row)\n for i in range(n):\n ai, bi = list(map(int, input().split()))\n grid[ai - 1][bi - 1] = 1\n \n ...
['Runtime Error', 'Accepted']
['s182175621', 's891015016']
[3184.0, 3064.0]
[23.0, 24.0]
[639, 524]
p04001
u985949234
2,000
262,144
You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ...
["S = str(input())\n\n\n\n\n\nfrom collections import deque\nbcal = []\nque = deque()\nque.append(S[0])\ns = ''.join([S[0],'+'])\nque.append(s)\nwhile len(que)>0:\n a = que.popleft()\n pn = a.count('+')\n if len(a)-pn == len(S):\n if a[-1]=='+':\n b = a.strip(a[-1])\n bcal.append(b...
['Wrong Answer', 'Accepted']
['s399736609', 's125808349']
[3444.0, 3436.0]
[25.0, 24.0]
[1265, 1028]
p04001
u996996256
2,000
262,144
You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ...
["s = input()\ntotal = 0\nfor i in product('01', repeat=len(s)-1):\n buf = s[0]\n for j in range(len(s)-1):\n if i[j] == '1':\n total += int(buf)\n buf = s[j+1]\n else:\n buf += s[j+1]\n total += int(buf)\nprint(total)", "s = input()\ntotal = 0\nfor i in product('...
['Runtime Error', 'Runtime Error', 'Accepted']
['s108343773', 's948450759', 's661821803']
[3060.0, 3060.0, 3060.0]
[18.0, 17.0, 20.0]
[261, 261, 254]
p04005
u010075034
2,000
262,144
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that: * There is at least one red block and at least one blue block. * The union of all red blocks forms a rectangular parallelepiped. * The union of all blue bloc...
["if __name__ == '__main__':\n x, y, z = (int(_) for _ in input().split(' '))\n if x % 2 == 0 or y % 2 == 0 or z % 2 == 0:\n print(0)\n return\n t = max((x, y, z))\n if t == x:\n print(y * z)\n elif t == y:\n print(x * z)\n elif t == z:\n print(x * y)\n", "#!/usr/bin...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s133089835', 's349125909', 's357005931', 's530520046', 's746003662', 's663327884']
[3064.0, 3064.0, 3064.0, 3188.0, 3064.0, 3064.0]
[38.0, 39.0, 37.0, 40.0, 38.0, 39.0]
[292, 222, 294, 218, 319, 313]
p04005
u026788530
2,000
262,144
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that: * There is at least one red block and at least one blue block. * The union of all red blocks forms a rectangular parallelepiped. * The union of all blue bloc...
['a=[int(_) for i in range(n)]\nif a[0]%2==0 or a[1]%2==0 or a[2]%2==0:\n print(0)\nelse:\n a.sort()\n print(a[0]*a[1])', 'a=[int(_) for _ in input().split()]\nif a[0]%2==0 or a[1]%2==0 or a[2]%2==0:\n print(0)\nelse:\n a.sort()\n print(a[0]*a[1])\n']
['Runtime Error', 'Accepted']
['s116251230', 's573859994']
[2940.0, 2940.0]
[18.0, 17.0]
[115, 123]
p04005
u030726788
2,000
262,144
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that: * There is at least one red block and at least one blue block. * The union of all red blocks forms a rectangular parallelepiped. * The union of all blue bloc...
['a,b,c=map(int,input().split())\ndif=10**15\nd=[[0,0,0],[0,0,1],[0,1,0],[0,1,1],[1,0,0],[1,0,1],[1,1,0],[1,1,1]]\nfor i in d:\n r1,r2,r3=a//2+i[0],b//2+i[1],c//2+i[2]\n b1,b2,b3=a-r1,b-r2,c-r3\n dif=min(dif,abs(r1*r2*r3-b1*b2*b3))\nprint(dif)\n', 'a,b,c=map(int,input().split())\ndif=10**15\nr1,r2,r3=a//2,b//2,c//2\...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s508858788', 's845152911', 's142006919']
[3064.0, 3060.0, 2940.0]
[17.0, 17.0, 17.0]
[238, 136, 74]
p04005
u062068953
2,000
262,144
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that: * There is at least one red block and at least one blue block. * The union of all red blocks forms a rectangular parallelepiped. * The union of all blue bloc...
['x=input().split()\ndim=[int(x[0]),int(x[1]),int(x[2])]\nprint(dim)\nif (dim[0]*dim[1]*dim[2])%2==0:\n print(0)\nelse:\n dim.remove(max(dim))\n print(dim[0]*dim[1])\n \n ', 'x=input().split()\ndim=[int(x[0]),int(x[1]),int(x[2])]\nif (dim[0]*dim[1]*dim[2])%2==0:\n print(0)\nelse:\n dim.remove(max(dim))\n print(...
['Wrong Answer', 'Accepted']
['s425090001', 's508345202']
[2940.0, 2940.0]
[19.0, 17.0]
[165, 151]
p04005
u098982053
2,000
262,144
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that: * There is at least one red block and at least one blue block. * The union of all red blocks forms a rectangular parallelepiped. * The union of all blue bloc...
['Cube = [int(i) for i in input().split(" ")]\n\nL = max(Cube)\nA,B = map(int,[i for i in Cube if i!=L])\n\nprint(abs((A*B*(L//2))-(A*B*(L-(L//2)))))', 'Cube = [int(i) for i in input().split(" ")]\n\nL = max(Cube)\nplane = [i for i in Cube if i!=L]\nif len(plane)==0:\n A = L\n B = L\nelif len(plane)==1:\n A = ...
['Runtime Error', 'Accepted']
['s835226544', 's760424209']
[3060.0, 3060.0]
[18.0, 17.0]
[192, 301]
p04005
u227082700
2,000
262,144
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that: * There is at least one red block and at least one blue block. * The union of all red blocks forms a rectangular parallelepiped. * The union of all blue bloc...
['a=list(int,input().split());a.sort();s=a[0]*a[1]\nif (a[2]*s)%2==0:print(0)\nelse:print(s)', 'a=list(map(int,input().split()));a.sort();s=a[0]*a[1]\nif (a[2]*s)%2==0:print(0)\nelse:print(s)\n']
['Runtime Error', 'Accepted']
['s631290542', 's761333565']
[2940.0, 2940.0]
[17.0, 17.0]
[88, 94]
p04005
u239342230
2,000
262,144
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that: * There is at least one red block and at least one blue block. * The union of all red blocks forms a rectangular parallelepiped. * The union of all blue bloc...
['A,B,C=map(int,input().split())\nans = A*B*C/max(A,B,C)\nif ans%2==0:\n print(0)\nelse:\n print(ans)', 'A,B,C=map(int,input().split())\nif any(map(lambda x: x%2==0,[A,B,C])):\n print(0)\nelse:\n print(min(A*B,B*C,C*A))']
['Wrong Answer', 'Accepted']
['s123906240', 's789284499']
[3060.0, 3316.0]
[18.0, 21.0]
[100, 116]
p04005
u276686572
2,000
262,144
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that: * There is at least one red block and at least one blue block. * The union of all red blocks forms a rectangular parallelepiped. * The union of all blue bloc...
['a,b,c = map(int, input().split())\n\nif a % 2 == 0 or b % 2 == 0 or c % 2 == 0: print(0)\nelse:\n square = a*b*c/max(a,b,c)\n print(square)', 'a,b,c = map(int, input().split())\n\nif a % 2 == 0 or b % 2 == 0 or c % 2 == 0: print(0)\nelse:\n square = min(a*b, b*c, a*c)\n print(int(square))\n']
['Wrong Answer', 'Accepted']
['s740747568', 's305195596']
[9148.0, 9088.0]
[25.0, 31.0]
[136, 144]
p04005
u311944296
2,000
262,144
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that: * There is at least one red block and at least one blue block. * The union of all red blocks forms a rectangular parallelepiped. * The union of all blue bloc...
['#include <bits/stdc++.h>\nusing namespace std;\n\ntypedef long long int64;\n\nint64 a, b, c, ans = LLONG_MAX;\n\nvoid calc(int64 a, int64 b, int64 c) {\n\tint64 r = a / 2;\n\n\tfor(int64 i = max(1LL, r - 5); i <= min(r + 5, a - 1); i++) {\n\t\tint64 v1 = i * b * c;\n\t\tint64 v2 = (a - i) * b * c;\n\t\tans = min(ans,...
['Runtime Error', 'Accepted']
['s475049765', 's086862097']
[2940.0, 3064.0]
[17.0, 17.0]
[504, 454]
p04005
u322171361
2,000
262,144
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that: * There is at least one red block and at least one blue block. * The union of all red blocks forms a rectangular parallelepiped. * The union of all blue bloc...
['a,b,c=input().split()\na=int(a)\nb=int(b)\nc=int(c)\na,b,c=[a,b,c].sort()\nprint(a*b)', 'a,b,c=input().split()\na=int(a)\nb=int(b)\nc=int(c)\nabc=sorted([a,b,c])\nif abc[2]%2==0:\n print(0)\nelse:\n print(abc[0]*abc[1])']
['Runtime Error', 'Accepted']
['s506737742', 's071903877']
[2940.0, 3064.0]
[18.0, 17.0]
[80, 128]
p04005
u333139319
2,000
262,144
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that: * There is at least one red block and at least one blue block. * The union of all red blocks forms a rectangular parallelepiped. * The union of all blue bloc...
['[a,b,c] == [int(i) for i in input().split()]\n\nif (a * b * c) % 2 == 0:\n print(0)\nelse:\n print(min(a * b,b * c,c * a))\n', '[a,b,c] = [int(i) for i in input().split()]\n\nif (a * b * c) % 2 == 0:\n print(0)\nelse:\n print(min(a * b,b * c,c * a))\n']
['Runtime Error', 'Accepted']
['s607652352', 's139777857']
[2940.0, 2940.0]
[17.0, 17.0]
[124, 123]
p04005
u366644013
2,000
262,144
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that: * There is at least one red block and at least one blue block. * The union of all red blocks forms a rectangular parallelepiped. * The union of all blue bloc...
['na = lambda: list(map(int, input().split()))\na, b, c = na()\nif a*b*c % 2 == 0:\n print(0)', 'na = lambda: list(map(int, input().split()))\na, b, c = na()\nif a*b*c % 2 == 0:\n print(0)\nelse:\n l = sorted([a, b, c])\n print(l[0] * l[1])']
['Wrong Answer', 'Accepted']
['s581543191', 's976861298']
[2940.0, 2940.0]
[17.0, 17.0]
[91, 146]
p04005
u368563078
2,000
262,144
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that: * There is at least one red block and at least one blue block. * The union of all red blocks forms a rectangular parallelepiped. * The union of all blue bloc...
['A,B,C = map(int,input())\nnum_list = [A,B,C]\n list_s = sorted(num_list)\nif A % 2 == 1 and B % 2 == 1 and C % 2 == 1:\n print(list_s[0]*list_s[1])\nelse:\n print(0)\n\n ', 'A,B,C = map(int,input())\nnum_list = [A,B,C]\nlist_s = sorted(num_list)\nif A % 2 == 1 and B % 2 == 1 and C % 2 == 1:\n print(list_s...
['Runtime Error', 'Runtime Error', 'Accepted']
['s435884578', 's969846267', 's406750675']
[2940.0, 3060.0, 2940.0]
[17.0, 17.0, 17.0]
[171, 164, 175]
p04005
u371467115
2,000
262,144
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that: * There is at least one red block and at least one blue block. * The union of all red blocks forms a rectangular parallelepiped. * The union of all blue bloc...
['l=list(map(int,input().split()))\nl.sort()\nif l[2]%2==0:\n print(l[0]*l[1])\nelse:\n print(0)', 's=list(map(int,input().split()))\nprint(s)\ns.sort()\nif s[0]%2==0:\n print(0)\nelse:\n print(s[1]*s[2])', 'a,b,c=map(int,input().split())\nif c%2==0:\n print(a*b)\nelse:\n print(0)', 'l=list(map(int,input(...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s032995377', 's790345434', 's989216479', 's628129399']
[3060.0, 2940.0, 2940.0, 2940.0]
[19.0, 18.0, 18.0, 18.0]
[91, 104, 75, 92]
p04005
u374802266
2,000
262,144
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that: * There is at least one red block and at least one blue block. * The union of all red blocks forms a rectangular parallelepiped. * The union of all blue bloc...
["a=sorted(list(map(int,input().split())))\nif (a[0]*a[1]*a[2])%2==0:\n print('0')\nelse:\n print(a[0]+a[1])", "a=sorted(list(map(int,input().split())))\nif (a[0]*a[1]*a[2])%2==0:\n print('0')\nelse:\n print(a[0]*a[1])"]
['Wrong Answer', 'Accepted']
['s403377103', 's729607795']
[2940.0, 2940.0]
[17.0, 17.0]
[108, 108]
p04005
u394721319
2,000
262,144
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that: * There is at least one red block and at least one blue block. * The union of all red blocks forms a rectangular parallelepiped. * The union of all blue bloc...
['li = [int(i) for i in input().split()]\n\nfor i in li:\n if i%2 == 0:\n print(0)\n exit()\n\nli.pop(max(li))\nans = 1\nfor i in li:\n ans *= i\n\nprint(ans)\n', 'li = [int(i) for i in input().split()]\n\nfor i in li:\n if i%2 == 0:\n print(0)\n exit()\n\nli.remove(max(li))\nans = ...
['Runtime Error', 'Accepted']
['s190317035', 's392463559']
[3316.0, 3316.0]
[19.0, 18.0]
[165, 168]
p04005
u397953026
2,000
262,144
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that: * There is at least one red block and at least one blue block. * The union of all red blocks forms a rectangular parallelepiped. * The union of all blue bloc...
['a,b,c = map(int,input().split())\nprint(a*b*c/max(a,b,c))', 'a = list(map(int,input().split()))\ncnt = 0\nfor i in range(3):\n if a[i]%2 == 0:\n cnt += 1\nif cnt == 0:\n a.sort()\n print(a[0]*a[1])\nelse:\n print(0)']
['Wrong Answer', 'Accepted']
['s856587284', 's235473871']
[9136.0, 9048.0]
[26.0, 23.0]
[56, 164]
p04005
u436484848
2,000
262,144
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that: * There is at least one red block and at least one blue block. * The union of all red blocks forms a rectangular parallelepiped. * The union of all blue bloc...
["str = input()\nnum = list(map(int,str.split(' ')))\nif !(num[0]%2)*(num[1]%2)*(num[2]):\n\tprint(0)\nelse:\n\tnum.sort()\nprint(num[0]*num[1])\n", "str = input()\nnum = list(map(int,str.split(' ')))\nif (num[0]%2)*(num[1]%2)*(num[2])==1:\n\tnum.sort()\n print(num[0]*num[1])\nelse:\n print(0)\n", "str = ...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s314111636', 's470573294', 's549326872', 's959814121', 's238704324']
[3064.0, 3064.0, 3064.0, 3064.0, 3064.0]
[37.0, 39.0, 37.0, 36.0, 37.0]
[135, 152, 134, 149, 146]
p04005
u459233539
2,000
262,144
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that: * There is at least one red block and at least one blue block. * The union of all red blocks forms a rectangular parallelepiped. * The union of all blue bloc...
['a,b,c=map(int,input().split())\nprint(min(a%*b*c,b%*a*c,c%*a*b))', '\na,b,c=map(int,input().split())\nprint(min((a%)*b*c,a*(b%)*c,a*b*(c%)))', 'a,b,c=map(int,input().split())\nprint(min(a%2*b*c,a*b%2*c,a*b*c%2))', 'a,b,c=map(int,input().split())\nprint(min(a%*b*c,a*b%*c,a*b*c%))', 'a,b,c=map(int,input().split())\npri...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s309691044', 's634536664', 's906590789', 's916052211', 's941557517']
[2940.0, 2940.0, 2940.0, 2940.0, 2940.0]
[18.0, 18.0, 19.0, 18.0, 18.0]
[63, 70, 66, 63, 72]
p04005
u468972478
2,000
262,144
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that: * There is at least one red block and at least one blue block. * The union of all red blocks forms a rectangular parallelepiped. * The union of all blue bloc...
['s = sorted(list(map(int, input().split())))\na = s.pop(-1)\nb,c = a // 2, a - (a//2)\nd = s[0] * a[1]\nprint(abs(d * b - d * c))', 'a, b, c = sorted(list(map(int, input().split())))\nprint(c % 2 * a * b)']
['Runtime Error', 'Accepted']
['s952328387', 's004108821']
[9100.0, 9008.0]
[26.0, 29.0]
[124, 70]
p04005
u497046426
2,000
262,144
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that: * There is at least one red block and at least one blue block. * The union of all red blocks forms a rectangular parallelepiped. * The union of all blue bloc...
['A, B, C = map(int, input().split())\nif A % 2 == 0 or B % 2 == 0 or C % 2 == 0:\n print(0)\nelse:\n min(A*B, B*C, C*A)', 'A, B, C = map(int, input().split())\nif A % 2 == 0 or B % 2 == 0 or C % 2 == 0:\n print(0)\nelse:\n print(min(A*B, B*C, C*A))']
['Wrong Answer', 'Accepted']
['s185079108', 's342766656']
[2940.0, 2940.0]
[17.0, 17.0]
[120, 127]
p04005
u516438812
2,000
262,144
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that: * There is at least one red block and at least one blue block. * The union of all red blocks forms a rectangular parallelepiped. * The union of all blue bloc...
['A,B,C = map(int,input().split())\nif A % 2 == 0 or B % 2 == 0 or C % 2 == 0:\n\tprint(0)\n\treturn\nS = A * B * C\nmi = min(A,min(B,C))\nma = max(A,max(B,C))\nmid = S // ma // mi // 2\nans = ma * mi * mid\nprint(abs(S - ans * 2))', 'A,B,C = map(int,input().split())\nif A % 2 == 0 or B % 2 == 0 or C % 2 == 0:\n\tprint...
['Runtime Error', 'Accepted']
['s112571289', 's189984007']
[3184.0, 3188.0]
[42.0, 44.0]
[218, 227]
p04005
u530850765
2,000
262,144
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that: * There is at least one red block and at least one blue block. * The union of all red blocks forms a rectangular parallelepiped. * The union of all blue bloc...
['a,b,c = (int(x) for x in input())\nans = abs(a*b*(c//2)-a*b*(c-c//2))\nans = min(ans, abs(a*c*(b//2)-a*c*(b-b//2)))\nans = min(ans, abs(b*c*(a//2)-b*c*(a-a//2)))\nprint(ans)', 'a,b,c = (int(x) for x in input().split())\nans = abs(a*b*(c//2)-a*b*(c-c//2))\nans = min(ans, abs(a*c*(b//2)-a*c*(b-b//2)))\nans = min(ans, a...
['Runtime Error', 'Accepted']
['s700164432', 's931298190']
[3316.0, 3064.0]
[42.0, 38.0]
[169, 177]
p04005
u547537397
2,000
262,144
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that: * There is at least one red block and at least one blue block. * The union of all red blocks forms a rectangular parallelepiped. * The union of all blue bloc...
['import sys\ninput = sys.stdin.readline\n \ndef linput(ty=int, cvt=list):\n\treturn cvt(map(ty,input().split()))\n \ndef gcd(a: int, b: int):\n\twhile b: a, b = b, a%b\n\treturn a\n \ndef lcm(a: int, b: int):\n\treturn a * b // gcd(a, b)\n \ndef main():\n\t#n=int(input())', 'import sys\ninput = sys.stdin.readline\n \n...
['Runtime Error', 'Accepted']
['s442961607', 's074867070']
[9044.0, 9104.0]
[30.0, 26.0]
[252, 454]
p04005
u601018334
2,000
262,144
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that: * There is at least one red block and at least one blue block. * The union of all red blocks forms a rectangular parallelepiped. * The union of all blue bloc...
['N, x = list(map(int, input().split()))\na = list(map(int, input().split()))\nmin_index = a.index(min(a))\nindex_list = list(range(min_index,N)) + list(range(min_index))\ncost = a.copy()\nc_count = [0]*N\nfor i in range(1,N):\n if cost[index_list[i]] > (cost[index_list[i-1]]+x):\n cost[index_list[i]] = cost[...
['Runtime Error', 'Accepted']
['s285906466', 's006542192']
[3064.0, 3064.0]
[37.0, 39.0]
[443, 129]
p04005
u623687794
2,000
262,144
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that: * There is at least one red block and at least one blue block. * The union of all red blocks forms a rectangular parallelepiped. * The union of all blue bloc...
['a=list(map(int,input().split()))\na.sort()\nif a%2!=0 and b%2!=0 and c%2!=0:\n print(a[0]*a[1])\nelse:\n print("0")\n', 'a=list(map(int,input().split()))\na.sort()\nif a%2!=0 and b%2!=0 and c%2!=0:\n print(a[0]*a[1])\nelif:\n print("0")', 'a=list(map(int,input().split()))\na.sort()\nif a[0]%2!=0 and a[1]%2!=0 and...
['Runtime Error', 'Runtime Error', 'Accepted']
['s494821604', 's964849111', 's144780007']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[113, 112, 122]
p04005
u627417051
2,000
262,144
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that: * There is at least one red block and at least one blue block. * The union of all red blocks forms a rectangular parallelepiped. * The union of all blue bloc...
['A, B, C = list(map(int, input().split()))\nif A % 2 == 0 or B % 2 == 0 or C % 2 == 0:\n\tprint(0)\nelse:\n\tABC = sort([A, B, C])\n\tprint(ABC[0] * ABC[1])', 'A, B, C = list(map(int, input().split()))\nif A % 2 == 0 or B % 2 == 0 or C % 2 == 0:\n\tprint(0)\nelse:\n\tABC = sorted([A, B, C])\n\tprint(ABC[0] * ABC[1])']
['Runtime Error', 'Accepted']
['s179742963', 's650673938']
[2940.0, 3060.0]
[17.0, 17.0]
[147, 149]
p04005
u663767599
2,000
262,144
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that: * There is at least one red block and at least one blue block. * The union of all red blocks forms a rectangular parallelepiped. * The union of all blue bloc...
['A, B, C = map(int, input().split())\nA, B, C = sorted([A, B, C])\n\nif C % 2 == 0:\n print(0)\nelse:\n d1, d2 = C // 2, (C // 2) + 1\n print(d1, d2)\n e = A * B\n print(abs(d1 - d2) * e)\n', 'A, B, C = map(int, input().split())\nA, B, C = sorted([A, B, C])\n\nif C % 2 == 0:\n print(0)\nelse:\n d1...
['Wrong Answer', 'Accepted']
['s224164472', 's246856705']
[2940.0, 2940.0]
[17.0, 17.0]
[193, 175]
p04005
u693716675
2,000
262,144
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that: * There is at least one red block and at least one blue block. * The union of all red blocks forms a rectangular parallelepiped. * The union of all blue bloc...
['a,b,c = [int(i) for i in input().split()]\nif (a*b*c)%2==0:\n print(0)\nelse:\n ans = a*b\n ans = min(ans, b*c)\n ans = min(aans, c*a)\n print(ans)', 'a,b,c = [int(i) for i in input().split()]\nif (a*b*c)%2==0:\n print(0)\nelse:\n ans = a*b\n ans = min(ans, b*c)\n ans = min(ans, c*a)\n p...
['Runtime Error', 'Accepted']
['s849433957', 's699772651']
[2940.0, 2940.0]
[17.0, 17.0]
[155, 154]
p04005
u746428948
2,000
262,144
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that: * There is at least one red block and at least one blue block. * The union of all red blocks forms a rectangular parallelepiped. * The union of all blue bloc...
['A,B,C = map(int,input().split())\nif A%2==0 or B%2==0 or C==0:\n print(0)\nelse:\n print(A*B*C/max({A,B,C}))', '#include <bits/stdc++.h>\n#define rep(i,n) for(int i=0; i<(n); i++)\n#define rrep(i,n) for(int i=1; i<=(int)(n); i++)\n#define pb push_back\n#define all(v) v.begin(),v.end()\n\n\n\n\nusing namespace std;\...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s967322822', 's993966385', 's660597582']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[106, 702, 109]
p04005
u754022296
2,000
262,144
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that: * There is at least one red block and at least one blue block. * The union of all red blocks forms a rectangular parallelepiped. * The union of all blue bloc...
['a, b, c = map(int, input().split())\nif a%2 and b%2 and c%2:\n l = sorted(a, b, c)\n print(l[0]*l[1])\nelse:\n print(0)', 'a, b, c = map(int, input().split())\nif a%2 and b%2 and c%2:\n l = sorted([a, b, c])\n print(l[0]*l[1])\nelse:\n print(0)']
['Runtime Error', 'Accepted']
['s034724514', 's508185131']
[2940.0, 2940.0]
[17.0, 17.0]
[117, 119]
p04005
u760794812
2,000
262,144
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that: * There is at least one red block and at least one blue block. * The union of all red blocks forms a rectangular parallelepiped. * The union of all blue bloc...
['A,B,C = map(int,input().split())\n\nif (A%2)*(B%2)*(C%2)==0:\n Answer = 0\nelse:\n Answer = A*B*C/max(A,B,C)\n\nprint(Answer)', 'A,B,C = map(int,input().split())\n\nif (A%2)*(B%2)*(C%2)==0:\n Answer = 0\nelse:\n Answer = min(A*B,A*C,B*C)\n\nprint(Answer)']
['Wrong Answer', 'Accepted']
['s883197702', 's435035142']
[2940.0, 2940.0]
[17.0, 17.0]
[120, 120]
p04005
u790301364
2,000
262,144
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that: * There is at least one red block and at least one blue block. * The union of all red blocks forms a rectangular parallelepiped. * The union of all blue bloc...
['def main10():\n buf = int(input(""));\n strbuf = input("");\n strbufs = strbuf.split();\n buf2 = [];\n for i in range(buf):\n buf2.append(int(strbufs[i]));\n if len(buf2) == 1:\n return("YES");\n else:\n ki = 0;\n for i in range(buf):\n if buf2[i] % 2 == 1:\...
['Runtime Error', 'Accepted']
['s170651349', 's408903403']
[3064.0, 3060.0]
[17.0, 17.0]
[462, 335]
p04005
u810288681
2,000
262,144
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that: * There is at least one red block and at least one blue block. * The union of all red blocks forms a rectangular parallelepiped. * The union of all blue bloc...
['l = sorted(list(map((int, input().split()))))\nans = 0\nif l[0]%2!=0 and l[1]%2!=0 and l[2]%2!=0:\n ans += l[0]*l[1]\nprint(ans)', 'l = sorted(list(map(int, input().split())))\nans = 0\nif l[0]%2!=0 and l[1]%2!=0 and l[2]%2!=0:\n ans += l[0]*l[1]\nprint(ans)']
['Runtime Error', 'Accepted']
['s844579471', 's429355588']
[2940.0, 2940.0]
[18.0, 17.0]
[127, 125]
p04005
u824237520
2,000
262,144
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that: * There is at least one red block and at least one blue block. * The union of all red blocks forms a rectangular parallelepiped. * The union of all blue bloc...
['n, x = map(int, input().split())\n\na = list(map(int, input().split()))\n\ntemp = 0\ncheck = 0\nfor i in range(1, n):\n if a[i] <= a[i - 1] + x:\n check = 1\n temp = i\n break\n\nif check == 1:\n a = a[temp:] + a[:temp]\n\ncheck = 1\nfor i in range(1, n):\n if a[i] >= a[i - check] + x:\n...
['Runtime Error', 'Accepted']
['s032473004', 's318551086']
[3064.0, 3316.0]
[17.0, 21.0]
[393, 130]
p04005
u835482198
2,000
262,144
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that: * There is at least one red block and at least one blue block. * The union of all red blocks forms a rectangular parallelepiped. * The union of all blue bloc...
['A = list(sorted(map(int, input().split())))\ntmp = A[-1] // 2\nprint(A[0] * A[1] * (tmp - (A[-1] - tmp)))\n', '\nA = list(sorted(map(int, input().split())))\ntmp = A[-2] // 2\nprint(A[0] * A[1] * (tmp - (A[-1] - tmp)))\n', 'A = list(sorted(map(int, input().split())))\ntmp = A[-1] // 2\nprint(A[0] * A[1] * (A[-1] - 2 ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s050203675', 's489093489', 's187068317']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[104, 105, 99]
p04005
u835924161
2,000
262,144
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that: * There is at least one red block and at least one blue block. * The union of all red blocks forms a rectangular parallelepiped. * The union of all blue bloc...
['a,b,c=map(int,input().split())\nif a%2==0 or b%2==0 or c%2==0:\n print(0)\n exit()\n\nprint(min[a*b,b*c,c*a])', 'a,b,c=map(int,input().split())\nif a%2==0 or b%2==0 or c%2==0:\n print(0)\n exit()\nx=[a*b,b*c,c*a]\nprint(min(x))']
['Runtime Error', 'Accepted']
['s299925517', 's091298419']
[2940.0, 2940.0]
[17.0, 17.0]
[110, 115]
p04005
u837286475
2,000
262,144
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that: * There is at least one red block and at least one blue block. * The union of all red blocks forms a rectangular parallelepiped. * The union of all blue bloc...
['\na,b,c = map(int,input().split())\n\nlst = [a,b,c]\n\ncnt = len(list( filter(lambda x:x%2==0,lst)))\n\nif(0<cnt):\n print(0)\nelse:\n lst.sort()\n\n res = 0\n if(lst[2]%2 == 1): \n res = lst[0]*lst[1]\n else:\n res = 0\n\n prin', '\nN,x = map(int,input().split())\n\nlst = list( map(i...
['Runtime Error', 'Runtime Error', 'Accepted']
['s169478662', 's641423998', 's608894946']
[3064.0, 3188.0, 3064.0]
[38.0, 39.0, 39.0]
[243, 411, 249]
p04005
u866746776
2,000
262,144
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that: * There is at least one red block and at least one blue block. * The union of all red blocks forms a rectangular parallelepiped. * The union of all blue bloc...
['def solve(n, x, a):\n\tcosts = []\n\tcost_min = 0\n\tfor k in range(n):\n\t\tif k == 0:\n\t\t\tcosts = a.copy()\n\t\telse:\n\t\t\tfor i in range(n):\n\t\t\t\tcosts[i] = min(costs[i], a[(i-k)%n])\n\t\tcost_k = sum(costs) + k*x\n\t\tif k == 0:\n\t\t\tcost_min = cost_k\n\t\telse:\n\t\t\tcost_min = min(cost_min, cost_k)\...
['Runtime Error', 'Accepted']
['s044929033', 's486263096']
[3064.0, 3064.0]
[39.0, 37.0]
[430, 105]
p04005
u884982181
2,000
262,144
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that: * There is at least one red block and at least one blue block. * The union of all red blocks forms a rectangular parallelepiped. * The union of all blue bloc...
['a = list(map(int,input().split()))\na.sort()\nfor i in a:\n if a%2 == 0:\n print(0)\n exit()\nprint(a[0]*a[1])', 'a = list(map(int,input().split()))\na.sort()\nfor i in a:\n if i%2 == 0:\n print(0)\n exit()\nprint(a[0]*a[1])']
['Runtime Error', 'Accepted']
['s801701820', 's241628919']
[2940.0, 2940.0]
[18.0, 18.0]
[111, 111]
p04006
u124139453
2,000
262,144
Snuke lives in another world, where slimes are real creatures and kept by some people. Slimes come in N colors. Those colors are conveniently numbered 1 through N. Snuke currently has no slime. His objective is to have slimes of all the colors together. Snuke can perform the following two actions: * Select a color ...
['n, x = map(int, raw_input().split())\na = map(int, raw_input().split())\nans = 0\nb = []\nfor k in range(n):\n if k == 0:\n b = a[:]\n else:\n for i in range(n):\n b[i] = min(a[(i-k)%n],b[i])\n cost = k*x+sum(b)\n if k == 0:\n ans = cost\n else:\n ans = min(ans,co...
['Runtime Error', 'Accepted']
['s231282511', 's420703335']
[3064.0, 3188.0]
[38.0, 1992.0]
[396, 464]
p04006
u163320134
2,000
262,144
Snuke lives in another world, where slimes are real creatures and kept by some people. Slimes come in N colors. Those colors are conveniently numbered 1 through N. Snuke currently has no slime. His objective is to have slimes of all the colors together. Snuke can perform the following two actions: * Select a color ...
['n,x=map(int,input().split())\narr=list(map(int,input().split()))\ncost=[10**10]*n\nans=10**10\nfor i in range(n):\n for j in range(n):\n cost[j]=min(cost[j],arr[j-i])\n print(cost)\n ans=min(ans,x*i+sum(cost))\nprint(ans)', 'n,x=map(int,input().split())\narr=list(map(int,input().split()))\ncost=[10**18]*n\nans=...
['Wrong Answer', 'Accepted']
['s940296284', 's614132575']
[50164.0, 3188.0]
[1995.0, 1614.0]
[218, 204]
p04006
u186838327
2,000
262,144
Snuke lives in another world, where slimes are real creatures and kept by some people. Slimes come in N colors. Those colors are conveniently numbered 1 through N. Snuke currently has no slime. His objective is to have slimes of all the colors together. Snuke can perform the following two actions: * Select a color ...
["def segfunc(x, y):\n return min(x, y)\n\nclass segment_():\n def __init__(self, init_val, n, segfunc):\n self.ide_ele = 10**9+1\n \n self.num = 2**(n-1).bit_length()\n self.seg = [self.ide_ele]*2*self.num\n self.segfunc = segfunc\n # set_val\n for i in range(n):\...
['Runtime Error', 'Accepted']
['s987488288', 's228213269']
[3192.0, 3188.0]
[18.0, 1909.0]
[1789, 313]
p04006
u532966492
2,000
262,144
Snuke lives in another world, where slimes are real creatures and kept by some people. Slimes come in N colors. Those colors are conveniently numbered 1 through N. Snuke currently has no slime. His objective is to have slimes of all the colors together. Snuke can perform the following two actions: * Select a color ...
['from copy import deepcopy as dc\n#n,x=map(int,input().split())\nx=int(input()) #\na=list(map(int,input().split()))\n\nn=len(a) #\na=[[i,i,0] for i in a]\naa=dc(a)\nb=[]\n\nm=0\nwhile(b!=a):\n b=dc(a)\n for _ in range(2):\n for i in range(n):\n j=i-1\n if j==-1:\n j=n-...
['Runtime Error', 'Runtime Error', 'Accepted']
['s403672941', 's651188657', 's748242531']
[3572.0, 3444.0, 37492.0]
[26.0, 22.0, 1529.0]
[625, 603, 420]
p04006
u536113865
2,000
262,144
Snuke lives in another world, where slimes are real creatures and kept by some people. Slimes come in N colors. Those colors are conveniently numbered 1 through N. Snuke currently has no slime. His objective is to have slimes of all the colors together. Snuke can perform the following two actions: * Select a color ...
['f = lambda: list(map(int,input().split()))\n\nn,x = f()\na = f()\nw = 0\nans = 0\nfor k in range(n):\n b = [a[i] + x*(k-i) for i in range(k+1)] + [a[i] + x*(n+k-i) for i in range(k+1,n)]\n print(b)\n m = b.index(min(b))\n ans += a[m]\n if m>k:\n m = n+k-m\n else:\n m = k-m\n print(m...
['Wrong Answer', 'Accepted']
['s253884735', 's953728957']
[59764.0, 35448.0]
[1284.0, 1998.0]
[340, 373]
p04006
u601018334
2,000
262,144
Snuke lives in another world, where slimes are real creatures and kept by some people. Slimes come in N colors. Those colors are conveniently numbered 1 through N. Snuke currently has no slime. His objective is to have slimes of all the colors together. Snuke can perform the following two actions: * Select a color ...
['N, x = list(map(int, input().split()))\na = list(map(int, input().split()))\ns_cost = a\ncost = sum(s_cost)\nfor k in xrange(0,N):\n s_cost = [min(s_cost[x],a[y]) for (x,y) in zip( list(xrange(N)), list(xrange(N-k,N))+list(xrange(N-k)) )]\n cost = min(cost, k*x + sum(s_cost))\n\nprint(cost)\n', 'N, x = list(map...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s029745429', 's755121868', 's906934679', 's628069923']
[3188.0, 3064.0, 3064.0, 3316.0]
[40.0, 38.0, 39.0, 1820.0]
[290, 444, 412, 412]
p04006
u637175065
2,000
262,144
Snuke lives in another world, where slimes are real creatures and kept by some people. Slimes come in N colors. Those colors are conveniently numbered 1 through N. Snuke currently has no slime. His objective is to have slimes of all the colors together. Snuke can perform the following two actions: * Select a color ...
['import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time\n\nsys.setrecursionlimit(10**7)\ninf = 10**9\n\ndef f():\n n,x = list(map(int, input().split()))\n a = list(map(int, input().split()))\n mi = a.index(min(a))\n a = a[mi:] + a[:mi]\n print("a",a)\n r = sum(a)\n ...
['Wrong Answer', 'Accepted']
['s575572454', 's757050753']
[8608.0, 6188.0]
[1758.0, 1750.0]
[526, 509]
p04006
u745087332
2,000
262,144
Snuke lives in another world, where slimes are real creatures and kept by some people. Slimes come in N colors. Those colors are conveniently numbered 1 through N. Snuke currently has no slime. His objective is to have slimes of all the colors together. Snuke can perform the following two actions: * Select a color ...
["# coding:utf-8\n\nINF = float('inf')\n\n\ndef inpl(): return list(map(int, input().split()))\n\n\nN, x = inpl()\nA = inpl()\n\nmin_index = A.index(min(A))\nB = A[min_index:] + A[:min_index]\n\ncost = [B[i] for i in range(N)]\n\nans = INF\nfor magic in range(N):\n for i in range(N):\n if i - magic >= 0:\n ...
['Wrong Answer', 'Accepted']
['s020117677', 's353931119']
[3188.0, 3188.0]
[1235.0, 758.0]
[396, 873]
p04006
u754022296
2,000
262,144
Snuke lives in another world, where slimes are real creatures and kept by some people. Slimes come in N colors. Those colors are conveniently numbered 1 through N. Snuke currently has no slime. His objective is to have slimes of all the colors together. Snuke can perform the following two actions: * Select a color ...
['import numpy as np\nn, x = map(int, input().split())\nA = np.array(input().split()[::-1], dtype=np.int64)\nB = A.copy()\nans = float("inf")\nfor k in range(n):\n print(B)\n t = x*k + B.sum()\n ans = min(ans, t)\n np.minimum(B, np.roll(A, -k-1), out=B)\nprint(ans)', 'import sys\ninput = sys.stdin.readline\n\nimpor...
['Wrong Answer', 'Accepted']
['s518432377', 's702574018']
[14536.0, 12500.0]
[864.0, 185.0]
[257, 357]
p04006
u785578220
2,000
262,144
Snuke lives in another world, where slimes are real creatures and kept by some people. Slimes come in N colors. Those colors are conveniently numbered 1 through N. Snuke currently has no slime. His objective is to have slimes of all the colors together. Snuke can perform the following two actions: * Select a color ...
["import numpy as np\nN, x = map(int, input().split())\na = np.array(map(int, input().split()))\nb = np.copy(a)\nans = float('inf') \nfor i in range(N):\n c = np.roll(a,i)\n b = np.minimum(b,c)\n ans = min(ans, sum(b)+i*x)\nprint(ans)\n", "import numpy as np\nN, x = map(int, input().split())\na = np.array(list...
['Runtime Error', 'Accepted']
['s792290457', 's670748120']
[12500.0, 12508.0]
[163.0, 1439.0]
[233, 239]
p04006
u803848678
2,000
262,144
Snuke lives in another world, where slimes are real creatures and kept by some people. Slimes come in N colors. Those colors are conveniently numbered 1 through N. Snuke currently has no slime. His objective is to have slimes of all the colors together. Snuke can perform the following two actions: * Select a color ...
['n, x = map(int, input().split())\na = list(map(int, input().split()))\n\nDP = a[:]\nans = sum(DP)\nfor i in range(n-1):\n new = [0]*n\n for j in range(n):\n new[i] = min(DP[j], DP[j-1])\n DP=new\n ans = min(ans, sum(DP) + (i+1)*x)\nprint(ans)', 'n, x = map(int, input().split())\na = list(map(int, i...
['Wrong Answer', 'Accepted']
['s090299726', 's553098695']
[3188.0, 3188.0]
[1587.0, 1585.0]
[250, 250]
p04006
u866746776
2,000
262,144
Snuke lives in another world, where slimes are real creatures and kept by some people. Slimes come in N colors. Those colors are conveniently numbered 1 through N. Snuke currently has no slime. His objective is to have slimes of all the colors together. Snuke can perform the following two actions: * Select a color ...
['def solve(n, x, a):\n\tcosts = []\n\tcost_min = 0\n\tfor k in range(n):\n\t\tif k == 0:\n\t\t\tcosts = a.copy()\n\t\telse:\n\t\t\tfor i in range(n):\n\t\t\t\tcosts[i] = min(costs[i], a[(i-k)%n])\n\t\tcost_k = sum(costs) + k*x\n\t\tif k == 0:\n\t\t\tcost_min = cost_k\n\t\telse:\n\t\t\tcost_min = min(cost_min, cost_k)\...
['Wrong Answer', 'Accepted']
['s334293946', 's274025383']
[3188.0, 3188.0]
[2038.0, 1980.0]
[378, 466]
p04006
u884982181
2,000
262,144
Snuke lives in another world, where slimes are real creatures and kept by some people. Slimes come in N colors. Those colors are conveniently numbered 1 through N. Snuke currently has no slime. His objective is to have slimes of all the colors together. Snuke can perform the following two actions: * Select a color ...
['n,x = map(int,input().split())\na = list(map(int,input().split()))\nMIN = sum(a)\nans = MIN\ntori = a + [0]\ntori.pop()\nfor i in range(1,n):\n for j in range(n):\n ido = i+j\n if ido >= n:\n ido-=n\n if tori[j] > a[ido]:\n tori[j] = a[ido]\n ans -= (tori[j] - a[ido])\n MIN = min(ans + i*x,M...
['Wrong Answer', 'Accepted']
['s148853036', 's401154287']
[3188.0, 3188.0]
[1434.0, 1423.0]
[318, 320]
p04006
u996252264
2,000
262,144
Snuke lives in another world, where slimes are real creatures and kept by some people. Slimes come in N colors. Those colors are conveniently numbered 1 through N. Snuke currently has no slime. His objective is to have slimes of all the colors together. Snuke can perform the following two actions: * Select a color ...
['def ri(): return int(input())\ndef rli(): return list(map(int, input().split()))\ndef ris(): return list(input())\ndef pli(): return "".join(list(map(str, ans)))\n\n\nN, x = rli()\na = rli()\n\ncatch_time = 0\nmagic_time = 0\nmi = [2000000000001 for _ in range(N)]\nfor i in range(N):\n for j in range(N):\n ...
['Wrong Answer', 'Accepted']
['s635924654', 's571277164']
[3188.0, 3188.0]
[1186.0, 1662.0]
[467, 366]
p04008
u102461423
1,000
262,144
There are N towns in Snuke Kingdom, conveniently numbered 1 through N. Town 1 is the capital. Each town in the kingdom has a _Teleporter_ , a facility that instantly transports a person to another place. The destination of the Teleporter of town i is town a_i (1≤a_i≤N). It is guaranteed that **one can get to the capit...
['import sys\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10 ** 7)\n\nN,K = map(int,readline().split())\nA = [int(x)-1 for x in readline().split()]\n\ndesc_edge = [set() for _ in range(N)]\nparent = [0] * N\nfor i,x in enumerate(A[1:],1):\n \n desc_edge[x].add(i)\n par...
['Wrong Answer', 'Accepted']
['s969214454', 's014517522']
[60900.0, 60832.0]
[381.0, 538.0]
[662, 1131]
p04008
u316386814
1,000
262,144
There are N towns in Snuke Kingdom, conveniently numbered 1 through N. Town 1 is the capital. Each town in the kingdom has a _Teleporter_ , a facility that instantly transports a person to another place. The destination of the Teleporter of town i is town a_i (1≤a_i≤N). It is guaranteed that **one can get to the capit...
['import sys\nsys.setrecursionlimit(10**7)\nINF = 10 ** 18\nMOD = 10 ** 9 + 7\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\ndef LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]\ndef LF(): return [float(x) for x in sys.stdin.readline().split()]\ndef LS(): return sys.stdin.readline().s...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s147635188', 's226688517', 's652647071']
[142620.0, 143468.0, 142620.0]
[407.0, 596.0, 401.0]
[915, 899, 916]
p04015
u030726788
2,000
262,144
Tak has N cards. On the i-th (1 \leq i \leq N) card is written an integer x_i. He is selecting one or more cards from these N cards, so that the average of the integers written on the selected cards is exactly A. In how many ways can he make his selection?
['n,a=map(int,input().split())\nx=list(map(int,input().split()))\ny=[]\nfor i in x:\n y.append(i-a)\ns=2*n*a\ndp=[[0 for i in range(s+1)] for j in range(n+1)]\ndp[0][n*a]=1\nfor i in range(n):\n for j in range(s+1):\n x=j-y[i]\n if(0<=x and x<=2*n*a):\n dp[i+1][j]=dp[i][j-y[i]]+dp[i][j]\n else:\n d...
['Wrong Answer', 'Accepted']
['s394303281', 's318831038']
[5236.0, 5236.0]
[193.0, 197.0]
[341, 343]
p04015
u036104576
2,000
262,144
Tak has N cards. On the i-th (1 \leq i \leq N) card is written an integer x_i. He is selecting one or more cards from these N cards, so that the average of the integers written on the selected cards is exactly A. In how many ways can he make his selection?
['N, A = map(int, input().split())\nX = list(map(int, input().split()))\nY = [x - A for x in X]\n\ndp = [0] * 5010\ndp[2500] = 1\n\nfor y in Y:\n for i in range(5009, -1, -1):\n if i - y < 0 or i - y >= 5010:\n dp[i] = 0\n else:\n dp[i] += dp[i - y]\nprint(dp[2500] - 1)\n', 'N, A ...
['Wrong Answer', 'Accepted']
['s033181744', 's729466733']
[9228.0, 9228.0]
[96.0, 91.0]
[295, 350]
p04015
u077291787
2,000
262,144
Tak has N cards. On the i-th (1 \leq i \leq N) card is written an integer x_i. He is selecting one or more cards from these N cards, so that the average of the integers written on the selected cards is exactly A. In how many ways can he make his selection?
['\nfrom collections import defaultdict\n\n\ndef main():\n N, A = tuple(map(int, input().split()))\n X = tuple(map(int, input().split()))\n Y = [i - A for i in X]\n D = defaultdict(int)\n D[0] = 1\n for i in Y:\n for j, k in D.items():\n D[i + j] += k\n print(D[0] - 1)\n\n\nif __n...
['Runtime Error', 'Accepted']
['s389238729', 's637917723']
[3316.0, 3572.0]
[21.0, 30.0]
[392, 389]
p04015
u310678820
2,000
262,144
Tak has N cards. On the i-th (1 \leq i \leq N) card is written an integer x_i. He is selecting one or more cards from these N cards, so that the average of the integers written on the selected cards is exactly A. In how many ways can he make his selection?
['def dp(k, value):\n if k==n:\n if value==0:\n return 1\n else:\n return 0\n if memo[k][value]>=0:\n return memo[k][value]\n memo[k][value]=dp(k+1, value+x[k])+dp(k+1, value)\n return memo[k][value]\nprint(dp(0, 0)-1)', 'n, a =map(int, input().split())\nx=list(map...
['Runtime Error', 'Runtime Error', 'Accepted']
['s228798421', 's636476171', 's671612523']
[3060.0, 3764.0, 6004.0]
[17.0, 48.0, 36.0]
[261, 416, 382]
p04015
u316386814
2,000
262,144
Tak has N cards. On the i-th (1 \leq i \leq N) card is written an integer x_i. He is selecting one or more cards from these N cards, so that the average of the integers written on the selected cards is exactly A. In how many ways can he make his selection?
['import bisect\nfrom collections import Counter, deque\nfrom itertools import combinations, accumulate\nfrom math import factorial\nfrom operator import neg\nn, a = list(map(int, input().split()))\nxs = list(map(lambda x: int(x) - a, input().split()))\n\nxs.sort()\nl, r = bisect.bisect_left(xs, 0), bisect.bisect_right...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s480492392', 's713373970', 's756096525']
[3444.0, 3436.0, 3564.0]
[24.0, 2104.0, 104.0]
[676, 1134, 696]
p04015
u368780724
2,000
262,144
Tak has N cards. On the i-th (1 \leq i \leq N) card is written an integer x_i. He is selecting one or more cards from these N cards, so that the average of the integers written on the selected cards is exactly A. In how many ways can he make his selection?
['def inpl(): return [int(i) for i in input().split()]\ndef hmd(a, b):\n ctr = -1\n while H[ctr+1][a] < b:\n ctr += 1\n vn = H[ctr][a]\n if (vn == b and ctr == 0) or ctr == -1:\n return 1\n return 2**ctr + hmd(vn,b)\nN = int(input())\nx = inpl() + [10**10]\nL = int(input())\nH = []\nG = [N-...
['Runtime Error', 'Accepted']
['s113674820', 's690952107']
[3064.0, 3572.0]
[18.0, 26.0]
[611, 261]
p04015
u371467115
2,000
262,144
Tak has N cards. On the i-th (1 \leq i \leq N) card is written an integer x_i. He is selecting one or more cards from these N cards, so that the average of the integers written on the selected cards is exactly A. In how many ways can he make his selection?
['n,a=map(int, input().split())\nx=list(map(int, input().split()))\nx=[i-a for i in x]\nd={0:0}\nfor i in x:\n for j,k in list(d.items()):\n d[i+j]=d.get(i+j,0)+k\nprint(d[0])\n#sample code.\n', 'n,a=map(int, input().split())\nx=list(map(int, input().split()))\nx=[i-a for i in x]\nd={0:1}\nfor i in x:\n fo...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s181971142', 's516427249', 's646059849', 's878365424', 's017523312']
[3188.0, 2940.0, 3188.0, 3188.0, 3188.0]
[25.0, 18.0, 26.0, 26.0, 27.0]
[191, 192, 192, 193, 192]
p04015
u379305729
2,000
262,144
Tak has N cards. On the i-th (1 \leq i \leq N) card is written an integer x_i. He is selecting one or more cards from these N cards, so that the average of the integers written on the selected cards is exactly A. In how many ways can he make his selection?
['\nline1=input().split()\nn=int(line1[0])\na=int(line1[1])\nnums=input().split()\nfor i in range(n):\n nums[i]=int(nums[i])-a\n\nworks={}\n\nprint (works)\ns=0\nfor x in nums:\n\n if x>=0:\n for i in range(50*n,-50*n, -1):\n try:\n works[i]+=works[i-x]\n except:\n ...
['Runtime Error', 'Accepted']
['s256184376', 's792001434']
[3316.0, 3188.0]
[333.0, 335.0]
[655, 668]
p04015
u520158330
2,000
262,144
Tak has N cards. On the i-th (1 \leq i \leq N) card is written an integer x_i. He is selecting one or more cards from these N cards, so that the average of the integers written on the selected cards is exactly A. In how many ways can he make his selection?
['N,A = map(int,input().split())\nX = list(map(lambda x:int(x)-A,input().split()))\n\nMX = max(X+[0])\n\ndp = [[0 for i in range(2*MX*N+1)] for _ in range(N+1)]\n\nfor i in range(N+1):\n for t in range(2*MX*N+1):\n if i==0 and t==N*MX:\n dp[i][t] = 1\n elif i>=1:\n if t-X[i-1]>=0 ...
['Wrong Answer', 'Accepted']
['s545707149', 's964701873']
[7560.0, 5108.0]
[229.0, 227.0]
[543, 1321]
p04015
u630941334
2,000
262,144
Tak has N cards. On the i-th (1 \leq i \leq N) card is written an integer x_i. He is selecting one or more cards from these N cards, so that the average of the integers written on the selected cards is exactly A. In how many ways can he make his selection?
["def main():\n N, A = map(int, input().split())\n x = [0].extend(list(map(int, input().split())))\n\n dp = [[[0 for _ in range(N * A + 1)] for _ in range(N + 1)] for _ in range(N + 1)]\n for i in range(N + 1):\n dp[i][0][0] = 1\n\n for i in range(1, N + 1):\n for j in range(1, i + 1):\n ...
['Runtime Error', 'Accepted']
['s508712326', 's367732158']
[56436.0, 54088.0]
[332.0, 1169.0]
[657, 651]
p04015
u649373416
2,000
262,144
Tak has N cards. On the i-th (1 \leq i \leq N) card is written an integer x_i. He is selecting one or more cards from these N cards, so that the average of the integers written on the selected cards is exactly A. In how many ways can he make his selection?
['import numpy as np\nhi = np.zeros((5000,60),np.int64)\nhi[0,0]=1\nn,a = [int(it) for it in input().split()]\nli = [int(it) for it in input().split()]\nfor i in li:\n \u3000hi_ = hi.copy()\n hi[i:-1,1:]+=hi_[:-1-i,:-1]\ns = 0\nfor i in range(n):\n s+=hi[(i+1)*a,i+1]\nprint (s)\n', 'import numpy as np\nhi = np.zer...
['Runtime Error', 'Accepted']
['s852695538', 's062304317']
[2940.0, 19580.0]
[17.0, 209.0]
[268, 267]
p04015
u663710122
2,000
262,144
Tak has N cards. On the i-th (1 \leq i \leq N) card is written an integer x_i. He is selecting one or more cards from these N cards, so that the average of the integers written on the selected cards is exactly A. In how many ways can he make his selection?
['import numpy as np\n\nN, A = map(int, input().split())\nX = [0] + list(map(int, input().split()))\nNX = N * max(X + [A])\n\ndp = np.zeros((N + 1, N + 1, NX + 1))\n\ndp[0][0][0] = 1\n\nfor j in range(N + 1):\n for k in range(N + 1):\n for s in range(NX + 1):\n if j >= 1 and s < X[j]:\n ...
['Wrong Answer', 'Accepted']
['s476650893', 's592774623']
[20644.0, 14436.0]
[2109.0, 563.0]
[538, 414]
p04015
u670180528
2,000
262,144
Tak has N cards. On the i-th (1 \leq i \leq N) card is written an integer x_i. He is selecting one or more cards from these N cards, so that the average of the integers written on the selected cards is exactly A. In how many ways can he make his selection?
['n,a,*x=map(int,open(0).read().split());dp={0:1}\nfor i in x:\n\tfor k,v in dp.items():\n\t\tdp[i+k-a]=dp.get(i+k-a,0)+v\nprint(dp[0]-1)', 'def main():\n\tn,a=map(int,input().split())\n\ty=[a-int(x) for x in input().split()]\n\tdp={0:1}\n\tfor i in y:\n\t\tfor k,v in list(dp.items()):\n\t\t\tdp[i+k]=dp.get(i+k,0)+v\n\...
['Runtime Error', 'Accepted']
['s612730428', 's528462157']
[2940.0, 3188.0]
[17.0, 23.0]
[128, 210]
p04015
u708255304
2,000
262,144
Tak has N cards. On the i-th (1 \leq i \leq N) card is written an integer x_i. He is selecting one or more cards from these N cards, so that the average of the integers written on the selected cards is exactly A. In how many ways can he make his selection?
['N, A = map(int, input().split()) \nX = tuple(map(int, input().split())) \n\ndp = [[[0]*(50*N+1) for _ in range(N+1)] for _ in range(N+1)]\n\ndp[0][0][0] = 1 \n\nfor i in range(N):\n for j in range(N+1):\n for s in range(50*N+1):\n if s >= X[i]: \n dp[i+1][j+1][s] += dp[i][j][s-...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s005065942', 's312225897', 's336919677', 's400549696']
[54004.0, 54004.0, 56052.0, 62952.0]
[234.0, 223.0, 2107.0, 1250.0]
[726, 754, 892, 760]
p04015
u768496010
2,000
262,144
Tak has N cards. On the i-th (1 \leq i \leq N) card is written an integer x_i. He is selecting one or more cards from these N cards, so that the average of the integers written on the selected cards is exactly A. In how many ways can he make his selection?
["n, a = map(int, input().split())\nxlist = list(map(int, input().split()))\n\nj = n\nk = n\nt = n * a\nmaxv = max(xlist)\n\n\ndp = [[[0 for t in range(t + 1)] for k in range(k + 1)] for j in range(j + 1)]\n\ndp[1][0][0] = 1\ndp[0][0][0] = 1\n\n\n# print(d)\n# print(dp[1][1][15])\n\nfor ji in range(0, j + 1):\n ...
['Runtime Error', 'Accepted']
['s357837859', 's113002331']
[56564.0, 65392.0]
[1212.0, 1326.0]
[991, 1004]
p04015
u859897687
2,000
262,144
Tak has N cards. On the i-th (1 \leq i \leq N) card is written an integer x_i. He is selecting one or more cards from these N cards, so that the average of the integers written on the selected cards is exactly A. In how many ways can he make his selection?
['n,a=map(int,input().split())\nm=list(map(lambda x:int(x)-a,input().split()))\nx=max(abs(max(m)),abs(min(m)))*n\ndp=[[0for _ in range(2*x+1)]for i in range(n)]\ndp[0][0+x]=1\ndp[0][m[0]+x]=1\nfor i in range(1,n):\n y=m[i]\n for j in range(x):\n dp[i][j+y]+=dp[i-1][j]\n dp[i][j]+=dp[i-1][j]\nprint(dp[n-1][0]-1)...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s165210306', 's293683429', 's473981187', 's902232635', 's334761398']
[5236.0, 5108.0, 5108.0, 5236.0, 5228.0]
[98.0, 48.0, 101.0, 89.0, 212.0]
[307, 357, 320, 309, 371]
p04015
u862517767
2,000
262,144
Tak has N cards. On the i-th (1 \leq i \leq N) card is written an integer x_i. He is selecting one or more cards from these N cards, so that the average of the integers written on the selected cards is exactly A. In how many ways can he make his selection?
['n,a=map(int,input().split())\nx=[0]+[i-a for i in map(int,input().split())]\nd={}\ndef f(i):\n if i==n+1:\n return c([0])\n if i in d:\n return d[i]\n d[i]={}\n for j in range(i+1,n+2):\n for k,v in f(j).items():\n d[i].setdefault(x[i]+k,0)\n d[i][x[i]+k]+=v\n ...
['Runtime Error', 'Accepted']
['s776358735', 's760227829']
[3136.0, 5236.0]
[44.0, 297.0]
[334, 333]
p04015
u977193988
2,000
262,144
Tak has N cards. On the i-th (1 \leq i \leq N) card is written an integer x_i. He is selecting one or more cards from these N cards, so that the average of the integers written on the selected cards is exactly A. In how many ways can he make his selection?
['n,a=map(int,input().split())\nX=[int(i)-a for i in input().split()]\n\nmemo={0:1}\nfor x in X:\n for k,v in list(memo.items()):\n memo[x+k]=memo.get(x+k,0)+v\n print(memo)\nprint(memo[0]-1)\n', 'n,a=map(int,input().split())\nX=[int(i)-a for i in input().split()]\n\nmemo={0:1}\nfor x in X:\n for k,...
['Runtime Error', 'Accepted']
['s558740126', 's976200394']
[134260.0, 3188.0]
[1764.0, 26.0]
[199, 180]
p04016
u052499405
2,000
262,144
For integers b (b \geq 2) and n (n \geq 1), let the function f(b,n) be defined as follows: * f(b,n) = n, when n < b * f(b,n) = f(b,\,{\rm floor}(n / b)) + (n \ {\rm mod} \ b), when n \geq b Here, {\rm floor}(n / b) denotes the largest integer not exceeding n / b, and n \ {\rm mod} \ b denotes the remainder of n d...
['n = int(input())\ns = int(input())\n\ndef f(b, n):\n val = 0\n while n > 0:\n val += n % b\n n //= b\n return val\n\nif s == n:\n print(n+1)\n exit()\nif s == 1:\n print(n)\n exit()\nfor i in range(1, int(n**0.5) + 10):\n if(f(i, n) == s):\n print(i)\n exit()\nans =...
['Wrong Answer', 'Accepted']
['s712488568', 's902336207']
[3064.0, 3188.0]
[2104.0, 475.0]
[480, 460]
p04016
u677523557
2,000
262,144
For integers b (b \geq 2) and n (n \geq 1), let the function f(b,n) be defined as follows: * f(b,n) = n, when n < b * f(b,n) = f(b,\,{\rm floor}(n / b)) + (n \ {\rm mod} \ b), when n \geq b Here, {\rm floor}(n / b) denotes the largest integer not exceeding n / b, and n \ {\rm mod} \ b denotes the remainder of n d...
['import math\n\nN = int(input())\nS = int(input())\nL = N-S\n\ndef search(b, n=N):\n ans = 0\n while n >= b:\n ans += n%b\n n //= b\n ans += n\n return ans\ns\nif L < 0:\n print(-1)\nelif L == 0:\n print(1)\nelse:\n P = []\n for l in range(1, int(math.sqrt(L))+1):\n if L%l ...
['Runtime Error', 'Accepted']
['s449177735', 's229353393']
[3064.0, 3188.0]
[17.0, 52.0]
[497, 655]
p04016
u794543767
2,000
262,144
For integers b (b \geq 2) and n (n \geq 1), let the function f(b,n) be defined as follows: * f(b,n) = n, when n < b * f(b,n) = f(b,\,{\rm floor}(n / b)) + (n \ {\rm mod} \ b), when n \geq b Here, {\rm floor}(n / b) denotes the largest integer not exceeding n / b, and n \ {\rm mod} \ b denotes the remainder of n d...
['import itertools\nimport math \n\nn,s = [int(input()) for _ in range(2)]\n\ndef calc_s(b,n):\n i = 0\n s = 0\n while(1):\n s+= n %b\n n = math.floor(n/b)\n i+=1\n if n ==0:\n break\n return s\n\ndef search_p(n,s):\n for p in range(1,math.ceil(math.sqrt(n))+1):\n ...
['Wrong Answer', 'Accepted']
['s528850028', 's302137641']
[3064.0, 3188.0]
[384.0, 549.0]
[614, 829]
p04016
u803848678
2,000
262,144
For integers b (b \geq 2) and n (n \geq 1), let the function f(b,n) be defined as follows: * f(b,n) = n, when n < b * f(b,n) = f(b,\,{\rm floor}(n / b)) + (n \ {\rm mod} \ b), when n \geq b Here, {\rm floor}(n / b) denotes the largest integer not exceeding n / b, and n \ {\rm mod} \ b denotes the remainder of n d...
['n = int(input())\ns = int(input())\n\nans = []\nfor i in range(2, n):\n use_n = n\n tmp_ans = 0\n if i*i > n:\n break\n while use_n:\n tmp_ans += use_n%i\n use_n //= i\n if tmp_ans == s:\n print("a")\n print(i)\n exit()\n \nfor p in range(2, n):\n if p*p ...
['Wrong Answer', 'Accepted']
['s828438870', 's094496904']
[3188.0, 3188.0]
[423.0, 518.0]
[496, 641]
p04016
u879309973
2,000
262,144
For integers b (b \geq 2) and n (n \geq 1), let the function f(b,n) be defined as follows: * f(b,n) = n, when n < b * f(b,n) = f(b,\,{\rm floor}(n / b)) + (n \ {\rm mod} \ b), when n \geq b Here, {\rm floor}(n / b) denotes the largest integer not exceeding n / b, and n \ {\rm mod} \ b denotes the remainder of n d...
['import numpy as np\ndef f(b, n):\n s = 0\n while n > 0:\n s += n % b\n n //= b\n return s\n\nINF = int("inf")\ndef solve(n, s):\n if n < s:\n return -1\n if n == s:\n return n+1\n m = int(np.sqrt(n)) + 1\n for b in range(2, m+1):\n if f(b, n) == s:\n ...
['Runtime Error', 'Accepted']
['s132432149', 's403949548']
[12508.0, 14404.0]
[150.0, 561.0]
[611, 538]
p04016
u922901775
2,000
262,144
For integers b (b \geq 2) and n (n \geq 1), let the function f(b,n) be defined as follows: * f(b,n) = n, when n < b * f(b,n) = f(b,\,{\rm floor}(n / b)) + (n \ {\rm mod} \ b), when n \geq b Here, {\rm floor}(n / b) denotes the largest integer not exceeding n / b, and n \ {\rm mod} \ b denotes the remainder of n d...
["#!/usr/bin/env python3\nimport sys\n\n\ndef f(n, b):\n if n < b:\n return n\n else:\n return n // b + f(n % b, b)\n\n\ndef solve(n: int, s: int):\n if s > n:\n return -1\n\n if s == n:\n return n+1\n\n b = 2\n while b * b <= n:\n if f(n, b) == s:\n retur...
['Wrong Answer', 'Accepted']
['s138989975', 's866376771']
[3064.0, 3064.0]
[225.0, 280.0]
[969, 969]
p04017
u218843509
3,000
262,144
N hotels are located on a straight line. The coordinate of the i-th hotel (1 \leq i \leq N) is x_i. Tak the traveler has the following two personal principles: * He never travels a distance of more than L in a single day. * He never sleeps in the open. That is, he must stay at a hotel at the end of a day. You ar...
['from bisect import bisect, bisect_left\nimport sys\n\nn = int(input())\nx = list(map(int, input().split()))\nl = int(input())\n\ndef search_1(start):\n\treturn bisect(x, x[start] + l) - 1\n\nroute = [[] for _ in range(n)]\n\ni = 0 \nfor i in range(n - 1):\n\tif route[i] == []:\n\t\tj = search_1(i) \n\t\tnum = 1 \n\t\...
['Runtime Error', 'Accepted']
['s749318649', 's652340677']
[1874532.0, 78940.0]
[3287.0, 1603.0]
[1114, 641]
p04017
u340781749
3,000
262,144
N hotels are located on a straight line. The coordinate of the i-th hotel (1 \leq i \leq N) is x_i. Tak the traveler has the following two personal principles: * He never travels a distance of more than L in a single day. * He never sleeps in the open. That is, he must stay at a hotel at the end of a day. You ar...
['import sys\nfrom bisect import bisect\n\nn = int(input())\nxxx = list(map(int, input().split()))\nl = int(input())\n\nreachable = [[bisect(xxx, x + l) - 1 for x in xxx]]\nwhile reachable[-1][0] < n - 1:\n rp = reachable[-1]\n reachable.append([rp[rp[i]] for i in range(n)])\n\nq = int(input())\nbuf = []\nfor lin...
['Wrong Answer', 'Accepted']
['s117552294', 's385766026']
[31276.0, 35304.0]
[1093.0, 958.0]
[638, 665]
p04017
u467736898
3,000
262,144
N hotels are located on a straight line. The coordinate of the i-th hotel (1 \leq i \leq N) is x_i. Tak the traveler has the following two personal principles: * He never travels a distance of more than L in a single day. * He never sleeps in the open. That is, he must stay at a hotel at the end of a day. You ar...
['N = int(input())\nX = list(map(int, input().split()))\nL = int(input())\nQ = int(input())\n\nV = [0]*N\nib = 0\nfor i in range(N):\n while X[i]-X[ib] > L:\n V[ib] = i-1\n ib += 1\nwhile ib!=N-1:\n V[ib]=N-1\n ib += 1\nS = [0]*N\nh=N-1\ncnt = 1\nfor i in range(N-2, -1, -1):\n if h==V[i]:\n ...
['Wrong Answer', 'Accepted']
['s207818005', 's856885911']
[15588.0, 26412.0]
[1044.0, 2536.0]
[488, 841]
p04017
u543954314
3,000
262,144
N hotels are located on a straight line. The coordinate of the i-th hotel (1 \leq i \leq N) is x_i. Tak the traveler has the following two personal principles: * He never travels a distance of more than L in a single day. * He never sleeps in the open. That is, he must stay at a hotel at the end of a day. You ar...
['n = int(input())\nhot = list(map(int,input().split())) \nn_ = n.bit_length()\ndb = [[n-1]*(n)]\nL = int(input())\nr = 1\nfor i in range(n-1):\n while r < n-1 and hot[r+1]-hot[i] <= L:\n r += 1\n db[0][i] = r\nfor j in range(1,n_+1):\n new = [db[-1][db[-1][i]] for i in range(n)]\n db.append(new)\n if new[0] ==...
['Wrong Answer', 'Accepted']
['s696295608', 's315075770']
[39340.0, 24988.0]
[2045.0, 1870.0]
[653, 626]
p04017
u729133443
3,000
262,144
N hotels are located on a straight line. The coordinate of the i-th hotel (1 \leq i \leq N) is x_i. Tak the traveler has the following two personal principles: * He never travels a distance of more than L in a single day. * He never sleeps in the open. That is, he must stay at a hotel at the end of a day. You ar...
['from math import*\nfrom bisect import*\nn,*t=map(int,open(0).read().split())\nm=int(log2(n))+1\nx=t[:n]\nl=t[n]\nd=[[bisect(x,y+l)-1for y in x]]+[[0]*n for _ in range(m)]\nfor i in range(m):\n for j in range(n):\n d[i+1][j]=d[i][d[i][j]]\nprint(d)\nfor a,b in zip(t[n+2::2],t[n+3::2]):\n a-=1\n b-=1\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s341707865', 's912778606', 's510547435']
[73248.0, 35948.0, 37228.0]
[1740.0, 447.0, 1510.0]
[435, 261, 426]
p04018
u102461423
2,000
262,144
Let x be a string of length at least 1. We will call x a _good_ string, if for any string y and any integer k (k \geq 2), the string obtained by concatenating k copies of y is different from x. For example, `a`, `bbc` and `cdcdc` are good strings, while `aa`, `bbbb` and `cdcdcd` are not. Let w be a string of length at...
['import sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\nW = list(map(int,read().rstrip()))\n\nN = len(W)\n\ndef Z_Algorithm(S):\n \n N=len(S)\n arr = [0]*N\n arr[0] = N\n i,j = 1,0\n while i<N:\n while i+j<N and S[j]==S[i+j]:\n...
['Wrong Answer', 'Accepted']
['s817931153', 's639820269']
[27332.0, 31588.0]
[361.0, 741.0]
[582, 1123]
p04018
u378667182
2,000
262,144
Let x be a string of length at least 1. We will call x a _good_ string, if for any string y and any integer k (k \geq 2), the string obtained by concatenating k copies of y is different from x. For example, `a`, `bbc` and `cdcdc` are good strings, while `aa`, `bbbb` and `cdcdcd` are not. Let w be a string of length at...
["w=list(input())\nn=len(w)\nper=-1\ndef Z(s):\n m=len(s);z=[0]*m;c=0;f=[1]*m;\n for i in range(1,m):\n if i+z[i-c]<c+z[c]:z[i]=z[i-c]\n else:\n j=max(0,c+z[c]-i)\n while i+j<n and s[j]==s[i+j]:j=j+1\n z[i]=j;c=i\n for p in range(1,m):\n for k in range(2,z[...
['Runtime Error', 'Accepted']
['s264726530', 's635695473']
[26500.0, 26500.0]
[1514.0, 1616.0]
[611, 610]
p04019
u024782094
2,000
262,144
Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th le...
['s=input()\nn=s.count("N")\nw=s.count("W")\ns=s.count("S")\ne=s.count("E")\nns=n+s\nwe=w+e\nif n>0 and w>0 and s>0 and e>0:\n print("Yes")\nelif n>0 and w>0 and we==0:\n print("Yes")\nelif ns==0 and s>0 and e>0:\n print("Yes")\nelse print("No")', 'i=set(input())\nif i=={"E","N","S","W"} or i=={"N","S"} or i=={"E","...
['Runtime Error', 'Accepted']
['s830266921', 's934300668']
[3064.0, 2940.0]
[18.0, 18.0]
[233, 110]