stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <cstdlib>

#include <cmath>

#include <algorithm>

#include <climits>

#include <cstring>

#include <string>

#include <set>

#include <bitset>

#include <map>

#include <queue>

#include <stack>

#include <vector>

#define rep(i,m,n) for(i=m;i<=n;i++)

#define mod 1000000007

#define inf 0x3f3f3f3f

#define vi vector<int>

#define pb push_back

#define mp make_pair

#define fi first

#define se second

#define ll long long

#define pi acos(-1.0)

#define pii pair<int,int>

#define sys system("pause")

const int maxn=1e5+10;

const int N=1e3+10;

using namespace std;

ll gcd(ll p,ll q){return q==0?p:gcd(q,p%q);}

ll qpow(ll p,ll q){ll f=1;while(q){if(q&1)f=f*p%mod;p=p*p%mod;q>>=1;}return f;}

int n,m,k,t,s,cnt;

int main()

{

    int i,j;

    scanf("%d%d",&k,&s);

    rep(i,0,k)rep(j,0,k)if(s-i-j>=0&&s-i-j<=k)cnt++;

    printf("%d\n",cnt);

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.108985184220719x):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

int i, j, k, l = 0, m, n, s;

int main() {

	scanf("%d%d", &n, &s);

	for(i = 0; i <= n; i++) for(j = 0; j <= n; j++) {

		k = s - i - j;

		if(k >= 0 && k <= n) l++;

	}

	printf("%d\n", l);

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int a[1000000];

int main()

{

    int k,s;

    cin>>k>>s;

    for(int i=0;i<=k;i++)

    {

        for(int j=0;j<=k;j++)

        {

            a[5000+i+j]++;

        }

    }

    int sum=0;

    for(int i=0;i<=k;i++)

    {

        int pos=s-i;

        if(pos<0)

        {

            continue;

        }

        sum+=a[5000+pos];

    }

    cout<<sum<<endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.159857193297851x):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

int i, j, k, l = 0, m, n, s;

int main() {

	scanf("%d%d", &n, &s);

	for(i = 0; i <= n; i++) for(j = 0; j <= n; j++) {

		k = s - i - j;

		if(k >= 0 && k <= n) l++;

	}

	printf("%d\n", l);

}
// Slower C++ solution:
#include <set>

#include <map>

#include <list>

#include <cmath>

#include <ctime>

#include <deque>

#include <queue>

#include <stack>

#include <cctype>

#include <cstdio>

#include <string>

#include <vector>

#include <cassert>

#include <cstdlib>

#include <cstring>

#include <sstream>

#include <iostream>

#include <algorithm>



using namespace std;

int x,y,z,k,s;

int ans;

int main()

{

    scanf("%d%d",&k,&s);

    ans=0;

    for (x=0;x<=k;++x)

        for (y=0;y<=k;++y)

        {

            z=s-x-y;

            if (z<=k&&z>=0) ans++;

        }

    printf("%d\n",ans);

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.110269708758032x):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

int i, j, k, l = 0, m, n, s;

int main() {

	scanf("%d%d", &n, &s);

	for(i = 0; i <= n; i++) for(j = 0; j <= n; j++) {

		k = s - i - j;

		if(k >= 0 && k <= n) l++;

	}

	printf("%d\n", l);

}
// Slower C++ solution:
#include <iostream>

#include <cstdio>

using namespace std;

int ans[8000]={0};

int main()

{

    int a,b;

    scanf("%d%d",&a,&b);

    a=min(a,b);

    for(int i=0;i<=a;i++)

        for(int j=0;j<=a;j++)

            ans[i+j]++;

    int wans=0;

    for(int i=0;i<=a;i++)

        wans=wans+ans[b-i];

    printf("%d\n",wans);

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.128732186530578x):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

int i, j, k, l = 0, m, n, s;

int main() {

	scanf("%d%d", &n, &s);

	for(i = 0; i <= n; i++) for(j = 0; j <= n; j++) {

		k = s - i - j;

		if(k >= 0 && k <= n) l++;

	}

	printf("%d\n", l);

}
// Slower C++ solution:
#include <bits/stdc++.h>



using namespace std;

bool judge[10000000];

int main()

{

    int k,s;

    int x,y,z;

    int temp;

    int ans = 0;

    scanf("%d%d",&k,&s);

    for( x = 0; x <= k; x ++)

    {

        for( y = 0; y <= k; y ++)

        {

            z = s - x - y;

            if(z >= 0 && z <= k)

            {

                temp = x * 3000 + y;

                if(judge[temp] == false)

                {

                    ans ++;

                    judge[temp] = true;

                }

            }

        }

    }

    printf("%d\n",ans);

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.14752330795846x):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

int i, j, k, l = 0, m, n, s;

int main() {

	scanf("%d%d", &n, &s);

	for(i = 0; i <= n; i++) for(j = 0; j <= n; j++) {

		k = s - i - j;

		if(k >= 0 && k <= n) l++;

	}

	printf("%d\n", l);

}
// Slower C++ solution:
#include <iostream>

#include <cstring>

#include <cstdio>

#include <algorithm>

#include <cmath>

#include <string>

#include <map>

#include <stack>

#include <queue>

#include <vector>

#define inf 0x3f3f3f3f

#define met(a,b) memset(a,b,sizeof a)

#define pb push_back

typedef long long ll;

using namespace std;

const int N = 1e5+5;

const int M = 24005;

int head[N*2],tot,in[N*2];

struct man

{

    int u,v;

}edg[N*2];

int n,v,m,k,s;

int main() {

    int x,y,z;

    int ans=0;

    scanf("%d%d",&k,&s);

    for(int i=0;i<=k;i++){

        for(int j=0;j<=k;j++){

            int ret=s-i-j;

            if(ret<=k&&ret>=0)ans++;

        }

    }

    printf("%d\n",ans);

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.099352853709692x):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

int i, j, k, l = 0, m, n, s;

int main() {

	scanf("%d%d", &n, &s);

	for(i = 0; i <= n; i++) for(j = 0; j <= n; j++) {

		k = s - i - j;

		if(k >= 0 && k <= n) l++;

	}

	printf("%d\n", l);

}
// Slower C++ solution:
#include <iostream>

#include <cstdio>

using namespace std;



int main()

{

    int K,s;

    scanf("%d%d",&K,&s);

    int i,j,k;

    int nu=0;

    for(j=0;j<=K;j++)

        for(k=0;k<=K;k++)

        {

            i=s-j-k;

            if(i>=0&&i<=K)

                nu++;

        }

    printf("%d",nu);

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.098220500989576x):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

int i, j, k, l = 0, m, n, s;

int main() {

	scanf("%d%d", &n, &s);

	for(i = 0; i <= n; i++) for(j = 0; j <= n; j++) {

		k = s - i - j;

		if(k >= 0 && k <= n) l++;

	}

	printf("%d\n", l);

}
// Slower C++ solution:
#include <iostream>

#include <string.h>

#include <stdio.h>

#include <algorithm>

#include <math.h>

using namespace std;



int main()

{

 int k,s,m;

 scanf("%d %d",&k,&s);

 m=0;

 for(int i=k;i>=0;i--)

 {

     for(int j=k;j>=0;j--)

     {

         if((s-i-j<=k)&&(s-i-j)>=0)

            m++;

     }

 }

 printf("%d\n",m);

}


// Faster C++ solution for the same problem (measured speedup: 5.100537465602756x):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

int i, j, k, l = 0, m, n, s;

int main() {

	scanf("%d%d", &n, &s);

	for(i = 0; i <= n; i++) for(j = 0; j <= n; j++) {

		k = s - i - j;

		if(k >= 0 && k <= n) l++;

	}

	printf("%d\n", l);

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int a[1000000];

int main()

{

    int k,s;

    cin>>k>>s;

    for(int i=0;i<=k;i++)

    {

        for(int j=0;j<=k;j++)

        {

            a[5000+i+j]++;

        }

    }

    int sum=0;

    for(int i=0;i<=k;i++)

    {

        int pos=s-i;

        if(pos<0)

        {

            continue;

        }

        sum+=a[5000+pos];

    }

    cout<<sum<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.159857193297851x):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

int i, j, k, l = 0, m, n, s;

int main() {

	scanf("%d%d", &n, &s);

	for(i = 0; i <= n; i++) for(j = 0; j <= n; j++) {

		k = s - i - j;

		if(k >= 0 && k <= n) l++;

	}

	printf("%d\n", l);

}
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <cstdlib>

#include <cmath>

#include <algorithm>

#include <cstring>

#include <stack>

#include <queue>

#include <string>

#include <vector>

#include <set>

#include <map>

#define LL long long int

using namespace std;

int main()

{

    int s,k,a,b,c;

   scanf("%d %d",&s,&k);

   if(k>s*3)

    printf("0\n");

   else if( k==s*3||k==0)

    printf("1\n");

   else if(k<s*3)

   {

       int ans=0;

       for(a=0;a<=s&&a<=k;a++)

       {

           c=k-a-a;

           if(c>=0&&c!=a&&c<=s)

           ans+=3;

           else if(c>=0&&c==a&&c<=s)

            ans++;

           for(b=a+1;b<=s&&b<=k;b++)

           {

               c=k-a-b;

               if(c>=0&&c>a&&c>b&&c<=s)

                ans+=6;

           }

       }

   printf("%d\n",ans);



   }

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.087410636672981x):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

int i, j, k, l = 0, m, n, s;

int main() {

	scanf("%d%d", &n, &s);

	for(i = 0; i <= n; i++) for(j = 0; j <= n; j++) {

		k = s - i - j;

		if(k >= 0 && k <= n) l++;

	}

	printf("%d\n", l);

}
// Slower C++ solution:
#include <iostream>

#include <stdio.h>

#include <cstring>

#include <cmath>

#include <algorithm>

using namespace std;



int main()

{

    int t,s;

    int sum,i,j,k;

    cin>>t>>s;

    sum=0;

    for(i=0; i<=t; ++i)

    {

        for(j=i; j<=t; ++j)

        {

            for(k=j; k<=t; ++k)

            {

                if(i+j+k==s)

                {

                    if(i==j&&j==k)

                        sum+=1;

                    if((i==j&&i!=k)||(j==k&&j!=i)||(i==k&&j!=k))

                        sum+=3;

                    if(i!=j&&j!=k&&i!=k)

                        sum+=6;

                }

            }

        }

    }

    cout<<sum<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.726188042151834x):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

int i, j, k, l = 0, m, n, s;

int main() {

	scanf("%d%d", &n, &s);

	for(i = 0; i <= n; i++) for(j = 0; j <= n; j++) {

		k = s - i - j;

		if(k >= 0 && k <= n) l++;

	}

	printf("%d\n", l);

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

const ll maxn=1e5+9;

ll arr[maxn];

ll sum[maxn];

ll sz[maxn];

ll n,k;

int main(){

        ll a,b,c,d,e,f,g,h;

        ios::sync_with_stdio(0);

        ll k,s;

        cin>>k>>s;

        g=0;

        for(int i=0;i<=k;i++){

                a=s-i;

                if(a>k*2||a<0)continue;

                h=a+1;

                if(a>k){

                        h-=(a-k)*2;

                }

                g+=h;

        }

        cout<<g<<endl;

        return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.211503610135437x):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

int i, j, k, l = 0, m, n, s;

int main() {

	scanf("%d%d", &n, &s);

	for(i = 0; i <= n; i++) for(j = 0; j <= n; j++) {

		k = s - i - j;

		if(k >= 0 && k <= n) l++;

	}

	printf("%d\n", l);

}
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#define ll long long

#define maxn 7510

using namespace std;



ll a[maxn];

int main(){

  int k,s;

  ll ans=0;

  scanf("%d%d",&k,&s);

  for(int x=0;x<=k;x++){

    for(int y=0;y<=k;y++){

      if(s-x-y<=k&&s-x-y>=0)

        ans++;

    }

  }

  printf("%lld\n",ans);

  return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.204532329279069x):
#include <cstdio>

long long a,b,c,d,i,j,k,x,y,z,ans;

int main(){

	ans=0;

	scanf("%lld %lld",&a,&b);

	for (i=0;i<=a;i++){

		x=i;

		c=b-x;

		if ((c>=0) and (c<=a)){

			ans+=c+1;

		}

		if ((c>a) and (c<=2*a)){

			ans+=2*a-c+1;

		} 

	}

	printf("%lld\n",ans);

}
// Slower C++ solution:
#include<iostream> 

using namespace std;

int main()

{

	int k,s,x,y,z,count=0;

	cin>>k>>s;

	for(int i=k;i>=0;i--){

		int x=s;

		if(i>x)continue;

		for(int j=k;j>=0;j--){

			int y=x-i,z=y-j;

			if(j>y||z<0)continue;

			else if(z<=k)count++;

		}

	}

	cout<<count;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.250673476659902x):
#include <cstdio>

long long a,b,c,d,i,j,k,x,y,z,ans;

int main(){

	ans=0;

	scanf("%lld %lld",&a,&b);

	for (i=0;i<=a;i++){

		x=i;

		c=b-x;

		if ((c>=0) and (c<=a)){

			ans+=c+1;

		}

		if ((c>a) and (c<=2*a)){

			ans+=2*a-c+1;

		} 

	}

	printf("%lld\n",ans);

}
// Slower C++ solution:
#include<iostream>

using namespace std;

const int maxi=8000;

int main()

{

     long long k,s,i,j,a[maxi],count,sum;

     while(cin>>k>>s)

     {

         for(i=0;i<=7500;i++)

            a[i]=0;

         count=0;

         for(i=0;i<=k;i++)

         {

             for(j=0;j<=k;j++)

             {

                 a[i+j]++;

             }

         }

         for(i=0;i<=k;i++)

         {

             sum=s-i;

             if(sum<0) continue;

             else count+=a[sum];

         }

         cout<<count<<endl;

     }

     return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.617353227827935x):
#include <cstdio>

long long a,b,c,d,i,j,k,x,y,z,ans;

int main(){

	ans=0;

	scanf("%lld %lld",&a,&b);

	for (i=0;i<=a;i++){

		x=i;

		c=b-x;

		if ((c>=0) and (c<=a)){

			ans+=c+1;

		}

		if ((c>a) and (c<=2*a)){

			ans+=2*a-c+1;

		} 

	}

	printf("%lld\n",ans);

}
// Slower C++ solution:
#include<iostream>

using namespace std;

int main()

{

    long long k,num,s,i,j,q,cnt=0;

	while(cin>>k>>s)

	{

		cnt=0;

		for(int i=0;i<=k;i++)

		for(int j=0;j<=k;j++)

		{

			num=s-i-j;

			if(num>=0&&num<=k)

		    cnt++;

		}

		cout<<cnt<<endl;

    }

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.277283545112369x):
#include <cstdio>

long long a,b,c,d,i,j,k,x,y,z,ans;

int main(){

	ans=0;

	scanf("%lld %lld",&a,&b);

	for (i=0;i<=a;i++){

		x=i;

		c=b-x;

		if ((c>=0) and (c<=a)){

			ans+=c+1;

		}

		if ((c>a) and (c<=2*a)){

			ans+=2*a-c+1;

		} 

	}

	printf("%lld\n",ans);

}
// Slower C++ solution:
#include<iostream>

using namespace std;

int main()

{

    int k,num,s,i,j,q,cnt=0;

	while(cin>>k>>s)

	{

		cnt=0;

		for(int i=0;i<=k;i++)

		for(int j=0;j<=k;j++)

		{

			num=s-i-j;

			if(num>=0&&num<=k)

		    cnt++;

		}

		cout<<cnt<<endl;

    }

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.269120764596408x):
#include <cstdio>

long long a,b,c,d,i,j,k,x,y,z,ans;

int main(){

	ans=0;

	scanf("%lld %lld",&a,&b);

	for (i=0;i<=a;i++){

		x=i;

		c=b-x;

		if ((c>=0) and (c<=a)){

			ans+=c+1;

		}

		if ((c>a) and (c<=2*a)){

			ans+=2*a-c+1;

		} 

	}

	printf("%lld\n",ans);

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

const int maxn = (2000000 + 10);

typedef long long int LLI;







int main(){

   // freopen("/home/qihan/Documents/in","r",stdin);

    int s,k;

    LLI ans = 0;

    scanf("%d%d",&k,&s);

    for(int i = 0; i <= k; i++){

        int temp = s - i;

        int mins = max(0,temp - k);

        int maxs = min(k,temp);

        if(mins > maxs) continue;

        ans += (maxs - mins + 1);

    }

    printf("%d\n", ans);

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.192227042417577x):
#include <cstdio>

long long a,b,c,d,i,j,k,x,y,z,ans;

int main(){

	ans=0;

	scanf("%lld %lld",&a,&b);

	for (i=0;i<=a;i++){

		x=i;

		c=b-x;

		if ((c>=0) and (c<=a)){

			ans+=c+1;

		}

		if ((c>a) and (c<=2*a)){

			ans+=2*a-c+1;

		} 

	}

	printf("%lld\n",ans);

}
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <cstdlib>

#include <cmath>

#include <algorithm>

#include <climits>

#include <cstring>

#include <string>

#include <set>

#include <bitset>

#include <map>

#include <queue>

#include <stack>

#include <vector>

#define rep(i,m,n) for(i=m;i<=n;i++)

#define mod 1000000007

#define inf 0x3f3f3f3f

#define vi vector<int>

#define pb push_back

#define mp make_pair

#define fi first

#define se second

#define ll long long

#define pi acos(-1.0)

#define pii pair<int,int>

#define sys system("pause")

const int maxn=1e5+10;

const int N=1e3+10;

using namespace std;

ll gcd(ll p,ll q){return q==0?p:gcd(q,p%q);}

ll qpow(ll p,ll q){ll f=1;while(q){if(q&1)f=f*p%mod;p=p*p%mod;q>>=1;}return f;}

int n,m,k,t,s,cnt;

int main()

{

    int i,j;

    scanf("%d%d",&k,&s);

    rep(i,0,k)rep(j,0,k)if(s-i-j>=0&&s-i-j<=k)cnt++;

    printf("%d\n",cnt);

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.211271671298457x):
#include <cstdio>

long long a,b,c,d,i,j,k,x,y,z,ans;

int main(){

	ans=0;

	scanf("%lld %lld",&a,&b);

	for (i=0;i<=a;i++){

		x=i;

		c=b-x;

		if ((c>=0) and (c<=a)){

			ans+=c+1;

		}

		if ((c>a) and (c<=2*a)){

			ans+=2*a-c+1;

		} 

	}

	printf("%lld\n",ans);

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int a[1000000];

int main()

{

    int k,s;

    cin>>k>>s;

    for(int i=0;i<=k;i++)

    {

        for(int j=0;j<=k;j++)

        {

            a[5000+i+j]++;

        }

    }

    int sum=0;

    for(int i=0;i<=k;i++)

    {

        int pos=s-i;

        if(pos<0)

        {

            continue;

        }

        sum+=a[5000+pos];

    }

    cout<<sum<<endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.2631621838379115x):
#include <cstdio>

long long a,b,c,d,i,j,k,x,y,z,ans;

int main(){

	ans=0;

	scanf("%lld %lld",&a,&b);

	for (i=0;i<=a;i++){

		x=i;

		c=b-x;

		if ((c>=0) and (c<=a)){

			ans+=c+1;

		}

		if ((c>a) and (c<=2*a)){

			ans+=2*a-c+1;

		} 

	}

	printf("%lld\n",ans);

}
// Slower C++ solution:
#include <set>

#include <map>

#include <list>

#include <cmath>

#include <ctime>

#include <deque>

#include <queue>

#include <stack>

#include <cctype>

#include <cstdio>

#include <string>

#include <vector>

#include <cassert>

#include <cstdlib>

#include <cstring>

#include <sstream>

#include <iostream>

#include <algorithm>



using namespace std;

int x,y,z,k,s;

int ans;

int main()

{

    scanf("%d%d",&k,&s);

    ans=0;

    for (x=0;x<=k;++x)

        for (y=0;y<=k;++y)

        {

            z=s-x-y;

            if (z<=k&&z>=0) ans++;

        }

    printf("%d\n",ans);

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.212581913174488x):
#include <cstdio>

long long a,b,c,d,i,j,k,x,y,z,ans;

int main(){

	ans=0;

	scanf("%lld %lld",&a,&b);

	for (i=0;i<=a;i++){

		x=i;

		c=b-x;

		if ((c>=0) and (c<=a)){

			ans+=c+1;

		}

		if ((c>a) and (c<=2*a)){

			ans+=2*a-c+1;

		} 

	}

	printf("%lld\n",ans);

}
// Slower C++ solution:
#include <iostream>

#include <cstdio>

using namespace std;

int ans[8000]={0};

int main()

{

    int a,b;

    scanf("%d%d",&a,&b);

    a=min(a,b);

    for(int i=0;i<=a;i++)

        for(int j=0;j<=a;j++)

            ans[i+j]++;

    int wans=0;

    for(int i=0;i<=a;i++)

        wans=wans+ans[b-i];

    printf("%d\n",wans);

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.231414026388517x):
#include <cstdio>

long long a,b,c,d,i,j,k,x,y,z,ans;

int main(){

	ans=0;

	scanf("%lld %lld",&a,&b);

	for (i=0;i<=a;i++){

		x=i;

		c=b-x;

		if ((c>=0) and (c<=a)){

			ans+=c+1;

		}

		if ((c>a) and (c<=2*a)){

			ans+=2*a-c+1;

		} 

	}

	printf("%lld\n",ans);

}
// Slower C++ solution:
#include <bits/stdc++.h>



using namespace std;

bool judge[10000000];

int main()

{

    int k,s;

    int x,y,z;

    int temp;

    int ans = 0;

    scanf("%d%d",&k,&s);

    for( x = 0; x <= k; x ++)

    {

        for( y = 0; y <= k; y ++)

        {

            z = s - x - y;

            if(z >= 0 && z <= k)

            {

                temp = x * 3000 + y;

                if(judge[temp] == false)

                {

                    ans ++;

                    judge[temp] = true;

                }

            }

        }

    }

    printf("%d\n",ans);

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.250581363000004x):
#include <cstdio>

long long a,b,c,d,i,j,k,x,y,z,ans;

int main(){

	ans=0;

	scanf("%lld %lld",&a,&b);

	for (i=0;i<=a;i++){

		x=i;

		c=b-x;

		if ((c>=0) and (c<=a)){

			ans+=c+1;

		}

		if ((c>a) and (c<=2*a)){

			ans+=2*a-c+1;

		} 

	}

	printf("%lld\n",ans);

}
// Slower C++ solution:
#include <iostream>

#include <cstring>

#include <cstdio>

#include <algorithm>

#include <cmath>

#include <string>

#include <map>

#include <stack>

#include <queue>

#include <vector>

#define inf 0x3f3f3f3f

#define met(a,b) memset(a,b,sizeof a)

#define pb push_back

typedef long long ll;

using namespace std;

const int N = 1e5+5;

const int M = 24005;

int head[N*2],tot,in[N*2];

struct man

{

    int u,v;

}edg[N*2];

int n,v,m,k,s;

int main() {

    int x,y,z;

    int ans=0;

    scanf("%d%d",&k,&s);

    for(int i=0;i<=k;i++){

        for(int j=0;j<=k;j++){

            int ret=s-i-j;

            if(ret<=k&&ret>=0)ans++;

        }

    }

    printf("%d\n",ans);

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.2014464928509385x):
#include <cstdio>

long long a,b,c,d,i,j,k,x,y,z,ans;

int main(){

	ans=0;

	scanf("%lld %lld",&a,&b);

	for (i=0;i<=a;i++){

		x=i;

		c=b-x;

		if ((c>=0) and (c<=a)){

			ans+=c+1;

		}

		if ((c>a) and (c<=2*a)){

			ans+=2*a-c+1;

		} 

	}

	printf("%lld\n",ans);

}
// Slower C++ solution:
#include <iostream>

#include <cstdio>

using namespace std;



int main()

{

    int K,s;

    scanf("%d%d",&K,&s);

    int i,j,k;

    int nu=0;

    for(j=0;j<=K;j++)

        for(k=0;k<=K;k++)

        {

            i=s-j-k;

            if(i>=0&&i<=K)

                nu++;

        }

    printf("%d",nu);

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.200291469409006x):
#include <cstdio>

long long a,b,c,d,i,j,k,x,y,z,ans;

int main(){

	ans=0;

	scanf("%lld %lld",&a,&b);

	for (i=0;i<=a;i++){

		x=i;

		c=b-x;

		if ((c>=0) and (c<=a)){

			ans+=c+1;

		}

		if ((c>a) and (c<=2*a)){

			ans+=2*a-c+1;

		} 

	}

	printf("%lld\n",ans);

}
// Slower C++ solution:
#include <iostream>

#include <string.h>

#include <stdio.h>

#include <algorithm>

#include <math.h>

using namespace std;



int main()

{

 int k,s,m;

 scanf("%d %d",&k,&s);

 m=0;

 for(int i=k;i>=0;i--)

 {

     for(int j=k;j>=0;j--)

     {

         if((s-i-j<=k)&&(s-i-j)>=0)

            m++;

     }

 }

 printf("%d\n",m);

}


// Faster C++ solution for the same problem (measured speedup: 5.20265482174155x):
#include <cstdio>

long long a,b,c,d,i,j,k,x,y,z,ans;

int main(){

	ans=0;

	scanf("%lld %lld",&a,&b);

	for (i=0;i<=a;i++){

		x=i;

		c=b-x;

		if ((c>=0) and (c<=a)){

			ans+=c+1;

		}

		if ((c>a) and (c<=2*a)){

			ans+=2*a-c+1;

		} 

	}

	printf("%lld\n",ans);

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int a[1000000];

int main()

{

    int k,s;

    cin>>k>>s;

    for(int i=0;i<=k;i++)

    {

        for(int j=0;j<=k;j++)

        {

            a[5000+i+j]++;

        }

    }

    int sum=0;

    for(int i=0;i<=k;i++)

    {

        int pos=s-i;

        if(pos<0)

        {

            continue;

        }

        sum+=a[5000+pos];

    }

    cout<<sum<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.2631621838379115x):
#include <cstdio>

long long a,b,c,d,i,j,k,x,y,z,ans;

int main(){

	ans=0;

	scanf("%lld %lld",&a,&b);

	for (i=0;i<=a;i++){

		x=i;

		c=b-x;

		if ((c>=0) and (c<=a)){

			ans+=c+1;

		}

		if ((c>a) and (c<=2*a)){

			ans+=2*a-c+1;

		} 

	}

	printf("%lld\n",ans);

}