Zonal Computing Olympiad 2014, 30 Nov 2013

#include
using namespace std;

int main() {

int n;
cin>>n;
long long int a[100000];
for(int i=0;i<n;i++)
cin>>a[i];
int count=0;
int count2=0;
int temp;
for (int i = 0; i < n-1; i++)

for (int j = 0; j < n-i-1; j++)
    if (a[j] > a[j+1])
    {
        temp=a[j];
        a[j]=a[j+1];
        a[j+1]=temp;
    }
int max2=0;
int max1=0;
int t=-1;
for(int i=0;i<n;i++)
{
    count=0;
for(int j=i+1;j<n;j++)
{

    if(a[i]<=a[j])
        count++;
}
max1=a[i]*(count+1);
if(max1>max2)
{
    max2=max1;
    t=a[i];

}

}
cout<<max2;



return 0;

}
My program is correct but some test cases are not passing .Can someone help in it.