ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2063C - Remove Exactly Two
Language: C++23 (GCC 14-64, msys2)

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

    vector<vector<int>> E(n+10);
    vector<int> d(n);
    for (int i = 1; i < n; i++)
    {
        int u, v;
        cin >> u >> v;
        u--, v--;
        E[u].push_back(v);
        E[v].push_back(u);
        d[u]++;
        d[v]++;
    }

    int res = 0;
    multiset<int> s;
    for (int u = 0; u < n; u++)
    {
        s.insert(d[u]);
    }
    for (int u = 0; u < n; u++)
    {
        s.extract(d[u]);
        for (auto v : E[u])
            s.extract(d[v]);
        if (!s.empty())
            res = max(res, d[u] + *s.rbegin() - 1);
        for (auto v : E[u])
            s.insert(d[v]);
        s.insert(d[u]);
        for (auto v : E[u])
        {
            res = max(res, d[u] + d[v] - 2);
        }
    }

    cout << res << endl;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    ll _ = 1;
    // cin >> _;
    while (_--)
    {
        solve();
    }
    return 0;
}

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

    vector<vector<int>> E(n);
    vector<int> d(n);
    for (int i = 1; i < n; i++)
    {
        int u, v;
        cin >> u >> v;
        u--, v--;
        E[u].push_back(v);
        E[v].push_back(u);
        d[u]++;
        d[v]++;
    }

    int res = 0;
    multiset<int> s;
    for (int u = 0; u < n; u++)
    {
        s.insert(d[u]);
    }
    for (int u = 0; u < n; u++)
    {
        s.extract(d[u]);
        for (auto v : E[u])
        {
            s.extract(d[v]);
        }
        if (!s.empty())
        {
            res = max(res, d[u] + *s.rbegin() - 1);
        }
        for (auto v : E[u])
        {
            s.insert(d[v]);
        }
        s.insert(d[u]);
        for (auto v : E[u])
        {
            res = max(res, d[u] + d[v] - 2);
        }
    }

    cout << res << endl;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    ll _ = 1;
    cin >> _;
    while (_--)
    {
        solve();
    }
    return 0;
}
Problem: 2063C - Remove Exactly Two
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Runtime error on test 1):
#include <bits/stdc++.h>
using namespace std;
#define ll long long
void solve()
{
    int n;
    cin >> n;

    vector<vector<int>> E(n);
    vector<int> d(n);
    for (int i = 1; i < n; i++)
    {
        int u, v;
        cin >> u >> v;
        u--, v--;
        E[u].push_back(v);
        E[v].push_back(u);
        d[u]++;
        d[v]++;
    }

    int res = 0;
    multiset<int> s;
    for (int u = 0; u < n; u++)
    {
        s.insert(d[u]);
    }
    for (int u = 0; u < n; u++)
    {
        s.extract(d[u]);
        for (auto v : E[u])
            s.extract(d[v]);
        if (!s.empty())
            res = max(res, d[u] + *s.rbegin() - 1);
        for (auto v : E[u])
            s.insert(d[v]);
        s.insert(d[u]);
        for (auto v : E[u])
        {
            res = max(res, d[u] + d[v] - 2);
        }
    }

    cout << res << endl;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    ll _ = 1;
    // cin >> _;
    while (_--)
    {
        solve();
    }
    return 0;
}

Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
#define ll long long
void solve()
{
    int n;
    cin >> n;

    vector<vector<int>> E(n+10);
    vector<int> d(n);
    for (int i = 1; i < n; i++)
    {
        int u, v;
        cin >> u >> v;
        u--, v--;
        E[u].push_back(v);
        E[v].push_back(u);
        d[u]++;
        d[v]++;
    }

    int res = 0;
    multiset<int> s;
    for (int u = 0; u < n; u++)
    {
        s.insert(d[u]);
    }
    for (int u = 0; u < n; u++)
    {
        s.extract(d[u]);
        for (auto v : E[u])
            s.extract(d[v]);
        if (!s.empty())
            res = max(res, d[u] + *s.rbegin() - 1);
        for (auto v : E[u])
            s.insert(d[v]);
        s.insert(d[u]);
        for (auto v : E[u])
        {
            res = max(res, d[u] + d[v] - 2);
        }
    }

    cout << res << endl;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    ll _ = 1;
    // cin >> _;
    while (_--)
    {
        solve();
    }
    return 0;
}
Problem: 2052A - Adrenaline Rush
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 5):
#include<iostream>
#include<algorithm>
using namespace std;
const int N=1010;
int a[N];
int st[N];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	int cut=0;
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			if(a[i]>a[j]){
				cut++;
			}
		}
	}
	int ans=n*(n-1)-cut;
	printf("%d\n",ans);
	reverse(a+1,a+n+1);
	for(int i=1;i<=n;i++){
		int p=a[i];
		for(int j=p-1;j>0;j--){
			if(st[j]) continue;
			printf("%d %d\n",p,j);
		}
		for(int j=n;j>=i+1;j--){
			if(st[a[j]]) continue;
			printf("%d %d\n",a[j],p);
		}
		st[p]=1;
	}
	return 0;
}

