ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2049C - MEX Cycle
Language: C++20 (GCC 13-64)

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

#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/tree_policy.hpp>

using namespace std;

using namespace __gnu_pbds;

#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

#define int long long

#define fast                          \

	ios_base::sync_with_stdio(false); \

	cin.tie(NULL)

#define fr(i, a, b) for (int i = (a); i < (int)(b); ++i)

#define frr(i, a, b) for (int i = (a); i >= (int)(b); --i)

#define vi vector<int>

#define vvi vector<vi>

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

typedef pair<int, int> pi;

typedef vector<pi> vpi;

#define pb push_back

#define endl "\n"

void solve()

{

	int n, x, y;

	cin >> n >> x >> y;

	vi v;

	if (n % 2)

	{

		fr(i, 0, n - 1)

		{

			if(i == y-1)

			{

				v.pb(2);

				break;

			}

			if (i % 2)

			{

				v.pb(1);

			}

			else

			{

				v.pb(0);

			}

		}

		int c = 0;

		fr(i,y,n)

		{

			if(v[y-2] == 1)

			{

				if(c%2 == 0)

				{

					v.pb(0);

				}

				else

				{

					v.pb(1);

				}

			}

			else

			{

				if (c % 2 == 0)

				{

					v.pb(1);

				}

				else

				{

					v.pb(0);

				}

			}

			c++;

		}

	}

	else

	{

		fr(i, 0, n)

		{

			if (i % 2)

			{

				v.pb(1);

			}

			else

			{

				v.pb(0);

			}

		}

		if (v[x - 1] == v[y - 1])

		{

			v[x - 1] = 2;

		}

	}

	fr(i,0,n)

	{

		cout << v[i] << " ";

	}

	cout << endl;

}

signed main()

{

	fast;

	int t;

	cin >> t;

	while (t--)

	{

		solve();

	}

}

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

#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/tree_policy.hpp>

using namespace std;

using namespace __gnu_pbds;

#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

#define int long long

#define fast                          \

	ios_base::sync_with_stdio(false); \

	cin.tie(NULL)

#define fr(i, a, b) for (int i = (a); i < (int)(b); ++i)

#define frr(i, a, b) for (int i = (a); i >= (int)(b); --i)

#define vi vector<int>

#define vvi vector<vi>

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

typedef pair<int, int> pi;

typedef vector<pi> vpi;

#define pb push_back

#define endl "\n"

void solve()

{

	int n, x, y;

	cin >> n >> x >> y;

	vi v;

	if (n % 2)

	{

		fr(i, 0, n)

		{

			if (i == y - 1)

			{

				v.pb(2);

				break;

			}

			if (i % 2)

			{

				v.pb(1);

			}

			else

			{

				v.pb(0);

			}

		}

		int c = 0;

		fr(i, y, n)

		{

			if (v[y - 2] == 1)

			{

				if (c % 2 == 0)

				{

					v.pb(0);

				}

				else

				{

					v.pb(1);

				}

			}

			else

			{

				if (c % 2 == 0)

				{

					v.pb(1);

				}

				else

				{

					v.pb(0);

				}

			}

			c++;

		}

	}

	else

	{

		fr(i, 0, n)

		{

			if (i % 2)

			{

				v.pb(1);

			}

			else

			{

				v.pb(0);

			}

		}

		if (v[x - 1] == v[y - 1])

		{

			v[x - 1] = 2;

		}

	}

	fr(i, 0, v.size())

	{

		cout << v[i] << " ";

	}

	cout << endl;

}

signed main()

