Buggy python submission (verdict: Time Limit Exceeded):
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:
                ans += 1
print(ans)        

Fixed submission:
k,s = map(int,input().split())
n = 0
for x in range(k+1):
    for y in range(k+1):
        z = s-(x+y)
        if z <= k and z >= 0 and x+y+z==s:
            n += 1
print(n)

Buggy python submission (verdict: Time Limit Exceeded):
k,s = map(int,input().split())
n = 0
m = k+1
for x in range(m):
    for y in range(m):
        for z in range(m):
            if z <= k and z >= 0 and x+y+z==s:
                n += 1
print(n)
                

Fixed submission:
k,s = map(int,input().split())
n = 0
for x in range(k+1):
    for y in range(k+1):
        z = s-(x+y)
        if z <= k and z >= 0 and x+y+z==s:
            n += 1
print(n)

Buggy python submission (verdict: Time Limit Exceeded):
k,s = map(int,input().split())
n = 0
m = k+1
for x in range(m):
    for y in range(m):
        z = s-(x+y)
        if z <= k and z >= 0 and x+y+z==s:
            n += 1
print(n)
                

Fixed submission:
k,s = map(int,input().split())
n = 0
for x in range(k+1):
    for y in range(k+1):
        z = s-(x+y)
        if z <= k and z >= 0 and x+y+z==s:
            n += 1
print(n)

Buggy python submission (verdict: Time Limit Exceeded):
k,s = map(int,input().split())
n = 0
for x in range(k+1):
    for y in range(k+1):
        z = s-(x+y)
        if z <= k and z >= 0 and x+y+z==s:
            n += 1
print(n)
                

Fixed submission:
k,s = map(int,input().split())
n = 0
for x in range(k+1):
    for y in range(k+1):
        z = s-(x+y)
        if z <= k and z >= 0 and x+y+z==s:
            n += 1
print(n)

Buggy python submission (verdict: Time Limit Exceeded):
k,s = map(int,input().split())
n = 0
for x in range(k+1):
    for y in range(k+1):
        z = s-(x+y)
        if z <= k and z >= 0:
            if x+y+z==s:
                n += 1
                
print(n)
                

Fixed submission:
k,s = map(int,input().split())
n = 0
for x in range(k+1):
    for y in range(k+1):
        z = s-(x+y)
        if z <= k and z >= 0 and x+y+z==s:
            n += 1
print(n)

Buggy python submission (verdict: Runtime Error):
k,s = map(int,input().split())
n = 0
for x in range(k+1):
    for y in range(k+1):
        z = s-(x+y)
        if z <= k and z > 0=:
            if x+y+z==s:
                n += 1
                
print(n)
                

Fixed submission:
k,s = map(int,input().split())
n = 0
for x in range(k+1):
    for y in range(k+1):
        z = s-(x+y)
        if z <= k and z >= 0 and x+y+z==s:
            n += 1
print(n)

Buggy python submission (verdict: Time Limit Exceeded):
k,s = map(int,input().split())
n = 0
for x in range(k+1):
    for y in range(k+1):
        z = s-(x+y)
        if z > k:
            z = k
        elif z < 0:
            z = 0
        if x+y+z==s:
            n += 1
                
print(n)
                

Fixed submission:
k,s = map(int,input().split())
n = 0
for x in range(k+1):
    for y in range(k+1):
        z = s-(x+y)
        if z <= k and z >= 0 and x+y+z==s:
            n += 1
print(n)

Buggy python submission (verdict: Time Limit Exceeded):
k,s = map(int,input().split())
n = 0
for x in range(k+1):
    for y in range(k+1):
        xy = x+y
        z = s-(xy)
        if z < 0:
            z = 0
        elif z > k:
            z = k
        if xy+z==s:
            n += 1
                
print(n)
                

Fixed submission:
k,s = map(int,input().split())
n = 0
for x in range(k+1):
    for y in range(k+1):
        z = s-(x+y)
        if z <= k and z >= 0 and x+y+z==s:
            n += 1
print(n)

Buggy python submission (verdict: Time Limit Exceeded):
k,s = map(int,input().split())
n = 0
for x in range(k+1):
    for y in range(k+1):
        z = s-(x+y)
        if z < 0:
            z = 0
        elif z > k:
            z = k
        if x+y+z==s:
            n += 1
                
print(n)
                

Fixed submission:
k,s = map(int,input().split())
n = 0
for x in range(k+1):
    for y in range(k+1):
        z = s-(x+y)
        if z <= k and z >= 0 and x+y+z==s:
            n += 1
print(n)