Problem:


Score : 200 points

Problem Statement

You are given two integers K and S.

Three variable X, Y and Z takes integer values satisfying 0≤X,Y,Z≤K.

How many different assignments of values to X, Y and Z are there such that X + Y + Z = S?  

Constraints

2≤K≤2500 

0≤S≤3K 

K and S are integers.  

Input

The input is given from Standard Input in the following format:

K S

Output

Print the number of the triples of X, Y and Z that satisfy the condition.

Sample Input 1

2 2

Sample Output 1

6

There are six triples of X, Y and Z that satisfy the condition:

X = 0, Y = 0, Z = 2 

X = 0, Y = 2, Z = 0 

X = 2, Y = 0, Z = 0 

X = 0, Y = 1, Z = 1 

X = 1, Y = 0, Z = 1 

X = 1, Y = 1, Z = 0

Sample Input 2

5 15

Sample Output 2

1

The maximum value of X + Y + Z is 15, achieved by one triple of X, Y and Z.



Sample input:
2 2


Sample output:
6

Submission status: Wrong Answer

Solution code:
K,S = map(int, input().split())

count = 0
for i in range(K+1):
  for j in range(K+1):
    if  0 <= S <= K:
      count += 1
print(count)

Submission status: Wrong Answer

Solution code:
k, s = 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:
            print(x,y)
            count += 1
print(count)

Submission status: Wrong Answer

Solution code:
k, s = 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 s-(x+y) >= 0 and s-(x+y) <= k :
                count += 1
print(count)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
K,S=map(int,input().split())
count=0
for i in range(1,K+1):
  for j in range(1,K+1):
    for k in range(1,K+1):
      if i+j+k==S:
        count=count+1
print(count)

Submission status: Wrong Answer

Solution code:
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:
            count += 1

print(count)

Submission status: Wrong Answer

Solution code:
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 x + y + (s-x-y) == s:
      ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
k, s = map(int, input().split())
count = 0
for kx in range(0, k+1):
    for ky in range(0, s-kx):
        kz = s - kx -ky
        if 0 <= kz <= k and kx + ky + kz == s:
            count += 1
print(count)

Submission status: Wrong Answer

Solution code:
k, s = map(int, input().split())
count = 0
for kx in range(0, k+1):
    for ky in range(0, s-kx+1):
        kz = s - kx -ky
        if 0 <= kz <= k and kx + ky + kz == s:
            count += 1
print(count)

Submission status: Wrong Answer

Solution code:
k, s = map(int, input().split())
count = 0
for kx in range(0, k+1):
    for ky in range(0, s-k+1):
        kz = s - kx -ky
        if 0 <= kz <= k and kx + ky + kz == s:
            count += 1
print(count)

Submission status: Wrong Answer

Solution code:
k, s = map(int, input().split())
count = 0
if k > s:
    print(0)
else:
    for kx in range(0, k+1):
        for ky in range(0, k+1):
            kz = s - kx -ky
            if 0 <= kz <= k and kx + ky + kz == s:
                count += 1
    print(count)

Submission status: Wrong Answer

Solution code:
k, s = map(int, input().split())
count = 0
for kx in range(0, k+1):
    for ky in range(0, k+1):
        kz = s - kx -ky
        if kx + ky + kz == s and 0 <= kz <= k:
            count += 1
            print(kx, ky, kz)
print(count)

Submission status: Wrong Answer

Solution code:
k, s = map(int, input().split())
count = 0
for kx in range(0, k+1):
    for ky in range(0, k+1):
        kz = s - kx -ky
        if kz >= 0 and kx + ky + kz == s:
            count += 1
print(count)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a = input()
    print(" ".join(a.split(",")))
    return

#B
def B():
    k, s = LI()
    ans = 0
    for i in range(k + 1):
        for j in range(k + 1):
            if 0 <= s - (i + j) <= k:
                ans += 1
    print(ans)
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    A()

Submission status: Wrong Answer

Solution code:
K,S=map(int,input().split())
print(int((S+2)*(S+1)/2))

Submission status: Wrong Answer

Solution code:
K,S = list(map(int,input().split()))

count = 0
for x in range(K):
  for y in range(K):
    if S-x-y < K and S-x-y >= 0:
      count += 1
        
