My code is failing in one test case. Which constraint is missing in the code?
One test case giving wrong answer
@sourav1999
You have to do
ans+=(1LL*fre[i]*(fre[i]-1))/2;
Since fre[] was int, fre[i]*(fre[i]-1) overflows the value of int.
1LL typecastes it into long long
I hope this solves your doubt,
Please close the doubt if it does, else you can enter your query here.