Buggy python submission (verdict: Runtime Error):
import sys
import copy
import string
from _bisect import *
from collections import *
from operator import itemgetter
from math import factorial
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

k, s = na()
ct = 0
for x in range(k+1):
    for y in range(k+1):
        z = s - x - y
        if 0 <= z <= k:
            ct += 1
print(ct)











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

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import copy
import string
from _bisect import *
from collections import *
from operator import itemgetter
from math import factorial
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

k, s = na()
ct = 0
for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x + y + z == s:
                ct += 1
                break
print(ct)











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

Buggy python submission (verdict: Time Limit Exceeded):
k, s = list(map(int, input().split()))
ct = 0
for x in range(k+1):
    for y in range(x, k+1):
        if x + y > s:
            break;
        for z in range(y, k+1):
            if x + y + z == s:
                if x == y and y == z:
                    ct += 1
                elif x != y and y != z:
                    ct += 6
                else:
                    ct += 3
                break;
print(ct)

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

Buggy python submission (verdict: Time Limit Exceeded):
k, s = list(map(int, input().split()))
ct = 0
for x in range(k+1):
    for y in range(x, k+1):
        if x + y > s:
            break;
        for z in range(y, k+1):
            if x + y + z == s:
                if x == y and y == z:
                    ct += 1
                elif x != y and y != z:
                    ct += 6
                else:
                    ct += 3
                break;
print(ct)

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

Buggy python submission (verdict: Time Limit Exceeded):
k, s = list(map(int, input().split()))
ct = 0
for x in range(k+1):
    for y in range(x, k+1):
        if x + y > s:
            break;
        for z in range(y, k+1):
            if x + y + z == s:
                if x == y and y == z:
                    ct += 1
                elif x != y and y != z and z != x:
                    ct += 6
                else:
                    ct += 3
                break;
print(ct)

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

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

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

Buggy python submission (verdict: Time Limit Exceeded):
k, s = list(map(int, input().split()))
ct = 0
for x in range(k+1):
    for y in range(min(k+1, s-x+1)):
        for z in range(min(k+1,s-x-y+1)):
            if x + y + z == s:
                ct += 1
                break;
print(ct)

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

Buggy python submission (verdict: Time Limit Exceeded):
k, s = list(map(int, input().split()))
ct = 0
for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x + y + z == s:
                ct += 1
                break;
print(ct)

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

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

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