Submission (verdict: Accepted):
#include<iostream>
#include<algorithm>
using namespace std;
const int N=1010;
int a[N];
int b[N];
int st[N];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		cin>>a[i];
		b[i]=i;
	}
	int cut=0;
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			if(a[i]>a[j]){
				cut++;
			}
		}
	}
	int ans=n*(n-1)-cut;
	printf("%d\n",ans);
	reverse(a+1,a+n+1);
	for(int i=1;i<=n;i++){
		int p=a[i];
		for(int j=p-1;j>0;j--){
			if(st[j]) continue;
			printf("%d %d\n",p,j);
		}
		st[p]=1;
		for(int j=1;j<=n;j++){
			if(st[j]) continue;
			printf("%d %d\n",j,p);
		}
		
	}
	return 0;
}
Problem: 2052A - Adrenaline Rush
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 1):
#include<iostream>
#include<algorithm>
using namespace std;
const int N=1010;
int a[N];
int st[N];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	int cut=0;
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			if(a[i]>a[j]){
				cut++;
			}
		}
	}
	int ans=n*(n-1)-cut;
	printf("%d\n",ans);
	reverse(a+1,a+n+1);
	for(int i=1;i<=n;i++){
		int p=a[i];
		for(int j=p-1;j>0;j--){
			if(st[j]) continue;
			printf("%d %d\n",p,j);
		}
		for(int j=i+1;j<=n;j++){
			if(st[a[j]]) continue;
			printf("%d %d\n",a[j],p);
		}
		st[p]=1;
	}
	return 0;
}

Submission (verdict: Wrong answer on test 5):
#include<iostream>
#include<algorithm>
using namespace std;
const int N=1010;
int a[N];
int st[N];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	int cut=0;
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			if(a[i]>a[j]){
				cut++;
			}
		}
	}
	int ans=n*(n-1)-cut;
	printf("%d\n",ans);
	reverse(a+1,a+n+1);
	for(int i=1;i<=n;i++){
		int p=a[i];
		for(int j=p-1;j>0;j--){
			if(st[j]) continue;
			printf("%d %d\n",p,j);
		}
		for(int j=n;j>=i+1;j--){
			if(st[a[j]]) continue;
			printf("%d %d\n",a[j],p);
		}
		st[p]=1;
	}
	return 0;
}
Problem: 2052A - Adrenaline Rush
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 1):
#include<iostream>
#include<algorithm>
using namespace std;
const int N=1010;
int a[N];
int st[N];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	int cut=0;
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			if(a[i]>a[j]){
				cut++;
			}
		}
	}
	int ans=n*(n-1)-cut;
	printf("%d\n",ans);
	reverse(a+1,a+n+1);
	for(int i=1;i<=n;i++){
		int p=a[i];
		for(int j=p-1;j>0;j--){
			if(st[j]) continue;
			printf("%d %d\n",p,j);
		}
		for(int j=i+1;j<=n;j++){
			if(st[a[j]]) continue;
			printf("%d %d\n",a[j],p);
		}
		st[p]=1;
	}
	return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)

