ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2050E - Three Strings
Language: C++17 (GCC 7-32)

Previous submission (verdict: Time limit exceeded on test 6):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int f(int i, int j ,int ind, int m ,int n,int p, string &a, string &b, string & c, vector<vector<int>>&dp){
    // if(i>=m){
    //     int count =0;
    //     while(j<n&&ind<p){
    //         if(c[ind]!=b[j]){
    //             count++;
    //         }
    //         ind++;
    //         j++;
    //     }
    //     return count;
    // }
    // if(j>=n){
    //     int count =0;
    //     while(i<m&&ind<p){
    //         if(c[ind]!=a[i]){
    //             count++;
    //         }
    //         ind++;
    //         i++;
    //     }
    //     return count;

    // }
    if(ind>=p){
        return 0;
    }

    
    int val=INT_MAX;

    if(i<m&&a[i]==c[ind]){
        val=min(val,f(i+1,j,ind+1,m,n,p,a,b,c,dp));
    }
     if(j<n&&b[j]==c[ind]){
        val=min(val,f(i,j+1,ind+1,m,n,p,a,b,c,dp));
    }
    if(i<m&&a[i]!=c[ind]){
        val=min(val,1+f(i+1,j,ind+1,m,n,p,a,b,c,dp));

        
    }
    if(j<n&&b[j]!=c[ind]){
        val=min(val,1+f(i,j+1,ind+1,m,n,p,a,b,c,dp));
    }
    return dp[i][j]=val;
}

int main() {
    ll t;
    cin >> t;
    while (t--) {
       string a;
       string b;
       string c;

       cin>>a;
       cin>>b;
       cin>>c;

       int m=a.size();
       int n=b.size();
       int p=c.size();
       
       vector<vector<int>>dp(m+1,vector<int>(n+1,-1));
       int ans=f(0,0,0,m,n,p,a,b,c,dp);
       cout<<ans<<endl;


       
    }
    return 0;
}


Submission (verdict: Time limit exceeded on test 6):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int f(int i, int j , int m ,int n,int p, string &a, string &b, string & c, vector<vector<int>>&dp){
    // if(i>=m){
    //     int count =0;
    //     while(j<n&&ind<p){
    //         if(c[ind]!=b[j]){
    //             count++;
    //         }
    //         ind++;
    //         j++;
    //     }
    //     return count;
    // }
    // if(j>=n){
    //     int count =0;
    //     while(i<m&&ind<p){
    //         if(c[ind]!=a[i]){
    //             count++;
    //         }
    //         ind++;
    //         i++;
    //     }
    //     return count;

    // }
    int ind=i+j;
    if(ind>=p){
        return 0;
    }

    
    int val=INT_MAX;

    if(i<m&&a[i]==c[ind]){
        val=min(val,f(i+1,j,m,n,p,a,b,c,dp));
    }
     if(j<n&&b[j]==c[ind]){
        val=min(val,f(i,j+1,m,n,p,a,b,c,dp));
    }
    if(i<m&&a[i]!=c[ind]){
        val=min(val,1+f(i+1,j,m,n,p,a,b,c,dp));

        
    }
    if(j<n&&b[j]!=c[ind]){
        val=min(val,1+f(i,j+1,m,n,p,a,b,c,dp));
    }
    return dp[i][j]=val;
}

int main() {
    ll t;
    cin >> t;
    while (t--) {
       string a;
       string b;
       string c;

       cin>>a;
       cin>>b;
       cin>>c;

       int m=a.size();
       int n=b.size();
       int p=c.size();
       
       vector<vector<int>>dp(m+1,vector<int>(n+1,-1));
       int ans=f(0,0,m,n,p,a,b,c,dp);
       cout<<ans<<endl;


       
    }
    return 0;
}
Problem: 2050E - Three Strings
Language: C++17 (GCC 7-32)

Previous submission (verdict: Time limit exceeded on test 6):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int f(int i, int j , int m ,int n,int p, string &a, string &b, string & c, vector<vector<int>>&dp){
    // if(i>=m){
    //     int count =0;
    //     while(j<n&&ind<p){
    //         if(c[ind]!=b[j]){
    //             count++;
    //         }
    //         ind++;
    //         j++;
    //     }
    //     return count;
    // }
    // if(j>=n){
    //     int count =0;
    //     while(i<m&&ind<p){
    //         if(c[ind]!=a[i]){
    //             count++;
    //         }
    //         ind++;
    //         i++;
    //     }
    //     return count;

    // }
    int ind=i+j;
    if(ind>=p){
        return 0;
    }

    
    int val=INT_MAX;

    if(i<m&&a[i]==c[ind]){
        val=min(val,f(i+1,j,m,n,p,a,b,c,dp));
    }
     if(j<n&&b[j]==c[ind]){
        val=min(val,f(i,j+1,m,n,p,a,b,c,dp));
    }
    if(i<m&&a[i]!=c[ind]){
        val=min(val,1+f(i+1,j,m,n,p,a,b,c,dp));

        
    }
    if(j<n&&b[j]!=c[ind]){
        val=min(val,1+f(i,j+1,m,n,p,a,b,c,dp));
    }
    return dp[i][j]=val;
}

