problem_id
stringclasses
100 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
6
806
p03835
s628549754
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
s173209887
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
s590940520
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
s107708910
Accepted
if __name__ == '__main__': 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
s237937702
Accepted
k,s=map(int,input().split()) count=0 for x in range(k+1): for y in range(k+1): if k>=s-x-y>=0: count+=1 print(count)
p03835
s005929395
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
s944783173
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 and z<=k : cnt += 1 print(cnt)
p03835
s285618252
Accepted
import sys input = sys.stdin.readline K,S=map(int,input().split()) if S < K: K = S 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(K*2 - s_z + 1) else: ans.append(s_z + 1) print(sum(ans))
p03835
s983349230
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
s477170954
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 >= 0 and z <= k: cnt += 1 print(cnt)
p03835
s844511759
Accepted
k,s = map(int, input().split()) count = 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 and y==z: count += 1 elif x==y or y==z or z==x: count += 3 else: count += 6 print(count) print("\n")
p03835
s343662496
Accepted
K, S = map(int, input().split()) c = 0 for x in range(K + 1): for y in range(x + 1): if x + y > S: break z = S - x - y if z >= 0 and z < y + 1: if x != y and x!= z and y!= z: c += 6 elif x == y and x == z and y == z: c += 1 else: c += 3 print(c)
p03835
s329020875
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 0<=k<=K: num+=1 print(num)
p03835
s166180506
Accepted
K, S = map(int, input().split()) c = 0 for x in range(K + 1): if x > S: break for y in range(K + 1): if x + y > S: break z = S - x - y if 0 <= z <= K: c += 1 print(c)
p03835
s660151144
Accepted
K, S = map(int, input().split()) sum_three = 0 for i in range(K+1): for j in range(K+1): if 0 <= S - (i + j) <= K: sum_three += 1 print(sum_three)
p03835
s716350642
Accepted
k, s = map(int, input().split(' ')) ans = 0 for x in range(k+1): for y in range(k+1): if s - k <= x + y <= s: ans +=1 print(ans)
p03835
s898177813
Accepted
k, s = map(int, input().split()) counts = 0 for x in range(k+1): if (s - x) > 2 * k: continue for y in range(min(k+1, s-x+1)): if (s - x - y) <= k: counts += 1 print(counts)
p03835
s930996489
Accepted
k,s=map(int,input().split()) ret=0 k+=1 for i in range(k): for j in range(k): d=s-i-j if k>d>=0: ret+=1 print(ret)
p03835
s858255711
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
s804580426
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
s014264696
Accepted
import sys readline = sys.stdin.readline readall = sys.stdin.read ns = lambda: readline().rstrip() ni = lambda: int(readline().rstrip()) nm = lambda: map(int, readline().split()) nl = lambda: list(map(int, readline().split())) prl = lambda x: print(*x ,sep='\n') k,s = nm() res = 0 for x in range(k+1): for y in range(k+1): z = s - x - y if 0 <= z <= k: res += 1 print(res)
p03835
s976723148
Accepted
K, S = map(int, input().split()) result = 0 for x in range(K+1): for y in range(K+1): if 0 <= S - x - y <= K: result += 1 print(result)
p03835
s843437119
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
s739739375
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 0<=z<=k: cnt+=1 print(cnt)
p03835
s316598498
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
s579185182
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
s747800273
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
s397426703
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
s430294408
Accepted
K,S = map(int, input().split()) print(sum(max(0, min(2*K-S+z+1, S-z+1)) for z in range(K+1)))
p03835
s864029525
Accepted
k,s=[int(i) for i in 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
s800469171
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
s405142123
Accepted
K, S = map(int, input().split()) cnt = 0 for x in range(K+1): for y in range(min(K,S-x)+1): z = S - x - y if z <= K: cnt += 1 print(cnt)
p03835
s131887667
Accepted
k, s = map(int, input().split()) t = 0 for x in range(k + 1): for y in range(k + 1): if k >= s - x - y >= 0: t += 1 print(t)
p03835
s342536233
Accepted
def resolve(): ks = input().split(" ") k = int(ks[0]) s = int(ks[1]) n = 0 for zz in range(k+1): for yy in range (k+1): if (0 <= s-(yy+zz) <= k): n += 1 print(n) if __name__ == "__main__": resolve()
p03835
s460487532
Accepted
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 <= K and z >= 0: ans+=1 # print(x,y,z) print(ans)
p03835
s308740171
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
s493848821
Accepted
import sys import itertools sys.setrecursionlimit(1000000000) from heapq import heapify,heappop,heappush,heappushpop import math import collections MAX = 10**18 MIN = -10**18 MOD = 998244353 k,s = map(int,input().split()) cnt = 0 for i in range(k+1): for j in range(k+1): l = s-i-j if l>=0 and l<=k: cnt += 1 print(cnt)
p03835
s024226078
Accepted
# -*- coding: utf-8 -*- """ Created on Mon Jun 15 13:34:38 2020 @author: NEC-PCuser """ K, S = map(int, input().split()) count = 0 for i in range(K + 1): if S - i > 2 * K or S - i < 0: continue elif S - i <= K: count += (S - i + 1) else: for j in range(S - i + 1): if S - i - j > K or j > K: continue count += 1 print(count)
p03835
s703764980
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
s671326421
Accepted
import sys readline = sys.stdin.buffer.readline k,s = map(int,readline().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
s171908785
Accepted
k,s=map(int,input().split()) from math import factorial def c(n,r): return factorial(n)//factorial(n-r)//factorial(r) 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
s127547439
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
s948109676
Accepted
K, S = list(map(int, input().split())) answer = 0 for i in range(K+1): for j in range(K+1): if S - (i + j) >= 0 and S - (i + j) <= K: answer += 1 print(str(answer))
p03835
s832409191
Accepted
a,b=map(int,input().split()) ans=0 for i in range(a+1): for j in range(a+1): if 0<=(b-i-j)<=a: ans+=1 print(ans)
p03835
s918790262
Accepted
from collections import Counter,defaultdict,deque from heapq import heappop,heappush,heapify import sys,bisect,math,itertools,fractions sys.setrecursionlimit(10**8) mod = 10**9+7 INF = float('inf') def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split())) n,s = inpl() res = 0 for i in range(n+1): for j in range(n+1): if 0 <= s - (i+j) <= n: res += 1 print(res)
p03835
s248201557
Accepted
import sys def S(): return sys.stdin.readline().rstrip() K,S = map(int,S().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
s946241012
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
s183929504
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
s769676442
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
s634974552
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
s353533113
Accepted
K, S = map(int, input().split()) Sum = 0 for i in range(K + 1): for j in range(K + 1): if 0 <= S - i - j <= K: Sum += 1 print(Sum)
p03835
s259634179
Accepted
import sys import heapq from decimal import Decimal input = sys.stdin.readline 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
s924567277
Accepted
k,s=map(int,input().split()) count=0 for x in range(k+1): for y in range(k+1): if x+y>=s-k and x+y<=s: count +=1 print(count)
p03835
s516891891
Accepted
import sys sys.setrecursionlimit(10 ** 5) readline =sys.stdin.readline def process(): k,s = map(int,readline().rstrip().split()) cnt=0 for i in range(0,k+1): for j in range(0,k+1): z = s-(i+j) if z>=0 and z<=k: cnt+=1 return cnt print(process())
p03835
s983473347
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
s454162441
Accepted
import sys sys.setrecursionlimit(10 ** 5) # sys.stdin = open('input.txt', 'r') # sys.stdout = open('output.txt', 'w') readline =sys.stdin.readline # time - O(n2) def process(): k,s = map(int,readline().rstrip().split()) cnt=0 for i in range(0,k+1): for j in range(0,k+1): z = s-(i+j) if z>=0 and z<=k: cnt+=1 return cnt # for _ in range(int(readline().rstrip())): print(process())
p03835
s956944647
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<0: break else: if (S-i-j)>K: pass else: result += 1 print(result)
p03835
s863731963
Accepted
k,s= [int(i) for i in input().split()] x=0 j=0 for j in range(k+1): if s-j<=k and s-j>=0: x=x+s-j+1 elif (s-j)<=2*k and s-j>=0: x=x+(2*k-(s-j)+1) print(x)
p03835
s098433697
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
s015986195
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
s208204748
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
s884624357
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
s057219617
Accepted
k, s = map(int, input().split()) c = 0 for x in range(min(s, k)+1): for y in range(min(s-x, k)+1): if s-x-y <= k: c += 1 print(c)
p03835
s988564651
Accepted
k,s=map(int,input().split()) cnt=0 for z in range(0,min(k+1,s+1)): s_=s-z if s_<=k: cnt+=(s_+1) else: v=s_-k if v<=k: cnt+=(k-v+1) print(cnt)
p03835
s343628357
Accepted
k, s = map(int, input().split()) count = 0 for a in range(k+1): for b in range(k+1): if s-k <= a + b <= s: count += 1 else: pass print(count)
p03835
s021377553
Accepted
#!/usr/bin/env python 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
s072747893
Accepted
import sys input = sys.stdin.readline K, S = map(int, input().split()) # X + Y = A # Z = S - A ans = 0 for A in range(2*K+1): Z = S - A if 0 <= Z and Z <= K: for X in range(K+1): Y = A - X if 0 <= Y and Y <= K: ans += 1 print(ans)
p03835
s786213690
Accepted
k,s=map(int,input().split()) ans=0 for i in range(k+1): if s-i>=0: for j in range(min(s-i+1,k+1)): if s-i-j<=k and s-i-j>=0: ans+=1 print(ans)
p03835
s482671470
Accepted
k,s=map(int,input().split()) way=0 for x in range (k+1): for y in range (k+1): if 0<=s-x-y<=k: way+=1 print (way)
p03835
s386820828
Accepted
K, S = map(int, input().split()) cnt = 0 for i in range(K+1): for j in range(i, K+1): if 0 <= S - i - j <= K: if i == j: cnt += 1 else: cnt += 2 print(cnt)
p03835
s295071936
Accepted
K,S=map(int, input().split()) ans = 0 x = S//3+1 for i in range(x): y = (S-i)//2+1 for j in range(i, y): k = S - i - j if k > K: continue if i == j == k: ans += 1 elif i == j or j == k: ans += 3 else: ans += 6 print(ans)
p03835
s531041209
Accepted
k,s=map(int, input().split()) cnt=0 for p in range(k+1): for q in range(k+1): r=s-p-q if 0<=r<=k: cnt+=1 print(cnt)
p03835
s781782342
Accepted
k, s = map(int, input().split()) ans = 0 for i in range(k + 1): for j in range(i, k + 1): if j <= s - i - j <= k: l = s - i - j if i == j == l: ans += 1 elif i == j or j == l: ans += 3 elif i != j != l: ans += 6 print(ans)
p03835
s854587974
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
s880692508
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 and x+y+z == s: ans += 1 print(ans)
p03835
s956926141
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 z >=0 and z <=K: count += 1 print(count)
p03835
s919234479
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
s586332903
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
s158025654
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
s240451939
Accepted
import sys # import math # import decimal # import queue # import bisect # import heapq # import time # import itertools # from fractions import Fraction mod = int(1e9+7) INF = 1<<29 def main(): 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) return if __name__=='__main__': main()
p03835
s347402640
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
s407188712
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
s421610518
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
s238111040
Accepted
k,s = map(int, input().split()) ans = 0 for right in range(max(s-k, 0), min(s+1, 2*k+1)): lower = max(0, right-k) upper = min(k, right) if right % 2 != 0: ans += upper - lower + 1 else: ans += upper - lower + 1 print(ans)
p03835
s773048110
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
s811931251
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
s311348015
Accepted
def main(): 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) if __name__ == "__main__": main()
p03835
s822546863
Accepted
k,s=map(int,input().split()) ans=0 for i in range(k+1): for j in range(k+1): if i+j<=s and i+j+k>=s: ans+=1 print(ans)
p03835
s775725551
Accepted
K,S = map(int,input().split()) a = 0 for X in range(K+1): for Y in range(K+1): if 0<=S-X-Y<=K: a+=1 print(a)
p03835
s620002970
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
s825855141
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
s088490388
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
s679611683
Accepted
K, S = 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)
p03835
s622557053
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 x+y+z != s: continue if z >= 0 and z <= k: ans += 1 print(ans)
p03835
s371132069
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
s610063890
Accepted
import sys import os def main(): if os.getenv("LOCAL"): sys.stdin = open("input.txt", "r") K, S = map(int, sys.stdin.readline().split()) ret = 0 for x in range(K + 1): for y in range(K + 1): if S - x - y <= K and S - x - y >= 0: ret += 1 print(ret) if __name__ == '__main__': main()
p03835
s981736653
Accepted
k, s = map(int, input().split()) count = 0 for i in range(k+1): for j in range(k+1): if i+j+k >= s and s-i-j >= 0: count += 1 else: continue print(count)
p03835
s319825075
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
s245261085
Accepted
p = input().split() k = int(p[0]) s = int(p[1]) x = -1 y = -1 z = 0 answer = 0 for num in range(k+1): x += 1 y = -1 for n in range(k+1): y += 1 z = s - x - y if 0 <= z and z <= k: answer += 1 print(answer)
p03835
s801381281
Accepted
K, S = map(int, input().split()) ans = 0 for x in range(K + 1) : if x > S : continue for y in range(K + 1) : if 0 <= S - x - y <= K : ans += 1 print(ans)