Previous submission (verdict: Compilation error):
#include <iostream>
#include <cstring>
#define endl '\n'
using namespace std;
const int N = 100010;
bool solve()
{
	int a = 0, b = 0, sum = 0;
	char c[N];
	cin >> c;
	for (int i = 0; i < strlen(c); i ++ )
	{
//		cout << c << endl;
		int t = c[i] - '0';
		sum += t;
		if (t == 2) a ++ ;
		if (t == 3) b ++ ;
	}
	int t = sum % 9;
	if (t == 0) return true;
//	if (t != 6 && t % 2 == 0) return false;
	if (t == 8)
	{
		if (a >= 5 || (a >= 2 && b >= 1)) return true;
		else return false;
	}
	if (t == 7)
	{
		if (a >= 1) return true;
		else return false;
	}
	if (t == 6)
	{
		if (b >= 2 || a >= 6 || (b >= 1 && a >= 3)) return true;
		else return false;
	}
	if (t == 5)
	{
		if (a >= 2) return true;
		else return false;
	}
	if (t == 4)
	{
		if (a >= 7 || (b >= 1 && a >= 4) || (b >= 2 || a >= 1)) return true;
		else return false;
	}
	if (t == 3)
	{
		if (a >= 3 || b >= 1) return true;
		else return false;
	}
	if (t == 2)
	{
		if (a >= 8 || (b >= 1 && a >= 5) || (b >= 2 && a >= 2)) return true;
		else return 0;1
	}
	if (t == 1)
	{
		if (a >= 4 || (a >= 1 && b >= 1)) return true;
		else return false;
	}
}
int main()
{
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int t;
	cin >> t;
	while (t -- )
	{
		if (solve()) cout << "YES" <<endl;
		else cout << "NO" << endl;
	}
	return 0;
}

Submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <cstring>
#define endl '\n'
using namespace std;
const int N = 100010;
bool solve()
{
	int a = 0, b = 0, sum = 0;
	char c[N];
	cin >> c;
	for (int i = 0; i < strlen(c); i ++ )
	{
//		cout << c << endl;
		int t = c[i] - '0';
		sum += t;
		if (t == 2) a ++ ;
		if (t == 3) b ++ ;
	}
	int t = sum % 9;
	if (t == 0) return true;
//	if (t != 6 && t % 2 == 0) return false;
	if (t == 8)
	{
		if (a >= 5 || (a >= 2 && b >= 1)) return true;
		else return false;
	}
	if (t == 7)
	{
		if (a >= 1) return true;
		else return false;
	}
	if (t == 6)
	{
		if (b >= 2 || a >= 6 || (b >= 1 && a >= 3)) return true;
		else return false;
	}
	if (t == 5)
	{
		if (a >= 2) return true;
		else return false;
	}
	if (t == 4)
	{
		if (a >= 7 || (b >= 1 && a >= 4) || (b >= 2 || a >= 1)) return true;
		else return false;
	}
	if (t == 3)
	{
		if (a >= 3 || b >= 1) return true;
		else return false;
	}
	if (t == 2)
	{
		if (a >= 8 || (b >= 1 && a >= 5) || (b >= 2 && a >= 2)) return true;
		else return 0;
	}
	if (t == 1)
	{
		if (a >= 4 || (a >= 1 && b >= 1)) return true;
		else return false;
	}
}
int main()
{
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int t;
	cin >> t;
	while (t -- )
	{
		if (solve()) cout << "YES" <<endl;
		else cout << "NO" << endl;
	}
	return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <cstring>
#define endl '\n'
using namespace std;
const int N = 100010;
bool solve()
{
	int a = 0, b = 0, sum = 0;
	char c[N];
	cin >> c;
	for (int i = 0; i < strlen(c); i ++ )
	{
//		cout << c << endl;
		int t = c[i] - '0';
		sum += t;
		if (t == 2) a ++ ;
		if (t == 3) b ++ ;
	}
	int t = sum % 9;
	if (t == 0) return true;
//	if (t != 6 && t % 2 == 0) return false;
	if (t == 8)
	{
		if (a >= 5 || (a >= 2 && b >= 1)) return true;
		else return false;
	}
	if (t == 7 || t == 2)
	{
		if (a >= 1) return true;
		else return false;
	}
	if (t == 6)
	{
		if (b >= 2 || a >= 6 || (b >= 1 && a >= 3)) return true;
		else return false;
	}
	if (t == 5)
	{
		if (a >= 2) return true;
		else return false;
	}
	if (t == 4)
	{
		if (a >= 7 || (b >= 1 && a >= 4) || (b >= 2 || a >= 1)) return true;
		else return false;
	}
	if (t == 3)
	{
		if (a >= 3 || b >= 1) return true;
		else return false;
	}
	if (t == 1)
	{
		if (a >= 4 || (a >= 1 && b >= 1)) return true;
		else return false;
	}
}
int main()
{
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int t;
	cin >> t;
	while (t -- )
	{
		if (solve()) cout << "YES" <<endl;
		else cout << "NO" << endl;
	}
	return 0;
}

Submission (verdict: Compilation error):
#include <iostream>
#include <cstring>
#define endl '\n'
using namespace std;
const int N = 100010;
bool solve()
{
	int a = 0, b = 0, sum = 0;
	char c[N];
	cin >> c;
	for (int i = 0; i < strlen(c); i ++ )
	{
//		cout << c << endl;
		int t = c[i] - '0';
		sum += t;
		if (t == 2) a ++ ;
		if (t == 3) b ++ ;
	}
	int t = sum % 9;
	if (t == 0) return true;
//	if (t != 6 && t % 2 == 0) return false;
	if (t == 8)
	{
		if (a >= 5 || (a >= 2 && b >= 1)) return true;
		else return false;
	}
	if (t == 7)
	{
		if (a >= 1) return true;
		else return false;
	}
	if (t == 6)
	{
		if (b >= 2 || a >= 6 || (b >= 1 && a >= 3)) return true;
		else return false;
	}
	if (t == 5)
	{
		if (a >= 2) return true;
		else return false;
	}
	if (t == 4)
	{
		if (a >= 7 || (b >= 1 && a >= 4) || (b >= 2 || a >= 1)) return true;
		else return false;
	}
	if (t == 3)
	{
		if (a >= 3 || b >= 1) return true;
		else return false;
	}
	if (t == 2)
	{
		if (a >= 8 || (b >= 1 && a >= 5) || (b >= 2 && a >= 2)) return true;
		else return 0;1
	}
	if (t == 1)
	{
		if (a >= 4 || (a >= 1 && b >= 1)) return true;
		else return false;
	}
}
int main()
{
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int t;
	cin >> t;
	while (t -- )
	{
		if (solve()) cout << "YES" <<endl;
		else cout << "NO" << endl;
	}
	return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)

Previous submission (verdict: Time limit exceeded on test 1):
#include <iostream>
#define endl '\n'
using namespace std;
bool solve()
{
	int a = 0, b = 0, sum = 0;
	char c;
	while ((c = getchar()) != '\n')
	{
//		cout << c << endl;
		int t = c - '0';
		sum += t;
		if (t == 2) a ++ ;
		if (t == 3) b ++ ;
	}
	int t = sum % 9;
	if (t == 0) return true;
//	if (t != 6 && t % 2 == 0) return false;
	if (t == 8)
	{
		if (a >= 5 || (a >= 2 && b >= 1)) return true;
		else return false;
	}
	if (t == 7 || t == 2)
	{
		if (a >= 1) return true;
		else return false;
	}
	if (t == 6)
	{
		if (b >= 2 || a >= 6 || (b >= 1 && a >= 3)) return true;
		else return false;
	}
	if (t == 5)
	{
		if (a >= 2) return true;
		else return false;
	}
	if (t == 4)
	{
		if (a >= 7 || (b >= 1 && a >= 4) || (b >= 2 || a >= 1)) return true;
		else return false;
	}
	if (t == 3)
	{
		if (a >= 3 || b >= 1) return true;
		else return false;
	}
	if (t == 1)
	{
		if (a >= 4 || (a >= 1 && b >= 1)) return true;
		else return false;
	}
}
int main()
{
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int t;
	cin >> t;
	while (t -- )
	{
		if (solve()) cout << "YES" <<endl;
		else cout << "NO" << endl;
	}
	return 0;
}

Submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <cstring>
#define endl '\n'
using namespace std;
const int N = 100010;
bool solve()
{
	int a = 0, b = 0, sum = 0;
	char c[N];
	cin >> c;
	for (int i = 0; i < strlen(c); i ++ )
	{
//		cout << c << endl;
		int t = c[i] - '0';
		sum += t;
		if (t == 2) a ++ ;
		if (t == 3) b ++ ;
	}
	int t = sum % 9;
	if (t == 0) return true;
//	if (t != 6 && t % 2 == 0) return false;
	if (t == 8)
	{
		if (a >= 5 || (a >= 2 && b >= 1)) return true;
		else return false;
	}
	if (t == 7 || t == 2)
	{
		if (a >= 1) return true;
		else return false;
	}
	if (t == 6)
	{
		if (b >= 2 || a >= 6 || (b >= 1 && a >= 3)) return true;
		else return false;
	}
	if (t == 5)
	{
		if (a >= 2) return true;
		else return false;
	}
	if (t == 4)
	{
		if (a >= 7 || (b >= 1 && a >= 4) || (b >= 2 || a >= 1)) return true;
		else return false;
	}
	if (t == 3)
	{
		if (a >= 3 || b >= 1) return true;
		else return false;
	}
	if (t == 1)
	{
		if (a >= 4 || (a >= 1 && b >= 1)) return true;
		else return false;
	}
}
int main()
{
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int t;
	cin >> t;
	while (t -- )
	{
		if (solve()) cout << "YES" <<endl;
		else cout << "NO" << endl;
	}
	return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <cstring>
#define endl '\n'
using namespace std;
const int N = 100010;
bool solve()
{
	int a = 0, b = 0, sum = 0;
	char c[N];
	cin >> c;
	for (int i = 0; i < strlen(c); i ++ )
	{
//		cout << c << endl;
		int t = c[i] - '0';
		sum += t;
		if (t == 2) a ++ ;
		if (t == 3) b ++ ;
	}
	int t = sum % 9;
	if (t == 0) return true;
//	if (t != 6 && t % 2 == 0) return false;
	if (t == 8)
	{
		if (a >= 5 || (a >= 2 && b >= 1)) return true;
		else return false;
	}
	if (t == 7)
	{
		if (a >= 1) return true;
		else return false;
	}
	if (t == 6)
	{
		if (b >= 2 || a >= 6 || (b >= 1 && a >= 3)) return true;
		else return false;
	}
	if (t == 5)
	{
		if (a >= 2) return true;
		else return false;
	}
	if (t == 4)
	{
		if (a >= 7 || (b >= 1 && a >= 4) || (b >= 2 || a >= 1)) return true;
		else return false;
	}
	if (t == 3)
	{
		if (a >= 3 || b >= 1) return true;
		else return false;
	}
	if (t == 2)
	{
		if (a >= 8 || (b >= 1 && a >= 5) || (b >= 2 && a >= 2)) return true;
		else return 0;
	}
	if (t == 1)
	{
		if (a >= 4 || (a >= 1 && b >= 1)) return true;
		else return false;
	}
}
int main()
{
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int t;
	cin >> t;
	while (t -- )
	{
		if (solve()) cout << "YES" <<endl;
		else cout << "NO" << endl;
	}
	return 0;
}

Submission (verdict: Accepted):
#include <iostream>
#include <cstring>
#define endl '\n'
using namespace std;
const int N = 100010;
bool solve()
{
	int a = 0, b = 0, sum = 0;
	char c[N];
	cin >> c;
	for (int i = 0; i < strlen(c); i ++ )
	{
//		cout << c << endl;
		int t = c[i] - '0';
		sum += t;
		if (t == 2) a ++ ;
		if (t == 3) b ++ ;
	}
	int t = sum % 9;
	if (t == 0) return true;
//	if (t != 6 && t % 2 == 0) return false;
	if (t == 8)
	{
		if (a >= 5 || (a >= 2 && b >= 1)) return true;
		else return false;
	}
	if (t == 7)
	{
		if (a >= 1) return true;
		else return false;
	}
	if (t == 6)
	{
		if (b >= 2 || a >= 6 || (b >= 1 && a >= 3)) return true;
		else return false;
	}
	if (t == 5)
	{
		if (a >= 2) return true;
		else return false;
	}
	if (t == 4)
	{
		if (a >= 7 || (b >= 1 && a >= 4) || (b >= 2 && a >= 1)) return true;
		else return false;
	}
	if (t == 3)
	{
		if (a >= 3 || b >= 1) return true;
		else return false;
	}
	if (t == 2)
	{
		if (a >= 8 || (b >= 1 && a >= 5) || (b >= 2 && a >= 2)) return true;
		else return 0;
	}
	if (t == 1)
	{
		if (a >= 4 || (a >= 1 && b >= 1)) return true;
		else return false;
	}
}
int main()
{
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int t;
	cin >> t;
	while (t -- )
	{
		if (solve()) cout << "YES" <<endl;
		else cout << "NO" << endl;
	}
	return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)


Submission (verdict: Time limit exceeded on test 1):
#include <iostream>
#define endl '\n'
using namespace std;
bool solve()
{
	int a = 0, b = 0, sum = 0;
	char c;
	while ((c = getchar()) != '\n')
	{
//		cout << c << endl;
		int t = c - '0';
		sum += t;
		if (t == 2) a ++ ;
		if (t == 3) b ++ ;
	}
	int t = sum % 9;
	if (t == 0) return true;
//	if (t != 6 && t % 2 == 0) return false;
	if (t == 8)
	{
		if (a >= 5 || (a >= 2 && b >= 1)) return true;
		else return false;
	}
	if (t == 7 || t == 2)
	{
		if (a >= 1) return true;
		else return false;
	}
	if (t == 6)
	{
		if (b >= 2 || a >= 6 || (b >= 1 && a >= 3)) return true;
		else return false;
	}
	if (t == 5)
	{
		if (a >= 2) return true;
		else return false;
	}
	if (t == 4)
	{
		if (a >= 7 || (b >= 1 && a >= 4) || (b >= 2 || a >= 1)) return true;
		else return false;
	}
	if (t == 3)
	{
		if (a >= 3 || b >= 1) return true;
		else return false;
	}
	if (t == 1)
	{
		if (a >= 4 || (a >= 1 && b >= 1)) return true;
		else return false;
	}
}
int main()
{
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int t;
	cin >> t;
	while (t -- )
	{
		if (solve()) cout << "YES" <<endl;
		else cout << "NO" << endl;
	}
	return 0;
}
Problem: 2052A - Adrenaline Rush
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 4):
#include <iostream>
#include <vector>
using namespace std;

int n;
int c[1100];
int main()
{

    vector<pair<int, int>> ans;
    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> c[i];
    for (int i = 1; i < n; i++)
        if (c[i] < c[i + 1])
        {
            ans.push_back({c[i], c[i + 1]});
            ans.push_back({c[i + 1], c[i]});
        }
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= n - i; j++)
        {
            if (c[j] > c[j + 1])
            {
                ans.push_back({c[j], c[j + 1]});
                swap(c[j + 1], c[j]);
            }
        }

    cout << ans.size() << endl;
    for (int i = (int)ans.size() - 1; i >= 0; i--)
        cout << ans[i].first << " " << ans[i].second << endl;

    system("pause");
    return 0;
}

