problem_id
stringclasses
100 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
6
806
p03835
s170059440
Accepted
import sys K, S = map(int, sys.stdin.readline().strip().split()) N_MAX = min(K, S) ans = 0 for i in range(N_MAX+1): for j in range(N_MAX+1): if 0 <= S - (i + j) <= K: ans += 1 print(ans)
p03835
s658290218
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
s050684140
Accepted
k, s = 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
s950123903
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) <= k: count += 1 print(count)
p03835
s562295120
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 Z in range(K+1): count+=1 print(count)
p03835
s871403539
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
s154765852
Accepted
k,s = map(int,input().split()) ans = 0 for x in range(min(k,s)+1): for y in range(min(k,s)+1): if 0 <= s - x - y <= min(k,s): ans += 1 print(ans)
p03835
s770830016
Accepted
k,s=map(int,input().split()) ans=0 for a in range(k+1): for b in range(k+1): if 0<=s-a-b<=k: ans+=1 print(ans)
p03835
s590094664
Accepted
K, S = 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
s499318456
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
s138716217
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
s802838259
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)&(s-(i+j)>=0): count+=1 print(count)
p03835
s721584211
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
s288398985
Accepted
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
s499623001
Accepted
k, s = map(int, input().split()) cnt = 0 for l in range(k+1): for m in range(k+1): n = s - l - m if 0 <= n <= k: cnt += 1 print(cnt)
p03835
s382069900
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 0<=S-i-j): count=count+1 print(count)
p03835
s544185344
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
s709411162
Accepted
k,s = map(int,input().split()) cnt=0 for i in range(k+1): for j in range(k+1): if s-k<=i+j<=s: cnt+=1 print(cnt)
p03835
s690028742
Accepted
#!/usr/bin/env python def main(): 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) if __name__ == '__main__': main()
p03835
s125732876
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
s726590201
Accepted
k, s = map(int, input().split()) ans = 0 for a in range(k+1): for b in range(k+1): if 0 <= s - a - b <= k: ans += 1 print(ans)
p03835
s675364044
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
s409909569
Accepted
K,S = map(int,input().split()) count = 0 for x in range(0,K+1): for y in range(0,K+1): if (S - (x + y) <= K and S - (x + y) >= 0): count += 1 print(str(count))
p03835
s723912856
Accepted
k,s = map(int,input().split()) ans = 0 if(s == 0): print(1) exit() elif(s == 3*k): print(1) exit() for i in range(0,k+1): for j in range(0,k+1): z = s - i - j if(z >= 0 and z <= k): ans += 1 print(ans)
p03835
s385848446
Accepted
K, S=map(int, input().split()) s=S-2*K if S-2*K>0 else 0 e=S if S<K else K ans=0 for Z in range(s, e+1): if S-Z>K: ans+=2*K+Z-S+1 else: ans+=S-Z+1 print(ans)
p03835
s295062642
Accepted
K,S = map(int,input().split()) ans = 0 for k in range(K+1): ans += max(0, min(S - k, K) - max(0, S - k - K) + 1) print(ans)
p03835
s871043586
Accepted
[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 else: continue print(cnt)
p03835
s058938381
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-z-y <= k]))
p03835
s863680770
Accepted
N,M=map(int,input().split()) counter=0 for a in range(N+1): for b in range(N+1): if 0<=M-(a+b)<=N: counter+=1 print(counter)
p03835
s714314452
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
s329059494
Accepted
K, S = map(int, input().split()) count=0 for i in range(0, K+1): for j in range(0, K + 1): if 0 <= S-i-j <= K: count+=1 print(count)
p03835
s292102351
Accepted
k,s=map(int,input().split()) ans=0 for x in range(k+1): #xは 0~kまで x=0,1,2,.....k for y in range(x,k+1): #yはx~k+1まで, z = s-(x+y) #zはxとyできまる, このときxyzの組み合わせが確定して評価する. if z>k or z<y: continue if x == y and y == z: #x=y=z ans+=1 elif x==y or y == z or z==x: ans+=3 else: ans+=6 print(ans)
p03835
s115549879
Accepted
def resolve(): K, S = map(int, input().split()) count = 0 for x in range(K + 1): for y in range(K + 1): if S - K <= x + y <= S and max(x, y) <= K: count += 1 print(count) if __name__ == "__main__": resolve()
p03835
s006660960
Accepted
a = input() k, s = a.split(' ') K = int(k) S = int(s) 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
s395940333
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 and z <= k: count += 1 print(count)
p03835
s270281856
Accepted
x = list(map(int,input().split())) count=0 for a in range(max(0,x[1]-2*x[0]),min(x[0],x[1])+1): for b in range(max(0,x[1]-a-x[0]),min(x[0],x[1]-a)+1): for c in range(max(x[1]-a-b,0),min(x[1]-a-b,x[0])+1): if(a+b+c==x[1]): count+=1 print(count)
p03835
s345602408
Accepted
K, S = map(int, input().split()) Y = 0 for i in range(K+1): for j in range(K+1): if 0 <= S-i-j and S-i-j <= K: Y = Y+1 print(Y)
p03835
s824818355
Accepted
k,s = map(int, input().split()) c=0 for i in range(k+1): for j in range(k+1): if s>=i+j and k+1+i+j>s : c+=1 # print( c ) print( c )
p03835
s866359556
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
s529066580
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
s528971159
Accepted
K, S = map(int, input().split()) s = 0 for x in range(min(S,K)+1): for y in range(min(S-x,K)+1): if S-x-y<=K: s += 1 print(s)
p03835
s068048524
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
s271939209
Accepted
k,s = list(map(int, input().split())) cnt=0 for i in range(k+1): for j in range(k+1): if s>=i+j>=s-k: cnt+=1 print(cnt)
p03835
s815749629
Accepted
##import sys #import numpy as np import math #from fractions import Fraction import itertools from collections import deque from collections import Counter import heapq from fractions import gcd #input=sys.stdin.readline #import bisect k,s=map(int,input().split()) ans=0 for i in range(k+1): if s-i>2*k: continue else: for j in range(k+1): if s-i-j>k or s-i-j<0: continue else: ans+=1 print(ans)
p03835
s811871986
Accepted
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 = map(int, input().split()) print(actual(K, S))
p03835
s344083941
Accepted
a,b = map(int,input().split()) ans = 0 for x in range(b+1): if x > a: break for y in range(b+1): if y > a: break z = b-x-y if z <= a and z >= 0: ans +=1 else: continue print(ans)
p03835
s426869247
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
s638870809
Accepted
def resolve(): 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) resolve()
p03835
s746387189
Accepted
K, S = map(int, input().split()) l = max(S-K*2, 0) h = min(K, S) res = 0 for i in range(l, h+1): x = S-i ll = max(x-K, 0) hh = min(h, x) res += hh-ll+1 print(res)
p03835
s961984789
Accepted
k, s = [int(w) for w 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
s269933546
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
s758178496
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
s820532062
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
s226044130
Accepted
import sys input = sys.stdin.readline def main(): K, S = map(int, input().split()) ans = 0 X_max = min(S, K) for X in range(X_max + 1): Y_max = min(S - X, K) for Y in range(Y_max + 1): Z = S - (X + Y) if 0 <= Z <= K: ans += 1 else: continue print(ans) if __name__ == "__main__": main()
p03835
s988776953
Accepted
k, s = map(int, input().split()) ans = 0 for i in range(k+1): for j in range(k+1): if k >= s - i - j >= 0: ans += 1 print(ans)
p03835
s806415359
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
s588723299
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
s849823598
Accepted
k,s = map(int,input().split()) c = 0 for i in range(k+1): for j in range(k+1): #print(i,j) if (s - (i + j)) <= k and (i + j) <= s: c += 1 print(c)
p03835
s991495892
Accepted
k,s=map(int,input().split()) print(len([1 for x in range(k+1) for y in range(k+1) if 0<=s-x-y<=k]))
p03835
s448944368
Accepted
K,S = input().strip().split() K,S = int(K),int(S) count = 0 for x in range(S+1): for y in range(S+1-x): z = S - x- y #print( x,y,z) if x <= K and y <= K and z <= K: count += 1 print(count)
p03835
s508979358
Accepted
import numpy as np K, S = map(int, input().split()) fft_len = 1 << (K * 3).bit_length() x = np.ones(K + 1) Fx = np.fft.rfft(x, fft_len) Fx3 = Fx * Fx * Fx conv = np.fft.irfft(Fx3, fft_len) ans = conv[S] ans = int(ans + 0.5) print(ans)
p03835
s318545281
Accepted
K, S = map(int, input().split()) ans = 0 for x in range(K + 1): for y in range(K + 1): rest = S - (x + y) if rest >= 0 and rest <= K: ans += 1 print(ans)
p03835
s330820312
Accepted
def solve(K, S): count = 0 for x in range(K+1): for y in range(K+1): if K >= S - (x + y) >= 0 : count += 1 print(count) if __name__ == '__main__': K, S = map(int, input().split()) solve(K, S)
p03835
s707355894
Accepted
k, s = map(int, input().split()) ans = 0 for x in range(k+1): if x > s: break else: for y in range(k+1): if x+y > s: break elif s - x - y <= k: ans += 1 print(ans)
p03835
s858946078
Accepted
#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 = 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 and x+y+z == s): #print(x,y,z) ans += 1 print(ans)
p03835
s869817065
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 ans += (0 <= z <= k) print(ans)
p03835
s358306148
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
s254920914
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
s875163496
Accepted
# -*- coding: utf-8 -*- # for文を3つ回すと間に合わない # a + b + c = s が決まるとき a, b, s が決まれば c が決まる 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 print(cnt)
p03835
s959707379
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 (s - i - j <= k): ans += 1 print(ans)
p03835
s226514886
Accepted
from collections import defaultdict, deque import sys import heapq import bisect import itertools import queue import copy import time sys.setrecursionlimit(10**8) INF = float('inf') mod = 10**9+7 eps = 10**-7 def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split())) def inpl_str(): return list(sys.stdin.readline().split()) k, s = inpl() 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
s442485183
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 k >= z: count += 1 print(count)
p03835
s497774417
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
s030775124
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
s646468701
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
s567609600
Accepted
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
s536606156
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
s579995003
Accepted
K,S = map(int,input().split()) cnt = 0 for a in range(K+1): for b in range(K+1): if S-a-b>=0 and S-a-b<=K: cnt += 1 print(cnt)
p03835
s840740340
Accepted
# B - Sum of Three Integers k,s = map(int,input().split()) c = 0 min_limit = s - k for i in range(k+1): for j in range(k+1): if i + j <= s and i + j >= min_limit: c += 1 print(c)
p03835
s390084554
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
s709408887
Accepted
import itertools url = "https://atcoder.jp//contests/abc057/tasks/abc057_a" def main(): k, s = list(map(int, input().split())) count = 0 for x, y in itertools.product(range(k+1), range(k+1)): z = s - x - y if 0 <= z <= k: count += 1 print(count) if __name__ == '__main__': main()
p03835
s142761101
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
s662919168
Accepted
def actual(K, S): my_range = lambda n: range(n + 1) count = 0 for x in my_range(K): for y in my_range(K): z = S - (x + y) if 0 <= z <= K: count += 1 return count K, S = map(int, input().split()) print(actual(K, S))
p03835
s874494895
Accepted
import sys in1 = sys.stdin.readlines() #in1 = ['10 15'] K, S = map(int, in1[0].split()) RC = 0 for idx1 in range(K + 1): for idx2 in range(K + 1): if 0 <= S - idx1 - idx2 <= K: RC += 1 print(RC)
p03835
s261339696
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
s716187872
Accepted
K,S = [int(i) for i in input().split()] count = 0 for i in range(K+1): for j in range(K+1): k = S - i - j if 0 <= k and k <= K: count += 1 print(count)
p03835
s596981354
Accepted
k, s = 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
s970444059
Accepted
K,S=map(int,input().split()) count=0 for x in range(K+1): for y in range(x+1): z=S-x-y if z<0 or z>y: pass else: #print(x,y,z) if x==y==z: count+=1 elif x==y or x==z or y==z: count+=3 else: count+=6 print(count)
p03835
s533547462
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
s859152111
Accepted
# vim: fileencoding=utf-8 def main(): k, s = 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) if __name__ == "__main__": main()
p03835
s099563776
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<=k: ans+=1 print(ans)
p03835
s644291990
Accepted
k,s = map(int,input().split()) ans = 0 for i in range(k+1): for j in range(k+1): ans += (1 if 0 <= s-i-j <= k else 0) print(ans)
p03835
s977557332
Accepted
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
s330925308
Accepted
input_str = input().split() k = int(input_str[0]) s = int(input_str[1]) count = 0 for x in range(k+1): for y in range(k+1): if x+y <= s: z = s-(x+y) if z <= k: count += 1 print(count)
p03835
s555926075
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
s196115169
Accepted
import sys input = sys.stdin.readline 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: CNT += 1 print(CNT) if __name__ == '__main__': main()
p03835
s494908617
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
s038560676
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 and s-i-j<=k: ans+=1 print(ans)
p03835
s292403360
Accepted
import sys k, s = [int(i) for i in sys.stdin.readline().split()] cnt = 0 for x in range(min(k+1, s+1)): for y in range(min(k+1, s - x + 1)): if s - x - y <= k: cnt += 1 print(cnt)
p03835
s596968127
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 and s-i-j <= k: ans += 1 else: continue print(ans)