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>
using namespace std;
#define int long long
#define X first
#define Y second
#define endl "\n"
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define dep(i, a, b) for (int i = a; i >= b; i--)
#define lowbit(x) x & -x
#define mems(a, x) memset((a), (x), sizeof(a))
#define pb emplace_back
 
typedef pair<int, int> pii;
const int N = 2e5 + 10;
int mod = 998244353;

void solve()
{
    int n, m;
    cin >> n >> m;
    vector<int> a(n + 1), b(m + 1);
    rep(i, 1, n) cin >> a[i];
    rep(i, 1, m) cin >> b[i];

    priority_queue<int, vector<int>,greater<int>> q;
    rep(i, 1, n)q.push(a[i]);
    sort(b.begin() + 1, b.begin() + m + 1);
    int ans = 0;
    rep(i, 1, m)
    {
        int x = b[i];
        if(q.size() == 0)
        {
            ans = 1;
            break;
        }
        while(q.size() > 1 && q.top() < b[i])
        {
            int t = q.top();
            q.pop();
            if(abs(q.top() - t) > 1)ans = 1;
            t += q.top();
            q.pop();
            q.push(t);
        }
        if(q.top()!= x)ans = 1;
        q.pop();
    }
    if(q.size())ans = 1;

    if(ans == 1) cout << "No" << endl;
    else cout << "Yes" <<endl;
}
 
signed main()
{
    cin.tie(0), ios_base::sync_with_stdio(false);
    int t = 1;
    cin >> t;
    while (t--)
    {
        solve();
    }
}
 
/*
1 1 1 1
4 3 3 2 2 2 1 1 1 1
5
1 10 2 3 3
5 3 1
9
9 223 361 347 302 335 839
0 0 1 2
 */
Problem: 2061D - Kevin and Numbers
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define X first
#define Y second
#define endl "\n"
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define dep(i, a, b) for (int i = a; i >= b; i--)
#define lowbit(x) x & -x
#define mems(a, x) memset((a), (x), sizeof(a))
#define pb emplace_back
 
typedef pair<int, int> pii;
const int N = 2e5 + 10;
int mod = 998244353;

void solve()
{
    int n, m;
    cin >> n >> m;
    vector<int> a(n + 1), b(m + 1);
    rep(i, 1, n) cin >> a[i];
    rep(i, 1, m) cin >> b[i];

    priority_queue<int, vector<int>,greater<int>> q;
    rep(i, 1, n)q.push(a[i]);
    sort(b.begin() + 1, b.begin() + m + 1);
    int ans = 0;
    rep(i, 1, m)
    {
        int x = b[i];
        if(q.size() == 0)
        {
            ans = 1;
            break;
        }
        while(q.size() > 1 && q.top() < b[i])
        {
            int t = q.top();
            q.pop();
            if(abs(q.top() - t) > 1)ans = 1;
            t += q.top();
            q.pop();
            q.push(t);
        }
        if(q.top()!= x)ans = 1;
        q.pop();
    }
    if(q.size())ans = 1;

    if(ans == 1) cout << "No" << endl;
    else cout << "Yes" <<endl;
}
 
signed main()
{
    cin.tie(0), ios_base::sync_with_stdio(false);
    int t = 1;
    cin >> t;
    while (t--)
    {
        solve();
    }
}
 
/*
1 1 1 1
4 3 3 2 2 2 1 1 1 1
5
1 10 2 3 3
5 3 1
9
9 223 361 347 302 335 839
0 0 1 2
 */

Submission (verdict: Time limit exceeded on test 1):
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define X first
#define Y second
#define endl "\n"
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define dep(i, a, b) for (int i = a; i >= b; i--)
#define lowbit(x) x & -x
#define mems(a, x) memset((a), (x), sizeof(a))
#define pb emplace_back
 
typedef pair<int, int> pii;
const int N = 2e5 + 10;
int mod = 998244353;

