ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2063B - Subsequence Update
Language: Java 21

Previous submission (verdict: Wrong answer on test 8):
import java.util.*;

import java.io.*;

public class MooCounting {

    public static void main(String[] args) throws IOException{

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int t = Integer.parseInt(br.readLine());



        while(t-- > 0)

        {

            StringTokenizer st = new StringTokenizer(br.readLine());

            int n = Integer.parseInt(st.nextToken());

            int left = Integer.parseInt(st.nextToken());

            left--;

            int right = Integer.parseInt(st.nextToken());

            right--;



            st = new StringTokenizer(br.readLine());

            int[] arr = new int[n];

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

            {

                arr[i] = Integer.parseInt(st.nextToken());

            }



            // Case 1

            int[] brr = arr.clone();

            Arrays.sort(brr, left, n); // Sort only [l, n]

            int sum1 = 0;

            for (int i = left; i <= right; i++) {

                sum1 += brr[i];

            }



            // Case 2

            int[] crr = arr.clone();

            Arrays.sort(crr, 0, right + 1); // Sort [0, r] normally

            reverse(crr, 0, right); 

            int sum2 = 0;

            for (int i = left; i <= right; i++) {

                sum2 += crr[i];

            }



            System.out.println(Math.min(sum1, sum2));  

        }

    }



    private static void reverse(int[] arr, int start, int end) {

        while (start < end) {

            int temp = arr[start];

            arr[start] = arr[end];

            arr[end] = temp;

            start++;

            end--;

        }

    }   

}

Submission (verdict: Wrong answer on test 8):
import java.util.*;
import java.io.*;
public class MooCounting {
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int t = Integer.parseInt(br.readLine());

        while(t-- > 0)
        {
            StringTokenizer st = new StringTokenizer(br.readLine());
            int n = Integer.parseInt(st.nextToken());
            int left = Integer.parseInt(st.nextToken());
            left--;
            int right = Integer.parseInt(st.nextToken());
            right--;
            int k = right - left + 1;

            st = new StringTokenizer(br.readLine());
            int[] arr = new int[n];
            for(int i = 0; i < n; i++)
            {
                arr[i] = Integer.parseInt(st.nextToken());
            }

            // Case 1: [l, n]
            int[] option1 = Arrays.copyOfRange(arr, left, n);
            Arrays.sort(option1);
            int sum1 = 0;
            for (int i = 0; i < k; i++) sum1 += option1[i];

            // Case 2: [1, r]
            int[] option2 = Arrays.copyOfRange(arr, 0, right + 1);
            Arrays.sort(option2);
            int sum2 = 0;
            for (int i = 0; i < k; i++) sum2 += option2[i];

            
            System.out.println(Math.min(sum1, sum2)); 
        }
    }
}
Problem: 2063B - Subsequence Update
Language: Java 21


Submission (verdict: Wrong answer on test 2):
import java.util.*;

import java.io.*;

public class MooCounting {

    public static void main(String[] args) throws IOException{

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int t = Integer.parseInt(br.readLine());



        while(t-- > 0)

        {

            StringTokenizer st = new StringTokenizer(br.readLine());

            int n = Integer.parseInt(st.nextToken());

            int left = Integer.parseInt(st.nextToken());

            int right = Integer.parseInt(st.nextToken());



            st = new StringTokenizer(br.readLine());

            int[] arr = new int[n];

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

            {

                arr[i] = Integer.parseInt(st.nextToken());

            }



            int[] brr = arr.clone();

            int min = 0; 

            int k = right - left + 1;

            Arrays.sort(brr);

            for(int i = 0; i < k; i++)

            {

                min += brr[i];

            }

            System.out.println(min);    

        }

    }   

}
Problem: 2060D - Subtract Min Sort
Language: C++23 (GCC 14-64, msys2)


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

using namespace std;



#define fastio() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

typedef long long ll;

#define endl '\n'

#define pb push_back

#define pii pair<ll, ll>

#define vi vector<ll>

#define vii vector<pii>

#define all(x) (x).begin(), (x).end()



int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }

int lcm(int a, int b) { return (a / gcd(a, b)) * b; }

bool isPrime(int n) { if (n <= 1) return false; for (int i = 2; i * i <= n; ++i) if (n % i == 0) return false; return true; }



