The below code passes for all testcases except test case 3.Although running it locally produces the correct output.
#include <iostream>
using namespace std;
int main() {
long long int numOfElements = 0;
long long int a[10] = {0};
long long int max = a[0];
cin >> numOfElements;
a[numOfElements] = {0};
for (long long int i = 0; i < numOfElements; i++) {
cin >> a[i];
}
for (long long int i :a) {
if (i > max) max = i;
}
cout << max;
}
Please help