ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2061D - Kevin and Numbers
Language: C++17 (GCC 7-32)


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

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

    multiset<ll> a;
    multiset<ll> b;

    sort(arr.begin(), arr.end());
    sort(brr.begin(), brr.end());
    ll i = 0;
    ll j = 0;
    while (i < n && j < m) {
        if (arr[i] == brr[j]) {
            i++;
            j++;
        }
        else if (arr[i] < brr[j]) {
            a.insert(arr[i]);
            i++;
        }
        else {
            b.insert(brr[j]);
            j++;
        }
    }

    while (i < n) a.insert(arr[i++]);
    while (j < m) b.insert(brr[j++]);

    while (!b.empty() && a.size() > 1) {
        ll first = *a.begin();
        a.erase(a.begin());
        ll second = *a.begin();
        a.erase(a.begin());
        if (second - first <= 1) {
            if (first + second == *b.begin()) {
                b.erase(b.begin());
            }
            else {
                a.insert(first + second);
            }
        }
        else {
            cout << "No" << endl;
            return;
        }
    }

    if (!a.empty() || !b.empty()) cout << "No" << endl;
    else cout << "Yes" << endl;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll t;
    cin >> t;
    while (t--) {
        solve();
    }
}
Problem: 2061D - Kevin and Numbers
Language: C++17 (GCC 7-32)

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

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

    multiset<ll> a;
    multiset<ll> b;

    sort(arr.begin(), arr.end());
    sort(brr.begin(), brr.end());
    ll i = 0;
    ll j = 0;
    while (i < n && j < m) {
        if (arr[i] == brr[j]) {
            i++;
            j++;
        }
        else if (arr[i] < brr[j]) {
            a.insert(arr[i]);
            i++;
        }
        else {
            b.insert(brr[j]);
            j++;
        }
    }

    while (i < n) a.insert(arr[i++]);
    while (j < m) b.insert(brr[j++]);

    while (!b.empty() && a.size() > 1) {
        ll first = *a.begin();
        a.erase(a.begin());
        ll second = *a.begin();
        a.erase(a.begin());
        if (second - first <= 1) {
            if (first + second == *b.begin()) {
                b.erase(b.begin());
            }
            else {
                a.insert(first + second);
            }
        }
        else {
            cout << "No" << endl;
            return;
        }
    }

    if (!a.empty() || !b.empty()) cout << "No" << endl;
    else cout << "Yes" << endl;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll t;
    cin >> t;
    while (t--) {
        solve();
    }
}

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

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

    multiset<ll> a;
    multiset<ll> b;

    sort(arr.begin(), arr.end());
    sort(brr.begin(), brr.end());
    ll i = 0;
    ll j = 0;
    while (i < n && j < m) {
        if (arr[i] == brr[j]) {
            i++;
            j++;
        }
        else if (arr[i] < brr[j]) {
            a.insert(arr[i]);
            i++;
        }
        else {
            b.insert(brr[j]);
            j++;
        }
    }

    while (i < n) a.insert(arr[i++]);
    while (j < m) b.insert(brr[j++]);

    while (!a.empty() && !b.empty()) {
        if (*a.rbegin() == *b.rbegin()) {
            a.erase(a.find(*a.rbegin()));
            b.erase(b.find(*b.rbegin()));
        }
        else if (*a.rbegin() == 1 || *a.rbegin() > *b.rbegin()) {
            cout << "No" << endl;
            return;
        }
        else {
            ll t1 = *b.rbegin()/2;
            ll t2 = (*b.rbegin()+1)/2;
            b.erase(b.find(*b.rbegin()));
            b.insert(t1);
            b.insert(t2);
        }
    }

    if (!a.empty() || !b.empty()) cout << "No" << endl;
    else cout << "Yes" << endl;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll t;
    cin >> t;
    while (t--) {
        solve();
    }
}
Problem: 2061D - Kevin and Numbers
Language: C++17 (GCC 7-32)

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

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

    multiset<ll> a;
    multiset<ll> b;

    sort(arr.begin(), arr.end());
    sort(brr.begin(), brr.end());
    ll i = 0;
    ll j = 0;
    while (i < n && j < m) {
        if (arr[i] == brr[j]) {
            i++;
            j++;
        }
        else if (arr[i] < brr[j]) {
            a.insert(arr[i]);
            i++;
        }
        else {
            b.insert(brr[j]);
            j++;
        }
    }

    while (i < n) a.insert(arr[i++]);
    while (j < m) b.insert(brr[j++]);

    while (!a.empty() && !b.empty()) {
        if (*a.rbegin() == *b.rbegin()) {
            a.erase(a.find(*a.rbegin()));
            b.erase(b.find(*b.rbegin()));
        }
        else if (*a.rbegin() == 1 || *a.rbegin() > *b.rbegin()) {
            cout << "No" << endl;
            return;
        }
        else {
            ll t1 = *b.rbegin()/2;
            ll t2 = (*b.rbegin()+1)/2;
            b.erase(b.find(*b.rbegin()));
            b.insert(t1);
            b.insert(t2);
        }
    }

    if (!a.empty() || !b.empty()) cout << "No" << endl;
    else cout << "Yes" << endl;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll t;
    cin >> t;
    while (t--) {
        solve();
    }
}

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

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

    multiset<ll> a;
    multiset<ll> b;

    sort(arr.begin(), arr.end());
    sort(brr.begin(), brr.end());
    ll i = 0;
    ll j = 0;
    while (i < n && j < m) {
        if (arr[i] == brr[j]) {
            i++;
            j++;
        }
        else if (arr[i] < brr[j]) {
            a.insert(arr[i]);
            i++;
        }
        else {
            b.insert(brr[j]);
            j++;
        }
    }

    while (i < n) a.insert(arr[i++]);
    while (j < m) b.insert(brr[j++]);

    while (!a.empty() && !b.empty()) {
        if (*a.rbegin() == *b.rbegin()) {
            a.erase(a.find(*a.rbegin()));
            b.erase(b.find(*b.rbegin()));
        }
        else if (a.size() < b.size() || *a.rbegin() > *b.rbegin()) {
            cout << "No" << endl;
            return;
        }
        else {
            ll t1 = *b.rbegin()/2;
            ll t2 = (*b.rbegin()+1)/2;
            b.erase(b.find(*b.rbegin()));
            b.insert(t1);
            b.insert(t2);
        }
    }

    if (!a.empty() || !b.empty()) cout << "No" << endl;
    else cout << "Yes" << endl;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll t;
    cin >> t;
    while (t--) {
        solve();
    }
}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int n,l,r,x;
		ll y=0;
		int a[100000];
		cin>>n>>l>>r;
		x=r-l+1;
		for(int i=1;i<=n;i++)
		{
			cin>>a[i];
		}
		sort(a+1,a+n+1);
		for(int i=1;i<=x;i++)
		{
			y+=a[i];
		}
		cout<<y<<endl;
	}
	return 0;
}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int n,l,r,x;
		ll y=0;
		int a[100000];
		cin>>n>>l>>r;
		x=r-l+1;
		for(int i=1;i<=n;i++)
		{
			cin>>a[i];
		}
		sort(a+1,a+n+1);
		for(int i=1;i<=x;i++)
		{
			y+=a[i];
		}
		cout<<y<<endl;
	}
	return 0;
}