int main() {
    ll t;
    cin >> t;
    while (t--) {
       string a;
       string b;
       string c;

       cin>>a;
       cin>>b;
       cin>>c;

       int m=a.size();
       int n=b.size();
       int p=c.size();
       
       vector<vector<int>>dp(m+1,vector<int>(n+1,-1));
       int ans=f(0,0,m,n,p,a,b,c,dp);
       cout<<ans<<endl;


       
    }
    return 0;
}


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

int f(int i, int j ,int ind, int m ,int n,int p, string &a, string &b, string & c, vector<vector<int>>&dp){
    // if(i>=m){
    //     int count =0;
    //     while(j<n&&ind<p){
    //         if(c[ind]!=b[j]){
    //             count++;
    //         }
    //         ind++;
    //         j++;
    //     }
    //     return count;
    // }
    // if(j>=n){
    //     int count =0;
    //     while(i<m&&ind<p){
    //         if(c[ind]!=a[i]){
    //             count++;
    //         }
    //         ind++;
    //         i++;
    //     }
    //     return count;

    // }
    if(ind>=p){
        return 0;
    }
    if(dp[i][j]!=-1){
        return dp[i][j];
    }

    
    int val=INT_MAX;

    if(i<m&&a[i]==c[ind]){
        val=min(val,f(i+1,j,ind+1,m,n,p,a,b,c,dp));
    }
     if(j<n&&b[j]==c[ind]){
        val=min(val,f(i,j+1,ind+1,m,n,p,a,b,c,dp));
    }
    if(i<m&&a[i]!=c[ind]){
        val=min(val,1+f(i+1,j,ind+1,m,n,p,a,b,c,dp));

        
    }
    if(j<n&&b[j]!=c[ind]){
        val=min(val,1+f(i,j+1,ind+1,m,n,p,a,b,c,dp));
    }
    return dp[i][j]=val;
}

int main() {
    ll t;
    cin >> t;
    while (t--) {
       string a;
       string b;
       string c;

       cin>>a;
       cin>>b;
       cin>>c;

       int m=a.size();
       int n=b.size();
       int p=c.size();
       
       vector<vector<int>>dp(m+1,vector<int>(n+1,-1));
       int ans=f(0,0,0,m,n,p,a,b,c,dp);
       cout<<ans<<endl;


       
    }
    return 0;
}
Problem: 2061D - Kevin and Numbers
Language: C++17 (GCC 7-32)


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

// JAY SHREE KRISHNA
// AUTHOR:- Solanki Nirmal Bhikhabhai

// ------------------------------------------------------------------------------------------------------------
#define hello ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define ll long long
#define ld long double
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define pb push_back
#define pp pop_back
#define endl "\n"
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
// ------------------------------------------------------------------------------------------------------------

vector<ll> llToBin(ll n){
    vector<ll> ans;
    while(n!=0){
        ans.pb(n%2);
        n/=2;
    }
    reverse(all(ans));
    return ans;
}

vector<ll> isprime(1e6+1,1);
void sieve(int n){
    isprime[1]=0;
    for(ll i=2;i*i<1000000;i++){
        if(isprime[i]!=0){
            for(ll j=i*i;j<1000000;j+=i) isprime[j]=0;
        }
    }
}

void printvec(vector<ll> temp){
    for(ll i=0;i<temp.size();i++) cout<<temp[i]<<" ";
    cout<<endl;
}

void printmap(map<ll,ll> temp){
    for(auto it=temp.begin();it!=temp.end();it++) cout<<it->fi<<" "<<it->se<<endl;
}

ll ncr(ll n,ll r){
    ld sum=1;
    for(ll i=0;i<=r;i++) sum=sum*(n-r+i)/i;
    return (ll)sum;
}


// ------------------------------------------------------------------------------------------------------------

