Subset Of Sequences

Limits: 1s, 512 MB

You will be given a set of sequences. Each sequence is a list of numbers. Two sequences are K-similar if the first K or more numbers from the both sequences are same and appear in same order in both set(K must be less than or equal to the size of the smaller sequence). That is the K length prefix of both sequence is same. So [1, 3, 5, 7, 9, 11] and [1, 3, 5, 7, 8, 11] sequences can be said 4-similar, 3-similar, 2-similar, 1-similar or 0-similar. [2, 4] and [2, 4, 6] are 2-similar, 1-similar or 0-similar. And [1, 2] and [2, 1] are only 0-similar.

This is a companion discussion topic for the original entry at