ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2061D - Kevin and Numbers
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 3):
#include <iostream>
#include <vector>
#include <cmath>
#include <set>

using namespace std;

typedef long long ll;

bool rec(int n, multiset<int>& s) {
    if (s.find(n) != s.end()) {
        s.erase(s.find(n));
        return true;
    }

    if (n == 1) {
        return false;
    }

    return rec((n + 1)/ 2, s) && rec(n / 2, s);
}

void solve() {
    int n, m;
    cin >> n >> m;

    multiset<int> s;

    vector<int> v(m);
    for (int i = 0; i < n; ++i) {
        int k; cin >> k;
        s.insert(k);
    }

    for (int i = 0; i < m; ++i) {
        cin >> v[i];
        if (!rec(v[i], s)) {
            cout << "No" << endl;
            return;
        }
    }

    if (s.empty()) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

int main() {
    int t; cin >> t;
    for (; t > 0; --t) {
        solve();
    }
}

Submission (verdict: Accepted):
#include <iostream>
#include <vector>
#include <cmath>
#include <set>
#include <algorithm>

using namespace std;

typedef long long ll;

bool rec(int n, multiset<int>& s) {
    if (s.find(n) != s.end()) {
        s.erase(s.find(n));
        return true;
    }

    if (n == 1) {
        return false;
    }

    return rec((n + 1)/ 2, s) && rec(n / 2, s);
}

void solve() {
    int n, m;
    cin >> n >> m;

    multiset<int> s;

    vector<int> v(m);
    for (int i = 0; i < n; ++i) {
        int k; cin >> k;
        s.insert(k);
    }
    for (int i = 0; i < m; ++i) {
        cin >> v[i];
    }

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

    for (int i = 0; i < m; ++i) {
        if (!rec(v[i], s)) {
            cout << "No" << endl;
            return;
        }
    }

    if (s.empty()) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

int main() {
    int t; cin >> t;
    for (; t > 0; --t) {
        solve();
    }
}
Problem: 2061D - Kevin and Numbers
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 1):
#include <iostream>
#include <vector>
#include <cmath>
#include <set>

using namespace std;

typedef long long ll;

bool rec(int n, multiset<int>& s) {
	if (s.find(n) != s.end()) {
		s.erase(n);
		return true;
	}
	
	if (n == 1) {
		return false;
	}
	
	return rec((n + 1)/ 2, s) && rec(n / 2, s);
}

void solve() {
	int n, m;
	cin >> n >> m;
	
	multiset<int> s;
	
	vector<int> v(m);
	for (int i = 0; i < n; ++i) {
		int k; cin >> k;
		s.insert(k);
	}
	
	for (int i = 0; i < m; ++i) {
		cin >> v[i];
		if (!rec(v[i], s)) {
			cout << "No";
			return;
		}
	}
	
	if (s.empty()) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
}

int main() {
	int t; cin >> t;
	for (; t > 0; --t) {
		solve();
	}
}



Submission (verdict: Wrong answer on test 3):
#include <iostream>
#include <vector>
#include <cmath>
#include <set>

using namespace std;

typedef long long ll;

bool rec(int n, multiset<int>& s) {
    if (s.find(n) != s.end()) {
        s.erase(s.find(n));
        return true;
    }

    if (n == 1) {
        return false;
    }

    return rec((n + 1)/ 2, s) && rec(n / 2, s);
}

void solve() {
    int n, m;
    cin >> n >> m;

    multiset<int> s;

    vector<int> v(m);
    for (int i = 0; i < n; ++i) {
        int k; cin >> k;
        s.insert(k);
    }

    for (int i = 0; i < m; ++i) {
        cin >> v[i];
        if (!rec(v[i], s)) {
            cout << "No" << endl;
            return;
        }
    }

    if (s.empty()) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

int main() {
    int t; cin >> t;
    for (; t > 0; --t) {
        solve();
    }
}
Problem: 2061D - Kevin and Numbers
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 1):
#include <iostream>
#include <vector>
#include <cmath>
#include <set>

using namespace std;

typedef long long ll;

bool rec(int n, multiset<int>& s) {
	if (s.find(n) != s.end()) {
		s.erase(n);
		return true;
	}
	
	if (n == 1) {
		return false;
	}
	
	return rec((n + 1)/ 2, s) && rec(n / 2, s);
}

void solve() {
	int n, m;
	cin >> n >> m;
	
	multiset<int> s;
	
	vector<int> v(m);
	for (int i = 0; i < n; ++i) {
		int k; cin >> k;
		s.insert(k);
	}
	
	for (int i = 0; i < m; ++i) {
		cin >> v[i];
		if (!rec(v[i], s)) {
			cout << "No";
			return;
		}
	}
	
	if (s.empty()) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
}

int main() {
	int t; cin >> t;
	for (; t > 0; --t) {
		solve();
	}
}
Problem: 2063C - Remove Exactly Two
Language: C++23 (GCC 14-64, msys2)

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

using namespace std;
const int N = 2e5 + 5;
int t;
int n, u, v, ans, d[N], d1[N];
vector<int> a[N];
void dfs(int u, int p) {
    d[u] = a[u].size();
    int mx = 0, mx1 = 0;
    for(auto& v : a[u]) {
        if(v != p) {
            dfs(v, u);
            d[u] = max(d[u], d[v]);
            d1[u] = max(d1[u], (int) a[v].size());
            mx1 = max(mx1, d1[v]);
            ans = max(ans, (int) a[v].size() + (int) a[u].size() - 2);
            ans = max(ans, mx + d[v] - 1);
            mx = max(mx, d[v]);
        }
    }
    ans = max(ans, mx1 + (int) a[u].size() - 1);
}
void solve() {
    ans = 0;
    dfs(1, 0);
    cout << ans << '\n';
}
void input() {
	cin >> t;
	while(t--) {
        cin >> n;
        for(int i = 1; i <= n; i++) {
            a[i].clear();
            d[i] = 0;
            d1[i] = 0;
        }
        for(int i = 1; i <= n - 1; i++) {
            cin >> u >> v;
            a[u].push_back(v);
            a[v].push_back(u);
        }
		solve();
	}
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	input();
	return 0;
}


Submission (verdict: Time limit exceeded on test 5):
#include <bits/stdc++.h>

using namespace std;
const int N = 2e5 + 5;
int t;
int n, u, v, ans, d[N];
set<pair<int, int> > c;
vector<int> a[N];
void dfs(int u, int p) {
    for(auto& v : a[u]) {
        if(v != p) {
            dfs(v, u);
            ans = max(ans, (int) a[v].size() + (int) a[u].size() - 2);
        }
    }
}
bool cmp(int x, int y) {
    if(a[x].size() == a[y].size())return x < y;
    return a[x].size() > a[y].size();
}
void solve() {
    ans = 0;
    dfs(1, 0);
    sort(d + 1, d + n + 1, cmp);
    for(int i = 1; i <= n; i++) {
        for(int j = i + 1; j <= n; j++) {
            if(c.find({d[i], d[j]}) == c.end()) {
                ans = max(ans, (int) a[d[i]].size() + (int) a[d[j]].size() - 1);
            }
        }
    }
    cout << ans << '\n';
}
void input() {
	cin >> t;
	while(t--) {
        cin >> n;
        c.clear();
        for(int i = 1; i <= n; i++) {
            a[i].clear();
            d[i] = i;
        }
        for(int i = 1; i <= n - 1; i++) {
            cin >> u >> v;
            c.insert({u, v});
            c.insert({v, u});
            a[u].push_back(v);
            a[v].push_back(u);
        }
		solve();
	}
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	input();
	return 0;
}
Problem: 2063C - Remove Exactly Two
Language: C++23 (GCC 14-64, msys2)


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

using namespace std;
const int N = 2e5 + 5;
int t;
int n, u, v, ans, d[N], d1[N];
vector<int> a[N];
void dfs(int u, int p) {
    d[u] = a[u].size();
    int mx = 0, mx1 = 0;
    for(auto& v : a[u]) {
        if(v != p) {
            dfs(v, u);
            d[u] = max(d[u], d[v]);
            d1[u] = max(d1[u], (int) a[v].size());
            mx1 = max(mx1, d1[v]);
            ans = max(ans, (int) a[v].size() + (int) a[u].size() - 2);
            ans = max(ans, mx + d[v] - 1);
            mx = max(mx, d[v]);
        }
    }
    ans = max(ans, mx1 + (int) a[u].size() - 1);
}
void solve() {
    ans = 0;
    dfs(1, 0);
    cout << ans << '\n';
}
void input() {
	cin >> t;
	while(t--) {
        cin >> n;
        for(int i = 1; i <= n; i++) {
            a[i].clear();
            d[i] = 0;
            d1[i] = 0;
        }
        for(int i = 1; i <= n - 1; i++) {
            cin >> u >> v;
            a[u].push_back(v);
            a[v].push_back(u);
        }
		solve();
	}
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	input();
	return 0;
}
Problem: 2063C - Remove Exactly Two
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Time limit exceeded on test 5):
#include <bits/stdc++.h>