const int MOD = 1e9 + 7;

const int INF = 1e18;

const int MAXN = 1e5 + 5;



void solve() {

ll n;

cin >> n;

vi arr(n, 0);

for (ll ch = 0; ch < n; ch++) {

cin >> arr[ch];

}



arr.back()<arr[n-2]?cout<<"NO"<<endl:cout<<"YES"<<endl;

}



int32_t main() {

fastio();

int t;

cin >> t;

while (t--) {

solve();

}

return 0;

}
Problem: 2060D - Subtract Min Sort
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>

using namespace std;



#define fastio() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

typedef long long ll;

#define endl '\n'

#define pb push_back

#define pii pair<ll, ll>

#define vi vector<ll>

#define vii vector<pii>

#define all(x) (x).begin(), (x).end()



int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }

int lcm(int a, int b) { return (a / gcd(a, b)) * b; }

bool isPrime(int n) { if (n <= 1) return false; for (int i = 2; i * i <= n; ++i) if (n % i == 0) return false; return true; }



const int MOD = 1e9 + 7;

const int INF = 1e18;

const int MAXN = 1e5 + 5;



void solve() {

ll n;

cin >> n;

vi arr(n, 0);

for (ll ch = 0; ch < n; ch++) {

cin >> arr[ch];

}



arr.back()<arr[n-2]?cout<<"NO"<<endl:cout<<"YES"<<endl;

}



int32_t main() {

fastio();

int t;

cin >> t;

while (t--) {

solve();

}

return 0;

}

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

using namespace std;



#define fastio() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

typedef long long ll;

#define endl '\n'

#define pb push_back

#define pii pair<ll, ll>

#define vi vector<ll>

#define vii vector<pii>

#define all(x) (x).begin(), (x).end()



int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }

int lcm(int a, int b) { return (a / gcd(a, b)) * b; }

bool isPrime(int n) { if (n <= 1) return false; for (int i = 2; i * i <= n; ++i) if (n % i == 0) return false; return true; }



const int MOD = 1e9 + 7;

const int INF = 1e18;

const int MAXN = 1e5 + 5;



void solve() {

ll n;

cin >> n;

vi arr(n, 0);

for (ll ch = 0; ch < n; ch++) {

cin >> arr[ch];

}



arr.back()<arr[n-2] || arr.front() >arr[1]?cout<<"NO"<<endl:cout<<"YES"<<endl;

}



int32_t main() {

fastio();

int t;

cin >> t;

while (t--) {

solve();

}

return 0;

}
Problem: 2060D - Subtract Min Sort
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>

using namespace std;



#define fastio() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

typedef long long ll;

#define endl '\n'

#define pb push_back

#define pii pair<ll, ll>

#define vi vector<ll>

#define vii vector<pii>

#define all(x) (x).begin(), (x).end()



int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }

int lcm(int a, int b) { return (a / gcd(a, b)) * b; }

bool isPrime(int n) { if (n <= 1) return false; for (int i = 2; i * i <= n; ++i) if (n % i == 0) return false; return true; }



const int MOD = 1e9 + 7;

const int INF = 1e18;

const int MAXN = 1e5 + 5;



void solve() {

ll n;

cin >> n;

vi arr(n, 0);

for (ll ch = 0; ch < n; ch++) {

cin >> arr[ch];

}



bool flag = true;



ll i = 0;



while(i<n){

while(arr[i]==arr[i+1] && i+1<n){

i++;

}

if(arr[i]>arr[i+1]){

flag=false;

}

break;

}



flag?cout<<"YES"<<endl:cout<<"NO"<<endl;



}



int32_t main() {

fastio();

int t;

cin >> t;

while (t--) {

solve();

}

return 0;

}

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

using namespace std;

using ll = long long;

using vll = vector <ll>;

using ii = pair <ll, ll>;

using vii = vector <ii>;



void tc () {

ll n;

cin >> n;

vll ve(n);

for (ll &i : ve) cin >> i;

ll j = 0;

for (ll i = 1; i < n; i++) {

if (ve[i-1] > ve[i]) j = i;

}

if (j == 0) { // all done

cout << "YES\n";

return;

}

auto fop = [&](ll i) {

ll minN = min(ve[i], ve[i+1]);

ve[i] -= minN;

ve[i+1] -= minN;

};

for (ll i = 0; i < j; i++) {

fop(i);

}

cout << (is_sorted(ve.begin(), ve.end()) ? "YES" : "NO") << '\n';

}



