problem_id
stringclasses
100 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
6
806
p03835
s078469700
Accepted
import sys sys.setrecursionlimit(10 ** 8) ini = lambda: int(sys.stdin.readline()) inm = lambda: map(int, sys.stdin.readline().split()) inl = lambda: list(inm()) ins = lambda: sys.stdin.readline().rstrip() debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw)) K, S = inm() def solve(): 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 print(solve())
p03835
s278661175
Accepted
k, s = map(int, input().split()) """ ・Z=S-(X+Y) ・0<=Z<=K """ ans = 0 for x in range(k + 1): for y in range(k + 1): if s >= x + y >= s - k: ans += 1 print(ans)
p03835
s317163742
Accepted
k,s=map(int,input().split()) print(len([1 for z in range(k+1) for y in range(k+1) if 0<=s-y-z<=k]))
p03835
s818966781
Accepted
K,S=map(int,input().split()) ans=0 for x in range(0,K+1): for y in range(0,K+1): if S-(x+y)>=0 and S-(x+y)<=K: ans+=1 print(ans)
p03835
s529044330
Accepted
k,s=map(int,input().split()) c=0 for i in range(k+1): for j in range(min(s-i+1,k+1)): if 0<=s-i-j<=k: c+=1 print(c)
p03835
s918211425
Accepted
K, S = map(int, input().split(' ')) count = 0 for x in range(K+1): for y in range(K+1): if S - x - y <= K and S - x - y >= 0: count += 1 print(count)
p03835
s994522606
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
s256069096
Accepted
import sys input = sys.stdin.readline def main(): k, s = map(int, input().split()) ans = 0 for x in range(k+1): if x > s: break for y in range(k+1): if x + y > s: break if s - (x + y) <= k: ans += 1 print(ans) if __name__ == '__main__': main()
p03835
s109330675
Accepted
K,S = map(int,input().split()) ret =0 for X in range(K+1): for Y in range(K+1): if 0 <= S-X-Y and S-X-Y <=K: ret +=1 print(ret)
p03835
s320417276
Accepted
k,s = map(int,input().split()) print(sum(0<=s-i-j<=k for i in range(k+1) for j in range(k+1)))
p03835
s907096331
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
s039545238
Accepted
K, S = list(map(lambda n: int(n), input().split(" "))) cnt = 0 # X + Y + Z = S, 0 <= X, Y, Z <= K # for x in range(K + 1): if S - x > 2 * K: continue for y in range(K + 1): if 0 <= S - x - y <= K: cnt += 1 print(cnt)
p03835
s115765996
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
s806762484
Accepted
import sys input = sys.stdin.readline k, s = map(int, input().split()) # min_num = s - k * 2 # if min_num <= 0: min_num = 0 ans = 0 for x in range(min_num, k + 1): for y in range(min_num, k + 1): z = s - x - y if z > k or z < 0: continue else: ans += 1 print(ans)
p03835
s780281810
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
s306178631
Accepted
K,S = map(int,input().split()) ans = 0 for i in range(0,K+1): for j in range(0,K+1): if 0 <= S-(i+j)<=K: ans += 1 print(ans)
p03835
s418738191
Accepted
K,S = map(int,input().split()) count = 0 for i in range(K+1): for j in range(K+1): if S <= (i+j+K) and i+j<=S: count += 1 print(count)
p03835
s898098174
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
s928048516
Accepted
K, S = map(int, input().split()) ans = 0 for i in range(0,K+1): for j in range (0,K+1): if (S-K) <= (i + j) <= S: ans = ans + 1 continue print(ans)
p03835
s803707892
Accepted
#!/usr/bin/env python3 K, S = map(int, input().split()) AB = [] ret = 0 for i in range(K+1): for j in range(K+1): AB.append(i+j) for i in range(len(AB)): if 0 <= S - AB[i] <= K: ret += 1 print(ret)
p03835
s376052526
Accepted
k, s = map(int,input().split()) ans = 0 for i in range(k+1): yz = s - i for j in range(k+1): if k >= yz - j >= 0: ans += 1 print(ans)
p03835
s344852820
Accepted
k, s = map(int, input().split()) p = 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: p += 1 print(p)
p03835
s922689515
Accepted
k,s=list(map(int,input().split())) ans=0 for i in range(k+1): for j in range(k+1): if -1 < s-i-j < k+1: ans+=1 print(ans)
p03835
s285113603
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 i+j <= s: ans += 1 print(ans)
p03835
s663628684
Accepted
K, S = map(int, input().split()) count = 0 for x in range(K+1): if K < 1/2 * (S - x): continue for y in range(min(S - x + 1, K + 1)): if K < (S - x - y): continue else: count += 1 print(count)
p03835
s976722140
Accepted
k,s=map(int, input().split()) Ans = 0 for i in range(k+1): for j in range(k+1): x = i y = j z = s - i - j if z <= k and z >= 0: Ans += 1 print(Ans)
p03835
s433508985
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 =ans+1 print(ans)
p03835
s933716822
Accepted
import sys input = sys.stdin.readline K,S=map(int,input().split()) ans = [] if S > K: z = list(range(K+1)) else: z = list(range(S+1)) 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*2 - s_z + 1) else: ans.append(s_z + 1) print(sum(ans))
p03835
s828879951
Accepted
k,s = map(int,input().split()) ans = 0 for x in range(k+1): for y in range(k+1): if k >= s-x-y >= 0: ans += 1 print(ans)
p03835
s091732176
Accepted
k, s = map(int, input().split()) from itertools import product k_list = list(range(k+1)) count = 0 for x, y in product(k_list, k_list): # print(x, y, s-x-y) if 0<=s-x-y<=k: count+=1 print(count)
p03835
s871878899
Accepted
import sys def solve(): input = sys.stdin.readline 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) return 0 if __name__ == "__main__": solve()
p03835
s241464402
Accepted
# -*- coding: utf-8 -*- K, S = map(int, input().split()) cnt = 0 for X in range(0, K+1): for Y in range(0, K+1): if 0<=S-X-Y and S-X-Y<=K: cnt += 1 print(cnt)
p03835
s256903459
Accepted
K,S=[int(x) for x in input().rstrip().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
s613058247
Accepted
k,s = map(int, input().split()) l = 0 if s <= k: l = int((s+2)*(s+1)/2) else: for x in range(0,k+1): if s-x > 2*k: l += 0 elif k < s-x <= 2*k: l += 2*k - s + x + 1 elif s-x <= k: l += s-x+1 print(l)
p03835
s230154958
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
s989976392
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=cnt+1 else: continue print(cnt)
p03835
s123825432
Accepted
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 and z<=K: count += 1 print(count)
p03835
s282205516
Accepted
k, s = map(int, input().split()) ans = 0 tmp = 0 for i in range(k + 1): x = i tmp = s - x if tmp < 0: break if 2 * k >= tmp: if k >= tmp: ans = ans + tmp + 1 else: ans = ans + ((k + 1) - (tmp - k)) print(ans)
p03835
s662706075
Accepted
k, s = map(int, input().split()) count = 0 for i in range(k+1): for j in range(k+1): if i + j > s: break m = s - i - j if m <= k: count += 1 print(count)
p03835
s701459271
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
s406550337
Accepted
#!/usr/bin/env python # coding: utf-8 # In[4]: K,S = map(int, input().split()) # In[6]: ans = 0 for x in range(K+1): diff1 = S-x if diff1 >= 0: for y in range(K+1): z = diff1-y if z >= 0 and z <= K: ans += 1 print(ans) # In[ ]:
p03835
s123306133
Accepted
import sys input = sys.stdin.readline from itertools import combinations def main(): k, s = map(int, input().split()) for x in range(k+1): for y in range(k+1): z = s - x - y if 0 <= z <= k: yield 1 print(sum(main()))
p03835
s255163522
Accepted
k, s = map(int, input().split()) c = 0 for i_x in range(k+1): for i_y in range(k+1): z = s - (i_x + i_y) if z >= 0 and z <= k: c += 1 print(c)
p03835
s603038579
Accepted
K,S=map(int,input().split()) print(len([True for x in range(K+1) for y in range(K+1) if (S-x-y>=0) and (S-x-y<=K)]))
p03835
s597989878
Accepted
k, s = map(int, input().split()) ans = 0 for q in range(k + 1): for w in range(k + 1): if 0 <= (s - q - w) <= k: ans += 1 print(ans)
p03835
s279250561
Accepted
k, s = map(int, input().split()) res = 0 for x in range(k+1): for y in range(k+1): z = s - (x + y) if z >= 0 and z <= k: res += 1 print(res)
p03835
s771883962
Accepted
# -*- coding: utf-8 -*- import sys k, s = map(int, input().split(' ')) counter = 0 for i in range(k + 1): for j in range(k + 1): if 0 <= s - i - j <= k: # print(i, j , s - i - j) counter += 1 print(counter)
p03835
s522993196
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
s743936656
Accepted
K, S = tuple(map(int, input().split())) cnt = 0 for a in range(K+1): for b in range(K+1): c = S - (a + b) if 0 <= c <= K: cnt += 1 print(cnt)
p03835
s793357493
Accepted
s = list(map(int, input().split(" "))) n = s[0] c = s[1] ans = 0 for v in range(n+1): x = v for i in range(n+1): y = i if 0 <= (c - x - y) <= n: ans += 1 print(ans)
p03835
s070735264
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
s962594929
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
s601394041
Accepted
K, S = map(int, input().split()) res = 0 for x in range(K+1): y_z = S - x if y_z < 0: continue y_min = max(y_z-K,0) y_max = min(y_z,K) res += max(y_max-y_min+1,0) print(res)
p03835
s861136214
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
s014720437
Accepted
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
s639883574
Accepted
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
s594832226
Accepted
k, s = map(int, input().split()) arr = [1 for x in range(k+1) for y in range(k+1) if k >= s-x-y >= 0] print(sum(arr))
p03835
s962958596
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
s367018964
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
s273617153
Accepted
k,s = map(int,input().split()) count = 0 for i in range(k+1): for j in range(k+1): if i+j <= s and s <= i+j+k: count += 1 print(count)
p03835
s333219551
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
s058046283
Accepted
K,S = map(int, input().split()) # debug # print([(A,B,S-A-B) for A in range(K+1) for B in range(K+1) if 0 <= S-A-B <= K]) print(sum(1 for A in range(K+1) for B in range(K+1) if 0 <= S-A-B <= K))
p03835
s431275156
Accepted
info = [int(i) for i in input().split(' ')] K = info[0] S = info[1] count = 0 for x in range(K+1): for y in range(K+1): z = S - x - y if (0<=z)&(z<=K): count += 1 print(count)
p03835
s099995910
Accepted
a=input().split() K=int(a[0]) S=int(a[1]) n=0 for i in range(K+1): for j in range(K+1): if 0<=S-i-j<=K: n+=1 print(n)
p03835
s981465612
Accepted
import math 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 K >= z: ans += 1 print(ans)
p03835
s123851052
Accepted
k, s = map(int, input().split()) ans = 0 for x in range(0, k+1): if s-x < 0 or s-x > 2*k: # no answer (y,z) continue elif 0 <= s-x <= k: ans += 1+s-x else: ans += k - (s-x-k) + 1 print(ans)
p03835
s743584928
Accepted
k,s = map(int,input().split()) cnt,x = 0,0 for y in range(k+1): for z in range(k+1): x = s-y-z if 0 <= x <= k: cnt += 1 print(cnt)
p03835
s308476478
Accepted
k, s = map(int, input().split()) n = range(k+1) count = 0 for x in n: for y in n: if 0 <= s-x-y <= k: count += 1 print(count)
p03835
s752697465
Accepted
import math k,s = map(int,input().split()) ans = 0 for i in range(k+1): s1 = s - i for j in range(s1+1): if j <= k and s1 - j <= k: ans += 1 print(ans)
p03835
s068454129
Accepted
a,b = map(int,input().split()) c = 0 for i in range(a+1): for j in range(a+1): z = b-i-j if i+j+z==b and 0<=z<=a: c+=1 print(c)
p03835
s584147876
Accepted
K,S = map(int,input().split()) num = 0 for i in range(K+1): for j in range(K+1) : k = S - i - j if k >= 0 and k <= K : num += 1 print(num)
p03835
s381733816
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(x, y, z) print(count)
p03835
s197116102
Accepted
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
s258402694
Accepted
#051_B 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
s679971099
Accepted
def main(): K, S = map(int, input().split()) count=0 for x in range(0, K+1): for y in range(0, K+1): if(0<=S-x-y<=K): count+=1 print(count) main()
p03835
s887169685
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
s195519558
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
s332433871
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
s197971404
Accepted
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<=K: cnt += 1 print(cnt)
p03835
s465785770
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) & (z <=K): ans +=1 print(ans)
p03835
s210016768
Accepted
k,s = map(int,input().split()) c = 0 for y in range(k+1): for z in range(k+1): if 0 <= s-(y+z) <= k: c += 1 print(c)
p03835
s899220746
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
s723106907
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
s935728731
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
s016010366
Accepted
k, s = map(int, input().split()) ans = 0 for x in range(k+1): for y in range(min(s-x+1, k+1)): z = s - x - y if 0 <= z <= k: ans += 1 print(ans)
p03835
s183552293
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 y<=z and z<=k: tmp = set([x,y,z]) if len(tmp)==3: ans += 6 elif len(tmp)==2: ans += 3 else: ans += 1 print(ans)
p03835
s869146760
Accepted
import sys readline = sys.stdin.readline def main(): K, S = map(int, readline().rstrip().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) if __name__ == '__main__': main()
p03835
s001460863
Accepted
import itertools K, S = map(int, input().split()) cnt = 0 # K = list(range(K + 1)) for i, j in itertools.product(list(range(K + 1)), repeat=2): if 0 <= S - i - j <= K: cnt += 1 print(cnt)
p03835
s097186996
Accepted
n,m = map(int,input().split()) cnt = 0 for i in range(n+1): for j in range(n+1): if m-i-j <= n and m-i-j >= 0: cnt += 1 print(cnt)
p03835
s410871364
Accepted
import math import sys from collections import deque a,b=map(int,input().split()) count=0 for i in range(a+1): for j in range(a+1): if 0<=b-i-j<=a: count+=1 print(count)
p03835
s398071622
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) and (s - x - y <= k): ans += 1 print(ans)
p03835
s531607403
Accepted
K, S = map(int, input().split()) ways = 0 for i in range(K+1): for j in range(K+1): k = S - i - j if k >= 0 and k <= K: ways += 1 print(ways)
p03835
s585876155
Accepted
import itertools a,b=(int(x) for x in input().split()) l = range(a+1) count = 0 m = [x+y for x,y in itertools.product(l,l) if (x+y)<=b] for i in m: if b-i <= a: count+=1 print(count)
p03835
s578567300
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: count += 1 print(count)
p03835
s142156719
Accepted
k, s = map(int, input().split()) ct = 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: ct += 1 print(ct)
p03835
s255005712
Accepted
k, s = map(int, input().split()) l=[] for x in range(0, k+1): for y in range(0, k+1): if s-x-y > k or s-x-y < 0: continue else: l.append(s-x-y) print(len(l))
p03835
s937947653
Accepted
#import #import math #import numpy as np #= int(input()) #= input() K, S = map(int, input().split()) #= list(map(int, input().split())) #= [input(), input()] #= [list(map(int, input().split())) for _ in range(N)] #= {i:[] for i in range(N)} r = 0 for i in range(K + 1): for j in range(K + 1): z = S - (i + j) if z >= 0 and z <= K: r += 1 print(r)
p03835
s000666525
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 and s - x - y <= k: ans += 1 print(ans)
p03835
s419657198
Accepted
K, S = map(int, input().split()) ans = 0 for X in range(min(K, S)+1): for Y in range(min(K, S-X)+1): if 0 <= S-X-Y <= K: ans += 1 print(ans)
p03835
s741209266
Accepted
K,S=map(int,input().split()) count=0 for i in range(K+1): for j in range(K+1): if S-i-j<=K and S-i-j>=0: count+=1 print(count)