print(count)

Submission status: Wrong Answer

Solution code:
K,S = list(map(int,input().split()))

count = 0
for x in range(K):
  for y in range(K):
    if S-x-y < K:
      count += 1
        
print(count)

Submission status: Wrong Answer

Solution code:
K,S = list(map(int,input().split()))

count = 0
for x in range(K):
  for y in range(K):
    for z in range(K):
      
      if x+y+z == S:
        count += 1
        
print(count)

Submission status: Wrong Answer

Solution code:
# Sum of Three Integers
K, S = map(int, input().split())
res = 0
for x in range(K+1):
    for y in range(K+1):
        if S - (x + y) <= K:
            res += 1
print(res)

Submission status: Wrong Answer

Solution code:
n,s=map(int,input().split())
ans=0
for i in range(n+1):
  for j in range(n+1):
    if 0<s-i-j<n+1:
      ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:
n,s=map(int,input().split())
ans=0
for i in range(n+1):
  for j in range(n+1):
    if s-i-j>-1 and s-i-j<s+1:
      ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:
K,S = map(int,input().split())
count = 0
#f = 0                                                                         
waru = S // 3
print('waru{}'.format(waru))
if waru*3 >= S:
    for x in range(waru,K+1):
        for y in range(waru,K+1):
            for z in range(waru,K+1):
                if x+y+z == S:
#                    print('1{}{}{}'.format(x,y,z))                            
                    count += 1
                #               f = 1                                          
                    break

    print(count)
else:
    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:
 #                   print('2{}{}{}'.format(x,y,z))                            
                    count += 1
                    break

    print(count)

Submission status: Wrong Answer

Solution code:
K,S = map(int,input().split())
count = 0
#f = 0                                                                         
waru = S // 3
print('waru{}'.format(waru))
if waru*3 >= S:
    for x in range(waru,K+1):
        for y in range(waru,K+1):
            for z in range(waru,K+1):
                if x+y+z == S:
#                    print('1{}{}{}'.format(x,y,z))                            
                    count += 1
                #               f = 1                                          
                    break

    print(count)
else:
    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:
 #                   print('2{}{}{}'.format(x,y,z))                            
                    count += 1
                    break

    print(count)

Submission status: Wrong Answer

Solution code:
K, S = map(int, input().split())

c = 0
for z in range(0, K+1):
    for y in range(0, z+1):
        for x in range(0, y+1):
            if x + y + z == S:
                c += 1

print(c*3)

Submission status: Wrong Answer

Solution code:
K, S = map(int, input().split())

count= 0

for i in range(K+1):# X
  for j in range(K+1):#Y
    Z = S - i - j
    if Z <= K & Z >=0:
      count += 1

print(count)

Submission status: Wrong Answer

