Finding heat of formation
The question: The heats of combustion of $\ce{C_xH_y}$, $\ce{C}$, and $\ce{H2}$ are $a, b,$ and $c$ $\pu{cal mol-1}$, respectively. What will be the heat of formation of $\ce{C_xH_y}$?

We have three combustion reactions to consider:
$$\ce{C + O2 -&gt; CO2} \quad \Delta H_{\mathrm{comp}(\ce{CO2})} = b \tag{1}$$
$$\ce{H2 + 1/2 O2 -&gt; H2O}  \quad \Delta H_{\mathrm{comp}(\ce{H2})} = c \tag{2}$$
$$\ce{C_xH_y + ($x$ +y/4) O2 -&gt; x CO2 + y/2 H2O}  \quad \Delta H_{\mathrm{comp}(\ce{C_xH_y})} = a \tag{3}$$
Assuming the given answer is correct, I have to tell this straight: The wrong doing in this question is giving all three heat of combustion values as their numerical values and not mentioning it in the question (thus, solver has to assume it). That, I called being tricky at this level of education. For example, if the question is a multiple choice, then it may include both $-\left(x b+\frac{y c}{2}-a\right) \ \pu{cal mol-1}$ and $+\left(x b+\frac{y c}{2}-a\right) \ \pu{cal mol-1}$ as chices to pick as an answer. Too bad for students.
Let's assume $\Delta H_{\mathrm{comp}(\ce{CO2})}$ is $-b$ in the equation $(1)$, and so on. Now we can rewrite above equations as:
$$\ce{C + O2 -&gt; CO2} \quad \Delta H_{\mathrm{comp}(\ce{CO2})} = -b \tag{4}$$
$$\ce{H2 + 1/2 O2 -&gt; H2O}  \quad \Delta H_{\mathrm{comp}(\ce{H2})} = -c \tag{5}$$
$$\ce{C_xH_y + ($x$ +y/4) O2 -&gt; x CO2 + y/2 H2O}  \quad \Delta H_{\mathrm{comp}(\ce{C_xH_y})} = -a \tag{6}$$
From the equation $(4)$:
$$\Delta H_{\mathrm{comp}(\ce{CO2})} = \Delta H_{f(\ce{CO2})} - \left(\Delta H_{f(\ce{C})}  + \Delta H_{f(\ce{O2})}  \right) = \Delta H_{f(\ce{CO2})} - \left(0  + 0  \right) = -b\\ \therefore \ \Delta H_{f(\ce{CO2})}  = -b \tag7$$
Simillarly, from the equation $(5)$:
$$\ \Delta H_{f(\ce{H2O})}  = -c, \tag8$$
and from the equation $(6)$ :
$$\Delta H_{\mathrm{comp}(\ce{C_xH_y})} = \left(x\Delta H_{f(\ce{CO2})}  + \frac{y}{2}\Delta H_{f(\ce{H2O})}  \right) - \Delta H_{f(\ce{C_xH_y})} = \left(-xb - \frac{yc}{2}\right) - \Delta H_{f(\ce{C_xH_y})} = -a$$
$$\ \Delta H_{f(\ce{C_xH_y})}  = +a - \left(xb + \frac{yc}{2}\right) \tag9$$
The equation $(9)$ is the correct answer.