You are given two integers K and S.

Three variable X, Y and Z takes integer values satisfying 0≤X,Y,Z≤K.

How many different assignments of values to X, Y and Z are there such that X + Y + Z = S?  

-----Constraints-----
 - 2≤K≤2500 
 - 0≤S≤3K 
 - K and S are integers.  

-----Input-----
The input is given from Standard Input in the following format:
K S

-----Output-----
Print the number of the triples of X, Y and Z that satisfy the condition.

-----Sample Input-----
2 2

-----Sample Output-----
6

There are six triples of X, Y and Z that satisfy the condition:
 - X = 0, Y = 0, Z = 2 
 - X = 0, Y = 2, Z = 0 
 - X = 2, Y = 0, Z = 0 
 - X = 0, Y = 1, Z = 1 
 - X = 1, Y = 0, Z = 1 
 - X = 1, Y = 1, Z = 0
[{"code": "k,s=map(int,input().split())\nprint(len([2 for z in range(k+1) for y in range(k+1) if 0<=s-y-z<=k]))", "passed": true, "time": 1.76, "memory": 51172.0, "status": "done"}, {"code": "k,s=map(int,input().split())\ncnt=0\n\nfor i in range(k+1):\n  for j in range(k+1):\n    if s-k<=i+j<=s:\n      cnt+=1\n      \nprint(cnt)", "passed": true, "time": 1.79, "memory": 14232.0, "status": "done"}, {"code": "K, S = map(int, input().split())\n\nkotae = 0\nfor Z in range(K + 1):\n    X_plus_Y = S - Z\n    for Y in range(K + 1):\n        X = X_plus_Y - Y\n        if 0 <= X <= K:\n            kotae += 1\n\nprint(kotae)", "passed": true, "time": 1.49, "memory": 14096.0, "status": "done"}, {"code": "k,s=map(int,input().split())\nprint(len([1 for x in range(k+1) for y in range(k+1) if 0<=s-x-y<=k]))", "passed": true, "time": 1.75, "memory": 51800.0, "status": "done"}, {"code": "K,S = map(int,input().split())\n\ncount = 0\nfor i in range(K+1):\n    for j in range(K+1):\n        if 0 <= S-(i+j) <= K:\n            count += 1\nprint(count)", "passed": true, "time": 1.85, "memory": 14276.0, "status": "done"}, {"code": "a,b=list(map(int,input().split()))\nn=0\n\nfor y in range(a+1):\n  for z in range(a+1):\n      p=b-y-z\n      if 0<=p and p<=a:\n        n+=1\nprint(n)\n      \n", "passed": true, "time": 2.59, "memory": 14104.0, "status": "done"}, {"code": "K,S = map(int,input().split())\ntotal = 0\ncount = 0\n\nfor x in range(0,K+1):\n    for y in range(0,K+1):\n        if K >= (S - x - y) and (S - x - y)>=0:\n            count+=1\nprint(count)            ", "passed": true, "time": 2.2, "memory": 14356.0, "status": "done"}, {"code": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# FileName: \tB\n# CreatedDate:  2020-10-01 02:02:04 +0900\n# LastModified: 2020-10-01 02:04:56 +0900\n#\n\n\nimport os\nimport sys\n# import numpy as np\n# import pandas as pd\n\n\ndef main():\n    K, S = list(map(int, input().split()))\n    ans = 0\n    for x in range(K+1):\n        for y in range(K+1):\n            if 0 <= S - x - y <= K:\n                ans += 1\n    print(ans)\n\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 2.03, "memory": 14388.0, "status": "done"}, {"code": "k, s = map(int, input().split())\n\nans = 0\nfor x in range(k+1):\n    for y in range(k+1):\n        if 0 <= s-(x+y) and s-(x+y)<=k:\n            ans += 1\nprint(ans)", "passed": true, "time": 2.45, "memory": 14028.0, "status": "done"}, {"code": "K,S=list(map(int,input().split()))\nans=0\nfor x in range(0,K+1):\n    for y in range(0,K+1):\n        z=S-x-y\n        if 0<=z and z<=K:\n            ans+=1\nprint(ans)\n", "passed": true, "time": 1.82, "memory": 14300.0, "status": "done"}, {"code": "K,S = map(int,input().split())\n\ncnt = 0\nfor x in range(K+1):\n  for y in range(K+1):\n    z = S - x - y\n    if 0 <= z <= K:\n      cnt += 1\n      \nprint(cnt)", "passed": true, "time": 2.6, "memory": 14188.0, "status": "done"}, {"code": "k,s = map(int,input().split())\ncnt = 0\nfor i in range(k+1):\n    for j in range(k+1):\n        z = s - i - j\n        if 0 <= z and z <= k:\n            cnt += 1\nprint(cnt)", "passed": true, "time": 1.81, "memory": 14280.0, "status": "done"}, {"code": "#!/usr/bin/env python3\n# coding:utf-8\n\ndef main():\n    stdIn1, stdIn2 = list(map(int, input().split()))\n    stdOut = solve(stdIn1, stdIn2)\n    print(stdOut)\n\n\n\"\"\"\n\u65b9\u91dd\nx,y,z\u305d\u308c\u305e\u308c\u30923\u91cd\u30eb\u30fc\u30d7\u30670\u304b\u3089k\u307e\u3067\u56de\u3059\n(O(N^3)\u3060\u304c\u3001k<=2500\u306a\u306e\u3067\u6c17\u306b\u306a\u3089\u306a\u3044)\nx+y+z\u304c\u7b49\u3057\u3051\u308c\u3070\u30d1\u30bf\u30fc\u30f3\u30921\u8ffd\u52a0\n\nTLE\u306b\u306a\u3063\u305f\u306e\u3067\u3001\u3082\u3046\u5c11\u3057\u7bc0\u7d04\u3059\u308b\u30d1\u30bf\u30fc\u30f3\u3092\u8003\u3048\u308b\u5fc5\u8981\u3042\u308a\n\u3072\u3068\u307e\u305ax,x+y,x+y+z\u304cs\u3088\u308a\u5927\u304d\u306a\u3063\u305f\u5834\u5408\u306fbreak\u3055\u305b\u3066\u30eb\u30fc\u30d7\u3092\u629c\u3051\u308b\u51e6\u7406\u306b\u3057\u3066\u307f\u308b\n\u307e\u3060TLE\u306b\u306a\u308b\u306e\u3067\u3001\u3082\u3046\u5c11\u3057\u8003\u3048\u308b\n\u5b9f\u306fz\u306f\u30eb\u30fc\u30d7\u3059\u308b\u5fc5\u8981\u306f\u306a\u304f z = s - (x + y) <= k \u3067\u3042\u308c\u3070 +1, > k \u3067\u3042\u308c\u3070 continue\u3067\u3088\u3044\n\u3053\u308c\u3067O(N^2)\u306b\u8a08\u7b97\u91cf\u3092\u6291\u3048\u3089\u308c\u308b\n\n\"\"\"\n\n\ndef solve(k, s):\n    pattern = 0\n    for x in range(k+1):\n        if x > s:\n            break\n        for y in range(k+1):\n            if x + y > s:\n                break\n            z = s - x - y\n            if z <= k:\n                pattern += 1\n\n    return pattern\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 4.58, "memory": 14140.0, "status": "done"}, {"code": "k, s = list(map(int, input().split()))\n\nans = 0\nfor x in range(k + 1):\n    for y in range(k + 1):\n        if 0 <= s - x - y <= k:\n            ans += 1\n\nprint(ans)\n", "passed": true, "time": 2.59, "memory": 14128.0, "status": "done"}, {"code": "k, s = map(int, input().split())\nans = 0\nfor x in range(k+1):\n    if x > s:\n        break\n    else:\n        for y in range(k+1):\n            if x+y > s:\n                break\n            elif s - x - y <= k:\n                ans += 1\nprint(ans)", "passed": true, "time": 4.5, "memory": 14164.0, "status": "done"}, {"code": "k,s=list(map(int,input().split()))\ncnt=0\nfor x in range(0,k+1):\n  for y in range(0,k+1):\n    z=s-x-y\n    if (0<=z<=k):\n      cnt+=1\n      \nprint(cnt)\n", "passed": true, "time": 3.85, "memory": 14096.0, "status": "done"}, {"code": "k, n = list(map(int,input().split()))\n\ndef the_algorithm(k, n):\n    count = 0\n\n    for x in range(k + 1):\n        for y in range(k + 1):\n            z = n - x - y\n            if 0 <= z <= k:\n                count += 1\n    \n    return count\n\nprint((the_algorithm(k, n)))\n", "passed": true, "time": 4.12, "memory": 14276.0, "status": "done"}, {"code": "import bisect, collections, copy, heapq, itertools, math, string, sys\ninput = lambda: sys.stdin.readline().rstrip() \nsys.setrecursionlimit(10**7)\nINF = float('inf')\ndef I(): return int(input())\ndef F(): return float(input())\ndef SS(): return input()\ndef LI(): return [int(x) for x in input().split()]\ndef LI_(): return [int(x)-1 for x in input().split()]\ndef LF(): return [float(x) for x in input().split()]\ndef LSS(): return input().split()\n\ndef resolve():\n    K, S = LI()\n\n    ans = 0\n    for x, y in itertools.product(list(range(K + 1)), repeat=2):\n        if 0 <= S - (x + y) <= K:\n            ans += 1\n\n    print(ans)\n\ndef __starting_point():\n    resolve()\n\n__starting_point()", "passed": true, "time": 1.89, "memory": 14176.0, "status": "done"}, {"code": "k,s = map(int,input().split())\nans = 0\n\nfor x in range(k+1):\n    for y in range(k+1):\n        z = s - (x + y)\n        if 0<=z<=k:\n            ans += 1\nprint(ans)", "passed": true, "time": 1.88, "memory": 13944.0, "status": "done"}, {"code": "k,s = map(int,input().split())\nans = 0\nfor i in range(k+1):\n  for j in range(k+1):\n    if s - (i+j) <= k and s - (i+j) >= 0:\n      ans += 1\nprint(ans)", "passed": true, "time": 4.4, "memory": 14252.0, "status": "done"}, {"code": "k,s=map(int,input().split())\nans=0\nfor x in range(k+1):\n    for y in range(k+1):\n        if 0<=s-(x+y)<=k:\n            ans+=1\nprint(ans)", "passed": true, "time": 4.34, "memory": 14248.0, "status": "done"}, {"code": "def main():\n    K, S = list(map(int, input().split()))\n    ans = 0\n    for Z in range(0, K+1):\n        if 0 <= S - Z <= 2*K:\n            ans += min(2*K - (S - Z) + 1, S-Z + 1)\n    print(ans)\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.14, "memory": 14340.0, "status": "done"}, {"code": "K, S = map(int, input().split())\ncnt = 0\nfor i in range(K+1):\n    for j in range(K+1):\n        if 0 <= S-i-j <= K:\n            cnt += 1\nprint(cnt)", "passed": true, "time": 3.02, "memory": 14096.0, "status": "done"}, {"code": "k, s = map(int,input().split())\n\ncount=0\nfor X in range(k+1):\n    for Y in range(k+1):\n        Z = s - X - Y\n        if k>=Z>=0:\n            count+=1\n\nprint(count)", "passed": true, "time": 4.33, "memory": 14344.0, "status": "done"}, {"code": "def answer(k: int, s: int) -> int:\n    count = 0\n    \n    for x in range(k + 1):\n        y_max = min(k, s - x)\n        y_min = max(0, s - x - k)\n        comb = y_max - y_min + 1\n        \n        if 0 < comb:\n            count += comb\n\n    return count\n\n\ndef main():\n    k, s = map(int, input().split())\n    print(answer(k, s))\n\n\ndef __starting_point():\n    main()\n__starting_point()", "passed": true, "time": 0.24, "memory": 14156.0, "status": "done"}, {"code": "k,s = map(int,input().split())\n\ncount = 0\n\nfor x in range(k + 1):\n    for y in range(k + 1):\n        if 0 <= s - x - y <= k:\n            count += 1\nprint(count)", "passed": true, "time": 1.82, "memory": 14288.0, "status": "done"}, {"code": "k, s = map(int, input().split())\ncount = 0\nfor x in range(k+1):\n    for y in range(k+1):\n        z = s - x -y\n        if 0 <= z <= k:\n            count += 1\nprint(count)", "passed": true, "time": 1.85, "memory": 14300.0, "status": "done"}, {"code": "K, S = map(int, input().split())\nans = 0\nfor x in range(K+1):\n    for y in range(K+1):\n        z = S - x - y\n        if 0 <= z <= K:\n            ans += 1\n\nprint(ans)", "passed": true, "time": 1.86, "memory": 14200.0, "status": "done"}, {"code": "k,s = list(map(int,input().split()))\n\ncnt=0\nfor x in range(k+1):\n    for y in range(k+1):\n        if 0<=s-x-y<=k:\n            cnt+=1\nprint(cnt)\n", "passed": true, "time": 1.82, "memory": 14256.0, "status": "done"}, {"code": "K, S = list(map(int, input().split()))\nSum = 0\n\nfor i in range(K + 1):\n    for j in range(K + 1):\n        if 0 <= S - i - j <= K:\n            Sum += 1\n\nprint(Sum)\n", "passed": true, "time": 1.87, "memory": 14236.0, "status": "done"}, {"code": "k,s = map(int,input().split())\nans = 0\nfor x in range(k+1):\n  for y in range(k+1):\n    z = s-x-y\n    ans += (0 <= z <= k)\nprint(ans)", "passed": true, "time": 3.34, "memory": 14288.0, "status": "done"}, {"code": "K,S = map(int,input().split())\nans = 0\nfor i in range(K+1):\n    for j in range(K+1):\n        x = S - i - j\n        if 0 <= x and x <= K:\n            ans += 1\nprint(ans)", "passed": true, "time": 1.82, "memory": 14096.0, "status": "done"}, {"code": "K,S = map(int,input().split())\n\nans = 0\nfor x in range(K+1):\n    for y in range(K+1):\n        z = S-x-y\n        if z <=K and z >=0:\n            ans += 1\nprint(ans)", "passed": true, "time": 1.81, "memory": 14100.0, "status": "done"}, {"code": "k,s=map(int,input().split())\nans=0\nfor i in range(k+1):\n    for j in range(k+1):\n        if 0<=s-i-j<=k:\n            ans+=1\nprint(ans)", "passed": true, "time": 2.95, "memory": 14244.0, "status": "done"}, {"code": "def main():\n    K, S = list(map(int,input().split()))\n    ans = 0\n    for i in range(K+1):\n        for j in range(K+1):\n            if i+j <= S and S - (i+j) <= K:\n                ans += 1\n    print(ans)\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 2.04, "memory": 14120.0, "status": "done"}, {"code": "k, s = map(int, input().split())\ncount=0\nfor x in range(k+1):\n  for y in range(k+1):\n    if 0<=s-x-y<=k:\n      count+=1\nprint(count)", "passed": true, "time": 1.81, "memory": 14200.0, "status": "done"}, {"code": "def main():\n\tK,S = map(int,input().split())\n\tans = 0\n\tListK = [i for i in range(K+1)]\n\tfor x in ListK:\n\t\tfor y in ListK:\n\t\t\tif 0 <= S - (x + y) <= K:\n\t\t\t\tans += 1\n\tprint(ans)\n\ndef __starting_point():\n\tmain()\n__starting_point()", "passed": true, "time": 1.69, "memory": 14276.0, "status": "done"}, {"code": "K, S = list(map(int, input().split()))\nc = 0\n\nfor x in range(K+1):\n    for y in range(K+1):\n        if 0 <= S-(x+y) <= K:\n            c += 1\nprint(c)\n", "passed": true, "time": 1.89, "memory": 14152.0, "status": "done"}, {"code": "# B - Sum of Three Integers\n\nk,s = list(map(int,input().split()))\nc = 0\nmin_limit = s - k\n\nfor i in range(k+1):\n    for j in range(k+1):\n        if i + j <= s and i + j >= min_limit:\n            c += 1\nprint(c)\n", "passed": true, "time": 1.74, "memory": 14288.0, "status": "done"}, {"code": "k, s = list(map(int, input().split()))\n\nans = 0\nfor i in range(k+1):\n    for j in range(k+1):\n        m = s - i - j\n        if (0 <= m <= k):\n            ans += 1\n\nprint(ans)\n", "passed": true, "time": 1.92, "memory": 14196.0, "status": "done"}, {"code": "k, s = map(int, input().split())\n\ncnt = 0\nfor x in range(k+1):\n    for y in range(k+1):\n      if x+y<= s:\n        z = s-(x+y)\n        if z <= k:\n          cnt +=1\n\nprint(cnt)", "passed": true, "time": 2.16, "memory": 14288.0, "status": "done"}, {"code": "import sys\nimport heapq\nfrom decimal import Decimal\n\ninput = sys.stdin.readline\nk, s = map(int, input().split())\n\nans = 0\nfor x in range(k+1):\n    for y in range(k+1):\n        z = s - x - y\n        if z >= 0 and z <= k:\n            ans += 1\n    \nprint(ans)", "passed": true, "time": 3.37, "memory": 14272.0, "status": "done"}, {"code": "k,s = map(int, input().split())\ncnt = 0\nfor i in range(k+1):\n    for j in range(k+1):\n            if 0 <= s-(i+j) <= k:\n                cnt += 1\nprint(cnt)", "passed": true, "time": 1.83, "memory": 14296.0, "status": "done"}, {"code": "k, s = list(map(int, input().split()))\ncounter = 0\nfor x in range(k + 1):\n    for y in range(x, k + 1):\n        z = s - x - y\n        if y <= z <= k:\n            if x == y == z:\n                counter += 1\n            elif x == y or y == z:\n                counter += 3\n            else:\n                counter += 6\n\nprint(counter)\n", "passed": true, "time": 1.03, "memory": 14284.0, "status": "done"}, {"code": "k,s=map(int,input().split())\ntotal=0\nfor i in range(k+1):\n    for j in range(k+1):\n        gen=s-k\n        num=i+j\n        if num<=s and num>=gen:\n            total+=1\nprint(total)", "passed": true, "time": 1.87, "memory": 14284.0, "status": "done"}, {"code": "k,s=map(int,input().split())\ncnt=0\nfor x in range(k+1):\n    for y in range(k+1):\n        if 0<=s-x-y<=k:\n            cnt+=1\nprint(cnt)", "passed": true, "time": 1.99, "memory": 14100.0, "status": "done"}, {"code": "k, s = list(map(int, input().split()))\nans = 0\nfor x in range(k + 1):\n    for y in range(k + 1):\n        z = s - x - y\n        if 0 <= z <= k:\n            ans += 1\nprint(ans)\n", "passed": true, "time": 1.87, "memory": 14240.0, "status": "done"}, {"code": "array = list(map(int,input().split()))\nK = array[0]\nS = array[1]\ncount = 0\nfor i in range(K+1):\n    for j in range(K+1):\n        z = S - i - j\n        if(z >= 0 and z <= K):\n            count+=1\nprint(count)", "passed": true, "time": 1.87, "memory": 14248.0, "status": "done"}, {"code": "k,s=map(int,input().split())\ncnt=0\nfor i in range(k+1):\n  for j in range(k+1):\n    if 0<=s-(i+j)<=k:\n      cnt+=1\n\nprint(cnt)", "passed": true, "time": 1.89, "memory": 14280.0, "status": "done"}, {"code": "'''\nCreated on 2020/09/03\n\n@author: harurun\n'''\ndef main():\n  import sys\n  pin=sys.stdin.readline\n  pout=sys.stdout.write\n  perr=sys.stderr.write\n  \n  K,S=map(int,pin().split())\n  ans=0\n  for x in range(K+1):\n    for y in range(K+1):\n      if 0<=S-x-y<=K:\n        ans+=1\n  print(ans)\n  return \nmain()", "passed": true, "time": 1.83, "memory": 14316.0, "status": "done"}, {"code": "import sys\nfrom collections import defaultdict\n\n\ndef get_lines():\n    return [line for line in sys.stdin]\n\n\ndef get_sum_counts(K):\n    cnts = defaultdict(int)\n    for i in range(K + 1):\n        for j in range(K + 1):\n            cnts[i + j] += 1\n    return cnts\n\n\ndef main(lines):\n    '''\n    S - Z = X + Y\n    '''\n    K, S = list(map(int, lines[0].split()))\n    count = 0\n    sum_counts = get_sum_counts(K)\n    for z in range(min(K, S) + 1):\n        target = S - z\n        count += sum_counts[target]\n    return count\n\n\ndef __starting_point():\n    lines = get_lines()\n    res = main(lines)\n    print(f'{res}')\n\n__starting_point()", "passed": true, "time": 2.37, "memory": 14112.0, "status": "done"}, {"code": "K,S=map(int,input().split())\ncount=0\nfor x in range(K+1):\n    for y in range(K+1):\n        if 0<=S-x-y<=K:\n            count+=1\nprint(count)", "passed": true, "time": 1.82, "memory": 14200.0, "status": "done"}, {"code": "k,s = map(int,input().split())\nans = 0\nfor x in range(k+1):\n    for y in range(k+1):\n        z = s - (x + y)\n        if 0 <= z <= k:\n            ans += 1\nprint(ans)", "passed": true, "time": 1.95, "memory": 14228.0, "status": "done"}, {"code": "# coding: utf-8\n# Your code here!\n\nk, s = map(int, input().split())\n\ncnt = 0\n\nfor i in range(k+1):\n    for j in range(k+1):\n        if s-i-j <= k and s-i-j>=0:\n            cnt += 1\n\nprint(cnt)", "passed": true, "time": 2.17, "memory": 14316.0, "status": "done"}, {"code": "k,s = map(int,input().split())\nans = 0\nfor x in range(k+1):\n  for y in range(k+1):\n    if k >= s-x-y >= 0:\n\n      ans += 1\nprint(ans)", "passed": true, "time": 1.76, "memory": 14320.0, "status": "done"}, {"code": "k,s = map(int, input().split())\nc = 0\nfor x in range(k+1):\n  for y in range(k+1):\n    if 0 <= s-x-y <= k:\n      c += 1\nprint(c)", "passed": true, "time": 1.81, "memory": 14192.0, "status": "done"}, {"code": "import itertools\nurl = \"https://atcoder.jp//contests/abc057/tasks/abc057_a\"\n\ndef main():\n    k, s = list(map(int, input().split()))\n    count = 0\n    for x, y in itertools.product(range(k+1), range(k+1)):\n        z = s - x - y\n        if 0 <= z <= k:\n            count += 1\n    print(count)\n\n\ndef __starting_point():\n    main()\n__starting_point()", "passed": true, "time": 3.69, "memory": 14156.0, "status": "done"}, {"code": "k,s = list(map(int,input().split()))\n\ncnt=0\nfor x in range(k+1):\n    for y in range(k+1):\n        z = s -x- y \n        if 0<=z and z<=k:\n            cnt+=1\n\nprint(cnt)\n", "passed": true, "time": 3.56, "memory": 14288.0, "status": "done"}, {"code": "k,s = map(int,input().split())\ncnt = 0\n\nfor x in range(k+1) :\n    for y in range(k+1) :\n        z = s-(x+y)\n        if 0 <= z <= k and x+y+z == s :\n            cnt += 1\n\nprint(cnt)", "passed": true, "time": 3.71, "memory": 14284.0, "status": "done"}, {"code": "k, s = map(int, input().split())\n\nans = 0\nfor x in range(k+1):\n  for y in range(k+1):\n    z = s - x - y\n    if 0 <= z and z <= k:\n      ans += 1\n        \nprint(ans)", "passed": true, "time": 1.82, "memory": 14084.0, "status": "done"}, {"code": "k,s = map(int,input().split())\nans = 0\nfor i in range(k+1):\n    for j in range(k+1):\n        if 0 <= s - i - j <= k:\n            ans += 1\n            \nprint(ans)", "passed": true, "time": 2.72, "memory": 14200.0, "status": "done"}, {"code": "k,s=map(int,input().split())\nans=0\nfor i in range(k+1):\n  num=s-i\n  for j in range(min(num+1,k+1)):\n    if 0<=num-j<=k:\n      ans+=1\nprint(ans)", "passed": true, "time": 2.04, "memory": 14304.0, "status": "done"}, {"code": "k, s = map(int, input().split())\ncnt = 0\n\nfor i in range(k + 1):\n    for j in range(k + 1):\n        z = s - i - j\n        if 0 <= z <= k:\n            cnt += 1\n\nprint(cnt)", "passed": true, "time": 1.91, "memory": 14296.0, "status": "done"}, {"code": "k,s=map(int, input().split())\nprint(sum(s-k<=x+y<=s for x in range(min(k+1,s+1)) for y in range(min(k+1,s-x+1))))", "passed": true, "time": 3.69, "memory": 14044.0, "status": "done"}, {"code": "k, s = list(map(int, input().split()))\n\nans = 0\n\nfor x in range(k+1):\n    for y in range(k+1):\n        tmp = s - x - y\n        if 0 <= tmp and tmp <= k:\n            ans += 1\n\nprint(ans)\n", "passed": true, "time": 1.95, "memory": 14204.0, "status": "done"}, {"code": "k,s=map(int,input().split())\nprint(len([1 for z in range(k+1) for y in range(k+1) if 0<=s-y-z<=k]))", "passed": true, "time": 3.18, "memory": 51180.0, "status": "done"}, {"code": "K,S = map(int, input().split())\ncnt=0\nfor X in range(K+1):\n  for Y in range(K+1):\n     if S-X-Y>=0 and S-X-Y<=K:\n       cnt+=1\nprint(cnt)", "passed": true, "time": 2.45, "memory": 14100.0, "status": "done"}, {"code": "k, s = list(map(int, input().split()))\n\ncnt = 0\nfor x in range(k + 1):\n    for y in range(k + 1):\n        z = s - x - y\n        if 0 <= z <= k:\n            cnt += 1\n\nprint(cnt)\n", "passed": true, "time": 1.92, "memory": 14104.0, "status": "done"}, {"code": "K,S=map(int,input().split())\nans=0\nfor i in range(K+1):\n    for j in range(K+1):\n        k=S-i-j\n        if i+j+k==S:\n            if 0<=k<=K:\n                ans+=1\nprint(ans)", "passed": true, "time": 2.94, "memory": 14100.0, "status": "done"}, {"code": "K,S=list(map(int,input().split()))\nans=0\nfor X in range(K+1):\n  for Y in range(K+1):\n    Z=S-X-Y\n    if 0<=Z<=K:\n      ans+=1\nprint(ans)\n", "passed": true, "time": 1.96, "memory": 14240.0, "status": "done"}, {"code": "k, s = map(int, input().split())\n\nans = 0\nfor i1 in range(min(k+1, s+1)):\n    for i2 in range(0, min(k+1, s - i1 + 1)):\n        if s - (i1 + i2) <= k:\n            ans += 1\n\nprint(ans)", "passed": true, "time": 1.41, "memory": 14196.0, "status": "done"}, {"code": "k, s = map(int, input().split())\ncnt = 0\nfor x in range(k+1):\n    for y in range(k+1):\n        z = s - x - y\n        if k >= z >= 0:\n            cnt += 1\nprint(cnt)", "passed": true, "time": 1.83, "memory": 14128.0, "status": "done"}, {"code": "import sys\n\nK, S = map(int, sys.stdin.readline().split())\nans = 0\nfor x in range(K+1):\n    for y in range(K+1):\n        if 0 <= S - (x + y) <= K:\n            ans += 1\nprint(ans)", "passed": true, "time": 1.85, "memory": 14352.0, "status": "done"}, {"code": "K, S = list(map(int, input().split()))\n\ncount = 0\nfor i in range(K + 1):\n    for j in range(K + 1):\n        if (S - i - j <= K and S - i - j >= 0):\n            count += 1\n\nprint(count)\n", "passed": true, "time": 2.17, "memory": 14196.0, "status": "done"}, {"code": "K,S = map(int, input().split())\ncnt=0\nfor x in range(K+1):\n    for y in range(K+1):\n        if 0 <= S-(x+y) <= K:\n            cnt += 1\nprint(cnt)", "passed": true, "time": 1.84, "memory": 14380.0, "status": "done"}, {"code": "k, s = map(int,input().split())\n\nans = 0\nfor x in range(k+1):\n    for y in range(k+1):\n            z = s - x - y \n            if z <= k and z >= 0 :\n                ans += 1\n\nprint(ans)", "passed": true, "time": 1.77, "memory": 14192.0, "status": "done"}, {"code": "k,s=map(int,input().split())\ncount=0\n\nif k*3==s:\n  print(1)\n  return\n\nfor x in range(k+1):\n  for y in range(k+1):\n    z=s-x-y\n    if z>=0 and z<=k:\n      count+=1\nprint(count)", "passed": true, "time": 1.23, "memory": 14136.0, "status": "done"}, {"code": "k, s = map(int, input().split(' '))\ncount = 0\nfor i in range(k+1):\n    for j in range(k+1):\n        if i + j <= s and s<=k+i+j:\n            count += 1\n\nprint(count)", "passed": true, "time": 2.05, "memory": 14264.0, "status": "done"}, {"code": "k, s = list(map(int, input().split()))\ncounter = 0\nfor i in range(k + 1):\n    counter += max(min(k, s - i) - max(0, s - k - i) + 1, 0)\n\nprint(counter)\n", "passed": true, "time": 0.21, "memory": 14148.0, "status": "done"}, {"code": "k, s = list(map(int, input().split()))\n\ncount = 0\nfor x in range(k + 1):\n  for y in range(k + 1):\n    z = s - x - y\n    if z < 0 or z > k:\n      continue\n    count += 1\n    # print(x, y, z)\n\nprint(count)\n", "passed": true, "time": 1.89, "memory": 14256.0, "status": "done"}, {"code": "import sys, math\nfrom itertools import combinations as c, product as p\nfrom collections import deque\nsys.setrecursionlimit(10**9)\n\n\ndef si(): return input()\ndef ii(): return int(input())\ndef fi(): return float(input())\ndef lstr(): return input().split()\ndef lint(): return list(map(int, input().split()))\ndef lint_dec(): return list(map(lambda x:int(x) - 1, input().split()))\ndef lnstr(n): return [input() for _ in range(n)]\ndef lnint(n): return [int(input()) for _ in range(n)]\ndef lint_list(n): return [lint() for _ in range(n)]\n\n\n\n############################################################\nK, S = lint()\nans = 0\n\nfor i in range(K + 1):\n    for j in range(K + 1):\n        if 0 <= S - i - j <= K:\n            ans += 1\n\nprint(ans)", "passed": true, "time": 1.84, "memory": 14256.0, "status": "done"}, {"code": "import sys\ninput = sys.stdin.readline\n\n\ndef main():\n    K, S = [int(x) for x in input().split()]\n\n\n    ans = 0\n    for x in range(K + 1) :\n        for y in range(K + 1):\n            z = S - x - y\n            if z < 0 or z > K:\n                continue\n            ans += 1\n\n    print(ans)\n\n\ndef __starting_point():\n    main()\n\n\n__starting_point()", "passed": true, "time": 1.85, "memory": 14224.0, "status": "done"}, {"code": "k,s=map(int,input().split())\ncount=0\nfor x in range(k+1):\n    for y in range(x+1):\n        if x+y>s:\n            continue\n        else:\n            z=s-x-y\n            if z>x or z>y:\n              continue\n            if x==y==z:\n                count+=1\n            elif x==y or y==z or z==x:\n                count+=3\n            else:\n                count+=6\nprint(count)", "passed": true, "time": 1.13, "memory": 14348.0, "status": "done"}, {"code": "K,S = list(map(int,input().split()))\nresult = 0\n\nfor i in range(K+1):\n    for j in range(K+1):\n        if K >= S -(i+j) >= 0:\n            z = S -(i+j)\n            result += 1\n            \n\nprint(result)\n", "passed": true, "time": 2.22, "memory": 14128.0, "status": "done"}, {"code": "k,s = [int(x) for x in input().split()]\n\nres = 0\n\nfor i in range(k+1):\n  for j in range(k+1):\n    cc = s - i - j\n    if 0 <= cc <= k:\n      res += 1\n\nprint(res)", "passed": true, "time": 1.88, "memory": 14304.0, "status": "done"}, {"code": "k,s = map(int,input().split())\nans = 0\nfor i in range(k + 1):\n    for j in range(k + 1):\n        l = s - i - j\n        if 0 <= l and l <= k:\n            ans += 1\nprint(ans)", "passed": true, "time": 1.83, "memory": 14188.0, "status": "done"}, {"code": "k, s = map(int, input().split())\ncnt = 0\nfor i in range(k + 1):\n    for j in range(k + 1):\n        if 0 <= s - i - j <= k:\n            cnt += 1\nprint(cnt)", "passed": true, "time": 1.9, "memory": 14308.0, "status": "done"}, {"code": "import itertools as it\n# \u5165\u529b\u306e\u6574\u6570K, S\nK, S = map(int, input().split())\n\n\ncounter = 0\n# 3\u3064\u306e\u5909\u6570\u3092\u4f5c\u308b\nfor x in range(0, K+1):\n    for y in range(0, K+1):\n        if K >= (S-x-y) and (S-x-y) >= 0:\n            counter+=1\nprint(counter)", "passed": true, "time": 2.27, "memory": 14384.0, "status": "done"}, {"code": "k,s = map(int,input().split())\nans = 0\nfor x in range(k+1):\n  for y in range(k+1):\n    z = s-x-y\n    if z >= 0 and z <= k:\n      ans += 1\nprint(ans)", "passed": true, "time": 3.97, "memory": 14188.0, "status": "done"}, {"code": "K, S = map(int, input().split())\nprint(sum(0<=S-x-y<=K for x in range(K+1) for y in range(K+1)))", "passed": true, "time": 3.96, "memory": 14136.0, "status": "done"}, {"code": "k,s = map(int, input().split())\nans = 0\nfor i in range(k+1):\n  for j in range(k+1):\n    t = s - (i + j)\n    if 0 <= t <= k:\n      ans += 1\nprint(ans)", "passed": true, "time": 1.88, "memory": 14236.0, "status": "done"}, {"code": "k, s = list(map(int, input().split()))\n\nsum = 0\n\nfor z in range(k + 1):\n    for y in range(k + 1):\n        if (s - y - z <= k and s - y - z >= 0):\n            sum += 1\n\nprint(sum)\n", "passed": true, "time": 2.16, "memory": 14096.0, "status": "done"}, {"code": "k_num, s_num = map(int, input().split())\n\ncnt = 0\nfor x in range(k_num+1):\n    l = s_num - x\n    for y in range(k_num+1):\n        z = l - y\n        if 0 <= z <= k_num:\n            cnt += 1\n\nprint(cnt)", "passed": true, "time": 1.45, "memory": 14320.0, "status": "done"}, {"code": "k, s = map(int, input().split())\nans = 0\nfor x in range(k+1):\n    for y in range(k+1):\n        z = s - x - y\n        if 0 <= z <= k:\n            ans += 1\nprint(ans)", "passed": true, "time": 1.84, "memory": 14060.0, "status": "done"}, {"code": "K,S=map(int, input().split())\nans = 0\nx = S//3+1\nfor i in range(x):\n  y = (S-i)//2+1\n  for j in range(i, y):\n    k = S - i - j\n    if k > K:\n      continue\n    if i == j == k:\n      ans += 1\n    elif i == j or j == k:\n      ans += 3\n    else:\n      ans += 6\nprint(ans)", "passed": true, "time": 0.74, "memory": 14120.0, "status": "done"}, {"code": "def LI():\n    return list(map(int, input().split()))\n\n\nK, S = LI()\nans = 0\nfor i in range(K+1):\n    for j in range(K+1):\n        if 0 <= S-(i+j) <= K:\n            ans += 1\nprint(ans)\n", "passed": true, "time": 1.83, "memory": 14276.0, "status": "done"}, {"code": "#!/usr/bin/env python3\nimport sys\n\n\ndef solve(K: int, S: int):\n    ans = 0\n    for x in range(K+1):\n        for y in range(K+1):\n            if 0 <= S - x - y <= K:\n                ans += 1\n    return ans\n\n# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools\ndef main():\n    def iterate_tokens():\n        for line in sys.stdin:\n            for word in line.split():\n                yield word\n    tokens = iterate_tokens()\n    K = int(next(tokens))  # type: int\n    S = int(next(tokens))  # type: int\n    print((solve(K, S)))\n\ndef test():\n    import doctest\n    doctest.testmod()\n\ndef __starting_point():\n    #test()\n    main()\n\n__starting_point()", "passed": true, "time": 1.8, "memory": 14152.0, "status": "done"}, {"code": "K, S = map(int, input().split())\ncnt = 0\n\nfor x in range(K+1):\n    for y in range(K+1):\n        z = S - x - y\n        if 0 <= z <= K:\n            cnt += 1\nprint(cnt)", "passed": true, "time": 1.92, "memory": 14224.0, "status": "done"}, {"code": "k, s = list(map(int, input().split()))\ncounter = 0\nfor x in range(k + 1):\n    for y in range(k + 1):\n        if 0 <= s - x - y <= k:\n            counter += 1\n\nprint(counter)\n", "passed": true, "time": 1.82, "memory": 14220.0, "status": "done"}, {"code": "a,b=input().split()\na=int(a)\nb=int(b)\nc=0\nfor i in range(a+1):\n  for k in range(a+1):\n    if b-a<=i+k<=b:\n      c=c+1\nprint(c)", "passed": true, "time": 1.72, "memory": 14356.0, "status": "done"}]