Allah has mentioned the importance of different actions and the meaning of that is if the person does a good deed it should not be followed by a bad deed, which would erase the affects of the good deed, because every succeeding action can affect its preceding action.
Similarly, actions that are followed by good actions may be erased, it is just like medicine if there is no prevention than it cannot have much effect.
The reference of the Hadith you gave about 40 prayers with two certificates granted to the person is an authentic Hadith. Sins will be for given, salvation from Hell would be attained, prayers with congregations are performed these are some of the benefits. Therefore we should not forsake attending the congregations.
