Husk, score 1 × 12 bytes = 12
First program:
₅ +¹Σ+ Try it online! It takes \$n\$ and \$m\$ as two separate arguments.
Second program:
Ξ +¹Σ+ Try it online! It takes the two strings in a list.
This pair of programs utilizes the strategy in Sisyphus's answer; inIn the first program, the main function just calls the auxiliary function with its arguments flipped, and in the second program, the auxiliary function is ignored altogether. However, instead of using contiguous subsequence counts to compute the pairing, this program uses the triangular-number builtin Σ.