web123456

Task Scheduler c++

#include<bits/stdc++.h>
using namespace std;
long long int n,r[100010],a[100010],r1;
int main()
{
cin>>n>>r1;
r[1]=r1;
a[1]=r[1]%100+1;
for(long long int i=2;i<=n;i++)
{
r[i]=(r[i-1]*6807+2831)%20170;
a[i]=r[i]%100+1;
}
sort(a+1,a+n+1);

int sum=0,sum1=0;
for(long long int i=1;i<=n;i++)
{
sum1=sum1+a[i];
sum=sum+sum1;
}
cout<<sum;
return 0;
}
What's wrong?