Cod sursa(job #717074)
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
vector <int> p;
long long x[1001],y[1001],n,nr=0,k=0,ct=0,ct1=0,ct2=0;
int main(){
freopen("trapez.in","r",stdin);
scanf("%lld",&n);
for (int i=0;i<n;i++){
scanf("%lld %lld",&x[i],&y[i]);
}
fclose(stdin);
for(int i=0;i<n-1;i++){
for(int j=i+1;j<n;j++){
if((x[i]==x[j])||(y[i]==y[j])){
if(x[i]==x[j])ct1++;
if(y[i]==y[j])ct2++;
}else p.push_back(((x[i]-x[j])*1000)/(y[i]-y[j]));
}
}
if (ct1!=0)nr+=ct1-1;
if (ct2!=0)nr+=ct2-1;
sort(p.begin(),p.end());
int l=p.size();
k=p[0];
ct=1;
for (int i=1;i<l;i++){
if(k!=p[i]){
nr+=ct-1;
k=p[i];
ct=1;
}else ct++;
}
freopen("trapez.out","w",stdout);
printf("%lld",nr);
fclose(stdout);
return 0;
}