ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2052A - Adrenaline Rush
Language: C++23 (GCC 14-64, msys2)


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

int main(){
    int n; cin >> n;
    int a[n];
    for(int i=0; i<n; i++) cin >> i[a];
    vector<vector<bool>> b(n+1, vector<bool>(n+1));
    vector<int> g, q;
    for(int i=1; i<n; i++){
        for(int j=i; j>0; j--){
            g.push_back(i+1);
            q.push_back(j);
            if(a[i] > a[j-1]) b[a[i]][a[j-1]] = 1;
        }
    }
    for(int i=0; i<n; i++) a[i] = n-i;
    for(int i = n-1; i>0; i--){
        for(int j=i; j<n && b[a[j-1]][a[j]]; j++){
            g.push_back(a[j-1]);
            q.push_back(a[j]);
            swap(a[j-1], a[j]);
        }
    }
    cout << q.size() << '\n';
    for(int i=0; i < g.size(); i++){
        cout << g[i] <<' '<< q[i] << '\n';
    }
}
Problem: 2050E - Three Strings
Language: C++17 (GCC 7-32)


Submission (verdict: Time limit exceeded on test 16):
#include <bits/stdc++.h>
#define ll long long int
#define vl vector<long long>
#define all(x) x.begin(), x.end()
#define in cin >>
#define out cout <<
#define br cout << "\n";
#define sz(x) (ll)(x).size()
#define yes() \
    out "YES";

#define no() \
    out "NO";
#define vvl vector<vl>
#define b() begin()
#define e() end()
#define fac(i, a, c) for (long long i = (a); i < (c); i++)
#define f(i, a) for (long long i = 0; i < (a); i++)
#define fa(v) for (auto &it : (v))
#define pb push_back
#define fi first
#define se second
#define spi set<pair<ll, ll>>
#define next(x) next_permutation(all(x))
#define tc \
    ll t;  \
    in t;  \
    while (t--)
using namespace std;

ll lcs(string X, string Y, string Z, ll m, ll n, ll o, vvl &dp)
{
    // ll o = m + n;
    if (m == 0 and n == 0 and o == 0)
        return 0;
    if (dp[m][n] != -1)
        return dp[m][n];

    ll ans = INT_MAX;

    // Check if current characters match with Z
    if (m - 1 >= 0 and X[m - 1] == Z[o - 1])
        ans = min(ans, lcs(X, Y, Z, m - 1, n, o - 1, dp));

    if (n - 1 >= 0 and Y[n - 1] == Z[o - 1])
        ans = min(ans, lcs(X, Y, Z, m, n - 1, o - 1, dp));

    if (m - 1 >= 0 and X[m - 1] != Z[o - 1])
        ans = min(ans, lcs(X, Y, Z, m - 1, n, o - 1, dp) + 1);

    if (n - 1 >= 0 and Y[n - 1] != Z[o - 1])
        ans = min(ans, lcs(X, Y, Z, m, n - 1, o - 1, dp) + 1);

    return dp[m][n] = ans;
}

void solve()
{
    string a, b, c;
    in a >> b >> c;
    ll la = sz(a), lb = sz(b), lc = sz(c);

    // Create a 3D DP array
    vvl dp(la + 1, vl(lb + 1, -1));

    ll ans = lcs(a, b, c, la, lb, lc, dp);
    out ans;
    br
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out1.txt", "w", stdout);
#endif
    tc { solve(); }
}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <cctype>
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define rall(x) x.rbegin(), x.rend()
using namespace std;
using ll = long long;
constexpr int mod = 1000000007;
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	for (size_t i = 0; i < v.size(); ++i) {
		os << v[i];
		if (i + 1 < v.size()) {
			os << " ";
		}
	}
	return os;
}
template<typename T>
istream& operator>>(istream& is, vector<T>& v) {
	for (auto& x : v) {
		is >> x;
	}
	return is;
}

ll fs(vector<int> &a) {
	ll s = 0;
	for (int i : a) s += i;
	return s;
}

