ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2050B - Transfusion
Language: C++17 (GCC 7-32)


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




int main() 
{
	ios_base::sync_with_stdio(false); cin.tie(NULL);

	int t;
	cin>>t;
	while(t--){
		int n;
        cin>>n;
        int arr[n];
        for(int i =0;i<n;i++){
            cin>>arr[i];
        }
        int od_,ev_;
        if(n%2 == 0){
            od_ = n/2;
            ev_ = n/2;
        }
        else{
            od_ = n/2 + 1;
            ev_ = n/2;
        }
        int od =0;
        int ev =0;
        for(int i =0;i<n;i++){
            if((i + 1)%2 == 0){
                ev += arr[i];
            }
            else{
                od += arr[i];
            }
        }
        if ((od/od_) == (ev/ev_) && od%od_ == 0 && ev%ev_ == 0){
            cout<<"YES"<<endl;
        }
        else{
            cout<<"NO"<<endl;
        }

	}

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

Previous submission (verdict: Compilation error):
#include <bits/stdc++.h>
using namespace std;




int main() 
{
	ios_base::sync_with_stdio(false); cin.tie(NULL);

	int t;
	cin>>t;
	while(t--){
		int n;
        cin>>n;
        int arr[n];
        for(int i =0;i<n;i++){
            cin>>arr[i];
        }
        int od_,ev_;
        if(n%2 == 0){
            od_ = n/2;
            ev_ = n/2;
        }
        else{
            od_ = n/2 + 1;
            ev_ = n/2;
        }
        // int a[od];
        // int b[ev];
        long long int od =0;
        long long int ev =0;
        for(int i =0;i<n;i++){
            if((i + 1)%2 == 0){
                ev += arr[i];
            }
            else{
                od += arr[i];
            }
        }
        if ((od/od_) == (ev/ev_) && od%od_ == 0 && ev%ev_ == 0){
            cout<<"YES"<<endl;
        }
        else{
            cout<<"NO"<<endl;
        }

	}

Submission (verdict: Compilation error):
#include <bits/stdc++.h>
using namespace std;




int main() 
{
// 	ios_base::sync_with_stdio(false); cin.tie(NULL);

	int t;
	cin>>t;
	while(t--){
		int n;
        cin>>n;
        int arr[n];
        for(int i =0;i<n;i++){
            cin>>arr[i];
        }
        int od_,ev_;
        if(n%2 == 0){
            od_ = n/2;
            ev_ = n/2;
        }
        else{
            od_ = n/2 + 1;
            ev_ = n/2;
        }
        // int a[od];
        // int b[ev];
        long long int od =0;
        long long int ev =0;
        for(int i =0;i<n;i++){
            if((i + 1)%2 == 0){
                ev += arr[i];
            }
            else{
                od += arr[i];
            }
        }
        if ((od/od_) == (ev/ev_) && od%od_ == 0 && ev%ev_ == 0){
            cout<<"YES"<<endl;
        }
        else{
            cout<<"NO"<<endl;
        }

	}
Problem: 2050E - Three Strings
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
void aaa()
{
	string a,b,c;cin>>a>>b>>c;
	int dp[105][105]={0};
	for(int i=0;i<a.size();i++)
	{
		if(a[i]!=c[i])dp[i+1][0]=dp[i][0]+1;
		else dp[i+1][0]=dp[i][0];
	}
	for(int i=0;i<b.size();i++)
	{
		if(b[i]!=c[i])dp[0][i+1]=dp[0][i]+1;
		else dp[0][i+1]=dp[0][i];
	}
	for(int i=1;i<=a.size();i++)
	{
		for(int j=1;j<=b.size();j++)
		{
			dp[i][j]=min(dp[i-1][j]+(a[i-1]==c[i+j-1]?0:1),
					 	 dp[i][j-1]+(b[j-1]==c[i+j-1]?0:1));
			cout<<dp[i][j]<<' ';
		}
		cout<<endl;
	}
	cout<<dp[a.size()][b.size()]<<endl;
}
int main()
{
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	int n;cin>>n;
	while(n--)aaa();
}
Problem: 2050E - Three Strings
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Runtime error on test 13):
#include<bits/stdc++.h>
using namespace std;
void aaa()
{
	string a,b,c;cin>>a>>b>>c;
	int dp[105][105]={0};
	for(int i=0;i<a.size();i++)
	{
		if(a[i]!=c[i])dp[i+1][0]=dp[i][0]+1;
		else dp[i+1][0]=dp[i][0];
	}
	for(int i=0;i<b.size();i++)
	{
		if(b[i]!=c[i])dp[0][i+1]=dp[0][i]+1;
		else dp[0][i+1]=dp[0][i];
	}
	for(int i=1;i<=a.size();i++)
	{
		for(int j=1;j<=b.size();j++)
		{
			dp[i][j]=min(dp[i-1][j]+(a[i-1]==c[i+j-1]?0:1),
					 	 dp[i][j-1]+(b[j-1]==c[i+j-1]?0:1));
		}
	}
	cout<<dp[a.size()][b.size()]<<endl;
}
int main()
{
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	int n;cin>>n;
	while(n--)aaa();
}


Submission (verdict: Accepted):
#include<bits/stdc++.h>
using namespace std;
void aaa()
{
	string a,b,c;cin>>a>>b>>c;
	int dp[1005][1005]={0};
	for(int i=0;i<a.size();i++)
	{
		if(a[i]!=c[i])dp[i+1][0]=dp[i][0]+1;
		else dp[i+1][0]=dp[i][0];
	}
	for(int i=0;i<b.size();i++)
	{
		if(b[i]!=c[i])dp[0][i+1]=dp[0][i]+1;
		else dp[0][i+1]=dp[0][i];
	}
	for(int i=1;i<=a.size();i++)
	{
		for(int j=1;j<=b.size();j++)
		{
			dp[i][j]=min(dp[i-1][j]+(a[i-1]==c[i+j-1]?0:1),
					 	 dp[i][j-1]+(b[j-1]==c[i+j-1]?0:1));
		}
	}
	cout<<dp[a.size()][b.size()]<<endl;
}
int main()
{
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	int n;cin>>n;
	while(n--)aaa();
}
Problem: 2050E - Three Strings
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
void aaa()
{
	string a,b,c;cin>>a>>b>>c;
	int dp[105][105]={0};
	for(int i=0;i<a.size();i++)
	{
		if(a[i]!=c[i])dp[i+1][0]=dp[i][0]+1;
		else dp[i+1][0]=dp[i][0];
	}
	for(int i=0;i<b.size();i++)
	{
		if(b[i]!=c[i])dp[0][i+1]=dp[0][i]+1;
		else dp[0][i+1]=dp[0][i];
	}
	for(int i=1;i<=a.size();i++)
	{
		for(int j=1;j<=b.size();j++)
		{
			dp[i][j]=min(dp[i-1][j]+(a[i-1]==c[i+j-1]?0:1),
					 	 dp[i][j-1]+(b[j-1]==c[i+j-1]?0:1));
			cout<<dp[i][j]<<' ';
		}
		cout<<endl;
	}
	cout<<dp[a.size()][b.size()]<<endl;
}
int main()
{
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	int n;cin>>n;
	while(n--)aaa();
}

Submission (verdict: Runtime error on test 13):
#include<bits/stdc++.h>
using namespace std;
void aaa()
{
	string a,b,c;cin>>a>>b>>c;
	int dp[105][105]={0};
	for(int i=0;i<a.size();i++)
	{
		if(a[i]!=c[i])dp[i+1][0]=dp[i][0]+1;
		else dp[i+1][0]=dp[i][0];
	}
	for(int i=0;i<b.size();i++)
	{
		if(b[i]!=c[i])dp[0][i+1]=dp[0][i]+1;
		else dp[0][i+1]=dp[0][i];
	}
	for(int i=1;i<=a.size();i++)
	{
		for(int j=1;j<=b.size();j++)
		{
			dp[i][j]=min(dp[i-1][j]+(a[i-1]==c[i+j-1]?0:1),
					 	 dp[i][j-1]+(b[j-1]==c[i+j-1]?0:1));
		}
	}
	cout<<dp[a.size()][b.size()]<<endl;
}
int main()
{
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	int n;cin>>n;
	while(n--)aaa();
}
Problem: 2060D - Subtract Min Sort
Language: Java 21

Previous submission (verdict: Runtime error on test 1):
package first;



import java.io.*;

import java.util.*;



public class Main{

	static StreamTokenizer cins=new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));

	static PrintWriter cout=new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

	static int cin()throws Exception {

		cins.nextToken();

		return (int)cins.nval;

	}

	static void solve() throws Exception{

		int n=cin();

		int a[]=new int[n+1];

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

			a[i]=cin();

		}

		

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

			a[i]-=Math.min(a[i],a[i+1]);

			a[i+1]-=Math.min(a[i],a[i+1]);

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

				cout.println("no");

				cout.flush();

				return;

			}

		}

		cout.println("Yes");

		cout.flush();

	}

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

		int t=cin();

		while(t--!=0)solve();

	}

}