{

	fast;

	int t;

	cin >> t;

	while (t--)

	{

		solve();

	}

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


Submission (verdict: Memory limit exceeded on test 6):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair <ll, ll> pii;

typedef vector <ll> vi;
typedef vector <vector <ll>> vvi;

const ll mxn = 1e6 + 5;
const ll mod = 1e9 + 7;

void fast(){
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
}


void solve(){

    ll n,m;
    cin>>n>>m;
    ll a[n];
    ll b[m];
    ll sum1=0;
    ll sum2=0;

    map<ll,ll> mp;
    for(ll i=0;i<n;i++){
        cin>>a[i];
        sum1+=a[i];
        mp[a[i]]++;
    }
    priority_queue<ll> p;
    for(ll i=0;i<m;i++){
        cin>>b[i];
        sum2+=b[i];
        p.push(b[i]);
    }
    if(sum1!=sum2){
        cout<<"No"<<endl;
        return;
    }
    while(!p.empty()||!mp.empty()){


        ll x=p.top();
        //cout<<x<<endl;
        p.pop();
        if(mp.count(x)!=0){
            mp[x]--;
            if(mp[x]==0) mp.erase(x);
           
            continue;
        }
        if(x==1){
            break;
        }
        // p.pop();
        //cout<<x<<endl;
        if(x%2==0){
            p.push(x/2);
            //cout<<"even pushing "<<endl;
            p.push(x/2);
        }
        else{
            ll kk=x/2+1;
            p.push(x/2);
            p.push(kk);
            //cout<<"odd pushing"<<endl;
        }
    }
    if(p.size()>0){
        cout<<"No"<<endl;
    }
    else cout<<"Yes"<<endl;

    // if(z==kk){
    //     cout<<"Yes"<<endl;
    // }
    // else cout<<"No"<<endl;
    

    





}
int main(){

    fast();
    ll t;
    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 <bits/stdc++.h>

#include <string>

#include <stack>

#include <list>

#include <string>

#include <queue>

#include <limits.h>

#include <random>

#include <cmath>

#define ll long long



using namespace std;



// cout consecutive occuring element in vector

// vector<int> cnt = {1};

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

// 	if (a[i] == a[i-1]){

// 		cnt.back()++;

// 	} else {

// 		cnt.emplace_back(1);

// 	}

// }



void solve()

{

    int n, l, r;

    cin >> n >> l >> r;

    vector<int> a(n);

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

    	cin >> a[i];

    }

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

    int res=0;

    for(int i=0; i< (r-l+1); i++){

    	res+=a[i];

    }

    cout <<res<< endl;



    

}



int main(){

	int tc;

	cin >> tc;

	while (tc--){

		solve();

	}

	return 0;

}



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

#include <string>

#include <stack>

#include <list>

#include <string>

#include <queue>

#include <limits.h>

#include <random>

#include <cmath>

#define ll long long



using namespace std;



// cout consecutive occuring element in vector

// vector<int> cnt = {1};

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

// 	if (a[i] == a[i-1]){

// 		cnt.back()++;

// 	} else {

// 		cnt.emplace_back(1);

// 	}

// }



void solve()

{

    ll n, l, r;

    cin >> n >> l >> r;

    vector<ll> a(n);

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

    	cin >> a[i];

    }

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

    ll res=0;

    for(ll i=0; i< (r-l+1); i++){

    	res+=a[i];

    }

    cout <<res<< endl;



    

}



int main(){

	int tc;

	cin >> tc;

	while (tc--){

		solve();

	}

	return 0;

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


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

#include <string>

#include <stack>

#include <list>

#include <string>

#include <queue>

#include <limits.h>

#include <random>

#include <cmath>

#define ll long long



using namespace std;



// cout consecutive occuring element in vector

// vector<int> cnt = {1};

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

// 	if (a[i] == a[i-1]){

// 		cnt.back()++;

// 	} else {

// 		cnt.emplace_back(1);

// 	}

// }



void solve()

{

    int n, l, r;

    cin >> n >> l >> r;

    vector<int> a(n);

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

    	cin >> a[i];

    }

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

    int res=0;

    for(int i=0; i< (r-l+1); i++){

    	res+=a[i];

    }

    cout <<res<< endl;



    

}



int main(){

	int tc;

	cin >> tc;

	while (tc--){

		solve();

	}

	return 0;

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

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

#include <string>

#include <stack>

#include <list>

#include <string>

#include <queue>

#include <limits.h>

#include <random>

#include <cmath>

#define ll long long



using namespace std;



// cout consecutive occuring element in vector

// vector<int> cnt = {1};

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

// 	if (a[i] == a[i-1]){

// 		cnt.back()++;

// 	} else {

// 		cnt.emplace_back(1);

// 	}

// }



void solve()

{

    ll n, l, r;

    cin >> n >> l >> r;

    vector<ll> a(n);

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

    	cin >> a[i];

    }

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

    ll res=0;

    for(ll i=0; i< (r-l+1); i++){

    	res+=a[i];

    }

    cout <<res<< endl;



    

}



int main(){

	int tc;

	cin >> tc;

	while (tc--){

		solve();

	}

	return 0;

}



Submission (verdict: Accepted):
#include <bits/stdc++.h>
#include <string>
#include <stack>
#include <list>
#include <string>
#include <queue>
#include <limits.h>
#include <random>
#include <cmath>
#define ll long long

using namespace std;