using namespace std;
const int N = 2e5 + 5;
int t;
int n, u, v, ans, d[N];
set<pair<int, int> > c;
vector<int> a[N];
void dfs(int u, int p) {
    for(auto& v : a[u]) {
        if(v != p) {
            dfs(v, u);
            ans = max(ans, (int) a[v].size() + (int) a[u].size() - 2);
        }
    }
}
bool cmp(int x, int y) {
    if(a[x].size() == a[y].size())return x < y;
    return a[x].size() > a[y].size();
}
void solve() {
    ans = 0;
    dfs(1, 0);
    sort(d + 1, d + n + 1, cmp);
    for(int i = 1; i <= n; i++) {
        for(int j = i + 1; j <= n; j++) {
            if(c.find({d[i], d[j]}) == c.end()) {
                ans = max(ans, (int) a[d[i]].size() + (int) a[d[j]].size() - 1);
            }
        }
    }
    cout << ans << '\n';
}
void input() {
	cin >> t;
	while(t--) {
        cin >> n;
        c.clear();
        for(int i = 1; i <= n; i++) {
            a[i].clear();
            d[i] = i;
        }
        for(int i = 1; i <= n - 1; i++) {
            cin >> u >> v;
            c.insert({u, v});
            c.insert({v, u});
            a[u].push_back(v);
            a[v].push_back(u);
        }
		solve();
	}
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	input();
	return 0;
}


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

