stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

#define ll long long



int main()

{

    int k,s;

    while(cin >> k >> s)

    {

        int count = 0;

        int x,y,z;

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

        {

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

            {

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

                count++;

            }

        }

        cout << count << endl;

    }

    return 0;

}


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



using namespace std;

int main() {

	int k, s, ans = 0; //s表示总和数 k表示相加的数的最大取值  

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

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

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

			int z = s - (x + y);

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

				ans++;

			}	

		}

	}

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

	return 0;	

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

using namespace std;

int main(){

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

	cin>>k>>s;

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

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

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

     	num++;

		 }

	 }

	cout<<num;

	return 0;

}

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



using namespace std;

int main() {

	int k, s, ans = 0; //s表示总和数 k表示相加的数的最大取值  

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

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

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

			int z = s - (x + y);

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

				ans++;

			}	

		}

	}

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

	return 0;	

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

using namespace std;

#define INF 105



int main()

{

	//freopen("input.txt","r",stdin);

	//freopen("output.txt","w",stdout);

	int n,s;

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

	long long counter=0;

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

	{

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

        {

            int tot=i+k;

            if(s-tot<=n && s-tot>=0)

            {

                counter++;

            }

        }

	}

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

}


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



using namespace std;

int main() {

	int k, s, ans = 0; //s表示总和数 k表示相加的数的最大取值  

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

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

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

			int z = s - (x + y);

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

				ans++;

			}	

		}

	}

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

	return 0;	

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

 using namespace std;

 int main(){

 int s,k; 

int count=0;

cin>>k>>s; 

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

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

 int z=s-(x+y); 

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

count ++; 

}

}

}

cout<<count; 

return 0; 

}

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



using namespace std;

int main() {

	int k, s, ans = 0; //s表示总和数 k表示相加的数的最大取值  

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

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

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

			int z = s - (x + y);

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

				ans++;

			}	

		}

	}

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

	return 0;	

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

using namespace std;

 

int main() {

	int k, s,z, count=0;

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

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

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

z=s-x-y;

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

count++;

} 

 

}} 

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

 

return 0;

}

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



using namespace std;

int main() {

	int k, s, ans = 0; //s表示总和数 k表示相加的数的最大取值  

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

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

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

			int z = s - (x + y);

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

				ans++;

			}	

		}

	}

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

	return 0;	

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

using namespace std;

int main(){

int k,s,z;

cin>>k>>s;

int c=0;

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

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

	z=s-i-j; 

	if(s==(i+j+z))

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

c+=1;

}}

cout<<c;

return 0;

}

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



using namespace std;

int main() {

	int k, s, ans = 0; //s表示总和数 k表示相加的数的最大取值  

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

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

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

			int z = s - (x + y);

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

				ans++;

			}	

		}

	}

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

	return 0;	

}
// 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.200537969483945x):
#include <cstdio>



using namespace std;

int main() {

	int k, s, ans = 0; //s表示总和数 k表示相加的数的最大取值  

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

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

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

			int z = s - (x + y);

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

				ans++;

			}	

		}

	}

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

	return 0;	

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

using namespace std;

int main ()

{

	int k,s,count=0;

	cin>>k>>s;

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

	{

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

		

		int z =s-x-y;

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

		count++;

	}

}

cout<<count<<endl;

}

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



using namespace std;

int main() {

	int k, s, ans = 0; //s表示总和数 k表示相加的数的最大取值  

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

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

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

			int z = s - (x + y);

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

				ans++;

			}	

		}

	}

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

	return 0;	

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



using namespace std;



int main()

{

    int k, s, z , count=0;

    cin >> k>> s;

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

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

            z=s-x-y;

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

                count++;



            }

        }

    }

    cout << count;



    return 0;

}


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



using namespace std;

int main() {

	int k, s, ans = 0; //s表示总和数 k表示相加的数的最大取值  

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

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

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

			int z = s - (x + y);

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

				ans++;

			}	

		}

	}

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

	return 0;	

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

#include<cstring>

#include<algorithm>

#include<cstdio>

#include<string>

#include<queue>

#include<deque>

#define INF 0x3f3f3f3f

using namespace std;

int main(){

	int k,s;

	

	while(cin>>k>>s){

		int con=0;

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

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

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

					con++;

				}

			}

		}

		cout<<con<<endl;

	}

}


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



using namespace std;

int main() {

	int k, s, ans = 0; //s表示总和数 k表示相加的数的最大取值  

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

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

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

			int z = s - (x + y);

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

				ans++;

			}	

		}

	}

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

	return 0;	

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

using namespace std;

int k,s,cnt=0;

int main(){

    cin>>k>>s;

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

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

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

        }

    }

    cout<<cnt<<endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.183107590532825x):
#include <stdio.h>

int main()

