Buggy python submission (verdict: Time Limit Exceeded):
ks= list(map(int, input().split())) 
 
count = 0
 
x = 0
y = 0
z = 0
 
for targetX in range(ks[0]+1):
    
    for targetY in range(ks[0]+1):
        
        z = ks[1] - (targetX + targetY)
        
        if 0 <= z and z <= ks[0]:
            count += 1
            
    
        targetY +=1
        
    targetX +=1
        
 
print(count)

Fixed submission:
ks= list(map(int, input().split())) 
 
count = 0
 
x = 0
y = 0
z = 0
 
for targetX in range(ks[0]+1):
    
    
    if targetX <= ks[0] and ks[1]-(targetX+ks[0]+ks[0]) <= 0:
    
        for targetY in range(ks[0]+1):
            
            z = ks[1] - (targetX + targetY)
            
            if 0 <= z and z <= ks[0]:
                count += 1
                
        
        
        
 
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
ks= list(map(int, input().split())) 
 
count = 0
 
x = 0
y = 0
z = 0
 
for targetX in range(ks[0]+1):
    
    
    if targetX <= ks[0] and ks[1]-(targetX+ks[0]+ks[0]) <= 0:
    
        for targetY in range(ks[0]+1):
            
            z = ks[1] - (targetX + targetY)
            
            if 0 <= z and z <= ks[0]:
                count += 1
                
        
            targetY +=1
        
    targetX +=1
        
 
print(count)

Fixed submission:
ks= list(map(int, input().split())) 
 
count = 0
 
x = 0
y = 0
z = 0
 
for targetX in range(ks[0]+1):
    
    
    if targetX <= ks[0] and ks[1]-(targetX+ks[0]+ks[0]) <= 0:
    
        for targetY in range(ks[0]+1):
            
            z = ks[1] - (targetX + targetY)
            
            if 0 <= z and z <= ks[0]:
                count += 1
                
        
        
        
 
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
ks= list(map(int, input().split())) 
 
count = 0

from itertools import product

xs = range(0,ks[0]+1)
ys = range(0,ks[0]+1)
zs = range(0,ks[0]+1)

for x, y, z in product(xs, ys, zs):
  if x+y+z == ks[1]:
    count+=1

print(count)
  

Fixed submission:
ks= list(map(int, input().split())) 
 
count = 0
 
x = 0
y = 0
z = 0
 
for targetX in range(ks[0]+1):
    
    
    if targetX <= ks[0] and ks[1]-(targetX+ks[0]+ks[0]) <= 0:
    
        for targetY in range(ks[0]+1):
            
            z = ks[1] - (targetX + targetY)
            
            if 0 <= z and z <= ks[0]:
                count += 1
                
        
        
        
 
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
ks= list(map(int, input().split())) 
 
count = 0
 
x = 0
y = 0
z = 0
 
for targetX in range(ks[0]+1):
    
    
    if targetX <= ks[0] and ks[1]-(targetX+ks[0]+ks[0]) <= 0:
    
        for targetY in range(ks[0]+1):
            
            if targetY <= ks[0] and ks[1]-(targetX+targetY+ks[0]) <= 0:
        
                for targetZ in range(ks[0]+1):
                    
                    if targetZ <= ks[0]:
                        
                        if targetX + targetY + targetZ == ks[1]:
                            count +=1
                    
                    targetZ +=1
                    
                    
        
            targetY +=1
        
    targetX +=1
        
 
print(count)

Fixed submission:
ks= list(map(int, input().split())) 
 
count = 0
 
x = 0
y = 0
z = 0
 
for targetX in range(ks[0]+1):
    
    
    if targetX <= ks[0] and ks[1]-(targetX+ks[0]+ks[0]) <= 0:
    
        for targetY in range(ks[0]+1):
            
            z = ks[1] - (targetX + targetY)
            
            if 0 <= z and z <= ks[0]:
                count += 1
                
        
        
        
 
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
ks= list(map(int, input().split())) 

count = 0

x = 0
y = 0
z = 0

for targetX in range(ks[0]+1):
    
    
    if targetX <= ks[0] and ks[1]-(targetX+ks[0]+ks[0]) <= 0:
    
        for targetY in range(ks[0]+1):
            
            if targetY <= ks[0] and ks[1]-(targetX+targetY+ks[0]) <= 0:
        
                for targetZ in range(ks[0]+1):
                
                    if targetZ <= ks[0]:
                        
                        if targetX + targetY + targetZ == ks[1]:
                            count +=1
                    
                    targetZ +=1
        
            targetY +=1
        
    targetX +=1
        

print(count)


