I would suggest a slightly different approach to solve this problem. The sample space imposed by the condition that there are $c$ correct answers among a total of $a+b $ answers is given by $\binom{a+b}{c}$, i.e. the number of ways in which $c$ successes can be distributed among a total of $a+b $ trials. This sample space corresponds to a probability $\binom{a+b}{c} \, p^c \,(1-p)^{a+b-c} $.
Working within this sample space, if we want to know the probability that the first student gives exactly $d $ correct answers, we have to count - among the total $\binom{a+b}{c}$ possible distributions of the $c$ correct answers - how many of these distributions have $d$ successes among the $a$ answers given by that student (and consequently also $c-d$ successes among the $b$ answers given by the second student).
To count the number of these "valid" distributions, we can note that the $d $ correct answers can be distributed in $\binom{a}{d} $ ways among the $a$ answers given by the first student. Similarly, the remaining $c-d$ correct answers can be distributed in $\binom {b}{c-d}$ ways among the $b$ answers given by the second student. This leads to a total of $\binom {a}{d} \binom{b}{c-d}$ valid distributions. Dividing this number by the total number of possible distributions, we get that the searched probability is
$$\displaystyle \frac {\binom{a}{d} \binom{b}{c-d}
}{ \binom{a+b}{c} } $$
Note that this probability does not depend on $p$. We calculated it as the ratio between valid and total possible configurations, but we could also have obtained it as the ratio between the probability of valid distribution and the "total" probability corrisponding to our sample space. In this case, there would have been an identical additional term in the fraction - that is to say, $p^c \,(1-p)^{a+b-c} $ - which would have been canceled out, resulting in the same formula given above.
For example, let us hypothesize that the first and second student give $a=6$ and $b=4$ answers, respectively. Under the condition that $c=7$ among these are correct, our sample space is given by a total of $\binom{10}{7}=120$ possible distributions. Let us hypothesize that we are interested in calculating the probability that, under these conditions, the first student has given exactly $5$ correct answers. To count the number of "valid" distributions, we can firstly note that these $5$ correct answers can be distributed, among the $6$ answers given by the first student, in $\binom{6}{5}=6$ ways. Then, we have to multiply by the number of ways in which the remaining $2$ correct answers can be distributed among the $4$ answers given by the second student, that is to say $\binom{4}{2}=6$. So, we have $6 \cdot 6=36$ valid distributions in which the first student has given exactly $5$ correct answers. Dividing this by the total number of distributions given by our sample space leads to a probability of $36/120=0.3$.
Lastly, we could have obtained the same result by dividing the probabilities of valid and total distributions, instead of their numbers. In this case, for any given value of $p$, we would have obtained $[36\, p^7 \, (1-p)^3]/[120 \, p^7 \, (1-p)^3]$, which again reduces to $0.3$.