Buggy python submission (verdict: Time Limit Exceeded):
#K : XYZそれぞれは、0以上K以下
#S : X+Y+Zの合計値を示すS

K,S = map(int,input().split())

X=Y=Z=0
result = 0
while(X<=S and X<=K):
    while(X+Y<=S and Y<=K):
        if 0 <= S-X-Y <=K:
            result +=1
        # Z = S-X-Y
        # # print("XYZ",X,Y,Z)
        # if X+Y+Z == S:
        #     if  Z<=K :
        #         result+=1 
        Y+=1
    Y=0
    X+=1

print(result)

Fixed submission:
#K : XYZそれぞれは、0以上K以下
#S : X+Y+Zの合計値を示すS

K,S = map(int,input().split())

X=Y=Z=0
result = 0
for x in range(K+1):
    for y in range ( K+1 ):
        if 0 <= S-X-Y <=K:
            result +=1
        # Z = S-X-Y
        # # print("XYZ",X,Y,Z)
        # if X+Y+Z == S:
        #     if  Z<=K :
        #         result+=1 
        Y+=1
    Y=0
    X+=1

print(result)

Buggy python submission (verdict: Time Limit Exceeded):
#K : XYZそれぞれは、0以上K以下
#S : X+Y+Zの合計値を示すS

K,S = map(int,input().split())

X=Y=Z=0
result = 0
while(X<=S and X<=K):
    while(X+Y<=S and Y<=K):
        Z = S-X-Y
        # print("XYZ",X,Y,Z)
        if X+Y+Z == S:
            if  Z<=K :
                result+=1 
        Y+=1
    Y=0
    X+=1

print(result)

Fixed submission:
#K : XYZそれぞれは、0以上K以下
#S : X+Y+Zの合計値を示すS

K,S = map(int,input().split())

X=Y=Z=0
result = 0
for x in range(K+1):
    for y in range ( K+1 ):
        if 0 <= S-X-Y <=K:
            result +=1
        # Z = S-X-Y
        # # print("XYZ",X,Y,Z)
        # if X+Y+Z == S:
        #     if  Z<=K :
        #         result+=1 
        Y+=1
    Y=0
    X+=1

print(result)

Buggy python submission (verdict: Time Limit Exceeded):
#K : XYZそれぞれは、0以上K以下
#S : X+Y+Zの合計値を示すS

K,S = map(int,input().split())

X=Y=Z=0
result = 0
while(X<=S):
    while(X+Y<=S):
        Z = S-X-Y
        # print("X,Y,Z",X,Y,Z)
        if X+Y+Z == S:
            if X<=K and Y<=K and Z<=K :
                result+=1 
        # Z=X+Y-S
        # if X+Y+Z==S:
        #     result +=1
        # while(Z<=K):
        #     if X+Y+Z<S:
        #         pass
        #     elif X+Y+Z==S:
        #         result +=1
        #     else:
        #         break
        #     Z+=1
        # if X+Y+Z>S:
        #     break
        if Y<K:
            Y+=1
        else:
            break
    if X<K:
        Y=0
        X+=1
    else:
        break

print(result)

Fixed submission:
#K : XYZそれぞれは、0以上K以下
#S : X+Y+Zの合計値を示すS

K,S = map(int,input().split())

X=Y=Z=0
result = 0
for x in range(K+1):
    for y in range ( K+1 ):
        if 0 <= S-X-Y <=K:
            result +=1
        # Z = S-X-Y
        # # print("XYZ",X,Y,Z)
        # if X+Y+Z == S:
        #     if  Z<=K :
        #         result+=1 
        Y+=1
    Y=0
    X+=1

print(result)

Buggy python submission (verdict: Time Limit Exceeded):
#K : XYZそれぞれは、0以上K以下
#S : X+Y+Zの合計値を示すS

K,S = map(int,input().split())

X=Y=Z=0
result = 0
while(X<=S):
    while(X+Y<=S):
        Z = S-X-Y
        # print("X,Y,Z",X,Y,Z)
        if X+Y+Z == S:
            if X<=K and Y<=K and Z<=K :
                result+=1 
        # Z=X+Y-S
        # if X+Y+Z==S:
        #     result +=1
        # while(Z<=K):
        #     if X+Y+Z<S:
        #         pass
        #     elif X+Y+Z==S:
        #         result +=1
        #     else:
        #         break
        #     Z+=1
        # if X+Y+Z>S:
        #     break
        if Y<=K:
            Y+=1
        else:
            break
    Y=0
    X+=1
