#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
struct Node{
int x,y;
}A[200100];
long long vis1[4010];
long long vis2[4010];
int main()
{
int n,i,j,k;
while(scanf("%d",&n)!=EOF){
long long ans=0;
memset(vis1,0,sizeof(vis1));
memset(vis2,0,sizeof(vis2));
for(i=0;i<n;++i){
scanf("%d%d",&A[i].x,&A[i].y);
vis1[A[i].x+A[i].y]++;
vis2[A[i].x-A[i].y+1000]++;
}
for(i=0;i<=2000;++i){
ans=ans+(vis1[i]*(vis1[i]-1))/2;
ans=ans+(vis2[i]*(vis2[i]-1))/2;
}
printf("%I64d\n",ans);
}
return 0;
}
codeforces621B. Wet Shark and Bishops
最新推荐文章于 2018-02-25 13:49:50 发布