ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2060D - Subtract Min Sort
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
/*
#       #      #   #######     #     #
#       #      #   #            #   #
#       #      #   #             # #
#       #      #   #              # 
#       #      #   #              # 
######  ########   #######        # 
*/
#include<bits/stdc++.h>
using namespace std;
#define vii vector<int> 
#define vll vector<long long>
#define pb push_back
#define ll long long
#define iterate(i,a,b) for(ll i=a;i<b;i++)
void solve(){
ll n; cin>>n;
vll arr(n); iterate(i,0,n) cin>>arr[i];
bool sorted=true;
iterate(i,1,n){
if(arr[i]<arr[i-1]) sorted=false;
}
if(sorted){
cout<<"YES"<<endl;
return;
}
ll maxi=*max_element(arr.begin(),arr.end());
if(n==3 && arr[1]!=maxi){
  cout<<"NO"<<endl;
  return;
}
else if(n==3 && arr[1]==maxi){
    cout<<"YES"<<endl;
    return;
  }
iterate(i,1,n){
    if(arr[i]>arr[i-1] && arr[i]==maxi){
        cout<<"YES"<<endl;
        return;
    }
}
cout<<"NO"<<endl;
}
int main()
{
ll t;
cin>>t; 
while(t--){
solve();
}
    return 0;
}

Submission (verdict: Accepted):
/*
#       #      #   #######     #     #
#       #      #   #            #   #
#       #      #   #             # #
#       #      #   #              # 
#       #      #   #              # 
######  ########   #######        # 
*/
#include<bits/stdc++.h>
using namespace std;
#define vii vector<int> 
#define vll vector<long long>
#define pb push_back
#define ll long long
#define iterate(i,a,b) for(ll i=a;i<b;i++)
void solve(){
ll n; cin>>n;
vll arr(n); iterate(i,0,n) cin>>arr[i];
iterate(i,0,n-1){
    ll mini=min(arr[i],arr[i+1]);
    arr[i]-=mini;
    arr[i+1]-=mini;
    if(arr[i]>arr[i+1]){
        cout<<"NO"<<endl;
        return;
    }
}
cout<<"YES"<<endl;

}
int main()
{
ll t;
cin>>t; 
while(t--){
solve();
}
    return 0;
}
Problem: 2060D - Subtract Min Sort
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Runtime error on test 1):
#include <bits/stdc++.h>
using namespace std;
 
#define int long long int
#define ll long long
 
typedef vector<long long> vt;
typedef pair<long long,long long> pi;
typedef vector<pair<long long,long long>> vpi;
 
#define loop(n) for (long long i = 0; i < n; i++)
#define all(s) (s).begin(), (s).end()
#define gcd(a, b) __gcd(a, b)
#define ub upper_bound
#define lb lower_bound
#define pb push_back
#define ppb pop_back
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
#define f(ind, i, m) for (ll (ind) = (i); (ind) <= (m); (ind)++)
 
#define ull unsigned long long
#define ff first
#define ss second
const ll mod = 1e9 + 7;
 
bool sortbysec(const pair<int, int>& a, const pair<int, int>& b) { return (a.second < b.second); }
void printa(vector<int>& v) { for (auto i : v) { cout << i << " "; } cout << endl; }
void printmp(map<int, int> mp) { for (auto i : mp) { cout << i.first << " " << i.second << endl; } }
ll BinExpItr(ll a, ll b) { ll ans = 1; while (b) { if (b & 1) ans = (ans * 1ll * a) % mod; a = (a * 1ll * a) % mod; b >>= 1; } return ans; }
 
void solve() 
{ 
    ll n;
    cin>>n;
    vt v(n);
    f(i,0,n-1)
    {
        cin>>v[i];
    }

   bool flag=true;

   for(int i=0;i<n;i++)
   {
         if(v[i]<v[i+1])
         {
             ll mini=min(v[i],v[i+1]);
             v[i]-=mini;
             v[i+1]-=mini;

         }else if(v[i]<v[i+1])
         {
            flag=false;
         }
   }

  if(flag)
  yes;
  else
  no;





 
    
 
}
 
