Buggy python submission (verdict: Time Limit Exceeded):
[K, S] = list(map(int, input().split()))
count = 0
for X in range(K+1):
  if X > S and 3*K < S:
    break
  for Y in range(K+1):
    add_xy = X + Y
    if S < add_xy and add_xy < (2/3) * S:
      break
    Z = S - X - Y
    if 0 <= Z and Z <= K:
      count +=1

      
print(count)

Fixed submission:
[K, S] = list(map(int, input().split()))
count = 0
for X in range(K+1):
  for Y in range(K+1):
    Z = S - X - Y
    if 0 <= Z and Z <= K:
      count +=1

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
[K, S] = list(map(int, input().split()))
count = 0
total = 0
for X in range(K+1):
  if X > S:
    break
  for Y in range(K+1):
    sub = X + Y
    if S < sub and sub < (2/3) * S:
      break
    Z = S - X - Y
    if 0 <= Z and Z <= K:
      count +=1
      
print(count)

Fixed submission:
[K, S] = list(map(int, input().split()))
count = 0
for X in range(K+1):
  for Y in range(K+1):
    Z = S - X - Y
    if 0 <= Z and Z <= K:
      count +=1

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
[K, S] = list(map(int, input().split()))
count = 0
total = 0
for X in range(K+1):
  if X > S:
    break
  for Y in range(K+1):
    sub = X + Y
    if sub > S:
      break
    Z = S - X - Y
    if 0 <= Z and Z <= K:
      count +=1
      

            
print(count)

Fixed submission:
[K, S] = list(map(int, input().split()))
count = 0
for X in range(K+1):
  for Y in range(K+1):
    Z = S - X - Y
    if 0 <= Z and Z <= K:
      count +=1

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import math 
[K, S] = list(map(int, input().split()))
count = 0
total = 0
for X in range(K+1):
  if X > S:
    break
  for Y in range(K+1):
    sub = X + Y
    if sub > S:
      break
    for Z in range(K+1):
      total = X + Y + Z 
      if total == S:
        count += 1
      if total > S:
        break
      if total < S/2:
        Z += math.floor(S/2)
            
print(count)

Fixed submission:
[K, S] = list(map(int, input().split()))
count = 0
for X in range(K+1):
  for Y in range(K+1):
    Z = S - X - Y
    if 0 <= Z and Z <= K:
      count +=1

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import math 
[K, S] = list(map(int, input().split()))
count = 0
total = 0
for X in range(K+1):
  if X > S:
    break
  for Y in range(K+1):
    for Z in range(K+1):
      total = X + Y + Z 
      if total == S:
        count += 1
      if total > S:
        break
      if total < S/2:
        Z += math.floor(S/2)
            
print(count)

Fixed submission:
[K, S] = list(map(int, input().split()))
count = 0
for X in range(K+1):
  for Y in range(K+1):
    Z = S - X - Y
    if 0 <= Z and Z <= K:
      count +=1

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import math 
[K, S] = list(map(int, input().split()))
count = 0
for X in range(K+1):
  for Y in range(K+1):
    for Z in range(K+1):
      total = X + Y + Z 
      if total == S:
        count += 1
      if total > S:
        break
      if total < S/2:
        Z += math.floor(S/2)
            
print(count)

Fixed submission:
[K, S] = list(map(int, input().split()))
count = 0
for X in range(K+1):
  for Y in range(K+1):
    Z = S - X - Y
    if 0 <= Z and Z <= K:
      count +=1

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
[K, S] = list(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 X + Y + Z == S:
        count += 1
        
print(count)

Fixed submission:
[K, S] = list(map(int, input().split()))
count = 0
for X in range(K+1):
  for Y in range(K+1):
    Z = S - X - Y
    if 0 <= Z and Z <= K:
      count +=1

print(count)