Submission (verdict: Wrong answer on test 2):


import java.io.*;

import java.util.*;



public class Main{

	static StreamTokenizer cins=new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));

	static PrintWriter cout=new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

	static int cin()throws Exception {

		cins.nextToken();

		return (int)cins.nval;

	}

	static void solve() throws Exception{

		int n=cin();

		int a[]=new int[n+1];

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

			a[i]=cin();

		}

		

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

			a[i]-=Math.min(a[i],a[i+1]);

			a[i+1]-=Math.min(a[i],a[i+1]);

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

				cout.println("no");

				cout.flush();

				return;

			}

		}

		cout.println("Yes");

		cout.flush();

	}

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

		int t=cin();

		while(t--!=0)solve();

	}

}
Problem: 2060D - Subtract Min Sort
Language: Java 21


Submission (verdict: Runtime error on test 1):
package first;



import java.io.*;

import java.util.*;



public class Main{

	static StreamTokenizer cins=new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));

	static PrintWriter cout=new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

	static int cin()throws Exception {

		cins.nextToken();

		return (int)cins.nval;

	}

	static void solve() throws Exception{

		int n=cin();

		int a[]=new int[n+1];

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

			a[i]=cin();

		}

		

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

			a[i]-=Math.min(a[i],a[i+1]);

			a[i+1]-=Math.min(a[i],a[i+1]);

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

				cout.println("no");

				cout.flush();

				return;

			}

		}

		cout.println("Yes");

		cout.flush();

	}

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

		int t=cin();

		while(t--!=0)solve();

	}

}
Problem: 2060D - Subtract Min Sort
Language: Java 21