void Oper(vector<int>& a) {
	reverse(all(a));
	for (int i = 0; i < a.size()-1; i++) {
		a[i] = a[i + 1] - a[i];
	}
	a.pop_back();
}
void Oper2(vector<int>& a) {
	for (int i = 0; i < a.size() - 1; i++) {
		a[i] = a[i + 1] - a[i];
	}
	a.pop_back();
	reverse(all(a));
}

void solve() {
	int n; cin >> n;
	vector<int> a(n); cin >> a;
	vector<int> b = a;
	ll res = fs(a);
	while (a.size() > 1) {
		Oper(a);
		res = max(res, fs(a));
	}
	a = b;
	while (a.size() > 1) {
		Oper(a);
		res = max(res, fs(a));
	}
	cout << res;

}
int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	int t = 1;
	cin >> t;
	while (t--) {
		solve(); 
		cout << endl;
	}
	return 0;
}

Submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <cctype>
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define rall(x) x.rbegin(), x.rend()
using namespace std;
using ll = long long;
constexpr int mod = 1000000007;
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	for (size_t i = 0; i < v.size(); ++i) {
		os << v[i];
		if (i + 1 < v.size()) {
			os << " ";
		}
	}
	return os;
}
template<typename T>
istream& operator>>(istream& is, vector<T>& v) {
	for (auto& x : v) {
		is >> x;
	}
	return is;
}

ll fs(vector<ll> &a) {
	ll s = 0;
	for (ll i : a) s += i;
	return s;
}

void Oper(vector<ll>& a) {
	reverse(all(a));
	for (int i = 0; i < a.size()-1; i++) {
		a[i] = a[i + 1] - a[i];
	}
	a.pop_back();
}
void Oper2(vector<ll>& a) {
	for (int i = 0; i < a.size() - 1; i++) {
		a[i] = a[i + 1] - a[i];
	}
	a.pop_back();
	reverse(all(a));
}

void solve() {
	int n; cin >> n;
	vector<ll> a(n); cin >> a;
	vector<ll> b = a;
	ll res = fs(a);
	while (a.size() > 1) {
		Oper(a);
		res = max(res, fs(a));
	}
	a = b;
	while (a.size() > 1) {
		Oper(a);
		res = max(res, fs(a));
	}
	cout << res;

}
int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	int t = 1;
	cin >> t;
	while (t--) {
		solve(); 
		cout << endl;
	}
	return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <cctype>
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define rall(x) x.rbegin(), x.rend()
using namespace std;
using ll = long long;
constexpr int mod = 1000000007;
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	for (size_t i = 0; i < v.size(); ++i) {
		os << v[i];
		if (i + 1 < v.size()) {
			os << " ";
		}
	}
	return os;
}
template<typename T>
istream& operator>>(istream& is, vector<T>& v) {
	for (auto& x : v) {
		is >> x;
	}
	return is;
}

ll fs(vector<ll> &a) {
	ll s = 0;
	for (ll i : a) s += i;
	return s;
}

void Oper(vector<ll>& a) {
	reverse(all(a));
	for (int i = 0; i < a.size()-1; i++) {
		a[i] = a[i + 1] - a[i];
	}
	a.pop_back();
}
void Oper2(vector<ll>& a) {
	for (int i = 0; i < a.size() - 1; i++) {
		a[i] = a[i + 1] - a[i];
	}
	a.pop_back();
	reverse(all(a));
}

void solve() {
	int n; cin >> n;
	vector<ll> a(n); cin >> a;
	vector<ll> b = a;
	ll res = fs(a);
	while (a.size() > 1) {
		Oper(a);
		res = max(res, fs(a));
	}
	a = b;
	while (a.size() > 1) {
		Oper(a);
		res = max(res, fs(a));
	}
	cout << res;

}
int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	int t = 1;
	cin >> t;
	while (t--) {
		solve(); 
		cout << endl;
	}
	return 0;
}

Submission (verdict: Wrong answer on test 1):
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <cctype>
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define rall(x) x.rbegin(), x.rend()
using namespace std;
using ll = long long;
constexpr int mod = 1000000007;
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	for (size_t i = 0; i < v.size(); ++i) {
		os << v[i];
		if (i + 1 < v.size()) {
			os << " ";
		}
	}
	return os;
}
template<typename T>
istream& operator>>(istream& is, vector<T>& v) {
	for (auto& x : v) {
		is >> x;
	}
	return is;
}