Solution code:
import time
a, b = map(int, input().split())
c = 0
for i in range(b // 3, a + 1):
    for j in range((b - i) // 2, a + 1):
        if b - i - j <= a:
            c += 1
        elif b - i - j > a:
            break
print(c)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

#+++++
		
def main():
	k, s = map(int, input().split())
	c=0
	for x in range(k+1):
		for y in range(k+1):
			c+=1 if s-(x+y) <= k else 0
	
	print(c)
	
	
#+++++

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		
	ret = main()
	if ret is not None:
		print(ret)

Submission status: Wrong Answer

Solution code:
k,s=map(int,input().split())
x=0
m=min(s+1,k+1)
for a in range(m):
  for b in range(m):
    if a+b>s or a+b<s-k:
      continue
    x+=1
    break
print(x)

Submission status: Wrong Answer

Solution code:
k,s=map(int,input().split())
x=0
m=min(s+1,k+1)
for a in range(m):
  for b in range(m):
    if a+b>s or a+b<s-k:
      break
    x+=1
print(x)

Submission status: Wrong Answer

Solution code:
k,s=map(int,input().split())
x=0
m=min(s+1,k+1)
for a in range(m):
  for b in range(m):
    if a+b>s:
      break
    x+=1
print(x)

Submission status: Wrong Answer

Solution code:
k,s=map(int,input().split())
ans=0
x=max(0,s-k-k)
y=min(k+1,s+1)

for i in range(x,y):
    for j in range(x,y):
        if 0<=s-i-j<=s:
            ans+=1
            #print(i,j,s-i-j)
print(ans)

Submission status: Wrong Answer

Solution code:
import itertools

k,s = map(int,input().split())
lst = [x for x in range(k+1)]*3
ans = 0
for v in itertools.combinations(lst, 3): 
	if sum(v) == s:
		ans += 1
print(ans if ans < 4 else ans//3)

Submission status: Wrong Answer

Solution code:
K, S = map(int, input().split())
count = 0
for x in range(K+1):
    for y in range(0, K+1):
        if S - (x+y) <= K:
            count += 1
print(count)

Submission status: Wrong Answer

Solution code:
k,s=map(int,input().split())
print(sum([min(k,s-i)-max(0,s-i-k)+1 for i in range(k+1)]))

Submission status: Wrong Answer

Solution code:
k,s=map(int,input().split())
r=0
for i in range(k+1):
  r+=max(0,2*k+i-s+1)
print(r)

Submission status: Wrong Answer

Solution code:
import numpy as np
K,S = map(int,input().split())
x1 = np.arange(K+1, dtype=np.int32)
x2 = np.convolve(x1,x1)
x3 = np.convolve(x1,x2)
answer = x3[S]

Submission status: Wrong Answer

Solution code:
k,s=map(int,input().split())

l=[]

for i in range(max(0,s-2*k),min(s,k)+1):#xはmax(0,s-2*k)からmin(s,k)までの値をとる
    l.append(min(s,k)-i+1) #x=iの時、(y,z)の組み合わせはs-i+1通り
#print(l)
print(sum(l))

Submission status: Wrong Answer

Solution code:
k,s = map(int, input().split())
res = 0
for x in range(0, k):
  for y in range(0, k - x):
    if(s == x + y + (k - (x + y))):
      res = res + 1
print(res)

Submission status: Wrong Answer

Solution code:
k,s = map(int, input().split())
res = 0
for x in range(0, k + 1):
  for y in range(0, k + 1 - x):
    if(s == x + y + (k - (x + y))):
      res = res + 1
print(res)

Submission status: Wrong Answer

Solution code:
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 and x + y + z == s:
                        count += 1
print(count)

Submission status: Wrong Answer

Solution code:
from sys import stdin
K,S = [int(x) for x in stdin.readline().rstrip().split()]
ans = 0
for X in range(0,K+1):
    for Y in range(0,K+1):
            if S-(X+Y) >= 0:
                ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
from sys import stdin
K,S = [int(x) for x in stdin.readline().rstrip().split()]
ans = 0
for X in range(0,K+1):
    for Y in range(0,K+1):
            if S-(X+Y) <= K:
                ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
from sys import stdin
N,S = [int(x) for x in stdin.readline().rstrip().split()]
ans = 0
for X in range(0,S+1):
    for Y in range(0,S+1):
        for Z in range(0,S+1):
            if X+Y+Z == S:
                ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
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) <= s:
        cnt += 1

print(cnt)

Submission status: Wrong Answer

Solution code:
k,s = 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 == k:
                cnt += 1
print(cnt)

Submission status: Wrong Answer

Solution code:
K,S = map(int,input().split())
count = 0
for x in range(K + 1):
  for y in range(K + 1):
    if S-x-y >= 0:
      count +=1
print(count)

Submission status: Wrong Answer

Solution code:
k, s = map(int, input().split())
count = 0
for ai in range(k+1):
    remain = s - ai
    if remain > k * 2:
        continue
    if remain <= k:
        count += remain + 1
    else:
        count += k * 2 - remain + 1
print(count)

Submission status: Wrong Answer

Solution code:
s,k=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)

Submission status: Wrong Answer

Solution code:
s,k=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)

Submission status: Wrong Answer

Solution code:
s,k=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)

Submission status: Wrong Answer

Solution code:
s,k=map(int,input().split())
cnt = 0
for x in range(k+1):
    for y in range(k+1):
        if 0 <= s-(x+y) <= 2500:
            cnt+=1
print(cnt)

Submission status: Wrong Answer

