in the RECURSIVE SEQ 1 implementation , we have taken modulus earlier and not at the final step
C[i][j] = (C[i][j] + (A[i][x]*B[x][j])%MOD)%MOD;
so will it not change my ans;
and can we make the 2d matrix as
vector<vector>T instead the one made in the ques which is vector<vector>T(k+1,vector(k+1));