void solve()
{
    int n, m;
    cin >> n >> m;
    vector<int> a(n + 1), b(m + 1);
    rep(i, 1, n) cin >> a[i];
    rep(i, 1, m) cin >> b[i];

    priority_queue<int>q;
    rep(i, 1, m)q.push(b[i]);
    map<int,int>mp;
    rep(i, 1, n)mp[a[i]] ++ ;

    while(q.size())
    {
        int x = q.top();
        if(mp[x] == 0)
        {
            if(x == 1)
            {
                cout << "No" << endl;
                return ;
            }
            q.push(x / 2);
            if(x % 2) q.push((x / 2 + 1));
            else q.push(x / 2);
        }
        else
        {
            mp[x] -- ;
        }
        q.pop();
    }

    rep(i, 1, n)
    {
        if(mp[a[i]])
        {
            cout << "No" << endl;
            return ;
        }
    }
    cout << "Yes" << endl;
    return ;
}
 
signed main()
{
    cin.tie(0), ios_base::sync_with_stdio(false);
    int t = 1;
    cin >> t;
    while (t--)
    {
        solve();
    }
}
 
/*
1 1 1 1
4 3 3 2 2 2 1 1 1 1
5
1 10 2 3 3
5 3 1
9
9 223 361 347 302 335 839
0 0 1 2
 */
Problem: 2061D - Kevin and Numbers
Language: C++17 (GCC 7-32)

Previous submission (verdict: Time limit exceeded on test 1):
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define X first
#define Y second
#define endl "\n"
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define dep(i, a, b) for (int i = a; i >= b; i--)
#define lowbit(x) x & -x
#define mems(a, x) memset((a), (x), sizeof(a))
#define pb emplace_back
 
typedef pair<int, int> pii;
const int N = 2e5 + 10;
int mod = 998244353;

void solve()
{
    int n, m;
    cin >> n >> m;
    vector<int> a(n + 1), b(m + 1);
    rep(i, 1, n) cin >> a[i];
    rep(i, 1, m) cin >> b[i];

    priority_queue<int>q;
    rep(i, 1, m)q.push(b[i]);
    map<int,int>mp;
    rep(i, 1, n)mp[a[i]] ++ ;

    while(q.size())
    {
        int x = q.top();
        if(mp[x] == 0)
        {
            if(x == 1)
            {
                cout << "No" << endl;
                return ;
            }
            q.push(x / 2);
            if(x % 2) q.push((x / 2 + 1));
            else q.push(x / 2);
        }
        else
        {
            mp[x] -- ;
        }
        q.pop();
    }

    rep(i, 1, n)
    {
        if(mp[a[i]])
        {
            cout << "No" << endl;
            return ;
        }
    }
    cout << "Yes" << endl;
    return ;
}
 
signed main()
{
    cin.tie(0), ios_base::sync_with_stdio(false);
    int t = 1;
    cin >> t;
    while (t--)
    {
        solve();
    }
}
 
/*
1 1 1 1
4 3 3 2 2 2 1 1 1 1
5
1 10 2 3 3
5 3 1
9
9 223 361 347 302 335 839
0 0 1 2
 */

Submission (verdict: Accepted):
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define X first
#define Y second
#define endl "\n"
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define dep(i, a, b) for (int i = a; i >= b; i--)
#define lowbit(x) x & -x
#define mems(a, x) memset((a), (x), sizeof(a))
#define pb emplace_back
 
typedef pair<int, int> pii;
const int N = 2e5 + 10;
int mod = 998244353;

void solve()
{
    int n, m;
    cin >> n >> m;
    vector<int> a(n + 1), b(m + 1);
    rep(i, 1, n) cin >> a[i];
    rep(i, 1, m) cin >> b[i];

    priority_queue<int>q;
    rep(i, 1, m)q.push(b[i]);
    map<int,int>mp;
    rep(i, 1, n)mp[a[i]] ++ ;

    int sum = 0;
    while(q.size())
    {
        int x = q.top();
        if(mp[x] == 0)
        {
            sum++;
            if(sum > n)
            {
                cout << "No" << endl;
                return ;
            }
            q.push(x / 2);
            if(x % 2) q.push((x / 2 + 1));
            else q.push(x / 2);
        }
        else
        {
            mp[x] -- ;
        }
        q.pop();
    }

    rep(i, 1, n)
    {
        if(mp[a[i]])
        {
            cout << "No" << endl;
            return ;
        }
    }
    cout << "Yes" << endl;
    return ;
}
 
