#include
#include<bits/stdc++.h>
#include
using namespace std;
int choppair(vectorchopsticks,int n,int d)
{
int t= 0;
for(int i = 0;i<n;i++)
{
for(int j =0;j<n;j++)
{
if(abs(chopsticks[i]-chopsticks[j])<=2 && i !=j)
{
t++;
}
}
return t ;
}
}
int main()
{
int n,d,m;
cin>>n;
cin>>d;
vector<int>chop(n);
for(int i=0;i<n;i++)
{
cin>>chop[i];
}
m = choppair(chop,n,d);
cout<<m;
return 0 ;
}
this is my code and i m getting a wrong anwer though even it was successfully executed for sample test case