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

Previous submission (verdict: Wrong answer on test 2):
// Problem: C. Cirno and Operations
// Contest: Codeforces - Ethflow Round 1 (Codeforces Round 1001, Div. 1 + Div. 2)
// URL: https://codeforces.com/problemset/problem/2062/C
// Memory Limit: 512 MB
// Time Limit: 2000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

#include <bits/stdc++.h>
#define ll long long
#define i64 long long
#define read(a) {char c;while((c=getchar())>47) a=a*10+(c^48);}
#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define ull unsigned long long int
#define ui unsigned int
using namespace std;
const int N = 1e5 + 5;
const int P = 1e9 + 7;
const ll inf = 4e18;


void zoumkfl()
{
	int n;cin >> n;
	vector<ll>a(n + 1);
	ll ans = -inf;
	for(int i = 1;i <= n;i++)cin >> a[i];
	if(n == 1)
	{
		cout << a[1] << '\n';
		return ;
	}
	int now = n;
	ll sum  = 0;
	for(int i = 1;i <= n;i++)sum += a[i];
	while(now > 1)
	{
		for(int i = 2;i <= now;i++)a[i - 1] = a[i - 1] - a[i];
		now--;
	}
	cout << max(abs(a[1]),sum) << '\n';
}

int main() {
    IOS;
    int _ = 1;
    cin >> _;
    while(_--)
    {
        zoumkfl();
    }
    return 0;
}

Submission (verdict: Wrong answer on test 2):
// Problem: C. Cirno and Operations
// Contest: Codeforces - Ethflow Round 1 (Codeforces Round 1001, Div. 1 + Div. 2)
// URL: https://codeforces.com/problemset/problem/2062/C
// Memory Limit: 512 MB
// Time Limit: 2000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

#include <bits/stdc++.h>
#define ll long long
#define i64 long long
#define read(a) {char c;while((c=getchar())>47) a=a*10+(c^48);}
#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define ull unsigned long long int
#define ui unsigned int
using namespace std;
const int N = 1e5 + 5;
const int P = 1e9 + 7;
const ll inf = 4e18;


void zoumkfl()
{
	int n;cin >> n;
	vector<ll>a(n + 1);
	ll ans = -inf;
	for(int i = 1;i <= n;i++)cin >> a[i];
	if(n == 1)
	{
		cout << a[1] << '\n';
		return ;
	}
	int now = n;
	ll sum  = 0;
	
	while(now >= 1)
	{
		sum = 0;
		for(int i = 1;i <= now;i++)sum += a[i];
		ans = max(abs(sum),ans);
		for(int i = 2;i <= now;i++)a[i - 1] = a[i - 1] - a[i];
		now--;
		
	}
	cout << ans << '\n';
}