print(result)

Fixed submission:
#K : XYZそれぞれは、0以上K以下
#S : X+Y+Zの合計値を示すS

K,S = map(int,input().split())

X=Y=Z=0
result = 0
for x in range(K+1):
    for y in range ( K+1 ):
        if 0 <= S-X-Y <=K:
            result +=1
        # Z = S-X-Y
        # # print("XYZ",X,Y,Z)
        # if X+Y+Z == S:
        #     if  Z<=K :
        #         result+=1 
        Y+=1
    Y=0
    X+=1

print(result)

Buggy python submission (verdict: Time Limit Exceeded):
#K : XYZそれぞれは、0以上K以下
#S : X+Y+Zの合計値を示すS

K,S = map(int,input().split())

X=Y=Z=0
result = 0
while(X<=S):
    while(X+Y<=S):
        Z = S-X-Y
        if X+Y+Z == S:
            if X<=K and Y<=K and Z<=K :
                result+=1 
        # Z=X+Y-S
        # if X+Y+Z==S:
        #     result +=1
        # while(Z<=K):
        #     if X+Y+Z<S:
        #         pass
        #     elif X+Y+Z==S:
        #         result +=1
        #     else:
        #         break
        #     Z+=1
        # if X+Y+Z>S:
        #     break
        Y+=1
    Y=0
    X+=1
print(result)

Fixed submission:
#K : XYZそれぞれは、0以上K以下
#S : X+Y+Zの合計値を示すS

K,S = map(int,input().split())

X=Y=Z=0
result = 0
for x in range(K+1):
    for y in range ( K+1 ):
        if 0 <= S-X-Y <=K:
            result +=1
        # Z = S-X-Y
        # # print("XYZ",X,Y,Z)
        # if X+Y+Z == S:
        #     if  Z<=K :
        #         result+=1 
        Y+=1
    Y=0
    X+=1

print(result)

Buggy python submission (verdict: Time Limit Exceeded):
#K : XYZそれぞれは、0以上K以下
#S : X+Y+Zの合計値を示すS

K,S = map(int,input().split())

X=Y=Z=0
result = 0
while(X<=K):
    while(Y<=K):
        while(Z<=K):
            # print("X,Y,Z",X,Y,Z)
            if X+Y+Z<S:
                pass
            elif X+Y+Z==S:
                result +=1
            else:
                break
            Z+=1
        Z=0
        Y+=1
        if X+Y+Z>S:
            break
    Y=0
    X+=1
print(result)

Fixed submission:
#K : XYZそれぞれは、0以上K以下
#S : X+Y+Zの合計値を示すS

K,S = map(int,input().split())

X=Y=Z=0
result = 0
for x in range(K+1):
    for y in range ( K+1 ):
        if 0 <= S-X-Y <=K:
            result +=1
        # Z = S-X-Y
        # # print("XYZ",X,Y,Z)
        # if X+Y+Z == S:
        #     if  Z<=K :
        #         result+=1 
        Y+=1
    Y=0
    X+=1

print(result)

Buggy python submission (verdict: Time Limit Exceeded):
#K : XYZそれぞれは、0以上K以下
#S : X+Y+Zの合計値を示すS

K,S = map(int,input().split())

X=Y=Z=0
result = 0
while(X<=K):
    while(Y<=K):
        while(Z<=K):
            if X+Y+Z<S:
                pass
            elif X+Y+Z==S:
                result +=1
            else:
                break
            Z+=1
        Z=0
        Y+=1
    Y=0
    X+=1
print(result)

Fixed submission:
#K : XYZそれぞれは、0以上K以下
#S : X+Y+Zの合計値を示すS

K,S = map(int,input().split())

X=Y=Z=0
result = 0
for x in range(K+1):
    for y in range ( K+1 ):
        if 0 <= S-X-Y <=K:
            result +=1
        # Z = S-X-Y
        # # print("XYZ",X,Y,Z)
        # if X+Y+Z == S:
        #     if  Z<=K :
        #         result+=1 
        Y+=1
    Y=0
    X+=1

print(result)