Solution (source code)

= Solution

Order the support as $K_1<\cdots<K_N$ and put
$$
s_i=\frac{g(K_i)-g(K_{i-1})}{K_i-K_{i-1}}.
$$
On the finite support,
$$
g(S_T)=g(K_1)+\sum_{i=2}^Ns_i
\{(S_T-K_{i-1})^+-(S_T-K_i)^+\}.
$$
This follows by telescoping: at $S_T=K_j$, only terms through $j$ survive and reconstruct successive increments of $g$. The <static replication on a finite terminal support> therefore has no-arbitrage price
$$
\pi_t=g(K_1)P_t^T+
\sum_{i=2}^N
\frac{g(K_i)-g(K_{i-1})}{K_i-K_{i-1}}
(C_t^{T,K_{i-1}}-C_t^{T,K_i}).
$$