ll fs(vector<ll> &a) {
	ll s = 0;
	for (ll i : a) s += i;
	return s;
}


void solve() {
	int n; cin >> n;
	vector<ll> a(n); cin >> a;
	ll res = -1 * 1e18;
	while (a.size() > 1) {
		ll s = fs(a);
		res = max(res, max(s, -s));
		for (int i = 0; i < a.size() - 1; i++) {
			a[i] = a[i + 1] - a[i];
		}
		a.pop_back();
	}
	cout << res;

}
int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	int t = 1;
	cin >> t;
	while (t--) {
		solve(); 
		cout << endl;
	}
	return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <cctype>
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define rall(x) x.rbegin(), x.rend()
using namespace std;
using ll = long long;
constexpr int mod = 1000000007;
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	for (size_t i = 0; i < v.size(); ++i) {
		os << v[i];
		if (i + 1 < v.size()) {
			os << " ";
		}
	}
	return os;
}
template<typename T>
istream& operator>>(istream& is, vector<T>& v) {
	for (auto& x : v) {
		is >> x;
	}
	return is;
}

ll fs(vector<int> &a) {
	ll s = 0;
	for (int i : a)s += i;
	return s;
}

void Oper(vector<int>& a) {
	reverse(all(a));
	for (int i = 0; i < a.size()-1; i++) {
		a[i] = a[i + 1] - a[i];
	}
	a.pop_back();
}

void solve() {
	int n; cin >> n;
	vector<int> a(n); cin >> a;
	ll res = fs(a);
	while (a.size() > 1) {
		Oper(a);
		res = max(res, fs(a));
	}
	cout << res;

}
int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	int t = 1;
	cin >> t;
	while (t--) {
		solve(); 
		cout << endl;
	}
	return 0;
}

Submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <cctype>
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define rall(x) x.rbegin(), x.rend()
using namespace std;
using ll = long long;
constexpr int mod = 1000000007;
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	for (size_t i = 0; i < v.size(); ++i) {
		os << v[i];
		if (i + 1 < v.size()) {
			os << " ";
		}
	}
	return os;
}
template<typename T>
istream& operator>>(istream& is, vector<T>& v) {
	for (auto& x : v) {
		is >> x;
	}
	return is;
}

ll fs(vector<int> &a) {
	ll s = 0;
	for (int i : a) s += i;
	return s;
}

void Oper(vector<int>& a) {
	reverse(all(a));
	for (int i = 0; i < a.size()-1; i++) {
		a[i] = a[i + 1] - a[i];
	}
	a.pop_back();
}
void Oper2(vector<int>& a) {
	for (int i = 0; i < a.size() - 1; i++) {
		a[i] = a[i + 1] - a[i];
	}
	a.pop_back();
	reverse(all(a));
}

void solve() {
	int n; cin >> n;
	vector<int> a(n); cin >> a;
	vector<int> b = a;
	ll res = fs(a);
	while (a.size() > 1) {
		Oper(a);
		res = max(res, fs(a));
	}
	a = b;
	while (a.size() > 1) {
		Oper(a);
		res = max(res, fs(a));
	}
	cout << res;

}
int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	int t = 1;
	cin >> t;
	while (t--) {
		solve(); 
		cout << endl;
	}
	return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <cctype>
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define rall(x) x.rbegin(), x.rend()
using namespace std;
using ll = long long;
constexpr int mod = 1000000007;
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	for (size_t i = 0; i < v.size(); ++i) {
		os << v[i];
		if (i + 1 < v.size()) {
			os << " ";
		}
	}
	return os;
}
template<typename T>
istream& operator>>(istream& is, vector<T>& v) {
	for (auto& x : v) {
		is >> x;
	}
	return is;
}

ll fs(vector<int> &a) {
	ll s = 0;
	for (int i : a)s += i;
	return s;
}

void Oper(vector<int>& a) {
	reverse(all(a));
	for (int i = 0; i < a.size()-1; i++) {
		a[i] = a[i + 1] - a[i];
	}
	a.pop_back();
}

