<s>[INST] $a+b+c+d=4n$; where $a,b,c$ lie between $0$ and $n $ and $d$ lies between $0$ and $2n.$ In the examination the max marks for each of three papers is $n$ and the fourth paper is $2n$. find the number of ways in which a candidate can gets $3n$ marks ?
 [/INST] Rather than applying inclusion-exclusion, you can let generating functions do the work for you. The possible (integral) marks that can be obtained for a single paper with maximum mark$~m$ is given by the polynomial $1+X+\cdots+X^m=\frac{1-X^{m+1}}{1-X}$. You want to get the coefficient of $X^{4n}$ (or maybe of $X^{3n}$) in the product of those polynomials for $m=n,n,n,2n$. Multiplying the numerators gives $(1-X^{n+1})^3(1-X^{2n+1})$, which gives $1-3X^{n+1}-X^{2n+1}+3X^{2n+2}+3X^{3n+2}-X^{3n+3}$ after dropping term of degree${}>4n$ that do not interest us. The denominator is $(1-X)^4$, so we must multiply the numerator by $(1-X)^{-4}=\sum_{k\in\Bbb N}\binom{k+3}3X^k$. Then the coefficient of $X^{4n}$ in the product is
$$
  \binom{4n+3}3-3\binom{3n+2}3-\binom{2n+2}3+3\binom{2n+1}3+3\binom{n+1}3-\binom n3=\frac{n^3+6n^2+11n+6}6.
$$
One can check this result as being the unique cubic polynomial in $n$ that gives $1,4,10,20$ (found by explicit counting) for $n=0,1,2,3$, respectively.
</s>