Solution code:
def main():
    k, s = map(int, input().split())

    pattern = 0

    for x in range(s // 3, k + 1):
        for y in range(s // 3, min(k + 1, s - x + 1)):
            for z in range(s // 3, min(k + 1, s - x - y + 1)):
                if x + y + z == s:
                    pattern += 1

    print(pattern)


if __name__ == "__main__":

    main()

Submission status: Wrong Answer

Solution code:
def main():
    k, s = map(int, input().split())

    pattern = 0

    for x in range(k + 1):
        for y in range(s + 1 - x):
            for z in range(s + 1 - x - y):
                if x + y + z == s:
                    pattern += 1

    print(pattern)


if __name__ == "__main__":

    main()

Submission status: Wrong Answer

Solution code:
k, s = map(int, input().split())
c = 0
for i in range(k+1):
    if s - i >= k:
        u = k - (s - k - i) + 1
        if u > 0:
            c += u
    elif s - i < k:
        u = (k - i + 1)
        if u > 0:
            c += u
print(c)

Submission status: Wrong Answer

Solution code:
k,s=map(int,input().split())
count=0
for x in range(k+1):
  for y in range(s-x+1):
    z = s - x - y    
    if (z <= k) and (0 <= z):  
      count+=1
      
print(count)

Submission status: Wrong Answer

Solution code:

K,S = map(int,input().split())
one = 0
three = 0
six = 0
if S%3==0:
    one = 1
else:
    one = 0
for l in range(K+1):
    if (S-l)%2==0 and (S-l)//2 <= K:
        three += 1
for m in range(K-1):
    for n in range(m+1,K):
        rest = S-(m+n)
        if rest>n and rest<=K:
          six += 1
print(one+3*(three-one)+6*six)

Submission status: Wrong Answer

Solution code:
K,S = map(int,input().split())
one = 0
three = 0
six = 0
if S%3==0:
    one = 1
else:
    one = 0
for l in range(K+1):
    if (S-l)%2==0 and (S-l)//2 < K:
        three += 1
for m in range(K-1):
    for n in range(m+1,K):
        rest = S-(m+n)
        if rest>n and rest<=K:
          six += 1
print(one+3*three+6*six)

Submission status: Wrong Answer

Solution code:
K,S = map(int,input().split())
one = 0
three = 0
six = 0
if S%3==0:
    one = 1
else:
    one = 0
for l in range(K+1):
    if (S-l)%2==0 and (S-l)//2 < K:
        three += 1
for m in range(K-1):
    for n in range(m+1,K):
        rest = S-(m+n)
        if rest>n and rest<=K:
          six += (rest-n)
print(one+3*three+6*six)

Submission status: Wrong Answer

Solution code:
K,S = map(int,input().split())
one = 0
three = 0
six = 0
if S%3==0:
    one = 1
else:
    one = 0
for l in range(K+1):
    if (S-l)%2==0 and (S-l)//2 < K:
        three += 1
for m in range(K+1):
    for n in range(m+1,K+1):
        rest = S-(m+n)
        if rest>n and rest<=K:
          six += (rest-n)
print(one+3*three+6*six)

Submission status: Wrong Answer

Solution code:
K,S = map(int,input().split())
one = 0
three = 0
six = 0
if S%3==0:
    one = 1
else:
    one = 0
for l in range(K+1):
    if (S-l)%2==0 and (S-l)//2 < K:
        three += 1
for m in range(K+1):
    for n in range(m+1,K+1):
        rest = S-(m+n)
        if rest>n and rest<=K:
            six += rest
print(one+3*three+6*six)

Submission status: Wrong Answer

Solution code:
K,S = map(int,input().split())
one = 0
three = 0
six = 0
div = S//3
if S%3==0:
    one = 1
else:
    one = 0
for l in range(K+1):
    if (S-l)%2==0 and (S-l)//2 < K:
        three += 1
for m in range(div):
    for n in range(m+1,div+1):
        rest = S-(m+n)
        if rest>n and rest<=K:
            six += rest

print(one+3*three+6*six)

Submission status: Wrong Answer

Solution code:
K,S = map(int,input().split())
one = 0
three = 0
six = 0
if S%3==0:
  one = 1
else:
  one = 0
for i in range(K+1):
  if (S-i)%2==0 and S%3!=0:
    three +=1

for l in range(K+1):
  for m in range(l+1,K+1):
    for n in range(m+1,K+1):
      if l+m+n == S:
        six +=1
print(one+3*three+6*six)

Submission status: Wrong Answer

Solution code:
K,S = map(int,input().split())
cnt= 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):
                break
                if ((x + y + z )== S):
                    cnt += 1

print(cnt)

Submission status: Wrong Answer

Solution code:
#入力部分を取得
#A, B, C = map(int,input().split())

#sumを取得
#sum([A,B,C])

#importするとき
#import math

#配列に入れる
#b_list=list(map(int,input().split()))

#一つ代入する(数値)
#e=int(input())

#取得する
#e=input()

#切り捨て
#math.floor((3*A + P)/2)

#stringからdatetimeへ変換
# 例1
#string_date_1 = '2017/07/01'
#atetime.datetime.strptime(string_date_1, '%Y/%m/%d')

#forの使い方
#for i in range(3):
#    print(haiku[i])
#for haiku in haikus:
#    print(haiku)

#分割して受け取る
#haiku = haikus.split(",")

K,S = map(int,input().split())
cnt= 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 & y==z):
                    cnt += 1
                elif(x==y | y==z):
                    cnt += 2
                else:
                    cnt += 3

print(cnt)

Submission status: Wrong Answer

Solution code:
K, S = map(int, input().split())

cnt = 0
for i in range(K):
    for j in range(K):
        for k in range(K):
            if i + j + k == S:
                cnt += 1

print(cnt)

Submission status: Wrong Answer

Solution code:
count=0
z=0
k,s=map(int,input().split())
for i in range(k+1):
    for j in range(k+1):
        x=i
        y=j
        z=-i-j+s
        if z>=0:
            count+=1
print(count)

Submission status: Wrong Answer

Solution code:
k, s = map(int, input().split())
cnt = 0
for i in range(s+1):
    for j in range(s+1-i):
        k = s - i - j
        if 0 <= k <= s:
            cnt += 1
print(cnt)

Submission status: Wrong Answer

Solution code:
k, s = map(int, input().split())
cnt = 0
for i in range(s+1):
    for j in range(s+1-i):
        k = s - i - j
        if 0 <= k:
            cnt += 1
print(cnt)

Submission status: Wrong Answer

Solution code:
k, s = map(int, input().split())
cnt = 0
for i in range(s+1):
    for j in range(s+1):
        k = s - i - j
        if 0 <= k:
            cnt += 1
print(cnt)

Submission status: Wrong Answer

Solution code:
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:
            ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
def fib(n):
    diff = 0
    tmp = 0
    for i in range(n+1):
        diff += 1
        tmp += diff
    return tmp


k, s = map(int, input().split())
d = min(s, k * 3 - s)
print(fib(d))

Submission status: Wrong Answer

Solution code:
a = list(map(int,input().split()))
k = a[0]
s = a[1]
num=0
for l in range(k+1):
    for m in range(k+1):
        n = s-l-m
        if(n <= k & n >= 0):
            num+=1

print(num)

Submission status: Wrong Answer

Solution code:
a = list(map(int,input().split()))
num=0
for l in range(a[0]+1):
    for m in range(a[0]+1):
        if(a[1]-l-m <= a[0]):
            num+=1
print(num)

Submission status: Wrong Answer

Solution code:
a = list(map(int,input().split()))
num=0
for l in range(a[0]+1):
    for m in range(a[0]+1):
        if(a[1]-l-m <= a[0]):
            num+=1

Submission status: Wrong Answer

Solution code:
a = list(map(int,input().split()))
for l in range(a[0]+1):
    for m in range(a[0]+1):
        if(a[1]-l-m <= a[0]):
            print(l,m,a[1]-l-m)

Submission status: Wrong Answer

Solution code:
import itertools

k,s = input().split()
k = int(k)
s = int(s)

count=0

def sum(a,b,c):
  return 1 if (a + b + c == s) else 0
  
	
for i, j in itertools.product(range(k+1), range(k+1)):
  for m in range(k):
    count += sum(i+1,j+1,m+1)
    	
print(count)

Submission status: Wrong Answer

Solution code:
import itertools

k,s = input().split()
k = int(k)
s = int(s)

count=0

def sum(a,b,c):
  return 1 if (a + b + c == s) else 0
  
	
for i, j in itertools.product(range(k), range(k)):
  for m in range(k):
    count += sum(i+1,j+1,m+1)
    	
print(count)

Submission status: Wrong Answer

Solution code:
k,s = input().split()
k = int(k)
s = int(s)

count=0

def sum(a,b,c):
  return 1 if (a + b + c == s) else 0
  
	
    
for i in range(k):
  for j in range(k):
    for m in range(k):
      count += sum(i+1,j+1,m+1)
    	
print(count)

Submission status: Wrong Answer

Solution code:
k,s = input().split()
k = int(k)
s = int(s)
c = 1

count=0
for i in range(k):
  for j in range(k):
    for m in range(k):
      if i+j+m == s:
        count+=1
print(count)

Submission status: Wrong Answer

Solution code:
K, S = map(int, input().split())

count = 0
z = 0
flag = False
for x in reversed(range(0,K+1)):
  for y in reversed(range(0,K+1)):
    for z in reversed(range(0,K+1)):
      if S == x + y + z:    
        count = count + 1
        flag = True
        break
      if flag == True:
      	break
    if flag == True:
      break
  if flag == True:
    break
          
print(count)

Submission status: Wrong Answer

Solution code:
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:
        count += 1
      
print(count)

Submission status: Wrong Answer

Solution code:
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 :
        count += K - (S-i-j) +1
    else:
      pass
      
print(count)

Submission status: Wrong Answer

Solution code:
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 :
        count += 1
    else:
      pass
      
print(count)

Submission status: Wrong Answer

Solution code:
k,s=map(int,input().split())
ans=0
def als(n):
  if n<=k:
    return n+1
  elif k+1<=n<=2*k:
    return 2*k+1-n
  else:
    return 0
for i in range(k+1):
  ans+=als(s-i)
print(ans)

Submission status: Wrong Answer

Solution code:
k,s=map(int,input().split())
ans=0
def als(n):
  if n<=k:
    return n
  elif k+1<=n<=2*k:
    return 2*k+1-n
  else:
    return 0
for i in range(k+1):
  ans+=als(s-i)
print(ans)

Submission status: Wrong Answer

Solution code:
k,s=map(int,input().split())
ans=0
for i in range(0,s+1):
	ans+=s-i+1
print(ans)

Submission status: Wrong Answer

Solution code:
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 :
            count += 1

print(count)

Submission status: Wrong Answer

Solution code:
K,S=map(int,input().split())
sum=0
count=0
for i in range(K+1):
    sum+=i
    a=sum
    for j in range(S-sum+1):
        sum+=j
        if sum==S: #X＝Sの場合
            count+=1
            #print(str(i)+" "+str(j))
            break
        if S-sum>=0 and S-sum<=K :
            count+=1
            #print(str(i)+" "+str(j))
        sum=a #jを足す前に戻す
    sum=0
print(count)

Submission status: Wrong Answer

Solution code:
K,S=map(int,input().split())
sum=0
count=0
for i in range(K+1):
    sum+=i
    a=sum
    for j in range(K+1):
        sum+=j
        if sum==S: #X＝Sの場合
            count+=1
            #print(str(i)+" "+str(j))
            break
        if S-sum<=K:
            count+=1
            #print(str(i)+" "+str(j))
        sum=a #jを足す前に戻す
    sum=0
print(count)

Submission status: Wrong Answer

Solution code:
k, s = map(int, input().split())
res = 0
su = 0
for x in range(0, k + 1):
    for y in range(0, k - x + 1):
        for z in range(0, k - x - y + 1):
            su = x + y + z
            if su == s:
                res += 1
print(res)

Submission status: Wrong Answer

Solution code:
k,s=map(int,input().split())
ans=0
for i in range(k):
  for j in range(k):
    for h in range(k):
      if i+j+h==s:
        ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import string
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

K, S = list(map(int, sys.stdin.readline().split()))

ans = 0
for x in range(K + 1):
    yz = S - x
    if 2 * K < yz:
        continue
    ans += yz + 1
    ans -= max(0, yz - K) * 2
print(ans)

Submission status: Wrong Answer

Solution code:
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import string
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

K, S = list(map(int, sys.stdin.readline().split()))

ans = 0
for x in range(K + 1):
    yz = S - x
    if 2 * K < yz:
        continue
    ans += min(yz + 1, K * 2 - yz + 1)
print(ans)

Submission status: Wrong Answer

Solution code:
k,s=map(int, input().split())
ans=0
for x in range(s+1):
    for y in range(s+1):
        for z in range(s+1):
            if x+y+z==s and x<=k and y<=k and z<=k:
                print(x,y,z)
                ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:
K, S = 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:
                print([x,y,z])
                ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
K, S = map(int, input().split())

ans = 0

for i in range(K+1):
    for j in range(K+1-i):
        x = i
        y = j
        z = S-x-y
        if z>=0 or z<=K:
            # print([x,y,z])
            ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
k, s = map(int, input().split())
res = 0
for x in range(k + 1):
    for y in range(2500):
        z = s - y - x
        if z >= 0 and x <= k and y <= k and z <= k:
            #print("{0}, {1} {2}".format(str(x), str(y), str(z)))
            res += 1
print(res)

Submission status: Wrong Answer

Solution code:
k,s = map(int,input().split())

counts = 0
for x in range(k+1):
    for y in range(k+1-x):
        if s-x-y >= 0 and s-x-y <= k:
            counts  += 1
print(counts)

Submission status: Wrong Answer

Solution code:

k,s = map(int,input().split())

count = 0

for x in range(0,s+1):
    #print(x)
    for y in range(0,s+1):
        #print(y)
        if 0 <= (s-x-y) and (s-x-y) <= k:
            count += 1
print(count)

Submission status: Wrong Answer

Solution code:

k,s = map(int,input().split())

count = 0

for x in range(0,s+1):
    #print(x)
    for y in range(0,s+1):
        #print(y)
        for z in range(0,s+1):
            #print(z)
            if (x+y+z) == s :
                count += 1

print(count)

Submission status: Wrong Answer

Solution code:
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:
      count +=1
print(count)

Submission status: Wrong Answer

Solution code:
K,S = map(int,input().split())

def F(K,S):
  # x+Y = S, <=K
  if S <= K:
    return (S+1)
  if S > K+K:
    return 0
  return (K+K-S+1)

answer = 0

for x in range(K+1):
  answer += F(K,S-x)

print(answer)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
k, s = map(int,input().split())
count = 0
if k == s/3:
  print(1)
  exit()
for x in range(k+1):
  for y in range(k+1):
    if (s- x- y) >= 0:
      z = s - x -y
    if x + y + z == s:
      #print(x,y,z)
      count += 1
print(count)

Submission status: Wrong Answer

Solution code:
k, s = map(int, input().split())
count = 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) and (i == l):
                count = count + 1
            if (i + j + l == s) and (i < l):
                count = count + 3
