node_ids listlengths 4 1.4k | edge_index listlengths 1 2.22k | text listlengths 4 1.4k | source stringlengths 14 427k |
|---|---|---|---|
[
7,
12,
13,
15,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
12,
2,
4,
13,
13,
13,
23,
4,
18,
4,
13,
13,
0,
13,
4,
18,
13,
13,
13,
0,
13,
18,
13,
13,
0,
13,
2,
13,
2,
13,
4,
18,
13,
13,
... | [
[
7,
6
],
[
7,
15
],
[
18,
17
],
[
15,
27
],
[
36,
35
],
[
17,
40
],
[
43,
42
],
[
48,
47
],
[
6,
49
],
[
15,
51
],
[
35,
56
],
[
17,
56
],
[
59,
58
],
[
6,... | [
"def abc044_c():\n import numpy as np\n n, a = map(int, input().split())\n x = list(map(lambda x: int(x) - a, input().split())) # 平均ターゲット値を引いておく\n x = np.array(x, dtype=np.int64)\n\n vrange = n * (a + np.max(x)) # 取りうる値の幅(片側), 広めにとってもかまわない\n dp = np.zeros((n+1, 2*vrange+1), dtype=np.int64) # DP... | def abc044_c():
import numpy as np
n, a = map(int, input().split())
x = list(map(lambda x: int(x) - a, input().split())) # 平均ターゲット値を引いておく
x = np.array(x, dtype=np.int64)
vrange = n * (a + np.max(x)) # 取りうる値の幅(片側), 広めにとってもかまわない
dp = np.zeros((n+1, 2*vrange+1), dtype=np.int64) # DPテーブル
dp[... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
28,
13,
4,
13,
13,
0,
18,
13,
13,
13,
0,
13,
2,
39,
17,
2,
2,
2,
17,
13,
17,
17,
0,
18,
13,
17,
17,
28,
13,
4,
13,
13,
... | [
[
106,
2
],
[
106,
11
],
[
100,
13
],
[
26,
25
],
[
104,
28
],
[
33,
30
],
[
101,
31
],
[
25,
32
],
[
107,
33
],
[
109,
35
],
[
104,
43
],
[
50,
47
],
[
110,
48
]... | [
"n, a = map(int, input().split())\nx = list(map(int, input().split()))\n\nfor i in range(n):\n x[i] -= a\n\ndp = [0] * (2 * n * 50 + 2)\ndp[0] = 1\n\nfor i in range(n):\n h = dp[:]\n for j in range(-(n - 1) * 50, (n - 1) * 50 + 1):\n h[j] += dp[j - x[i]]\n dp = h\n\nprint(dp[0] - 1)",
"n, a = m... | n, a = map(int, input().split())
x = list(map(int, input().split()))
for i in range(n):
x[i] -= a
dp = [0] * (2 * n * 50 + 2)
dp[0] = 1
for i in range(n):
h = dp[:]
for j in range(-(n - 1) * 50, (n - 1) * 50 + 1):
h[j] += dp[j - x[i]]
dp = h
print(dp[0] - 1) |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
4,
13,
13,
13,
0,
13,
39,
28,
13,
13,
4,
18,
13,
13,
2,
13,
13,
41,
28,
13,
4,
13,
2,
13,
17,
4,
2,
39,
... | [
[
222,
2
],
[
222,
11
],
[
207,
13
],
[
213,
25
],
[
208,
30
],
[
211,
31
],
[
216,
33
],
[
37,
36
],
[
208,
36
],
[
217,
40
],
[
36,
43
],
[
211,
44
],
[
48,
47
... | [
"n, a = map(int, input().split())\nx = list(map(int, input().split()))\nX = max(max(x),a)\ny = []\nfor i in x:\n y.append(i-a)\ndp = [[0]*(2*n*X+1) for _ in range(n+1)]\n\nfor i in range(n+1):\n for j in range(len(dp[i])):\n if i == 0 and j == n * X:\n dp[i][j] = 1\n elif i > 0 and (j... | n, a = map(int, input().split())
x = list(map(int, input().split()))
X = max(max(x),a)
y = []
for i in x:
y.append(i-a)
dp = [[0]*(2*n*X+1) for _ in range(n+1)]
for i in range(n+1):
for j in range(len(dp[i])):
if i == 0 and j == n * X:
dp[i][j] = 1
elif i > 0 and (j - y[i-1] < 0 or ... |
[
7,
15,
13,
13,
13,
13,
13,
13,
13,
0,
13,
12,
4,
18,
4,
18,
4,
18,
18,
18,
13,
13,
13,
13,
13,
13,
17,
4,
18,
13,
13,
2,
17,
17,
0,
13,
4,
13,
17,
0,
13,
17,
0,
13,
17,
12,
13,
0,
13,
2,
39,
17,
17,
0,
18,
... | [
[
199,
10
],
[
202,
35
],
[
220,
40
],
[
220,
43
],
[
49,
48
],
[
57,
54
],
[
48,
55
],
[
60,
59
],
[
91,
62
],
[
65,
64
],
[
91,
64
],
[
68,
67
],
[
67,
76
],
... | [
"#!/usr/bin/env python3\nimport sys, math, itertools, heapq, collections, bisect, fractions\ninput = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')\nsys.setrecursionlimit(10**8)\ninf = float('inf')\nans = count = 0\n\ndef counting(A):\n memo=[0]*2501\n memo[0]=1\n n=len(A)\n for ai in A:\n... | #!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect, fractions
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans = count = 0
def counting(A):
memo=[0]*2501
memo[0]=1
n=len(A)
for ai in A:
for i in ... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
41,
28,
13,
4,
13,
2,
13,
17,
4,
13,
0,
13,
13,
0,
18,
18,
18,
13,
17,
17,
17,
17,
28,
13,
4,
13,
13,
28,
13,
4,
13,
13,... | [
[
148,
2
],
[
148,
11
],
[
142,
13
],
[
27,
26
],
[
146,
30
],
[
151,
35
],
[
45,
38
],
[
152,
41
],
[
48,
47
],
[
146,
50
],
[
53,
52
],
[
146,
55
],
[
58,
57
],... | [
"n, a = map(int, input().split())\nX = tuple(map(int, input().split()))\ndp = [[[0] * (2550) for _ in range(n+1)] for _ in range(n+1)]\ndp[0][0][0] = 1\nfor i in range(n):\n # i枚目までで\n for j in range(n):\n # j枚のカードを選んで\n for s in range(n*a+1):\n # 合計がsになるパターン\n if dp[i][j][... | n, a = map(int, input().split())
X = tuple(map(int, input().split()))
dp = [[[0] * (2550) for _ in range(n+1)] for _ in range(n+1)]
dp[0][0][0] = 1
for i in range(n):
# i枚目までで
for j in range(n):
# j枚のカードを選んで
for s in range(n*a+1):
# 合計がsになるパターン
if dp[i][j][s] == 0:
... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
13,
0,
13,
4,
13,
13,
2,
13,
13,
41,
28,
13,
4,
13,
2,
13,
17,
4,
13,
0,
13,
13,
0,
18,
18,
18,
13,
17,
... | [
[
159,
2
],
[
159,
11
],
[
156,
13
],
[
150,
25
],
[
157,
28
],
[
171,
30
],
[
151,
33
],
[
154,
35
],
[
160,
36
],
[
40,
39
],
[
154,
43
],
[
165,
48
],
[
58,
51
... | [
"n, a = map(int, input().split())\nx = list(map(int, input().split()))\nsum_x = sum(x)\nsum_x = max(sum_x, n*a)\n\ndp = [[[0]*(sum_x+1) for _ in range(n+1)] for _ in range(n+1)]\n#dp[i][j][k]はi番目までのカードの中からj枚選んで、合計がkになるときの選び方の総数\ndp[0][0][0] = 1\n\nfor i in range(n):\n for j in range(n):\n for k in range(s... | n, a = map(int, input().split())
x = list(map(int, input().split()))
sum_x = sum(x)
sum_x = max(sum_x, n*a)
dp = [[[0]*(sum_x+1) for _ in range(n+1)] for _ in range(n+1)]
#dp[i][j][k]はi番目までのカードの中からj枚選んで、合計がkになるときの選び方の総数
dp[0][0][0] = 1
for i in range(n):
for j in range(n):
for k in range(sum_x+1):
... |
[
7,
15,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
18,
13,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
2,
13,
4,
18,
13,
13,
13,
0,
13,
4,
13,
13,
4,
13,
13,
0,
13,
4,
18,
13,
13,
39,
2,
13,
... | [
[
178,
4
],
[
178,
13
],
[
181,
15
],
[
175,
31
],
[
182,
33
],
[
179,
38
],
[
169,
40
],
[
179,
43
],
[
182,
46
],
[
163,
48
],
[
167,
55
],
[
167,
61
],
[
170,
62... | [
"# 全DP C - 高橋君とカード / Tak and Cards\n\nimport numpy as np\n\nN, A = map(int, input().split())\nx = np.array(list(map(int, input().split())))\n\nx_diff = x - np.array(A)\nX = max(A, max(x))\n\ndp = np.zeros((N+2, 2*N*X+2)) #dp[i+1][j]はx_diff[i]までの数からいくつか選んで合計j-N*Xにするような選び方のパターン\ndp = dp.tolist()\ndp[0][N*X] = 1\n\nfo... | # 全DP C - 高橋君とカード / Tak and Cards
import numpy as np
N, A = map(int, input().split())
x = np.array(list(map(int, input().split())))
x_diff = x - np.array(A)
X = max(A, max(x))
dp = np.zeros((N+2, 2*N*X+2)) #dp[i+1][j]はx_diff[i]までの数からいくつか選んで合計j-N*Xにするような選び方のパターン
dp = dp.tolist()
dp[0][N*X] = 1
for i in range(N):
... |
[
7,
15,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
18,
4,
18,
13,
13,
39,
2,
13,
17,
2,
13,
17,
17,
13,
18,
13,
13,
0,
18,
18,
18,
13,
17,
17,
17,
17,
28... | [
[
120,
4
],
[
120,
13
],
[
117,
15
],
[
108,
27
],
[
112,
36
],
[
112,
39
],
[
54,
47
],
[
109,
50
],
[
57,
56
],
[
112,
59
],
[
123,
61
],
[
118,
63
],
[
56,
64
... | [
"import numpy as np\nn, a = map(int, input().split())\nx = list(map(int, input().split()))\n\n# dp[i][j][k]: i枚目までのカードをj枚使用して合計kを作れる組み合わせ\ndp = np.zeros((n+1, n+1, 3001)).astype(np.int64)\ndp[0][0][0] = 1\n\nfor i in range(n):\n _x = x[i]\n for j in range(n):\n dp[i+1, j+1, _x:] += dp[i, j, :-_x]\n ... | import numpy as np
n, a = map(int, input().split())
x = list(map(int, input().split()))
# dp[i][j][k]: i枚目までのカードをj枚使用して合計kを作れる組み合わせ
dp = np.zeros((n+1, n+1, 3001)).astype(np.int64)
dp[0][0][0] = 1
for i in range(n):
_x = x[i]
for j in range(n):
dp[i+1, j+1, _x:] += dp[i, j, :-_x]
dp[i+1, j, :]... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
28,
13,
4,
13,
13,
0,
18,
13,
13,
13,
4,
18,
13,
13,
14,
2,
2,
18,
13,
17,
17,
2,
18,
13,
17,
17,
4,
13,
17,
4,
13,
0,
... | [
[
231,
2
],
[
231,
11
],
[
225,
13
],
[
26,
25
],
[
232,
28
],
[
33,
30
],
[
226,
31
],
[
25,
32
],
[
217,
33
],
[
226,
36
],
[
226,
42
],
[
226,
47
],
[
219,
56
... | [
"n, a = map(int, input().split())\nx = list(map(int, input().split()))\n\nfor i in range(n):\n x[i] -= a\n\nx.sort()\n\nif x[0] > 0 or x[-1] < 0:\n print(0)\n exit()\n\nnum_zero = x.count(0)\n\nif x[0] == 0 or x[-1] == 0:\n print(pow(2, num_zero) - 1)\n exit()\n\nxp = [i for i in x if i > 0]\nxm = [-... | n, a = map(int, input().split())
x = list(map(int, input().split()))
for i in range(n):
x[i] -= a
x.sort()
if x[0] > 0 or x[-1] < 0:
print(0)
exit()
num_zero = x.count(0)
if x[0] == 0 or x[-1] == 0:
print(pow(2, num_zero) - 1)
exit()
xp = [i for i in x if i > 0]
xm = [-i for i in x if i < 0]
... |
[
7,
15,
13,
15,
13,
13,
15,
15,
15,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
41,
28,
13,
4,
13,
2,
13,
17,
4,
2,
39,
17,
2,
2,
13,
13,
17,
0,
13,
13,
0,
18,
18,
... | [
[
146,
11
],
[
146,
20
],
[
143,
22
],
[
36,
35
],
[
147,
39
],
[
147,
47
],
[
138,
48
],
[
140,
51
],
[
59,
54
],
[
141,
56
],
[
62,
61
],
[
147,
65
],
[
68,
67
... | [
"import sys\nimport heapq, math\nfrom itertools import zip_longest, permutations, combinations, combinations_with_replacement\nfrom itertools import accumulate, dropwhile, takewhile, groupby\nfrom functools import lru_cache\nfrom copy import deepcopy\n\nN, A = map(int, input().split())\nX = list(map(int, input().sp... | import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy
N, A = map(int, input().split())
X = list(map(int, input().split()))
dp =... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
0,
13,
4,
13,
13,
41,
28,
13,
4,
13,
2,
13,
17,
4,
13,
0,
13,
13,
0,
18,
18,
18,
13,
17,
17,
17,
17,
28,
13,... | [
[
168,
2
],
[
168,
11
],
[
15,
14
],
[
14,
23
],
[
171,
25
],
[
174,
28
],
[
172,
31
],
[
35,
34
],
[
169,
38
],
[
156,
43
],
[
53,
46
],
[
157,
49
],
[
56,
55
],... | [
"n,a = map(int,input().split())\nx = [int(i) for i in input().split()]\n\nsum_x = sum(x)\n\ndp = [[[0 for i in range(n+1)]for j in range(sum_x+1)]for k in range(n+1)]\n\ndp[0][0][0] = 1\n\nfor i in range(n):\n for j in range(n):\n for k in range(sum_x+1):\n dp[i+1][k][j] += dp[i][k][j]\n ... | n,a = map(int,input().split())
x = [int(i) for i in input().split()]
sum_x = sum(x)
dp = [[[0 for i in range(n+1)]for j in range(sum_x+1)]for k in range(n+1)]
dp[0][0][0] = 1
for i in range(n):
for j in range(n):
for k in range(sum_x+1):
dp[i+1][k][j] += dp[i][k][j]
if k + x[i] >... |
[
7,
15,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
18,
13,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
13,
0,
13,
18,
13,
2,
13,
17,
0,
13,
18,
13,
2,
13,
17,
0,
13,
4,
13,
18,
13,
2,
13,
17,
... | [
[
133,
4
],
[
133,
13
],
[
145,
15
],
[
142,
31
],
[
128,
32
],
[
148,
34
],
[
143,
36
],
[
146,
36
],
[
143,
38
],
[
146,
38
],
[
151,
41
],
[
143,
43
],
[
146,
43... | [
"import numpy as np\n\n\nn, a = map(int, input().split())\nX = np.array(list(map(int, input().split())))\nX -= a\n\nplus = X[X > 0]\nzero = X[X == 0]\nminus = abs(X[X < 0])\n\nnum_count = np.zeros(2551, dtype=np.int64)\nnum_count[0] = 1\n\nfor num in plus:\n num_count[num:] = num_count[:-num] + num_count[num:]\n... | import numpy as np
n, a = map(int, input().split())
X = np.array(list(map(int, input().split())))
X -= a
plus = X[X > 0]
zero = X[X == 0]
minus = abs(X[X < 0])
num_count = np.zeros(2551, dtype=np.int64)
num_count[0] = 1
for num in plus:
num_count[num:] = num_count[:-num] + num_count[num:]
for num in minus:
... |
[
7,
15,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
18,
18,
13,
13,
13,
4,
18,
13,
13,
2,
17,
17,
0,
13,
2,
17,
17,
0,
13,
17,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
31,
13,
0,
... | [
[
168,
4
],
[
159,
11
],
[
171,
18
],
[
162,
32
],
[
165,
37
],
[
43,
42
],
[
169,
49
],
[
43,
51
],
[
43,
52
],
[
56,
55
],
[
62,
61
],
[
42,
65
],
[
55,
72
],
... | [
"import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10 ** 9)\nINF = 1 << 60\nMOD = 1000000007\n\n\ndef main():\n N, A, *X = map(int, read().split())\n\n M = sum(X)\n dp = [[0] * (M + 1) for j in range(N + 1)]\n dp[0][0] = 1\n\n f... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, A, *X = map(int, read().split())
M = sum(X)
dp = [[0] * (M + 1) for j in range(N + 1)]
dp[0][0] = 1
for i in range(N):
... |
[
7,
0,
13,
12,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
13,
41,
28,
13,
4,
13,
4,
2,
13,
13,
0,
13,
13,
41,
28,
13,
4,
13,
17,
4,
2,
39,
17,
17,
0,
13,
13,
0,
13,
17,
0,
18,
18,
13,
17,
13,
17,
28,
13,
4,
... | [
[
125,
2
],
[
122,
13
],
[
126,
15
],
[
122,
16
],
[
20,
19
],
[
126,
21
],
[
19,
24
],
[
123,
25
],
[
116,
27
],
[
32,
31
],
[
110,
41
],
[
119,
44
],
[
52,
47
]... | [
"f=lambda:map(int,input().split())\nn,a=f()\nl=[i-a for i in f()]\ndp=[[0]*5000 for _ in range(51)]\nZ=2500\ndp[0][Z]=1\nfor i in range(n):\n for s in range(5000-max(l[i],0)):\n dp[i+1][s]+=dp[i][s]\n dp[i+1][s+l[i]]+=dp[i][s]\nprint(dp[n][Z]-1)",
"f=lambda:map(int,input().split())",
"f",
"lambda:map(i... | f=lambda:map(int,input().split())
n,a=f()
l=[i-a for i in f()]
dp=[[0]*5000 for _ in range(51)]
Z=2500
dp[0][Z]=1
for i in range(n):
for s in range(5000-max(l[i],0)):
dp[i+1][s]+=dp[i][s]
dp[i+1][s+l[i]]+=dp[i][s]
print(dp[n][Z]-1) |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
15,
41,
28,
13,
4,
18,
4,
13,
13,
4,
2,
4,
13,
13,
13,
0,
13,
13,
0,
13,
4,
13,
39,
17,
28,
13,
13,
0,
13,
4,
13,
28,
13,
13,
4,
18,
13,
13,
0,
18,
13,
2,
13,
13,
... | [
[
74,
2
],
[
74,
11
],
[
16,
15
],
[
15,
25
],
[
75,
26
],
[
77,
28
],
[
68,
31
],
[
38,
37
],
[
78,
37
],
[
80,
40
],
[
69,
48
],
[
84,
48
],
[
56,
51
],
[
... | [
"n,a=map(int,input().split())\nfrom collections import Counter\nX = [int(x) - a for x in input().split()]\nd=Counter([0])\nfor i in X:\n tmp=Counter()\n for j,k in d.items():\n tmp[i+j]+=k\n d+=tmp\nprint(d[0]-1)",
"n,a=map(int,input().split())",
"n",
"map(int,input().split())",
"map",
"in... | n,a=map(int,input().split())
from collections import Counter
X = [int(x) - a for x in input().split()]
d=Counter([0])
for i in X:
tmp=Counter()
for j,k in d.items():
tmp[i+j]+=k
d+=tmp
print(d[0]-1) |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
13,
41,
28,
13,
4,
13,
2,
4,
13,
13,
17,
4,
13,
0,
13,
13,
0,
18,
18,
18,
13,
17,
17,
17,
17,
0,
18,
18,
... | [
[
202,
2
],
[
202,
11
],
[
205,
13
],
[
187,
25
],
[
206,
28
],
[
32,
31
],
[
206,
37
],
[
193,
42
],
[
52,
45
],
[
194,
48
],
[
61,
54
],
[
194,
57
],
[
64,
63
]... | [
"n, a = map(int, input().split())\nx = list(map(int, input().split()))\n#dp[i][j] := iの数字まで考えたとき、jの数字になる個数\nmax_s = sum(x)\ndp = [[[0 for i in range(max_s + 1)] for j in range(n+1)] for k in range(len(x) + 1)]\n#init\ndp[0][0][0] = 1\ndp[1][0][0] = 1\nfor i in range(1,n+1):\n num = x[i-1]\n for j in range(len... | n, a = map(int, input().split())
x = list(map(int, input().split()))
#dp[i][j] := iの数字まで考えたとき、jの数字になる個数
max_s = sum(x)
dp = [[[0 for i in range(max_s + 1)] for j in range(n+1)] for k in range(len(x) + 1)]
#init
dp[0][0][0] = 1
dp[1][0][0] = 1
for i in range(1,n+1):
num = x[i-1]
for j in range(len(x)+1):
... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
13,
41,
28,
13,
4,
13,
2,
13,
17,
4,
13,
0,
13,
13,
0,
18,
18,
18,
13,
17,
17,
17,
17,
28,
13,
4,
13,
17,
... | [
[
177,
2
],
[
177,
11
],
[
186,
13
],
[
180,
25
],
[
187,
28
],
[
32,
31
],
[
178,
35
],
[
171,
40
],
[
50,
43
],
[
172,
46
],
[
53,
52
],
[
178,
57
],
[
183,
60
... | [
"#!/usr/bin/env python3\nn, a = map(int, input().split())\nx = list(map(int, input().split()))\ns = sum(x)\ndp = [[[0] * (s+1) for _ in range(n+1)] for _ in range(n+1)]\ndp[0][0][0] = 1\nfor i in range(1, n+1):\n xi = x[i-1]\n for j in range(s+1):\n for k in range(i):\n dp[i][k][j] = dp[i-1]... | #!/usr/bin/env python3
n, a = map(int, input().split())
x = list(map(int, input().split()))
s = sum(x)
dp = [[[0] * (s+1) for _ in range(n+1)] for _ in range(n+1)]
dp[0][0][0] = 1
for i in range(1, n+1):
xi = x[i-1]
for j in range(s+1):
for k in range(i):
dp[i][k][j] = dp[i-1][k][j]
for ... |
[
7,
15,
13,
12,
13,
0,
13,
4,
13,
13,
4,
13,
13,
0,
13,
2,
13,
13,
0,
13,
2,
17,
13,
0,
13,
4,
18,
13,
13,
0,
13,
39,
2,
13,
17,
2,
13,
17,
0,
13,
13,
0,
18,
18,
13,
17,
13,
17,
28,
13,
4,
13,
17,
4,
13,
13,... | [
[
7,
6
],
[
132,
9
],
[
134,
12
],
[
15,
14
],
[
6,
16
],
[
130,
17
],
[
20,
19
],
[
14,
22
],
[
25,
24
],
[
31,
30
],
[
130,
33
],
[
19,
36
],
[
40,
39
],
[
... | [
"import numpy as np\n\n\ndef main(n, a, x):\n X = max(a, max(x))\n NX = X * n\n NX2 = 2 * NX\n dp = np.zeros(shape=(n + 1, NX2 + 1), dtype=int)\n dp[0][NX] = 1\n for j in range(1, len(dp)):\n for t in range(len(dp[j])):\n xj = x[j - 1]\n yj = xj - a\n if 0 <... | import numpy as np
def main(n, a, x):
X = max(a, max(x))
NX = X * n
NX2 = 2 * NX
dp = np.zeros(shape=(n + 1, NX2 + 1), dtype=int)
dp[0][NX] = 1
for j in range(1, len(dp)):
for t in range(len(dp[j])):
xj = x[j - 1]
yj = xj - a
if 0 <= t - yj <= NX2:
... |
[
7,
41,
28,
13,
13,
4,
2,
18,
13,
17,
13,
0,
13,
4,
13,
13,
4,
18,
4,
18,
4,
13,
17,
13,
13,
31,
13,
0,
13,
13,
0,
13,
2,
13,
4,
13,
13,
0,
13,
13,
0,
18,
18,
13,
17,
17,
17,
28,
13,
4,
13,
17,
2,
13,
17,
28... | [
[
4,
3
],
[
3,
10
],
[
75,
12
],
[
75,
25
],
[
78,
28
],
[
81,
31
],
[
76,
33
],
[
72,
38
],
[
46,
41
],
[
73,
43
],
[
49,
48
],
[
76,
53
],
[
57,
56
],
[
8... | [
"n,*x=map(int,open(0).read().split());y=[x[0]-i for i in x];m=n*max(x);d=[[0]*m*2 for _ in[0]*-~n];d[0][0]=1\nfor i in range(1,n+1):\n\tfor s in range(-m,m):d[i][s]=d[i-1][s]+d[i-1][s-y[i]]\nprint(d[n][0]-1)",
"x[0]-i for i in x",
"for i in x",
"i",
"x",
"for i in x",
"x[0]-i",
"x[0]",
"x",
"0",
... | n,*x=map(int,open(0).read().split());y=[x[0]-i for i in x];m=n*max(x);d=[[0]*m*2 for _ in[0]*-~n];d[0][0]=1
for i in range(1,n+1):
for s in range(-m,m):d[i][s]=d[i-1][s]+d[i-1][s-y[i]]
print(d[n][0]-1) |
[
7,
17,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
12,
2,
4,
13,
13,
13,
23,
4,
18,
4,
13,
13,
0,
13,
4,
13,
0,
18,
13,
17,
17,
28,
13,
13,
28,
13,
13,
4,
13,
4,
18,
13,
13,
0,
18,
13,
2,
... | [
[
85,
3
],
[
85,
12
],
[
79,
14
],
[
86,
24
],
[
82,
32
],
[
39,
36
],
[
83,
37
],
[
42,
41
],
[
80,
41
],
[
83,
50
],
[
58,
53
],
[
83,
54
],
[
41,
56
],
[
... | [
"\"\"\"\nkari1 = '4 8'\nkari2 = '7 9 8 9' #5\n#kari1 = '3 8'\n#kari2 = '6 6 9' #0\n#kari1 = '8 5'\n#kari2 = '3 6 2 8 7 6 5 9' #19\n#kari1 = '33 3'\n#kari2 = '3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3' #8589934591\nn, a = map(int, kari1.split())\nx_a = list(map(lambda x: int(x) - a, kari2.spl... | """
kari1 = '4 8'
kari2 = '7 9 8 9' #5
#kari1 = '3 8'
#kari2 = '6 6 9' #0
#kari1 = '8 5'
#kari2 = '3 6 2 8 7 6 5 9' #19
#kari1 = '33 3'
#kari2 = '3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3' #8589934591
n, a = map(int, kari1.split())
x_a = list(map(lambda x: int(x) - a, kari2.split()))
"""
n, a = ... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
41,
28,
13,
13,
4,
2,
13,
13,
0,
13,
13,
0,
13,
2,
13,
13,
41,
28,
13,
4,
13,
2,
13,
17,
4,
2,
2,
39,
17,
13,
17,
0,
1... | [
[
139,
2
],
[
139,
11
],
[
145,
13
],
[
27,
26
],
[
146,
26
],
[
26,
30
],
[
137,
31
],
[
133,
33
],
[
148,
36
],
[
137,
38
],
[
140,
39
],
[
43,
42
],
[
140,
46
... | [
"n,A = map(int,input().split())\na = list(map(int,input().split()))\na = [x-A for x in a]\nB = A*n\ndp = [[0]*B*2 for i in range(n+1)]\ndp[0][B] = 1\nfor i in range(n):\n for j in range(B*2):\n dp[i+1][j] += dp[i][j]\n k = j+a[i]\n if k >=0 and k<B*2:\n dp[i+1][k] += dp[i][j]\npri... | n,A = map(int,input().split())
a = list(map(int,input().split()))
a = [x-A for x in a]
B = A*n
dp = [[0]*B*2 for i in range(n+1)]
dp[0][B] = 1
for i in range(n):
for j in range(B*2):
dp[i+1][j] += dp[i][j]
k = j+a[i]
if k >=0 and k<B*2:
dp[i+1][k] += dp[i][j]
print(dp[n][B]-1) |
[
7,
15,
13,
12,
13,
0,
13,
17,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
28,
13,
4,
13,
13,
0,
13,
2,
39,
17,
17,
0,
18,
13,
13,
17,
0,
18,
13,
2,
18,
13,
17,... | [
[
132,
6
],
[
12,
11
],
[
130,
18
],
[
12,
20
],
[
23,
22
],
[
130,
31
],
[
35,
34
],
[
11,
37
],
[
40,
39
],
[
48,
45
],
[
39,
46
],
[
133,
47
],
[
57,
50
],
[... | [
"import sys\ndef input(): return sys.stdin.readline().strip()\noffset = 2500\n\ndef main():\n N, A = map(int, input().split())\n X = list(map(int, input().split()))\n for i in range(N): X[i] -= A\n dp = [0] * 5010\n dp[offset] += 1\n dp[X[0] + offset] += 1\n for i, x in enumerate(X):\n i... | import sys
def input(): return sys.stdin.readline().strip()
offset = 2500
def main():
N, A = map(int, input().split())
X = list(map(int, input().split()))
for i in range(N): X[i] -= A
dp = [0] * 5010
dp[offset] += 1
dp[X[0] + offset] += 1
for i, x in enumerate(X):
if i == 0: continu... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
18,
4,
13,
17,
13,
13,
13,
31,
13,
0,
13,
21,
22,
17,
17,
28,
13,
13,
28,
13,
13,
4,
18,
4,
18,
13,
13,
13,
4,
13,
2,
18,
13,
17,
17,
10,
4,
13,
10,
21,
13,
10,
4,
13
] | [
[
51,
2
],
[
51,
15
],
[
51,
16
],
[
48,
19
],
[
26,
25
],
[
49,
34
],
[
49,
41
],
[
51,
46
],
[
48,
49
],
[
51,
52
]
] | [
"_,a,*l=map(int,open(0).read().split())\nd={0:1}\nfor i in l:\n for k,v in d.copy().items(): d[i-a+k]=d.get(i-a+k,0)+v\nprint(d[0]-1)",
"_,a,*l=map(int,open(0).read().split())",
"_",
"map(int,open(0).read().split())",
"map",
"int",
"open(0).read().split()",
"(0).read().split",
"(0).read()",
"(0).... | _,a,*l=map(int,open(0).read().split())
d={0:1}
for i in l:
for k,v in d.copy().items(): d[i-a+k]=d.get(i-a+k,0)+v
print(d[0]-1) |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
41,
28,
13,
4,
18,
4,
13,
13,
4,
2,
13,
4,
13,
13,
0,
13,
13,
0,
13,
2,
2,
13,
13,
17,
41,
28,
13,
4,
13,
2,
13,
17,
4,
2,
39,
17,
2,
13,
17,
0,
13,
13,
0,
18,
1... | [
[
134,
2
],
[
134,
11
],
[
15,
14
],
[
135,
22
],
[
14,
25
],
[
131,
27
],
[
143,
30
],
[
129,
33
],
[
135,
34
],
[
39,
38
],
[
129,
42
],
[
144,
49
],
[
140,
52
... | [
"N, A = map(int, input().split())\n# 予め-Kした状態で用意しておく\nX = [A-int(x) for x in input().split()]\nMAX = N*A*2\n# dp[i][k] := i枚目までのカードで、合計をkにする通り数\ndp = [[0]*(MAX+1) for _ in range(N+1)]\n# 負の数を考慮して、N*K位置を0とする\ndp[0][N*A] = 1\nfor i in range(N):\n x = X[i]\n for k in range(MAX+1):\n dp[i+1][k] += dp[i][k]\n if... | N, A = map(int, input().split())
# 予め-Kした状態で用意しておく
X = [A-int(x) for x in input().split()]
MAX = N*A*2
# dp[i][k] := i枚目までのカードで、合計をkにする通り数
dp = [[0]*(MAX+1) for _ in range(N+1)]
# 負の数を考慮して、N*K位置を0とする
dp[0][N*A] = 1
for i in range(N):
x = X[i]
for k in range(MAX+1):
dp[i+1][k] += dp[i][k]
if 0 <= k+x <= MAX:... |
[
7,
15,
13,
4,
18,
13,
13,
2,
17,
17,
0,
13,
18,
18,
13,
13,
13,
0,
13,
4,
13,
17,
0,
13,
2,
2,
17,
17,
17,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
... | [
[
191,
11
],
[
188,
18
],
[
182,
23
],
[
33,
32
],
[
192,
39
],
[
33,
41
],
[
44,
43
],
[
192,
52
],
[
56,
55
],
[
32,
57
],
[
41,
58
],
[
62,
61
],
[
32,
65
],
... | [
"import sys\n\nsys.setrecursionlimit(10 ** 7)\ninput = sys.stdin.readline\nf_inf = float('inf')\nmod = 10 ** 9 + 7\n\n\ndef resolve():\n n, a = map(int, input().split())\n X = list(map(int, input().split()))\n MAX = n * a\n dp = [[[0] * (MAX + 1) for _ in range(n + 1)] for _ in range(n + 1)]\n dp[0][... | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n, a = map(int, input().split())
X = list(map(int, input().split()))
MAX = n * a
dp = [[[0] * (MAX + 1) for _ in range(n + 1)] for _ in range(n + 1)]
dp[0][0][0] = 1
for ... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
28,
13,
4,
13,
13,
0,
18,
13,
13,
13,
41,
28,
13,
4,
13,
2,
13,
17,
4,
2,
39,
17,
17,
0,
13,
13,
0,
18,
18,
13,
17,
17,
... | [
[
122,
2
],
[
122,
11
],
[
116,
13
],
[
26,
25
],
[
123,
28
],
[
33,
30
],
[
117,
31
],
[
25,
32
],
[
120,
33
],
[
37,
36
],
[
123,
40
],
[
113,
48
],
[
56,
51
],... | [
"n,a=map(int,input().split())\nx=list(map(int,input().split()))\nfor i in range(n):\n x[i]-=a\n# dp[i][j] = i番目までで(j-2500)を何個作れるか\ndp=[[0]*5001 for i in range(n+1)]\ndp[0][2500]=1\nfor i in range(n):\n for j in range(5000):\n for k in range(2):\n if 0<=j-k*x[i]<=5000:\n dp[i+1... | n,a=map(int,input().split())
x=list(map(int,input().split()))
for i in range(n):
x[i]-=a
# dp[i][j] = i番目までで(j-2500)を何個作れるか
dp=[[0]*5001 for i in range(n+1)]
dp[0][2500]=1
for i in range(n):
for j in range(5000):
for k in range(2):
if 0<=j-k*x[i]<=5000:
dp[i+1][j]+=dp[i][j-k*... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
41,
28,
13,
4,
13,
2,
13,
17,
4,
13,
0,
13,
13,
0,
13,
17,
0,
18,
18,
18,
13,
17,
17,
17,
17,
28,
13,
4,
13,
17,
2,
13,
... | [
[
172,
2
],
[
172,
11
],
[
175,
13
],
[
27,
26
],
[
167,
30
],
[
160,
35
],
[
163,
38
],
[
48,
41
],
[
161,
44
],
[
51,
50
],
[
167,
55
],
[
59,
58
],
[
50,
62
],... | [
"n,a = map(int,input().split())\nx = list(map(int,input().split()))\nt = [[[0] * (50*(j+1)+1) for j in range(i+2)] for i in range(n+1)]\nans = 0\nt[0][0][0] = 1\n\nfor i in range(1, n+1):\n for j in range(i+1):\n for k in range(50*j + 1):\n if j >= 1 and k >= x[i-1]:\n t[i][j][k]... | n,a = map(int,input().split())
x = list(map(int,input().split()))
t = [[[0] * (50*(j+1)+1) for j in range(i+2)] for i in range(n+1)]
ans = 0
t[0][0][0] = 1
for i in range(1, n+1):
for j in range(i+1):
for k in range(50*j + 1):
if j >= 1 and k >= x[i-1]:
t[i][j][k] = t[i - 1][j -... |
[
7,
15,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
0,
13,
4,
18,
13,
13,
39,
2,
13,
17,
2,
2,
13,
13,
17,
0,
13,
18,
13,
13,
0,
18,
13,
17,
17,
28,
13,... | [
[
95,
4
],
[
95,
13
],
[
17,
16
],
[
16,
25
],
[
101,
27
],
[
98,
30
],
[
90,
37
],
[
90,
41
],
[
96,
42
],
[
46,
45
],
[
53,
50
],
[
99,
51
],
[
56,
55
],
[
... | [
"import numpy as np\n\nN, A = map(int,input().split())\nX = [int(x) for x in input().split()]\n \ndp = np.zeros((N+1,N*A+1),dtype=np.int64)\ndp[0,0] = 1\n \nfor x in X:\n dp[1:,x:] += dp[:-1,:-x].copy()\n \nans = 0\nfor n in range(1,N+1):\n ans += dp[n,n*A]\n\nprint(ans)",
"import numpy as np",
"numpy",
... | import numpy as np
N, A = map(int,input().split())
X = [int(x) for x in input().split()]
dp = np.zeros((N+1,N*A+1),dtype=np.int64)
dp[0,0] = 1
for x in X:
dp[1:,x:] += dp[:-1,:-x].copy()
ans = 0
for n in range(1,N+1):
ans += dp[n,n*A]
print(ans) |
[
7,
15,
13,
4,
18,
13,
13,
2,
17,
17,
0,
13,
18,
18,
13,
13,
13,
0,
13,
17,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
13,
41,
28,
13,
4,
18,
4,
13,
13,
4,
2,
4,
13,
13,
13,
0,
13,
13,
0,
13,
2,
... | [
[
136,
11
],
[
142,
18
],
[
23,
22
],
[
137,
26
],
[
22,
31
],
[
139,
33
],
[
139,
35
],
[
39,
38
],
[
137,
42
],
[
38,
48
],
[
134,
49
],
[
127,
51
],
[
130,
54
... | [
"#!/usr/bin/env python3\nimport sys\nsys.setrecursionlimit(10**8)\ninput = sys.stdin.readline\n\noffset = 3000\n\nn, a = [int(item) for item in input().split()]\nx = [int(item) - a for item in input().split()]\n\ndp = [0] * 6000\ndp[0 + offset] = 1\n\nfor item in x:\n if item < 0:\n for i in range(6000):\... | #!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
offset = 3000
n, a = [int(item) for item in input().split()]
x = [int(item) - a for item in input().split()]
dp = [0] * 6000
dp[0 + offset] = 1
for item in x:
if item < 0:
for i in range(6000):
if dp[i]... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
39,
17,
28,
13,
13,
4,
18,
13,
13,
2,
18,
13,
17,
13,
41,
28,
13,
4,
13,
2,
13,
17,
4,
13,
0,
13,
13,
0,
18,
18,
... | [
[
196,
2
],
[
196,
11
],
[
193,
13
],
[
199,
25
],
[
30,
29
],
[
194,
29
],
[
200,
33
],
[
200,
37
],
[
29,
39
],
[
43,
42
],
[
197,
46
],
[
202,
51
],
[
61,
54
]... | [
"N,A=map(int,input().split())\nxlist=list(map(int,input().split()))\n\nslist=[0]\nfor x in xlist:\n slist.append(slist[-1]+x)\n#print(slist)\n\ndp=[[[0]*(sum(xlist)+1) for _ in range(N+1)] for _ in range(N+1)]\ndp[0][0][0]=1\nfor i in range(1,N+1):\n dp[i][0][0]=1\n for j in range(1,i+1):\n for k in range(1,s... | N,A=map(int,input().split())
xlist=list(map(int,input().split()))
slist=[0]
for x in xlist:
slist.append(slist[-1]+x)
#print(slist)
dp=[[[0]*(sum(xlist)+1) for _ in range(N+1)] for _ in range(N+1)]
dp[0][0][0]=1
for i in range(1,N+1):
dp[i][0][0]=1
for j in range(1,i+1):
for k in range(1,slist[i]+1):
... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
41,
28,
13,
4,
13,
2,
13,
17,
4,
13,
0,
13,
13,
0,
18,
18,
18,
13,
17,
17,
17,
17,
28,
13,
4,
13,
13,
28,
13,
4,
13,
13,... | [
[
145,
2
],
[
145,
11
],
[
151,
13
],
[
27,
26
],
[
143,
30
],
[
154,
35
],
[
45,
38
],
[
155,
41
],
[
48,
47
],
[
143,
50
],
[
53,
52
],
[
143,
55
],
[
58,
57
],... | [
"N, A = map(int, input().split())\nX = list(map(int, input().split()))\ndp = [[[0] * 6000 for _ in range(N + 1) ] for _ in range(N + 1)]\ndp[0][0][0] = 1\nfor i in range(N):\n for j in range(N):\n for k in range(5000):\n if dp[i][j][k] == 0:\n continue\n dp[i + 1][j][k... | N, A = map(int, input().split())
X = list(map(int, input().split()))
dp = [[[0] * 6000 for _ in range(N + 1) ] for _ in range(N + 1)]
dp[0][0][0] = 1
for i in range(N):
for j in range(N):
for k in range(5000):
if dp[i][j][k] == 0:
continue
dp[i + 1][j][k] += dp[i][j][... |
[
7,
15,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
15,
4,
18,
13,
13,
2,
17,
17,
0,
13,
2,
17,
17,
0,
13,
2,
2,
17,
17,
17,
0,
13,
39,
17,
17,
17,
17,
0,
13,
39,
17,
17,
17,
17,
41,
28,
13,
4,
18,... | [
[
277,
25
],
[
265,
30
],
[
247,
37
],
[
250,
44
],
[
53,
52
],
[
52,
65
],
[
71,
70
],
[
70,
84
],
[
91,
90
],
[
90,
103
],
[
117,
116
],
[
253,
123
],
[
129,
128
... | [
"import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools\nfrom collections import deque\n\nsys.setrecursionlimit(10**7)\ninf = 10**20\nmod = 10**9 + 7\n\nDR = [1, -1, 0, 0]\nDC = [0, 0, 1, -1]\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\ndef LI_... | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
41,
28,
13,
4,
13,
2,
13,
17,
4,
13,
0,
13,
13,
0,
18,
18,
18,
13,
17,
17,
17,
17,
28,
13,
4,
13,
13,
28,
13,
4,
13,
2,
... | [
[
160,
2
],
[
160,
11
],
[
151,
13
],
[
27,
26
],
[
146,
30
],
[
154,
35
],
[
45,
38
],
[
155,
41
],
[
48,
47
],
[
146,
50
],
[
53,
52
],
[
146,
56
],
[
60,
59
],... | [
"N, A = map(int, input().split()) # N枚数のカード, 平均をAにしたい\nX = tuple(map(int, input().split())) # N枚のカードの中身\n\ndp = [[[0]*(50*N+2) for _ in range(N+2)] for _ in range(N+2)]\n\ndp[0][0][0] = 1 # 0枚の中から0枚選んで合計が0になる選び方が1通りある\n\nfor i in range(N):\n for j in range(N+1):\n for k in range(50*N+1):\n #... | N, A = map(int, input().split()) # N枚数のカード, 平均をAにしたい
X = tuple(map(int, input().split())) # N枚のカードの中身
dp = [[[0]*(50*N+2) for _ in range(N+2)] for _ in range(N+2)]
dp[0][0][0] = 1 # 0枚の中から0枚選んで合計が0になる選び方が1通りある
for i in range(N):
for j in range(N+1):
for k in range(50*N+1):
# if dp[i][j][k]... |
[
7,
15,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
18,
18,
13,
13,
13,
4,
18,
13,
13,
2,
17,
17,
0,
13,
2,
17,
17,
0,
13,
17,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
31,
13,
41,
... | [
[
190,
4
],
[
187,
11
],
[
178,
18
],
[
184,
32
],
[
175,
37
],
[
43,
42
],
[
191,
49
],
[
43,
51
],
[
43,
52
],
[
57,
56
],
[
56,
60
],
[
51,
61
],
[
64,
63
],
... | [
"import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10 ** 9)\nINF = 1 << 60\nMOD = 1000000007\n\n\ndef main():\n N, A, *X = map(int, read().split())\n\n X = [x - A for x in X]\n\n base = 2500\n dp = [[0] * 5001 for _ in range(N + 1)... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, A, *X = map(int, read().split())
X = [x - A for x in X]
base = 2500
dp = [[0] * 5001 for _ in range(N + 1)]
dp[0][base] = 1... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
17,
12,
13,
14,
2,
13,
4,
13,
13,
29,
8,
2,
2,
13,
17,
2,
2,
13,
13,
13,
17,
17,
14,
2,
39,
13,
13,
13,
13,
29,
18,
13,
... | [
[
121,
2
],
[
121,
11
],
[
124,
13
],
[
130,
23
],
[
100,
29
],
[
102,
32
],
[
106,
37
],
[
106,
41
],
[
108,
42
],
[
104,
43
],
[
131,
52
],
[
131,
55
],
[
67,
61
... | [
"n,a = map(int, raw_input().split())\nais = map(int, raw_input().split())\nmem = {}\ndef dfs(i,ais, cumul,count,a):\n\tif i == len(ais):\n\t\treturn 1 if (count > 0 and count * a == cumul) else 0\n\tif (i,cumul,count) in mem:\n\t\treturn mem[(i,cumul,count)]\n\tmem[(i,cumul,count)] = dfs(i+1, ais, cumul + ais[i], c... | n,a = map(int, raw_input().split())
ais = map(int, raw_input().split())
mem = {}
def dfs(i,ais, cumul,count,a):
if i == len(ais):
return 1 if (count > 0 and count * a == cumul) else 0
if (i,cumul,count) in mem:
return mem[(i,cumul,count)]
mem[(i,cumul,count)] = dfs(i+1, ais, cumul + ais[i], count +1, a) + dfs(i+... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
4,
18,
13,
13,
0,
13,
17,
0,
13,
4,
13,
13,
41,
28,
13,
4,
13,
2,
13,
17,
4,
2,
39,
17,
2,
13,
17,
0,
13,
13,
0,
18,
1... | [
[
201,
2
],
[
201,
11
],
[
189,
13
],
[
190,
26
],
[
30,
29
],
[
204,
32
],
[
190,
35
],
[
39,
38
],
[
205,
42
],
[
187,
49
],
[
192,
52
],
[
60,
55
],
[
193,
57
... | [
"n,a=map(int,input().split())\nx=list(map(int,input().split()))\nx.sort(reverse=True)\nsx=sum(x)\ndp=[[0]*(n+1) for i in range(sx+1)]\ndp[0][0]=1\nfor i in range(n):\n dp_sub=[[0]*(n+1) for j in range(sx+1)]\n for j in range(sx+1):\n for k in range(n+1):\n if (j==0 and k==0) or dp[j][k]!=0:\... | n,a=map(int,input().split())
x=list(map(int,input().split()))
x.sort(reverse=True)
sx=sum(x)
dp=[[0]*(n+1) for i in range(sx+1)]
dp[0][0]=1
for i in range(n):
dp_sub=[[0]*(n+1) for j in range(sx+1)]
for j in range(sx+1):
for k in range(n+1):
if (j==0 and k==0) or dp[j][k]!=0:
... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
41,
28,
13,
4,
18,
4,
13,
13,
4,
2,
4,
13,
13,
13,
0,
13,
13,
41,
28,
13,
4,
13,
2,
13,
17,
4,
2,
39,
17,
2,
2,
17,
13,
17,
0,
13,
13,
0,
18,
18,
13,
17,
2,
17,
... | [
[
113,
2
],
[
113,
11
],
[
15,
14
],
[
14,
24
],
[
111,
25
],
[
116,
27
],
[
32,
31
],
[
114,
35
],
[
114,
44
],
[
119,
47
],
[
57,
50
],
[
120,
52
],
[
114,
56
]... | [
"N, A = map(int, input().split())\nlst = [int(x) - A for x in input().split()]\ndp = [[0] * (100 * N + 1) for _ in range(N + 1)]\ndp[0][50 * N] = 1\nfor i in range(N):\n for j in range(50, 100 * N + 1 - 50):\n dp[i + 1][j] = dp[i][j] + dp[i][j - lst[i]]\nprint(dp[N][50 * N] - 1)",
"N, A = map(int, input... | N, A = map(int, input().split())
lst = [int(x) - A for x in input().split()]
dp = [[0] * (100 * N + 1) for _ in range(N + 1)]
dp[0][50 * N] = 1
for i in range(N):
for j in range(50, 100 * N + 1 - 50):
dp[i + 1][j] = dp[i][j] + dp[i][j - lst[i]]
print(dp[N][50 * N] - 1)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
4,
13,
13,
13,
41,
28,
13,
4,
13,
2,
13,
17,
4,
13,
0,
13,
13,
0,
18,
18,
18,
13,
17,
17,
17,
17,
28,
13,
... | [
[
199,
2
],
[
199,
11
],
[
196,
13
],
[
184,
25
],
[
197,
30
],
[
200,
31
],
[
35,
34
],
[
194,
38
],
[
187,
43
],
[
53,
46
],
[
188,
49
],
[
56,
55
],
[
194,
59
... | [
"n, a = map(int, input().split())\nx = list(map(int, input().split()))\nmax_x = max(max(x), a)\ndp = [[[0] * (n * max_x + 1) for _ in range(n + 1)] for _ in range(n + 1)]\ndp[0][0][0] = 1\nfor i in range(n + 1):\n for j in range(n + 1):\n for k in range(n * max_x + 1):\n if i >= 1 and k < x[i -... | n, a = map(int, input().split())
x = list(map(int, input().split()))
max_x = max(max(x), a)
dp = [[[0] * (n * max_x + 1) for _ in range(n + 1)] for _ in range(n + 1)]
dp[0][0][0] = 1
for i in range(n + 1):
for j in range(n + 1):
for k in range(n * max_x + 1):
if i >= 1 and k < x[i - 1]:
... |
[
7,
15,
13,
15,
13,
0,
13,
4,
13,
13,
4,
18,
4,
18,
18,
13,
13,
13,
13,
13,
31,
13,
12,
13,
0,
13,
17,
0,
13,
4,
18,
13,
13,
39,
2,
13,
17,
2,
13,
17,
0,
13,
18,
13,
13,
0,
18,
13,
17,
17,
28,
13,
4,
13,
13,
... | [
[
128,
6
],
[
128,
19
],
[
128,
20
],
[
26,
25
],
[
29,
28
],
[
123,
35
],
[
25,
38
],
[
42,
41
],
[
49,
46
],
[
28,
47
],
[
52,
51
],
[
123,
54
],
[
57,
56
],
... | [
"import sys\nimport numpy as np\n\nn, a, *x = map(int, sys.stdin.read().split())\n\ndef main():\n m = 2500\n dp = np.zeros((n + 1, m + 1), dtype=np.int64)\n dp[0, 0] = 1\n for i in range(n):\n ndp = np.copy(dp)\n for j in range(1, n + 1):\n ndp[j][x[i]:] += dp[j-1][:m-x[i]+1]\n ... | import sys
import numpy as np
n, a, *x = map(int, sys.stdin.read().split())
def main():
m = 2500
dp = np.zeros((n + 1, m + 1), dtype=np.int64)
dp[0, 0] = 1
for i in range(n):
ndp = np.copy(dp)
for j in range(1, n + 1):
ndp[j][x[i]:] += dp[j-1][:m-x[i]+1]
dp = ndp
... |
[
7,
15,
13,
12,
13,
0,
13,
18,
18,
18,
13,
13,
13,
13,
0,
13,
2,
2,
17,
17,
17,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
28,
13,
4,
13,
13,
0,
18,
13,
13,
13,... | [
[
7,
6
],
[
16,
15
],
[
23,
22
],
[
6,
31
],
[
23,
33
],
[
36,
35
],
[
6,
44
],
[
48,
47
],
[
22,
50
],
[
55,
52
],
[
35,
53
],
[
47,
54
],
[
33,
55
],
[
58... | [
"import sys\n\n\ndef solve():\n readline = sys.stdin.buffer.readline\n mod = 10 ** 9 + 7\n n, a = list(map(int, readline().split()))\n x = list(map(int, readline().split()))\n for i in range(n):\n x[i] -= a\n ls = [0] * 5010\n ls[2500] = 1\n for v in x:\n if v == 0:\n ... | import sys
def solve():
readline = sys.stdin.buffer.readline
mod = 10 ** 9 + 7
n, a = list(map(int, readline().split()))
x = list(map(int, readline().split()))
for i in range(n):
x[i] -= a
ls = [0] * 5010
ls[2500] = 1
for v in x:
if v == 0:
for i in range(50... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
2,
39,
17,
13,
0,
13,
4,
13,
2,
13,
39,
13,
41,
28,
13,
4,
13,
2,
13,
17,
4,
13,
0,
13,
13,
28,
13,
4,
13,
2,
1... | [
[
191,
2
],
[
191,
11
],
[
182,
13
],
[
179,
25
],
[
183,
29
],
[
194,
31
],
[
180,
35
],
[
183,
35
],
[
41,
40
],
[
192,
44
],
[
185,
49
],
[
53,
52
],
[
192,
56
... | [
"n, a = map(int, input().split())\nns = list(map(int, input().split()))\nns = [0] + ns\nma = max(ns+[a])\ndp = [[[0] * (ma * n+1) for i in range(n+1)] for i in range(n+1)]\nfor i in range(n+1):\n for j in range(i+1):\n for k in range(n * ma+1):\n if i == j == k == 0:\n dp[i][j][k... | n, a = map(int, input().split())
ns = list(map(int, input().split()))
ns = [0] + ns
ma = max(ns+[a])
dp = [[[0] * (ma * n+1) for i in range(n+1)] for i in range(n+1)]
for i in range(n+1):
for j in range(i+1):
for k in range(n * ma+1):
if i == j == k == 0:
dp[i][j][k] = 1
... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
17,
0,
13,
4,
13,
2,
39,
17,
2,
2,
13,
13,
17,
0,
18,
18,
13,
17,
17,
17,
28,
13,
13,
28,
13,
4,
13,
13,
17,
17,
... | [
[
116,
2
],
[
116,
11
],
[
107,
13
],
[
119,
25
],
[
122,
28
],
[
111,
36
],
[
117,
37
],
[
45,
40
],
[
123,
42
],
[
48,
47
],
[
108,
47
],
[
51,
50
],
[
111,
53
... | [
"n, a = map(int, input().split())\nl = list(map(int, input().split()))\nans = 0\ndp = list([0]*(n*a+1) for _ in range(n+1))#動的計画法で解く\ndp[0][0] = 1\nfor x in l:\n for i in range(n, 0, -1):#下行から順に格納していく(上からだと格納したばかりの値が参照されてしまう)\n for j in range(n*a+1):\n if x > j:\n continue\n ... | n, a = map(int, input().split())
l = list(map(int, input().split()))
ans = 0
dp = list([0]*(n*a+1) for _ in range(n+1))#動的計画法で解く
dp[0][0] = 1
for x in l:
for i in range(n, 0, -1):#下行から順に格納していく(上からだと格納したばかりの値が参照されてしまう)
for j in range(n*a+1):
if x > j:
continue
dp[i][j]... |
[
7,
15,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
2,
17,
17,
0,
13,
2,
2,
17,
17,
17,
4,
18,
13,
13,
17,
15,
15,
15,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
41,... | [
[
204,
4
],
[
201,
11
],
[
195,
16
],
[
34,
33
],
[
205,
40
],
[
34,
42
],
[
45,
44
],
[
205,
53
],
[
58,
57
],
[
33,
61
],
[
67,
66
],
[
70,
69
],
[
33,
73
],
... | [
"import sys\ninput = sys.stdin.readline\nINF = 10**10\nMOD = 10**9 + 7\nsys.setrecursionlimit(100000000)\nfrom functools import lru_cache\nfrom itertools import permutations\nfrom math import factorial\n\n\ndef main():\n n,a = map(int,input().split())\n x = list(map(int,input().split()))\n dp = [[[0] * (n ... | import sys
input = sys.stdin.readline
INF = 10**10
MOD = 10**9 + 7
sys.setrecursionlimit(100000000)
from functools import lru_cache
from itertools import permutations
from math import factorial
def main():
n,a = map(int,input().split())
x = list(map(int,input().split()))
dp = [[[0] * (n * a + 1) for _ in ... |
[
7,
15,
13,
13,
15,
15,
15,
15,
15,
15,
15,
15,
15,
12,
13,
12,
13,
12,
13,
12,
13,
12,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
12,
13,
23,
13,
4,
18,
13,
13,
2,
17,
17,
0,
13,
4,
13,
17,
0,
13,
2,
2,
17,
17,
17,... | [
[
26,
25
],
[
276,
31
],
[
35,
35
],
[
269,
44
],
[
284,
49
],
[
293,
56
],
[
276,
58
],
[
293,
59
],
[
290,
61
],
[
261,
63
],
[
287,
65
],
[
291,
70
],
[
294,
71
... | [
"import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd\nfrom itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby\nfrom operator import i... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
41,
28,
13,
13,
4,
2,
13,
13,
0,
13,
13,
0,
13,
21,
22,
17,
17,
28,
13,
13,
28,
13,
13,
4,
13,
4,
18,
13,
13,
0,
18,
13,... | [
[
89,
2
],
[
89,
11
],
[
83,
13
],
[
27,
26
],
[
84,
26
],
[
26,
30
],
[
90,
31
],
[
77,
33
],
[
80,
36
],
[
43,
42
],
[
78,
42
],
[
84,
42
],
[
81,
51
],
[
... | [
"n, a = map(int, input().split())\nx = list(map(int, input().split()))\nx = [i - a for i in x]\ndic = {0:1}\nfor i in x:\n for j, k in list(dic.items()):\n dic[i+j] = dic.get(i+j, 0) + k\n\nprint(dic[0] - 1)",
"n, a = map(int, input().split())",
"n",
"map(int, input().split())",
"map",
"int",
... | n, a = map(int, input().split())
x = list(map(int, input().split()))
x = [i - a for i in x]
dic = {0:1}
for i in x:
for j, k in list(dic.items()):
dic[i+j] = dic.get(i+j, 0) + k
print(dic[0] - 1) |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
12,
2,
4,
13,
13,
13,
23,
4,
18,
4,
13,
13,
0,
13,
21,
22,
17,
17,
28,
13,
13,
28,
13,
13,
4,
13,
4,
18,
13,
13,
0,
18,
13,
2,
13,
13,
2,
4,
... | [
[
75,
2
],
[
75,
11
],
[
78,
13
],
[
76,
23
],
[
81,
31
],
[
38,
37
],
[
79,
37
],
[
82,
46
],
[
54,
49
],
[
82,
50
],
[
37,
52
],
[
82,
57
],
[
37,
60
],
[
... | [
"N, A = map(int, input().split())\nX = list(map(lambda x: int(x) - A, input().split()))\n\nd = {0: 1}\n\nfor cur in X:\n for k, v in list(d.items()):\n d[cur + k] = d.get(cur + k, 0) + v\n \nprint(d[0]-1)",
"N, A = map(int, input().split())",
"N",
"map(int, input().split())",
"map",
"int",
"input... | N, A = map(int, input().split())
X = list(map(lambda x: int(x) - A, input().split()))
d = {0: 1}
for cur in X:
for k, v in list(d.items()):
d[cur + k] = d.get(cur + k, 0) + v
print(d[0]-1) |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
4,
18,
13,
13,
41,
28,
13,
13,
4,
2,
13,
13,
0,
13,
13,
0,
13,
21,
22,
17,
17,
28,
13,
13,
28,
13,
13,
4,
13... | [
[
93,
2
],
[
93,
11
],
[
15,
14
],
[
14,
23
],
[
84,
25
],
[
85,
29
],
[
34,
33
],
[
85,
33
],
[
33,
37
],
[
88,
38
],
[
90,
40
],
[
96,
43
],
[
50,
49
],
[
... | [
"N, A = map(int, input().split())\nx = [int(i) for i in input().split()]\n\nx.sort()\nx = [i - A for i in x]\nD = {0 : 1}\nfor i in x :\n for j, k in list(D.items()) :\n D[i+j] = D.get(i+j, 0) + k\n\nprint(D[0] - 1)",
"N, A = map(int, input().split())",
"N",
"map(int, input().split())",
"map",
"... | N, A = map(int, input().split())
x = [int(i) for i in input().split()]
x.sort()
x = [i - A for i in x]
D = {0 : 1}
for i in x :
for j, k in list(D.items()) :
D[i+j] = D.get(i+j, 0) + k
print(D[0] - 1)
|
[
7,
15,
13,
15,
0,
13,
18,
18,
13,
13,
13,
0,
13,
17,
0,
13,
39,
0,
13,
17,
12,
13,
41,
14,
2,
13,
4,
13,
13,
14,
2,
40,
13,
17,
2,
13,
2,
13,
13,
29,
17,
29,
17,
0,
13,
17,
0,
13,
4,
13,
2,
13,
17,
2,
13,
1... | [
[
138,
5
],
[
144,
12
],
[
135,
15
],
[
147,
18
],
[
151,
21
],
[
80,
21
],
[
73,
25
],
[
75,
32
],
[
77,
35
],
[
75,
37
],
[
148,
38
],
[
45,
44
],
[
48,
47
],
... | [
"import sys\nfrom functools import lru_cache\n\ninput = sys.stdin.readline\n\n\nans = 0\nX = []\nA = 0\n\n@lru_cache(maxsize=None)\ndef solve(i, selected, total):\n global X, ans\n\n if i == len(X):\n if selected != 0 and total == (selected * A):\n return 1\n return 0\n\n ret = 0\n... | import sys
from functools import lru_cache
input = sys.stdin.readline
ans = 0
X = []
A = 0
@lru_cache(maxsize=None)
def solve(i, selected, total):
global X, ans
if i == len(X):
if selected != 0 and total == (selected * A):
return 1
return 0
ret = 0
ret += solve(i + 1, s... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
2,
13,
13,
4,
13,
13,
41,
28,
13,
4,
13,
2,
13,
17,
4,
13,
0,
13,
13,
0,
18,
18,
18,
13,
17,
17,
17,
17,
... | [
[
145,
2
],
[
145,
11
],
[
148,
13
],
[
151,
25
],
[
146,
29
],
[
143,
30
],
[
149,
33
],
[
37,
36
],
[
146,
40
],
[
154,
45
],
[
55,
48
],
[
155,
51
],
[
58,
57
... | [
"N, A = map(int, input().split())\nX = list(map(int, input().split()))\nS = max(N * A, sum(X))\nDP = [[[0] * (S+1) for _ in range(N+1)] for _ in range(N+1)]\nDP[0][0][0] = 1\nfor i in range(N):\n for j in range(N+1):\n for k in range(S+1):\n if not DP[i][j][k]: continue\n DP[i+1][j][... | N, A = map(int, input().split())
X = list(map(int, input().split()))
S = max(N * A, sum(X))
DP = [[[0] * (S+1) for _ in range(N+1)] for _ in range(N+1)]
DP[0][0][0] = 1
for i in range(N):
for j in range(N+1):
for k in range(S+1):
if not DP[i][j][k]: continue
DP[i+1][j][k] += DP[i][j]... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
2,
4,
13,
4,
13,
13,
13,
13,
41,
28,
13,
4,
13,
2,
13,
17,
4,
13,
0,
13,
13,
0,
18,
18,
18,
13,
17,
17,
17,
17,
... | [
[
198,
2
],
[
198,
11
],
[
195,
13
],
[
207,
25
],
[
196,
31
],
[
193,
32
],
[
199,
33
],
[
37,
36
],
[
199,
40
],
[
204,
45
],
[
55,
48
],
[
205,
51
],
[
58,
57
... | [
"n,a=map(int,input().split())\nx=list(map(int,input().split()))\n\nxsum=max(max(x),a)*n\ndp=[[[0]*(xsum+1) for i in range(n+1)] for ii in range(n+1)]\n\ndp[0][0][0]=1\n\nfor j in range(1,n+1):\n for k in range(0,n+1): \n for s in range(0,xsum+1): \n if s<x[j-1] :\n dp[j][k]... | n,a=map(int,input().split())
x=list(map(int,input().split()))
xsum=max(max(x),a)*n
dp=[[[0]*(xsum+1) for i in range(n+1)] for ii in range(n+1)]
dp[0][0][0]=1
for j in range(1,n+1):
for k in range(0,n+1):
for s in range(0,xsum+1):
if s<x[j-1] :
dp[j][k][s]=dp[j-1][k][s]... |
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
4,
13,
13,
13,
41,
28,
13,
4,
13,
2,
13,
17,
4,
13,
0,
13,
13,
0,
18,
18,
18,
13,
17,
17,
17,
17,
28,
... | [
[
165,
3
],
[
165,
12
],
[
174,
14
],
[
168,
26
],
[
175,
31
],
[
166,
32
],
[
36,
35
],
[
163,
39
],
[
156,
44
],
[
54,
47
],
[
157,
50
],
[
57,
56
],
[
163,
59
... | [
"# DP\n\n# https://atcoder.jp/contests/abc044/tasks/arc060_a\n\nfrom itertools import combinations\n\n\nn, a = map(int, input().split())\nx = list(map(int, input().split()))\nX = max(max(x), a)\n\n\n# dp[j][k][s] (0 <= j <= N, 0 <= k <= N, 0 <= s <= NX)\n# dp[j][k][s] = x1,...,xjまでからk枚使って,合計をsにする選び方の総数\n# dp[0][0][... | # DP
# https://atcoder.jp/contests/abc044/tasks/arc060_a
from itertools import combinations
n, a = map(int, input().split())
x = list(map(int, input().split()))
X = max(max(x), a)
# dp[j][k][s] (0 <= j <= N, 0 <= k <= N, 0 <= s <= NX)
# dp[j][k][s] = x1,...,xjまでからk枚使って,合計をsにする選び方の総数
# dp[0][0][0] = 1
# j >= 1, s ... |
[
7,
15,
13,
15,
13,
15,
13,
15,
13,
15,
13,
15,
13,
15,
13,
15,
13,
15,
13,
15,
15,
4,
18,
13,
13,
2,
17,
17,
0,
13,
2,
2,
17,
17,
17,
0,
13,
4,
13,
17,
12,
13,
23,
13,
23,
13,
12,
13,
23,
13,
23,
13,
12,
13,
... | [
[
375,
29
],
[
357,
36
],
[
43,
43
],
[
45,
45
],
[
49,
49
],
[
51,
51
],
[
75,
75
],
[
78,
77
],
[
82,
82
],
[
84,
84
],
[
88,
88
],
[
90,
90
],
[
94,
94
],
[
... | [
"# python3.4.2用\nimport math\nimport fractions\nimport bisect\nimport collections\nimport itertools\nimport heapq\nimport string\nimport sys\nimport copy\nfrom decimal import *\nfrom collections import deque\nsys.setrecursionlimit(10**7)\nMOD = 10**9+7\nINF = float('inf') #無限大\ndef gcd(a,b):return fractions.gcd(a,b... | # python3.4.2用
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') #無限大
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
17,
13,
41,
28,
13,
4,
18,
4,
13,
13,
17,
4,
2,
4,
13,
13,
13,
0,
13,
13,
41,
28,
13,
4,
13,
2,
13,
17,
4,
17,
0,
13,
13,
0,
18,
18,
13,
17,
17,
17,
28,
13,
13,
4,
13,... | [
[
146,
2
],
[
146,
12
],
[
16,
15
],
[
15,
26
],
[
147,
27
],
[
137,
29
],
[
34,
33
],
[
144,
37
],
[
140,
42
],
[
50,
45
],
[
141,
47
],
[
138,
56
],
[
59,
58
],... | [
"n, a = map(int, input().split(\" \"))\nlist_x = [int(x) - a for x in input().split(\" \")]\ncounts = [{} for i in range(n + 1)]\ncounts[0][0] = 1\nfor i, x in enumerate(list_x):\n for v in counts[i]:\n c = counts[i][v]\n if v not in counts[i + 1]:\n counts[i + 1][v] = 0\n counts[i + 1][v] += c\n ... | n, a = map(int, input().split(" "))
list_x = [int(x) - a for x in input().split(" ")]
counts = [{} for i in range(n + 1)]
counts[0][0] = 1
for i, x in enumerate(list_x):
for v in counts[i]:
c = counts[i][v]
if v not in counts[i + 1]:
counts[i + 1][v] = 0
counts[i + 1][v] += c
if v + x not in cou... |
[
7,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
2,
13,
39,
13,
28,
13,
4,
13,
13,
0,
18,
13,
13,
13,
0,
13,
2,
2,
17,
13,
13,
41,
28,
13,
4,
13,
... | [
[
5,
4
],
[
5,
13
],
[
16,
15
],
[
28,
27
],
[
15,
31
],
[
36,
35
],
[
4,
38
],
[
43,
40
],
[
15,
41
],
[
35,
42
],
[
13,
43
],
[
46,
45
],
[
4,
49
],
[
27,... | [
"def main():\n n, a = map(int, input().split())\n x = list(map(int, input().split()))\n\n mx = max(x + [a])\n\n for i in range(n):\n x[i] -= a\n\n sm = 2 * n * mx\n\n dp = [[0] * (sm + 1) for _ in range(n + 1)]\n\n dp[0][n*mx] = 1\n\n for i, e in enumerate(x, 1):\n for j in ran... | def main():
n, a = map(int, input().split())
x = list(map(int, input().split()))
mx = max(x + [a])
for i in range(n):
x[i] -= a
sm = 2 * n * mx
dp = [[0] * (sm + 1) for _ in range(n + 1)]
dp[0][n*mx] = 1
for i, e in enumerate(x, 1):
for j in range(sm + 1):
... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
21,
22,
39,
17,
17,
17,
28,
13,
4,
13,
13,
0,
13,
21,
22,
39,
17,
17,
17,
28,
39,
13,
13,
13,
4,
18,
13,
13,
14,
... | [
[
159,
2
],
[
159,
11
],
[
162,
13
],
[
150,
25
],
[
34,
33
],
[
160,
36
],
[
153,
38
],
[
151,
52
],
[
157,
52
],
[
154,
59
],
[
66,
61
],
[
154,
62
],
[
73,
68
... | [
"\nn,k = map(int,input().split())\nA = list(map(int,input().split()))\ndic1 = {(0,0):1}\nfor i in range(n):\n dic2 = {(0,0):0}\n for (total,num),amount in dic1.items():\n if (total,num) in dic2:\n dic2[(total,num)] += amount\n else:\n dic2[(total,num)] = amount\n if ... |
n,k = map(int,input().split())
A = list(map(int,input().split()))
dic1 = {(0,0):1}
for i in range(n):
dic2 = {(0,0):0}
for (total,num),amount in dic1.items():
if (total,num) in dic2:
dic2[(total,num)] += amount
else:
dic2[(total,num)] = amount
if (total+A[i],num+... |
[
7,
15,
13,
15,
13,
0,
13,
4,
13,
13,
4,
18,
4,
18,
18,
13,
13,
13,
13,
13,
31,
13,
12,
13,
0,
13,
17,
0,
13,
4,
18,
13,
13,
39,
2,
13,
17,
2,
13,
17,
0,
13,
18,
13,
13,
0,
18,
13,
17,
17,
28,
13,
4,
13,
13,
... | [
[
103,
6
],
[
103,
19
],
[
103,
20
],
[
26,
25
],
[
29,
28
],
[
101,
35
],
[
25,
38
],
[
42,
41
],
[
49,
46
],
[
28,
47
],
[
52,
51
],
[
101,
54
],
[
57,
56
],
... | [
"import sys\nimport numpy as np\n\nn, a, *x = map(int, sys.stdin.read().split())\n\ndef main():\n m = 2500\n dp = np.zeros((n + 1, m + 1), dtype=np.int64)\n dp[0, 0] = 1\n for i in range(n):\n ndp = np.copy(dp)\n ndp[1:, x[i]:] += dp[:-1, :m-x[i]+1]\n dp = ndp\n i = np.arange(1, ... | import sys
import numpy as np
n, a, *x = map(int, sys.stdin.read().split())
def main():
m = 2500
dp = np.zeros((n + 1, m + 1), dtype=np.int64)
dp[0, 0] = 1
for i in range(n):
ndp = np.copy(dp)
ndp[1:, x[i]:] += dp[:-1, :m-x[i]+1]
dp = ndp
i = np.arange(1, n + 1)
print(n... |
[
7,
15,
13,
13,
13,
4,
18,
13,
13,
17,
0,
13,
18,
18,
13,
13,
13,
0,
13,
2,
2,
17,
17,
17,
0,
13,
18,
13,
13,
12,
13,
29,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
12,
13,
29,
4,
13,
13,
4,
18,
4,
13,
13,
12,
13,
... | [
[
370,
11
],
[
340,
18
],
[
364,
25
],
[
371,
40
],
[
371,
51
],
[
371,
59
],
[
64,
63
],
[
128,
69
],
[
75,
74
],
[
128,
76
],
[
80,
79
],
[
83,
82
],
[
128,
88
... | [
"import sys,collections as cl,bisect as bs\nsys.setrecursionlimit(100000)\ninput = sys.stdin.readline\nmod = 10**9+7\nMax = sys.maxsize\ndef l(): #intのlist\n return list(map(int,input().split()))\ndef m(): #複数文字\n return map(int,input().split())\ndef onem(): #Nとかの取得\n return int(input())\ndef s(x): #圧縮\n ... | import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
return list(map(int,input().split()))
def m(): #複数文字
return map(int,input().split())
def onem(): #Nとかの取得
return int(input())
def s(x): #圧縮
a = []
if l... |
[
7,
15,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
13,
0,
13,
4,
18,
13,
13,
39,
13,
2,
13,
17,
0,
13,
18,
13,
13,
28,
13,
4,
13,
13,
28,
13,
18,
4,
... | [
[
129,
4
],
[
129,
13
],
[
135,
15
],
[
123,
27
],
[
136,
30
],
[
120,
32
],
[
124,
40
],
[
44,
43
],
[
49,
48
],
[
127,
51
],
[
54,
53
],
[
48,
57
],
[
71,
61
],... | [
"import numpy as np\nn,a=map(int,input().split())\nx=list(map(int,input().split()))\ns=sum(x)\ndp=np.zeros((n,s+1),dtype=np.int64)\nfor i in range(n):\n for j in range(i)[::-1]:\n dp[j+1][x[i]:]+=dp[j][:-x[i]]\n dp[0][x[i]]+=1\nt=0\nfor k in range(n):\n if (k+1)*a<=s:\n t+=dp[k][(k+1)*a]\npri... | import numpy as np
n,a=map(int,input().split())
x=list(map(int,input().split()))
s=sum(x)
dp=np.zeros((n,s+1),dtype=np.int64)
for i in range(n):
for j in range(i)[::-1]:
dp[j+1][x[i]:]+=dp[j][:-x[i]]
dp[0][x[i]]+=1
t=0
for k in range(n):
if (k+1)*a<=s:
t+=dp[k][(k+1)*a]
print(t) |
[
7,
15,
13,
15,
13,
15,
13,
15,
15,
13,
15,
13,
15,
13,
15,
15,
4,
18,
13,
13,
2,
17,
17,
0,
13,
2,
17,
17,
12,
13,
12,
13,
12,
13,
12,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
12,
13,
23,
13,
41,
28,
13,
4,
13,
1... | [
[
304,
24
],
[
39,
38
],
[
314,
44
],
[
48,
48
],
[
52,
51
],
[
329,
57
],
[
61,
61
],
[
65,
64
],
[
320,
70
],
[
74,
74
],
[
78,
77
],
[
347,
83
],
[
87,
87
],
... | [
"import sys\nimport numpy as np\nimport random\nfrom decimal import Decimal\nimport itertools\nimport re\nimport bisect\nfrom collections import deque, Counter\nfrom functools import lru_cache\n\nsys.setrecursionlimit(10**9)\nINF = 10**13\ndef LI(): return list(map(int, sys.stdin.buffer.readline().split()))\ndef I(... | import sys
import numpy as np
import random
from decimal import Decimal
import itertools
import re
import bisect
from collections import deque, Counter
from functools import lru_cache
sys.setrecursionlimit(10**9)
INF = 10**13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.... |
[
7,
15,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
18,
18,
13,
13,
13,
4,
18,
13,
13,
2,
17,
17,
0,
13,
2,
17,
17,
0,
13,
17,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
31,
13,
41,
... | [
[
199,
4
],
[
187,
11
],
[
202,
18
],
[
196,
32
],
[
193,
37
],
[
43,
42
],
[
200,
49
],
[
43,
51
],
[
43,
52
],
[
57,
56
],
[
56,
60
],
[
51,
61
],
[
64,
63
],
... | [
"import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10 ** 9)\nINF = 1 << 60\nMOD = 1000000007\n\n\ndef main():\n N, A, *X = map(int, read().split())\n\n X = [x - A for x in X]\n\n neg = pos = 0\n for x in X:\n if x > 0:\n ... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, A, *X = map(int, read().split())
X = [x - A for x in X]
neg = pos = 0
for x in X:
if x > 0:
pos += x
... |
[
7,
12,
13,
15,
13,
0,
13,
18,
18,
13,
13,
13,
4,
18,
13,
13,
2,
17,
17,
15,
15,
15,
15,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
28,
13,
4,
13,
13,
0,
18,
13,
1... | [
[
7,
6
],
[
26,
25
],
[
6,
32
],
[
26,
34
],
[
37,
36
],
[
6,
45
],
[
49,
48
],
[
25,
51
],
[
56,
53
],
[
36,
54
],
[
48,
55
],
[
34,
56
],
[
60,
59
],
[
25... | [
"def main():\n import sys\n input = sys.stdin.readline\n sys.setrecursionlimit(10**7)\n from collections import Counter, deque\n #from collections import defaultdict\n from itertools import combinations, permutations, accumulate, groupby, product\n from bisect import bisect_left,bisect_right\n ... | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
2,
39,
17,
13,
41,
28,
13,
4,
13,
2,
13,
17,
4,
13,
0,
13,
13,
4,
18,
13,
13,
28,
13,
4,
13,
2,
13,
17,
28,
13,
... | [
[
213,
2
],
[
213,
11
],
[
216,
13
],
[
204,
25
],
[
217,
29
],
[
33,
32
],
[
214,
36
],
[
219,
41
],
[
205,
45
],
[
217,
45
],
[
49,
48
],
[
214,
52
],
[
56,
55
... | [
"n, a = map(int, input().split())\nx = list(map(int, input().split()))\nx = [0] + x\ndp = [[[0 for _ in range(max(x)*n+1)] for _ in range(n+1)] for _ in range(n+1)]\nx.sort()\nfor j in range(n+1):\n for k in range(n+1):\n for s in range(max(x)*n+1):\n if j == 0 and k == 0 and s == 0:\n ... | n, a = map(int, input().split())
x = list(map(int, input().split()))
x = [0] + x
dp = [[[0 for _ in range(max(x)*n+1)] for _ in range(n+1)] for _ in range(n+1)]
x.sort()
for j in range(n+1):
for k in range(n+1):
for s in range(max(x)*n+1):
if j == 0 and k == 0 and s == 0:
dp[j][k... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
4,
13,
13,
13,
41,
28,
13,
4,
13,
2,
13,
17,
4,
13,
0,
13,
13,
0,
18,
18,
18,
13,
17,
17,
17,
17,
28,
13,
... | [
[
166,
2
],
[
166,
11
],
[
151,
13
],
[
154,
25
],
[
152,
30
],
[
167,
31
],
[
35,
34
],
[
164,
38
],
[
160,
43
],
[
53,
46
],
[
161,
49
],
[
56,
55
],
[
164,
58
... | [
"N, A = map(int, input().split())\nx = list(map(int, input().split()))\nmaxX = max(max(x), A)\ndp = [[[0 for _ in range(N * maxX + 1)] for _ in range(N + 1)] for _ in range(N + 1)]\ndp[0][0][0] = 1\nfor i in range(N):\n for j in range(N + 1):\n for k in range(N * A + 1):\n if dp[i][j][k] == 0: ... | N, A = map(int, input().split())
x = list(map(int, input().split()))
maxX = max(max(x), A)
dp = [[[0 for _ in range(N * maxX + 1)] for _ in range(N + 1)] for _ in range(N + 1)]
dp[0][0][0] = 1
for i in range(N):
for j in range(N + 1):
for k in range(N * A + 1):
if dp[i][j][k] == 0: continue
... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
18,
4,
13,
17,
13,
13,
31,
13,
41,
28,
13,
13,
4,
2,
18,
13,
17,
13,
0,
13,
13,
0,
13,
2,
13,
4,
13,
13,
41,
28,
13,
4,
13,
2,
13,
17,
4,
2,
39,
17,
2,
2,
13,
17,
17,
0,
13,
... | [
[
114,
2
],
[
114,
15
],
[
20,
19
],
[
19,
26
],
[
123,
28
],
[
117,
31
],
[
115,
33
],
[
40,
39
],
[
115,
43
],
[
118,
51
],
[
120,
55
],
[
63,
58
],
[
121,
60
]... | [
"n,*x=map(int,open(0).read().split())\ny=[x[0]-i for i in x]\nm=n*max(x)\ndp=[[0]*(m*2+1) for _ in range(n+1)]\ndp[0][0]=1\nfor i in range(1,n+1):\n\tfor s in range(-m,m):\n\t\tdp[i][s]=dp[i-1][s]+dp[i-1][s-y[i]]\nprint(dp[n][0]-1)",
"n,*x=map(int,open(0).read().split())",
"n",
"map(int,open(0).read().split()... | n,*x=map(int,open(0).read().split())
y=[x[0]-i for i in x]
m=n*max(x)
dp=[[0]*(m*2+1) for _ in range(n+1)]
dp[0][0]=1
for i in range(1,n+1):
for s in range(-m,m):
dp[i][s]=dp[i-1][s]+dp[i-1][s-y[i]]
print(dp[n][0]-1) |
[
7,
15,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
18,
18,
13,
13,
13,
4,
18,
13,
13,
2,
17,
17,
0,
13,
2,
17,
17,
0,
13,
17,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
31,
13,
41,
... | [
[
170,
4
],
[
158,
11
],
[
167,
18
],
[
173,
32
],
[
164,
37
],
[
43,
42
],
[
171,
49
],
[
43,
51
],
[
43,
52
],
[
57,
56
],
[
56,
60
],
[
51,
61
],
[
64,
63
],
... | [
"import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10 ** 9)\nINF = 1 << 60\nMOD = 1000000007\n\n\ndef main():\n N, A, *X = map(int, read().split())\n\n X = [x - A for x in X]\n base = 2500\n dp = [[0] * 5001 for _ in range(N + 1)]\... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, A, *X = map(int, read().split())
X = [x - A for x in X]
base = 2500
dp = [[0] * 5001 for _ in range(N + 1)]
dp[0][base] = 1
... |
[
7,
15,
13,
12,
13,
0,
13,
17,
0,
13,
4,
13,
17,
4,
18,
13,
13,
2,
17,
17,
12,
13,
12,
13,
12,
13,
12,
13,
12,
13,
12,
13,
12,
13,
0,
13,
4,
13,
13,
0,
13,
4,
13,
41,
28,
13,
13,
4,
2,
13,
13,
0,
13,
13,
41,
... | [
[
7,
6
],
[
10,
9
],
[
36,
35
],
[
25,
37
],
[
36,
38
],
[
41,
40
],
[
29,
42
],
[
46,
45
],
[
40,
45
],
[
45,
49
],
[
38,
50
],
[
53,
52
],
[
57,
56
],
[
3... | [
"#!/usr/bin/env python3\n\nimport sys\n# import math\n# from string import ascii_lowercase, ascii_uppercase, ascii_letters, digits, hexdigits\n# import re # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)\n# from operator import... | #!/usr/bin/env python3
import sys
# import math
# from string import ascii_lowercase, ascii_uppercase, ascii_letters, digits, hexdigits
# import re # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from operator import itemgetter... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
41,
28,
13,
4,
13,
2,
13,
17,
4,
13,
0,
13,
13,
0,
18,
18,
18,
13,
17,
17,
17,
17,
28,
13,
4,
13,
13,
28,
13,
4,
13,
2,
... | [
[
130,
2
],
[
130,
11
],
[
136,
13
],
[
27,
26
],
[
131,
30
],
[
133,
35
],
[
45,
38
],
[
134,
41
],
[
48,
47
],
[
131,
50
],
[
53,
52
],
[
131,
56
],
[
60,
59
],... | [
"N,A=map(int,input().split())\nx=list(map(int,input().split()))\ndp=[[[0]*2600 for j in range(N+10)] for i in range(N+10)]\ndp[0][0][0]=1\nfor i in range(N):\n for j in range(N+1):\n for k in range(2501):\n if(dp[i][j][k]!=0):\n dp[i+1][j][k]+=dp[i][j][k]\n dp[i+1]... | N,A=map(int,input().split())
x=list(map(int,input().split()))
dp=[[[0]*2600 for j in range(N+10)] for i in range(N+10)]
dp[0][0][0]=1
for i in range(N):
for j in range(N+1):
for k in range(2501):
if(dp[i][j][k]!=0):
dp[i+1][j][k]+=dp[i][j][k]
dp[i+1][j+1][k+x[i]]+... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
2,
13,
17,
41,
28,
13,
4,
13,
2,
13,
17,
4,
13,
0,
13,
13,
0,
18,
18,
18,
13,
17,
17,
17,
17,
28,
13,
13,
4,
13,
... | [
[
155,
2
],
[
155,
11
],
[
158,
13
],
[
146,
25
],
[
156,
27
],
[
32,
31
],
[
156,
35
],
[
149,
40
],
[
50,
43
],
[
150,
46
],
[
159,
56
],
[
60,
59
],
[
156,
63
... | [
"N, A = map(int, input().split())\nX = list(map(int, input().split()))\nn = N * 50\ndp = [[[0]*(n+1) for j in range(N+1)] for i in range(N+1)]\ndp[0][0][0] = 1\n\nfor i, a in enumerate(X, 1):\n for j in range(N+1):\n for s in range(n+1):\n dp[i][j][s] = dp[i-1][j][s]\n if a <= s:\n dp[i][j][s] ... | N, A = map(int, input().split())
X = list(map(int, input().split()))
n = N * 50
dp = [[[0]*(n+1) for j in range(N+1)] for i in range(N+1)]
dp[0][0][0] = 1
for i, a in enumerate(X, 1):
for j in range(N+1):
for s in range(n+1):
dp[i][j][s] = dp[i-1][j][s]
if a <= s:
dp[i][j][s] += dp[i-1][j-1][... |
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
4,
13,
12,
2,
4,
13,
13,
13,
23,
4,
18,
4,
13,
13,
0,
13,
4,
13,
39,
17,
28,
13,
13,
0,
13,
4,
13,
28,
13,
13,
4,
18,
13,
13,
0,
18,
13,
... | [
[
77,
3
],
[
77,
12
],
[
83,
14
],
[
75,
26
],
[
71,
34
],
[
41,
40
],
[
84,
40
],
[
80,
43
],
[
72,
51
],
[
87,
51
],
[
59,
54
],
[
81,
55
],
[
40,
58
],
[
... | [
"from collections import Counter\nn,a=map(int,input().split())\nX=sorted(list(map(lambda x:int(x)-a,input().split())))\nans=Counter([0])\nfor x in X:\n tmp=Counter()\n for i,j in ans.items():\n tmp[i+x]+=j\n ans+=tmp\nprint(ans[0]-1)\n",
"from collections import Counter",
"n,a=map(int,input().sp... | from collections import Counter
n,a=map(int,input().split())
X=sorted(list(map(lambda x:int(x)-a,input().split())))
ans=Counter([0])
for x in X:
tmp=Counter()
for i,j in ans.items():
tmp[i+x]+=j
ans+=tmp
print(ans[0]-1)
|
[
7,
15,
13,
4,
18,
13,
13,
17,
0,
13,
4,
13,
17,
0,
13,
2,
2,
17,
17,
17,
0,
13,
12,
4,
18,
4,
18,
18,
13,
13,
13,
13,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
... | [
[
177,
9
],
[
171,
14
],
[
174,
21
],
[
36,
35
],
[
175,
42
],
[
36,
44
],
[
47,
46
],
[
175,
55
],
[
59,
58
],
[
46,
61
],
[
65,
64
],
[
35,
68
],
[
58,
75
],
... | [
"import sys\nsys.setrecursionlimit(2147483647)\nINF=float(\"inf\")\nMOD=10**9+7\ninput=lambda :sys.stdin.readline().rstrip()\ndef resolve():\n n,a=map(int,input().split())\n X=list(map(int,input().split()))\n M=sum(X)\n dp=[[0]*(M+1) for _ in range(n+1)]\n dp[0][0]=1\n\n from itertools import prod... | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
n,a=map(int,input().split())
X=list(map(int,input().split()))
M=sum(X)
dp=[[0]*(M+1) for _ in range(n+1)]
dp[0][0]=1
from itertools import product
for x in X:... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
2,
4,
13,
13,
13,
41,
28,
13,
4,
13,
2,
13,
17,
4,
13,
0,
13,
13,
0,
18,
18,
18,
13,
17,
17,
17,
17,
28,
13,
4,
... | [
[
155,
2
],
[
155,
11
],
[
161,
13
],
[
158,
25
],
[
162,
29
],
[
150,
30
],
[
34,
33
],
[
150,
37
],
[
143,
42
],
[
52,
45
],
[
144,
48
],
[
55,
54
],
[
150,
57
... | [
"# ABC044\nN, A = map(int, input().split())\nX = list(map(int, input().split()))\n\n# 2 ** 50 -> 全探索は厳しい -> DP\n# dp[i][k][wa] = i枚まで見て、k枚選んだ時の合計値がwaとなるときの選び方の合計\n# max wa = max(X) * N\nmax_wa = max(X) * N\ndp = [[[0] * (max(X) * (N+1)) for _ in range(N+1)] for __ in range(N+1)]\ndp[0][0][0] = 1\nfor i in range(N):... | # ABC044
N, A = map(int, input().split())
X = list(map(int, input().split()))
# 2 ** 50 -> 全探索は厳しい -> DP
# dp[i][k][wa] = i枚まで見て、k枚選んだ時の合計値がwaとなるときの選び方の合計
# max wa = max(X) * N
max_wa = max(X) * N
dp = [[[0] * (max(X) * (N+1)) for _ in range(N+1)] for __ in range(N+1)]
dp[0][0][0] = 1
for i in range(N):
for k in r... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
41,
28,
13,
4,
13,
17,
4,
13,
0,
13,
13,
0,
18,
18,
18,
13,
17,
17,
17,
17,
28,
13,
4,
13,
17,
13,
28,
13,
4,
13,
17,
2,... | [
[
157,
2
],
[
157,
11
],
[
151,
13
],
[
27,
26
],
[
145,
33
],
[
43,
36
],
[
146,
39
],
[
46,
45
],
[
149,
49
],
[
52,
51
],
[
149,
56
],
[
60,
59
],
[
149,
64
],... | [
"n, a = map(int, input().split())\nX = list(map(int, input().split()))\n\n# dp[i][j][k] i枚までj枚えらんで合計k\n# 答えはdp[n][1..n][a..ak]\ndp = [[[0] * 2700 for _ in range(52)]\n for __ in range(52)]\n\ndp[0][0][0] = 1\nfor i in range(0, n):\n for j in range(0, n + 1):\n for k in range(n * max(X) + 1):\n ... | n, a = map(int, input().split())
X = list(map(int, input().split()))
# dp[i][j][k] i枚までj枚えらんで合計k
# 答えはdp[n][1..n][a..ak]
dp = [[[0] * 2700 for _ in range(52)]
for __ in range(52)]
dp[0][0][0] = 1
for i in range(0, n):
for j in range(0, n + 1):
for k in range(n * max(X) + 1):
dp[i + 1][j]... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
41,
28,
13,
4,
13,
13,
4,
13,
0,
13,
13,
28,
13,
4,
13,
13,
28,
13,
4,
13,
2,
2,
13,
13,
17,
28,
13,
4,
13,
13,
14,
2,
... | [
[
234,
2
],
[
234,
11
],
[
237,
13
],
[
27,
26
],
[
235,
29
],
[
225,
33
],
[
37,
36
],
[
235,
39
],
[
42,
41
],
[
235,
46
],
[
220,
47
],
[
51,
50
],
[
235,
53
]... | [
"n, a = map(int,input().split())\nx = list(map(int,input().split()))\n\ndp = [[[0] * n for i in range(n * a + 1)] for i in range(n)]\nfor i in range(n):\n for j in range(n * a + 1):\n for k in range(n):\n if i == 0 and x[0] < n * a + 1:\n dp[0][x[0]][0] = 1\n break... | n, a = map(int,input().split())
x = list(map(int,input().split()))
dp = [[[0] * n for i in range(n * a + 1)] for i in range(n)]
for i in range(n):
for j in range(n * a + 1):
for k in range(n):
if i == 0 and x[0] < n * a + 1:
dp[0][x[0]][0] = 1
break
e... |
[
7,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
13,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
41,
28,
13,
13,
4,
2,
4,
13,
13,
13,
0,
13,
13,
0,
13,
4,
13,
13,
41,
28,
13,
4,
13,
2,
... | [
[
4,
3
],
[
3,
12
],
[
188,
14
],
[
188,
16
],
[
20,
19
],
[
19,
28
],
[
173,
30
],
[
35,
34
],
[
174,
34
],
[
34,
40
],
[
189,
41
],
[
182,
43
],
[
185,
46
],
... | [
"n, a = [int(i) for i in input().split()]\n\nx = [int(i) for i in input().split()] \ny = [int(i)-a for i in x] \n\n\nmax = max(x)\n\ndp = [[0 for _ in range(2*n*max+1)] for _ in range(n+1)]\n\ndp[0][n*max] = 1 \n\nfor i in range(1, n+1):\n\tfor j in range(2*n*max+1):\n\t\tif j - y[i-1] < 0 or j - y[i-1] > 2*n*max:\... | n, a = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]
y = [int(i)-a for i in x]
max = max(x)
dp = [[0 for _ in range(2*n*max+1)] for _ in range(n+1)]
dp[0][n*max] = 1
for i in range(1, n+1):
for j in range(2*n*max+1):
if j - y[i-1] < 0 or j - y[i-1] > 2*n*max:
dp[i][j] = dp[i-1][... |
[
7,
0,
13,
17,
0,
13,
17,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
12,
2,
4,
13,
13,
13,
23,
4,
18,
4,
13,
13,
41,
28,
13,
4,
13,
13,
4,
2,
39,
17,
17,
0,
13,
13,
0,
18,
18,
13,
17,
13,
... | [
[
127,
2
],
[
124,
5
],
[
133,
8
],
[
133,
17
],
[
136,
19
],
[
131,
29
],
[
39,
38
],
[
128,
41
],
[
139,
48
],
[
56,
51
],
[
140,
53
],
[
125,
55
],
[
59,
58
],... | [
"\nNMAX = 55\nT = 2500\nN, A = map(int, input().split())\nX = list(map(lambda x: int(x) - A, input().split()))\n\ndp = [[0]*5001 for i in range(NMAX)] # i時点で総和がSになるものの個数\n\ndp[0][T] = 1\n\nfor i in range(N):\n for s in range(5001):\n if s+X[i] > 5001 or dp[i][s] == 0:\n continue\n dp[i+... |
NMAX = 55
T = 2500
N, A = map(int, input().split())
X = list(map(lambda x: int(x) - A, input().split()))
dp = [[0]*5001 for i in range(NMAX)] # i時点で総和がSになるものの個数
dp[0][T] = 1
for i in range(N):
for s in range(5001):
if s+X[i] > 5001 or dp[i][s] == 0:
continue
dp[i+1][s] += dp[i][s]
... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
18,
4,
13,
17,
13,
13,
13,
31,
13,
0,
13,
17,
41,
28,
13,
4,
13,
2,
13,
17,
4,
2,
2,
39,
17,
13,
17,
0,
13,
13,
0,
18,
18,
13,
17,
17,
17,
28,
13,
4,
13,
13,
28,
13,
4,
13,
40... | [
[
99,
2
],
[
99,
15
],
[
99,
16
],
[
102,
19
],
[
24,
23
],
[
97,
27
],
[
103,
34
],
[
93,
37
],
[
45,
40
],
[
94,
42
],
[
48,
47
],
[
97,
50
],
[
53,
52
],
[
... | [
"n,a,*l=map(int,open(0).read().split())\nR=2500\ndp=[[0]*R*2 for _ in range(n+1)]\ndp[0][0]=1\nfor i in range(n):\n for s in range(-R,R):\n dp[i+1][s]=dp[i][s]+dp[i][s-l[i]+a]\nprint(dp[n][0]-1)",
"n,a,*l=map(int,open(0).read().split())",
"n",
"map(int,open(0).read().split())",
"map",
"int",
"open(0... | n,a,*l=map(int,open(0).read().split())
R=2500
dp=[[0]*R*2 for _ in range(n+1)]
dp[0][0]=1
for i in range(n):
for s in range(-R,R):
dp[i+1][s]=dp[i][s]+dp[i][s-l[i]+a]
print(dp[n][0]-1) |
[
7,
15,
13,
0,
13,
18,
18,
13,
13,
13,
12,
13,
12,
13,
12,
13,
12,
13,
0,
13,
2,
2,
17,
17,
17,
0,
13,
4,
13,
13,
0,
13,
4,
13,
0,
13,
4,
13,
13,
41,
28,
13,
4,
13,
2,
13,
17,
4,
13,
0,
13,
13,
0,
18,
18,
18... | [
[
179,
4
],
[
20,
19
],
[
27,
26
],
[
171,
28
],
[
27,
29
],
[
32,
31
],
[
183,
33
],
[
36,
35
],
[
31,
38
],
[
42,
41
],
[
26,
45
],
[
51,
50
],
[
60,
53
],
[
... | [
"import sys\ninput = sys.stdin.readline\n\ndef I(): return int(input())\ndef MI(): return map(int, input().split())\ndef LI(): return list(map(int, input().split()))\n\ndef main():\n mod=10**9+7\n N,A=MI()\n x=LI()\n M=max(x)\n \n #dp[i][j][k]はi番目まで,j枚で,和がkにできるか\n dp=[[[0]*(N*M+1) for j in rang... | import sys
input = sys.stdin.readline
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def main():
mod=10**9+7
N,A=MI()
x=LI()
M=max(x)
#dp[i][j][k]はi番目まで,j枚で,和がkにできるか
dp=[[[0]*(N*M+1) for j in range(N+1)] for _ in ra... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
41,
28,
13,
4,
13,
2,
13,
17,
4,
13,
0,
13,
13,
0,
18,
18,
18,
13,
17,
17,
17,
17,
28,
13,
4,
13,
13,
28,
13,
4,
13,
13,... | [
[
145,
2
],
[
145,
11
],
[
151,
13
],
[
27,
26
],
[
140,
30
],
[
148,
35
],
[
45,
38
],
[
149,
41
],
[
48,
47
],
[
140,
50
],
[
53,
52
],
[
140,
55
],
[
58,
57
],... | [
"N,A=map(int,input().split())\nx=list(map(int,input().split()))\ndp=[[[0]*(2501) for i in range(N+1)] for k in range(N+1)]\ndp[0][0][0]=1\nfor j in range(N):\n for k in range(N):\n for i in range(2501):\n if dp[j][k][i]==0:\n continue\n dp[j+1][k][i]+=dp[j][k][i]\n dp[j+1][k+1][i+x[j]]+=dp... | N,A=map(int,input().split())
x=list(map(int,input().split()))
dp=[[[0]*(2501) for i in range(N+1)] for k in range(N+1)]
dp[0][0][0]=1
for j in range(N):
for k in range(N):
for i in range(2501):
if dp[j][k][i]==0:
continue
dp[j+1][k][i]+=dp[j][k][i]
dp[j+1][k+1][i+x[j]]+=dp[j][k][i]
ans=0... |
[
7,
15,
13,
15,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
18,
13,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
2,
13,
13,
0,
13,
17,
0,
13,
4,
18,
13,
13,
39,
13,
13,
18,
13,
13,
0,
18,
18,
13,... | [
[
167,
6
],
[
167,
15
],
[
158,
17
],
[
164,
33
],
[
159,
35
],
[
168,
36
],
[
161,
38
],
[
170,
41
],
[
62,
53
],
[
171,
55
],
[
162,
59
],
[
77,
64
],
[
171,
66
... | [
"import sys\nimport numpy as np\nN, A = map(int, input().split())\nX = np.array(list(map(int, input().split())))\nx = X - A\nR = 5001\ndp = np.zeros([N, R], np.int64)\ndp[0][(R-1)//2] += 1\ndp[0][(R-1)//2 + x[0]] += 1\n\nfor i in range(1,N):\n\tfor j in range(R):\n\t\tif 0 <= j-x[i] <= R-1:\n\t\t\tdp[i][j] = dp[i-1... | import sys
import numpy as np
N, A = map(int, input().split())
X = np.array(list(map(int, input().split())))
x = X - A
R = 5001
dp = np.zeros([N, R], np.int64)
dp[0][(R-1)//2] += 1
dp[0][(R-1)//2 + x[0]] += 1
for i in range(1,N):
for j in range(R):
if 0 <= j-x[i] <= R-1:
dp[i][j] = dp[i-1][j] + dp[i-1][j-x[i]]
... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
4,
13,
12,
2,
4,
13,
13,
13,
23,
4,
18,
4,
13,
13,
0,
13,
2,
4,
13,
4,
13,
18,
13,
17,
4,
13,
18,
13,
17,
13,
41,
28,
13,
4,
13,
2,
13,
17,
... | [
[
159,
2
],
[
159,
11
],
[
153,
13
],
[
157,
25
],
[
150,
33
],
[
154,
40
],
[
154,
45
],
[
160,
47
],
[
51,
50
],
[
160,
54
],
[
147,
59
],
[
67,
62
],
[
148,
64
... | [
"n,a = map(int,input().split())\nx = sorted(list(map(lambda y:int(y)-a,input().split())))\n\nsx = max(abs(x[0]),abs(x[-1]))*n\n\ndp = [[0 for _ in range(2*sx+2)] for _ in range(n+1)]\ndp[0][0] = 1\n\nfor j in range(n):\n for t in range(-sx-1,sx+1):\n if -sx <= t-x[j] and t-x[j] <= sx: \n dp[j+1... | n,a = map(int,input().split())
x = sorted(list(map(lambda y:int(y)-a,input().split())))
sx = max(abs(x[0]),abs(x[-1]))*n
dp = [[0 for _ in range(2*sx+2)] for _ in range(n+1)]
dp[0][0] = 1
for j in range(n):
for t in range(-sx-1,sx+1):
if -sx <= t-x[j] and t-x[j] <= sx:
dp[j+1][t] = dp[j][t] ... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
28,
13,
4,
13,
13,
0,
18,
13,
13,
13,
0,
13,
2,
39,
17,
17,
0,
13,
17,
28,
13,
13,
0,
13,
18,
13,
2,
40,
13,
17,
14,
2,
... | [
[
140,
2
],
[
140,
11
],
[
134,
13
],
[
26,
25
],
[
141,
28
],
[
33,
30
],
[
135,
31
],
[
25,
32
],
[
129,
33
],
[
143,
35
],
[
146,
41
],
[
45,
44
],
[
135,
44
]... | [
"n, a = map(int, input().split())\nx = list(map(int, input().split()))\n\nfor i in range(n):\n x[i] -= a\n\nd = [0] * 6000\nans = 0\nfor dif in x:\n ans += d[-dif+3000]\n if dif == 0:\n ans += 1\n if dif < 0:\n for i in range(6000):\n if 0 <= i+dif < 6000:\n d[i+dif] += d[i]\n else:\n for ... | n, a = map(int, input().split())
x = list(map(int, input().split()))
for i in range(n):
x[i] -= a
d = [0] * 6000
ans = 0
for dif in x:
ans += d[-dif+3000]
if dif == 0:
ans += 1
if dif < 0:
for i in range(6000):
if 0 <= i+dif < 6000:
d[i+dif] += d[i]
else:
for i in range(5999, -1, -... |
[
7,
15,
13,
12,
13,
41,
28,
13,
4,
13,
13,
4,
2,
39,
13,
13,
12,
13,
23,
13,
23,
13,
23,
13,
41,
28,
13,
4,
13,
13,
4,
13,
12,
13,
23,
13,
23,
13,
23,
13,
23,
13,
41,
28,
13,
4,
13,
13,
4,
13,
12,
13,
23,
13,
... | [
[
8,
7
],
[
19,
19
],
[
21,
21
],
[
23,
23
],
[
27,
26
],
[
35,
35
],
[
37,
37
],
[
39,
39
],
[
41,
41
],
[
45,
44
],
[
53,
53
],
[
55,
55
],
[
57,
57
],
[
... | [
"# -*- coding: utf-8 -*-\n\nimport sys\n\ndef input(): return sys.stdin.readline().strip()\ndef list2d(a, b, c): return [[c] * b for i in range(a)]\ndef list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]\ndef list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for ... | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a... |
[
7,
15,
13,
0,
13,
4,
18,
13,
13,
39,
17,
17,
18,
13,
13,
0,
18,
13,
17,
17,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
28,
13,
13,
0,
13,
4,
18,
13,
13,
0... | [
[
100,
4
],
[
19,
16
],
[
101,
17
],
[
97,
21
],
[
97,
30
],
[
34,
33
],
[
33,
42
],
[
91,
44
],
[
48,
47
],
[
92,
47
],
[
106,
50
],
[
101,
53
],
[
61,
56
],
[... | [
"import numpy as np\nhi = np.zeros((5000,60),np.int64)\nhi[0,0]=1\nn,a = map(int, input().split())\nli = [int(it) for it in input().split()]\nfor i in li:\n hi_ = 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)",
"import numpy as np",
"numpy",
"hi = np... | import numpy as np
hi = np.zeros((5000,60),np.int64)
hi[0,0]=1
n,a = map(int, input().split())
li = [int(it) for it in input().split()]
for i in li:
hi_ = hi.copy()
hi[i:-1,1:]+=hi_[:-1-i,:-1]
s = 0
for i in range(n):
s+=hi[(i+1)*a,i+1]
print (s) |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
41,
28,
13,
4,
13,
17,
4,
13,
0,
13,
13,
0,
18,
18,
18,
13,
17,
17,
17,
17,
28,
13,
4,
13,
13,
28,
13,
4,
13,
2,
13,
17,... | [
[
147,
2
],
[
147,
11
],
[
141,
13
],
[
27,
26
],
[
153,
33
],
[
43,
36
],
[
154,
39
],
[
46,
45
],
[
145,
48
],
[
51,
50
],
[
145,
54
],
[
58,
57
],
[
57,
63
],
... | [
"n,a=map(int,input().split())\nx=list(map(int,input().split()))\n# dp[j][k][s]=(x1,...,xjからk枚選んでx[i]の合計をsにするような選び方の総数)\ndp=[[[0]*2501 for i in range(51)] for j in range(51)]\ndp[0][0][0]=1\nfor i in range(n):\n for j in range(n+1):\n for k in range(2501):\n if k<x[i]:\n dp[i+1][j... | n,a=map(int,input().split())
x=list(map(int,input().split()))
# dp[j][k][s]=(x1,...,xjからk枚選んでx[i]の合計をsにするような選び方の総数)
dp=[[[0]*2501 for i in range(51)] for j in range(51)]
dp[0][0][0]=1
for i in range(n):
for j in range(n+1):
for k in range(2501):
if k<x[i]:
dp[i+1][j][k]=dp[i][j][... |
[
7,
15,
12,
13,
0,
13,
18,
13,
13,
0,
13,
17,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
41,
28,
13,
4,
13,
2,
13,
17,
4,
13,
0,
13,
13,
0,
18,
18,
18,
13,
17,
17,
17,... | [
[
6,
5
],
[
11,
10
],
[
14,
13
],
[
5,
20
],
[
14,
22
],
[
25,
24
],
[
5,
33
],
[
38,
37
],
[
13,
41
],
[
47,
46
],
[
56,
49
],
[
46,
52
],
[
59,
58
],
[
13... | [
"from sys import stdin\ndef main():\n #入力\n readline=stdin.readline\n con=2500\n n,a=map(int,readline().split())\n x=list(map(int,readline().split()))\n\n dp=[[[0]*(n+1) for _ in range(con+1)] for _ in range(n+1)]\n dp[0][0][0]=1\n for i in range(n):\n for k in range(n):\n ... | from sys import stdin
def main():
#入力
readline=stdin.readline
con=2500
n,a=map(int,readline().split())
x=list(map(int,readline().split()))
dp=[[[0]*(n+1) for _ in range(con+1)] for _ in range(n+1)]
dp[0][0][0]=1
for i in range(n):
for k in range(n):
for j in range(co... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
2,
13,
13,
41,
28,
13,
4,
13,
2,
13,
17,
4,
13,
0,
13,
13,
0,
18,
18,
13,
17,
17,
17,
0,
18,
18,
13,
17,
17,
17,
... | [
[
155,
2
],
[
155,
11
],
[
140,
13
],
[
149,
23
],
[
156,
28
],
[
32,
31
],
[
147,
35
],
[
143,
40
],
[
48,
43
],
[
144,
45
],
[
55,
50
],
[
144,
52
],
[
66,
57
]... | [
"n, a = map(int, input().split())\nx_i = map(int, input().split())\nlist = list(i - a for i in x_i)\nanslist = [[0 for i in range(5001)] for j in range(n + 1)]\nanslist[0][2500] += 1\nanslist[1][2500] += 1\nanslist[1][list[0] + 2500] += 1\nfor id in range(n + 1):\n if id == 0 or id == 1: continue\n num = list... | n, a = map(int, input().split())
x_i = map(int, input().split())
list = list(i - a for i in x_i)
anslist = [[0 for i in range(5001)] for j in range(n + 1)]
anslist[0][2500] += 1
anslist[1][2500] += 1
anslist[1][list[0] + 2500] += 1
for id in range(n + 1):
if id == 0 or id == 1: continue
num = list[id - 1]
f... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
2,
17,
13,
41,
28,
13,
4,
13,
2,
13,
17,
4,
13,
0,
13,
13,
0,
18,
18,
18,
13,
17,
17,
17,
17,
28,
13,
13,
4,
13,
... | [
[
172,
2
],
[
172,
11
],
[
157,
13
],
[
166,
25
],
[
155,
28
],
[
32,
31
],
[
155,
35
],
[
160,
40
],
[
50,
43
],
[
161,
46
],
[
158,
56
],
[
60,
59
],
[
65,
64
]... | [
"n, a = map(int, input().split())\nx = list(map(int, input().split()))\nMAX = 50 * n\n\ndp = [[[0] * (MAX + 1) for _ in range(n + 1)] for _ in range(n + 1)]\ndp[0][0][0] = 1\n\nfor i, e in enumerate(x, 1):\n for j in range(i):\n for k in range(MAX + 1):\n dp[i][j][k] += dp[i-1][j][k]\n\n for... | n, a = map(int, input().split())
x = list(map(int, input().split()))
MAX = 50 * n
dp = [[[0] * (MAX + 1) for _ in range(n + 1)] for _ in range(n + 1)]
dp[0][0][0] = 1
for i, e in enumerate(x, 1):
for j in range(i):
for k in range(MAX + 1):
dp[i][j][k] += dp[i-1][j][k]
for j in range(i):
... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
41,
28,
13,
4,
13,
2,
13,
17,
4,
2,
39,
17,
2,
2,
13,
13,
17,
0,
13,
13,
0,
18,
18,
13,
17,
17,
17,
28,
13,
... | [
[
122,
2
],
[
122,
11
],
[
15,
14
],
[
14,
23
],
[
125,
25
],
[
30,
29
],
[
123,
33
],
[
123,
41
],
[
117,
42
],
[
113,
45
],
[
53,
48
],
[
114,
50
],
[
56,
55
],... | [
"N, A = map(int,input().split())\nX = [int(x) for x in input().split()]\n\ndp = [[0]*(N*A+1) for _ in range(N+1)] #dp[i][j]:i枚の和がjとなるようなカードの選び方\ndp[0][0] = 1 \nfor x in X:\n for i in reversed(range(1,N+1)):\n for j in reversed(range(N*A+1)):\n if j < x:\n continue\n d... | N, A = map(int,input().split())
X = [int(x) for x in input().split()]
dp = [[0]*(N*A+1) for _ in range(N+1)] #dp[i][j]:i枚の和がjとなるようなカードの選び方
dp[0][0] = 1
for x in X:
for i in reversed(range(1,N+1)):
for j in reversed(range(N*A+1)):
if j < x:
continue
dp[i][j] += dp[i... |
[
7,
15,
13,
0,
13,
18,
18,
13,
13,
13,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
18,
4,
13,
13,
13,
0,
13,
2,
4,
13,
13,
13,
41,
28,
13,
13,
4,
2,
13,
13,
... | [
[
171,
4
],
[
14,
13
],
[
172,
22
],
[
14,
25
],
[
28,
27
],
[
172,
38
],
[
43,
42
],
[
27,
46
],
[
13,
47
],
[
51,
50
],
[
27,
50
],
[
50,
54
],
[
25,
55
],
[
... | [
"import sys\nreadline = sys.stdin.readline\n\ndef main():\n N, A = map(int, readline().rstrip().split())\n X = list(map(int, readline().rstrip().split()))\n lim = max(X) * N\n X = [x-A for x in X]\n dp = [[0]*(2*lim) for _ in range(N+1)]\n dp[0][lim] = 1\n for i in range(1, N+1):\n x = X... | import sys
readline = sys.stdin.readline
def main():
N, A = map(int, readline().rstrip().split())
X = list(map(int, readline().rstrip().split()))
lim = max(X) * N
X = [x-A for x in X]
dp = [[0]*(2*lim) for _ in range(N+1)]
dp[0][lim] = 1
for i in range(1, N+1):
x = X[i-1]
fo... |
[
7,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
41,
28,
13,
4,
13,
13,
4,
13,
0,
13,
13,
0,
18,
18,
18,
13,
17,
17,
17,
17,
0,
18,
18,
18,
13,
17,
1... | [
[
5,
4
],
[
5,
13
],
[
17,
16
],
[
16,
25
],
[
28,
27
],
[
32,
31
],
[
4,
34
],
[
39,
38
],
[
48,
41
],
[
38,
44
],
[
59,
50
],
[
38,
53
],
[
27,
57
],
[
62... | [
"def main():\n n,a = map(int,input().split())\n x = [int(x) for x in input().split()]\n dp= [[[0 for _ in range(2501)] for _ in range(n+1)] for _ in range(n)]\n\n dp[0][0][0] = 1\n dp[0][1][x[0]] = 1\n\n for i in range(1,n):\n for j in range(n+1):\n for k in range(2501):\n ... | def main():
n,a = map(int,input().split())
x = [int(x) for x in input().split()]
dp= [[[0 for _ in range(2501)] for _ in range(n+1)] for _ in range(n)]
dp[0][0][0] = 1
dp[0][1][x[0]] = 1
for i in range(1,n):
for j in range(n+1):
for k in range(2501):
if k<x[... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
2,
17,
17,
41,
28,
13,
4,
13,
2,
13,
17,
4,
13,
0,
13,
13,
0,
18,
18,
13,
17,
17,
17,
28,
13,
4,
13,
13,
0,
13,
... | [
[
138,
2
],
[
138,
11
],
[
117,
13
],
[
123,
25
],
[
32,
31
],
[
139,
35
],
[
120,
40
],
[
48,
43
],
[
121,
45
],
[
51,
50
],
[
139,
53
],
[
129,
55
],
[
118,
57
... | [
"N, K = map(int, input().split())\nA = list(map(int, input().split()))\n\nL = 50*50\ndp = [[0 for _ in range(L+1)] for _ in range(N+1)]\ndp[0][0] = 1\n\nfor i in range(N):\n a = A[i]\n for j in reversed(range(N)):\n for l in range(L+1):\n if l < a: continue\n dp[j+1][l] += dp[j][l... | N, K = map(int, input().split())
A = list(map(int, input().split()))
L = 50*50
dp = [[0 for _ in range(L+1)] for _ in range(N+1)]
dp[0][0] = 1
for i in range(N):
a = A[i]
for j in reversed(range(N)):
for l in range(L+1):
if l < a: continue
dp[j+1][l] += dp[j][l-a]
ans = 0
for ... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
39,
17,
0,
13,
39,
17,
0,
13,
17,
28,
13,
13,
14,
2,
2,
13,
13,
17,
4,
18,
13,
13,
2,
13,
13,
14,
2,
2,
13,
13,
... | [
[
301,
2
],
[
301,
11
],
[
274,
13
],
[
271,
25
],
[
304,
29
],
[
286,
33
],
[
37,
36
],
[
275,
36
],
[
36,
41
],
[
302,
42
],
[
272,
46
],
[
36,
49
],
[
302,
50
... | [
"N,A = map(int,input().split())\nX = list(map(int,input().split()))\n\nXp = [0]\nXm = [0]\nXz = 0\nfor x in X:\n if x-A > 0:\n Xp.append(x-A)\n elif x-A < 0:\n Xm.append(x-A)\n else:\n Xz += 1\n\nDPp = [[0 for j in range(2501)] for i in range(len(Xp))]\nDPm = [[0 for j in range(2501)] ... | N,A = map(int,input().split())
X = list(map(int,input().split()))
Xp = [0]
Xm = [0]
Xz = 0
for x in X:
if x-A > 0:
Xp.append(x-A)
elif x-A < 0:
Xm.append(x-A)
else:
Xz += 1
DPp = [[0 for j in range(2501)] for i in range(len(Xp))]
DPm = [[0 for j in range(2501)] for i in range(len(X... |
[
7,
15,
13,
0,
13,
4,
13,
13,
4,
18,
4,
18,
18,
13,
13,
13,
13,
13,
31,
13,
12,
13,
0,
13,
2,
13,
13,
41,
28,
13,
4,
13,
2,
13,
17,
4,
13,
0,
13,
13,
0,
18,
18,
18,
13,
17,
17,
17,
17,
28,
13,
4,
13,
13,
0,
... | [
[
154,
4
],
[
154,
17
],
[
154,
18
],
[
24,
23
],
[
152,
25
],
[
155,
26
],
[
30,
29
],
[
155,
33
],
[
39,
38
],
[
48,
41
],
[
38,
44
],
[
51,
50
],
[
155,
53
],
... | [
"import sys\n\nn, a, *x = map(int, sys.stdin.read().split())\n\ndef main():\n ma = a * n\n res = [[[0] * (ma + 1) for _ in range(n + 1)] for _ in range(n + 1)]\n res[0][0][0] = 1\n for i in range(n):\n cur = x[i]\n for j in range(i+2):\n for k in range(ma + 1):\n ... | import sys
n, a, *x = map(int, sys.stdin.read().split())
def main():
ma = a * n
res = [[[0] * (ma + 1) for _ in range(n + 1)] for _ in range(n + 1)]
res[0][0][0] = 1
for i in range(n):
cur = x[i]
for j in range(i+2):
for k in range(ma + 1):
res[i+1][j][k] +=... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
2,
2,
4,
13,
13,
13,
17,
2,
2,
13,
13,
17,
41,
28,
13,
4,
13,
2,
13,
17,
4,
13,
0,
13,
13,
0,
18,
18,
18... | [
[
144,
2
],
[
144,
11
],
[
129,
13
],
[
138,
25
],
[
130,
32
],
[
145,
33
],
[
127,
37
],
[
145,
38
],
[
43,
42
],
[
145,
46
],
[
135,
51
],
[
61,
54
],
[
136,
57
... | [
"n,a=map(int,input().split())\nx=list(map(int,input().split()))\nl=max(max(x)*n+3,a*n+3)\ndp=[[l*[0]for _ in range(n+1)]for _ in range(n+1)]\ndp[0][0][0]=1\nfor i in range(1,n+1):\n for j in range(i+1):\n for k in range(l):dp[i][j][k]=dp[i-1][j][k]\n for j in range(1,i+1):\n for k in range(x[i-1],l):dp[i][j... | n,a=map(int,input().split())
x=list(map(int,input().split()))
l=max(max(x)*n+3,a*n+3)
dp=[[l*[0]for _ in range(n+1)]for _ in range(n+1)]
dp[0][0][0]=1
for i in range(1,n+1):
for j in range(i+1):
for k in range(l):dp[i][j][k]=dp[i-1][j][k]
for j in range(1,i+1):
for k in range(x[i-1],l):dp[i][j][k]+=dp[i-1][... |
[
7,
15,
13,
12,
13,
41,
28,
13,
4,
13,
13,
4,
2,
18,
13,
13,
13,
0,
13,
13,
41,
28,
13,
4,
13,
2,
13,
17,
4,
2,
39,
17,
17,
0,
13,
13,
0,
18,
18,
13,
17,
17,
17,
28,
13,
4,
13,
17,
2,
13,
17,
28,
13,
4,
13,
... | [
[
8,
7
],
[
127,
10
],
[
131,
14
],
[
7,
15
],
[
129,
16
],
[
19,
18
],
[
23,
22
],
[
127,
26
],
[
35,
34
],
[
42,
37
],
[
34,
39
],
[
45,
44
],
[
127,
49
],
[
... | [
"#!/usr/bin/env python3\nimport sys\n# dp[j][t]=(y1,...,yj から 0 枚以上選んで yi の合計を t − 1250 にするような選び方の総数)\n\ndef solve(N: int, A: int, x: \"List[int]\"):\n x = [x[i]-A for i in range(N)]\n dp = [[0]*2500 for _ in range(N+1)]\n dp[0][1250] = 1\n\n for j in range(1,N+1):\n for t in range(2500):\n ... | #!/usr/bin/env python3
import sys
# dp[j][t]=(y1,...,yj から 0 枚以上選んで yi の合計を t − 1250 にするような選び方の総数)
def solve(N: int, A: int, x: "List[int]"):
x = [x[i]-A for i in range(N)]
dp = [[0]*2500 for _ in range(N+1)]
dp[0][1250] = 1
for j in range(1,N+1):
for t in range(2500):
if t-x[j-1]>... |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
13,
0,
13,
4,
13,
13,
13,
28,
13,
4,
13,
13,
0,
18,
13,
13,
13,
41,
28,
13,
4,
13,
2,
13,
17,
4,
... | [
[
168,
2
],
[
168,
11
],
[
171,
13
],
[
180,
27
],
[
172,
30
],
[
177,
32
],
[
181,
35
],
[
169,
36
],
[
39,
38
],
[
166,
41
],
[
46,
43
],
[
172,
44
],
[
38,
45
... | [
"#想定解法\nN, A = map(int, input().split())\nX = sorted(list(map(int, input().split())))\nxm = max(X)\nxm = max(xm, A)\nfor i in range(N):\n X[i] -= A \n#print(X, xm)\ndp = [[0] * (2 * N * xm + 1) for i in range(N + 1)]\ndp[0][N * xm] = 1\n\nfor i in range(1, N + 1):\n for j in range(2 * N * xm + 1):\n if 0 <= j ... | #想定解法
N, A = map(int, input().split())
X = sorted(list(map(int, input().split())))
xm = max(X)
xm = max(xm, A)
for i in range(N):
X[i] -= A
#print(X, xm)
dp = [[0] * (2 * N * xm + 1) for i in range(N + 1)]
dp[0][N * xm] = 1
for i in range(1, N + 1):
for j in range(2 * N * xm + 1):
if 0 <= j - X[i - 1] <= 2 * ... |
[
7,
12,
13,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
13,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
41,
28,
13,
4,
13,
2,
13,
17,
4,
13,
0,
13,
13,
0,
18,
18,
18,
13,
17,
17,
17,
17... | [
[
6,
5
],
[
5,
14
],
[
17,
16
],
[
17,
18
],
[
22,
21
],
[
21,
30
],
[
33,
32
],
[
37,
36
],
[
16,
40
],
[
46,
45
],
[
55,
48
],
[
45,
51
],
[
58,
57
],
[
1... | [
"def main():\n N, A = (int(i) for i in input().split())\n X = [int(i) for i in input().split()]\n dp = [[[0 for s in range(N*A + 1)] for k in range(N + 1)]\n for j in range(N + 1)]\n dp[0][0][0] = 1\n for j in range(1, N+1):\n for k in range(0, N+1):\n for s in range(N*A + ... | def main():
N, A = (int(i) for i in input().split())
X = [int(i) for i in input().split()]
dp = [[[0 for s in range(N*A + 1)] for k in range(N + 1)]
for j in range(N + 1)]
dp[0][0][0] = 1
for j in range(1, N+1):
for k in range(0, N+1):
for s in range(N*A + 1):
... |
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
2,
39,
17,
13,
28,
13,
4,
13,
13,
0,
18,
13,
13,
2,
18,
13,
13,
13,
0,
13,
4,
13,
39,
17,
18,
13,
17,
28,
13,... | [
[
104,
3
],
[
104,
12
],
[
95,
14
],
[
107,
26
],
[
105,
30
],
[
33,
32
],
[
105,
35
],
[
40,
37
],
[
108,
38
],
[
32,
39
],
[
96,
42
],
[
32,
43
],
[
93,
44
],
... | [
"from collections import Counter\n\nN, A = map(int, input().split())\nX = list(map(int, input().split()))\n\nX2 = [0]*N\n\nfor i in range(N):\n X2[i] = X[i] - A\n\nC = Counter([0, X2[0]])\n\nfor x in X2[1:]:\n C2 = Counter()\n for s, c in C.items():\n C2[s+x] += c\n C += C2\n\nprint(C[0]-1)",
"... | from collections import Counter
N, A = map(int, input().split())
X = list(map(int, input().split()))
X2 = [0]*N
for i in range(N):
X2[i] = X[i] - A
C = Counter([0, X2[0]])
for x in X2[1:]:
C2 = Counter()
for s, c in C.items():
C2[s+x] += c
C += C2
print(C[0]-1)
|
[
7,
15,
13,
12,
13,
41,
28,
13,
4,
13,
13,
4,
2,
39,
13,
13,
12,
13,
23,
13,
23,
13,
23,
13,
41,
28,
13,
4,
13,
13,
4,
13,
12,
13,
23,
13,
23,
13,
23,
13,
23,
13,
41,
28,
13,
4,
13,
13,
4,
13,
12,
13,
23,
13,
... | [
[
8,
7
],
[
19,
19
],
[
21,
21
],
[
23,
23
],
[
27,
26
],
[
35,
35
],
[
37,
37
],
[
39,
39
],
[
41,
41
],
[
45,
44
],
[
53,
53
],
[
55,
55
],
[
57,
57
],
[
... | [
"# -*- coding: utf-8 -*-\n\nimport sys\n\ndef input(): return sys.stdin.readline().strip()\ndef list2d(a, b, c): return [[c] * b for i in range(a)]\ndef list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]\ndef list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for ... | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a... |
[
7,
12,
13,
0,
13,
4,
13,
13,
0,
13,
4,
13,
0,
13,
2,
4,
13,
13,
13,
41,
28,
13,
4,
13,
2,
13,
17,
4,
13,
0,
13,
13,
0,
18,
18,
18,
13,
17,
17,
17,
17,
28,
13,
4,
13,
17,
2,
13,
17,
0,
13,
18,
13,
2,
13,
17,... | [
[
5,
4
],
[
5,
7
],
[
10,
9
],
[
14,
13
],
[
9,
17
],
[
4,
18
],
[
22,
21
],
[
4,
25
],
[
31,
30
],
[
40,
33
],
[
30,
36
],
[
43,
42
],
[
4,
47
],
[
51,
... | [
"def examC():\n N, A = LI()\n x = LI()\n maxNX = max(x)*N\n dp = [[[0]*(maxNX+1) for _ in range(N+1)]for _ in range(N+1)]\n dp[0][0][0] = 1\n for i in range(1,N+1):\n cur = x[i-1]\n for l in range(N+1):\n for j in range(maxNX + 1):\n dp[l][i][j] += dp[l][i -... | def examC():
N, A = LI()
x = LI()
maxNX = max(x)*N
dp = [[[0]*(maxNX+1) for _ in range(N+1)]for _ in range(N+1)]
dp[0][0][0] = 1
for i in range(1,N+1):
cur = x[i-1]
for l in range(N+1):
for j in range(maxNX + 1):
dp[l][i][j] += dp[l][i - 1][j]
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.