int main() {
    IOS;
    int _ = 1;
    cin >> _;
    while(_--)
    {
        zoumkfl();
    }
    return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
// Problem: C. Cirno and Operations
// Contest: Codeforces - Ethflow Round 1 (Codeforces Round 1001, Div. 1 + Div. 2)
// URL: https://codeforces.com/problemset/problem/2062/C
// Memory Limit: 512 MB
// Time Limit: 2000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

#include <bits/stdc++.h>
#define ll long long
#define i64 long long
#define read(a) {char c;while((c=getchar())>47) a=a*10+(c^48);}
#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define ull unsigned long long int
#define ui unsigned int
using namespace std;
const int N = 1e5 + 5;
const int P = 1e9 + 7;
const ll inf = 4e18;


void zoumkfl()
{
	int n;cin >> n;
	vector<ll>a(n + 1);
	ll ans = -inf;
	for(int i = 1;i <= n;i++)cin >> a[i];
	if(n == 1)
	{
		cout << a[1] << '\n';
		return ;
	}
	int now = n;
	ll sum  = 0;
	
	while(now >= 1)
	{
		sum = 0;
		for(int i = 1;i <= now;i++)sum += a[i];
		ans = max(abs(sum),ans);
		for(int i = 2;i <= now;i++)a[i - 1] = a[i - 1] - a[i];
		now--;
		
	}
	cout << ans << '\n';
}

int main() {
    IOS;
    int _ = 1;
    cin >> _;
    while(_--)
    {
        zoumkfl();
    }
    return 0;
}

Submission (verdict: Accepted):
// Problem: C. Cirno and Operations
// Contest: Codeforces - Ethflow Round 1 (Codeforces Round 1001, Div. 1 + Div. 2)
// URL: https://codeforces.com/problemset/problem/2062/C
// Memory Limit: 512 MB
// Time Limit: 2000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

#include <bits/stdc++.h>
#define ll long long
#define i64 long long
#define read(a) {char c;while((c=getchar())>47) a=a*10+(c^48);}
#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define ull unsigned long long int
#define ui unsigned int
using namespace std;
const int N = 1e5 + 5;
const int P = 1e9 + 7;
const ll inf = 4e18;


void zoumkfl()
{
	int n;cin >> n;
	vector<ll>a(n + 1);
	ll ans = -inf;
	for(int i = 1;i <= n;i++)cin >> a[i];
	if(n == 1)
	{
		cout << a[1] << '\n';
		return ;
	}
	int now = n;
	ll sum  = 0;
	while(now >= 1)
	{
		sum = 0;
		if(now != n)
		{
			for(int i = 1;i <= now;i++)sum += a[i];
			ans = max(abs(sum),ans);
		}
		else
		{
			for(int i = 1;i <= n;i++)sum += a[i];
			ans = max(sum,ans);
		}
		for(int i = 2;i <= now;i++)a[i - 1] = a[i - 1] - a[i];
		now--;
		
	}
	cout << ans << '\n';
}

int main() {
    IOS;
    int _ = 1;
    cin >> _;
    while(_--)
    {
        zoumkfl();
    }
    return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 2):
// Problem: C. Cirno and Operations
// Contest: Codeforces - Ethflow Round 1 (Codeforces Round 1001, Div. 1 + Div. 2)
// URL: https://codeforces.com/problemset/problem/2062/C
// Memory Limit: 512 MB
// Time Limit: 2000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

#include <bits/stdc++.h>
#define ll long long
#define i64 long long
#define read(a) {char c;while((c=getchar())>47) a=a*10+(c^48);}
#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define ull unsigned long long int
#define ui unsigned int
using namespace std;
const int N = 1e5 + 5;
const int P = 1e9 + 7;
const ll inf = 4e18;


void zoumkfl()
{
	int n;cin >> n;
	vector<ll>a(n + 1);
	ll ans = -inf;
	for(int i = 1;i <= n;i++)cin >> a[i];
	if(n == 1)
	{
		cout << a[1] << '\n';
		return ;
	}
	int now = n;
	ll sum  = 0;
	for(int i = 1;i <= n;i++)sum += a[i];
	while(now > 1)
	{
		for(int i = 2;i <= now;i++)a[i - 1] = a[i - 1] - a[i];
		now--;
	}
	cout << max(abs(a[1]),sum) << '\n';
}

int main() {
    IOS;
    int _ = 1;
    cin >> _;
    while(_--)
    {
        zoumkfl();
    }
    return 0;
}
Problem: 2063C - Remove Exactly Two
Language: C++20 (GCC 13-64)


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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<pair<ll,ll>, null_type,less<pair<ll,ll>>, rb_tree_tag,tree_order_statistics_node_update>



#define ll long long

#define scn(v) for(auto &i:v)cin>>i
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define vl vector<ll>
#define vi vector<int>
#define vvi vector<vi>
#define vvl vector<vl>
#define vb vector<bool>
#define vvb vector<vb>
#define en cout<<'\n'
#define vb vector<bool>
#define vpl vector<pair<ll,ll>>
#define vi vector<int>
#define X first
#define Y second

const int MOD = 998244353;
ll mul(ll a, ll b) {
    return (((a % MOD + MOD) * (b % MOD + MOD)) % MOD);
}
ll fastPow(ll x, ll n, ll m) {
    if (n == 0) {
        return 1;
    }
    ll po = fastPow(x, n / 2, m);
    po =mul(po,po) % m;
    if (n & 1) {
        po =mul(po,x) %m;
    }
    return po % m;
}

ll modInv(ll x, ll m) {
    return fastPow(x, m - 2, m) % m;
}

ll setBit(ll num, ll idx, ll val = 1) {
    return (val) ? (num | (1 << idx)) : (num & ~(1 << idx));
}
int getBit(ll num, int idx) { return ((num >> idx) & 1) == 1; }

void burnx(){
     ll n;
     cin>>n;
     vvl adj(n+1);
     vl deg(n+1);
     for(int i=1;i<n;i++){
         ll u,v;
         cin>>u>>v;
         adj[u].push_back(v);
         adj[v].push_back(u);
         deg[u]++;
         deg[v]++;
     }
//     if(n<=2){
//         cout<<"0";
//         return;
//     }
     ll ans=0;
     ll cnt=1;

     for(int z=0;z<2;z++){
         ll mx=-1;
         ll mxi=-1;
         for(int i=1;i<=n;i++){
             if(deg[i]>mx){
                 mxi=i;
                 mx=deg[i];
             }
         }
         cnt+=deg[mxi]-1;
         deg[mxi]=-1;
         for(auto v:adj[mxi]){
             deg[v]--;
         }
     }

     cout<<cnt;
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL); cin.tie(NULL);
//  freopen ("input.txt","r",stdin);
//   freopen ("output.txt","w",stdout);
    //preFact();
    int t = 1;
    cin >> t;

    for(int txt=1;txt<=t;txt++){
        burnx();
        en;
    }

    return 0;
}
Problem: 2050B - Transfusion
Language: C++17 (GCC 7-32)

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