Fixed submission:
ks= list(map(int, input().split())) 
 
count = 0
 
x = 0
y = 0
z = 0
 
for targetX in range(ks[0]+1):
    
    
    if targetX <= ks[0] and ks[1]-(targetX+ks[0]+ks[0]) <= 0:
    
        for targetY in range(ks[0]+1):
            
            z = ks[1] - (targetX + targetY)
            
            if 0 <= z and z <= ks[0]:
                count += 1
                
        
        
        
 
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
ks= list(map(int, input().split())) 

count = 0

x = 0
y = 0
z = 0

for targetX in range(ks[0]+1):
    
    
    if targetX <= ks[0] and ks[1]-(targetX+ks[0]+ks[0]) <= 0:
    
        for targetY in range(ks[0]+1):
            
            if targetY <= ks[0]:
        
                for targetZ in range(ks[0]+1):
                
                    if targetZ <= ks[0]:
                        
                        if targetX + targetY + targetZ == ks[1]:
                            count +=1
                    
                    targetZ +=1
        
            targetY +=1
        
    targetX +=1
        

print(count)


Fixed submission:
ks= list(map(int, input().split())) 
 
count = 0
 
x = 0
y = 0
z = 0
 
for targetX in range(ks[0]+1):
    
    
    if targetX <= ks[0] and ks[1]-(targetX+ks[0]+ks[0]) <= 0:
    
        for targetY in range(ks[0]+1):
            
            z = ks[1] - (targetX + targetY)
            
            if 0 <= z and z <= ks[0]:
                count += 1
                
        
        
        
 
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
ks= list(map(int, input().split())) 

count = 0

x = 0
y = 0
z = 0

for targetX in range(ks[0]+1):
    
    if targetX <= ks[0]:
    
        for targetY in range(ks[0]+1):
            
            if targetY <= ks[0]:
        
                for targetZ in range(ks[0]+1):
                
                    if targetZ <= ks[0]:
                        
                        if targetX + targetY + targetZ == ks[1]:
                            count +=1
                    
                    targetZ +=1
        
            targetY +=1
        
    targetX +=1
        

print(count)


Fixed submission:
ks= list(map(int, input().split())) 
 
count = 0
 
x = 0
y = 0
z = 0
 
for targetX in range(ks[0]+1):
    
    
    if targetX <= ks[0] and ks[1]-(targetX+ks[0]+ks[0]) <= 0:
    
        for targetY in range(ks[0]+1):
            
            z = ks[1] - (targetX + targetY)
            
            if 0 <= z and z <= ks[0]:
                count += 1
                
        
        
        
 
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
ks= list(map(int, input().split())) 

count = 0

x = 0
y = 0
z = 0

for targetX in range(ks[1]+1):
    
    if targetX <= ks[0]:
    
        for targetY in range(ks[1]+1):
            
            if targetY <= ks[0]:
        
                for targetZ in range(ks[1]+1):
                
                    if targetZ <= ks[0]:
                        if targetX + targetY + targetZ == ks[1]:
                        
                            count +=1
                    
                    targetZ +=1
        
            targetY +=1
        
    targetX +=1
        

#print(ks)
print(count)


Fixed submission:
ks= list(map(int, input().split())) 
 
count = 0
 
x = 0
y = 0
z = 0
 
for targetX in range(ks[0]+1):
    
    
    if targetX <= ks[0] and ks[1]-(targetX+ks[0]+ks[0]) <= 0:
    
        for targetY in range(ks[0]+1):
            
            z = ks[1] - (targetX + targetY)
            
            if 0 <= z and z <= ks[0]:
                count += 1
                
        
        
        
 
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
ks= list(map(int, input().split())) 

count = 0

x = 0
y = 0
z = 0

for targetX in range(ks[1]+1):
    
    for targetY in range(ks[1]+1):
    
        for targetZ in range(ks[1]+1):
        
            if targetX <= ks[0] and targetY <= ks[0] and targetZ <= ks[0] and 0 <= targetX:
                if targetX + targetY + targetZ == ks[1]:
                
                    count +=1
            
            targetZ +=1
    
        targetY +=1
        
    targetX +=1
        

#print(ks)
print(count)


Fixed submission:
ks= list(map(int, input().split())) 
 
count = 0
 
x = 0
y = 0
z = 0
 
for targetX in range(ks[0]+1):
    
    
    if targetX <= ks[0] and ks[1]-(targetX+ks[0]+ks[0]) <= 0:
    
        for targetY in range(ks[0]+1):
            
            z = ks[1] - (targetX + targetY)
            
            if 0 <= z and z <= ks[0]:
                count += 1
                
        
        
        
 
print(count)