The initial defense is by the tenant. The tenant's subtenants are not engaged in a legal relation with the landlord (not in privity of contract).
If you paid the rent directly to the landlord in your name, suggesting that the landlord knew of the breach of the lease and still accepted the rent, you might present in your Answer to the landlord's petition a defense grounded upon waiver.
Defending a breach of lease sublet holdover proceeding is complex and you should make certain that you retain an attorney as soon as possible.
The fact that the tenant disclosed the occupants of the apartment does not by itself establish "consent" to a sublease without the landlord's consent.
The "occupant" list will typically report tenant roommates. When the landlord discovered the "roommates" were living in the apartment without the tenant, the landlord would then have knowledge of the subleasing without permission.
The answer provided to you is in the nature of general information. The general proposition being that you should try to avoid a bad outcome if you can.
In Rent Stabilization, it must be the Tenant's primary residence. If the Tenant does not live there, s/he is in violation of the Rent Stabilization Laws. If the Tenant is subletting, s/he must ask consent before s/he can sublet the housing accommodation.
Unless you provided the landlord with WRITTEN notice of the leak, you are not entitled to deduct. The landlord may commence a proceeding after the notice to cure in housing court because: 1) the prime tenant does not live in the rent stabilized unit; and 2) the undertenants (the 3 other people) are not Tenants. If the landlord can show that the Tenant does not live there, the court will grant an order to evict.
The Rent Stabilization Code is very specific concerning the right to sublet. Most importantly, you must obtain written consent from the landlord after submission of your request to sublet. The occupancy statement you filled out has nothing to do with subletting. It is used primarily as evidence in succession cases where family members of rent-stabilized tenants claim independent rights to renewal based on longevity of occupancy with the primary tenant.
Illegal subletting, in and of itself, is curable. You should consult an attorney to determine if it will be possible in your situation and if there are any other extenuating circumstances that might affect your defense. Regarding retaliation, again, the law is specific. The defense of retaliation is usually upheld by the courts only where there has been a tenant complaint to a governmental agency such as HPD or the Building Department within 6 months of the landlord's action. Once the defense is properly pled, the landlord is free to prove to the court that retaliation is not the reason for the action and that there are other valid grounds. In your case subletting, would be another valid ground for eviction.
There are other issues that present themselves in your question and you should seriously consider retaining counsel. This answer does not constitute legal advice.