int main () {

cin.tie(nullptr) -> sync_with_stdio(false);

ll T; cin >> T; while (T--) { tc(); }

return 0;

}
Problem: 2060D - Subtract Min Sort
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>

using namespace std;



#define fastio() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

typedef long long ll;

#define endl '\n'

#define pb push_back

#define pii pair<ll, ll>

#define vi vector<ll>

#define vii vector<pii>

#define all(x) (x).begin(), (x).end()



int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }

int lcm(int a, int b) { return (a / gcd(a, b)) * b; }

bool isPrime(int n) { if (n <= 1) return false; for (int i = 2; i * i <= n; ++i) if (n % i == 0) return false; return true; }



const int MOD = 1e9 + 7;

const int INF = 1e18;

const int MAXN = 1e5 + 5;



void solve() {

ll n;

cin >> n;

vi arr(n, 0);

for (ll ch = 0; ch < n; ch++) {

cin >> arr[ch];

}



arr.back()<arr[n-2] || arr.front() >arr[1]?cout<<"NO"<<endl:cout<<"YES"<<endl;

}



int32_t main() {

fastio();

int t;

cin >> t;

while (t--) {

solve();

}

return 0;

}

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

using namespace std;



#define fastio() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

typedef long long ll;

#define endl '\n'

#define pb push_back

#define pii pair<ll, ll>

#define vi vector<ll>

#define vii vector<pii>

#define all(x) (x).begin(), (x).end()



int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }

int lcm(int a, int b) { return (a / gcd(a, b)) * b; }

bool isPrime(int n) { if (n <= 1) return false; for (int i = 2; i * i <= n; ++i) if (n % i == 0) return false; return true; }



const int MOD = 1e9 + 7;

const int INF = 1e18;

const int MAXN = 1e5 + 5;



void solve() {

ll n;

cin >> n;

vi arr(n, 0);

for (ll ch = 0; ch < n; ch++) {

cin >> arr[ch];

}



bool flag = true;



ll i = 0;



while(i<n){

while(arr[i]==arr[i+1] && i+1<n){

i++;

}

if(arr[i]>arr[i+1]){

flag=false;

}

break;

}



flag?cout<<"YES"<<endl:cout<<"NO"<<endl;



}



int32_t main() {

fastio();

int t;

cin >> t;

while (t--) {

solve();

}

return 0;

}
Problem: 2063B - Subsequence Update
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
/* Authour : Shivanshu Garg */ 
#include <bits/stdc++.h>
using namespace std;
 
#define fastio() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
typedef long long ll;
#define endl '\n'
#define pb push_back
#define pii pair<ll, ll>
#define vi vector<ll>
#define vii vector<pii>
#define all(x) (x).begin(), (x).end()
 
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int lcm(int a, int b) { return (a / gcd(a, b)) * b; }
bool isPrime(int n) { if (n <= 1) return false; for (int i = 2; i * i <= n; ++i) if (n % i == 0) return false; return true; }
 
const int MOD = 1e9 + 7;
const int INF = 1e18;
const int MAXN = 1e5 + 5;

void solve() {
    ll n, l, r;
    cin>>n>>l>>r;
    
    vi arr(n);
    for(ll i =0; i<n; i++) cin>>arr[i];
    
    ll sum = 0;
    priority_queue<ll> pq1;
    
    priority_queue<ll , vector<ll> , greater<ll>> pq2;
    
    for(ll i = l; i<=r; i++){
        pq1.push(arr[i]); 
        sum+=arr[i];
    }
    for(ll i = 0; i<l; i++){
        pq2.push(arr[i]); 
    }
    
    for(ll i=r+1; i<n; i++){
        pq2.push(arr[i]);
    }
    
    while(!pq1.empty() && !pq2.empty()){
        if(pq2.top()>=pq1.top()){
            break; 
        }
        
        sum-=pq1.top();
        pq1.pop(); 
        sum+=pq2.top();
        pq2.pop();
    }
    
    cout<<sum<<endl; 
}
 
