This question can be tested in two parts: whether substituted performance is available to A in principle, and whether A actually followed the procedure the statute requires to use it.
Test 1, availability in principle:
Section 20 does recognise substituted performance as a remedy, so A is not confined to an ordinary damages suit, and B's own breach is a real trigger that could, in principle, support A's claim.
Test 2, procedural compliance:
Before hiring a third party, the statute requires the aggrieved party to send the defaulter written notice giving at least thirty days to perform. A hired C immediately, without any such notice to B.
Conclusion:
Although A passes Test 1, A fails Test 2 because the mandatory notice was never sent. That procedural failure, not the unavailability of the remedy or any need for a prior court declaration, is what actually bars A's recovery of the extra ten lakh.
The written notice requirement in Section 20 exists to give the defaulting party a genuine last chance to perform before the other side spends money getting the work done elsewhere and then comes back demanding reimbursement. Measuring each option against that fair-warning purpose shows why only one correctly explains A's position.
Because A denied B the fair chance to perform that the notice requirement is meant to guarantee, it is this missing notice that actually blocks A's claim.
Therefore, the correct answer is A cannot recover the cost because A did not give B prior notice.