using namespace std;



void solve() {

    int n;

    cin >> n;

    

    vector<long long> a(n);

    long long sum = 0;

    

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

        cin >> a[i];

        sum += a[i];

    }



   

    if (sum % n != 0) {

        cout << "NO\n";

        return;

    }



    long long target = sum / n; 

    long long extra = 0; 



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

        extra += (a[i] - target);

        if (extra < 0) { 

            cout << "NO\n";

            return;

        }

    }



    cout << "YES\n";

}



int main() {

    ios::sync_with_stdio(false);

    cin.tie(nullptr);



    int t;

    cin >> t;

    while (t--) {

        solve();

    }

}



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

using namespace std;



void solve() {

    int n;cin >> n;

    int sum=0;

    vector<int> v(n);

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

        cin>>v[i];

        sum+=v[i];

    }

  if(sum%n==0 && v[0]!=v[n-1]){

      cout<<"YES\n";

  }

  else{

      cout<<"NO\n" ;

  }



}

int main() {

    int t;

    cin >> t;

    while (t--) {

        solve();

    }

}
Problem: 2050B - Transfusion
Language: C++17 (GCC 7-32)


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

using namespace std;



void solve() {

    int n;cin >> n;

    vector<int> v(n);

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

        cin>>v[i];

    }

    bool lol=true ;

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

        {

         if(v[i]==v[i+1])

             {

              lol=false;

              break;



             }

         else if (v[0]==v[n-1]){

             lol=false;

             break;

         }

         else{

             continue;

         }

        }

    if(lol)

        {

        cout<<"YES\n";

        }

    else{

        cout<<"NO\n";

    }



}

int main() {

    int t;

    cin >> t;

    while (t--) {

        solve();

    }

}
Problem: 2050B - Transfusion
Language: C++17 (GCC 7-32)

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

using namespace std;



void solve() {

    int n;cin >> n;

    vector<int> v(n);

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

        cin>>v[i];

    }

    bool lol=true ;

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

        {

         if(v[i]==v[i+1])

             {

              lol=false;

              break;



             }

         else if (v[0]==v[n-1]){

             lol=false;

             break;

         }

         else{

             continue;

         }

        }

    if(lol)

        {

        cout<<"YES\n";

        }

    else{

        cout<<"NO\n";

    }



}

int main() {

    int t;

    cin >> t;

    while (t--) {

        solve();

    }

}



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

using namespace std;



void solve() {

    int n;

    cin >> n;

    

    vector<long long> a(n);

    long long sum = 0;

    

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

        cin >> a[i];

        sum += a[i];

    }



   

    if (sum % n != 0) {

        cout << "NO\n";

        return;

    }



    long long target = sum / n; 

    long long extra = 0; 



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

        extra += (a[i] - target);

        if (extra < 0) { 

            cout << "NO\n";

            return;

        }

    }



    cout << "YES\n";

}



int main() {

    ios::sync_with_stdio(false);

    cin.tie(nullptr);



    int t;

    cin >> t;

    while (t--) {

        solve();

    }

}
Problem: 2050B - Transfusion
Language: C++17 (GCC 7-32)

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

using namespace std;



void solve() {

    int n;cin >> n;

    int sum=0;

    vector<int> v(n);

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

        cin>>v[i];

        sum+=v[i];

    }

  if(sum%n==0 && v[0]!=v[n-1]){

      cout<<"YES\n";

  }

  else{

      cout<<"NO\n" ;

  }



}

int main() {

    int t;

    cin >> t;

    while (t--) {

        solve();

    }

}





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

using namespace std;



void solve() {

    int n;cin >> n;

    vector<int> v1, v2; 

    long long sum1 = 0, sum2 = 0;

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

        int x;

        cin >> x;

        if (i % 2 == 0) { 

            v1.push_back(x);

            sum1 += x;

        } else { 

            v2.push_back(x);

            sum2 += x;

        }

    }

    if((sum1*v2.size())==(sum2*v1.size())&&(sum1+sum2)%(n)==0){

        cout<<"YES\n";

    }

    else{

        cout<<"NO\n";

    }

}

