Anomalous Joule law in the adiabatic dynamics of a quantum dot in contact with normal-metal and superconducting reservoirs