int32_t main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
   
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
 
    return 0;
}
Problem: 2063B - Subsequence Update
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
int main(){
    int tt;
    cin>>tt;
    while(tt--){
        int n, l, r;
        cin>>n>>l>>r;
        vector<int> vect(n);
        for(int i=0;i<n;i++) cin>>vect[i];
        sort(vect.begin(), vect.end());
        long long sum = 0;
        for(int i=0;i<(r-l+1);i++) sum+= vect[i];
        cout<<sum<<endl;
    }
    return 0;
}
Problem: 2063B - Subsequence Update
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
int main(){
    int tt;
    cin>>tt;
    while(tt--){
        int n, l, r;
        cin>>n>>l>>r;
        vector<int> vect(n);
        for(int i=0;i<n;i++) cin>>vect[i];
        sort(vect.begin(), vect.end());
        long long sum = 0;
        for(int i=0;i<(r-l+1);i++) sum+= vect[i];
        cout<<sum<<endl;
    }
    return 0;
}


Submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
int main(){
    int tt;
    cin>>tt;
    while(tt--){
        int n, l, r;
        cin>>n>>l>>r;
        vector<int> vect(n), vect2(n);
        //find the smallest r - l + 1 values in l to n 
        for(int i=0;i<n;i++){cin>>vect[i];vect2[i] = vect[i];}

        long long sum1 = 0;
        sort(vect.begin() + l, vect.end());
        for(int i=l;i<=r;i++) sum1+=vect[i];
        long long sum2 = 0;
        sort(vect2.begin(), vect2.begin() + r);
        for(int i=0;i<=r-l;i++) sum2+= vect2[i];
        cout<<min(sum1, sum2)<<endl;

        
    }
    return 0;
}
Problem: 2063B - Subsequence Update
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
int main(){
    int tt;
    cin>>tt;
    while(tt--){
        int n, l, r;
        cin>>n>>l>>r;
        vector<int> vect(n), vect2(n);
        //find the smallest r - l + 1 values in l to n 
        for(int i=0;i<n;i++){cin>>vect[i];vect2[i] = vect[i];}

        long long sum1 = 0;
        sort(vect.begin() + l, vect.end());
        for(int i=l;i<=r;i++) sum1+=vect[i];
        long long sum2 = 0;
        sort(vect2.begin(), vect2.begin() + r);
        for(int i=0;i<=r-l;i++) sum2+= vect2[i];
        cout<<min(sum1, sum2)<<endl;

        
    }
    return 0;
}


Submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
int main(){
    int tt;
    cin>>tt;
    while(tt--){
        int n, l, r;
        cin>>n>>l>>r;
        vector<int> vect(n), vect2(n);
        //find the smallest r - l + 1 values in l to n 
        for(int i=0;i<n;i++){cin>>vect[i];vect2[i] = vect[i];}

        long long sum1 = 0;
        sort(vect.begin() + l-1, vect.end());
        for(int i=l;i<=r;i++) sum1+=vect[i];
        long long sum2 = 0;
        sort(vect2.begin(), vect2.begin() + r);
        for(int i=0;i<=r-l;i++) sum2+= vect2[i];
        cout<<min(sum1, sum2)<<endl;

        
    }
    return 0;
}
Problem: 2063B - Subsequence Update
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
int main(){
    int tt;
    cin>>tt;
    while(tt--){
        int n, l, r;
        cin>>n>>l>>r;
        vector<int> vect(n), vect2(n);
        //find the smallest r - l + 1 values in l to n 
        for(int i=0;i<n;i++){cin>>vect[i];vect2[i] = vect[i];}

        long long sum1 = 0;
        sort(vect.begin() + l-1, vect.end());
        for(int i=l;i<=r;i++) sum1+=vect[i];
        long long sum2 = 0;
        sort(vect2.begin(), vect2.begin() + r);
        for(int i=0;i<=r-l;i++) sum2+= vect2[i];
        cout<<min(sum1, sum2)<<endl;

        
    }
    return 0;
}