using namespace std;
const int N = 2e5 + 5;
int t;
int n, u, v, ans, d[N];
set<pair<int, int> > c;
vector<int> a[N];
void dfs(int u, int p) {
    for(auto& v : a[u]) {
        if(v != p) {
            dfs(v, u);
            ans = max(ans, (int) a[v].size() + (int) a[u].size() - 2);
        }
    }
}
bool cmp(int x, int y) {
    if(a[x].size() == a[y].size())return x < y;
    return a[x].size() > a[y].size();
}
void solve() {
    ans = 0;
    dfs(1, 0);
    sort(d + 1, d + n + 1, cmp);
    for(int i = 1; i <= n; i++) {
        for(int j = i + 1; j <= n; j++) {
            if(c.find({d[i], d[j]}) == c.end()) {
                ans = max(ans, (int) a[d[i]].size() + (int) a[d[j]].size() - 1);
                break;
            }
        }
    }
    cout << ans << '\n';
}
void input() {
	cin >> t;
	while(t--) {
        cin >> n;
        c.clear();
        for(int i = 1; i <= n; i++) {
            a[i].clear();
            d[i] = i;
        }
        for(int i = 1; i <= n - 1; i++) {
            cin >> u >> v;
            c.insert({u, v});
            c.insert({v, u});
            a[u].push_back(v);
            a[v].push_back(u);
        }
		solve();
	}
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	input();
	return 0;
}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 1):
#include<iostream>

#include<algorithm>

#include<iomanip>

#include<cmath>

#include<math.h>

#include <vector>

#include <map>

#include <set>

#include<string>

#include <cstring>

#include <stack>

#include<queue>



using namespace std;

#define int long long

typedef pair<int,int> PII;

typedef vector<int> vi;

typedef vector<char> vc;



const int N =2e5+10, INF = 0x3f3f3f3f,mod=1e9+7;

int a[N];

int dx[]={-1,-1,1,1};

int dy[]={1,-1,1,-1};



