Here is the code

include <bits/stdc++.h>

using namespace std;

int main() {

int t;

cin>>t;

while(t–){

long long n;

cin>>n;

vectora(n);

vectorb(200002);

vectorp(200002);

for(int i=0;i<n;i++){

cin>>a[i];

}

for(int i=0;i<n;i++){

if(a[i]<=200000){

b[a[i]]++;

}

}

p[0]=1;

long long count =0;

for(int i=1;i<=200000;i++){

p[i]=(b[i]*p[i-1])%1000000007;

count+=(p[i])%1000000007;

}

cout<<count<<endl;

}

return 0;

}

Here is the solution Link:CodeChef: Practical coding for everyone

I used the prefix sum method and modulo method but getting wrong answer and TLE