Submission (verdict: Accepted):
#include<bits/stdc++.h>
using namespace std;
int main(){
    int tt;
    cin>>tt;
    while(tt--){
        int n, l, r;
        cin>>n>>l>>r;
        vector<int> vect(n), vect2(n);
        //find the smallest r - l + 1 values in l to n 
        for(int i=0;i<n;i++){cin>>vect[i];vect2[i] = vect[i];}

        long long sum1 = 0;
        sort(vect.begin() + l-1, vect.end());
        for(int i=l-1;i<r;i++) sum1+=vect[i];
        long long sum2 = 0;
        sort(vect2.begin(), vect2.begin() + r);
        for(int i=0;i<=r-l;i++) sum2+= vect2[i];
        cout<<min(sum1, sum2)<<endl;

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


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

int main() {
    int tt;
    cin >> tt;
    while(tt--) {
        long long n;
        cin >> n;
        int sum = 0,two = 0,three = 0;
        while(n > 0) {
            sum += n%10;
            if(n%10 == 2) two++;
            if(n%10 == 3) three++;
            n = n/10;
        }
        int remainder = sum%9;
        int t = 0;
        if(remainder == 0) t = 1;
        if(remainder == 1) {
            if(two >= 4 or (two >= 1 and three >= 1)) t = 1;
        } 
        if(remainder == 2) {
            if(two >= 8 or (two >= 5 and three >= 1) or (two >= 2 and three >= 2)) t = 1;
        }
        if(remainder == 3) {
            if(three >= 1 or two >= 3) t = 1;
        }
        if(remainder == 4) {
            if(two >= 7 or (two >= 4 and three >= 1) or (two >= 1 and three >= 2)) t = 1;
        }
        if(remainder == 5 and two >= 2) t = 1; 
        if(remainder == 6) {
            if(two >= 6 or (two >= 3 and three >= 1) or three >= 2) t = 1;
        }
        if(remainder == 7 and two >= 1) t = 1;
        if(remainder == 8) {
            if(two >= 5 or (three >= 1 and two >= 2)) t = 1;
        }
        if(t == 1) cout << "yes" << endl;
        else cout << "no" << endl;
    }
}
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)

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

int main() {
    int tt;
    cin >> tt;
    while(tt--) {
        long long n;
        cin >> n;
        int sum = 0,two = 0,three = 0;
        while(n > 0) {
            sum += n%10;
            if(n%10 == 2) two++;
            if(n%10 == 3) three++;
            n = n/10;
        }
        int remainder = sum%9;
        int t = 0;
        if(remainder == 0) t = 1;
        if(remainder == 1) {
            if(two >= 4 or (two >= 1 and three >= 1)) t = 1;
        } 
        if(remainder == 2) {
            if(two >= 8 or (two >= 5 and three >= 1) or (two >= 2 and three >= 2)) t = 1;
        }
        if(remainder == 3) {
            if(three >= 1 or two >= 3) t = 1;
        }
        if(remainder == 4) {
            if(two >= 7 or (two >= 4 and three >= 1) or (two >= 1 and three >= 2)) t = 1;
        }
        if(remainder == 5 and two >= 2) t = 1; 
        if(remainder == 6) {
            if(two >= 6 or (two >= 3 and three >= 1) or three >= 2) t = 1;
        }
        if(remainder == 7 and two >= 1) t = 1;
        if(remainder == 8) {
            if(two >= 5 or (three >= 1 and two >= 2)) t = 1;
        }
        if(t == 1) cout << "yes" << endl;
        else cout << "no" << endl;
    }
}

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

int main() {
    int tt;
    cin >> tt;
    while(tt--) {
        long long n;
        cin >> n;
        int sum = 0,two = 0,three = 0;
        while(n > 0) {
            sum += n%10;
            if(n%10 == 2) two++;
            if(n%10 == 3) three++;
            n = n/10;
        }
        int remainder = sum%9;
        int t = 0;
        if(remainder == 0) t = 1;
        two = min(two,9);
        three = min(three,9);
        for(int i = 0;i <= two;i++) {
            for(int j = 0;j <= three;j++) {
                if((remainder + (i*2 + j*6)) % 9 == 0) {
                    t = 1;
                    break;
                }
            }
        }
        if(t == 1) cout << "yes" << endl;
        else cout << "no" << endl;
    }
}
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)

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