void solve(){
    ll n,m;		cin>>n>>m;
    vector<ll> a(n),b(m);
    for(ll i=0;i<n;i++) cin>>a[i];
    for(ll i=0;i<m;i++) cin>>b[i];

    priority_queue<ll,vector<ll>,greater<ll>>pqa (a.begin(),a.end());
    priority_queue<ll,vector<ll>,greater<ll>>pqb (b.begin(),b.end());
    bool flag=true;
    while(!pqa.empty() && !pqb.empty())
    {
        ll a1=pqa.top();
        ll b1=pqb.top();
        //cout<<a1<<" "<<b1<<" "<<endl;
        if(a1>b1)
        {
            flag=false;
            break;
        }
        pqa.pop();
        pqb.pop();
        if(a1==b1)
        {
            //cout<<"Hii"<<endl;
            continue;
        }
        if(pqa.empty())
        {
            flag=false;
            break;
        }
        ll a2=pqa.top();
        pqa.pop();
        //cout<<a2<<endl;
        if(a2==b1)
        {
            pqa.push(a1);
            continue;
        }
        if(a1+a2<b1)
        {
            pqa.push(a1+a2);
            pqb.push(b1);
        }
        else if( a2-a1<=1 && a1+a2==b1) continue;
        else
        {
            flag=false;
            break;
        }
    }
    if(pqa.size()>0 || pqb.size()>0 || !flag) no;
    else yes;
    //cout<<"f "<<flag<<endl;
}

int32_t main(){
    hello;
    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):
#include "bits/stdc++.h"

#define int long long

#define uint unsigned long long

#define vi vector<int>

#define vvi vector<vi >

#define vb vector<bool>

#define vvb vector<vb >

#define fr(i,n) for(int i=0; i<(n); i++)

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

#define nl cout<<"\n"

#define dbg(var) cout<<#var<<"="<<var<<" "

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

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

#define srt(v)  sort(v.begin(),v.end())         // sort 

#define mxe(v)  *max_element(v.begin(),v.end())     // find max element in vector

#define mne(v)  *min_element(v.begin(),v.end())     // find min element in vector

#define unq(v)  v.resize(distance(v.begin(), unique(v.begin(), v.end())));

// make sure to sort before applying unique // else only consecutive duplicates would be removed 

#define bin(x,y)  bitset<y>(x) 

using namespace std;

int MOD=1e9+7;      // Hardcoded, directly change from here for functions!







void modadd(int &a , int b) {a=((a%MOD)+(b%MOD))%MOD;}

void modsub(int &a , int b) {a=((a%MOD)-(b%MOD)+MOD)%MOD;}

void modmul(int &a , int b) {a=((a%MOD)*(b%MOD))%MOD;}

// ================================== take ip/op like vector,pairs directly!==================================

template<typename typC,typename typD> istream &operator>>(istream &cin,pair<typC,typD> &a) { return cin>>a.first>>a.second; }

template<typename typC> istream &operator>>(istream &cin,vector<typC> &a) { for (auto &x:a) cin>>x; return cin; }

template<typename typC,typename typD> ostream &operator<<(ostream &cout,const pair<typC,typD> &a) { return cout<<a.first<<' '<<a.second; }

template<typename typC,typename typD> ostream &operator<<(ostream &cout,const vector<pair<typC,typD>> &a) { for (auto &x:a) cout<<x<<'\n'; return cout; }

template<typename typC> ostream &operator<<(ostream &cout,const vector<typC> &a) { int n=a.size(); if (!n) return cout; cout<<a[0]; for (int i=1; i<n; i++) cout<<' '<<a[i]; return cout; }

// ===================================END Of the input module ==========================================





void solve(){

    int n=1,l=0,r=0;

    string s;

    cin>>n>>l>>r;

    vi v(n);

    fr(i,n)

    cin>>v[i];

    srt(v);

    int k=0;

    int sum=0;

    while(k<(r-l+1)){

        sum+=v[k++];

    }

    cout<<sum<<endl;

    

}



int32_t main()

{

 

 ios_base::sync_with_stdio(false);

 cin.tie(NULL);



    int T = 1;

    cin >> T;

    while (T--)

    {

        solve();

    }

    return 0;

}
Problem: 2052A - Adrenaline Rush
Language: C++17 (GCC 7-32)


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

#ifdef DEBUG
#include <debug.h>
#else
#define dbg(x...)
#endif


