ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2062C - Cirno and Operations
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
#define int long long
using namespace std;
void solve(){

    int n;
    cin>>n;
    vector<int>a;
    for (int i = 0; i < n; i++)
    {
        int temp ;
        cin>>temp;
        a.push_back(temp);
    }
    int ans = accumulate(begin(a),end(a),0LL);
    while (a.size()>1)
    {
        vector<int>forward;
        vector<int>backward;
        int f = 0;
        int b = 0;
        for (int i = 0; i < a.size()-1; i++)
        {
            b+=a[i]-a[i+1];
            backward.push_back(a[i]-a[i+1]);
        }
        for (int i = 1; i < a.size(); i++)
        {
            f+=a[i]-a[i-1];
            forward.push_back(a[i]-a[i-1]);
        }
        if(f>b){
            a.resize(forward.size());
            a=forward;
        }
        else{
            a.resize(backward.size());
            a=backward;
        }
    }
    ans = max(ans,a[0]);
    cout<<ans<<endl;
    
}

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);

    int _t;cin>>_t;while(_t--)
    solve();

    return  0;
}



Submission (verdict: Accepted):
#include <bits/stdc++.h>
#define int long long
using namespace std;
void solve(){

    int n;
    cin>>n;
    vector<int>a;
    for (int i = 0; i < n; i++)
    {
        int temp ;
        cin>>temp;
        a.push_back(temp);
    }
    int ans = accumulate(begin(a),end(a),0LL);
    while (a.size()>1)
    {
        vector<int>forward;
        vector<int>backward;
        int f = 0;
        int b = 0;
        for (int i = 0; i < a.size()-1; i++)
        {
            b+=a[i]-a[i+1];
            backward.push_back(a[i]-a[i+1]);
        }
        for (int i = 1; i < a.size(); i++)
        {
            f+=a[i]-a[i-1];
            forward.push_back(a[i]-a[i-1]);
        }
        if(f>b){
            a.resize(forward.size());
            a=forward;
            ans=max(f,ans);
        }
        else{
            a.resize(backward.size());
            a=backward;
            ans=max(b,ans);
        }
    }
    ans = max(ans,a[0]);
    cout<<ans<<endl;
    
}

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);

    int _t;cin>>_t;while(_t--)
    solve();

    return  0;
}
Problem: 2063C - Remove Exactly Two
Language: C++17 (GCC 7-32)


Submission (verdict: Runtime error on test 2):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//ll m = 1e9+7;


int main() {
	// your code goes here
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        vector<int> a[n+1];
        map<pair<int,int>, int> e;
        for(int i=1; i<n; i++){
            int u, v;
            cin>>u>>v;
            a[u].push_back(v);
            a[v].push_back(u);
            e[{u,v}]=1;
            e[{v,u}]=1;
        }
      //  cout<<"#";
        vector<int> p;
        map<int, vector<int>> m; 
        for(int i=1;i<=n;i++){
            p.push_back(a[i].size());
         //   cout<<a[i].size()<<" "<<i<<endl;
            m[a[i].size()].push_back(i);
        }
        sort(p.begin(), p.end());
        // for(auto i:p)
        //     cout<<i<<" ";
        // cout<<endl;
        int k=p.size(), ans;
       // cout<<k<<" "<<p[k-1]<<endl;
        if(m[p[k]].size()>2){
            ans=2*p[k-1]-1;
           // cout<<p[k-1]<<" " <<m[p[k-1]].size()<<endl;
        }
        else if(m[p[k-1]].size()==2){
           // cout<<"@";
            if(e.find({m[k-1][0],m[k-1][1]})==e.end()){
                ans=2*p[k-1]-1;
            }
            else
                ans=2*p[k-1]-2;
            
        }
        else{
            int s = m[p[k-2]].size();
          //  cout<<s<<endl;
            ans=p[k-1]+p[k-2]-2;
            for(int i=0;i<s;i++){
                if(e.find({m[p[k-2]][i], m[p[k-1]][0]})==e.end()){
                 //   cout<<m[p[k-2]][i]<<" "<<m[p[k-1]][0]<<endl;
                    ans=p[k-1]+p[k-2]-1;
                }
            }
        }
        // if(m.size()>0){
        //     if(m.size()==1){
        //         if(b==1)
        //             cout<<"2"<<endl;
        //         else
        //             cout
        //     }
        //     for(int i=1;i<=n;i++){
        //         if(m.find(i)!=m.end()){
        //             for(auto j : a[i]){
        //                 if(m.find(j))
        //             }
        //         }
        //     }
        // }
        // else{
        //     cout<<min(n-2, 3)<<endl;
        // }
        cout<<ans<<endl;
        
        
        
    }
        
}
Problem: 2049C - MEX Cycle
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>

