Max value test case error

My code got wrong answer for test case 3 but when i downloaded the test case and check it i got correct output can anyone tell me where my code gone wrong.
Here’s my code
#include
using namespace std;

int main() {

int n;
cin>>n;

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

int m = 0; //variable for storing maximum value
for(int i=0 ; i<n ; i++){
	m = max(a[i] , m);
}
cout<<m<<endl;
return 0;

}

@goyalaman hey aman do m=a[0];