problem_id
stringclasses
100 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
6
806
p03835
s953733029
Accepted
from sys import stdin def main(): K, S = [int(x) for x in stdin.readline().rstrip().split()] result = 0 for X in range(K + 1): for Y in range(K + 1): Z = S - (X + Y) if Z < 0: break if X <= K and Y <= K and Z <= K: result += 1 print(result) if __name__ == "__main__": main()
p03835
s060977892
Accepted
k, s = map(int, input().split()) cnt = 0 for x in range(k+1): for y in range(k+1): if k >= s - x - y >= 0: cnt += 1 print(cnt)
p03835
s438746040
Accepted
import sys input = sys.stdin.readline K,S=map(int,input().split()) z = list(range(K+1)) ans = [] for i in z: s_z = S - i if s_z < 0: pass elif K < s_z: if (K + 1) > (s_z - K): ans.append(2*K + 1 - s_z) else: ans.append(s_z + 1) print(sum(ans))
p03835
s813959223
Accepted
K, S = map(int, input().split()) ans = 0 for x in range(K+1): for y in range(K+1): if S - x - y <= K and S - x - y >= 0: ans += 1 print(ans)
p03835
s320028205
Accepted
k, s = map(int, input().split()) cnt = 0 for x in range(k+1): for y in range(k+1): z = s - x - y if z <= k and z >= 0: cnt += 1 print(cnt)
p03835
s696135611
Accepted
k, s = map(int, input().split()) c=0 for x in range(k+1): for y in range(k+1): z=s-x-y if 0<=z<=k: c += 1 print(c)
p03835
s188120490
Accepted
K,S=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
s404460786
Accepted
k,s = [int(x) for x in 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
s297234160
Accepted
k, s = map(int, input().split()) cnt = 0 for x in range(k+1): for y in range(k+1): if (0 <= s-x-y) and (s-x-y <= k): cnt += 1 print(cnt)
p03835
s072671345
Accepted
K,M=list(map(int,input().split())) ans = 0 for i in range(K+1): for j in range(min(K+1,M-i+1)): if M-i-j > K: continue else: ans +=1 print(ans)
p03835
s128434482
Accepted
k,s = 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
s276419191
Accepted
#!/usr/bin/env python3 k, s = map(int, input().split()) ans = 0 for i in range(k + 1): for j in range(k + 1): a = s - i - j if a >= 0 and a <= k: ans += 1 print(ans)
p03835
s009464423
Accepted
i,j=map(int,input().split()) a=0 for x in range(i+1): for y in range(i+1): if j-(x+y)<=i: if x+y<=j: a+=1 print(a)
p03835
s144676156
Accepted
icase=0 if icase==0: k,s=map(int,input().split()) icnt=0 for x in range(k+1): for y in range(k+1): z=s-x-y if 0<=z and z<=k: icnt=icnt+1 print(icnt)
p03835
s483405049
Accepted
k, s = map(int, input().split()) cnt = 0 for x in range(0, k+1): for y in range(0, k+1): z = s - x - y if z < 0 or z > k: continue cnt +=1 print(cnt)
p03835
s815976535
Accepted
k, s = 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
s294999642
Accepted
k, s = 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
s533177042
Accepted
# Problem B - Sum of Three Integers K, S = map(int, input().split()) count_num = 0 for x in range(K+1): tmp_num = S tmp_num = tmp_num - x for y in range(K+1): tmp_num_2 = tmp_num z = tmp_num_2 - y if z<=K and z>=0: count_num = count_num + 1 print(count_num)
p03835
s463056493
Accepted
K,S = (int(T) for T in input().split()) Count = 0 for TX in range(0,K+1): for TY in range(0,K+1): if 0<=(S-TX-TY)<=K: Count += 1 print(Count)
p03835
s916815278
Accepted
K,S = 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
s638443895
Accepted
K,S=map(int,input().split()) ans=0 for a in range(K+1): for b in range(K+1): if K>=S-a-b and 0<=S-a-b: ans+=1 print(ans)
p03835
s047831700
Accepted
# -*- coding: utf-8 -*- import math # 整数の入力 k, s = map(int, input().split()) # 計算 count = 0 for x in range(k+1): for y in range(k+1): if s >= x + y and s - x - y <= k: count += 1 # for z in range(k+1): # if x + y + z == s: # count += 1 print(count)
p03835
s898415750
Accepted
k_num, s_num = map(int, input().split()) cnt = 0 for x in range(k_num+1): l = s_num - x for y in range(k_num+1): z = l - y if 0 <= z <= k_num: cnt += 1 print(cnt)
p03835
s058940791
Accepted
k,s=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
s431702488
Accepted
k, s = map(int, input().split()) ans = 0 for x in range(max(s-2*k, 0), min(s, k)+1): for y in range(max(s-x-k, 0), min(s-x, k)+1): ans += 1 print(ans)
p03835
s829932815
Accepted
def solve(K, S): import bisect count = 0 z_array = [i for i in range(K+1)] for x in range(K+1): for y in range(K+1): z = S - x - y if(z >= 0 and z <= K):count+=1 return count def main(): K, S = map(int, input().split()) print(solve(K, S)) #print(solve(2, 2)) #print(solve(5, 15)) main()
p03835
s674580290
Accepted
k,s=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
s784180791
Accepted
k,s = list(map(int,input().split())) def fact(n): return sum([x for x in range(1,n+1)]) ans = 0 r = 0 for x in range(k+1): for y in range(x,k+1): if 0 <= s - (x+y) <= k: if (x==y): ans += 1 else: ans += 2 print(ans)
p03835
s850535417
Accepted
K, S = map(int, input().split()) res = 0 for X in range(min(S, K), -1, -1): for Y in range(min(K, S - X), -1, -1): if 0 <= S - X - Y <= K: res += 1 print(res)
p03835
s654215470
Accepted
k,s=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
s663469309
Accepted
k,s=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
s033649079
Accepted
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import copy def main(): K, S = map(int, input().split()) result = 0 for x in range(K + 1): for y in range(K + 1): z = S - x - y if 0 > z or z > K: continue else: result += 1 print(result) if __name__ == "__main__": main()
p03835
s872898197
Accepted
K, S = map(int, 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
s750594762
Accepted
K, S = map(int, input().split()) counter = 0 for x in range(K+1): for y in range(K+1): z = S - x - y if 0 <= z <= K: counter += 1 print(counter)
p03835
s878400839
Accepted
K, S = 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
s996389867
Accepted
k, s = 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
s394296047
Accepted
k, s = 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 0 <= z and z <= k: ans += 1 print(ans)
p03835
s196979876
Accepted
k,s = map(int,input().split()) ans = 0 for i in range(k+1): for j in range(i,k+1): c = s-i-j if k >= c and c >=j: if i == j and j == c: ans += 1 elif i!=j and j!=c and c!=j: ans += 6 else: ans += 3 print(ans)
p03835
s852438152
Accepted
K,S = map(int,input().split()) x,y,z = 0,0,0 n = 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: n += 1 print(n)
p03835
s309536735
Accepted
k, s = map(int, input().split()) ans = 0 for x in range(k + 1): for y in range(k + 1): if x + y > s: break z = s - x - y if 0 <= z <= k: ans += 1 print(ans)
p03835
s901369475
Accepted
k,s=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
s793335516
Accepted
k, s = 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
s109855735
Accepted
# coding = SJIS k, s = 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 0 <= z and z <= k: ans += 1 print(ans)
p03835
s445311429
Accepted
k,s=[int(x) for x in input().split()] c=0 for x in range(k+1): for y in range(k+1): if 0<=s-x-y<=k: c=c+1 print(c)
p03835
s533412567
Accepted
import sys input = sys.stdin.readline k,s = 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
s005441515
Accepted
from sys import stdin k,s = map(int,stdin.readline().rstrip().split()) point = 0 for i in range(k+1): for j in range(k+1): if 0 <= s-(i+j) <= k: point += 1 print(point)
p03835
s589687688
Accepted
K,s=map(int,input().split()) cnt=0 for i in range(K+1): if s-i>2*K: continue for j in range(K+1): if s-i-j<0: break if s-i-j<=K: cnt+=1 print(cnt)
p03835
s131832464
Accepted
a,b=input().split() a=int(a) b=int(b) c=0 for i in range(a+1): for k in range(a+1): if b-a<=i+k<=b: c=c+1 print(c)
p03835
s967816025
Accepted
k,s = 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
s516622092
Accepted
K, S = map(int, input().split()) print(sum(0 <= S - X - Y <= K for X in range(K+1) for Y in range(K+1)))
p03835
s624230017
Accepted
k, s = 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
s876139243
Accepted
import sys input = sys.stdin.readline K,S=map(int,input().split()) z = list(range(0,K+1)) ans = [] for i in z: s_z = S - i if s_z < 0: pass elif K < s_z: if (K + 1) > (s_z - K): ans.append(K + 1 - (s_z - K)) else: ans.append(s_z + 1) print(sum(ans))
p03835
s701176876
Accepted
def main(): K, S = map(int, input().split()) cnt = 0 for i in range(K + 1): for j in range(K + 1): k = S - i - j if 0 <= k and k <= K: cnt += 1 print(cnt) if __name__ == "__main__": main()
p03835
s746312534
Accepted
K, S = 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)
p03835
s240635776
Accepted
def main(): k, s = map(int, input().split()) cnt = 0 for x in range(k+1): for y in range(k+1): if s - x - y >= 0 and s - x - y <= k: # print(x, y, s-x-y) cnt += 1 print(cnt) if __name__ == '__main__': main()
p03835
s093130236
Accepted
K, S = map(int, input().split()) ans = 0 for X in range(K+1): for Y in range(K+1): if (S- X - Y >= 0 and S - X - Y <= K): ans += 1 print(ans)
p03835
s853768088
Accepted
k, s = map(int, input().split()) ans = 0 for x in range(k+1): for y in range(k+1): z = s - x - y if z <= k and z >= 0: ans += 1 print(ans)
p03835
s423998375
Accepted
k, s = map(int, input().split()) counter = 0 for x in range(k + 1): for y in range(x, k + 1): z = s - x - y if y <= z <= k: if x == y == z: counter += 1 elif x == y or y == z: counter += 3 else: counter += 6 print(counter)
p03835
s618147567
Accepted
k, s = 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
s161911183
Accepted
K,S = map(int,input().split()) count = 0 for p in range(K+1): for q in range(K+1): if S-p-q>=0 and S-p-q <= K: count+=1 print(count)
p03835
s508139510
Accepted
k, s = map(int, input().split()) ans = 0 x_min = max(0, s - k - k) x_max = min(k, s) for x in range(x_min, x_max + 1): y_min = max(0, s - x - k) y_max = min(k, s - x) ans += y_max - y_min + 1 print(ans)
p03835
s306973317
Accepted
k,s = 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
s363800454
Accepted
# B - Sum of Three Integers K,S= map(int,input().split()) cnt = 0 for x in range(K+1): for y in range(K+1): z = S-x-y if z>=0 and K>=z: cnt+=1 print(cnt)
p03835
s762663641
Accepted
# -*- coding: utf-8 -*- K, S = map(int, input().split()) n_int = 0 for z in range(min(K, S)+1): for y in range(min(K, S-z)+1): if S-y-z <= K: n_int += 1 print(n_int)
p03835
s911169253
Accepted
#!/usr/bin/env python3 # from numba import njit # input = stdin.readline # @njit def solve(k,s): res = 0 for i in range(k+1): for j in range(k+1): l = s - i - j if 0 <= l <= k: res += 1 return res def main(): K,S = map(int,input().split()) # a = list(map(int,input().split())) print(solve(K,S)) return if __name__ == '__main__': main()
p03835
s003315758
Accepted
# coding: utf-8 # Your code here! k, s = map(int, input().rstrip().split()) result = 0 for x in range(k+1): if 2*k >= s - x: for y in range(k+1): if s - x - y >= 0 and s - x - y <= k: result += 1 print(result)
p03835
s335645873
Accepted
k, s = map(int, input().split()) result = 0 for i in range(k+1): for j in range(k+1): if s-i-j <= k and s-i-j >= 0: result += 1 print(result)
p03835
s456106823
Accepted
k, s = map(int, input().split()) ans = 0 for i in range(0,k+1): for j in range(0,k+1): if i+j <= s and s-(i+j) <= k: ans += 1 print(ans)
p03835
s507792884
Accepted
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 and S - i - j <= K: count += 1 print(count)
p03835
s597011868
Accepted
k, s = 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
s990004668
Accepted
k, s = map(int, input().split()) cnt = 0 for i in range(min(k+1, s+1)): for j in range(min(k+1, s-i+1)): if s-i-j<=k: cnt += 1 print(cnt)
p03835
s420883751
Accepted
K, S = 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)
p03835
s676454978
Accepted
k, s = map(int, input().split()) r = 0 for x in range(k + 1): for y in range(0, min(s - x + 1, k + 1)): z = s - x - y if 0 <= z <= k and z + x + y == s: r += 1 print(r)
p03835
s951453124
Accepted
k,s = list(map(int,input().split(" "))) a = 0 for x in range(0,k+1): for y in range(0,k+1): z = s - x - y if (x + y + z ) == s and 0 <= z <= k: a += 1 print(a)
p03835
s890409426
Accepted
K, S = 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
s746691393
Accepted
k_num, s_num = map(int, input().split()) cnt = 0 for x in range(k_num+1): l = s_num - x for y in range(k_num+1): z = l - y if 0 <= z <= k_num: cnt += 1 print(cnt)
p03835
s541836186
Accepted
K, S = 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
s743868720
Accepted
k,s = map(int,input().split()) ans = 0 for i in range(k+1): for j in range(k+1): dum = (s - (i + j)) if dum < 0: continue if dum <= k: ans += 1 print(ans)
p03835
s542252927
Accepted
k,s=map(int,input().split()) cnt=0 for i in range(min(k,s)+1): for j in range(min(k,s-i)+1): if s-i-j<=k: cnt+=1 print(cnt)
p03835
s294586500
Accepted
k,s=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
s339587100
Accepted
K, S = map(int, input().split(" ")) count = 0 for i in range(K+1): for j in range(K+1): k = S -(i+j) if k >= 0 and k <= K: # print(i, j, k) count += 1 print(count)
p03835
s801446701
Accepted
k,s = 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
s171216380
Accepted
## coding: UTF-8 s = input().split() t = [int(p) for p in s] K = t[0] S = t[1] counter = 0 for X in range(K+1): for Y in range(K+1): if(S-X-Y >= 0 and S-X-Y <=K): counter += 1 print(counter)
p03835
s275395901
Accepted
k, s = 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 0<=z and z <= k: ans += 1 print(ans)
p03835
s772644998
Accepted
k,s = 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
s157391895
Accepted
k,s = 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
s769814125
Accepted
k,s=map(int,input().split()) ans=0 for x in range(k+1): for y in range(x,k+1): z=s-(x+y) if z>k or z<y: continue if x==y and y==z: ans+=1 elif x==y or y==z or x==z: ans+=3 else: ans+=6 print(ans)
p03835
s247895076
Accepted
k,s = map(int,input().split()) c = 0 for x in range(k+1): for y in range(k+1): if k >= s-(x+y) >= 0: c += 1 print(c)
p03835
s469261636
Accepted
k,s = map(int,input().split()) ans = 0 for i in range(0,k+1): for j in range(0,k+1): z = s-i-j if 0<=z<=k: ans+=1 print(ans)
p03835
s497529695
Accepted
def ABC051B(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 print(count) k, s = map(int, input().split()) ABC051B(k, s)
p03835
s191097085
Accepted
k,s=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)
p03835
s579213422
Accepted
K, S = map(int, input().split()) l = [] for i in range(K + 1): l.append(i) count = 0 for i in l: for j in l: z = S - i - j if 0 <= z and z <= K: count += 1 print(count)
p03835
s813241176
Accepted
k, s = 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
s857276287
Accepted
K,S=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)
p03835
s192940006
Accepted
K,S = 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
s282930283
Accepted
K, S = 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
s879259061
Accepted
K,S=map(int,input().split()) cnt=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: cnt+=1 print(cnt)
p03835
s788941199
Accepted
import sys input = sys.stdin.readline K,S=map(int,input().split()) z=list(range(K+1)) ans=[] for i in z: s_z=S-i if s_z<0: pass elif K<s_z: if (K+1)>(s_z-K): ans.append(2*K-s_z+1) else: ans.append(s_z+1) print(sum(ans))
p03835
s559642444
Accepted
K,S = 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)
p03835
s941148509
Accepted
K, S = [int(i) for i in 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)