using namespace std;

void solve(int n, int x, int y) {

    vector<vector<int>> adj(n + 1, vector<int>());

    for (int i = 0; i < n; ++i) {

        int prev = (i - 1 + n) % n;

        int next = (i + 1) % n;

        adj[i].push_back(prev);

        adj[i].push_back(next);

    }

    auto is_adjacent = [&](int u, int v) -> bool {

        return (u == v - 1) || (u == v + 1) || (u == 1 && v == n) || (u == n && v == 1);

    };

    if (!is_adjacent(x, y)) {

        adj[x].push_back(y);

        adj[y].push_back(x);

    }

    vector<int> labels(n + 1, 0);

    queue<int> q;

    for (int i = 0; i < n; ++i) {

        q.push(i);

    }

    vector<bool> in_queue(n + 1, true);

    while (!q.empty()) {

        int u = q.front();

        q.pop();

        in_queue[u] = false;

        int mask = 0;

        for (const auto &v : adj[u]) {

            if (labels[v] < 32) {

                mask |= (1 << labels[v]);

            }

        }

        int mex = 0;

        while (mask & (1 << mex)) {

            ++mex;

        }

        if (labels[u] != mex) {

            labels[u] = mex;

            for (const auto &v : adj[u]) {

                if (!in_queue[v]) {

                    q.push(v);

                    in_queue[v] = true;

                }

            }

        }

    }

    for (int i = 0; i < n; ++i) {

        cout << labels[i] << " ";

    }

    cout << "\n";

}

int main() {

    ios::sync_with_stdio(false);

    cin.tie(nullptr);

    int t;

    cin >> t;

    while (t--) {

        int n, x, y;

        cin >> n >> x >> y;

        solve(n, x, y);

    }

    return 0;

}
Problem: 2060D - Subtract Min Sort
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
#define IO iostream::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define int long long
#define int long long
#define ll long long
#define ld long double
#define nl "\n"

void solve() {
    int n; cin >> n;
    deque<int> arr(n);
    bool acc = true;
    for (int i = 0; i < n; i++) cin >> arr[i];

    while (arr.size() > 1) {
        if (arr[0] > arr[1]) {
            acc = false;
            break;
        }
        else if (arr[0] < arr[1]) {
            arr[1] = arr[0];
            arr.pop_front();
        }
        else {
            arr.pop_front();
            arr.pop_back();
        }
    }
    cout << (acc? "YES" : "NO") << nl;
}

signed main() {
    IO
    //int t = 1;
    int t; cin >> t;

    while(t--) {
        solve();
    }
}

Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define IO iostream::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define int long long
#define int long long
#define ll long long
#define ld long double
#define nl "\n"

void solve() {
    int n; cin >> n;
    deque<int> arr(n);
    bool acc = true;
    for (int i = 0; i < n; i++) cin >> arr[i];

    while (arr.size() > 1) {
        if (arr[0] > arr[1]) {
            acc = false;
            break;
        }
        else if (arr[0] < arr[1]) {
            arr[1] -= arr[0];
            arr.pop_front();
        }
        else {
            arr.pop_front();
            arr.pop_back();
        }
    }
    cout << (acc? "YES" : "NO") << nl;
}

signed main() {
    IO
    //int t = 1;
    int t; cin >> t;

    while(t--) {
        solve();
    }
}
Problem: 2060D - Subtract Min Sort
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define IO iostream::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define int long long
#define int long long
#define ll long long
#define ld long double
#define nl "\n"

void solve() {
    int n; cin >> n;
    deque<int> arr(n);
    bool acc = true;
    for (int i = 0; i < n; i++) cin >> arr[i];

    while (arr.size() > 1) {
        if (arr[0] > arr[1]) {
            acc = false;
            break;
        }
        else if (arr[0] < arr[1]) {
            arr[1] -= arr[0];
            arr.pop_front();
        }
        else {
            arr.pop_front();
            arr.pop_back();
        }
    }
    cout << (acc? "YES" : "NO") << nl;
}

signed main() {
    IO
    //int t = 1;
    int t; cin >> t;

    while(t--) {
        solve();
    }
}

Submission (verdict: Accepted):
#include <bits/stdc++.h>
using namespace std;
#define IO iostream::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define int long long
#define int long long
#define ll long long
#define ld long double
#define nl "\n"