void solve() {
	int n; cin >> n;
	vector<int> a(n); cin >> a;
	ll res = fs(a);
	while (a.size() > 1) {
		Oper(a);
		res = max(res, fs(a));
	}
	cout << res;

}
int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	int t = 1;
	cin >> t;
	while (t--) {
		solve(); 
		cout << endl;
	}
	return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 1):
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <cctype>
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define rall(x) x.rbegin(), x.rend()
using namespace std;
using ll = long long;
constexpr int mod = 1000000007;
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	for (size_t i = 0; i < v.size(); ++i) {
		os << v[i];
		if (i + 1 < v.size()) {
			os << " ";
		}
	}
	return os;
}
template<typename T>
istream& operator>>(istream& is, vector<T>& v) {
	for (auto& x : v) {
		is >> x;
	}
	return is;
}

ll fs(vector<ll> &a) {
	ll s = 0;
	for (ll i : a) s += i;
	return s;
}


void solve() {
	int n; cin >> n;
	vector<ll> a(n); cin >> a;
	ll res = -1 * 1e18;
	while (a.size() > 1) {
		ll s = fs(a);
		res = max(res, max(s, -s));
		for (int i = 0; i < a.size() - 1; i++) {
			a[i] = a[i + 1] - a[i];
		}
		a.pop_back();
	}
	cout << res;

}
int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	int t = 1;
	cin >> t;
	while (t--) {
		solve(); 
		cout << endl;
	}
	return 0;
}

Submission (verdict: Accepted):
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <cctype>
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define rall(x) x.rbegin(), x.rend()
using namespace std;
using ll = long long;
constexpr int mod = 1000000007;
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	for (size_t i = 0; i < v.size(); ++i) {
		os << v[i];
		if (i + 1 < v.size()) {
			os << " ";
		}
	}
	return os;
}
template<typename T>
istream& operator>>(istream& is, vector<T>& v) {
	for (auto& x : v) {
		is >> x;
	}
	return is;
}

ll fs(vector<ll> &a) {
	ll s = 0;
	for (ll i : a) s += i;
	return s;
}


void solve() {
	int n; cin >> n;
	vector<ll> a(n); cin >> a;
	ll res = fs(a);
	while (a.size() > 1) {
		for (int i = 0; i < a.size() - 1; i++) {
			a[i] = a[i + 1] - a[i];
		}
		a.pop_back();
		ll s = fs(a);
		res = max(res, max(s, -s));
	}
	cout << res;

}
int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	int t = 1;
	cin >> t;
	while (t--) {
		solve(); 
		cout << endl;
	}
	return 0;
}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 8):
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>

#define arrout(a,n) rep(i,1,n)std::cout<<a[i]
#define arrin(a,n) rep(i,1,n)std::cin>>a[i]
#define rep(i,x,n) for(int i=x;i<=n;i++)
#define dep(i,x,n) for(int i=x;i>=n;i--)
#define mem(a,x) memset(a,x,sizeof a)
#define mp(a,b) make_pair(a,b)
#define arep(it,s) for(auto it=s.begin();it!=s.end();it++)
#define st first
#define ed second
#define eout(a) cout<<a<<endl;
#define INF 2e9;
// #define int long long

using namespace std;
int l,r,mid;
int n,m,k,f,tot,ans,T,num;
int dx[9]={0,0,0,1,-1,-1,1,1,-1};
int dy[9]={0,1,-1,0,0,1,1,-1,-1};

int a[300005];
int b[300005];
int c[300005];
int v[1005][1005];
int fa[100005];

int num1,num2,num3;

void solve()
{
	num1=num2=num3=0;
	cin>>n>>l>>r;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		b[i]=a[i];
	}
	sort(a+1,a+r+1);
	sort(b+l,b+n+1);
	for(int i=1;i<=r-l+1;i++)
	{
		num1+=a[i];
	}
	for(int i=l;i;i++)
	{
		num3++;
		num2+=b[i];
		if(num3==r-l+1) break;
	}
	ans=min(num1,num2);
	eout(ans);
}

signed main() {
	cin>>T;
	while(T--)
	{
		solve();
	}
	return 0;
}

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

#include <map>

