My issue
My code
#include <bits/stdc++.h>
using namespace std;
#define ll long long
long long int modulo = 1000000007 ;
ll d[1000001] ;
int main() {
// your code goes here
int t;
cin>>t;
d[0] = 0 ;
d[1] = 1 ;
for(ll j = 2 ; j <= 1000000 ;++j)
{
d[j] = (j*d[j-1]% modulo)%modulo ;
}
while(t--)
{
int num;
int sum = 0 ;
cin >> num ;
map<ll, ll>m ;
for(int i = 0 ; i < num ; ++i)
{
int x ;
cin >> x ;
m[x]++ ;
}
for(auto it:m)
{
sum = ((sum + it.first*it.second)%modulo)%modulo;
}
cout<<sum<<endl ;
}
return 0;
}
Problem Link: SPBALL Problem - CodeChef