Why this code not passing 1 test case

#include
#include<math.h>
#include
using namespace std;
int main(){
long long int n;
cin>>n;
int a[1000];
long long int max=a[0];
for(int i=0;i<n;i++){
cin>>a[i];

}
for(int i=0;i<n;i++){
if(a[i]>max){
max=a[i];
}
}
cout<<max;

return 0;

}

Your mistakes

  1. first take array
    and then initialize the max = a[0]

Modified Code

check now