#include

using namespace std;

```
int main()
{ typedef unsigned int sd;
sd n;
sd *s;
sd i,j;
sd MAX;
cout<<"Enter the number of skyscrapers"<<endl;
cin>>n;
s= new sd[n+1];
cout<<"Enter the floors of skyscrapers";
cout<<endl;
for(i=1;i<=n;i++)
{
cin>>s[i];
}
MAX=0;
for(i=1;i<n;i++)
{
for(j=i+1;j<=n;j++)
{
if(j<=n/2)
{
if((s[i]+s[j]+(j-i))>MAX)
{
MAX=(s[i]+s[j]+(j-i));
}
}
if(j>n/2)
{
if(s[i]+s[j]+(n-(j-i))>MAX)
MAX=(s[i]+s[j]+(j-i));
}
}
}
cout<<endl;
cout<<MAX;
}
```

**I didnt use system(“Pause”) or getline or getch functions yet this programs says time limit exceeded**