By keeping score.
Science of Us has some advice that people in long-term relationships have probably known for a while. Scorekeeping is toxic and should be avoided at all costs:
Keeping track of who does what for whom (a “tit-for-tat” game) is a sign you are not seeing your behaviors as benefiting the relationship, but just as benefiting one partner or the other. Try to see how your actions benefit the relationship, because, ultimately, your relationship ultimately benefits you both.
After all, you can be right or you can be happy.