A single good dish requires two distinct meat portions and one cheese portion. Thus k dishes consume 2k meat portions and k cheese portions. Constraints:
\begin{cases}
2k \le a+b+c, &\text{(total meat available)},\\
k \le (a+b+c)-\max\{a,b,c\}, &\text{(no meat portion reused)},\\
k \le d, &\text{(cheese available)}.
\end{cases}
Let
s=a+b+c, \qquad M=\max\{a,b,c\}.
The two upper bounds on meat are ( s/2) and ( s-M ), hence the effective meat bound is
min(⌊s/2⌋,s−M).
Combining with cheese:
k=\min\!\Bigl(d,\;\min(\lfloor s/2\rfloor,\;s-M)\Bigr).
Unused portions in total:
R=(a+b+c+d)-3k.