int main() {
    int tt;
    cin >> tt;
    while(tt--) {
        long long n;
        cin >> n;
        int sum = 0,two = 0,three = 0;
        while(n > 0) {
            sum += n%10;
            if(n%10 == 2) two++;
            if(n%10 == 3) three++;
            n = n/10;
        }
        int remainder = sum%9;
        int t = 0;
        if(remainder == 0) t = 1;
        two = min(two,9);
        three = min(three,9);
        for(int i = 0;i <= two;i++) {
            for(int j = 0;j <= three;j++) {
                if((remainder + (i*2 + j*6)) % 9 == 0) {
                    t = 1;
                    break;
                }
            }
        }
        if(t == 1) cout << "yes" << endl;
        else cout << "no" << endl;
    }
}

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

int main() {
    int tt;
    cin >> tt;
    while(tt--) {
        string n;
        cin >> n;
        int sum = 0,two = 0,three = 0;
        for(int i = 0;i < n.length();i++) {
            sum += n[i] - '0';
            if(n[i] == '2') two++;
            if(n[i] == '3') three++;
        }
        int remainder = sum%9;
        int t = 0;
        two = min(two,9);
        three = min(three,9);
        for(int i = 0;i <= two;i++) {
            for(int j = 0;j <= three;j++) {
                if((remainder + (i*2 + j*6)) % 9 == 0) {
                    t = 1;
                    break;
                }
            }
        }
        if(t == 1) cout << "yes" << endl;
        else cout << "no" << endl;
    }
}
Problem: 2050E - Three Strings
Language: C++23 (GCC 14-64, msys2)

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

#define int long long
#define inp cin >>
#define out cout <<
#define next cout << endl

int dp[2006][2006];//dp [i][j] denotes min char change till index i of a and j of b ...
int min_change(string a,string b,string c,int i,int j){
    if(dp[i][j]!=-1){
        return dp[i][j];
    }
    if(j<=0 && i<=0){
        return 0;
    }
    int ans=INT64_MAX;
    //suppose we take character from a .....
    int store=INT32_MAX;
    
    int a_taken=min_change(a,b,c,i-1,j);
    int b_taken=min_change(a,b,c,i,j-1);

    if(c[i+j-1]==a[i-1] && i>0){
        store=min(a_taken,store);
    }
    else if(i>0){
        store=min(store,a_taken+1);
    }
    //suppose we take character from b .....
    if(c[i+j-1]==b[j-1] && j>0){
        store=min(b_taken,store);
    }
    else if(j>0){
        store=min(store,b_taken+1);
    }
    return dp[i][j]=store;
}
void solve() {
    string a,b,c;
    inp a;inp b;inp c;
    int inda=a.size(),indb=b.size(),indc=c.size();
    memset(dp,-1,sizeof(dp));
       int ans= min_change(a,b,c,inda,indb);
        out ans;
        next;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int tc = 1;
     inp tc;
    while (tc--){
        solve();
    }
    return 0;
}


Submission (verdict: Time limit exceeded on test 16):
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define inp cin >>
#define out cout <<
#define next cout << endl