signed main()
{
    cin.tie(0), ios_base::sync_with_stdio(false);
    int t = 1;
    cin >> t;
    while (t--)
    {
        solve();
    }
}
 
/*
1 1 1 1
4 3 3 2 2 2 1 1 1 1
5
1 10 2 3 3
5 3 1
9
9 223 361 347 302 335 839
0 0 1 2
 */
Problem: 2050C - Uninteresting Number
Language: PyPy 3-64

Previous submission (verdict: Time limit exceeded on test 5):
for _ in range(int(input())):
    n = input()
    
    sm = 0
    for i in str(n):
        sm += int(i)

    twos = n.count('2')
    threes = n.count('3')
    
    ans = False
    for x in range(twos+1):
        for y in range(threes+1):
            if (sm + (2*x) + (6*y))%9 == 0:
                ans = True

    print("YES" if ans else "NO")

Submission (verdict: Accepted):
for _ in range(int(input())):
    n = input()
    
    sm = 0
    for i in str(n):
        sm += int(i)

    twos = n.count('2')
    threes = n.count('3')
    
    ans = False
    for x in range(min(twos+1, 9)):
        for y in range(min(threes+1, 9)):
            if (sm + (2*x) + (6*y))%9 == 0:
                ans = True

    print("YES" if ans else "NO")
Problem: 2050C - Uninteresting Number
Language: PyPy 3-64

Previous submission (verdict: Runtime error on test 4):
for _ in range(int(input())):
    n = int(input())
    
    sm = 0
    for i in str(n):
        sm += int(i)
    
    if sm % 9 == 0:
        print("YES")
        continue

    twos = str(n).count('2')
    threes = str(n).count('3')
    
    c = sm%9
    ans = str()
    if c == 1:
        ans = (twos >= 1 and threes >= 1) or (twos >= 4)
    elif c == 2:
        ans = (threes >= 2 and twos >= 2) or (twos >= 8) or (threes >= 1 and twos >= 5)
    elif c == 3:
        ans = (threes >= 1) or (twos >= 3)
    elif c == 4:
        ans = (threes >= 2 and twos >= 1) or (twos >= 7) or (threes >= 1 and twos >= 4)
    elif c == 5:
        ans = (twos >= 2)
    elif c == 6:
        ans = (threes >= 2) or (twos >= 6) or (threes >= 1 and twos >= 3)
    elif c == 7:
        ans = (twos >= 1)
    elif c == 8:
        ans = (threes >= 1 and twos >= 2) or (twos >= 5)

    print("YES" if ans else "NO")



Submission (verdict: Runtime error on test 4):
for _ in range(int(input())):
    n = int(input())
    
    sm = 0
    for i in str(n):
        sm += int(i)
    
    if sm % 9 == 0:
        print("YES")
        continue

    twos = str(n).count('2')
    threes = str(n).count('3')
    
    c = sm%9
    ans = False
    if c == 1:
        ans = (twos >= 1 and threes >= 1) or (twos >= 4)
    elif c == 2:
        ans = (threes >= 2 and twos >= 2) or (twos >= 8) or (threes >= 1 and twos >= 5)
    elif c == 3:
        ans = (threes >= 1) or (twos >= 3)
    elif c == 4:
        ans = (threes >= 2 and twos >= 1) or (twos >= 7) or (threes >= 1 and twos >= 4)
    elif c == 5:
        ans = (twos >= 2)
    elif c == 6:
        ans = (threes >= 2) or (twos >= 6) or (threes >= 1 and twos >= 3)
    elif c == 7:
        ans = (twos >= 1)
    elif c == 8:
        ans = (threes >= 1 and twos >= 2) or (twos >= 5)

    print("YES" if ans else "NO")
