# uva12535求圆上所有的点能形成的锐角三角形的数量

PS：要加eps

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 0x3f3f3f3f
#define clr(x,y) memset(x,y,sizeof x)
const ll Mod = 1e9 + 7;
const int maxn = 200000 + 10;
#define eps 1e-6
double a[maxn];
int finds(int l,int r,double x)
{
int ret = 0;
while(l <= r)
{
int mid = (l + r) >> 1;
if(a[mid] <= x + eps)ret = mid,l = mid + 1;
else r = mid - 1;
}
return ret;
}
int main()
{
int n;double m;int Tcase = 1;
while( ~ scanf("%d%lf",&n,&m))
{
if(n == 0 && m == 0)break;
for(int i = 1;i <= n;i ++)scanf("%lf",&a[i]);
sort(a + 1,a + n + 1);
ll sum = 0;
for(int i = 1;i <= n;i ++)
{
int t ;
if(a[i] <= 180 + eps)
{
t = finds(i,n,180 + a[i]) - i;
}
else
{
t = finds(1,n,a[i] - 180) + n - i;
}
//            cout << a[i] << " " << t << endl;
sum += 1ll * t * (t - 1)/2;
}
printf("Case %d: %lld\n",Tcase ++,1ll *n * (n - 1)/2 *(n - 2)/3 - sum);
}
return 0;
}



11-13 1112
10-17 974
04-04 6561
12-29 3368
12-22 469
11-19 714
05-18 1269
12-26 85
08-22 1035
09-03 255
03-23 69
08-02 320
03-06 715
02-10 2471
12-14 470