Problem Statement:
A k-bounded list of length n is a sequence [x1, x2, . . . , xn] where each xj
is an
integer between 0 and k, inclusive. A good list is one that does not contain three
consecutive values 0, 1, 0. For example, for n = 4 and k = 2, [2, 0, 0, 1] and [1, 0, 0, 1]
are good lists while [0, 1, 0, 2] and [0, 0, 1, 0] are not.
Let good(n, k) be the number of good k-bounded lists of length n. For instance,
the good 1-bounded lists of length 2 are {[0, 0], [0, 1], [1, 0], [1, 1]}, so good(2, 1) = 4.
Similarly, you can check that good(4, 1) = 12 and good(3, 2) = 26.
Your task is to compute good(n, k) for the following values of n and k.
(a) good(7, 1)
(b) good(7, 3)
(c) good(20, 1)
Note: This is a question from a past contest and the official answers for the parts a, b and c are as follows:
(a) good(7, 1) = 65
(b) good(7, 3) = 15163
(c) good(20, 1) = 97229
My Approach: I came up with the following recurrence relations,
$$p(i,0) = p(i-1,0) + p(i-1,1) - p(i-2,0)$$ $$p(i,1) = [p(i-1,0) + p(i-1,1)]\times k$$
where $p(i,0)$ is the number of good lists of length $i$ ending with 0 and $p(i,1)$ is the number of good lists of length i not ending with 0. The idea behind this is that every good list of length $i$ is an extension of a good list of length $i-1$ but there can also be some bad extensions in the process, hence it is better to handle them separately. Therefore, in case a good list ends with 0,1 then we need to take care of the fact that while extending this list we don't count the lists where we place a 0 at the end, otherwise we will have 0,1,0 in the list. So what we do is that we just count all the lists of length $i$ ending with 0 and then subtract the lists of length $i-2$ that end with a 0. Whereas the case where we do not use a 0 at the end is a bit simpler.
I just filled the table for the above recurrence manually with the initial values as $p(0,0) = 0$, $p(0,1) = 0$, and $p(1,0) = 1$, $p(1,1) = k$ (since it was a pen and paper exam) and could arrive at the answers which is the sum of $p(n,0)$ and $p(n,1)$ [C++ code for reference: https://ideone.com/wSVhVL]. But then I have been thinking whether this problem has a closed form solution, some function in n and k. I couldn't arrive at one until now. Can anyone provide some combinatorial insight? Is a closed form solution possible?

I am going to use Chomsky-Schutzemberger method to find the generating function of this (you put DP as tag, so I guess you are interested in computational stuff). Consider the following automaton that accepts the good lists.
If you label $A,B,C,D$ the nodes of the automaton, then the following system of equations gives you the generating function of the number of strings of size $n$ that the automaton accepts. $$A=1+kxA+xB, \, B=xB+xC+(k-1)xA+1,C=\, kxA+1.$$ We omit $D$ because is a state that dies. Doing the substitution, you get $$(1-kx)A=1+xB=1+x\frac{x+kx^2A+(k-1)xA+1}{1-x},$$ So $$A=\frac{1+\frac{x^2+x}{1-x}}{1-kx-\frac{kx^3+(k-1)x^2}{1-x}},$$ hence $$A=\frac{1+x^2}{(1-x)(1-kx)-(kx^3+(k-1)x^2)}=\frac{1+x^2}{1-(k+1)x+x^2-kx^3}=\frac{1}{1-\left ( kx+\frac{x}{1+x^2}\right ) }.$$ This agrees with your findings.
One can try to factor the denominator to try to use partial fractions and get a formula. The problem is that this polynomial does not seem to have a nice factorization (for low $k'$s) that would be enough evidence to me that a "nice close formula" is not possible. OEIS just seems to have $k=1$.
Case k=1: The OEIS gives that $$a_n = \sum_{k=0}^{n+2} \binom{n+2-k}{2k}.$$ which says that somehow a tiling problem can be attach to this(reminds me of Fibonacci).
General case: A very ugly but closed formula can be seen to be $$a_n=\sum _{i=0}^n\sum _{\substack{a_0+2a_1+4a_2+\cdots +2\ell \cdot a_{\ell}+\cdots =n-i\\ a_0+a_1+\cdots =i}}\frac{i!}{\prod _{j=0}^{\infty} a_j!}(k+1)^{a_0}(-1)^{a_1+a_3+\cdots +a_{2\ell +1}+\cdots }$$