When I compile the code with inputs then it works fine. But when I want to run it with user input, it just doesn't take in inputs. It doesn't give any error.
// kefaa and first steps
// 2 2 1 3 4 1
#include <bits/stdc++.h>
using namespace std;
int main(){
int n, a[n], counter=0, maxIncr=0;
cin >> n;
cin.sync();
for(int i = 0; i < n; ++i){
cin >> a[i];
}
for(int i=0; i < n-1; ++i){
if (a[i] <= a[i+1]){
counter += 1;
if(maxIncr<counter)
maxIncr=counter;
}else{
counter=1;
}
}
cout << maxIncr;
return 0;
}