void solve() {
    int n; cin >> n;
    deque<int> arr(n);
    bool acc = true;
    for (int i = 0; i < n; i++) cin >> arr[i];

    while (arr.size() > 1) {
        if (arr[0] > arr[1]) {
            acc = false;
            break;
        }
        else if (arr[0] < arr[1]) {
            arr[1] -= arr[0];
            arr.pop_front();
        }
        else {
            arr.pop_front();
            arr.pop_front();
        }
    }
    cout << (acc? "YES" : "NO") << nl;
}

signed main() {
    IO
    //int t = 1;
    int t; cin >> t;

    while(t--) {
        solve();
    }
}
Problem: 2060D - Subtract Min Sort
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define IO iostream::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define int long long
#define int long long
#define ll long long
#define ld long double
#define nl "\n"
bool isNonDecreasing(const vector<int>& arr) {
    int n = arr.size();
    for (int i = 0; i < n - 1; i++) {
        if (arr[i] > arr[i + 1]) {
            return false;
        }
    }
    return true;
}

void solve() {
    int n; cin >> n;
    deque<int> arr(n);
    bool acc = true;
    for (int i = 0; i < n; i++) cin >> arr[i];

    while (arr.size() > 1) {
        if (arr[0] > arr[1]) {
            acc = false;
            break;
        }
        else if (arr[0] < arr[1]) {
            arr[1] = 0;
            arr.pop_front();
        }
        else {
            arr.pop_back();
            arr.pop_front();
        }
    }
    cout << (acc? "YES" : "NO") << nl;
}

signed main() {
    IO
    //int t = 1;
    int t; cin >> t;

    while(t--) {
        solve();
    }
}

Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
#define IO iostream::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define int long long
#define int long long
#define ll long long
#define ld long double
#define nl "\n"

void solve() {
    int n; cin >> n;
    deque<int> arr(n);
    bool acc = true;
    for (int i = 0; i < n; i++) cin >> arr[i];

    while (arr.size() > 1) {
        if (arr[0] > arr[1]) {
            acc = false;
            break;
        }
        else if (arr[0] < arr[1]) {
            arr[1] = arr[0];
            arr.pop_front();
        }
        else {
            arr.pop_front();
            arr.pop_back();
        }
    }
    cout << (acc? "YES" : "NO") << nl;
}

signed main() {
    IO
    //int t = 1;
    int t; cin >> t;

    while(t--) {
        solve();
    }
}
Problem: 2060D - Subtract Min Sort
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define IO iostream::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define int long long
#define int long long
#define ll long long
#define ld long double
#define nl "\n"
bool isNonDecreasing(const vector<int>& arr) {
    int n = arr.size();
    for (int i = 0; i < n - 1; i++) {
        if (arr[i] > arr[i + 1]) {
            return false;
        }
    }
    return true;
}

void solve() {
    int n; cin >> n;
    deque<int> arr(n);
    bool acc = true;
    for (int i = 0; i < n; i++) cin >> arr[i];

    while (arr.size() > 1) {
        if (arr[0] > arr[1]) {
            acc = false;
            break;
        }
        else if (arr[0] < arr[1]) {
            arr[1] = 0;
            arr.pop_front();
        }
        else {
            arr.pop_back();
            arr.pop_front();
        }
    }
    cout << (acc? "YES" : "NO") << nl;
}

signed main() {
    IO
    //int t = 1;
    int t; cin >> t;

    while(t--) {
        solve();
    }
}
Problem: 2052A - Adrenaline Rush
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;


#define N 1000000

int i,j,k,n,m,t,res;
bitset<N+50> nmsl;
vector<pair<int,int> > v;

int main(){
	
	cin>>n;
	for(i=1;i<=n;i++){
		cin>>k; nmsl[k]=1;
		for(j=k+1;j<=n;j++)if(!nmsl[j]){
			v.push_back({j,k});
		}
		for(j=n;j>=1;j--)if(!nmsl[j]){
			v.push_back({k,j});
		}
	}
	
	cout<<v.size()<<'\n';
	for(auto [i,j]:v)cout<<i<<j<<'\n';
}

Submission (verdict: Accepted):
#include<bits/stdc++.h>
using namespace std;


#define N 1000000

int i,j,k,n,m,t,res;
bitset<N+50> nmsl;
vector<pair<int,int> > v;

int main(){
	
	cin>>n;
	for(i=1;i<=n;i++){
		cin>>k; nmsl[k]=1;
		for(j=k+1;j<=n;j++)if(!nmsl[j]){
			v.push_back({j,k});
		}
		for(j=n;j>=1;j--)if(!nmsl[j]){
			v.push_back({k,j});
		}
	}
	
	cout<<v.size()<<'\n';
	for(auto [i,j]:v)cout<<i<<' '<<j<<'\n';
}
Problem: 2052A - Adrenaline Rush
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;