// cout consecutive occuring element in vector
// vector<int> cnt = {1};
// for(int i=1; i<n; i++){
// 	if (a[i] == a[i-1]){
// 		cnt.back()++;
// 	} else {
// 		cnt.emplace_back(1);
// 	}
// }

void solve()
{
    int n, l, r;
    cin >> n >> l >> r;
    vector<ll> a(n);
    for(ll i=0; i<n; i++){
    	cin >> a[i];
    }
    sort(a.begin() + (l - 1), a.begin() + r);
    sort(a.begin(), a.begin() + (l - 1));
    sort(a.begin() + r, a.end());
    ll range_sum = accumulate(a.begin() + (l - 1), a.begin() + r, 0LL);

   	ll i=0;
   	ll j=r-1;
   	ll k=r;
  
   	ll left_sum=range_sum;
   	while(j >= l-1 && i < l-1){
   		if (a[j] > a[i]){
   			left_sum=left_sum - a[j] + a[i];
	   		j--;
	   		i++;	
   		}else{
   			i++;
   		}
   	}

   	j=r-1;
   	ll right_sum=range_sum;
   	while(j >= l-1 && k < n){
   		if (a[j] > a[k]){
   			right_sum=right_sum - a[j] + a[k];
	   		j--;
	   		k++;	
   		}else{
   			k++;
   		}
   	}

   	if(left_sum > right_sum){
   		cout << right_sum <<endl;
   	}else{
   		cout << left_sum << endl;
   	}

    
}

int main(){
	int tc;
	cin >> tc;
	while (tc--){
		solve();
	}
	return 0;
}
Problem: 2057C - Trip to the Olympiad
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;
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
    int t;
    cin >> t;
    for (int i = 0; i < t; i++)
    {
        int l, r;
        cin >> l >> r;

        int k = int(pow(2, floor(log2(r)) + 1) - 1) ^ r;

        cout << r << " " << k << " " << l << '\n';
    }
}

Submission (verdict: Accepted):
#include <bits/stdc++.h>
#define LL long long
using namespace std;
 
struct three{
    LL a, b, c;
};

three compute(LL a, LL b){
    LL p = pow(2, floor(log2(b))) - 1;

    if(p >= a){
        LL third = a;
        if(a == p) third = b;
        return {p, p+1, third};
    }
    else{
        three x = compute(a-(p+1), b-(p+1));
        return{x.a + p + 1, x.b + p + 1, x.c + p + 1};
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
    int t;
    cin >> t;
    for (int i = 0; i < t; i++)
    {
        LL l, r;
        cin >> l >> r;

        three ans = compute(l, r);

        // int k = int(pow(2, floor(log2(r)) + 1) - 1) ^ r;

        cout << ans.a << " " << ans.b << " " << ans.c << '\n';
    }
}
Problem: 2057C - Trip to the Olympiad
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;
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
    int t;
    cin >> t;
    for (int i = 0; i < t; i++)
    {
        int l, r;
        cin >> l >> r;

        cout << r << " " << r-1 << " " << l << '\n';
    }
}

Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
#define LL long long
using namespace std;
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
    int t;
    cin >> t;
    for (int i = 0; i < t; i++)
    {
        int l, r;
        cin >> l >> r;

        int k = int(pow(2, floor(log2(r)) + 1) - 1) ^ r;

        cout << r << " " << k << " " << l << '\n';
    }
}
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
#define LL long long
using namespace std;
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
    int t;
    cin >> t;
    for (int i = 0; i < t; i++)
    {
        int l, r;
        cin >> l >> r;

        cout << r << " " << r-1 << " " << l << '\n';
    }
}
Problem: 2050D - Digital string maximization
Language: GNU C11


Submission (verdict: Runtime error on test 4):
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define INPUT_STR_MAX 1024

void move(int i, char* str) {
    char tmp = str[i];
    str[i] = str[i + 1] - 1;
    str[i + 1] = tmp;
}

int run_test(char* str) {
    int i = 0;

    int len = strlen(str);

    while (i < len - 1) {
        if (str[i + 1] - 1 > str[i]) {
            move(i, str);
            if (i > 0) i--;
            else i++;
        } else {
            i++;
        }
    }

    return len;
}

int main() {
    int test_cases;

    scanf("%d", &test_cases);

    char** results = malloc(sizeof(char*) * test_cases);

    for (int i = 0; i < test_cases; i++) {
        char str[INPUT_STR_MAX];
        scanf("%s", str);

        int len = run_test(str);

        results[i] = malloc(len + 1);
        strcpy(results[i], str);
    }

    for (int i = 0; i < test_cases; i++) {
        printf("%s\n", results[i]);
        free(results[i]);
    }

    free(results);
}
Problem: 2050D - Digital string maximization
Language: GNU C11

