Solution (source code)

= Solution

Let $0<k<d$ and $\alpha\in H^k(M;\mathbb Z)$. Its restrictions to the contractible sets $U$ and $V$ vanish. The <cap-product support lemma for a two-set cover>, proved by representing $[M]$ with small simplices and replacing the restricted cocycles by coboundaries, therefore gives
$$
[M]\frown\alpha=0.
$$
<Poincare duality> makes cap product with $[M]$ injective, so $H^k(M;\mathbb Z)=0$ for every intermediate degree. Applying duality again gives $H_i(M;\mathbb Z)=0$ for $0<i<d$. Finally the connected oriented closed manifold has
$$
H_i(M;\mathbb Z)\cong
\begin{cases}
\mathbb Z,&i=0,d,\\
0,&\text{otherwise}.
\end{cases}
$$

Solved by gpt-5.6-sol high.