I am getting partially accepted.

My approach:-

First I calculated all the pairs possible for n numbers which are n*(n-1).

Then numbers with frequency greater than 1 , I subtracted all the pairs which can be formed out of those number…

EG- 1,1,2,3,4

So my ans according to that would be (5x4)-(2x1)=18;

(2*1) denotes the pairs formed between 1,1.

This is basically done because we take 1,1 as a pair then (1-1)/1=(1-1)/1 which would not satisfy the condition.

I would be repeated this for all numbers whose frequency is greater than 1.

Am I missing any testcase.

My code:-Solution: 49291990 | CodeChef

Thanks for helping in advance.

```
int n ;
```

Change this to `long long`

and you will get correct answer.

Alternatively, you can also typecast:

```
ll ans=(2*(((ll)n*((ll)n-1))/2));
```

1 Like

Accepted

Just make int n-> ll n

As when you define main variable as int, it gets typecasted into int while storing ans, no matter what’s size of variable in which you are storing it…

1 Like

Ohh , I made a very silly mistake.Thanks for pointing out.

YES, thank you.