Previous submission (verdict: Wrong answer on test 2):


import java.io.*;

import java.util.*;



public class Main{

	static StreamTokenizer cins=new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));

	static PrintWriter cout=new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

	static int cin()throws Exception {

		cins.nextToken();

		return (int)cins.nval;

	}

	static void solve() throws Exception{

		int n=cin();

		int a[]=new int[n+1];

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

			a[i]=cin();

		}

		

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

			a[i]-=Math.min(a[i],a[i+1]);

			a[i+1]-=Math.min(a[i],a[i+1]);

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

				cout.println("no");

				cout.flush();

				return;

			}

		}

		cout.println("Yes");

		cout.flush();

	}

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

		int t=cin();

		while(t--!=0)solve();

	}

}

Submission (verdict: Runtime error on test 1):
package first;



import java.io.*;

import java.util.*;



public class Main{

	static StreamTokenizer cins=new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));

	static PrintWriter cout=new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

	static int cin()throws Exception {

		cins.nextToken();

		return (int)cins.nval;

	}

	static void solve() throws Exception{

		int n=cin();

		int a[]=new int[n+1];

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

			a[i]=cin();

		}

		

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

			int now=Math.min(a[i],a[i+1]);

			a[i]-=now;

			a[i+1]-=now;

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

				cout.println("no");

				cout.flush();

				return;

			}

		}

		cout.println("Yes");

		cout.flush();

	}

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

		int t=cin();

		while(t--!=0)solve();

	}

}
Problem: 2060D - Subtract Min Sort
Language: Java 21

Previous submission (verdict: Runtime error on test 1):
package first;



import java.io.*;

import java.util.*;



public class Main{

	static StreamTokenizer cins=new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));

	static PrintWriter cout=new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

	static int cin()throws Exception {

		cins.nextToken();

		return (int)cins.nval;

	}

	static void solve() throws Exception{

		int n=cin();

		int a[]=new int[n+1];

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

			a[i]=cin();

		}

		

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

			int now=Math.min(a[i],a[i+1]);

			a[i]-=now;

			a[i+1]-=now;

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

				cout.println("no");

				cout.flush();

				return;

			}

		}

		cout.println("Yes");

		cout.flush();

	}

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

		int t=cin();

		while(t--!=0)solve();

	}

}

