\text{1,2,3}$ 容易做到 $O(n+m+k)
等价于对于每个 $i$ 求
$$\begin{aligned}
&\sum_{l\le i,l<k}[s[i-l+1:i]+t[1:k-l]=p]\\
=&\sum_{l<k}[l\text{ is border of }(p+\text{'\$'}+s[1:i])][(k-l)\text{ is border of }(t+\text{'\$'}+p)]\\
\end{aligned}$$
等价于在 $$p+\text{'\$'}+s$$ 的 $\text{fail}$ 树上给定点查询该点到根的链上满足 $$(k-l)\text{ is border of }(t+\text{'\$'}+p)\land l<k$$ 的 $l$ 数量,容易扫描线做到 $O(m+k+n\log(n+k))
对于 6,等价于对于每个 i 求
&\sum_{m<l<k}[s[i-(l-m)+1:i]=p[1:l-m]][t=p[l-m+1:l]][s[i+1:i+k-l]=p[l+1:k]]\\
=&\sum_{m<l<k}[(l-m)\text{ is border of }(p+\text{'\$'}+s[1:i])][t=p[l-m+1:l]][(k-l)\text{ is border of }(p^R+s[i+1:n]^R)]\\
\end{aligned}
等价于两颗 \text{fail} 树上分别给定点,查询同时在两个点到根的链上满足 m<l<k\land t=p[l-m+1:l 的 l 数量,转化为静态矩形加单点查询,容易扫描线做到 O(m+(n+k)\log(n+k))