#include <cmath>

#include <queue>

#include <stack>

#include <vector>

#include <string>

#include <cstdio>

#include <cstdlib>

#include <cstring>

#include <iostream>

#include <algorithm>



#define arrout(a,n) rep(i,1,n)std::cout<<a[i]

#define arrin(a,n) rep(i,1,n)std::cin>>a[i]

#define rep(i,x,n) for(int i=x;i<=n;i++)

#define dep(i,x,n) for(int i=x;i>=n;i--)

#define mem(a,x) memset(a,x,sizeof a)

#define mp(a,b) make_pair(a,b)

#define arep(it,s) for(auto it=s.begin();it!=s.end();it++)

#define st first

#define ed second

#define eout(a) cout<<a<<endl;

#define INF 2e9;

// #define int long long



using namespace std;

int l,r,mid;

int n,m,k,f,tot,ans,T,num;

int dx[9]={0,0,0,1,-1,-1,1,1,-1};

int dy[9]={0,1,-1,0,0,1,1,-1,-1};



int a[300005];

int b[300005];

int c[300005];

int v[1005][1005];

int fa[100005];



int num1,num2,num3;



void solve()

{

	num1=num2=num3=0;

	cin>>n>>l>>r;

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

	{

		cin>>a[i];

		b[i]=a[i];

	}

	sort(a+1,a+r);

	sort(b+l,b+n+1);

	for(int i=1;i<=r-l+1;i++)

	{

		num1+=a[i];

	}

	for(int i=l;i;i++)

	{

		num3++;

		num2+=b[i];

		if(num3==r-l+1) break;

	}

	ans=min(num1,num2);

	eout(ans);

}



signed main() {

	cin>>T;

	while(T--)

	{

		solve();

	}

	return 0;

}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)

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

#include <map>

#include <cmath>

#include <queue>

#include <stack>

#include <vector>

#include <string>

#include <cstdio>

#include <cstdlib>

#include <cstring>

#include <iostream>

#include <algorithm>



#define arrout(a,n) rep(i,1,n)std::cout<<a[i]

#define arrin(a,n) rep(i,1,n)std::cin>>a[i]

#define rep(i,x,n) for(int i=x;i<=n;i++)

#define dep(i,x,n) for(int i=x;i>=n;i--)

#define mem(a,x) memset(a,x,sizeof a)

#define mp(a,b) make_pair(a,b)

#define arep(it,s) for(auto it=s.begin();it!=s.end();it++)

#define st first

#define ed second

#define eout(a) cout<<a<<endl;

#define INF 2e9;

// #define int long long



using namespace std;

int l,r,mid;

int n,m,k,f,tot,ans,T,num;

int dx[9]={0,0,0,1,-1,-1,1,1,-1};

int dy[9]={0,1,-1,0,0,1,1,-1,-1};



int a[300005];

int b[300005];

int c[300005];

int v[1005][1005];

int fa[100005];



int num1,num2,num3;



void solve()

{

	num1=num2=num3=0;

	cin>>n>>l>>r;

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

	{

		cin>>a[i];

		b[i]=a[i];

	}

	sort(a+1,a+r);

	sort(b+l,b+n+1);

	for(int i=1;i<=r-l+1;i++)

	{

		num1+=a[i];

	}

	for(int i=l;i;i++)

	{

		num3++;

		num2+=b[i];

		if(num3==r-l+1) break;

	}

	ans=min(num1,num2);

	eout(ans);

}



signed main() {

	cin>>T;

	while(T--)

	{

		solve();

	}

	return 0;

}

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

#include <map>

#include <cmath>

#include <queue>

#include <stack>

#include <vector>

#include <string>

#include <cstdio>

#include <cstdlib>

#include <cstring>

#include <iostream>

#include <algorithm>



#define arrout(a,n) rep(i,1,n)std::cout<<a[i]

#define arrin(a,n) rep(i,1,n)std::cin>>a[i]

#define rep(i,x,n) for(int i=x;i<=n;i++)

#define dep(i,x,n) for(int i=x;i>=n;i--)

#define mem(a,x) memset(a,x,sizeof a)

#define mp(a,b) make_pair(a,b)