Submission (verdict: Compilation error):
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
//int main()
//{
//	int t;
//	cin>>t;
//	while(t--)
//	{
//		int n,l,r,x;
//		ll y=0;
//		int a[100000];
//		cin>>n>>l>>r;
//		x=r-l+1;
//		for(int i=1;i<=n;i++)
//		{
//			cin>>a[i];
//		}
//		sort(a+1,a+n+1);
//		for(int i=1;i<=x;i++)
//		{
//			y+=a[i];
//		}
//		cout<<y<<endl;
//	}
//	return 0;
//}
//只能一次反转
void solve()
{
	int n,l,r;
	cin>>n>>l>>r;
	ll res=0;
	vector<int>a(n+1);
	for(int i=1;i<=n;i++)
		cin>>a[i];
	priority_quene<int>tmpl_ans,tmpr_ans;
	//tmpl_ans 和 tmpr_ans 是最大堆，用于存储区间 [l, r] 内的元素。
    priority_queue<int,vector<int>,greater<int>> lans,rans;
	//lans 和 rans 是最小堆，分别用于存储区间 [1, l-1] 和 [r+1, n] 的元素。
	for(int i=l;i<=r;i++)
	{
		res+=a[i];
		tmpl_ans.push(a[i]);
		tmpr_ans.push(a[i]);
	}
	for(int i=1;i<l;i++)
		lans.push(a[i]);
	for(int i=r+1;i<=n;i++)
		rans.push(a[i]);
	
	ll res1=res;
	
  while (!lans.empty()){
    int now1 = tmpl_ans.top(),now2 = lans.top();
    if (now1>now2){
      res -= now1-now2;
      tmpl_ans.pop();
      tmpl_ans.push(now2);
      lans.pop();
    }else{
      break;
    }
  }
  while (!rans.empty()){
    int now1 = tmpr_ans.top(),now2 = rans.top();//最大元素
    if (now1>now2){
      res1 -= now1-now2;
      tmpr_ans.pop();//移除堆顶的最大元素
      tmpr_ans.push(now2);//将新的较小元素 now2 插入堆中
      rans.pop();
    }else{
      break;
    }
  }
  cout<<min(res1,res)<<endl;
}
 