#define N 1000000

int i,j,k,n,m,t,res;
bitset<N+50> nmsl;
vector<pair<int,int> > v;

int main(){
	
	cin>>n;
	for(i=1;i<=n;i++){
		cin>>k; nmsl[k]=1;
		for(j=k+1;j<=n;j++)if(!nmsl[j]){
			v.push_back({j,k});
		}
		for(j=n;j>=1;j--)if(!nmsl[j]){
			v.push_back({k,j});
		}
	}
	
	cout<<v.size()<<'\n';
	for(auto [i,j]:v)cout<<i<<j;
}
Problem: 2052A - Adrenaline Rush
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;


#define N 1000000

int i,j,k,n,m,t,res;
bitset<N+50> nmsl;
vector<pair<int,int> > v;

int main(){
	
	cin>>n;
	for(i=1;i<=n;i++){
		cin>>k; nmsl[k]=1;
		for(j=k+1;j<=n;j++)if(!nmsl[j]){
			v.push_back({j,k});
		}
		for(j=n;j>=1;j--)if(!nmsl[j]){
			v.push_back({k,j});
		}
	}
	
	cout<<v.size()<<'\n';
	for(auto [i,j]:v)cout<<i<<j;
}

Submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;


#define N 1000000

int i,j,k,n,m,t,res;
bitset<N+50> nmsl;
vector<pair<int,int> > v;

int main(){
	
	cin>>n;
	for(i=1;i<=n;i++){
		cin>>k; nmsl[k]=1;
		for(j=k+1;j<=n;j++)if(!nmsl[j]){
			v.push_back({j,k});
		}
		for(j=n;j>=1;j--)if(!nmsl[j]){
			v.push_back({k,j});
		}
	}
	
	cout<<v.size()<<'\n';
	for(auto [i,j]:v)cout<<i<<j<<'\n';
}
Problem: 2049B - pspspsps
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include <iostream>

#include <vector>

#include <algorithm>

#include <set>

using namespace std;



int main() {

    int t;

    cin >> t;

    while (t--) {

        int n;

        cin >> n;

        

        string ss;

        cin >> ss;

        if(n == 1){

            cout<<"YES"<<endl;

            continue;

        }

        int p = -1, s = -1;

        for (int i = 0; i < n; i++) {

            if (ss[i] == 'p' && p == -1) p = i;

            if (ss[i] == 's' && s == -1) s = i;

        }

        

        if (s != -1 && p != -1 && p < s) {

            cout << "NO" << endl;

            continue;

        }



        set<char> cnt;

        for (int i = 1;i< n-1;i++ ) {

            if (ss[i] != '.') cnt.insert(ss[i]);

        }



        if (cnt.size() > 1) {

            cout << "NO" << endl;

            continue;

        }



        if (cnt.size() == 0) {

            cout << "YES" << endl;

            continue;

        }



        char bet = *cnt.begin();

        bool ans = (ss[0] == ss[n - 1] && ss[n - 1] == bet) || (ss[0] == 's' && ss[n - 1] == 'p');

        

        if (ans) cout << "YES" << endl;

        else cout << "NO" << endl;

    }

    

    return 0;

}



Submission (verdict: Wrong answer on test 2):
#include <iostream>

#include <vector>

#include <algorithm>

#include <set>

using namespace std;



int main() {

    int t;

    cin >> t;

    while (t--) {

        int n;

        cin >> n;

        

        string ss;

        cin >> ss;

        if(n == 1){

            cout<<"YES"<<endl;

            continue;

        }

        int p = -1, s = -1;

        for (int i = 0; i < n; i++) {

            if (ss[i] == 'p' && p == -1) p = i;

            if (ss[i] == 's' && s == -1) s = i;

        }

        

        if (s != -1 && p != -1 && p < s) {

            cout << "NO" << endl;

            continue;

        }



        set<char> cnt;

        for (int i = 1;i< n-1;i++ ) {

            if (ss[i] != '.') cnt.insert(ss[i]);

        }



        if (cnt.size() > 1) {

            cout << "NO" << endl;

            continue;

        }



        if (cnt.size() == 0) {

            cout << "YES" << endl;

            continue;

        }



        // char bet = *cnt.begin();

        // bool ans = (ss[0] == ss[n - 1] && ss[n - 1] == bet) || (ss[0] == 's' && ss[n - 1] == 'p');

         cout << "YES" << endl;



    }

    

    return 0;

}
Problem: 2049B - pspspsps
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 2):
#include <iostream>

#include <vector>

#include <algorithm>

#include <set>

using namespace std;



