# ZCO15004 solution not accepted

My code is giving WA even though it gives correct answer in the sample cases.
My code:

``````#include <stdio.h>
#include <algorithm>
#define ll long long int
using namespace std;

int main()
{
ll x_co=100000,y_co=500,n,max_v=0,grt=0;
cin>>n;
ll a[n][2];
for(ll i=0;i<n;i++)
{
cin>>a[i][0];
if(i!=0)
{
if(a[i][0]-a[i-1][0]>max_v)
{
max_v=a[i][0]-a[i-1][0];
}
}

cin>>a[i][1];
}
for(ll i=0;i<n;i++)
{
for(ll j=i+1;j<n;j++)
{
if(a[j][0]<a[i][0])
{
ll temp=a[j][0];
a[j][0]=a[i][0];
a[i][0]=temp;
}
}
}
grt=y_co*max_v;
for(ll i=0;i<n;i++)
{
ll left=0,right=x_co;
if(a[i][0]==a[i-1][0])
{
if(a[i][1]>a[i-1][1])
continue;
}
if(a[i][0]==a[i+1][0])
{
if(a[i][1]>a[i+1][1])
continue;
}
for(ll j=i-1;j>0;j--)
{
if(a[j][1]<a[i][1])
{
left=a[j][0];
break;
}
}
for(ll j=i+1;j<n;j++)
{
if(a[j][1]<a[i][1])
{
right=a[j][0];
break;
}
}
ll area=a[i][1]*(left-right);
if(area>grt)
grt=area;
}
if((a[0][0]*y_co)>grt)
grt=a[0][0]*y_co;
if(((x_co-a[n-1][0])*y_co)>grt)
grt=(x_co-a[n-1][0])*y_co;
cout<<grt;
return 0;

}`````````

Please either format your code or link to your submission - the forum software has mangled it and it wonâ€™t compile!