int dp[2006][2006];//dp [i][j] denotes min char change till index i of a and j of b ...
int min_change(string a,string b,string c,int i,int j){
    if(dp[i][j]!=-1){
        return dp[i][j];
    }
    if(j==0 && i==0){
        return dp[0][0]=0;
    }
    int ans=INT64_MAX;
    //suppose we take character from a .....
    int store=INT32_MAX;
    int a_taken;int b_taken;
    if(i>0)
    a_taken=min_change(a,b,c,i-1,j);
    if(j>0)
    b_taken=min_change(a,b,c,i,j-1);

    if(c[i+j-1]==a[i-1] && i>0){
        store=min(a_taken,store);
    }
    else if(i>0){
        store=min(store,a_taken+1);
    }
    //suppose we take character from b .....
    if(c[i+j-1]==b[j-1] && j>0){
        store=min(b_taken,store);
    }
    else if(j>0){
        store=min(store,b_taken+1);
    }
    return dp[i][j]=store;
}
void solve() {
    string a,b,c;
    inp a;inp b;inp c;
    int inda=a.size(),indb=b.size(),indc=c.size();
    memset(dp,-1,sizeof(dp));
       int ans= min_change(a,b,c,inda,indb);
        out ans;
        next;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int tc = 1;
     inp tc;
    while (tc--){
        solve();
    }
    return 0;
}
Problem: 2050E - Three Strings
Language: C++23 (GCC 14-64, msys2)

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

#define int int64_t
#define inp cin >>
#define out cout <<
#define next cout << endl

const int INF = 1e18;

int dp[2005][2005]; // dp[i][j] denotes min char changes till index i of a and j of b

int min_change(const string &a, const string &b, const string &c, int i, int j) {
    if (i == 0 && j == 0) return 0; // Base case: No characters to match

    if (dp[i][j] != -1) return dp[i][j];

    int ans = INF;

    // If we take from a
    if (i > 0) {
        int cost = min_change(a, b, c, i - 1, j);
        if (c[i + j - 1] != a[i - 1]) cost++; // Increment if characters don't match
        ans = min(ans, cost);
    }

    // If we take from b
    if (j > 0) {
        int cost = min_change(a, b, c, i, j - 1);
        if (c[i + j - 1] != b[j - 1]) cost++; // Increment if characters don't match
        ans = min(ans, cost);
    }

    return dp[i][j] = ans;
}

void solve() {
    string a, b, c;
    inp a >> b >> c;

    int inda = a.size(), indb = b.size(), indc = c.size();
    if (inda + indb != indc) {
        out -1; // If lengths don't match, it's impossible
        next;
        return;
    }

    memset(dp, -1, sizeof(dp));

    int ans = min_change(a, b, c, inda, indb);
    out ans;
    next;
}

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

    int tc;
    inp tc;
    while (tc--) {
        solve();
    }
    
}this is working i have an ac

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

#define int int64_t
#define inp cin >>
#define out cout <<
#define next cout << endl

const int INF = 1e18;

int dp[2005][2005]; // dp[i][j] denotes min char changes till index i of a and j of b

int min_change(const string &a, const string &b, const string &c, int i, int j) {
    if (i == 0 && j == 0) return 0; // Base case: No characters to match

    if (dp[i][j] != -1) return dp[i][j];

    int ans = INF;

    // If we take from a
    if (i > 0) {
        int cost = min_change(a, b, c, i - 1, j);
        if (c[i + j - 1] != a[i - 1]) cost++; // Increment if characters don't match
        ans = min(ans, cost);
    }

    // If we take from b
    if (j > 0) {
        int cost = min_change(a, b, c, i, j - 1);
        if (c[i + j - 1] != b[j - 1]) cost++; // Increment if characters don't match
        ans = min(ans, cost);
    }

    return dp[i][j] = ans;
}

void solve() {
    string a, b, c;
    inp a >> b >> c;

    int inda = a.size(), indb = b.size(), indc = c.size();
    if (inda + indb != indc) {
        out -1; // If lengths don't match, it's impossible
        next;
        return;
    }

    memset(dp, -1, sizeof(dp));

    int ans = min_change(a, b, c, inda, indb);
    out ans;
    next;
}

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

    int tc;
    inp tc;
    while (tc--) {
        solve();
    }
    
}
Problem: 2050E - Three Strings
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Time limit exceeded on test 16):
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define inp cin >>
#define out cout <<
#define next cout << "\n"

