I am trying to solve MIXCOLOR and my code passes all the given test cases also the one’s that I am giving it but it is still giving me WA on codechef judge. Please help me in finding the error in my code or my understanding.

My code:

```
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t --)
{
long long int n;
cin>>n;
long long int a[n];
for(long long int i=0;i<n;i++)
{
cin>>a*;
}
sort(a,a+n);
long long int max = a[n-1];
long long int c = 0;
for(long long int i=1;i<n;i++)
{
if(a* == a[i-1])
{
a* = (a* + max) % 1000000000;
c++;
max += a* % 1000000000;
}
}
cout<<c<<endl;
}
return 0;
}
```