Submission (verdict: Wrong answer on test 4):
#include <iostream>
#include <vector>
using namespace std;

int n;
int c[1100];
int v[1100][1100] = {0};
int main()
{

    vector<pair<int, int>> ans;
    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> c[i];
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= n - i; j++)
        {
            if (c[j] > c[j + 1])
            {
                ans.push_back({c[j], c[j + 1]});
                swap(c[j + 1], c[j]);
            }
            else if (v[c[j]][c[j + 1]] == 0)
            {
                ans.push_back({c[j], c[j + 1]});
                ans.push_back({c[j + 1], c[j]});
                v[c[j]][c[j + 1]] == 1;
            }
        }

    cout << ans.size() << endl;
    for (int i = (int)ans.size() - 1; i >= 0; i--)
        cout << ans[i].first << " " << ans[i].second << endl;

    system("pause");
    return 0;
}
Problem: 2052A - Adrenaline Rush
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 1):
#include <iostream>
#include <vector>
using namespace std;

int n;
int c[1100];
int main()
{

    vector<pair<int, int>> ans;
    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> c[i];
    for (int i = 1; i < n; i++)
        if (c[i] < c[i + 1])
        {
            ans.push_back({c[i], c[i + 1]});
            ans.push_back({c[i + 1], c[i]});
        }
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= n - i; j++)
        {
            if (c[j] > c[j + 1])
            {
                ans.push_back({c[j], c[j + 1]});
                swap(c[j], c[j + 1]);
            }
        }
    cout << ans.size() << endl;
    for (int i = 0; i < (int)ans.size(); i++)
        cout << ans[i].first << " " << ans[i].second << endl;

    system("pause");
    return 0;
}
Problem: 2052A - Adrenaline Rush
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 1):
#include <iostream>
#include <vector>
using namespace std;