using namespace std;
using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
using pii = std::pair<int, int>;
using pil = std::pair<int, ll>;
using pll = std::pair<ll, ll>;
using pli = std::pair<ll, int>;
typedef std::vector<int> vi;
typedef std::vector<ll> vl;
typedef std::vector<pii> vpii;
typedef std::vector<pil> vpil;
typedef std::vector<pli> vpli;
typedef std::vector<pll> vpll;
typedef std::vector<bool> vb;

#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int) (x).size()
#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= b; i--)
#define F0Rd(i, a) for (int i = (a) - 1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)
#define nl cout << "\n"
#define ins insert
#define RET return






int main() {
        ios::sync_with_stdio(false), cin.tie(nullptr);
        int n;
        cin >> n;
        vector<int> p(n);
        vector<pair<int, int>> ans;
        for (int &x: p) cin >> x;
        for (int i = 1; i <= n; i++) {
                set<int> s;
                int j = 0;
                while (j < n && p[j] != i) {
                        if (p[j] < i) s.insert(p[j]);
                        j++;
                }
                vpii tmp;
                for (int x : s) {
                        tmp.push_back({i, x});
                }
                reverse(all(tmp));
                for (auto x : tmp) ans.pb(x);
                for (int k = sz(tmp)-1; k >= 0; k--) ans.pb({tmp[k].se, tmp[k].fi});
        }
        dbg(ans);
        for (int i = 0; i < n; i++) {
                set<int> s;
                for (int j = i + 1; j < n; j++) {
                        if (p[j] < p[i]) {
                                s.insert(p[j]);
                        }
                }
                vpii tmp;
                for (int x : s) {
                        tmp.push_back({p[i], x});
                }
                reverse(all(tmp));
                for (auto x : tmp) ans.pb(x);
        }
        dbg(sz(ans));
        dbg(ans);

}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 6):
/*
*	Author: Nonoze
*	Created: Saturday 01/03/2025
*/
#include <bits/stdc++.h>
using namespace std;

#ifndef IN_LOCAL
	#define dbg(...)
#endif

// #define cout cerr << "OUT: "
#define endl '\n'
#define endlfl '\n' << flush
#define quit(x) return (void)(cout << x << endl)

template<typename T> void read(T& x) { cin >> x;}
template<typename T1, typename T2> void read(pair<T1, T2>& p) { read(p.first), read(p.second);}
template<typename T> void read(vector<T>& v) { for (auto& x : v) read(x); }
template<typename T1, typename T2> void read(T1& x, T2& y) { read(x), read(y); }
template<typename T1, typename T2, typename T3> void read(T1& x, T2& y, T3& z) { read(x), read(y), read(z); }
template<typename T1, typename T2, typename T3, typename T4> void read(T1& x, T2& y, T3& z, T4& zz) { read(x), read(y), read(z), read(zz); }
template<typename T> void print(vector<T>& v) { for (auto& x : v) cout << x << ' '; cout << endl; }

#define sz(x) (int)(x.size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define make_unique(v) sort(all(v)), v.erase(unique(all(v)), (v).end())
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define fi first
#define se second
#define cmin(a, b) a = min(a, b)
#define cmax(a, b) a = max(a, b)
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define QYES quit("YES")
#define QNO quit("NO")

#define int long long
#define double long double
const int inf = numeric_limits<int>::max() / 4;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int MOD = 1e9+7, LOG=20;



void solve();

signed main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int tt=1;
	cin >> tt;
	while(tt--) solve();
	return 0;
}




int n, k, m, q;
vector<int> a;


void solve() {
	read(n);
	a.clear(), a.resize(n); read(a);
	int ans=0; for (int i=0; i<n; i++) ans+=a[i];
	for (int i=1; i<n; i++) {
		vector<int> na;
		for (int i=0; i<sz(a)-1; i++) {
			na.pb(a[i+1]-a[i]);
		}
		if (i==n-1) cmax(ans, abs(na[0]));
		else cmax(ans, abs(na.back()-na[0]));
		a=na;
	}
	cout << ans << endl;
}
Problem: 2049B - pspspsps
Language: C++17 (GCC 7-32)


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

using namespace std;

#define ll long long

#define test cout<<"ok"<<endl; 

#define check(n) for(auto x:n)cout<<x<<" "

//  p.push_back(make_pair(a,b));

// pr.push_back({1,3});

//factor and divisor are same which is limited & multiple are unlimited

#define debug(x) cout << #x <<" " << x << endl;

#define Faster ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

#define MX  1000000+7

vector < bool > is_prime(MX+ 1, true);