Problem: 2050C - Uninteresting Number
Language: PyPy 3-64

Previous submission (verdict: Runtime error on test 4):
for _ in range(int(input())):
    n = int(input())
    
    sm = 0
    for i in str(n):
        sm += int(i)
    
    if sm % 9 == 0:
        print("YES")
        continue

    twos = str(n).count('2')
    threes = str(n).count('3')
    
    ans = False
    for x in range(twos+1):
        for y in range(threes+1):
            if (sm + (2*x) + (6*y))%9 == 0:
                ans = True

    print("YES" if ans else "NO")

Submission (verdict: Time limit exceeded on test 5):
for _ in range(int(input())):
    n = input()
    
    sm = 0
    for i in str(n):
        sm += int(i)

    twos = n.count('2')
    threes = n.count('3')
    
    ans = False
    for x in range(twos+1):
        for y in range(threes+1):
            if (sm + (2*x) + (6*y))%9 == 0:
                ans = True

    print("YES" if ans else "NO")
Problem: 2050C - Uninteresting Number
Language: PyPy 3-64


Submission (verdict: Runtime error on test 4):
for _ in range(int(input())):
    n = int(input())
    
    sm = 0
    for i in str(n):
        sm += int(i)
    
    if sm % 9 == 0:
        print("YES")
        continue

    twos = str(n).count('2')
    threes = str(n).count('3')
    
    c = sm%9
    ans = str()
    if c == 1:
        ans = (twos >= 1 and threes >= 1) or (twos >= 4)
    elif c == 2:
        ans = (threes >= 2 and twos >= 2) or (twos >= 8) or (threes >= 1 and twos >= 5)
    elif c == 3:
        ans = (threes >= 1) or (twos >= 3)
    elif c == 4:
        ans = (threes >= 2 and twos >= 1) or (twos >= 7) or (threes >= 1 and twos >= 4)
    elif c == 5:
        ans = (twos >= 2)
    elif c == 6:
        ans = (threes >= 2) or (twos >= 6) or (threes >= 1 and twos >= 3)
    elif c == 7:
        ans = (twos >= 1)
    elif c == 8:
        ans = (threes >= 1 and twos >= 2) or (twos >= 5)

    print("YES" if ans else "NO")
Problem: 2050C - Uninteresting Number
Language: PyPy 3-64

Previous submission (verdict: Runtime error on test 4):
for _ in range(int(input())):
    n = int(input())
    
    sm = 0
    for i in str(n):
        sm += int(i)
    
    if sm % 9 == 0:
        print("YES")
        continue

    twos = str(n).count('2')
    threes = str(n).count('3')
    
    c = sm%9
    ans = False
    if c == 1:
        ans = (twos >= 1 and threes >= 1) or (twos >= 4)
    elif c == 2:
        ans = (threes >= 2 and twos >= 2) or (twos >= 8) or (threes >= 1 and twos >= 5)
    elif c == 3:
        ans = (threes >= 1) or (twos >= 3)
    elif c == 4:
        ans = (threes >= 2 and twos >= 1) or (twos >= 7) or (threes >= 1 and twos >= 4)
    elif c == 5:
        ans = (twos >= 2)
    elif c == 6:
        ans = (threes >= 2) or (twos >= 6) or (threes >= 1 and twos >= 3)
    elif c == 7:
        ans = (twos >= 1)
    elif c == 8:
        ans = (threes >= 1 and twos >= 2) or (twos >= 5)

    print("YES" if ans else "NO")



Submission (verdict: Runtime error on test 4):
for _ in range(int(input())):
    n = int(input())
    
    sm = 0
    for i in str(n):
        sm += int(i)
    
    if sm % 9 == 0:
        print("YES")
        continue

    twos = str(n).count('2')
    threes = str(n).count('3')
    
    ans = False
    for x in range(twos+1):
        for y in range(threes+1):
            if (sm + (2*x) + (6*y))%9 == 0:
                ans = True

    print("YES" if ans else "NO")
