Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
 
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 z==S-x-y: count+=1
print(count)

Fixed submission:
import sys
input = sys.stdin.readline
 
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: count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
 
K,S=map(int,input().split())
count=0
if 2<=K<=2500:
  if 0<=S<=3*K:
      for x in range(K+1):
        for y in range(K+1):
          for z in range(K+1):
            if z==S-x-y:
              count+=1
print(count)

Fixed submission:
import sys
input = sys.stdin.readline
 
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: count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
 
K,S=map(int,input().split())
count=0
if 2<=K<=2500:
  if 0<=S<=3*K:
      for x in range(K+1):
        for y in range(K+1):
          for z in range(K+1):
            if z==S-x-y:
              count+=1
print(count)

Fixed submission:
import sys
input = sys.stdin.readline
 
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: count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
#ないよりも10倍以上早くなる
import sys
input = sys.stdin.readline
 
K,S=map(int,input().split())
if 2<=K<=2500 and 0<=S<=3*K:
    count=0
    Ks=[]
    for x in range(K+1):
        for y in range(K+1):
            for z in range(K+1):
                if z==S-x-y: count+=1
    print(count)

Fixed submission:
import sys
input = sys.stdin.readline
 
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: count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
#ないよりも10倍以上早くなる
import sys
input = sys.stdin.readline
 
K,S=map(int,input().split())
if 2<=K<=2500 and 0<=S<=3*K:
    count=0
    Ks=[]
    wa=[]
    for i in range(K+1):
        Ks.append(i)
    X,Y,Z =Ks,Ks,Ks
    for x in X:
      if x<=S:
        X_=[]
        X_.append(x)
        for y in Y:
          if y<=S:
            X_Y_=list(X_)
            X_Y_.append(y)
            wa_=sum(X_Y_)
            wa.append(wa_)
    wa= [w for w in wa if w<=S]
    for z in Z:
      if z<=S:
        for j in wa:
            j+=z
            if j==S:
                count+=1
    print(count)

Fixed submission:
import sys
input = sys.stdin.readline
 
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: count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
#ないよりも10倍以上早くなる
import sys
input = sys.stdin.readline
 
K,S=map(int,input().split())
if 2<=K<=2500 and 0<=S<=3*K:
    count=0
    Ks=[]
    wa=[]
    for i in range(K+1):
        Ks.append(i)
    X,Y,Z =Ks,Ks,Ks
    for x in X:
        X_=[]
        X_.append(x)
        for y in Y:
            X_Y_=list(X_)
            X_Y_.append(y)
            wa_=sum(X_Y_)
            wa.append(wa_)
    wa= [w for w in wa if w<=S]
    for z in Z:
        for j in wa:
            j+=z
            if j==S:
                count+=1
    print(count)

Fixed submission:
import sys
input = sys.stdin.readline
 
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: count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
#ないよりも10倍以上早くなる
import sys
input = sys.stdin.readline
 
K,S=map(int,input().split())
if 2<=K<=2500 and 0<=S<=3*K:
    count=0
    Ks=[]
    wa=[]
    for i in range(K+1):
        Ks.append(i)
    X,Y,Z =Ks,Ks,Ks
    for x in X:
        if x<=S:
            X_=[]
            X_.append(x)
            for y in Y:
                if y<=S:
                    X_Y_=list(X_)
                    X_Y_.append(y)
                    wa_=sum(X_Y_)
                    wa.append(wa_)
    for z in Z:
        for j in wa:
            j+=z
            if j==S:
                count+=1
    print(count)

Fixed submission:
import sys
input = sys.stdin.readline
 
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: count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
#ないよりも10倍以上早くなる
import sys
input = sys.stdin.readline

K,S=map(int,input().split())
if 2<=K<=2500 and 0<=S<=3*K:
    count=0
    Ks=[]
    wa=[]
    for i in range(K+1):
        Ks.append(i)
    X,Y,Z =Ks,Ks,Ks
    for x in X:
        if x<=S:
            X_=[]
            X_.append(x)
            for y in Y:
                if y<=S:
                    X_Y_=list(X_)
                    X_Y_.append(y)
                    wa_=sum(X_Y_)
                    wa.append(wa_)
    wa= [w for w in wa if w<=S]
    for z in Z:
        for j in wa:
            j+=z
            if j==S:
                count+=1
    print(count)