/*is_prime[0] = false;

is_prime[1] = true;

for(int i = 2; i<= MX; i++){

    if(is_prime[i] == true && i * i <= MX)

        {

            for(int j = i * i ; j <= MX ;j+= i)

            {       

                is_prime[j] = false;

            }

        }



}*/



void solve(){

ll n; cin >> n;    

 string s;

 cin >> s;

 int ppos = 0, spos = 0;

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

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

    spos = i;

 }  

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

   if(s[i] == 'p'){

    ppos = i;

    break;

   }

 } 

 if(ppos < spos)

    cout <<"NO" << endl;

else 

    cout << "YES" << endl;

}



int main(){

Faster;

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>
#define ll long long int
using namespace std;
 
int main() {
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        vector <ll> v(n);
        set <ll> st;
        for (int i=0; i<n; i++) {
            cin >> v[i];
            st.insert(v[i]);
        }
        if (st.size() == 1) {
            cout << "yes\n";
            continue;
        }
        ll mn = INT_MAX;
        int pos = -1;
        for (int i=2; i<n; i ++) {
            ll diff = abs(v[i] - v[i-2]);
            if (diff > 0 && diff % 2 == 0 && diff < mn) {
                mn = diff;
                pos = i;
            }
        }
        if (pos == -1) {
            cout << "no\n";
            continue;
        }
        //cout << pos << " ";
        ll target;
        if (v[pos] > v[pos - 2]) target = v[pos] - mn/2;
        else target = v[pos] + mn/2;
        ll tot = 0;
        for (ll num: v) {
            tot += num - target;
        }
        if (tot == 0) cout << "yes\n";
        else cout << "no\n";
    }
}

Submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
 
int main() {
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        int od = 0, ev = 0;
        for (int i=0; i<n; i++) {
            int x;
            cin >> x;
            if (i%2 == 0) ev += x;
            else od += x;
        }
        int eve = n / 2, ode = n / 2;
        if (n%2 != 0) eve ++;
        if (ev % eve == 0 && od % ode == 0 && ev / eve == od / ode) cout << "yes\n";
        else cout << "no\n";
    }
}
Problem: 2050B - Transfusion
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        vector <int> v(n);
        for (int i=0; i<n; i++) cin >> v[i];
        int mn = INT_MAX, pos = -1;
        for (int i=2; i<n; i ++) {
            int diff = abs(v[i] - v[i-2]);
            if (diff % 2 == 0 && diff < mn) {
                mn = diff;
                pos = i;
            }
        }
        if (pos == -1) {
            cout << "no\n";
            continue;
        }
        //cout << pos << " ";
        int target;
        if (v[pos] > v[pos - 2]) target = v[pos] - mn/2;
        else target = v[pos] + mn/2;
        int tot = 0;
        for (int num: v) {
            tot += num - target;
        }
        if (tot == 0) cout << "yes\n";
        else cout << "no\n";
    }
}
Problem: 2050B - Transfusion
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        vector <int> v(n);
        for (int i=0; i<n; i++) cin >> v[i];
        int mn = INT_MAX, pos = -1;
        for (int i=2; i<n; i ++) {
            int diff = abs(v[i] - v[i-2]);
            if (diff % 2 == 0 && diff < mn) {
                mn = diff;
                pos = i;
            }
        }
        if (pos == -1) {
            cout << "no\n";
            continue;
        }
        //cout << pos << " ";
        int target;
        if (v[pos] > v[pos - 2]) target = v[pos] - mn/2;
        else target = v[pos] + mn/2;
        int tot = 0;
        for (int num: v) {
            tot += num - target;
        }
        if (tot == 0) cout << "yes\n";
        else cout << "no\n";
    }
}

Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        vector <int> v(n);
        set <int> st;
        for (int i=0; i<n; i++) {
            cin >> v[i];
            st.insert(v[i]);
        }
        if (st.size() == 1) {
            cout << "yes\n";
            continue;
        }
        int mn = INT_MAX, pos = -1;
        for (int i=2; i<n; i ++) {
            int diff = abs(v[i] - v[i-2]);
            if (diff > 0 && diff % 2 == 0 && diff < mn) {
                mn = diff;
                pos = i;
            }
        }
        if (pos == -1) {
            cout << "no\n";
            continue;
        }
        //cout << pos << " ";
        int target;
        if (v[pos] > v[pos - 2]) target = v[pos] - mn/2;
        else target = v[pos] + mn/2;
        int tot = 0;
        for (int num: v) {
            tot += num - target;
        }
        if (tot == 0) cout << "yes\n";
        else cout << "no\n";
    }
}