Submission (verdict: Accepted):




import java.io.*;

import java.util.*;



public class Main{

	static StreamTokenizer cins=new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));

	static PrintWriter cout=new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

	static int cin()throws Exception {

		cins.nextToken();

		return (int)cins.nval;

	}

	static void solve() throws Exception{

		int n=cin();

		int a[]=new int[n+1];

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

			a[i]=cin();

		}

		

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

			int now=Math.min(a[i],a[i+1]);

			a[i]-=now;

			a[i+1]-=now;

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

				cout.println("no");

				cout.flush();

				return;

			}

		}

		cout.println("Yes");

		cout.flush();

	}

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

		int t=cin();

		while(t--!=0)solve();

	}

}
Problem: 2063B - Subsequence Update
Language: C++20 (GCC 13-64)


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

    author: Aditya Gupta 

    created: 05.02.2025 15:42:59

*/



#include <bits/stdc++.h>

using namespace std;



#ifndef ONLINE_JUDGE

// Template to debug 1 variable

template<typename T>

void debug1(const char* varName, T varValue) {

    cout << varName << " = " << varValue << endl;

}

// Template to debug 2 variables

template<typename T1, typename T2>

void debug2(const char* varName1, T1 varValue1, const char* varName2, T2 varValue2) {

    cout << varName1 << " = " << varValue1 << " " << varName2 << " = " << varValue2 << endl;

}

// Template to print a vector

template<typename T>

void debug_vector(const char* varName, const vector<T>& vec) {

    cout << varName << " = [";

    for (size_t i = 0; i < vec.size(); ++i) {

        cout << vec[i];

        if (i < vec.size() - 1) cout << ", ";

    }

    cout << "]" << endl;

}



#define debug1(var) debug1(#var, var)

#define debug2(var1, var2) debug2(#var1, var1, #var2, var2)

#define debug_vector(vec) debug_vector(#vec, vec)



#else

#define debug1(var)

#define debug2(var1, var2)

#define debug_vector(vec)

#endif



#define int long long



void solve(){

   int n,l,r;

   cin>>n>>l>>r;

   vector<int> arr(n);

   for(auto &it: arr) cin>>it;

   sort(arr.begin(),arr.end());

   int sum=0,i=0;

   while(i<=(r-l)){

        sum+=arr[i];

        i++;

   }

   cout<<sum<<endl;

}

signed main() {

    ios::sync_with_stdio(false);

    cin.tie(NULL);

    auto start = chrono::high_resolution_clock::now();



    int t;

    cin >> t;

    

    while (t--) {

        solve();

    }



    auto end = chrono::high_resolution_clock::now();

    auto duration = chrono::duration_cast<chrono::milliseconds>(end - start);

    cerr << "Execution Time: " << duration.count() << " ms" << std::endl;



    return 0;

}
Problem: 2061D - Kevin and Numbers
Language: C++20 (GCC 13-64)


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

void solve(){
    int n, m;
    cin >> n >> m;
    int a[n], b[m];
    priority_queue<int> p1;
    priority_queue<int> p2;
    int s1=0,s2=0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        p1.push(a[i]);
        s1+=a[i];
    }
    for (int i = 0; i < m; i++) {
        cin >> b[i];
        p2.push(b[i]);
        s2+=b[i];
    }
    // cout<<s1<<" "<<s2<<endl;
    bool flag=false;
    bool ans=false;
    while (!p2.empty()) {
        int x = p2.top();
        if(x==1){
            if(p1.top()==1 && p2.size()==p1.size()){
                flag=true;
                ans=true;   
            }else{
                flag=true;
            }
        }
        if(flag) break;
        p2.pop();
        if(p1.top()==x){
            // cout<<p1.top()<<endl;
            p1.pop();
        }else{
            int a = floor(x / 2.0);
            int b = ceil(x / 2.0);
            if (!p1.empty() && p1.top() == b) {
                // cout<<p1.top()<<endl;
                p1.pop();
            }
            else if(!p1.empty() && p1.top() >b){
                p2.push(b);
            }
            else if(!p1.empty() && p1.top() <b/2){
                flag=true;
            }
            else{
                p2.push(b);
            }
            p2.push(a);
        }
        // if(flag) break;
    }
    // cout << p1.size() << endl;
    // cout << p2.size() << endl;
    // cout << ans << endl;
    // cout << flag << endl;
    // cout << p1.top() << endl;
    // cout << p2.top() << endl;
    if ((p1.empty() && p2.empty() ) || ans) cout << "Yes" << endl;
    // while (p1.size() > 0){
    //     cout<<p1.top()<<" ";
    //     p1.pop();
    // }
    // cout<<endl;
    // while (p2.size() > 0){
    //     cout<<p2.top()<<"";
    //     p2.pop();
    // }
    // {
    //     /* code */
    // }
    
    else cout << "No" << endl;
}

