这份代码为何T掉了
#include<iostream>
#include<cstdio>
#include<vector>
#include<unordered_map>
using namespace std;
namespace INPUT{
char buf[1<<20],*p1,*p2;
#define gc() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<20,stdin),p1==p2)?EOF:*p1++)
}
using namespace INPUT;
template<typename T>
inline T read(){
T x=0,p=1;
char ch=gc();
for(;ch<'0'||ch>'9';ch=gc())
if(ch=='-') p=-1;
for(;ch>='0'&&ch<='9';ch=gc())
x=(x<<3)+(x<<1)+(ch^48);
return x*p;
}
const int N=2e5+5;
int n;
int x[N],y[N];
unordered_map<int,int>K1,K2;
unordered_map<int,int>X,Y;
#define ll long long
ll ans;
void solve(){
K1.clear(),K2.clear();
X.clear(),Y.clear();
ans=0;
n=read<int>();
for(int i=1;i<=n;i++) {
x[i]=read<int>(),y[i]=read<int>();
K1[y[i]-x[i]]++,K2[y[i]+x[i]]++;
X[x[i]]++,Y[y[i]]++;
}
for(auto p:K1) ans+=(1ll*p.second*(p.second-1));
for(auto p:K2) ans+=(1ll*p.second*(p.second-1));
for(auto p:X) ans+=(1ll*p.second*(p.second-1));
for(auto p:Y) ans+=(1ll*p.second*(p.second-1));
cout<<ans<<endl;
}
int main(){
// freopen("G.in","r",stdin);
// freopen("G.out","w",stdout);
int T=read<int>();
while(T--) solve();
}