{

    int i,j,k,ans=0,n,h;

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

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

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

        {

            h=n-i-j;

            if(h>k) continue;

            else if(h<0) continue;

            else ans++;

        }

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

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

using namespace std;

int main()

{

    int k,s,i,j,ans=0;

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

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

    {

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

        {

            int ij=s-i-j;

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

        }

    }

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

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.150821524704011x):
#include <stdio.h>

int main()

{

    int i,j,k,ans=0,n,h;

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

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

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

        {

            h=n-i-j;

            if(h>k) continue;

            else if(h<0) continue;

            else ans++;

        }

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

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

using namespace std;

int k,s,cnt=0;

int main(){

    cin>>k>>s;

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

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

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

        }

    }

    cout<<cnt<<endl;

    return 0;

}

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

using namespace std;

int n,m,s;

int main(){

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

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

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

            int k=m-i-j;

            if(k>=0&&k<=n){

                ++s;

            }

        }

    }

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

    return 0;

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

using namespace std;

int main()

{

    int k,s,i,j,ans=0;

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

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

    {

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

        {

            int ij=s-i-j;

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

        }

    }

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

    return 0;

}

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

using namespace std;

int n,m,s;

int main(){

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

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

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

            int k=m-i-j;

            if(k>=0&&k<=n){

                ++s;

            }

        }

    }

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

    return 0;

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

using namespace std;

int main()

{

	int s,k,sum=0;

	cin>>k>>s;

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

	{

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

		{

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

			{

				sum++;

			}

		}

	}

	cout<<sum;

	return 0;

}

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

using namespace std;

int n,m,s;

int main(){

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

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

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

            int k=m-i-j;

            if(k>=0&&k<=n){

                ++s;

            }

        }

    }

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

    return 0;

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

using namespace std;

int main()

{

	int ans;

	int k,s;

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

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

	{

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

		{

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

				{

					ans++;

				}

		}

	}

	cout<<ans;

	//printf("%d",ans);

}

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

using namespace std;

int n,m,s;

int main(){

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

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

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

            int k=m-i-j;

            if(k>=0&&k<=n){

                ++s;

            }

        }

    }

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

    return 0;

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

using namespace std;

int k,s,cnt=0;

int main()

{

    cin>>k>>s;

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

    {

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

        {

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

        }

    }

    cout<<cnt<<endl;

    return 0;

}

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

using namespace std;

int n,m,s;

int main(){

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

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

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

            int k=m-i-j;

            if(k>=0&&k<=n){

                ++s;

            }

        }

    }

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

    return 0;

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

using namespace std;

int main()

{

	int x,y,z,k,s;

	cin>>k>>s;

	int ans=0;

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

	{

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

		{

			z=s-x-y;

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

			{

				ans++;

			}

		}

	}

	printf("%d",ans);

}

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

using namespace std;

int n,m,s;

int main(){

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

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

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

            int k=m-i-j;

            if(k>=0&&k<=n){

                ++s;

            }

        }

    }

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

    return 0;

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

using namespace std;

int k,s,cnt=0;

int main(){

    cin>>k>>s;

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

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

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

        }

    }

    cout<<cnt<<endl;

    return 0;

}

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

int main()

{

	int k, s, 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 >= 0 && s - x - y <= k) ans++;

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

    return 0;

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

using namespace std;

int main()

{

    int k,s,i,j,ans=0;

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

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

    {

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

        {

            int ij=s-i-j;

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

        }

    }

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

    return 0;

}

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

int main()

{

	int k, s, 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 >= 0 && s - x - y <= k) ans++;

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

    return 0;

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

using namespace std;

int main()

{

	int s,k,sum=0;

	cin>>k>>s;

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

	{

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

		{

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

			{

				sum++;

			}

		}

	}

	cout<<sum;

	return 0;

}

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

int main()

{

	int k, s, 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 >= 0 && s - x - y <= k) ans++;

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

    return 0;

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

using namespace std;

int main()

{

	int ans;

	int k,s;

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

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

	{

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

		{

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

				{

					ans++;

				}

		}

	}

	cout<<ans;

	//printf("%d",ans);

}

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

int main()

{

	int k, s, 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 >= 0 && s - x - y <= k) ans++;

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

    return 0;

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

using namespace std;

int k,s,cnt=0;

int main()

{

    cin>>k>>s;

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

    {

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

        {

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

        }

    }

    cout<<cnt<<endl;

    return 0;

}

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

int main()

{

	int k, s, 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 >= 0 && s - x - y <= k) ans++;

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

    return 0;

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

using namespace std;

int main()

{

	int x,y,z,k,s;

	cin>>k>>s;

	int ans=0;

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

	{

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

		{

			z=s-x-y;

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

			{

				ans++;

			}

		}

	}

	printf("%d",ans);

}

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

int main()

{

	int k, s, 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 >= 0 && s - x - y <= k) ans++;

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

    return 0;

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

using namespace std;

int s,k,cnt;

int main(){

	ios::sync_with_stdio;

	cin>>k>>s;

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

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

			int l=s-i-j;

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

		}

	cout<<cnt<<endl;

	return 0;

}

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

int main()

{

	int k, s, 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 >= 0 && s - x - y <= k) ans++;

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

    return 0;

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

using namespace std;