print(count)

Submission status: Wrong Answer

Solution code:
k, s = 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 0 <= s - (i + j) <= k:
                count += 1
print(count)

Submission status: Wrong Answer

Solution code:
K,S = map(int,input().split())
cnt = 0
for i in range(K + 1):
    for j in range(K + 1):
        if i + j > S:
            continue
        elif i + j == S - K:
            cnt += 1
print(cnt)

Submission status: Wrong Answer

Solution code:
K,S = map(int,input().split())
cnt = 0
for i in range(K + 1):
    for j in range(K + 1):
        if i + j > K:
            continue
        else:
            cnt += 1
print(cnt)

Submission status: Wrong Answer

Solution code:
K, S = map(int, input().split())

result = 0
for x in range(K + 1):
  for y in range(K + 1 - x):
    z = K - x - y
    if x + y + z == S:
      result += 1
print(result)

Submission status: Wrong Answer

Solution code:
#n = list(map(int, (input()).split(' ')))
n = [2500,7500]
#print(n)
x = [ i   for i in range(n[0]+1)]
#y = [ i   for i in range(n[1]+1)]
#z = [ i   for i in range(n[1]+1)]
#print(x)
counter = 0
if n[0]*3 >= n[1]:
  for x1 in x:
    for y1 in x:
      if 0<= n[1]-x1-y1 <=n[0]  :
          counter +=1

        
print(counter)