My code is not passing last test case

#include<bits/stdc++.h>
#define ll long long
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
#define lprt(n) printf("%lld “,n)
#define prt(n) printf(”%d “,n)
#define pln() printf(”\n")
#define prtln(n) printf("%d\n",n)
#define lprtln(n) printf("%lld\n",n)
#define fr(i,init,n) for(int i=init;i<n;i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define gcd __gcd
#define inf INT_MAX
#define ninf INT_MIN
#define IMN int main()
#define rtn return
#define Wt int t; scn(t);while(t–)
using namespace std;
const ll mod=1e9+7;

int dp[2001][2001][6];

int fn(int s1[],int s2[], int i, int j, int k){

if(k<0)
return -1;

if(i<0 || j<0)
return 0;

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




if (s1[i]==s2[j])
    dp[i][j][k]=max(dp[i][j][k],fn(s1,s2,i-1,j-1,k)+1);

if (s1[i]!=s2[j]){
	dp[i][j][k]=max(fn(s1,s2,i-1,j,k),fn(s1,s2,i,j-1,k));
    dp[i][j][k]=max(dp[i][j][k],fn(s1,s2,i-1,j-1,k-1)+1);
}

return dp[i][j][k];

}

IMN
{

    int n,m,k;
    scn(n);
    scn(m);
    scn(k);
    
    int s1[n],s2[m];
    
    fr(i,0,n)
    scn(s1[i]);
    
    fr(i,0,m)
    scn(s2[i]);
    
    fr(i,0,n+1)
    fr(j,0,m+1)
    memset(dp[i][j],-1,sizeof(dp[i][j]));
    
    
    // sort(coc,coc+n);
    // sort(can,can+m);
    
    prtln(fn(s1,s2,n,m,k));
    
}

@durbij is it showing Wrong answer or TLE?