I think Alexander Duality is what you are looking for. I gather that you are a non-expert, so I will attempt to describe in fairly informal terms how Alexander duality deals with the questions that you are interested in. Consequently, I'll suppress the inevitable technicalities, since they don't enter into the very geometric situations that you are interested in.
Alexander duality deals with the following situation. Let $S^n$ denote the $n$-dimensional sphere. Note that you can think of the $n$-sphere as being standard $n$-dimensional space $\mathbb{R}^n$ with an extra point "at infinity" added in (take a look at stereographic projection if this is unfamiliar to you). The upshot of this is that working with the $n$-sphere is not too far away from the situation you are interested in. Now take some subspace $X$, like the $m$-balls you are removing. Or take anything else; a solid torus of whatever genus you like, higher-dimensional manifolds, etc. Let $Y$ denote the complement of $X$ inside $S^n$. Then, in very informal terms, Alexander duality asserts that homologically, $Y$ is exactly as complicated as $X$. Somewhat more technically, Alexander duality asserts that for all $q$, there is an isomorphism
$$
\tilde H _q(Y) \cong \tilde H^{n-q-1}(X)
$$
between the reduced homology of $Y$ and the reduced cohomology of $X$ (for whatever coefficient group we choose). If the meaning of this is somewhat unfamiliar to you, you might be more interested to know that this says that the Betti numbers of $Y$ can be computed from those of $X$. In the range $1 \le q \le n-2$, a consequence of Alexander duality is that
$$
B_q(Y) = B_{n-q-1}(X),
$$
where $B_k(Z)$ indicates the $k^{th}$ Betti number of a space $Z$. If the piece $X$ that you are removing has $p$ components, this also implies that $B_{n-1}(Y) = p-1$.
As I remarked before, Alexander duality says that the topology of a space obtained by cutting a piece out is, from the point of view of homology (which encapsulates Betti numbers) exactly as complicated as the piece being removed. It is interesting to note that from the point of view of homotopy theory, this is incredibly far from being true. A basic technique in knot theory is to study a knot by studying the topology of its complement in $\mathbb R^3$ (or $S^3$). Homologically, Alexander duality says this is very boring, but from the perspective of homotopy theory, the story is very interesting indeed.
This can be answered with some knot theory. The openings can be thought of as an unlink on three components. This just means three circles that are not "linked" together. This Y shaped pipe can be deformed to a sphere with three holes missing from it. Just think about the pipe as if it were a weird ballon. If we would fill these holes, we get a sphere, which means that it has genus zero. Then, we know that the Euler characteristic of sphere is two. (For a genus $g$ "shape," the Euler characteristic is $2-2g$. )
But we added those disks, which each count as a face. So, to get back to our Y shaped pipe, we need to subtract those disks (faces), which means we have $2-3=-1$.
Or, we could have used this: From Rolfsen's Knots and Links, we have a relation which says $$ g(M)=1-\frac{\chi(M)+b}{2} $$ where $g(M)$ is the genus of a manifold $M$ (our Y shaped pipe), $\chi(M)$ is the Euler characteristic, and $b$ is the number of boundary components, which means the holes. We know the genus, and the number of holes, all you have to do is solve for $\chi(M)$.
Best Answer
First of all, I think that you may be confusing "sphere" with "ball". If you take a sphere a drill a hole through it, you get a cylinder, not a torus. But if you take a ball and drill a hole through it, you get a $3$-manifold with boundary whose boundary is a torus.
If you take a ball and drill two holes through it intersecting at the center of the sphere, you get a $3$-manifold whose boundary is a genus $3$ surface. To see this, imagine stretching one of the holes very much, so that what you have is essentially a donut with a hole drilled through it perpendicularly to its axis of rotational symmetry. There are three holes: one in the center, and two on opposite sides of the donut.
Doing the same thing with three holes intersecting at the center will leave you with two extra holes, so in other words with a genus $5$ surface.