Problem: 2057C - Trip to the Olympiad
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
#define pii pair<int, int>
#define x first
#define int long long
#define y second
#define bitget(x, i) ((x >> i) & 1)
#define lowbit(x) (x & -x)
#define inf 1e18

void solve()
{
	int l, r;	cin >> l >> r;
	int s = 1;
	while(r)
	{
		r /= 2;
		s *= 2;
		if(r < 2)break;
	}
	int a = s, b = s - 1, c = l;
	if(b == c)b = s + 1;
	cout << a << " " << b << " " << c << endl;
}

signed main()
{
	//freopen("C:/Users/33943/Desktop/1.in","r",stdin);
	//freopen("C:/Users/33943/Desktop/1.out","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int tt = 1;	cin >> tt;
	while(tt--)
	{
		solve();
	}
}






Submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
#define pii pair<int, int>
#define x first
#define int long long
#define y second
#define bitget(x, i) ((x >> i) & 1)
#define lowbit(x) (x & -x)
#define inf 1e18

void solve()
{
	int l, r;	cin >> l >> r;
	int a, b, c;
	int k = 0;
	while(1)
	{
		int s = 1, x = r;
		while(x)
		{
			x /= 2;
			s *= 2;
			if(x < 2)break;
		}
		a = s;	b = s - 1; c = l;
		if(a <= c || b <= c)
		{
			//cout << a << " " << b << " " << c << endl;
			l -= s;
			r -= s;
			k |= s;
		}
		else
		{
			cout << a + k << " " << b + k << " " << c + k << endl;
			return;
		}
	}
//int a, b , c;	cin >> a >> b >> c;
//cout << (a ^ b) + (b ^ c) + (c ^ a) << endl;
}

signed main()
{
	//freopen("C:/Users/33943/Desktop/1.in","r",stdin);
	//freopen("C:/Users/33943/Desktop/1.out","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int tt = 1;	cin >> tt;
	while(tt--)
	{
		solve();
	}
}
Problem: 2057C - Trip to the Olympiad
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
#define pii pair<int, int>
#define x first
#define int long long
#define y second
#define bitget(x, i) ((x >> i) & 1)
#define lowbit(x) (x & -x)
#define inf 1e18

void solve()
{
	int l, r;	cin >> l >> r;
	int a, b, c;
	int k = 0;
	while(1)
	{
		int s = 1, x = r;
		while(x)
		{
			x /= 2;
			s *= 2;
			if(x < 2)break;
		}
		a = s;	b = s - 1; c = l;
		if(a <= c || b <= c)
		{
			//cout << a << " " << b << " " << c << endl;
			l -= s;
			r -= s;
			k |= s;
		}
		else
		{
			cout << a + k << " " << b + k << " " << c + k << endl;
			return;
		}
	}
//int a, b , c;	cin >> a >> b >> c;
//cout << (a ^ b) + (b ^ c) + (c ^ a) << endl;
}

signed main()
{
	//freopen("C:/Users/33943/Desktop/1.in","r",stdin);
	//freopen("C:/Users/33943/Desktop/1.out","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int tt = 1;	cin >> tt;
	while(tt--)
	{
		solve();
	}
}






Submission (verdict: Accepted):
#include<bits/stdc++.h>
using namespace std;
#define pii pair<int, int>
#define x first
#define int long long
#define y second
#define bitget(x, i) ((x >> i) & 1)
#define lowbit(x) (x & -x)
#define inf 1e18