Previous submission (verdict: Runtime error on test 7):
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define INPUT_STR_MAX 100001

void move(int i, char* str) {
    char tmp = str[i];
    str[i] = str[i + 1] - 1;
    str[i + 1] = tmp;
}

int run_test(char* str) {
    int i = 0;

    int len = strlen(str);

    while (i < len - 1) {
        if (str[i + 1] - 1 > str[i]) {
            move(i, str);
            if (i > 0) i--;
            else i++;
        } else {
            i++;
        }
    }

    return len;
}

int main() {
    int test_cases;

    scanf("%d", &test_cases);

    char** results = malloc(sizeof(char*) * test_cases);

    for (int i = 0; i < test_cases; i++) {
        char str[INPUT_STR_MAX];
        scanf("%s", str);

        int len = run_test(str);

        results[i] = malloc(len + 1);
        strcpy(results[i], str);
    }

    for (int i = 0; i < test_cases; i++) {
        printf("%s\n", results[i]);
        free(results[i]);
    }

    free(results);
}


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

#define INPUT_STR_MAX 200001

void move(int i, char* str) {
    char tmp = str[i];
    str[i] = str[i + 1] - 1;
    str[i + 1] = tmp;
}

int run_test(char* str) {
    int i = 0;

    int len = strlen(str);

    while (i < len - 1) {
        if (str[i + 1] - 1 > str[i]) {
            move(i, str);
            if (i > 0) i--;
            else i++;
        } else {
            i++;
        }
    }

    return len;
}

int main() {
    int test_cases;

    scanf("%d", &test_cases);

    char** results = malloc(sizeof(char*) * test_cases);

    for (int i = 0; i < test_cases; i++) {
        char str[INPUT_STR_MAX];
        scanf("%s", str);

        int len = run_test(str);

        results[i] = malloc(len + 1);
        strcpy(results[i], str);
    }

    for (int i = 0; i < test_cases; i++) {
        printf("%s\n", results[i]);
        free(results[i]);
    }

    free(results);
}
Problem: 2050D - Digital string maximization
Language: GNU C11

Previous submission (verdict: Runtime error on test 4):
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define INPUT_STR_MAX 1024

void move(int i, char* str) {
    char tmp = str[i];
    str[i] = str[i + 1] - 1;
    str[i + 1] = tmp;
}

int run_test(char* str) {
    int i = 0;

    int len = strlen(str);

    while (i < len - 1) {
        if (str[i + 1] - 1 > str[i]) {
            move(i, str);
            if (i > 0) i--;
            else i++;
        } else {
            i++;
        }
    }

    return len;
}

int main() {
    int test_cases;

    scanf("%d", &test_cases);

    char** results = malloc(sizeof(char*) * test_cases);

    for (int i = 0; i < test_cases; i++) {
        char str[INPUT_STR_MAX];
        scanf("%s", str);

        int len = run_test(str);

        results[i] = malloc(len + 1);
        strcpy(results[i], str);
    }

    for (int i = 0; i < test_cases; i++) {
        printf("%s\n", results[i]);
        free(results[i]);
    }

    free(results);
}


Submission (verdict: Runtime error on test 7):
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define INPUT_STR_MAX 100001

void move(int i, char* str) {
    char tmp = str[i];
    str[i] = str[i + 1] - 1;
    str[i + 1] = tmp;
}

int run_test(char* str) {
    int i = 0;

    int len = strlen(str);

    while (i < len - 1) {
        if (str[i + 1] - 1 > str[i]) {
            move(i, str);
            if (i > 0) i--;
            else i++;
        } else {
            i++;
        }
    }

    return len;
}