int32_t main() {
    fastio();
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}

Submission (verdict: Wrong answer on test 2):
/* Authour : Shivanshu Garg */ 
#include <bits/stdc++.h>
using namespace std;
 
#define fastio() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
typedef long long ll;
#define endl '\n'
#define pb push_back
#define pii pair<ll, ll>
#define vi vector<ll>
#define vii vector<pii>
#define all(x) (x).begin(), (x).end()
 
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int lcm(int a, int b) { return (a / gcd(a, b)) * b; }
bool isPrime(int n) { if (n <= 1) return false; for (int i = 2; i * i <= n; ++i) if (n % i == 0) return false; return true; }
 
const int MOD = 1e9 + 7;
const int INF = 1e18;
const int MAXN = 1e5 + 5;

void solve() {
    ll n, l, r;
    cin>>n>>l>>r;
    
    vi arr(n);
    
    for(ll i =0; i<n; i++) cin>>arr[i];
    l--,r--;
    
    ll sum = 0;
    priority_queue<ll> pq1;
    
    priority_queue<ll , vector<ll> , greater<ll>> pq2;
    
    for(ll i = l; i<=r; i++){
        pq1.push(arr[i]); 
        sum+=arr[i];
    }
    for(ll i = 0; i<l; i++){
        pq2.push(arr[i]); 
    }
    
    for(ll i=r+1; i<n; i++){
        pq2.push(arr[i]);
    }
    
    while(!pq1.empty() && !pq2.empty()){
        if(pq2.top()>=pq1.top()){
            break; 
        }
        
        sum-=pq1.top();
        pq1.pop(); 
        sum+=pq2.top();
        pq2.pop();
    }
    
    cout<<sum<<endl; 
}
 
int32_t main() {
    fastio();
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}
Problem: 2063B - Subsequence Update
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
/* Authour : Shivanshu Garg */ 
#include <bits/stdc++.h>
using namespace std;
 
#define fastio() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
typedef long long ll;
#define endl '\n'
#define pb push_back
#define pii pair<ll, ll>
#define vi vector<ll>
#define vii vector<pii>
#define all(x) (x).begin(), (x).end()
 
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int lcm(int a, int b) { return (a / gcd(a, b)) * b; }
bool isPrime(int n) { if (n <= 1) return false; for (int i = 2; i * i <= n; ++i) if (n % i == 0) return false; return true; }
 
const int MOD = 1e9 + 7;
const int INF = 1e18;
const int MAXN = 1e5 + 5;

void solve() {
    ll n, l, r;
    cin>>n>>l>>r;
    
    vi arr(n);
    
    for(ll i =0; i<n; i++) cin>>arr[i];
    l--,r--;
    
    ll sum = 0;
    priority_queue<ll> pq1;
    
    priority_queue<ll , vector<ll> , greater<ll>> pq2;
    
    for(ll i = l; i<=r; i++){
        pq1.push(arr[i]); 
        sum+=arr[i];
    }
    for(ll i = 0; i<l; i++){
        pq2.push(arr[i]); 
    }
    
    for(ll i=r+1; i<n; i++){
        pq2.push(arr[i]);
    }
    
    while(!pq1.empty() && !pq2.empty()){
        if(pq2.top()>=pq1.top()){
            break; 
        }
        
        sum-=pq1.top();
        pq1.pop(); 
        sum+=pq2.top();
        pq2.pop();
    }
    
    cout<<sum<<endl; 
}
 
int32_t main() {
    fastio();
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}

Submission (verdict: Wrong answer on test 2):
/* Authour : Shivanshu Garg */ 

#include <bits/stdc++.h>

using namespace std;

 

#define fastio() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

typedef long long ll;

#define endl '\n'

#define pb push_back

#define pii pair<ll, ll>

#define vi vector<ll>

#define vii vector<pii>

#define all(x) (x).begin(), (x).end()

 

int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }

int lcm(int a, int b) { return (a / gcd(a, b)) * b; }

bool isPrime(int n) { if (n <= 1) return false; for (int i = 2; i * i <= n; ++i) if (n % i == 0) return false; return true; }

 

const int MOD = 1e9 + 7;

const int INF = 1e18;