void solve() {

	int n,l,r;

	cin>>n>>l>>r;

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

		cin>>a[i];

	} 

	int len = r-l+1;

	if(l==r){

		cout<<0<<'\n';

		return ; 

	}

	sort(a+1,a+1+n);

	int sum = 0;

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

		sum+=a[i];

	}

	

	cout<<sum<<'\n';

}



signed main(){

	ios::sync_with_stdio(false);

	cin.tie(0);



	int t=1;



	cin>>t;

	while(t--){

		solve();

	}

    return 0;

}





Submission (verdict: Accepted):
#include<iostream>

#include<algorithm>

#include<iomanip>

#include<cmath>

#include<math.h>

#include <vector>

#include <map>

#include <set>

#include<string>

#include <cstring>

#include <stack>

#include<queue>



using namespace std;

#define int long long

typedef pair<int,int> PII;

typedef vector<int> vi;

typedef vector<char> vc;



const int N =2e5+10, INF = 0x3f3f3f3f,mod=1e9+7;

int a[N],b[N];

int dx[]={-1,-1,1,1};

int dy[]={1,-1,1,-1};



void solve() {

	int n,l,r;

	cin>>n>>l>>r;

	int idx1 = 1,idx = 1;

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

		int x;cin>>x;

		if(i<=r){

			a[idx1++] = x;

		}

		if(i>=l){

			b[idx++] = x;

		}

	} 

	int len = r-l+1;

	

	sort(a+1,a+idx1);

	sort(b+1,b+idx);

	int sum1 = 0,sum2 = 0;

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

		sum1+=a[i];

		sum2+=b[i];

	}

	

	cout<<min(sum1,sum2)<<'\n';

}



signed main(){

	ios::sync_with_stdio(false);

	cin.tie(0);



	int t=1;



	cin>>t;

	while(t--){

		solve();

	}

    return 0;

}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 2):
#include<iostream>

#include<algorithm>

#include<iomanip>

#include<cmath>

#include<math.h>

#include <vector>

#include <map>

#include <set>

#include<string>

#include <cstring>

#include <stack>

#include<queue>



using namespace std;

#define int long long

typedef pair<int,int> PII;

typedef vector<int> vi;

typedef vector<char> vc;



const int N =2e5+10, INF = 0x3f3f3f3f,mod=1e9+7;

int a[N];

int dx[]={-1,-1,1,1};

int dy[]={1,-1,1,-1};



void solve() {

	int n,l,r;

	cin>>n>>l>>r;

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

		cin>>a[i];

	} 

	int len = r-l+1;

	sort(a+1,a+1+n);

	int sum = 0;

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

		sum+=a[i];

	}

	

	cout<<sum<<'\n';

}



signed main(){

	ios::sync_with_stdio(false);

	cin.tie(0);



	int t=1;



	cin>>t;

	while(t--){

		solve();

	}

    return 0;

}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include<iostream>

#include<algorithm>

#include<iomanip>

#include<cmath>

#include<math.h>

#include <vector>

#include <map>

#include <set>

#include<string>

#include <cstring>

#include <stack>

#include<queue>



using namespace std;

#define int long long

typedef pair<int,int> PII;

typedef vector<int> vi;

typedef vector<char> vc;



const int N =2e5+10, INF = 0x3f3f3f3f,mod=1e9+7;

int a[N];

int dx[]={-1,-1,1,1};

int dy[]={1,-1,1,-1};



void solve() {

	int n,l,r;

	cin>>n>>l>>r;

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

		cin>>a[i];

	} 

	int len = r-l+1;

	sort(a+1,a+1+n);

	int sum = 0;

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

		sum+=a[i];

	}

	

	cout<<sum<<'\n';

}



signed main(){

	ios::sync_with_stdio(false);

	cin.tie(0);



	int t=1;



	cin>>t;

	while(t--){

		solve();

	}

    return 0;

}





Submission (verdict: Wrong answer on test 1):
#include<iostream>

#include<algorithm>

#include<iomanip>

#include<cmath>

#include<math.h>

#include <vector>

#include <map>

#include <set>

#include<string>

#include <cstring>

#include <stack>

#include<queue>



using namespace std;

#define int long long

typedef pair<int,int> PII;

typedef vector<int> vi;

typedef vector<char> vc;



const int N =2e5+10, INF = 0x3f3f3f3f,mod=1e9+7;

