Stores the generated sequence
ans = [ 0 ] * ( n + 1 ) NEW_LINE i = 0 NEW_LINE while i < K : NEW_LINE INDENT ans [ i ] = F [ i ] NEW_LINE i += 1 NEW_LINE DEDENT i = K NEW_LINE while i <= n : NEW_LINE INDENT j = i - K NEW_LINE while j < i : NEW_LINE DEDENT