const int MAXN = 1e5 + 5;



void solve() {

    ll n, l, r;

    cin>>n>>l>>r;

    

    vi arr(n);

    

    for(ll i =0; i<n; i++) cin>>arr[i];

    l--,r--;

    

    ll sum = 0;

    priority_queue<ll> pq1;

    

    priority_queue<ll , vector<ll> , greater<ll>> pq2;

    

    for(ll i = l; i<=r; i++){

        pq1.push(arr[i]); 

        sum+=arr[i];

    }

    for(ll i = 0; i<l; i++){

        pq2.push(arr[i]); 

    }

    

    for(ll i=r+1; i<n; i++){

        pq2.push(arr[i]);

    }

    

    while(!pq1.empty() && !pq2.empty()){

        if(pq2.top()>pq1.top()){

            break; 

        }

        

        sum-=pq1.top();

        pq1.pop(); 

        sum+=pq2.top();

        pq2.pop();

    }

    

    cout<<sum<<endl; 

}

 

int32_t main() {

    fastio();

    int t;

    cin >> t;

    while (t--) {

        solve();

    }

    return 0;

}
Problem: 2063B - Subsequence Update
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 2):
/* Authour : Shivanshu Garg */ 
#include <bits/stdc++.h>
using namespace std;
 
#define fastio() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
typedef long long ll;
#define endl '\n'
#define pb push_back
#define pii pair<ll, ll>
#define vi vector<ll>
#define vii vector<pii>
#define all(x) (x).begin(), (x).end()
 
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int lcm(int a, int b) { return (a / gcd(a, b)) * b; }
bool isPrime(int n) { if (n <= 1) return false; for (int i = 2; i * i <= n; ++i) if (n % i == 0) return false; return true; }
 
const int MOD = 1e9 + 7;
const int INF = 1e18;
const int MAXN = 1e5 + 5;

void solve() {
    ll n, l, r;
    cin>>n>>l>>r;
    
    vi arr(n);
    for(ll i =0; i<n; i++) cin>>arr[i];
    
    ll sum = 0;
    priority_queue<ll> pq1;
    
    priority_queue<ll , vector<ll> , greater<ll>> pq2;
    
    for(ll i = l; i<=r; i++){
        pq1.push(arr[i]); 
        sum+=arr[i];
    }
    for(ll i = 0; i<l; i++){
        pq2.push(arr[i]); 
    }
    
    for(ll i=r+1; i<n; i++){
        pq2.push(arr[i]);
    }
    
    while(!pq1.empty() && !pq2.empty()){
        if(pq2.top()>=pq1.top()){
            break; 
        }
        
        sum-=pq1.top();
        pq1.pop(); 
        sum+=pq2.top();
        pq2.pop();
    }
    
    cout<<sum<<endl; 
}
 
int32_t main() {
    fastio();
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}
Problem: 2060D - Subtract Min Sort
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
/*
   Cool_ewrey_boy
*/
 
#include <bits/stdc++.h>
 
#define F first
#define S second
#define size(v) (int) size(v)
#define all(v) begin(v), end(v)
#if !LOCAL
   #define endl '\n'
#endif
 
using namespace std;
using ll = long long;
const ll INF = 1e18l + 10;
const int mod = 1e9 + 7, inf = 2e9 + 10;

void solve() {
   int n;
   cin >> n;
   vector<int> a(n);
   for(int &i: a) cin >> i;
   for(int i = 0; i < n - 1; i++) {
      if(a[i] < a[i + 1]) {
         cout << "YES\n";
         return;
      }
      else if(a[i] == a[i + 1]) continue;
      else {
         cout << "NO\n";
         return;
      }
   }
   cout << "NO\n";
} 

int main() {
   cin.tie(0)->sync_with_stdio(0);
   if(auto s = "in.txt"; fopen(s, "r") && freopen(s, "r", stdin));
   int t = 1;
   cin >> t;
   //t = 1;
   while(t--) solve();
   return 0;
}

Submission (verdict: Wrong answer on test 2):
/*
   Cool_ewrey_boy
*/
 
#include <bits/stdc++.h>
 
#define F first
#define S second
#define size(v) (int) size(v)
#define all(v) begin(v), end(v)
#if !LOCAL
   #define endl '\n'