int main() {

    int t;

    cin >> t;

    while (t--) {

        solve();

    }

}
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);

#define ll long long

#define yes cout << "YES\n" 

#define no cout << "NO\n"

#define ull unsigned long long

#define pb push_back

#define mp make_pair

#define fi first

#define se second

#define sz(x) (int)(x).size()

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

#define rep(i, a, b) for (int i = a; i < b; i++)

#define repr(i, a, b) for (int i = a; i >= b; i--)

#define vi vector<int>

#define vvi vector<vector<int>>

void print_v(auto &v,int n){

    rep(i, 0, n) cout<<v[i]<<" ";

}

// ========================= KING OF COMPETITIVE PROGRAMMING ============================

// Ruler of runtime, master of efficiency. Write your solution and dominate the contest!

// ======================================================================================



void solve(){

    int n;

    cin >> n;

    vi a(n);

    rep(i,0,n){

        cin >> a[i];

    }

    a[1]<= a[0] ? no : yes;

}



    int main()

    {

        fastio;

        int t;

        cin >> t;

        while (t--)

        {

            solve();

        }



        return 0;

}

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

using namespace std;



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

#define ll long long

#define yes cout << "YES\n" 

#define no cout << "NO\n"

#define ull unsigned long long

#define pb push_back

#define mp make_pair

#define fi first

#define se second

#define sz(x) (int)(x).size()

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

#define rep(i, a, b) for (int i = a; i < b; i++)

#define repr(i, a, b) for (int i = a; i >= b; i--)

#define vi vector<int>

#define vvi vector<vector<int>>

void print_v(auto &v,int n){

    rep(i, 0, n) cout<<v[i]<<" ";

}

// ========================= KING OF COMPETITIVE PROGRAMMING ============================

// Ruler of runtime, master of efficiency. Write your solution and dominate the contest!

// ======================================================================================



int solve(){

    int n;

    cin >> n;

    vi a(n);

    rep(i,0,n){

        cin >> a[i];

    }

    rep(i, 0, n-1)

    {

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

            no;

            return 0;

        }

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

    }

    yes;

    return 0;

}



    int 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);

#define ll long long

#define yes cout << "YES\n" 

#define no cout << "NO\n"

#define ull unsigned long long

#define pb push_back

#define mp make_pair

#define fi first

#define se second

#define sz(x) (int)(x).size()

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

#define rep(i, a, b) for (int i = a; i < b; i++)

#define repr(i, a, b) for (int i = a; i >= b; i--)

#define vi vector<int>

#define vvi vector<vector<int>>

void print_v(auto &v,int n){

    rep(i, 0, n) cout<<v[i]<<" ";

}

// ========================= KING OF COMPETITIVE PROGRAMMING ============================

// Ruler of runtime, master of efficiency. Write your solution and dominate the contest!

// ======================================================================================



void solve(){

    int n;

    cin >> n;

    vi a(n);

    int mx = 0;

    rep(i,0,n){

        cin >> a[i];

        mx = max(mx, a[i]);

    }

    mx == a[0] ? no : yes;

}



    int 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);

#define ll long long

#define yes cout << "YES\n" 

#define no cout << "NO\n"

#define ull unsigned long long

#define pb push_back

#define mp make_pair

#define fi first

#define se second

#define sz(x) (int)(x).size()

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

#define rep(i, a, b) for (int i = a; i < b; i++)

#define repr(i, a, b) for (int i = a; i >= b; i--)

#define vi vector<int>

#define vvi vector<vector<int>>

void print_v(auto &v,int n){

    rep(i, 0, n) cout<<v[i]<<" ";

}

// ========================= KING OF COMPETITIVE PROGRAMMING ============================

// Ruler of runtime, master of efficiency. Write your solution and dominate the contest!

// ======================================================================================



void solve(){

    int n;

    cin >> n;

    vi a(n);

    rep(i,0,n){

        cin >> a[i];

    }

    a[1]<= a[0] ? no : yes;

}



    int main()

    {

        fastio;

        int t;

        cin >> t;

        while (t--)

        {

            solve();

        }



        return 0;

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


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

using namespace std;



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

#define ll long long

#define yes cout << "YES\n" 

#define no cout << "NO\n"

#define ull unsigned long long

#define pb push_back

#define mp make_pair

#define fi first

#define se second

#define sz(x) (int)(x).size()

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

#define rep(i, a, b) for (int i = a; i < b; i++)

#define repr(i, a, b) for (int i = a; i >= b; i--)

#define vi vector<int>

#define vvi vector<vector<int>>

void print_v(auto &v,int n){

    rep(i, 0, n) cout<<v[i]<<" ";

}

// ========================= KING OF COMPETITIVE PROGRAMMING ============================

// Ruler of runtime, master of efficiency. Write your solution and dominate the contest!

// ======================================================================================



int solve(){

    int n;

    cin >> n;

    vi a(n);

    int mx = 0;

    rep(i,0,n){

        cin >> a[i];

        mx = max(mx, a[i]);

    }

    mx == a[0] ? no : yes;

}



    int 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: Runtime error on test 1):