int a[N];

int dx[]={-1,-1,1,1};

int dy[]={1,-1,1,-1};



void solve() {

	int n,l,r;

	cin>>n>>l>>r;

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

		cin>>a[i];

	} 

	int len = r-l+1;

	if(l==r){

		cout<<0<<'\n';

		return ; 

	}

	sort(a+1,a+1+n);

	int sum = 0;

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

		sum+=a[i];

	}

	

	cout<<sum<<'\n';

}



signed main(){

	ios::sync_with_stdio(false);

	cin.tie(0);



	int t=1;



	cin>>t;

	while(t--){

		solve();

	}

    return 0;

}
Problem: 2050E - Three Strings
Language: GNU C11


Submission (verdict: Compilation error):
#include<stdio.h>
#include<string.h>

// Function to calculate the minumum changes
int minChanges(char a[], char b[], char c[], int len_a, int len_b)
{
    int i = 0, j = 0, k = 0;
    int changes = 0;
    
    // Traverse the combined length of a and b
    while (k < len_a + len_b)
    {
        if (i < len_a && a[i] == c[k])
        {
            i++;
        }
         else if (j < len_b && b[j] == c[k])
         {
             j++;
         }
          else 
          {
              changes++;
          }
          k++;
    }
     return changes;
}

int main()
{
    int t;
    scanf("%d", &t);
    
    while (t--)
    {
        char a[1001], b[1001], c[2002];
        scanf("%s %s %s", a, b, c);
        
        int len_a = strlen(a);
        int len_b = strlen(b);
        
        int result = minchanges(a, b, c, len_a, len_b);
        
        // Print the minimum number of changes
        printf("%d\n", result);
    }
    
     return 0;
}
Problem: 2050E - Three Strings
Language: GNU C11

Previous submission (verdict: Wrong answer on test 1):
#include <stdio.h>
#include <string.h>

// Function prototype
int minChanges(char a[], char b[], char c[], int len_a, int len_b);

// Function to calculate the minimum changes
int minChanges(char a[], char b[], char c[], int len_a, int len_b) {
    int i = 0, j = 0, k = 0;
    int changes = 0;
    
    // Traverse the combined length of a and b
    while (k < len_a + len_b) {
        if (i < len_a && a[i] == c[k]) {
            i++;
        } else if (j < len_b && b[j] == c[k]) {
            j++;
        } else {
            changes++;
        }
        k++;
    }
    return changes;
}

int main() {
    int t;
    scanf("%d", &t);
    
    while (t--) {
        char a[1001], b[1001], c[2002];
        scanf("%s %s %s", a, b, c);
        
        int len_a = (int)strlen(a);
        int len_b = (int)strlen(b);
        
        int result = minChanges(a, b, c, len_a, len_b);
        
        // Print the minimum number of changes
        printf("%d\n", result);
    }
    
    return 0;
}


Submission (verdict: Accepted):
#include <stdio.h>
#include <string.h>
#include <limits.h>

// Function to calculate the minimum changes using dynamic programming
int minChanges(char a[], char b[], char c[], int len_a, int len_b) {
    int dp[len_a + 1][len_b + 1];

    // Initialize the DP table
    for (int i = 0; i <= len_a; i++) {
        for (int j = 0; j <= len_b; j++) {
            dp[i][j] = INT_MAX;
        }
    }
    dp[0][0] = 0;

    // Fill the DP table
    for (int i = 0; i <= len_a; i++) {
        for (int j = 0; j <= len_b; j++) {
            int k = i + j;
            if (k < strlen(c)) {
                if (i < len_a && a[i] == c[k]) {
                    if (dp[i + 1][j] > dp[i][j]) dp[i + 1][j] = dp[i][j];
                } else if (i < len_a) {
                    if (dp[i + 1][j] > dp[i][j] + 1) dp[i + 1][j] = dp[i][j] + 1;
                }
                if (j < len_b && b[j] == c[k]) {
                    if (dp[i][j + 1] > dp[i][j]) dp[i][j + 1] = dp[i][j];
                } else if (j < len_b) {
                    if (dp[i][j + 1] > dp[i][j] + 1) dp[i][j + 1] = dp[i][j] + 1;
                }
            }
        }
    }

    return dp[len_a][len_b];
}