#endif
 
using namespace std;
using ll = long long;
const ll INF = 1e18l + 10;
const int mod = 1e9 + 7, inf = 2e9 + 10;

void solve() {
   int n;
   cin >> n;
   vector<int> a(n);
   for(int &i: a) cin >> i;
   for(int i = 0; i < n - 1; i++) {
      if(a[i] < a[i + 1]) {
         cout << "YES\n";
         return;
      }
      else if(a[i] == a[i + 1]) continue;
      else {
         cout << "NO\n";
         return;
      }
   }
   cout << "YES\n";
} 

int main() {
   cin.tie(0)->sync_with_stdio(0);
   if(auto s = "in.txt"; fopen(s, "r") && freopen(s, "r", stdin));
   int t = 1;
   cin >> t;
   //t = 1;
   while(t--) solve();
   return 0;
}
Problem: 2060D - Subtract Min Sort
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
/*
   Cool_ewrey_boy
*/
 
#include <bits/stdc++.h>
 
#define F first
#define S second
#define size(v) (int) size(v)
#define all(v) begin(v), end(v)
#if !LOCAL
   #define endl '\n'
#endif
 
using namespace std;
using ll = long long;
const ll INF = 1e18l + 10;
const int mod = 1e9 + 7, inf = 2e9 + 10;

void solve() {
   int n;
   cin >> n;
   vector<int> a(n);
   for(int &i: a) cin >> i;
   for(int i = 0; i < n - 1; i++) {
      if(a[i] < a[i + 1]) {
         cout << "YES\n";
         return;
      }
      else if(a[i] == a[i + 1]) continue;
      else {
         cout << "NO\n";
         return;
      }
   }
   cout << "YES\n";
} 

int main() {
   cin.tie(0)->sync_with_stdio(0);
   if(auto s = "in.txt"; fopen(s, "r") && freopen(s, "r", stdin));
   int t = 1;
   cin >> t;
   //t = 1;
   while(t--) solve();
   return 0;
}

Submission (verdict: Accepted):
/*

   Cool_ewrey_boy

*/

#define _GLIBCXX_FILESYSTEM

#include <bits/stdc++.h>



#define F first

#define S second

#define size(v) (int) size(v)

#define all(v) begin(v), end(v)

#if !LOCAL

   #define endl '\n'

#endif



using namespace std;

using ll = long long;

const ll INF = 1e18l + 10;

const int mod = 1e9 + 7, inf = 2e9 + 10;



void solve() {

   int n;

   cin >> n;

   vector<int> a(n);

   for(int &i: a) cin >> i;

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

      if(a[i] > a[i + 1]) {

        cout << "NO\n";

        return;

      }

      else {

        int mm = min(a[i], a[i + 1]);

        a[i] -= mm;

        a[i + 1] -= mm;

      }

   }

   cout << "YES\n";

}



int main() {

   cin.tie(0)->sync_with_stdio(0);

   if(auto s = "in.txt"; fopen(s, "r") && freopen(s, "r", stdin));

   int t = 1;

   cin >> t;

   //t = 1;

   while(t--) solve();

   return 0;

}
Problem: 2060D - Subtract Min Sort
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 2):
/*
   Cool_ewrey_boy
*/
 
#include <bits/stdc++.h>
 
#define F first
#define S second
#define size(v) (int) size(v)
#define all(v) begin(v), end(v)
#if !LOCAL
   #define endl '\n'
#endif
 
using namespace std;
using ll = long long;
const ll INF = 1e18l + 10;
const int mod = 1e9 + 7, inf = 2e9 + 10;

void solve() {
   int n;
   cin >> n;
   vector<int> a(n);
   for(int &i: a) cin >> i;
   for(int i = 0; i < n - 1; i++) {
      if(a[i] < a[i + 1]) {
         cout << "YES\n";
         return;
      }
      else if(a[i] == a[i + 1]) continue;
      else {
         cout << "NO\n";
         return;
      }
   }
} 

int main() {
   cin.tie(0)->sync_with_stdio(0);
   if(auto s = "in.txt"; fopen(s, "r") && freopen(s, "r", stdin));
   int t = 1;
   cin >> t;
   //t = 1;
   while(t--) solve();
   return 0;
}