Fixed submission:
import sys
input = sys.stdin.readline
 
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: count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
#ないよりも10倍以上早くなる
import sys
input = sys.stdin.readline

K,S=map(int,input().split())
if 2<=K<=2500 and 0<=S<=3*K:
    count=0
    Ks=[]
    wa=[]
    for i in range(K+1):
        Ks.append(i)
    X,Y,Z =Ks,Ks,Ks
    for x in X:
        if x<=S:
            X_=[]
            X_.append(x)
            for y in Y:
                if y<=S:
                    X_Y_=list(X_)
                    X_Y_.append(y)
                    wa_=sum(X_Y_)
                    wa.append(wa_)
    for z in Z:
        for j in wa:
            j+=z
            if j==S:
                count+=1
    print(count)

Fixed submission:
import sys
input = sys.stdin.readline
 
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: count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
#ないよりも10倍以上早くなる
import sys
input = sys.stdin.readline

K,S=map(int,input().split())
if 2<=K<=2500 and 0<=S<=3*K:
    count=0
    Ks=[]
    wa=[]
    for i in range(K+1):
        Ks.append(i)
    X,Y,Z =Ks,Ks,Ks
    for x in X:
        if x<=S:
            X_=[]
            X_.append(x)
            for y in Y:
                if y<=S:
                    X_Y_=list(X_)
                    X_Y_.append(y)
                    wa_=sum(X_Y_)
                    wa.append(wa_)
    for z in Z:
        for j in wa:
            j+=z
            if j==S:
                count+=1
    print(count)

Fixed submission:
import sys
input = sys.stdin.readline
 
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: count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
#ないよりも10倍以上早くなる
import sys
input = sys.stdin.readline

K,S=map(int,input().split())
if 2<=K<=2500 and 0<=S<=3*K:
    count=0
    Ks=[]
    wa=[]
    for i in range(K+1):
        Ks.append(i)
    X,Y,Z =Ks,Ks,Ks
    for x in X:
        if x<=S:
            X_=[]
            X_.append(x)
            for y in Y:
                if y<=S:
                    X_Y_=[]
                    X_Y_=list(X_)
                    X_Y_.append(y)
                    for z in Z:
                        if z<=S:
                            X_Y_Z_=list(X_Y_)
                            X_Y_Z_.append(z) 
                            wa_=sum(X_Y_Z_)
                            wa.append(wa_)
    for j in wa:
        if j==S:
            count+=1
    print(count)

Fixed submission:
import sys
input = sys.stdin.readline
 
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: count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
K,S=map(int,input().split())
if 2<=K<=2500 and 0<=S<=3*K:
    count=0
    Ks=[]
    wa=[]
    for i in range(K+1):
        Ks.append(i)
    X,Y,Z =Ks,Ks,Ks
    for x in X:
        if x<=S:
            X_=[]
            X_.append(x)
            for y in Y:
                if y<=S:
                    X_Y_=[]
                    X_Y_=list(X_)
                    X_Y_.append(y)
                    for z in Z:
                        if z<=S:
                            X_Y_Z_=list(X_Y_)
                            X_Y_Z_.append(z) 
                            wa_=sum(X_Y_Z_)
                            wa.append(wa_)
    for j in wa:
        if j==S:
            count+=1
    print(count)

Fixed submission:
import sys
input = sys.stdin.readline
 
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: count+=1
print(count)

Buggy python submission (verdict: Runtime Error):
K,S=map(int,input().split())
if 2<=K<=2500 and 0<=S<=3*K:
    Ks=[]
    wa=[]
    for i in range(K+1):
        Ks.append(i)
    X,Y,Z =Ks,Ks,Ks
    for x in X:
        if x<=S:
            X_=[]
            X_.append(x)
            for y in Y:
                if y<=S:
                    X_Y_=[]
                    X_Y_=list(X_)
                    X_Y_.append(y)
                    for z in Z:
                        if z<=S:
                            X_Y_Z_=list(X_Y_)
                            X_Y_Z_.append(z) 
                            wa_=sum(X_Y_Z_)
                            wa.append(wa_)
    for j in wa:
        if j==S:
            count+=1
    print(count)

