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

#define N 500005

#define ll long long

#define For(i,x,y) for(int i=(x);i<=(y);++i)

#define Rof(i,x,y) for(int i=(x);i>=(y);--i)

#define Edge(x) for(int i=head[x];i;i=e[i].nxt)

#define mset(x,y) memset(x,y,sizeof(x))

#define mod 998244353

using namespace std;

int fac[N],invf[N];

int C(int x,int y){ return x>=y?1ll*fac[x]*invf[y]%mod*invf[x-y]%mod:0; }

int main(){

	int n,k,ans=0;

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

	fac[0]=fac[1]=1,invf[0]=invf[1]=1;

	For(i,2,k){

		fac[i]=1ll*fac[i-1]*i%mod;

		invf[i]=1ll*(1ll*mod-mod/i)*invf[mod%i]%mod;

	}

	For(i,2,k) invf[i]=1ll*invf[i-1]*invf[i]%mod;

	For(i,n,k) (ans+=C(k-1,i-1))%=mod;

	cout<<ans;

}


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



typedef long long LL;

const int Mod = 998244353;



inline int qPow(int b, int e) {

	int a = 1;

	for (; e; e >>= 1, b = (LL)b * b % Mod)

		if (e & 1) a = (LL)a * b % Mod;

	return a;

}



const int MN = 500005;



int Fac[MN], iFac[MN];



inline void Init(int N) {

	Fac[0] = 1;

	for (int i = 1; i <= N; ++i) Fac[i] = (LL)Fac[i - 1] * i % Mod;

	iFac[N] = qPow(Fac[N], Mod - 2);

	for (int i = N; i >= 1; --i) iFac[i - 1] = (LL)iFac[i] * i % Mod;

}

inline int Binom(int N, int M) {

	if (M < 0 || M > N) return 0;

	return (LL)Fac[N] * iFac[M] % Mod * iFac[N - M] % Mod;

}



int N, K, Ans;