int k,s,cnt=0;

int main(){

    cin>>k>>s;

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

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

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

        }

    }

    cout<<cnt<<endl;

    return 0;

}

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

int main() {

    int s,k,a,b,c,u=0;

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

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

        for(b=0;b<=k;b++){

            c=s-a-b;

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

            ++u;

        }

    }

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

    return 0;

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

using namespace std;

int main()

{

    int k,s,i,j,ans=0;

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

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

    {

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

        {

            int ij=s-i-j;

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

        }

    }

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

    return 0;

}

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

int main() {

    int s,k,a,b,c,u=0;

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

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

        for(b=0;b<=k;b++){

            c=s-a-b;

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

            ++u;

        }

    }

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

    return 0;

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

using namespace std;

int main()

{

	int s,k,sum=0;

	cin>>k>>s;

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

	{

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

		{

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

			{

				sum++;

			}

		}

	}

	cout<<sum;

	return 0;

}

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

int main() {

    int s,k,a,b,c,u=0;

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

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

        for(b=0;b<=k;b++){

            c=s-a-b;

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

            ++u;

        }

    }

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

    return 0;

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

using namespace std;

int main()

{

	int ans;

	int k,s;

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

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

	{

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

		{

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

				{

					ans++;

				}

		}

	}

	cout<<ans;

	//printf("%d",ans);

}

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

int main() {

    int s,k,a,b,c,u=0;

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

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

        for(b=0;b<=k;b++){

            c=s-a-b;

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

            ++u;

        }

    }

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

    return 0;

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

using namespace std;

int k,s,cnt=0;

int main()

{

    cin>>k>>s;

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

    {

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

        {

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

        }

    }

    cout<<cnt<<endl;

    return 0;

}

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

int main() {

    int s,k,a,b,c,u=0;

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

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

        for(b=0;b<=k;b++){

            c=s-a-b;

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

            ++u;

        }

    }

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

    return 0;

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

using namespace std;

int main()

{

	int x,y,z,k,s;

	cin>>k>>s;

	int ans=0;

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

	{

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

		{

			z=s-x-y;

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

			{

				ans++;

			}

		}

	}

	printf("%d",ans);

}

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

int main() {

    int s,k,a,b,c,u=0;

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

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

        for(b=0;b<=k;b++){

            c=s-a-b;

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

            ++u;

        }

    }

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

    return 0;

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

using namespace std;

int s,k,cnt;

int main(){

	ios::sync_with_stdio;

	cin>>k>>s;

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

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

			int l=s-i-j;

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

		}

	cout<<cnt<<endl;

	return 0;

}

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

int main() {

    int s,k,a,b,c,u=0;

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

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

        for(b=0;b<=k;b++){

            c=s-a-b;

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

            ++u;

        }

    }

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

    return 0;

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

using namespace std;

int k,s,cnt=0;

int main(){

    cin>>k>>s;

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

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

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

        }

    }

    cout<<cnt<<endl;

    return 0;

}

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

using namespace std;

int s,i,j,k;

long long n;

int main()

{

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

	for(i=0;i<=k;i++) for(j=0;j<=k;j++) if(s>=i+j&&s<=i+j+k) n++;

	printf("%lld",n);

	return 0;

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

using namespace std;

int main()

{

    int k,s,i,j,ans=0;

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

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

    {

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

        {

            int ij=s-i-j;

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

        }

    }

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

    return 0;

}

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

using namespace std;

int s,i,j,k;

long long n;

int main()

{

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

	for(i=0;i<=k;i++) for(j=0;j<=k;j++) if(s>=i+j&&s<=i+j+k) n++;

	printf("%lld",n);

	return 0;

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

using namespace std;

int main()

{

	int s,k,sum=0;

	cin>>k>>s;

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

	{

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

		{

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

			{

				sum++;

			}

		}

	}

	cout<<sum;

	return 0;

}

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

using namespace std;

int s,i,j,k;

long long n;

int main()

{

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

	for(i=0;i<=k;i++) for(j=0;j<=k;j++) if(s>=i+j&&s<=i+j+k) n++;

	printf("%lld",n);

	return 0;

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

using namespace std;

int main()

{

	int ans;

	int k,s;

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

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

	{

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

		{

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

				{

					ans++;

				}

		}

	}

	cout<<ans;

	//printf("%d",ans);

}

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

using namespace std;

int s,i,j,k;

long long n;

int main()

{

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

	for(i=0;i<=k;i++) for(j=0;j<=k;j++) if(s>=i+j&&s<=i+j+k) n++;

	printf("%lld",n);

	return 0;

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

using namespace std;

int k,s,cnt=0;

int main()

{

    cin>>k>>s;

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

    {

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

        {

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

        }

    }

    cout<<cnt<<endl;

    return 0;

}

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

using namespace std;

int s,i,j,k;

long long n;

int main()

{

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

	for(i=0;i<=k;i++) for(j=0;j<=k;j++) if(s>=i+j&&s<=i+j+k) n++;

	printf("%lld",n);

	return 0;

}