int main()
{
	int t;
	cin>>t;
    while (t--) solve();
}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)

Previous submission (verdict: Compilation error):
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
//int main()
//{
//	int t;
//	cin>>t;
//	while(t--)
//	{
//		int n,l,r,x;
//		ll y=0;
//		int a[100000];
//		cin>>n>>l>>r;
//		x=r-l+1;
//		for(int i=1;i<=n;i++)
//		{
//			cin>>a[i];
//		}
//		sort(a+1,a+n+1);
//		for(int i=1;i<=x;i++)
//		{
//			y+=a[i];
//		}
//		cout<<y<<endl;
//	}
//	return 0;
//}
//只能一次反转
void solve()
{
	int n,l,r;
	cin>>n>>l>>r;
	ll res=0;
	vector<int>a(n+1);
	for(int i=1;i<=n;i++)
		cin>>a[i];
	priority_quene<int>tmpl_ans,tmpr_ans;
	//tmpl_ans 和 tmpr_ans 是最大堆，用于存储区间 [l, r] 内的元素。
    priority_queue<int,vector<int>,greater<int>> lans,rans;
	//lans 和 rans 是最小堆，分别用于存储区间 [1, l-1] 和 [r+1, n] 的元素。
	for(int i=l;i<=r;i++)
	{
		res+=a[i];
		tmpl_ans.push(a[i]);
		tmpr_ans.push(a[i]);
	}
	for(int i=1;i<l;i++)
		lans.push(a[i]);
	for(int i=r+1;i<=n;i++)
		rans.push(a[i]);
	
	ll res1=res;
	
  while (!lans.empty()){
    int now1 = tmpl_ans.top(),now2 = lans.top();
    if (now1>now2){
      res -= now1-now2;
      tmpl_ans.pop();
      tmpl_ans.push(now2);
      lans.pop();
    }else{
      break;
    }
  }
  while (!rans.empty()){
    int now1 = tmpr_ans.top(),now2 = rans.top();//最大元素
    if (now1>now2){
      res1 -= now1-now2;
      tmpr_ans.pop();//移除堆顶的最大元素
      tmpr_ans.push(now2);//将新的较小元素 now2 插入堆中
      rans.pop();
    }else{
      break;
    }
  }
  cout<<min(res1,res)<<endl;
}
 
