$B.\,\,\, for(i=0\,\,to\,\,n)score=max(score, B[i][k])$

$C.\,\,\,Time\,Complexity : O(nk), \,\,Space\,Complexity:O(n)$

Space complexity is $O(n)$ as for calculating $B[\,][j]$ we only need values in $B[\,][j-1]$. So, no need to store all the values, and also at last we only need values in $B[\,][k]$ for calculating the score.