Help me in solving RATINGINPRAC problem

My issue

i have taken two variables prev and k prev is used to store previous question ranking and k is used to store present ranking. i just compare them and prev is updated at end of loop.I only face problem is 9 26 53 83 87 127 181 196 210 222 297 346 351 356 471 531 636 684 692 755 774 875 883 907 911 1012 1098 1115 1115 1123 1143 1178 1356 1579 1616 1741 1838 1885 1980 1990 2159 2162 2170 2204 2237 2281 2356 2447 2460 2473 2490 2511 2518 2564 2766 2843 2865 2916 3015 3076 3094 3268 3272 3275 3287 3293 3507 3515 3549 3736 3768 3861 3864 3898 3924 3931 4037 4077 4118 4127 4127 4162 4244 4251 4259 4283 4327 4328 4433 4448 4495 4522 4535 4604 4628 4644 4680 4692 4718 4985
test case and this too is working on other compilers like programz

My code

#include <iostream>
#include<vector>
using namespace std;
int main() {
	int t;
	cin>>t;
	for(int i=0;i<t;i++)
	{
	    int n;
	    cin>>n;
	    int u=0,k,flag=0;
	    for(int j=0;j<n;j++){
	        cin>>k;
	        if(k<u){
	            cout<<"No \n";
	            flag=1;
	            break;
	        }
	        u=k;
	    }
	    if(flag==0)
	    cout<<"Yes \n";
	}
}

Learning course: Arrays using C++
Problem Link: CodeChef: Practical coding for everyone

@prernapal135
Have corrected your code.
the thing is when u are getting no as answer u are breaking the loop and ignoring the rest of the inputs .
This thing can mess up the inputs for the test cases afterwards.

#include <iostream>
#include<vector>
using namespace std;
int main() {
	int t;
	cin>>t;
	for(int i=0;i<t;i++)
	{
	    int n;
	    cin>>n;
	    int u=0,k,flag=0;
	    for(int j=0;j<n;j++){
	        cin>>k;
	        if(k<u){
	            //cout<<"No \n";
	            flag=1;
	          //  break;
	        }
	        u=k;
	    }
	    if(flag==0)
	    cout<<"Yes \n";
	    else
	    cout<<"No\n";
	}
}