int dp[2006][2006];//dp [i][j] denotes min char change till index i of a and j of b ...
int min_change(string a,string b,string c,int i,int j){
    if(dp[i][j]!=-1){
        return dp[i][j];
    }
    if(j==0 && i==0){
        return dp[0][0]=0;
    }
    int ans=INT64_MAX;
    //suppose we take character from a .....
    int store=INT32_MAX;
    int a_taken;int b_taken;
    if(i>0)
    a_taken=min_change(a,b,c,i-1,j);
    if(j>0)
    b_taken=min_change(a,b,c,i,j-1);

    if(c[i+j-1]==a[i-1] && i>0){
        store=min(a_taken,store);
    }
    else if(i>0){
        store=min(store,a_taken+1);
    }
    //suppose we take character from b .....
    if(c[i+j-1]==b[j-1] && j>0){
        store=min(b_taken,store);
    }
    else if(j>0){
        store=min(store,b_taken+1);
    }
    return dp[i][j]=store;
}
void solve() {
    string a,b,c;
    inp a;inp b;inp c;
    int inda=a.size(),indb=b.size(),indc=c.size();
    memset(dp,-1,sizeof(dp));
       int ans= min_change(a,b,c,inda,indb);
        out ans;
        next;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int tc = 1;
     inp tc;
    while (tc--){
        solve();
    }
    return 0;
}


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

#define int int64_t
#define inp cin >>
#define out cout <<
#define next cout << endl

const int INF = 1e18;

int dp[2005][2005]; // dp[i][j] denotes min char changes till index i of a and j of b

int min_change(const string &a, const string &b, const string &c, int i, int j) {
    if (i == 0 && j == 0) return 0; // Base case: No characters to match

    if (dp[i][j] != -1) return dp[i][j];

    int ans = INF;

    // If we take from a
    if (i > 0) {
        int cost = min_change(a, b, c, i - 1, j);
        if (c[i + j - 1] != a[i - 1]) cost++; // Increment if characters don't match
        ans = min(ans, cost);
    }

    // If we take from b
    if (j > 0) {
        int cost = min_change(a, b, c, i, j - 1);
        if (c[i + j - 1] != b[j - 1]) cost++; // Increment if characters don't match
        ans = min(ans, cost);
    }

    return dp[i][j] = ans;
}

void solve() {
    string a, b, c;
    inp a >> b >> c;

    int inda = a.size(), indb = b.size(), indc = c.size();
    if (inda + indb != indc) {
        out -1; // If lengths don't match, it's impossible
        next;
        return;
    }

    memset(dp, -1, sizeof(dp));

    int ans = min_change(a, b, c, inda, indb);
    out ans;
    next;
}

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

    int tc;
    inp tc;
    while (tc--) {
        solve();
    }
    
}this is working i have an ac
Problem: 2050E - Three Strings
Language: C++23 (GCC 14-64, msys2)


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

#define int long long
#define inp cin >>
#define out cout <<
#define next cout << endl

int dp[2006][2006];//dp [i][j] denotes min char change till index i of a and j of b ...
int min_change(string a,string b,string c,int i,int j){
    if(dp[i][j]!=-1){
        return dp[i][j];
    }
    if(j<=0 && i<=0){
        return 0;
    }
    int ans=INT64_MAX;
    //suppose we take character from a .....
    int store=INT32_MAX;
    
    int a_taken=min_change(a,b,c,i-1,j);
    int b_taken=min_change(a,b,c,i,j-1);

    if(c[i+j-1]==a[i-1] && i>0){
        store=min(a_taken,store);
    }
    else if(i>0){
        store=min(store,a_taken+1);
    }
    //suppose we take character from b .....
    if(c[i+j-1]==b[j-1] && j>0){
        store=min(b_taken,store);
    }
    else if(j>0){
        store=min(store,b_taken+1);
    }
    return dp[i][j]=store;
}
void solve() {
    string a,b,c;
    inp a;inp b;inp c;
    int inda=a.size(),indb=b.size(),indc=c.size();
    memset(dp,-1,sizeof(dp));
       int ans= min_change(a,b,c,inda,indb);
        out ans;
        next;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int tc = 1;
     inp tc;
    while (tc--){
        solve();
    }
    return 0;
}