When there will be increase in the internal energy of a system?
If the system gains heat and work performed on the system both are positive.
If heat gained by the system and work performed on the system both are positive, then internal energy will increase.