input
stringlengths
20
127k
target
stringlengths
20
119k
problem_id
stringlengths
6
6
k, s = list(map(int, input().split())) ans = 0 for i in range(k + 1): for j in range(k + 1): if i + j == s: ans += 1 elif 0 <= s - (i + j) <= k: ans += 1 print(ans)
k,s = list(map(int, input().split())) ans = 0 for x in range(k+1): for y in range(k+1): if x + y > s: break if s - x - y <= k: ans += 1 print(ans)
p03835
k,s = list(map(int,input().split())) count = 0 for i in range(0,k+1): for j in range(0,k+1): x = i y = j z = s-i-j ##print("X=" + str(x),"Y=" + str(y),"Z="+ str(z)) if 0<= z <= k: count+=1 print(count)
k,s = list(map(int,input().split())) count = 0 for i in range(0,k+1): for j in range(0,k+1): x = i y = j z = s-i-j if 0<= z <= k: count+=1 print(count)
p03835
k, s = list(map(int,input().split())) # print(k) # print(s) # 組み合わせをカウントする変数 count = 0 # 変数の初期化 x = 0 y = 0 z = 0 for x in range(k+1): for y in range(k+1): for z in range(k+1): if x + y + z == s: count += 1 print(count)
k, s = list(map(int,input().split())) # print(k) # print(s) # 組み合わせをカウントする変数 count = 0 # 変数の初期化 x = 0 y = 0 z = 0 for x in range(k+1): for y in range(k+1): z = s - x - y if z >= 0 and z <= k: count += 1 print(count)
p03835
k,s=list(map(int,input().split())) print(([x+y+z for z in range(k+1) for y in range(k+1) for x in range(k+1)].count(s)))
k,s=list(map(int,input().split())) print((len([1 for z in range(k+1) for y in range(k+1) if 0<=s-z-y<=k])))
p03835
import itertools K,S = list(map(int,input().split())) c = 0 for i in range(K+1): for j in range(K+1): for k in range(K+1): if i+j+k == S: c += 1 print(c)
K,S = list(map(int,input().split())) c = 0 for i in range(K+1): for j in range(K+1): if 0 <= S-(i+j) <= K: c += 1 print(c)
p03835
K, S = list(map(int, input().split())) count = 0 for x in range(K + 1): for y in range(K + 1): for z in range(K + 1): if x + y + z == S: count += 1 print(count)
K, S = list(map(int, input().split())) count = 0 for x in range(K + 1): for y in range(K + 1): z = S - x - y if z >= 0 and z <= K: count += 1 print(count)
p03835
K, S = list(map(int, input().split())) ans = 0 for x in range(K+1): for y in range(K+1): for z in range(K+1): if x + y + z == S: ans += 1 print(ans)
K, S = list(map(int, input().split())) ans = 0 for x in range(K+1): for y in range(K+1): z = S - x - y if K >= S - x - y and z >= 0: ans += 1 print(ans)
p03835
from itertools import product as prod k, s = [int(x) for x in input().split()] x = list(range(k + 1)) y = list(range(k + 1)) z = list(range(k + 1)) c = 0 for x, y, z in prod(x, y, z): if x + y + z == s: c += 1 print(c)
from itertools import product as prod k, s = [int(x) for x in input().split()] x = list(range(k + 1)) y = list(range(k + 1)) c = 0 for x, y in prod(x, y): if 0 <= s - x - y <= k: c += 1 print(c)
p03835
K,S=list(map(int, input().split())) count = 0 for x in range(min([K+1,S+1])): for y in range(min([K+1,S+1-x])): for z in range(min([K+1,S+1-x-y])): if x+y+z == S: count = count + 1 print(count)
K,S=list(map(int, input().split())) count = 0 for x in range(min([K+1,S+1])): for y in range(min([K+1,S+1-x])): if S-x-y<=K: count = count + 1 print(count)
p03835
K,S=list(map(int, input().split())) n=0 for x in range(K+1): for y in range (K+1): for z in range(K+1): if x+y+z==S: n+=1 print(n)
K,S=list(map(int, input().split())) n=0 for x in range(K+1): for y in range (K+1): if 0<=S-x-y<=K: n+=1 print(n)
p03835
import itertools k,s = [int(x) for x in input().split()] ans = 0 for i in range(k+1): for j in range(k+1): if s - i - j >= 0 and s - i - j <= k: ans += 1 print(ans)
k,s = [int(x) for x in input().split()] ans = 0 for x in range(k+1): for y in range(k+1): if 0 <= s - (x+y) <= k: ans += 1 print(ans)
p03835
k, s = [int(x) for x in input().split()] count = 0 for x in range(k+1): if x <= s: for y in range(k+1): if x + y <= s: z = s - (x + y) if z <= k: count += 1 print(count)
K, S = [int(x) for x in input().split()] count = 0 for x in range(K+1): # y + z = S - x if 0 <= S - x <= K: count += S - x + 1 # yに選べるのは0から(y+z)までのy+z-0+1通りすなわちS-x+1 elif K < S - x <= 2 * K: count += 2 * K - S + x + 1 # K - ((S - x) - K) + 1 # excess = (S...
p03835
# author: kagemeka # created: 2019-11-08 23:31:18(JST) ### modules ## from standard library import sys # import collections # import math # import string # import bisect # import re # import itertools # import statistics # import functools # import operator...
# author: kagemeka # created: 2019-11-08 23:31:18(JST) ### modules ## from standard library import sys # import collections # import math # import string # import bisect # import re # import itertools # import statistics # import functools # import operator...
p03835
k, s = list(map(int, input().split())) count = 0 for i in range(k + 1): for j in range(k + 1): for l in range(k + 1): if i + j + l == s: count += 1 print(count)
k, s = list(map(int, input().split())) count = 0 for i in range(k + 1): for j in range(k + 1): l = s - i - j if l >= 0 and l <= k: count += 1 print(count)
p03835
k, s = list(map(int, input().split())) count = 0 for x in range(k+1): for y in range(k+1): for z in range(k+1): if x + y + z == s: count += 1 print(count)
k, s = list(map(int, input().split())) count = 0 for x in range(k+1): for y in range(k+1): z = s - x - y if 0<= z <= k: count += 1 print(count)
p03835
#!/usr/bin/env python3 # coding:utf-8 def main(): stdIn1, stdIn2 = list(map(int, input().split())) stdOut = solve(stdIn1, stdIn2) print(stdOut) """ 方針 x,y,zそれぞれを3重ループで0からkまで回す (O(N^3)だが、k<=2500なので気にならない) x+y+zが等しければパターンを1追加 TLEになったので、もう少し節約するパターンを考える必要あり ひとまずx,x+y,x+y+zがsより大きなった場合はbreakさ...
#!/usr/bin/env python3 # coding:utf-8 def main(): stdIn1, stdIn2 = list(map(int, input().split())) stdOut = solve(stdIn1, stdIn2) print(stdOut) """ 方針 x,y,zそれぞれを3重ループで0からkまで回す (O(N^3)だが、k<=2500なので気にならない) x+y+zが等しければパターンを1追加 TLEになったので、もう少し節約するパターンを考える必要あり ひとまずx,x+y,x+y+zがsより大きなった場合はbreakさ...
p03835
K,S=input().split() K=int(K) S=int(S) A=0 for x in range(0,K+1): for y in range(0,K+1): for z in range(0,K+1): if x+y+z==S: A=A+1 print(A)
K,S=input().split() K=int(K) S=int(S) A=0 for x in range(0,K+1): for y in range(0,K+1): z=S-x-y if 0<=z<=K: A=A+1 print(A)
p03835
K, S = list(map(int, input().split())) ct = 0 for X in range(K+1): if S - X > 0: for Y in range(K+1): if S - (X + Y) > 0: for Z in range(K+1): ct += (1 if X + Y + Z == S else 0) else: ct += (1 if X + Y == S else 0) else: ct += (1 if X == S else 0) print(ct)
K, S = list(map(int, input().split())) ct = 0 for X in range(K+1): for Y in range(K+1): if S - (X + Y) >= 0 and S - (X + Y) <= K : ct += 1 print(ct)
p03835
K, S = list(map(int, input().split())) ct = 0 for X in range(K+1): for Y in range(K+1): if S - (X + Y) >= 0 and S - (X + Y) <= K : ct += 1 print(ct)
K, S = list(map(int, input().split())) ans = 0 for Z in range(K+1): r = S - Z if r < 0: ans += 0 elif r <= K: ans += r+1 elif r <= K*2: ans += (K+1)*2 - (r+1) print(ans)
p03835
import math K,S = list(map(int, input().split())) n = 0 up = math.floor(K) for i in range(up+1): for j in range(i,up+1): for k in range(j,up+1): if i==j and j==k: same=1 elif (i==j and j!=k)or(j==k and i!=j) or(k ==i and i!=j): same =3 ...
import math import sys input = sys.stdin.readline K,S = list(map(int, input().split())) n = 0 up = math.floor(K) for i in range(0,K+1): for j in range(0, K+1): if(0<= S-i-j <=K): n +=1 else: n =n print(n)
p03835
k, s = list(map(int, input().split())) count = 0 for x in range(k+1): for y in range(k+1): for z in range(k+1): if x + y + z == s: count += 1 print(count)
k, s = list(map(int, input().split())) count = 0 for x in range(k+1): for y in range(k+1): z = s - x - y if 0 <= z and z <= k: count += 1 print(count)
p03835
K, S = list(map(int, input().split())) count = 0 for X in range(K+1): for Y in range(K+1): for Z in range(K+1): if X + Y + Z == S: count += 1 print(count)
K, S = list(map(int, input().split())) count = 0 for X in range(K+1): for Y in range(K+1): Z = S - X - Y if 0 <= Z <= K: count += 1 print(count)
p03835
K, S = list(map(int, input().split())) ans = 0 for X in range(K+1): for Y in range(K+1): for Z in range(K+1): if (X + Y + Z == S): ans += 1 print(ans)
K, S = list(map(int, input().split())) ans = 0 for X in range(K + 1): for Y in range(K + 1): Z = S - X - Y if (Z >= 0 and Z <= K): ans += 1 print(ans)
p03835
k, s = list(map(int, input().split())) ans1 = 0 ans2 = 0 ans3 = 0 for i in range(k+1): for j in range(i, k+1): for l in range(j, k+1): if i + j + l == s: if i == j == l: ans1 +=1 elif i == l or i == j or j == l: ...
k, s = list(map(int, input().split())) ans1 = 0 ans2 = 0 ans3 = 0 for i in range(k+1): for j in range(i, k+1): if 0 <= s-i-j <= k and j <= s-i-j: if i == j == s-i-j: ans1 +=1 elif i == s-i-j or i == j or j == s-i-j: ans2 += 1 ...
p03835
K,S=list(map(int,input().split())) cnt=0 for x in range(K+1): for y in range(K+1): for z in range(K+1): if S==(x+y+z): cnt+=1 print(cnt)
K,S=list(map(int,input().split())) cnt=0 for x in range(K+1): for y in range(K+1): if 0<=(S-(x+y))<=K: cnt+=1 print(cnt)
p03835
k, s = list(map(int, input().split())) cnt = 0 for i in range(k+1): for j in range(k+1): for k in range(k+1): if i+j+k==s: cnt+=1 print(cnt)
k, s = list(map(int, input().split())) cnt = 0 for i in range(k+1): for j in range(k+1): if i+j<=s and s-(i+j)<=k: cnt+=1 print(cnt)
p03835
import itertools K, S = list(map(int, input().split())) print((sum([len(set(itertools.permutations(l, 3))) for l in itertools.combinations_with_replacement(list(range(K+1)), 3) if sum(l) == S])))
K, S = list(map(int, input().split())) R = 0 for X in range(max(0, S-2*K), K+1): for Y in range(max(0, S-X-K), K+1): if X + Y <= S: R += 1 print(R)
p03835
k,s=list(map(int,input().split())) ans=0 for i in range(k+1): for j in range(k+1): for l in range(k+1): if (i+j+l)==s: ans+=1 print(ans)
k,s=list(map(int,input().split())) ans=0 for i in range(k+1): for j in range(k+1): if (s-k<=i+j<=s): ans+=1 print(ans)
p03835
k, s = list(map(int, input().split())) ans = 0 for x in range(k+1): for y in range(k+1): for z in range(k+1): if x + y + z == s: ans += 1 print(ans)
k, s = list(map(int, input().split())) ans = 0 for x in range(k+1): for y in range(k+1): if 0 <= s - x - y <= k: ans += 1 # print(x, y, s - x - y) print(ans)
p03835
k,s=list(map(int,input().split(" "))) c=0 for i in range(k+1): for j in range(k+1): if i+j>s: break for l in range(k+1): if i+j+l==s: c+=1 if i+j+l>s: break print(c)
k,s=list(map(int,input().split(" "))) c=0 for i in range(k+1): for j in range(k+1): if s-i-j<=k and s-i-j>=0: c+=1 print(c)
p03835
k, s = list(map(int, input().split())) count = 0 for x in range(k+1): for y in range(k+1): for z in range(k+1): if x + y + z == s: count += 1 print(count)
k, s = list(map(int, input().split())) count = 0 for x in range(k+1): for y in range(k+1): if 0<= s - x - y <= k: count += 1 print(count)
p03835
K, S = list(map(int, input().split())) ans = 0 for x in range(K+1): for y in range(K+1): for z in range(K+1): if x+y+z==S: ans += 1 print(ans)
K, S = list(map(int, input().split())) ans = 0 for x in range(K+1): for y in range(K+1): if 0 <= S-x-y <= K: ans += 1 print(ans)
p03835
K, S = list(map(int, input().split())) # ok_list = [] cnt = 0 for x in range(K + 1): if S - x > K: y_max = K + 1 else: y_max = S - x + 1 for y in range(y_max): if S - x - y > K: z_max = K + 1 else: z_max = S - x - y + 1 for z in ...
K, S = list(map(int, input().split())) # ok_list = [] cnt = 0 for x in range(K + 1): if S - x > K: y_max = K + 1 else: y_max = S - x + 1 if S - x > 2 * K: continue else: # print(y_max, end=" ") pass for y in range(y_max): if S - (x ...
p03835
k, s = list(map(int, input().split())) c = 0 for x in range(k + 1): for y in range(k + 1): if 0 <= s - x - y and s - x - y <= k: c += 1 print(c)
k, s = list(map(int, input().split())) ans = 0 for x in range(k + 1): for y in range(k + 1): z = s - x - y if 0 <= z and z <= k: ans += 1 print(ans)
p03835
k,s=list(map(int,input().split())) count=0 for i in range(0,k+1): for j in range(0,k+1): for k in range(0,k+1): if i+j+k==s: count+=1 print(count)
k,s=list(map(int,input().split())) count=0 for x in range(0,k+1): for y in range(0,k+1): z=s-x-y if 0<=z<=k: count+=1 print(count)
p03835
K, S = list(map(int, (input().split()))) ans = 0 for x in range(0, K + 1): for y in range(0, K + 1): for z in range(0, K + 1): if x + y + z == S: ans += 1 print(ans)
K, S = list(map(int, (input().split()))) ans = 0 for x in range(0, K + 1): for y in range(0, K + 1): z = S - x - y if z <= K and z >= 0: ans += 1 print(ans)
p03835
k,s = list(map(int, input().split())) count = 0 for i in range(k+1): if s-i > k: rang = k else: rang = s-i for j in range(rang+1): if s-i-j < 0: continue elif s-i-j > k: rangg = k else: rang = s-i-j for h in ...
k,s = list(map(int, input().split())) count = 0 for i in range(k+1): for j in range(k+1): if s-i-j > k or s-i-j < 0: continue else: count += 1 print(count)
p03835
k, s = list(map(int, input().split())) ans = 0 for x in range(k + 1): for y in range(k + 1): for z in range(k + 1): if x + y + z == s: ans += 1 print(ans)
k, s = list(map(int, input().split())) ans = 0 for x in range(k + 1): for y in range(k + 1): if 0 <= s - x - y <=k: ans += 1 print(ans)
p03835
k, s = list(map(int, input().split())) count = 0 for i in range(k + 1): for j in range(k + 1): for l in range(k + 1): x = i y = j z = l if i + j + l == s: count += 1 print(count)
k, s = list(map(int, input().split())) count = 0 for i in range(k + 1): for j in range(k + 1): if 0 <= s - i - j <= k: count += 1 print(count)
p03835
import itertools K, S = list(map(int, input().split())) ans = 0 for i in itertools.product(list(range(S+1)), repeat=2): if all([j <= K for j in i]): Z = S - sum(i) if 0 <= Z <= K: ans += 1 print(ans)
import itertools K, S = list(map(int, input().split())) ans = 0 for i in itertools.product(list(range(K+1)), repeat=2): Z = S - sum(i) if 0 <= Z <= K: ans += 1 print(ans) # for x in range(K+1): # for y in range(K+1): # z = S - x - y # if 0 <= z <= K: # ans += 1
p03835
k, s = list(map(int, input().split())) cnt = 0 for x in range(k+1): for y in range(k+1): for z in range(k+1): if x+y+z == s: cnt += 1 print(cnt)
k, s = list(map(int, input().split())) cnt = 0 for x in range(k+1): for y in range(k+1): if s-k <= x+y <= s: cnt += 1 print(cnt)
p03835
k, s = list(map(int,input().split())) ans = 0 for i in range(k + 1): for j in range(k + 1): for m in range(k + 1): if i + j + m == s: ans += 1 print(ans)
k, s = list(map(int,input().split())) ans = 0 for i in range(k + 1): for j in range(k + 1): z = s - (i + j) if z >= 0 and z <= k: ans += 1 print(ans)
p03835
K,S = list(map(int,input().split())) ans = 0 for x in range(K+1): for y in range(K+1): z = S-(x+y) if 0 <= z and z <= K: ans += 1 print(ans)
# python3 (3.4.3) import sys input = sys.stdin.readline # main K,S = list(map(int,input().split())) ans = 0 for x in range(K+1): for y in range(K+1): if 0 <= S-(x+y) <= K: ans += 1 print(ans)
p03835
K, S = list(map(int, input().split())) count = 0 for i in range(S + 1): X = S - i for j in range(i + 1): Y = j Z = S - X - Y if K >= X >= 0 and K >= Y >= 0 and K >= Z >= 0: count += 1 print(count)
K, S = list(map(int, input().split())) count = 0 for i in range(K + 1): for j in range(K + 1): Z = S - i - j if K >= Z >= 0: count += 1 print(count)
p03835
k,s = list(map(int,input().split())) c = 0 for x in range(k+1): for y in range(k+1): for z in range(k+1): if x+y+z==s: c += 1 print(c)
k,s = list(map(int,input().split())) c = 0 for x in range(k+1): for y in range(k+1): if 0<=s-x-y<=k: c += 1 print(c)
p03835
K, S = list(map(int, input().split())) ans =0 for i in range(K+1): for j in range(K+1): for k in range(K+1): if i+j+k == S: ans += 1 print(ans)
K, S = list(map(int, input().split())) ans =0 for i in range(K+1): for j in range(K+1): if S-i-j<=K and S-i-j>=0: ans += 1 print(ans)
p03835
K, S = [int(a) for a in input().split()] cnt = 0 for x in range(0,K+1): if x > S: continue for y in range(0,K+1): if x+y > S: continue for z in range(0,K+1): check = x+y+z if check == S: cnt += 1 elif check > S: continue print(cnt)
K, S = [int(a) for a in input().split()] cnt = 0 for x in range(0,K+1): if x > S: continue for y in range(0,K+1): if x+y > S: continue elif x+y+K < S: continue else: cnt +=1 print(cnt)
p03835
X = [int(e) for e in input().split()] ans = 0 for i in range(0,X[0]+1): for k in range(0,X[0]+1): for j in range(0,X[0]+1): if(i + k + j)==X[1]: ans += 1 break print(ans)
X = [int(e) for e in input().split()] ans = 0 for i in range(0,X[0]+1): for k in range(0,X[0]+1): if(X[1] - (i+k))<=X[0] and X[1] - i - k >= 0: ans += 1 print(ans)
p03835
K, S = list(map(int,input().split())) ans = 0 for i in range(K+1): for j in range(K+1): if 0<=i<=K and 0<=S-i-j<=K and 0<=j<=K: ans += 1 # print(i, j, S-i-j, ans) print(ans)
K, S = list(map(int,input().split())) ans = 0 for i in range(K+1): for j in range(K+1): if 0<=S-i-j<=K: ans += 1 # print(i, j, S-i-j, ans) print(ans)
p03835
K, S = list(map(int, input().split())) x,y,z = 0,0,0 ans = 0 for i in range(K+1): x = i for j in range(S-i+1): y = j z = S - x - y if x + y + z == S and 0 <= x <= K and 0 <= y <= K and 0 <= z <= K: ans += 1 print(ans)
K, S = list(map(int, input().split())) x,y,z = 0,0,0 ans = 0 for i in range(K+1): x = i for j in range(K+1): y = j z = S - x - y if 0 <= z <= K: ans += 1 print(ans)
p03835
k,s = list(map(int,input().split())) l = [a+b+c for a in range(k+1) for b in range(k+1) for c in range(k+1)] print((l.count(s)))
k,s = list(map(int,input().split())) l = [a+b for a in range(k+1) for b in range(k+1)] sum = 0 for i in range(k+1): sum += l.count(s-i) print(sum)
p03835
k,s = list(map(int, input().split())) ans = 0 x = list(range(k + 1)) y = list(range(k + 1)) z = list(range(k + 1)) for i in x: for j in y: for k in z: if s - i - j <= (k+1) and i + j + k == s: ans += 1 print(ans)
k,s = list(map(int, input().split())) ans = 0 x = list(range(k + 1)) y = list(range(k + 1)) z = list(range(k + 1)) for i in x: for j in y: if 0 <= s - i - j <= k: ans += 1 print(ans)
p03835
k,s = list(map(int, input().split())) ans = 0 x = list(range(k + 1)) y = list(range(k + 1)) z = list(range(k + 1)) for i in x: for j in y: if 0 <= s - i - j <= k: ans += 1 print(ans)
k,s = list(map(int, input().split())) ans = 0 x = list(range(k + 1)) y = list(range(k + 1)) for i in x: for j in y: if 0 <= s - i - j <= k: ans += 1 print(ans)
p03835
#! env python # -*- coding: utf-8 -*- import os import sys # ac_py.main # Date: 2020/06/16 # Filename: main # Author: acto_mini def main(): K, S = list(map(int, input().split())) ans = 0 for i in range(K + 1): for j in range(K + 1): for p in range(K + 1): ...
#! env python # -*- coding: utf-8 -*- import os import sys # ac_py.main # Date: 2020/06/16 # Filename: main # Author: acto_mini def main(): K, S = list(map(int, input().split())) ans = 0 for i in range(K + 1): for j in range(K + 1): if 0 <= (S - i - j) <= K: ...
p03835
k, s = list(map(int, input().split())) cnt = 0 for i in range(k + 1): for j in range(k + 1): for l in range(k + 1): if i + j + l == s: cnt += 1 print(cnt)
k, s = list(map(int, input().split())) cnt = 0 for i in range(k + 1): for j in range(k + 1): if 0 <= s - (i + j) <= k: cnt += 1 print(cnt)
p03835
a = input().split() k = int(a[0]) s = int(a[1]) count = 0 for x in range(k + 1): for y in range(k + 1): for z in range(k + 1): if x + y + z == s: count = count + 1 print(count)
a = input().split() k = int(a[0]) s = int(a[1]) count = 0 for x in range(k + 1): if x > s: break for y in range(k + 1): if x + y > s: break else: if (k + 1) > (s - x - y): # print(x, y, (s - x - y)) count = count + ...
p03835
k,s = list(map(int,input().split())) a = 0 for x in range(k+1): for y in range(x,k+1): for z in range(y,k+1): if x+y+z == s: if x != y and y != z and z != x: a += 6 elif (x == y and y != z) or (x == z and z != y) or (z == y and y!= x): a += 3 else: ...
k,s = list(map(int,input().split())) a = 0 for x in range(k+1): for y in range(k+1): if s-(x+y) <= k and s-(x+y) >= 0: a += 1 print(a)
p03835
K,S= list(map(int, input().split())) ans=0 for i in range(S//3,K+1): for j in range(i+1): if i+j>S: break if i+j*2<S: continue for k in range(j+1): if i+j+k==S: if i==j==k: ans+=1 elif i==j or...
K,S= list(map(int, input().split())) ans=0 for i in range(S//3,K+1): for j in range(i+1): if i+j>S: break if i+j*2<S: continue if S-i-j<=j: k=S-i-j if i==j==k: ans+=1 elif i==j or j==k: a...
p03835
def spline(func=int, iter_=None): if iter_ is None: iter_ = input().split() return list(map(func, iter_)) def parg(**kwargs): text = '' for item in list(kwargs.items()): if text: text += ',\t' text += '{}: {}'.format(*item) print(text) K, S = sp...
def spline(func=int, iter_=None): if iter_ is None: iter_ = input().split() return list(map(func, iter_)) K, S = spline() count = 0 k = K + 1 for x in range(k): for y in range(k): z = S - x - y if 0 <= z <= K: count += 1 print(count)
p03835
def spline(func=int, iter_=None): if iter_ is None: iter_ = input().split() return list(map(func, iter_)) K, S = spline() count = 0 k = K + 1 for x in range(k): for y in range(k): z = S - x - y if 0 <= z <= K: count += 1 print(count)
K, S = list(map(int, input().split())) k = K + 1 ans = 0 for x in range(k): for y in range(k): z = S - (x + y) if 0 <= z <= K: ans += 1 print(ans)
p03835
# coding: utf-8 K, S = list(map(int, input().split())) ans = 0 for i in range(K + 1): if S > 2 * K + i: continue for j in range(K + 1): if S > K + i + j: continue for k in range(K + 1): if i + j + k == S: ans += 1 print(ans)
# coding: utf-8 K, S = list(map(int, input().split())) ans = 0 for i in range(K + 1): if S - i > 2 * K: continue elif S - i < 0: break if S - i > K: ans += 2 * K + 1 - S + i else: ans += S - i + 1 print(ans)
p03835
k, s = list(map(int, input().split())) cnt = 0 for x in range(k + 1): for y in range(k + 1): for z in range(k + 1): if s == x + y + z: cnt += 1 print(cnt)
k, s = list(map(int, input().split())) cnt = 0 for x in range(k + 1): for y in range(k + 1): z = s - x - y if 0 <= z <= k: cnt += 1 print(cnt)
p03835
K, S = list(map(int, input().split())) count = 0 for x in range(0,K+1): for y in range(0,K+1): for z in range(0,K+1): if S == x + y + z: count = count + 1 print(count)
K, S = list(map(int, input().split())) count = 0 for x in reversed(list(range(0,K+1))): for y in reversed(list(range(0,K+1))): z = S - x - y if z >= 0 and z <= K: count = count + 1 print(count)
p03835
k, s = list(map(int,input().split())) count=0 for X in range(k+1): for Y in range(k+1): for Z in range(k+1): if X + Y + Z == s: count+=1 print(count)
k, s = list(map(int,input().split())) count=0 for X in range(k+1): for Y in range(k+1): Z = s - X - Y if k>=Z>=0: count+=1 print(count)
p03835
K, S = list(map(int, input().split())) cnt = 0 for x in range(K+1): for y in range(K+1): for z in range(K+1): if x + y + z == S: cnt += 1 print(cnt)
K, S = list(map(int, input().split())) cnt = 0 for x in range(K+1): for y in range(K+1): if 0 <= S - x - y <= K: cnt += 1 print(cnt)
p03835
if __name__ == '__main__': k, s = list(map(int, input().split())) ans = 0 for i in range(k+1): if i > s: break for j in range(k+1): if i + j > s: break for l in range(k+1): if i+j+l == s: ans +...
if __name__ == '__main__': k, s = list(map(int, input().split())) ans = 0 for i in range(k+1): if i > s: break for j in range(k+1): z = s - i - j if i + j > s: break elif 0 <= z and z <= k: ans += 1 ...
p03835
if __name__ == '__main__': k, s = list(map(int, input().split())) ans = 0 for i in range(k+1): if i > s: break for j in range(k+1): z = s - i - j if i + j > s: break elif 0 <= z and z <= k: ans += 1 ...
if __name__ == '__main__': k, s = list(map(int, input().split())) ans = 0 for i in range(k+1): for j in range(k+1): if 0 <= (s - i - j) and (s - i - j) <= k: ans += 1 print(ans)
p03835
k, s = list(map(int, input().split())) count = 0 c1 = s for i in range(k+1): if 0 <= s-i <= 2*k: for j in range(0, k+1): if 0<= s-i-j <= k: for l in range(0,k+1): if i + j + l == s: count += 1 print(count)
k, s = list(map(int, input().split())) cnt = 0 for i in range(k+1): for j in range(k+1): if 0<= s-i-j <= k: cnt += 1 print(cnt)
p03835
K,S = list(map(int,input().split())) answer = 0 for i in range(K+1): for j in range(K+1): for q in range(K+1): if i+j+q == S: answer+=1 print(answer)
K,S = list(map(int,input().split())) answer = 0 for i in range(K+1): for j in range(K+1): if 0 <= S-i-j and S-i-j <= K: answer+=1 print(answer)
p03835
import itertools k, s = list(map(int, input().split())) data = [i for i in range(k + 1)] # print(data) dd = itertools.product(data, repeat=3) # print(dd) dd = list(dd) ans = 0 for i in dd: #print(sum(i)) if (sum(i) == s): ans += 1 print(ans)
import itertools k, s = list(map(int, input().split())) #data = [i for i in range(k + 1)] # print(data) #dd = itertools.product(data, repeat=3) # print(dd) #dd = list(dd) #target = s / 3 ans = 0 if (k * 3 < s): pass else: for x in range(0, k + 1): #temp = s - x # 2なら、(0、2)(1、1)...
p03835
k, s = list(map(int, input().split())) count = 0 for i in range(k + 1): x = i for j in range(k + 1): y = j for l in range(k + 1): z = l if x + y + z == s: count += 1 print(count)
k, s = list(map(int, input().split())) count = 0 for x in range(k + 1): for y in range(k + 1): if (s - x - y >= 0 and s - x - y <= k): count += 1 print(count)
p03835
k,s = list(map(int,input().split())) cnt = 0 for x in range(k+1): for y in range(x,k+1): for z in range(y,k+1): if x+y+z == s: if x==y==z: cnt+=1 elif (x==y and x!=z) or (x!=y and x==z) or (x!=y and y==z): cnt+=3 ...
k, s = list(map(int, input().split())) c = 0 for i in range(k+1): for j in range(k+1): z = s - i - j if z >= 0 and z <= k: c += 1 print(c)
p03835
k, s = list(map(int, input().split())) c = 0 for i in range(k+1): for j in range(k+1): z = s - i - j if z >= 0 and z <= k: c += 1 print(c)
k,s=list(map(int,input().split())) cnt = 0 for x in range(k+1): for y in range(k+1): z = s-(x+y) if 0 <= z and z <= k: cnt+=1 print(cnt)
p03835
K, S = list(map(int,input().split())) cnt = 0 for x in range(K+1): for y in range(K+1): if 0 <= S - (x+y) <= K: cnt += 1 print(cnt)
K, S = list(map(int, input().split())) ans = 0 for i in range(K+1): for j in range(K+1): if 0 <= S-(i+j) <= K: ans += 1 print(ans)
p03835
k, s = list(map(int, input().split())) count = 0 for x in range(k + 1): for y in range(k + 1): for z in range(k + 1): if x + y + z == s: count += 1 break print(count)
k, s = list(map(int, input().split())) count = 0 for x in range(k + 1): for y in range(k + 1): if x + y <= s <= x + y + k: count += 1 print(count)
p03835
k,s = list(map (int ,input ().split ())) x = 0 y = 0 z = 0 p = 0 while x <= k: while y <= k: while z <= k: if x+y+z == s: p += 1 z += 1 y += 1 z = 0 x += 1 y,z = 0,0 print (p)
k,s = list(map (int ,input ().split ())) x = 0 y = 0 p = 0 while x <= k: while y <= k: if x+y > s: break z = s-(x+y) if 0 <= z <= k: p += 1 y += 1 x += 1 y = 0 print (p)
p03835
k, s = list(map(int, input().split())) ans = 0 for x in range(k+1): for y in range(k+1): for z in range(k+1): if x + y + z == s: ans += 1 print(ans)
k, s = list(map(int, input().split())) ans = 0 for x in range(k+1): for y in range(k+1): if (0 <= s - x - y) and (s - x - y <= k): ans += 1 print(ans)
p03835
k, s = list(map(int, input().split())) ret = 0 for x in range(k + 1): for y in range(k + 1): for z in range(k + 1): if x + y + z == s: ret += 1 print(ret)
k, s = list(map(int, input().split())) ret = 0 for x in range(k + 1): for y in range(k + 1): if x + y <= s and x + y + k >= s: ret += 1 print(ret)
p03835
#-*-coding:utf-8-*- def main(): k,s = list(map(int,input().split())) counter=0 for x in range(k+1): for y in range(k+1): for z in range(k+1): if x+y+z==s: counter+=1 print(counter) if __name__=="__main__": main()
#-*-coding:utf-8-*- def main2(): k,s = list(map(int,input().split())) counter=0 for x in range(k+1): for y in range(k+1): if 0<=s-x-y <=k: counter+=1 print(counter) if __name__=="__main__": main2()
p03835
def actual(K, S): count = 0 for x in range(S + 1): for y in range(S + 1): z = S - (x + y) cond1 = (0 <= x <= K) and (0 <= y <= K) and (0 <= z <= K) cond2 = (x + y + z) == S if cond1 and cond2: count += 1 return count ...
def actual(K, S): count = 0 for x in range(K + 1): for y in range(K + 1): z = S - (x + y) cond1 = (0 <= x <= K) and (0 <= y <= K) and (0 <= z <= K) cond2 = (x + y + z) == S if cond1 and cond2: count += 1 return count ...
p03835
def actual(K, S): count = 0 for x in range(K + 1): for y in range(K + 1): z = S - (x + y) cond1 = (0 <= x <= K) and (0 <= y <= K) and (0 <= z <= K) cond2 = (x + y + z) == S if cond1 and cond2: count += 1 return count ...
def actual(K, S): count = 0 for x in range(K + 1): for y in range(K + 1): z = S - (x + y) if 0 <= z <= K: count += 1 return count K, S = list(map(int, input().split())) print((actual(K, S)))
p03835
a,b=list(map(int,input().split())) count=0 for x in range(a+1): for y in range(a+1): for z in range(a+1): if x+y+z == b: count+=1 print(count)
a,b=list(map(int,input().split())) count=0 for x in range(a+1): for y in range(a+1): if b < x+y: break if b-x-y <= a: count+=1 print(count)
p03835
k, s = list(map(int, input().split())) ans = 0 for x in range(0, k + 1): for y in range(0, k + 1): for z in range(0, k + 1): if x + y + z == s: ans += 1 print(ans)
k, s = list(map(int, input().split())) ans = 0 for x in range(0, k + 1): for y in range(0, k + 1): if 0 <= s - (x + y) <= k: ans += 1 print(ans)
p03835
k, s = list(map(int, input().split(" "))) count = int(0) for i in range(k + 1): for j in range(k + 1): for l in range(k + 1): if s == i + j + l: count += 1 print(count)
k, s = list(map(int, input().split())) count = int(0) for i in range(k + 1): for j in range(k + 1): z = s - i - j if 0 <= z <= k: count += 1 print(count)
p03835
k, s = [int(i) for i in input().split()] ans = 0 for i in range(k+1): for j in range(k+1): for l in range(k+1): if i + j + l == s: ans += 1 break print(ans)
k, s = [int(i) for i in input().split()] ans = 0 for i in range(k+1): for j in range(k+1): if k >= s-i-j and s-i-j>=0: ans += 1 print(ans)
p03835
K,S=[int(i) for i in input().split()] count=0 for i in range(0,K+1): for j in range(0,K+1): for k in range(0,K+1): if i+j+k==S: count+=1 print(count)
K,S=[int(i) for i in input().split()] count=0 for i in range(0,K+1): for j in range(0,K+1): k=S-i-j if 0<=k<=K: count+=1 print(count)
p03835
k,s = list(map(int,input().split())) ans = [1 for x in range(k+1) for y in range(k+1) for z in range(k+1) if x + y + z == s] print((len(ans)))
k,s = list(map(int,input().split())) ans = [1 for x in range(k+1) for y in range(k+1) if 0 <= s - (x+y) <= k] print((len(ans)))
p03835
#k = int(input()) #s = input() #a, b = map(int, input().split()) #s, t = map(str, input().split()) #l = list(map(int, input().split())) #l = [list(map(int,input().split())) for i in range(n)] k, s = list(map(int, input().split())) ans = 0 for x in range(k+1): for y in range(k+1): z = s - (x+y)...
#k = int(input()) #s = input() #a, b = map(int, input().split()) #s, t = map(str, input().split()) #l = list(map(int, input().split())) #l = [list(map(int,input().split())) for i in range(n)] k, s = list(map(int, input().split())) ans = 0 for x in range(k+1): for y in range(k+1): z = s - (x+y)...
p03835
K, S = list(map(int, input().split())) wariate = 0 for x in range(0, K + 1): for y in range(0, K + 1): z = S - (x + y) if 0 <= z <= K: wariate += 1 print(wariate)
K, S = list(map(int, input().split())) cnt = 0 for x in range(K + 1): for y in range(K + 1): z = S - (x + y) cnt += (0 <= z <= K) print(cnt)
p03835
K, S = list(map(int, input().split())) cnt = 0 for x in range(K + 1): for y in range(K + 1): z = S - (x + y) cnt += (0 <= z <= K) print(cnt)
K, S = list(map(int, input().split())) cnt = 0 for x in range(K + 1): S2 = S - x if S2 < 0: break elif S2 > 2*K: continue else: cnt += (S2 + 1) - 2*max(0, S2 - K) print(cnt)
p03835
k,s=list(map(int,input().split())) print(([x+y+z for z in range(k+1) for y in range(k+1) for x in range(k+1)].count(s)))
k,s=list(map(int,input().split())) ans=0 for i in range(k+1): x=min(s-i,k)-max(0,s-k-i) if x>=0: ans+=x+1 print(ans)
p03835
[k,s]=[int(i) for i in input().split()] a=[] for i in range(k+1): x=i for j in range(s-x+1): y=s-x-j z=s-x-y if y<=k and z<=k: a.append([x,y,z]) #print(a) print((len(a)))
[k,s] = [int(i) for i in input().split()] count = 0 for x in range(k+1): for y in range(min(s-x+1,k+1)): if s - x - y <= k: count += 1 print(count)
p03835
k,s = list(map(int,input().split())) count = 0 for i in range(k+1): for j in range(k+1): for l in range(k+1): if i + j + l == s: count += 1 print(count)
k,s = list(map(int,input().split())) count = 0 for i in range(k+1): for j in range(k+1): if 0<=s - i - j < k+1: count += 1 print(count)
p03835
k, s=list(map(int, input().split())) ans=[] for x in range(k+1): for y in range(k+1): for z in range(k+1): if x+y+z==s: ans.append((x, y, z)) print((len(ans)))
k, s=list(map(int, input().split())) ans=0 for x in range(k+1): for y in range(k+1): if 0<= s-x-y <= k: ans+=1 print(ans)
p03835
k, s = list(map(int, input().split())) cnt = 0 for x in range(k + 1): for y in range(k + 1): for z in range(k + 1): if s == x + y + z: cnt += 1 print(cnt)
k, s = list(map(int, input().split())) cnt = 0 for x in range(k + 1): for y in range(k + 1): if 0 <= s - x - y <= k: cnt += 1 print(cnt)
p03835
K,S = list(map(int,input().split())) count1 = 0 count2 = 0 count3 = 0 for x in range(0,K+1): for y in range(x,K+1): for z in range(y,K+1): if x+y+z==S: if x==y and y==z and z==x: count1+=1 elif x!=y and y!=z and z!=x: ...
K,S = list(map(int,input().split())) sum=0 for x in range(0,K+1): for y in range(0,K+1): z = S-x-y if z>=0 and z<=K: sum+=1 print(sum)
p03835
K,S=list(map(int,input().split())) count=0 for x in range(K+1): if x>S: break for y in range(K+1): if y>S: break z=S-x-y if 0<=z and z<=K: count+=1 print(count)
K,S=list(map(int,input().split())) r=K+1 count=0 for x in range(r): if x>S: break for y in range(r): if y>S: break z=S-x-y if 0<=z and z<=K: count+=1 print(count)
p03835
k,s=list(map(int,input().split())) ans = 0 for x in range(k+1): for y in range(k+1): z = s - x -y if 0<=z<=k: ans +=1 print(ans)
k,s= list(map(int,input().split())) ans=0 for i in range(k+1): for j in range(k+1): z=s-i-j if 0<=z<=k: ans+=1 print(ans)
p03835
k,s = list(map(int, input().split())) cnt = 0 for x in range(k+1): for y in range(k+1): for z in range(k+1): if x+y+z==s: cnt += 1 print(cnt)
k,s = list(map(int, input().split())) cnt = 0 for x in range(k+1): for y in range(k+1): z = s-x-y if 0<=z and z<=k : cnt += 1 print(cnt)
p03835
k,s = list(map(int,input().split())) count = 0 for x in range(k+1): for y in range(x,k+1): for z in range(y,k+1): if x+y+z == s: if x == y and y == z: count += 1 elif x == y or y == z or x == z: count += 3 ...
k,s = list(map(int,input().split())) count = 0 for x in range(k+1): for y in range(k+1): z = s-x-y if z <= k and 0 <= z: count += 1 print(count)
p03835