int main() {

    int t;

    cin >> t;

    while (t--) {

        int n;

        cin >> n;

        

        string ss;

        cin >> ss;

        if(n == 1){

            cout<<"YES"<<endl;

            continue;

        }

        int p = -1, s = -1;

        for (int i = 0; i < n; i++) {

            if (ss[i] == 'p' && p == -1) p = i;

            if (ss[i] == 's' && s == -1) s = i;

        }

        

        if (s != -1 && p != -1 && p < s) {

            cout << "NO" << endl;

            continue;

        }



        set<char> cnt;

        for (int i = 1;i< n-1;i++ ) {

            if (ss[i] != '.') cnt.insert(ss[i]);

        }



        if (cnt.size() > 1) {

            cout << "NO" << endl;

            continue;

        }



        if (cnt.size() == 0) {

            cout << "YES" << endl;

            continue;

        }



        char bet = *cnt.begin();

        bool ans = (ss[0] == ss[n - 1] && ss[n - 1] == bet) || (ss[0] == 's' && ss[n - 1] == 'p');

        

        if (ans) cout << "YES" << endl;

        else cout << "NO" << endl;

    }

    

    return 0;

}
Problem: 2049B - pspspsps
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include <iostream>

#include <vector>

#include <algorithm>

#include <set>

using namespace std;



int main() {

    int t;

    cin >> t;

    while (t--) {

        int n;

        cin >> n;

        

        string ss;

        cin >> ss;

        if(n == 1){

            cout<<"YES"<<endl;

            continue;

        }

        int p = -1, s = -1;

        for (int i = 0; i < n; i++) {

            if (ss[i] == 'p' && p == -1) p = i;

            if (ss[i] == 's' && s == -1) s = i;

        }

        

        if (s != -1 && p != -1 && p < s) {

            cout << "NO" << endl;

            continue;

        }



        set<char> cnt;

        for (int i = 1;i< n-1;i++ ) {

            if (ss[i] != '.') cnt.insert(ss[i]);

        }



        if (cnt.size() > 1) {

            cout << "NO" << endl;

            continue;

        }



        if (cnt.size() == 0) {

            cout << "YES" << endl;

            continue;

        }



        // char bet = *cnt.begin();

        // bool ans = (ss[0] == ss[n - 1] && ss[n - 1] == bet) || (ss[0] == 's' && ss[n - 1] == 'p');

         cout << "YES" << endl;



    }

    

    return 0;

}



Submission (verdict: Accepted):
#include <iostream>

#include <vector>

#include <algorithm>

#include <set>

using namespace std;



int main() {

    int t;

    cin >> t;

    while (t--) {

        int n;

        cin >> n;

        

        string ss;

        cin >> ss;

        if(n == 1){

            cout<<"YES"<<endl;

            continue;

        }

        int p = -1, s = -1;

        for (int i = 0; i < n; i++) {

            if (ss[i] == 'p' && p == -1) p = i;

            if (ss[i] == 's') s = i;

        }

        

        if (s != -1 && p != -1 && p < s) {

            cout << "NO" << endl;

            continue;

        }



        set<char> cnt;

        for (int i = 1;i< n-1;i++ ) {

            if (ss[i] != '.') cnt.insert(ss[i]);

        }



        if (cnt.size() > 1) {

            cout << "NO" << endl;

            continue;

        }



        if (cnt.size() == 0) {

            cout << "YES" << endl;

            continue;

        }



        // char bet = *cnt.begin();

        // bool ans = (ss[0] == ss[n - 1] && ss[n - 1] == bet) || (ss[0] == 's' && ss[n - 1] == 'p');

         cout << "YES" << endl;



    }

    

    return 0;

}
Problem: 2060D - Subtract Min Sort
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;

int main() {
    int tt; 
    cin >> tt;
    
    while (tt--) {
        int n; cin >> n;
        vector<int>nums(n);
        for(int i =0 ; i <n ; i++) cin >> nums[i];
        reverse(nums.begin(),nums.end());
        bool st=true;
        for (int i = 0; i < n-2; i++)
        {
            if(nums[i]<nums[i+1]){
                int x=(min(nums[i+1],nums[i+2]));
                nums[i+1]-=x;
                nums[i+2]-=x;
                 if(nums[i]<nums[i+1]){
                    st=false;
                    break;
                 }
            }
        }
        // for(auto s: nums) cout << s << " ";
        if(nums[n-2]>nums[n-1]) st=false;
        if(!st){
            cout << "YES\n";
            continue;
        }else{
            cout << "NO\n";
        }
        

        


        
        

        
        
        
        

        
        
        
        

        
        

       
    }
}