int n;
int c[1100];
int main()
{

    vector<pair<int, int>> ans;
    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> c[i];
    for (int i = 1; i < n; i++)
        if (c[i] < c[i + 1])
        {
            ans.push_back({c[i + 1], c[i]});
            ans.push_back({c[i], c[i + 1]});
        }
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= n - i; j++)
        {
            if (c[j] > c[j + 1])
            {
                ans.push_back({c[j], c[j + 1]});
                swap(c[j], c[j + 1]);
            }
        }
    cout << ans.size() << endl;
    for (int i = 0; i < (int)ans.size(); i++)
        cout << ans[i].first << " " << ans[i].second << endl;

    system("pause");
    return 0;
}

Submission (verdict: Wrong answer on test 4):
#include <iostream>
#include <vector>
using namespace std;

int n;
int c[1100];
int main()
{

    vector<pair<int, int>> ans;
    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> c[i];
    for (int i = 1; i < n; i++)
        if (c[i] < c[i + 1])
        {
            ans.push_back({c[i], c[i + 1]});
            ans.push_back({c[i + 1], c[i]});
        }
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= n - i; j++)
        {
            if (c[j] > c[j + 1])
            {
                ans.push_back({c[j], c[j + 1]});
                swap(c[j + 1], c[j]);
            }
        }

    cout << ans.size() << endl;
    for (int i = (int)ans.size() - 1; i >= 0; i--)
        cout << ans[i].first << " " << ans[i].second << endl;

    system("pause");
    return 0;
}