Cin.get() leading to wrong output

why you want to use cin.get()
there is not need

you can simply use cin>>
cin automatically remove whitespaces

int n;
    cin>>n;
    // char ch='\n';
    // ch=cin.get();
    // char sh=' ';
    int a[n];
    for(int i=0 ; i<n ; i++){
        cin>>a[i];
    }

this will work fine (after commenting )

all test cases are failing , input format is wrong without use of cin.get()

this is because your code is not printing correct output
you have to print Yes or No and you are printing true false

why you think so?
it will work, don’t use cin.get() only use cin>>

check out this code

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.