Fixed submission:
import sys
input = sys.stdin.readline
 
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: count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
K,S=map(int,input().split())
if 2<=K<=2500 and 0<=S<=3*K:
    Ks=[]
    wa=[]
    for i in range(K+1):
        Ks.append(i)
    X,Y,Z =Ks,Ks,Ks
    for x in X:
        if x<=S:
            X_=[]
            X_.append(x)
            for y in Y:
                if y<=S:
                    X_Y_=[]
                    X_Y_=list(X_)
                    X_Y_.append(y)
                    for z in Z:
                        if z<=S:
                            X_Y_Z_=list(X_Y_)
                            X_Y_Z_.append(z) 
                            wa_=sum(X_Y_Z_)
                            wa.append(wa_)
    print(len([c for c in wa if c==S]))

Fixed submission:
import sys
input = sys.stdin.readline
 
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: count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
K,S=map(int,input().split())
if 2<=K<=2500 and 0<=S<=3*K:
    Ks=[]
    wa=[]
    for i in range(K+1):
        Ks.append(i)
    X,Y,Z =Ks,Ks,Ks
    for x in X:
        if x<=S:
            X_=[]
            X_.append(x)
            for y in Y:
                if y<=S:
                    X_Y_=[]
                    X_Y_=X_.copy()
                    X_Y_.append(y)
                    for z in Z:
                        if z<=S:
                            X_Y_Z_=X_Y_.copy()
                            X_Y_Z_.append(z) 
                            wa_=sum(X_Y_Z_)
                            wa.append(wa_)
    print(len([c for c in wa if c==S]))

Fixed submission:
import sys
input = sys.stdin.readline
 
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: count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
K,S=map(int,input().split())
if 2<=K<=2500 and 0<=S<=3*K:
    Ks=[]
    wa=[]
    for i in range(K+1):
        Ks.append(i)
    X,Y,Z =Ks,Ks,Ks
    for x in X:
        if x<=S:
            X_=[]
            X_.append(x)
            for y in Y:
                X_Y_=[]
                X_Y_=X_.copy()
                X_Y_.append(y)
                for z in Z:
                    X_Y_Z_=X_Y_.copy()
                    X_Y_Z_.append(z) 
                    wa_=sum(X_Y_Z_)
                    wa.append(wa_)
    print(len([c for c in wa if c==S]))

Fixed submission:
import sys
input = sys.stdin.readline
 
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: count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
K,S=map(int,input().split())
if 2<=K<=2500 and 0<=S<=3*K:
    count=0
    Ks=[]
    wa=[]
    for i in range(K+1):
        Ks.append(i)
    X,Y,Z =Ks,Ks,Ks
    for x in X:
        X_=[]
        X_.append(x)
        for y in Y:
            X_Y_=[]
            X_Y_=X_.copy()
            X_Y_.append(y)
            for z in Z:
                X_Y_Z_=X_Y_.copy()
                X_Y_Z_.append(z) 
                wa_=sum(X_Y_Z_)
                wa.append(wa_)
    print(len([c for c in wa if c==S]))

Fixed submission:
import sys
input = sys.stdin.readline
 
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: count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
K,S=map(int,input().split())
if 2<=K<=2500 and 0<=S<=3*K:
    count=0
    Ks=[]
    wa=[]
    for i in range(K+1):
        Ks.append(i)
    X,Y,Z =Ks,Ks,Ks
    for x in X:
        X_=[]
        X_.append(x)
        for y in Y:
            X_Y_=[]
            X_Y_=X_.copy()
            X_Y_.append(y)
            for z in Z:
                X_Y_Z_=X_Y_.copy()
                X_Y_Z_.append(z) 
                wa_=sum(X_Y_Z_)
                wa.append(wa_)
    for j in wa:
        if j==S:
            count+=1
    print(count)

Fixed submission:
import sys
input = sys.stdin.readline
 
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: count+=1
print(count)