int main() {
    int test_cases;

    scanf("%d", &test_cases);

    char** results = malloc(sizeof(char*) * test_cases);

    for (int i = 0; i < test_cases; i++) {
        char str[INPUT_STR_MAX];
        scanf("%s", str);

        int len = run_test(str);

        results[i] = malloc(len + 1);
        strcpy(results[i], str);
    }

    for (int i = 0; i < test_cases; i++) {
        printf("%s\n", results[i]);
        free(results[i]);
    }

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

Previous submission (verdict: Runtime error on test 13):
#include <bits/stdc++.h>

#define int long long
using namespace std;

const int MAXN = 2005; // Adjusted for constraints
int dp[MAXN][MAXN];

#undef int // Restore int for standard main() function

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t;
    cin >> t;

    while (t--) {
        string a, b;
        cin >> a >> b;

        string c;
        cin >> c;

        int na = a.size(), nb = b.size();

        // Add dummy character for 1-based indexing
        a = "a" + a;
        b = "a" + b;
        c = "a" + c;

        // Initialize DP table
        for (int i = 0; i <= na; i++) {
            for (int j = 0; j <= na + nb; j++) {
                dp[i][j] = 1e18; // Infinity
            }
        }

        dp[0][0] = 0;

        for (int i = 0; i <= na; i++) {
            for (int j = 0; j <= na + nb; j++) {
                int k = j - i; // Characters taken from `b`

                if (i > 0 && j > 0 && c[j] == a[i]) {
                    dp[i][j] = min(dp[i][j], dp[i - 1][j - 1]);
                }
                if (j > 0 && k > 0 && c[j] == b[k]) {
                    dp[i][j] = min(dp[i][j], dp[i][j - 1]);
                }
                if (i > 0 && j > 0) {
                    dp[i][j] = min(dp[i][j], dp[i - 1][j - 1] + 1);
                }
                if (j > 0 && k > 0) {
                    dp[i][j] = min(dp[i][j], dp[i][j - 1] + 1);
                }
            }
        }

        cout << dp[na][na + nb] << '\n';
    }

    return 0;
}

Submission (verdict: Runtime error on test 16):
#include <bits/stdc++.h>

#define int long long
using namespace std;

const int MAXN = 2e3 + 5;
int dp[MAXN][MAXN];

signed main() {
	
	int t;
	cin >> t;

	while (t--) {
		string a, b;
		cin >> a >> b;

		string c;
		cin >> c;

		int na = a.size(), nb = b.size();

		a = "a" + a;
		b = "a" + b;
		c = "a" + c;

		for (int i = 0; i <= na; i++)
			for (int j = 0; j <= na + nb; j++) 
				dp[i][j] = 1e18;

		dp[0][0] = 0;

		for (int i = 0; i <= na; i++) {
			for (int j = 0; j <= na + nb; j++) {
				// i chars from a, j chars from c, minimum change
				// k chars from b
				int k = j - i;
				if (i > 0 && j > 0 && c[j] == a[i]) dp[i][j] = min(dp[i][j], dp[i - 1][j - 1]);
				if (j > 0 && k > 0 && c[j] == b[k]) dp[i][j] = min(dp[i][j], dp[i][j - 1]);
				if (i > 0 && j > 0) dp[i][j] = min(dp[i][j], dp[i - 1][j - 1] + 1);
				if (j > 0 && k > 0) dp[i][j] = min(dp[i][j], dp[i][j - 1] + 1);
			}
		}

		cout << dp[na][na + nb] << '\n';
	}		
}
Problem: 2050E - Three Strings
Language: C++17 (GCC 7-32)


Submission (verdict: Runtime error on test 13):
#include <bits/stdc++.h>

#define int long long
using namespace std;

const int MAXN = 2005; // Adjusted for constraints
int dp[MAXN][MAXN];

#undef int // Restore int for standard main() function

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t;
    cin >> t;

    while (t--) {
        string a, b;
        cin >> a >> b;

        string c;
        cin >> c;

        int na = a.size(), nb = b.size();

        // Add dummy character for 1-based indexing
        a = "a" + a;
        b = "a" + b;
        c = "a" + c;

        // Initialize DP table
        for (int i = 0; i <= na; i++) {
            for (int j = 0; j <= na + nb; j++) {
                dp[i][j] = 1e18; // Infinity
            }
        }

        dp[0][0] = 0;

        for (int i = 0; i <= na; i++) {
            for (int j = 0; j <= na + nb; j++) {
                int k = j - i; // Characters taken from `b`

                if (i > 0 && j > 0 && c[j] == a[i]) {
                    dp[i][j] = min(dp[i][j], dp[i - 1][j - 1]);
                }
                if (j > 0 && k > 0 && c[j] == b[k]) {
                    dp[i][j] = min(dp[i][j], dp[i][j - 1]);
                }
                if (i > 0 && j > 0) {
                    dp[i][j] = min(dp[i][j], dp[i - 1][j - 1] + 1);
                }
                if (j > 0 && k > 0) {
                    dp[i][j] = min(dp[i][j], dp[i][j - 1] + 1);
                }
            }
        }

        cout << dp[na][na + nb] << '\n';
    }

    return 0;
}