void solve()
{
	int l, r;	cin >> l >> r;
	int a, b, c;
	int k = 0;
	while(1)
	{
		int s = 1, x = r;
		while(x)
		{
			x /= 2;
			s *= 2;
			if(x < 2)break;
		}
		a = s;	b = s - 1; c = l;
		if(b == c)
		{
			b = s + 1;
		}
		if(a <= c)
		{
			//cout << a << " " << b << " " << c << endl;
			l -= s;
			r -= s;
			k |= s;
		}
		else
		{
			cout << a + k << " " << b + k << " " << c + k << endl;
			return;
		}
	}
//int a, b , c;	cin >> a >> b >> c;
//cout << (a ^ b) + (b ^ c) + (c ^ a) << endl;
}

signed main()
{
	//freopen("C:/Users/33943/Desktop/1.in","r",stdin);
	//freopen("C:/Users/33943/Desktop/1.out","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int tt = 1;	cin >> tt;
	while(tt--)
	{
		solve();
	}
}
Problem: 2057C - Trip to the Olympiad
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
#define pii pair<int, int>
#define x first
#define int long long
#define y second
#define bitget(x, i) ((x >> i) & 1)
#define lowbit(x) (x & -x)
#define inf 1e18

void solve()
{
	int l, r;	cin >> l >> r;
	int s = 1;
	while(r)
	{
		r /= 2;
		s *= 2;
		if(r < 2)break;
	}
	cout << (s) << " " << (s - 1) << " " <<  (l) << endl;
}

signed main()
{
	//freopen("C:/Users/33943/Desktop/1.in","r",stdin);
	//freopen("C:/Users/33943/Desktop/1.out","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int tt = 1;	cin >> tt;
	while(tt--)
	{
		solve();
	}
}
Problem: 2057C - Trip to the Olympiad
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
#define pii pair<int, int>
#define x first
#define int long long
#define y second
#define bitget(x, i) ((x >> i) & 1)
#define lowbit(x) (x & -x)
#define inf 1e18

void solve()
{
	int l, r;	cin >> l >> r;
	int s = 1;
	while(r)
	{
		r /= 2;
		s *= 2;
		if(r < 2)break;
	}
	cout << (s) << " " << (s - 1) << " " <<  (l) << endl;
}

signed main()
{
	//freopen("C:/Users/33943/Desktop/1.in","r",stdin);
	//freopen("C:/Users/33943/Desktop/1.out","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int tt = 1;	cin >> tt;
	while(tt--)
	{
		solve();
	}
}






Submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
#define pii pair<int, int>
#define x first
#define int long long
#define y second
#define bitget(x, i) ((x >> i) & 1)
#define lowbit(x) (x & -x)
#define inf 1e18

void solve()
{
	int l, r;	cin >> l >> r;
	int s = 1;
	while(r)
	{
		r /= 2;
		s *= 2;
		if(r < 2)break;
	}
	int a = s, b = s - 1, c = l;
	if(b == c)b = s + 1;
	cout << a << " " << b << " " << c << endl;
}

signed main()
{
	//freopen("C:/Users/33943/Desktop/1.in","r",stdin);
	//freopen("C:/Users/33943/Desktop/1.out","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int tt = 1;	cin >> tt;
	while(tt--)
	{
		solve();
	}
}
Problem: 2050D - Digital string maximization
Language: C++17 (GCC 7-32)

Previous submission (verdict: Time limit exceeded on test 6):
#include<bits/stdc++.h>
using namespace std;
int main () {
	int t; cin >> t;
	while (t--) {
		string s;
		cin >> s;
		int n = s.size();
		int a[n];
		for (int i = 0; i < n; i++) {
			a[i] = s[i] - '0' - i;
		}
		for (int i = 0; i < n; i++) {
			int m = a[i], im = i;
			for (int j = i + 1; j < n; j++) {
				if (a[j] > m) {
					im = j, m = a[j];
				}
			}
			int t, t1 = m + 1;
			for (int j = i; j <= im; j++) {
				t = a[j];
				a[j] = t1 - 1;
				t1 = t;
			}
		}
		for (int i = 0; i < n; i++) 
			cout << a[i] + i;
		cout << endl;
	}
	return 0;
}


Submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
int main () {
	int t; cin >> t;
	while (t--) {
		string s;
		cin >> s;
		int n = s.size();
		int a[n], m = 0;
		for (int i = 0; i < n; i++) {
			a[i] = s[i] - '0' - i;
		}
		for (int i = 0; i < n; i++) {
			int m = a[i], im = i;
			for (int j = i; j < n and j < i + 10; j++) {
				if (a[i] > m) {
					im = i, m = a[i];
				}
			}
			int t, t1 = m + 1;
			for (int j = i; j <= im; j++) {
				t = a[j];
				a[j] = t1 - 1;
				t1 = t;
			}
		}
		for (int i = 0; i < n; i++) 
			cout << a[i] + i;
		cout << endl;
	}
	return 0;
}
Problem: 2050D - Digital string maximization
Language: C++17 (GCC 7-32)


Submission (verdict: Time limit exceeded on test 6):
#include<bits/stdc++.h>
using namespace std;
int main () {
	int t; cin >> t;
	while (t--) {
		string s;
		cin >> s;
		int n = s.size();
		int a[n];
		for (int i = 0; i < n; i++) {
			a[i] = s[i] - '0' - i;
		}
		for (int i = 0; i < n; i++) {
			int m = a[i], im = i;
			for (int j = i + 1; j < n; j++) {
				if (a[j] > m) {
					im = j, m = a[j];
				}
			}
			int t, t1 = m + 1;
			for (int j = i; j <= im; j++) {
				t = a[j];
				a[j] = t1 - 1;
				t1 = t;
			}
		}
		for (int i = 0; i < n; i++) 
			cout << a[i] + i;
		cout << endl;
	}
	return 0;
}
Problem: 2050D - Digital string maximization
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
int main () {
	int t; cin >> t;
	while (t--) {
		string s;
		cin >> s;
		int n = s.size();
		int a[n], m = 0;
		for (int i = 0; i < n; i++) {
			a[i] = s[i] - '0' - i;
		}
		for (int i = 0; i < n; i++) {
			int m = a[i], im = i;
			for (int j = i; j < n and j < i + 10; j++) {
				if (a[i] > m) {
					im = i, m = a[i];
				}
			}
			int t, t1 = m + 1;
			for (int j = i; j <= im; j++) {
				t = a[j];
				a[j] = t1 - 1;
				t1 = t;
			}
		}
		for (int i = 0; i < n; i++) 
			cout << a[i] + i;
		cout << endl;
	}
	return 0;
}


Submission (verdict: Accepted):
#include<bits/stdc++.h>
using namespace std;
int main () {
	int t; cin >> t;
	while (t--) {
		string s;
		cin >> s;
		int n = s.size();
		int a[n];
		for (int i = 0; i < n; i++) {
			a[i] = s[i] - '0' - i;
		}
		for (int i = 0; i < n; i++) {
			int m = a[i], im = i;
			for (int j = i; j < n and j < i + 10; j++) {
				if (a[j] > m) {
					im = j, m = a[j];
				}
			}
			int t, t1 = m + 1;
			for (int j = i; j <= im; j++) {
				t = a[j];
				a[j] = t1 - 1;
				t1 = t;
			}
		}
		for (int i = 0; i < n; i++) 
			cout << a[i] + i;
		cout << endl;
	}
	return 0;
}
Problem: 2057B - Gorilla and the Exam
Language: C++23 (GCC 14-64, msys2)


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

using namespace std;

int main(){
    short t; cin>>t; int n,k;

    while(t--){
        cin>>n>>k;

        vector<int> a(n);

        for(int i=0;i<n;i++) cin>>a[i];

        sort(a.begin(), a.end());
        int count=0;
        while(!a.empty()){
            for(int i=0;i<k;i++)
            {
                a.insert(a.begin(), a.front());a.pop_back();
            }
            a.erase(remove(a.begin(), a.end(), a.front()), a.end());
            count++;
        }
        
        cout << count << endl;
    }
    return 0;
}