#include <bits/stdc++.h>

using namespace std;



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

#define ll long long

#define yes cout << "YES\n" 

#define no cout << "NO\n"

#define ull unsigned long long

#define pb push_back

#define mp make_pair

#define fi first

#define se second

#define sz(x) (int)(x).size()

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

#define rep(i, a, b) for (int i = a; i < b; i++)

#define repr(i, a, b) for (int i = a; i >= b; i--)

#define vi vector<int>

#define vvi vector<vector<int>>

void print_v(auto &v,int n){

    rep(i, 0, n) cout<<v[i]<<" ";

}

// ========================= KING OF COMPETITIVE PROGRAMMING ============================

// Ruler of runtime, master of efficiency. Write your solution and dominate the contest!

// ======================================================================================



int solve(){

    int n;

    cin >> n;

    vi a(n);

    int mx = 0;

    rep(i,0,n){

        cin >> a[i];

        mx = max(mx, a[i]);

    }

    mx == a[0] ? no : yes;

}



    int 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);

#define ll long long

#define yes cout << "YES\n" 

#define no cout << "NO\n"

#define ull unsigned long long

#define pb push_back

#define mp make_pair

#define fi first

#define se second

#define sz(x) (int)(x).size()

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

#define rep(i, a, b) for (int i = a; i < b; i++)

#define repr(i, a, b) for (int i = a; i >= b; i--)

#define vi vector<int>

#define vvi vector<vector<int>>

void print_v(auto &v,int n){

    rep(i, 0, n) cout<<v[i]<<" ";

}

// ========================= KING OF COMPETITIVE PROGRAMMING ============================

// Ruler of runtime, master of efficiency. Write your solution and dominate the contest!

// ======================================================================================



void solve(){

    int n;

    cin >> n;

    vi a(n);

    int mx = 0;

    rep(i,0,n){

        cin >> a[i];

        mx = max(mx, a[i]);

    }

    mx == a[0] ? no : yes;

}



    int main()

    {

        fastio;

        int t;

        cin >> t;

        while (t--)

        {

            solve();

        }



        return 0;

}
Problem: 2050C - Uninteresting Number
Language: PyPy 3-64

Previous submission (verdict: Time limit exceeded on test 3):
from itertools import product

def is_divi9(num):
    s = sum(num)  # مجموع اولیه ارقام
    if s % 9 == 0:  # بررسی اولیه
        return "YES"
    
    # پیدا کردن ایندکس ارقام 2 و 3
    indices = [i for i in range(len(num)) if num[i] in (2, 3)]
    # تولید تمام ترکیب‌های ممکن از تغییر
    for changes in product((0, 1), repeat=len(indices)):  # 0: تغییر نکن، 1: تغییر کن
        new_s = s  # شروع از مجموع اولیه
        for idx, change in zip(indices, changes):
            if change == 1:  # اگر قرار است این رقم تغییر کند
                new_s += num[idx] ** 2 - num[idx]
        if new_s % 9 == 0:  # بررسی بخش‌پذیری مجموع جدید
            return "YES"
    
    return "NO"  # اگر هیچ حالتی موفق نبود

# ورودی گرفتن
t = int(input())
for _ in range(t):
    num = [int(digit) for digit in input()]  # تبدیل عدد به لیست ارقام
    print(is_divi9(num))


Submission (verdict: Accepted):
def is_divi9(num):
    s = sum(num)  # مجموع اولیه ارقام
    if s % 9 == 0:  # بررسی اولیه
        return "YES"
    
    # شمارش تعداد ارقام 2 و 3
    count_2 = num.count(2)
    count_3 = num.count(3)

    # بررسی تمام مقادیر ممکن از تغییر
    for c2 in range(count_2 + 1):  # تعداد تغییر 2ها از 0 تا count_2
        for c3 in range(count_3 + 1):  # تعداد تغییر 3ها از 0 تا count_3
            new_s = s + c2 * 2 + c3 * 6
            if new_s % 9 == 0:
                return "YES"

    return "NO"

# ورودی گرفتن
t = int(input())
for _ in range(t):
    num = [int(digit) for digit in input()]  # تبدیل عدد به لیست ارقام
    print(is_divi9(num))