int main()
{
	int t;
	cin>>t;
    while (t--) solve();
}


Submission (verdict: Accepted):
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
//int main()
//{
//	int t;
//	cin>>t;
//	while(t--)
//	{
//		int n,l,r,x;
//		ll y=0;
//		int a[100000];
//		cin>>n>>l>>r;
//		x=r-l+1;
//		for(int i=1;i<=n;i++)
//		{
//			cin>>a[i];
//		}
//		sort(a+1,a+n+1);
//		for(int i=1;i<=x;i++)
//		{
//			y+=a[i];
//		}
//		cout<<y<<endl;
//	}
//	return 0;
//}
//只能一次反转
void solve()
{
	int n,l,r;
	cin>>n>>l>>r;
	ll res=0;
	vector<int>a(n+1);
	for(int i=1;i<=n;i++)
		cin>>a[i];
	priority_queue<int> tmpl_ans,tmpr_ans;
	//tmpl_ans 和 tmpr_ans 是最大堆，用于存储区间 [l, r] 内的元素。
    priority_queue<int,vector<int>,greater<int>> lans,rans;
	//lans 和 rans 是最小堆，分别用于存储区间 [1, l-1] 和 [r+1, n] 的元素。
	for(int i=l;i<=r;i++)
	{
		res+=a[i];
		tmpl_ans.push(a[i]);
		tmpr_ans.push(a[i]);
	}
	for(int i=1;i<l;i++)
		lans.push(a[i]);
	for(int i=r+1;i<=n;i++)
		rans.push(a[i]);
	
	ll res1=res;
	
  while (!lans.empty()){
    int now1 = tmpl_ans.top(),now2 = lans.top();
    if (now1>now2){
      res -= now1-now2;
      tmpl_ans.pop();
      tmpl_ans.push(now2);
      lans.pop();
    }else{
      break;
    }
  }
  while (!rans.empty()){
    int now1 = tmpr_ans.top(),now2 = rans.top();//最大元素
    if (now1>now2){
      res1 -= now1-now2;
      tmpr_ans.pop();//移除堆顶的最大元素
      tmpr_ans.push(now2);//将新的较小元素 now2 插入堆中
      rans.pop();
    }else{
      break;
    }
  }
  cout<<min(res1,res)<<endl;
}
 
int main()
{
	int t;
	cin>>t;
    while (t--) 
	{
		solve();
	}
	return 0;
}
Problem: 2050D - Digital string maximization
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
char judge(string& s,int x)
{
	int ans=0,y;
	if(s.size()-x>9)
	{
		for(int i=x;i<x+9;i++)
		{
			int a=(s[i]-'0')-i+x;
			if(a>ans)
			{
				ans=a;
				y=i;
			}
		}
	}
	else
	{
		for(int i=x,len=s.size();i<len;i++)
		{
			int a=(s[i]-'0')-i+x;
			if(a>ans)
			{
				ans=a;
				y=i;
			}
		}
	}
	if(y==x) return ans+'0';
	else
	{
		for(int i=y;i>=x;i--)
		{
			char c=s[i];
			s[i]=s[i-1];
			s[i-1]=(s[i]-'0'-1)+'0';
		}
		return ans+'0';
	}
}
void sol()
{
	string s;
	string b;
	cin>>s;
	for(int i=0,len=s.size();i<len;i++)
	{
		b+=judge(s,i); 
	}
	cout<<b<<endl;
	return;
}
int main()
{
	int t;
	t=0;
	cin>>t;
	while(t--)
	{
		sol();
	}
	return 0;
}

Submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
char judge(string& s,int x)
{
	int ans=0,y;
	if(s.size()-x>10)
	{
		for(int i=x;i<x+10;i++)
		{
			int a=(s[i]-'0')-i+x;
			if(a>ans)
			{
				ans=a;
				y=i;
			}
		}
	}
	else
	{
		for(int i=x,len=s.size();i<len;i++)
		{
			int a=(s[i]-'0')-i+x;
			if(a>ans)
			{
				ans=a;
				y=i;
			}
		}
	}
	if(y==x) return ans+'0';
	else
	{
		for(int i=y;i>=x;i--)
		{
			char c=s[i];
			s[i]=s[i-1];
			s[i-1]=(s[i]-'0'-1)+'0';
		}
		return ans+'0';
	}
}
void sol()
{
	string s;
	string b;
	cin>>s;
	for(int i=0,len=s.size();i<len;i++)
	{
		b+=judge(s,i); 
	}
	cout<<b<<endl;
	return;
}
int main()
{
	int t;
	t=0;
	cin>>t;
	while(t--)
	{
		sol();
	}
	return 0;
}
Problem: 2050D - Digital string maximization
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
char judge(string& s,int x)
{
	int ans=0,y;
	if(s.size()-x>10)
	{
		for(int i=x;i<x+10;i++)
		{
			int a=(s[i]-'0')-i+x;
			if(a>ans)
			{
				ans=a;
				y=i;
			}
		}
	}
	else
	{
		for(int i=x,len=s.size();i<len;i++)
		{
			int a=(s[i]-'0')-i+x;
			if(a>ans)
			{
				ans=a;
				y=i;
			}
		}
	}
	if(y==x) return ans+'0';
	else
	{
		for(int i=y;i>=x;i--)
		{
			char c=s[i];
			s[i]=s[i-1];
			s[i-1]=(s[i]-'0'-1)+'0';
		}
		return ans+'0';
	}
}
void sol()
{
	string s;
	string b;
	cin>>s;
	for(int i=0,len=s.size();i<len;i++)
	{
		b+=judge(s,i); 
	}
	cout<<b<<endl;
	return;
}
int main()
{
	int t;
	t=0;
	cin>>t;
	while(t--)
	{
		sol();
	}
	return 0;
}

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