int main() {
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
}
Problem: 2050B - Transfusion
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>
using namespace std;
int t, n, a1, a2, x;
int n1, n2;
int main()
{
    cin >> t;
    for (int i = 1; i <= t; i++)
    {
        a1 = a2 = 0;
        cin >> n;
        for (int j = 1; j <= n; j++)
        {
            cin >> x;
            if (j % 2 == 1) a1 += x;
            else a2 += x;
        }
        if ((a1+a2) % n) {cout << "No" << '\n'; continue;}
        int avg = (a1+a2) / n;
        if (n % 2) {n1 = n/2+1; n2 = n - n1;}
        else {n1 = n/2; n2 = n - n1;}
        if (avg * (n1) == a1 && avg * n2 == a2)
        {
            cout << "Yes" << '\n';
            continue;
        }
        cout << "No" << '\n';
    }
    return 0;
}
Problem: 2050B - Transfusion
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>
using namespace std;
int t, n, a1, a2, x;
int n1, n2;
int main()
{
    cin >> t;
    for (int i = 1; i <= t; i++)
    {
        a1 = a2 = 0;
        cin >> n;
        for (int j = 1; j <= n; j++)
        {
            cin >> x;
            if (j % 2 == 1) a1 += x;
            else a2 += x;
        }
        if ((a1+a2) % n) {cout << "No" << '\n'; continue;}
        int avg = (a1+a2) / n;
        if (n % 2) {n1 = n/2+1; n2 = n - n1;}
        else {n1 = n/2; n2 = n - n1;}
        if (avg * (n1) != a1 || avg * n2 != a2)
        {
            cout << "No" << '\n';
            continue;
        }
        cout << "Yes" << '\n';
    }
    return 0;
}


Submission (verdict: Accepted):
#include <bits/stdc++.h>
using namespace std;
#define int long long
int t, n, a1, a2, x;
int n1, n2;
signed main()
{
    cin >> t;
    for (int i = 1; i <= t; i++)
    {
        a1 = a2 = 0;
        cin >> n;
        for (int j = 1; j <= n; j++)
        {
            cin >> x;
            if (j % 2 == 1) a1 += x;
            else a2 += x;
        }
        if ((a1+a2) % n) {cout << "No" << '\n'; continue;}
        int avg = (a1+a2) / n;
        if (n % 2) {n1 = n/2+1; n2 = n - n1;}
        else {n1 = n/2; n2 = n - n1;}
        if (avg * (n1) != a1 || avg * n2 != a2)
        {
            cout << "No" << '\n';
            continue;
        }
        cout << "Yes" << '\n';
    }
    return 0;
}
Problem: 2050B - Transfusion
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>
using namespace std;
int t, n, a1, a2, x;
int n1, n2;
int main()
{
    cin >> t;
    for (int i = 1; i <= t; i++)
    {
        a1 = a2 = 0;
        cin >> n;
        for (int j = 1; j <= n; j++)
        {
            cin >> x;
            if (j % 2 == 1) a1 += x;
            else a2 += x;
        }
        if ((a1+a2) % n) {cout << "No" << '\n'; continue;}
        int avg = (a1+a2) / n;
        if (n % 2) {n1 = n/2+1; n2 = n - n1;}
        else {n1 = n/2; n2 = n - n1;}
        if (avg * (n1) == a1 && avg * n2 == a2)
        {
            cout << "Yes" << '\n';
            continue;
        }
        cout << "No" << '\n';
    }
    return 0;
}


Submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>
using namespace std;
int t, n, a1, a2, x;
int n1, n2;
int main()
{
    cin >> t;
    for (int i = 1; i <= t; i++)
    {
        a1 = a2 = 0;
        cin >> n;
        for (int j = 1; j <= n; j++)
        {
            cin >> x;
            if (j % 2 == 1) a1 += x;
            else a2 += x;
        }
        if ((a1+a2) % n) {cout << "No" << '\n'; continue;}
        int avg = (a1+a2) / n;
        if (n % 2) {n1 = n/2+1; n2 = n - n1;}
        else {n1 = n/2; n2 = n - n1;}
        if (avg * (n1) != a1 || avg * n2 != a2)
        {
            cout << "No" << '\n';
            continue;
        }
        cout << "Yes" << '\n';
    }
    return 0;
}
Problem: 2049C - MEX Cycle
Language: C++17 (GCC 7-32)


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

using namespace std;

typedef long long ll;

#define fastio std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);

#define endl '\n'

const ll mod = 998244353;

const int N = 2e5+10;

int a[N];

int main() {

	fastio;

	int T;

	cin>>T;

	while(T--) {

		int n,x,y;

		cin>>n>>x>>y;

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

			if(i&1) a[i]=0;

			else a[i]=1;

		}

		if(n&1) a[n]=2;

		if(a[x]==a[y]){

			a[y]=2;

		}

		for(int i=1;i<=n;i++) cout<<a[i]<<" ";

		cout<<endl;



	}

	return 0;

}
Problem: 2049C - MEX Cycle
Language: C++17 (GCC 7-32)

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

using namespace std;

typedef long long ll;

#define fastio std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);

#define endl '\n'

const ll mod = 998244353;

const int N = 2e5+10;

int a[N];

int main() {

	fastio;

	int T;

	cin>>T;

	while(T--) {

		int n,x,y;

		cin>>n>>x>>y;

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

			if(i&1) a[i]=0;

			else a[i]=1;

		}

		if(n&1) a[n]=2;

		if(a[x]==a[y]){

			a[y]=2;

		}

		for(int i=1;i<=n;i++) cout<<a[i]<<" ";

		cout<<endl;



	}

	return 0;

}



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

using namespace std;

typedef long long ll;

#define fastio std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);

#define endl '\n'

const ll mod = 998244353;

const int N = 2e5+10;

int a[N];

int main() {

	fastio;

	int T;

	cin>>T;

	while(T--) {

		int n,x,y;

		cin>>n>>x>>y;

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

			if(i&1) a[i]=0;

			else a[i]=1;

		}

		if(n&1) a[n]=2;

		if(a[x]==a[y]){

			a[y]=2;

		}

		if(n&1){

			if(y==n-2) a[n-1]=0,a[n]=1;

			else if(y==n-1) a[n]=1; 

		}

		for(int i=1;i<=n;i++) cout<<a[i]<<" ";

		cout<<endl;



	}

	return 0;

}
Problem: 2049C - MEX Cycle
Language: C++17 (GCC 7-32)

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

using namespace std;

typedef long long ll;

#define fastio std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);

#define endl '\n'

const ll mod = 998244353;

const int N = 2e5+10;

int a[N];

int main() {

	fastio;

	int T;

	cin>>T;

	while(T--) {

		int n,x,y;

		cin>>n>>x>>y;

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

			if(i&1) a[i]=0;

			else a[i]=1;

		}

		if(n&1) a[n]=2;

		if(a[x]==a[y]){

			a[y]=2;

		}

		if(n&1){

			if(y==n-2) a[n-1]=0,a[n]=1;

			else if(y==n-1) a[n]=1; 

		}

		for(int i=1;i<=n;i++) cout<<a[i]<<" ";

		cout<<endl;



	}

	return 0;

}



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

using namespace std;

typedef long long ll;

#define fastio std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);

#define endl '\n'

const ll mod = 998244353;

const int N = 2e5+10;

int a[N];

int main() {

	fastio;

	int T;

	cin>>T;

	while(T--) {

		int n,x,y;

		cin>>n>>x>>y;

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

			if(i&1) a[i]=0;

			else a[i]=1;

		}

		if(n&1) a[n]=2;

		if(a[x]==a[y]) {

			a[y]=2;

			if(n&1) {

				if(y==n-2) a[n-1]=0,a[n]=1;

				else if(y==n-1) a[n]=1;

			}

		}



		for(int i=1; i<=n; i++) cout<<a[i]<<" ";

		cout<<endl;



	}

	return 0;

}