Problem in Magic pairs

http://www.codechef.com/viewsolution/5463660

Above code shows wrong answer…
can anyone plz check it …

printf("%lld\n",ans[i]);
^

you can directly do printf("%lld\n",n*(n-1)/2);

there is no need to use array. :slight_smile:

thanks bro …
i didnt see that comin