If (but for this subparagraph) any portion of the repayments referred to in subparagraph (A) would have been allowable as a deduction for the taxable year under section
165, such portion shall be allowable as a deduction only to the extent it exceeds the social security benefits received by the taxpayer during the taxable year (and not repaid during such taxable year).