If a broken pipe from the upstairs tenants apartment, floods my apartment. Who is responable to pay 4 damages?

The building itself will be covered by the landlords policy. Any personal property would be covered on your rents insurance.
Here is some more info:
http://www.insuremyhouse.com/info.html

Definitely the upstairs tenant.

Whoever has caused you an injury is responsible to cover your losses. It would help if you have enough proof to make your case in court, but you may be able to avoid court. If you are both tenants and the Landlord neglected the plumbing, the Landlord may pay. If the Landlord had plumbing work performed, and the work was done improperly, the plumber may be responsible (and likely has insurance). If the upstairs tenant was negligent in causing the pipe to break, he/she may be responsible. The Landlord may be insured and if you or the upstairs tenant have renter's insurance, one or both policies may help recover damages.

The short answer is, who caused the damage?

Could be the landlord, could be the tenant, could be a plumber, could be the manufacturer of the appliance or fitting that failed. You need more info.