void sol()
{
	string s;
	cin>>s;
	for(int i=0,len=s.size();i<len;i++)
	{
		int best=s[i]-'0',pos=i;
		for(int j=i;j<min(pos+10,(int)s.size());j++)
		{
			if(s[j]-'0'-(j-i)>best)
			{
				pos=j;
				best=s[j]-'0'-(j-i);
			}
			while(pos>i)
			{
				swap(s[pos],s[pos-1]);
				pos--;
			}
			s[i]=best+'0';
		}
	}
	cout<<s<<endl;
	return;
}
int main()
{
	int t;
	t=0;
	cin>>t;
	while(t--)
	{
		sol();
	}
	return 0;
}
Problem: 2050D - Digital string maximization
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
char judge(string& s,int x)
{
	int ans=0,y;
	if(s.size()-x>9)
	{
		for(int i=x;i<x+9;i++)
		{
			int a=(s[i]-'0')-i+x;
			if(a>ans)
			{
				ans=a;
				y=i;
			}
		}
	}
	else
	{
		for(int i=x,len=s.size();i<len;i++)
		{
			int a=(s[i]-'0')-i+x;
			if(a>ans)
			{
				ans=a;
				y=i;
			}
		}
	}
	if(y==x) return ans+'0';
	else
	{
		for(int i=y;i>=x;i--)
		{
			char c=s[i];
			s[i]=s[i-1];
			s[i-1]=(s[i]-'0'-1)+'0';
		}
		return ans+'0';
	}
}
void sol()
{
	string s;
	string b;
	cin>>s;
	for(int i=0,len=s.size();i<len;i++)
	{
		b+=judge(s,i); 
	}
	cout<<b<<endl;
	return;
}
int main()
{
	int t;
	t=0;
	cin>>t;
	while(t--)
	{
		sol();
	}
	return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
int main()
{
	//NOI;
	//freopen("road.in","r",stdin);
	//freopen("road.out","w",stdout);
	long long T;
	cin>>T;
	while(T--)
	{
		string N;
		cin>>N;
		long long n=N.length();
		long long sum=0;
		long long ssum=0,tsum=0;
		for(long long i=0;i<n;i++)
		{
			sum+=N[i]-'0';
			if(N[i]-'0'==2)tsum++;
			else if(N[i]-'0'==3)ssum++;
		}
		sum%=9;
		if(sum==0){
			cout<<"YES"<<endl;
			continue;
		}
		bool check=0;
		for(long long i=0;i<tsum;i++)
		{
			for(long long j=0;j<ssum;j++)
			{
				if((sum+i*2+j*6)%9==0){
				
					cout<<"YES";
					check=1;
					break;
				}
				
			}if(check==1)break;
		}
		if(check==0)cout<<"NO";
		cout<<endl;
	}
	//fclose(stdin);
	//fclose(stdout);
	return 0;
}


Submission (verdict: Accepted):
#include <bits/stdc++.h>
using namespace std;
int main()
{
	//NOI;
	//freopen("road.in","r",stdin);
	//freopen("road.out","w",stdout);
	long long T;
	cin>>T;
	while(T--)
	{
		string N;
		cin>>N;
		long long n=N.size();
		long long sum=0;
		long long ssum=0,tsum=0;
		for(long long i=0;i<n;i++)
		{
			sum+=N[i]-'0';
			if(N[i]-'0'==2)tsum++;
			else if(N[i]-'0'==3)ssum++;
		}
		sum%=9;
		if(sum==0){
			cout<<"YES"<<endl;
			continue;
		}
		bool check=0;
		for(long long i=0;i<=tsum;i++)
		{
			for(long long j=0;j<=ssum;j++)
			{
				if((sum+i*2+j*6)%9==0){
				
					cout<<"YES";
					check=1;
					break;
				}
				
			}if(check==1)break;
		}
		if(check==0)cout<<"NO";
		cout<<endl;
	}
	//fclose(stdin);
	//fclose(stdout);
	return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
int main()
{
	//NOI;
	//freopen("road.in","r",stdin);
	//freopen("road.out","w",stdout);
	int T;
	cin>>T;
	while(T--)
	{
		string N;
		cin>>N;
		int n=N.length();
		int sum=0;
		int ssum=0,tsum=0;
		for(int i=0;i<n;i++)
		{
			sum+=N[i]-'0';
			if(N[i]-'0'==2)tsum++;
			else if(N[i]-'0'==3)ssum++;
		}
		sum%=9;
//		cout<<sum;
		if(sum==0){
			cout<<"YES"<<endl;
			continue;
		}
		bool check=0;
		for(int i=0;i<=tsum;i++)
		{
			for(int j=0;j<=ssum;j++)
			{
				if((sum+i*2+j*6)%9==0){
				
				cout<<"YES";
				check=1;}
			}
		}
		if(check==0)cout<<"NO";
		cout<<endl;
	}
	//fclose(stdin);
	//fclose(stdout);
	return 0;
}


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
int main()
{
	//NOI;
	//freopen("road.in","r",stdin);
	//freopen("road.out","w",stdout);
	long long T;
	cin>>T;
	while(T--)
	{
		string N;
		cin>>N;
		long long n=N.length();
		long long sum=0;
		long long ssum=0,tsum=0;
		for(long long i=0;i<n;i++)
		{
			sum+=N[i]-'0';
			if(N[i]-'0'==2)tsum++;
			else if(N[i]-'0'==3)ssum++;
		}
		sum%=9;
//		cout<<sum;
		if(sum==0){
			cout<<"YES"<<endl;
			continue;
		}
		bool check=0;
		for(long long i=0;i<=tsum;i++)
		{
			for(long long j=0;j<=ssum;j++)
			{
				if((sum+i*2+j*6)%9==0){
				
				cout<<"YES";
				check=1;}
			}
		}
		if(check==0)cout<<"NO";
		cout<<endl;
	}
	//fclose(stdin);
	//fclose(stdout);
	return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
int main()
{
	//NOI;
	//freopen("road.in","r",stdin);
	//freopen("road.out","w",stdout);
	int T;
	cin>>T;
	while(T--)
	{
		string N;
		cin>>N;
		int n=N.length();
		int sum=0;
		int ssum=0,tsum=0;
		for(int i=0;i<n;i++)
		{
			sum+=N[i]-'0';
			if(N[i]-'0'==2)tsum++;
			else if(N[i]-'0'==3)ssum++;
		}
		sum%=9;
//		cout<<sum;
		if(sum==0){
			cout<<"YES"<<endl;
			continue;
		}
		bool check=0;
		for(int i=0;i<=tsum;i++)
		{
			for(int j=0;j<=ssum;j++)
			{
				if((sum+i*2+j*6)%9==0){
				
				cout<<"YES";
				check=1;}
			}
		}
		if(check==0)cout<<"NO";
		cout<<endl;
	}
	//fclose(stdin);
	//fclose(stdout);
	return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
int main()
{
	//NOI;
	//freopen("road.in","r",stdin);
	//freopen("road.out","w",stdout);
	long long T;
	cin>>T;
	while(T--)
	{
		string N;
		cin>>N;
		long long n=N.length();
		long long sum=0;
		long long ssum=0,tsum=0;
		for(long long i=0;i<n;i++)
		{
			sum+=N[i]-'0';
			if(N[i]-'0'==2)tsum++;
			else if(N[i]-'0'==3)ssum++;
		}
		sum%=9;
//		cout<<sum;
		if(sum==0){
			cout<<"YES"<<endl;
			continue;
		}
		bool check=0;
		for(long long i=0;i<=tsum;i++)
		{
			for(long long j=0;j<=ssum;j++)
			{
				if((sum+i*2+j*6)%9==0){
				
				cout<<"YES";
				check=1;}
			}
		}
		if(check==0)cout<<"NO";
		cout<<endl;
	}
	//fclose(stdin);
	//fclose(stdout);
	return 0;
}


Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
int main()
{
	//NOI;
	//freopen("road.in","r",stdin);
	//freopen("road.out","w",stdout);
	long long T;
	cin>>T;
	while(T--)
	{
		string N;
		cin>>N;
		long long n=N.length();
		long long sum=0;
		long long ssum=0,tsum=0;
		for(long long i=0;i<n;i++)
		{
			sum+=N[i]-'0';
			if(N[i]-'0'==2)tsum++;
			else if(N[i]-'0'==3)ssum++;
		}
		sum%=9;
		if(sum==0){
			cout<<"YES"<<endl;
			continue;
		}
		bool check=0;
		for(long long i=0;i<tsum;i++)
		{
			for(long long j=0;j<ssum;j++)
			{
				if((sum+i*2+j*6)%9==0){
				
					cout<<"YES";
					check=1;
					break;
				}
				
			}if(check==1)break;
		}
		if(check==0)cout<<"NO";
		cout<<endl;
	}
	//fclose(stdin);
	//fclose(stdout);
	return 0;
}
Problem: 2049B - pspspsps
Language: C++23 (GCC 14-64, msys2)


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

using namespace std;

#define int long long

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



void solve() {

    int n;

    cin >> n;

    string st;

    cin >> st;

    bool s_after_p = false;

    map<char, int> mp;

    string ans;

    

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

        if (mp[st[i]] == 0) {

            ans.push_back(st[i]);  

            mp[st[i]]++; 

        }

    }

    

    if (ans == "ps." || ans == "p.s" || ans == "ps." || ans == ".sp"||ans=="ps") {

        cout << "NO" << endl;

    } else {

        cout << "YES" << endl;

    }

}



int32_t main() {

    fastio;

    int t;

    cin >> t;

    while (t--) solve();

    return 0;

}