#define arep(it,s) for(auto it=s.begin();it!=s.end();it++)

#define st first

#define ed second

#define eout(a) cout<<a<<endl;

#define INF 2e9;

#define int long long



using namespace std;

int l,r,mid;

int n,m,k,f,tot,ans,T,num;

int dx[9]={0,0,0,1,-1,-1,1,1,-1};

int dy[9]={0,1,-1,0,0,1,1,-1,-1};



int a[300005];

int b[300005];

int c[300005];

int v[1005][1005];

int fa[100005];



int num1,num2,num3;



void solve()

{

	num1=num2=num3=0;

	cin>>n>>l>>r;

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

	{

		cin>>a[i];

		b[i]=a[i];

	}

	sort(a+1,a+r+1);

	sort(b+l,b+n+1);

	for(int i=1;i<=r-l+1;i++)

	{

		num1+=a[i];

	}

	for(int i=l;i;i++)

	{

		num3++;

		num2+=b[i];

		if(num3==r-l+1) break;

	}

	ans=min(num1,num2);

	eout(ans);

}



signed main() {

	cin>>T;

	while(T--)

	{

		solve();

	}

	return 0;

}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 8):
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>

#define arrout(a,n) rep(i,1,n)std::cout<<a[i]
#define arrin(a,n) rep(i,1,n)std::cin>>a[i]
#define rep(i,x,n) for(int i=x;i<=n;i++)
#define dep(i,x,n) for(int i=x;i>=n;i--)
#define mem(a,x) memset(a,x,sizeof a)
#define mp(a,b) make_pair(a,b)
#define arep(it,s) for(auto it=s.begin();it!=s.end();it++)
#define st first
#define ed second
#define eout(a) cout<<a<<endl;
#define INF 2e9;
// #define int long long

using namespace std;
int l,r,mid;
int n,m,k,f,tot,ans,T,num;
int dx[9]={0,0,0,1,-1,-1,1,1,-1};
int dy[9]={0,1,-1,0,0,1,1,-1,-1};

int a[300005];
int b[300005];
int c[300005];
int v[1005][1005];
int fa[100005];

int num1,num2,num3;

void solve()
{
	num1=num2=num3=0;
	cin>>n>>l>>r;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		b[i]=a[i];
	}
	sort(a+1,a+r+1);
	sort(b+l,b+n+1);
	for(int i=1;i<=r-l+1;i++)
	{
		num1+=a[i];
	}
	for(int i=l;i;i++)
	{
		num3++;
		num2+=b[i];
		if(num3==r-l+1) break;
	}
	ans=min(num1,num2);
	eout(ans);
}

signed main() {
	cin>>T;
	while(T--)
	{
		solve();
	}
	return 0;
}
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;

int main(){

ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);

int t;cin>>t;

while(t--){

int n;cin>>n;

int a[100005],pre[100005];

bool flag=1;

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

cin>>a[i];

pre[i]=a[i]-pre[i-1];

}

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

if(pre[i]<0){

if((pre[i]+min(a[i],a[i+1]))<0) { cout << "No"<<endl;flag=0;break; }

else {

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

}

}

}

if(flag==1)cout<<"Yes"<<endl;

}

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;

int main(){

ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);

int t;cin>>t;

while(t--){

int n;cin>>n;

int a[100005],pre[100005];

bool flag=1;

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

cin>>a[i];

pre[i]=a[i]-pre[i-1];

}

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

if(pre[i]<0){

if((pre[i]+min(a[i],a[i+1]))<0) { cout << "No"<<endl;flag=0;break; }

else {

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

}

}

}

if(flag==1)cout<<"Yes"<<endl;

}

return 0;

}

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

using namespace std;

int main(){

ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);

int t;cin>>t;

while(t--){

int n;cin>>n;

int a[200005],pre[200005];

bool flag=1;

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

cin>>a[i];

pre[i]=a[i]-pre[i-1];

}

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

if(pre[i]<0){

if((pre[i]+min(a[i],a[i+1]))<0) { cout << "No"<<endl;flag=0;break; }

else {

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

}

}

}

if(flag==1)cout<<"Yes"<<endl;

}

return 0;

}