int main() {

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

	Init(K);

	for (int i = N; i <= K; ++i) Ans = (Ans + Binom(K - 1, i - 1)) % Mod;

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

	return 0;

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

#define LL long long

#define mod 998244353

#define M 1000005

using namespace std;

int read()

{

	char ch=getchar(); int w=1,c=0;

	for (;!isdigit(ch);ch=getchar()) if (ch=='-') w=-1;

	for (;isdigit(ch);ch=getchar()) c=(c<<3)+(c<<1)+(ch^48);

	return w*c;

}

LL f[M],inv_f[M],ans;

int n,m;

LL fast(LL x,LL p)

{

	LL res=1;

	for (;p;p>>=1,x=x*x%mod) if (p&1) res=res*x%mod;

	return res;

}

LL C(int n,int m){if (m>n) return 0;return f[n]*inv_f[m]%mod*inv_f[n-m]%mod;}

LL calc(int x,int y,int t){return C(x+y,y)-C(x+y,x+t);}

int main()

{

	n=read(); m=read();

	if(m<n) return puts("0")&0;

	f[0]=1;

	for(register int i=1;i<=m+n;++i)

	f[i]=f[i-1]*i%mod;

	inv_f[m+n]=fast(f[m+n],mod-2);

	for(register int i=m+n;i;--i) inv_f[i-1]=inv_f[i]*i%mod;

	for(register int i=0;i<=m;++i)

	{

		int R=i,B=m-i;

		if(R==B) ans=(ans+calc(R,B-1,R-n+1)+mod)%mod;

		if(R>B) ans=(ans+calc(R,B,R-n+1)+mod)%mod;

	}

	return printf("%lld",ans)&0;

}


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



typedef long long LL;

const int Mod = 998244353;



inline int qPow(int b, int e) {

	int a = 1;

	for (; e; e >>= 1, b = (LL)b * b % Mod)

		if (e & 1) a = (LL)a * b % Mod;

	return a;

}



const int MN = 500005;



int Fac[MN], iFac[MN];



inline void Init(int N) {

	Fac[0] = 1;

	for (int i = 1; i <= N; ++i) Fac[i] = (LL)Fac[i - 1] * i % Mod;

	iFac[N] = qPow(Fac[N], Mod - 2);

	for (int i = N; i >= 1; --i) iFac[i - 1] = (LL)iFac[i] * i % Mod;

}

inline int Binom(int N, int M) {

	if (M < 0 || M > N) return 0;

	return (LL)Fac[N] * iFac[M] % Mod * iFac[N - M] % Mod;

}



int N, K, Ans;



int main() {

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

	Init(K);

	for (int i = N; i <= K; ++i) Ans = (Ans + Binom(K - 1, i - 1)) % Mod;

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

	return 0;

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

using namespace std ;

int n , a , b ;

int main()

{

	cin >> n >> a >> b ;

	cout << min( n*a , b ) << "\n" ;



}

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

int main()

{

	int a, b, c;

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

	printf("%d", a*b<c?a*b:c);

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

using namespace std;



typedef long long ll;



const int N = 2500;

ll arr[N + 5];

ll sq[N + 5];



ll tipe[3];



int main() {

	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);

	int n;

	cin>>n;

	for(int i = 0;i < n;i++) cin>>arr[i];

	sort(arr, arr + n);

	for(int i = 0;i < n;i++) sq[i] = arr[i] * arr[i];

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

		for(int j = i + 1;j < n;j++) {

			int lo = j + 1;

			int hi = n - 1;

			int ub = -1;

			while(lo <= hi) {

				int mid = (lo + hi) / 2;

				if(arr[i] + arr[j] > arr[mid]) {

					ub = mid;

					lo = mid + 1;

				} else hi = mid - 1;

			}

			

			if(ub != -1) {

				int lo = j + 1;

				int hi = ub;

				int resL = j;

				while(lo <= hi) {

					int mid = (lo + hi) / 2;

					if(sq[i] + sq[j] > sq[mid]) {

						resL = mid;

						lo = mid + 1;

					} else hi = mid - 1;

				}

				

				lo = j + 1;

				hi = ub;

				int resH = ub + 1;

				while(lo <= hi) {

					int mid = (lo + hi) / 2;

					if(sq[i] + sq[j] < sq[mid]) {

						resH = mid;

						hi = mid - 1;

					} else lo = mid + 1;

				}

				int total = ub - j;

				int t1 = resL - j;

				int t3 = ub + 1 - resH;

				int t2 = total - t1 - t3;

//				cout<<"RESL "<<resL<<" "<<resH<<endl;

//				cout<<"AT "<<i<<" "<<j<<" "<<t1<<" "<<t2<<" "<<t3<<endl;

				tipe[0] += t1, tipe[1] += t2, tipe[2] += t3;

			}			

		}

	}

	cout<<tipe[0] + tipe[1] + tipe[2]<<endl;

}

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



void ShellSort(int arr[],int n)

{

	int incre = 1;

	while(incre < n/3)

		incre = incre*3 + 1;

	for(;incre >= 1;incre/=3)

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

		{

			int pos = i;

			int val = arr[i];

			for(;pos >= incre && val < arr[pos - incre];pos-=incre)

				arr[pos] = arr[pos - incre];

			arr[pos] = val;

		}

}



int Find(int arr[],int n)

{

    int ans = 0;

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

        for(int j = i + 1;j < n - 1;j++)

            for(int k = j + 1;k < n;k++)

            {

                if(arr[i] + arr[j] > arr[k]) ans++;

                else break;

            }

    return ans;

}  

int main()

{

    int n;

    scanf("%d",&n);

    int arr[10002];

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

        scanf("%d",arr + i);

    ShellSort(arr,n);

    printf("%d\n",Find(arr,n));

    return 0;

}
// Slower C++ solution:


#include<bits/stdc++.h>

using namespace std;



int a[100001] ;



int panduan(int a,int b,int c)

{

	if(a+b>c&&b+c>a&&c+a>b) return 1;

	else return 0;

}



int main(){

	

	int n;

	scanf("%d",&n);

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

	{

		scanf("%d",&a[i]);

	}

	int ans=0;

	sort(a+1,a+n+1); 

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

	{

		for(int j=i+1;j<=n;++j)

		{

			int it=lower_bound(a+1,a+n+1,a[i]+a[j])-a-2;

			if(it-j+1>0)

			{

				ans+=it-j+1;

			}

		}

	}

	printf("%d",ans);

	return 0;

}


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



void ShellSort(int arr[],int n)

{

	int incre = 1;

	while(incre < n/3)

		incre = incre*3 + 1;

	for(;incre >= 1;incre/=3)

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

		{

			int pos = i;

			int val = arr[i];

			for(;pos >= incre && val < arr[pos - incre];pos-=incre)

				arr[pos] = arr[pos - incre];

			arr[pos] = val;

		}

}



int Find(int arr[],int n)

{

    int ans = 0;

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

        for(int j = i + 1;j < n - 1;j++)

            for(int k = j + 1;k < n;k++)

            {

                if(arr[i] + arr[j] > arr[k]) ans++;

                else break;

            }

    return ans;

}  

int main()

{

    int n;

    scanf("%d",&n);

    int arr[10002];

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

        scanf("%d",arr + i);

    ShellSort(arr,n);

    printf("%d\n",Find(arr,n));

    return 0;

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

#include<stdio.h>

#include<algorithm>

using namespace std;



int main()

{

	int n,j,k,a[10009],m=0;

	scanf("%d",&n);

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

	{

		scanf("%d",&a[i]);

	}

	sort(a,a+n);

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

	{

		for(j=i+1;j<n-1;j++)

		{

			for(k=j+1;k<n;k++)

			{

				if(a[i]<a[j]+a[k]&&a[j]<a[k]+a[i]&&a[k]<a[i]+a[j])

				{

					m++;

				}

				else

				{

					break;

				}

			}

		}

	}

	cout<<m;

	return 0;

 } 

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



void ShellSort(int arr[],int n)

{

	int incre = 1;

	while(incre < n/3)

		incre = incre*3 + 1;

	for(;incre >= 1;incre/=3)

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

		{

			int pos = i;

			int val = arr[i];

			for(;pos >= incre && val < arr[pos - incre];pos-=incre)

				arr[pos] = arr[pos - incre];

			arr[pos] = val;

		}

}



int Find(int arr[],int n)

{

    int ans = 0;

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

        for(int j = i + 1;j < n - 1;j++)

            for(int k = j + 1;k < n;k++)

            {

                if(arr[i] + arr[j] > arr[k]) ans++;

                else break;

            }

    return ans;

}  

int main()

{

    int n;

    scanf("%d",&n);

    int arr[10002];

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

        scanf("%d",arr + i);

    ShellSort(arr,n);

    printf("%d\n",Find(arr,n));

    return 0;

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

using namespace std;

typedef long long ll;

ll n,arr[3000],tot,ans = 0;





int main (){

	cin >> n;

	for(ll i = 1; i <= n; i++){

		cin >> arr[i];

	}

	sort(arr + 1, arr + n + 1);

	

	for(ll i = 1; i <= n; i++){

		for(ll j = i + 1; j <= n; j++){

			ll l = j + 1, r = n, nemu = 0;

			while(l <= r){

				ll mid = (l + r) / 2;

				if((arr[i] + arr[j]) > arr[mid]){

					nemu = mid;

					l = mid + 1;

				}else r = mid - 1;

			}

			

			if(nemu > 0) ans += nemu - j;

			//cout << nemu << " " << j << endl;

		}

	}

	

	cout << ans << endl;

}

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



void ShellSort(int arr[],int n)

{

	int incre = 1;

	while(incre < n/3)

		incre = incre*3 + 1;

	for(;incre >= 1;incre/=3)

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

		{

			int pos = i;

			int val = arr[i];

			for(;pos >= incre && val < arr[pos - incre];pos-=incre)

				arr[pos] = arr[pos - incre];

			arr[pos] = val;

		}

}



int Find(int arr[],int n)

{

    int ans = 0;

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

        for(int j = i + 1;j < n - 1;j++)

            for(int k = j + 1;k < n;k++)

            {

                if(arr[i] + arr[j] > arr[k]) ans++;

                else break;

            }

    return ans;

}  

int main()

{

    int n;

    scanf("%d",&n);

    int arr[10002];

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

        scanf("%d",arr + i);

    ShellSort(arr,n);

    printf("%d\n",Find(arr,n));

    return 0;

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

using namespace std;



typedef long long ll;



const int N = 2500;

ll arr[N + 5];

ll sq[N + 5];



ll tipe[3];



int main() {

	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);

	int n;

	cin>>n;

	for(int i = 0;i < n;i++) cin>>arr[i];

	sort(arr, arr + n);

	for(int i = 0;i < n;i++) sq[i] = arr[i] * arr[i];

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

		for(int j = i + 1;j < n;j++) {

			int lo = j + 1;

			int hi = n - 1;

			int ub = -1;

			while(lo <= hi) {

				int mid = (lo + hi) / 2;

				if(arr[i] + arr[j] > arr[mid]) {

					ub = mid;

					lo = mid + 1;

				} else hi = mid - 1;

			}

			

			if(ub != -1) {

				int lo = j + 1;

				int hi = ub;

				int resL = j;

				while(lo <= hi) {

					int mid = (lo + hi) / 2;

					if(sq[i] + sq[j] > sq[mid]) {

						resL = mid;

						lo = mid + 1;

					} else hi = mid - 1;

				}

				

				lo = j + 1;

				hi = ub;

				int resH = ub + 1;

				while(lo <= hi) {

					int mid = (lo + hi) / 2;

					if(sq[i] + sq[j] < sq[mid]) {

						resH = mid;

						hi = mid - 1;

					} else lo = mid + 1;

				}

				int total = ub - j;

				int t1 = resL - j;

				int t3 = ub + 1 - resH;

				int t2 = total - t1 - t3;

//				cout<<"RESL "<<resL<<" "<<resH<<endl;

//				cout<<"AT "<<i<<" "<<j<<" "<<t1<<" "<<t2<<" "<<t3<<endl;

				tipe[0] += t1, tipe[1] += t2, tipe[2] += t3;

			}			

		}

	}

	cout<<tipe[0] + tipe[1] + tipe[2]<<endl;

}

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

#include<stdlib.h>

int inc(const void *a, const void *b)

{

	return *(int *)a-*(int *)b;

}

int main()

{

	int n,a[10000],l=0,r=1,m,cnt=0;

	scanf("%d",&n);

	for(int i=0;i<n;i++)scanf("%d",&a[i]);

	qsort(a,n,sizeof(int),inc);

	m=2;

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

	{

		for(int j=i+1;j<n-1;j++)

		{

			for(int k=j+1;k<n;k++)

			{

				if(a[i]+a[j]>a[k])cnt++;

			}

		}

	}

	/*while(l<n-2)

	{

		if(m<=n-1&&a[l]+a[r]>a[m])

		{

			cnt++;

			m++;

		}

		else

		{

			r++;

			m=r+1;

		}

		if(r==n-1)

		{

			l++;

			r=l+1;

			m=r+1;

		}

	}*/

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

}
// Slower C++ solution:


#include<bits/stdc++.h>

using namespace std;



int a[100001] ;



int panduan(int a,int b,int c)

{

	if(a+b>c&&b+c>a&&c+a>b) return 1;

	else return 0;

}



int main(){

	

	int n;

	scanf("%d",&n);

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

	{

		scanf("%d",&a[i]);

	}

	int ans=0;

	sort(a+1,a+n+1); 

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

	{

		for(int j=i+1;j<=n;++j)

		{

			int it=lower_bound(a+1,a+n+1,a[i]+a[j])-a-2;

			if(it-j+1>0)

			{

				ans+=it-j+1;

			}

		}

	}

	printf("%d",ans);

	return 0;

}


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

#include<stdlib.h>

int inc(const void *a, const void *b)

{

	return *(int *)a-*(int *)b;

}

int main()

{

	int n,a[10000],l=0,r=1,m,cnt=0;

	scanf("%d",&n);

	for(int i=0;i<n;i++)scanf("%d",&a[i]);

	qsort(a,n,sizeof(int),inc);

	m=2;

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

	{

		for(int j=i+1;j<n-1;j++)

		{

			for(int k=j+1;k<n;k++)

			{

				if(a[i]+a[j]>a[k])cnt++;

			}

		}

	}

	/*while(l<n-2)

	{

		if(m<=n-1&&a[l]+a[r]>a[m])

		{

			cnt++;

			m++;

		}

		else

		{

			r++;

			m=r+1;

		}

		if(r==n-1)

		{

			l++;

			r=l+1;

			m=r+1;

		}

	}*/

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

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

#include<stdio.h>

#include<algorithm>

using namespace std;



int main()

{

	int n,j,k,a[10009],m=0;

	scanf("%d",&n);

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

	{

		scanf("%d",&a[i]);

	}

	sort(a,a+n);

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

	{

		for(j=i+1;j<n-1;j++)

		{

			for(k=j+1;k<n;k++)

			{

				if(a[i]<a[j]+a[k]&&a[j]<a[k]+a[i]&&a[k]<a[i]+a[j])

				{

					m++;

				}

				else

				{

					break;

				}

			}

		}

	}

	cout<<m;

	return 0;

 } 

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

#include<stdlib.h>

int inc(const void *a, const void *b)

{

	return *(int *)a-*(int *)b;

}

int main()

{

	int n,a[10000],l=0,r=1,m,cnt=0;

	scanf("%d",&n);

	for(int i=0;i<n;i++)scanf("%d",&a[i]);

	qsort(a,n,sizeof(int),inc);

	m=2;

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

	{

		for(int j=i+1;j<n-1;j++)

		{

			for(int k=j+1;k<n;k++)

			{

				if(a[i]+a[j]>a[k])cnt++;

			}

		}

	}

	/*while(l<n-2)

	{

		if(m<=n-1&&a[l]+a[r]>a[m])

		{

			cnt++;

			m++;

		}

		else

		{

			r++;

			m=r+1;

		}

		if(r==n-1)

		{

			l++;

			r=l+1;

			m=r+1;

		}

	}*/

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

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

using namespace std;

typedef long long ll;

ll n,arr[3000],tot,ans = 0;





int main (){

	cin >> n;

	for(ll i = 1; i <= n; i++){

		cin >> arr[i];

	}

	sort(arr + 1, arr + n + 1);

	

	for(ll i = 1; i <= n; i++){

		for(ll j = i + 1; j <= n; j++){

			ll l = j + 1, r = n, nemu = 0;

			while(l <= r){

				ll mid = (l + r) / 2;

				if((arr[i] + arr[j]) > arr[mid]){

					nemu = mid;

					l = mid + 1;

				}else r = mid - 1;

			}

			

			if(nemu > 0) ans += nemu - j;

			//cout << nemu << " " << j << endl;

		}

	}

	

	cout << ans << endl;

}

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

#include<stdlib.h>

int inc(const void *a, const void *b)

{

	return *(int *)a-*(int *)b;

}

int main()

{

	int n,a[10000],l=0,r=1,m,cnt=0;

	scanf("%d",&n);

	for(int i=0;i<n;i++)scanf("%d",&a[i]);

	qsort(a,n,sizeof(int),inc);

	m=2;

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

	{

		for(int j=i+1;j<n-1;j++)

		{

			for(int k=j+1;k<n;k++)

			{

				if(a[i]+a[j]>a[k])cnt++;

			}

		}

	}

	/*while(l<n-2)

	{

		if(m<=n-1&&a[l]+a[r]>a[m])

		{

			cnt++;

			m++;

		}

		else

		{

			r++;

			m=r+1;

		}

		if(r==n-1)

		{

			l++;

			r=l+1;

			m=r+1;

		}

	}*/

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

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

using namespace std;



int main(){

  int n;

  cin >> n; 

  vector<int> l(n),L(100000);

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

    cin >> l.at(i);

    L.at(l.at(i))++;

  }

  

  sort(l.begin(),l.end());

  long long ans =0;

  

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

    for(int j=i+1;j<n-1;j++){

      for(int k=j+1;k<n;k++){

        if(l.at(k) < l.at(i) + l.at(j)){

          ans++;

        }

      }

    }

  }

  

  cout << ans << endl;

  return 0;

}


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

using namespace std;



int main(){

  int n;

  cin >> n; 

  vector<int> l(n);

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

    cin >> l.at(i);

  }

  

  sort(l.begin(),l.end());

  long long ans =0;

  

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

    for(int j=i+1;j<n-1;j++){

      for(int k=j+1;k<n;k++){

        if(l.at(k) < l.at(i) + l.at(j)){

          ans++;

        }

      }

    }

  }

  

  cout << ans << endl;

  return 0;

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

#include<algorithm>

int n,d[30000];



bool bh(int i,int j,int k){

    if (d[i]<d[j]+d[k]){

        return true;

    }

    return false;

}



int main(){

    std::cin>>n;

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

        std::cin>>d[i];

    }

    int sl=0;

    std::sort(d+1,d+n+1);

    for (int i=1;i<=n-2;i++){

        for (int j=i+1;j<=n-1;j++){

            for (int k=j+1;k<=n;k++){

                if ((bh(i,j,k)) && (bh(j,k,i)) && (bh(k,i,j))){

                sl++;}

                else break;

            }

        }

    }

    std::cout<<sl;

    return 0;

}

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

#include<string.h>

#include<algorithm>

//

using namespace std;

int n,ans;

int a[2005]; 

int main(){

	scanf("%d",&n);

	for(int i=1;i<=n;++i)scanf("%d",a+i);

	sort(a+1,a+n+1);

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

	for(int j=i+1;j<=n;++j)

	for(int k=j+1;k<=n;++k)

	if(a[i]+a[j]>a[k])ans++;

	else break;

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

	return 0;

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

using namespace std;



const int N = (int)2e3;

int dat[N+5];



int main() {

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

    for (int i=1; i<=n; i++) scanf("%d", dat+i);



    sort(dat+1, dat+1+n);



    long long res = 0;

    for (int i=1; i<=n; i++) for (int j=i+1; j<=n; j++) {

        int key = dat[i] + dat[j];

        int idx = lower_bound(dat+1, dat+1+n, key) - dat;

        res += (long long)max(idx-j - 1, 0);

    }



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

    return 0;

}


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

#include<string.h>

#include<algorithm>

//

using namespace std;

int n,ans;

int a[2005]; 

int main(){

	scanf("%d",&n);

	for(int i=1;i<=n;++i)scanf("%d",a+i);

	sort(a+1,a+n+1);

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

	for(int j=i+1;j<=n;++j)

	for(int k=j+1;k<=n;++k)

	if(a[i]+a[j]>a[k])ans++;

	else break;

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

	return 0;

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

#include<algorithm>

#include<iostream>

#include<cmath>

#include<cstring>

#include<string>

using namespace std;

int n,cnt=0,l[100010];

int main(){

	scanf("%d",&n);

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

	    scanf("%d",&l[i]);

	sort(l+1,l+n+1);

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

	    for(int j=1;j<i;j++){

	    	int left=i+1,right=n,mid,ans=-1;

	    	while(left<=right){

	    		mid=(left+right)/2;

	    		if(l[mid]<l[i]+l[j]&&(mid==n||l[mid+1]>=l[i]+l[j])){ans=mid;break;}

				else if(l[mid]>=l[i]+l[j]) right=mid-1;

				else left=mid+1;

			}

			if(ans==-1) continue;

			else cnt+=(ans-i);

		}

	cout<<cnt<<endl;

}

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

#include<string.h>

#include<algorithm>

//

using namespace std;

int n,ans;

int a[2005]; 

int main(){

	scanf("%d",&n);

	for(int i=1;i<=n;++i)scanf("%d",a+i);

	sort(a+1,a+n+1);

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

	for(int j=i+1;j<=n;++j)

	for(int k=j+1;k<=n;++k)

	if(a[i]+a[j]>a[k])ans++;

	else break;

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

	return 0;

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

#include<algorithm>

int n,d[30000];



bool bh(int i,int j,int k){

    if (d[i]<d[j]+d[k]){

        return true;

    }

    return false;

}



int main(){

    std::cin>>n;

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

        std::cin>>d[i];

    }

    int sl=0;

    std::sort(d+1,d+n+1);

    for (int i=1;i<=n-2;i++){

        for (int j=i+1;j<=n-1;j++){

            for (int k=j+1;k<=n;k++){

                if ((bh(i,j,k)) && (bh(j,k,i)) && (bh(k,i,j))){

                sl++;}

                else break;

            }

        }

    }

    std::cout<<sl;

    return 0;

}

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

#include<stdlib.h>

int inc(const void *a, const void *b)

{

	return *(int *)a-*(int *)b;

}

int main()

{

	int n,a[10000],l=0,r=1,m,cnt=0;

	scanf("%d",&n);

	for(int i=0;i<n;i++)scanf("%d",&a[i]);

	qsort(a,n,sizeof(int),inc);

	m=2;

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

	{

		for(int j=i+1;j<n-1;j++)

		{

			for(int k=j+1;k<n;k++)

			{

				if(a[i]+a[j]>a[k])cnt++;

			}

		}

	}

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

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

using namespace std;



const int N = (int)2e3;

int dat[N+5];



int main() {

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

    for (int i=1; i<=n; i++) scanf("%d", dat+i);



    sort(dat+1, dat+1+n);



    long long res = 0;

    for (int i=1; i<=n; i++) for (int j=i+1; j<=n; j++) {

        int key = dat[i] + dat[j];

        int idx = lower_bound(dat+1, dat+1+n, key) - dat;

        res += (long long)max(idx-j - 1, 0);

    }



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

    return 0;

}


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

#include<stdlib.h>

int inc(const void *a, const void *b)

{

	return *(int *)a-*(int *)b;

}

int main()

{

	int n,a[10000],l=0,r=1,m,cnt=0;

	scanf("%d",&n);

	for(int i=0;i<n;i++)scanf("%d",&a[i]);

	qsort(a,n,sizeof(int),inc);

	m=2;

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

	{

		for(int j=i+1;j<n-1;j++)

		{

			for(int k=j+1;k<n;k++)

			{

				if(a[i]+a[j]>a[k])cnt++;

			}

		}

	}

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

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

#include<algorithm>

#include<iostream>

#include<cmath>

#include<cstring>

#include<string>

using namespace std;

int n,cnt=0,l[100010];

int main(){

	scanf("%d",&n);

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

	    scanf("%d",&l[i]);

	sort(l+1,l+n+1);

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

	    for(int j=1;j<i;j++){

	    	int left=i+1,right=n,mid,ans=-1;

	    	while(left<=right){

	    		mid=(left+right)/2;

	    		if(l[mid]<l[i]+l[j]&&(mid==n||l[mid+1]>=l[i]+l[j])){ans=mid;break;}

				else if(l[mid]>=l[i]+l[j]) right=mid-1;

				else left=mid+1;

			}

			if(ans==-1) continue;

			else cnt+=(ans-i);

		}

	cout<<cnt<<endl;

}

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

#include<stdlib.h>

int inc(const void *a, const void *b)

{

	return *(int *)a-*(int *)b;

}

int main()

{

	int n,a[10000],l=0,r=1,m,cnt=0;

	scanf("%d",&n);

	for(int i=0;i<n;i++)scanf("%d",&a[i]);

	qsort(a,n,sizeof(int),inc);

	m=2;

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

	{

		for(int j=i+1;j<n-1;j++)

		{

			for(int k=j+1;k<n;k++)

			{

				if(a[i]+a[j]>a[k])cnt++;

			}

		}

	}

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

}