int main() {
    int t;
    scanf("%d", &t);
    
    while (t--) {
        char a[1001], b[1001], c[2002];
        scanf("%s %s %s", a, b, c);
        
        int len_a = strlen(a);
        int len_b = strlen(b);
        
        int result = minChanges(a, b, c, len_a, len_b);
        
        // Print the minimum number of changes
        printf("%d\n", result);
    }
    
    return 0;
}
Problem: 2050E - Three Strings
Language: GNU C11

Previous submission (verdict: Compilation error):
#include<stdio.h>
#include<string.h>

// Function to calculate the minumum changes
int minChanges(char a[], char b[], char c[], int len_a, int len_b)
{
    int i = 0, j = 0, k = 0;
    int changes = 0;
    
    // Traverse the combined length of a and b
    while (k < len_a + len_b)
    {
        if (i < len_a && a[i] == c[k])
        {
            i++;
        }
         else if (j < len_b && b[j] == c[k])
         {
             j++;
         }
          else 
          {
              changes++;
          }
          k++;
    }
     return changes;
}

int main()
{
    int t;
    scanf("%d", &t);
    
    while (t--)
    {
        char a[1001], b[1001], c[2002];
        scanf("%s %s %s", a, b, c);
        
        int len_a = strlen(a);
        int len_b = strlen(b);
        
        int result = minchanges(a, b, c, len_a, len_b);
        
        // Print the minimum number of changes
        printf("%d\n", result);
    }
    
     return 0;
}

Submission (verdict: Wrong answer on test 1):
#include <stdio.h>
#include <string.h>

// Function prototype
int minChanges(char a[], char b[], char c[], int len_a, int len_b);

// Function to calculate the minimum changes
int minChanges(char a[], char b[], char c[], int len_a, int len_b) {
    int i = 0, j = 0, k = 0;
    int changes = 0;
    
    // Traverse the combined length of a and b
    while (k < len_a + len_b) {
        if (i < len_a && a[i] == c[k]) {
            i++;
        } else if (j < len_b && b[j] == c[k]) {
            j++;
        } else {
            changes++;
        }
        k++;
    }
    return changes;
}

int main() {
    int t;
    scanf("%d", &t);
    
    while (t--) {
        char a[1001], b[1001], c[2002];
        scanf("%s %s %s", a, b, c);
        
        int len_a = (int)strlen(a);
        int len_b = (int)strlen(b);
        
        int result = minChanges(a, b, c, len_a, len_b);
        
        // Print the minimum number of changes
        printf("%d\n", result);
    }
    
    return 0;
}
Problem: 2050D - Digital string maximization
Language: C++17 (GCC 7-32)

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

int main()
{
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
#endif
    int t = 1;
    std::cin >> t;
    while (t--)
    {
        string s;
        cin >> s;
        int n = s.size();
        for (int i = 0; i < n; ++i)
        {
            int value = s[i] - '0';
            int mx = value;
            int j = i;
            int biggest = j;
            for (j; j < (i + 8); ++j)
            {
                if (s[j] - '0' - (j - i) > mx)
                {
                    mx = s[j] - '0' - (j - i);
                    biggest = j;
                }
            }
            reverse(s.begin() + i, s.begin() + biggest + 1);
            if (biggest != i)
                reverse(s.begin() + i + 1, s.begin() + biggest + 1);
            s[i] = mx + '0';
        }
        cout << s << '\n';
    }
    return 0;
}

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

int main()
{
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
#endif
    int t = 1;
    std::cin >> t;
    while (t--)
    {
        string s;
        cin >> s;
        int n = s.size();
        for (int i = 0; i < n; ++i)
        {
            int value = s[i] - '0';
            int mx = value;
            int j = i;
            int biggest = j;
            for (j; j < (i + 8); ++j)
            {
                if ((s[j] - '0' - (j - i)) > mx)
                {
                    mx = s[j] - '0' - (j - i);
                    biggest = j;
                }
            }
            reverse(s.begin() + i, s.begin() + biggest + 1);
            reverse(s.begin() + i + 1, s.begin() + biggest + 1);
            s[i] = mx + '0';
        }
        cout << s << '\n';
    }
    return 0;
}