Indeed, [the person’s judgment in Heaven] is dependant on the way that he interacts with people in his lifetime. If he was accustomed to judging them favorably, they, [in the Heavenly Court], will also judge him favorably, as is [taught] in [maseches] Shabbos (127b). If he was accustomed to draw conclusions of guilt about the people, and to speak evil about them, the Ministering Angels also speak evil about him Above, [in Heaven], as is [taught] in Midrash Mishlei. Therefore, a person must know within himself while he is still alive, that at the time that he judges his fellow, whether for good or for bad, then, with his speech, he is actually setting up the [Heavenly] judgment of himself.
 The entire passage in the gemara states as follows:
“We learn in a Baraisa, [as follows]: A person should always see himself as if half of [his deeds are weighed on the side of] guilt and half of [them are on the side of] merit. If [a person] performs one mitzvah, he is praiseworthy, for he [moved] himself to the side of merit. If he performed one sin, woe to him, for he [moved] himself to the side of guilt, as it says [in Koheles], “And one sin will cause a great deal of good to be lost.” (Koheles: 9; 18) Due to one sin that he sinned, many good [deeds] have been lost from [his possession]. Rabbi Elazar, the son of Rabbi Shimon, says, “Since the world is judged after the majority, and the individual is judged after the majority, if he performed one mitzvah, he is praiseworthy, for he [moved] himself and the entire world to the [side] of merit. If [the individual] performed one sin, woe to him, for he [moved] himself and the entire world to the [side] of guilt, as it says, “…And one sin [causes a great amount of good to be lost.” Due to one sin that this one [person] performed, he caused himself and the entire world to be denied a great deal of good.” Rabbi Shimon ben Yochai says, even one who is completely righteous all of his days, and in end [of his life] he rebels [against the Torah way of life], he loses [the reward for] his first [deeds], as it says, “The righteousness of the righteous will not save him on the day of his rebellious sin.” (Yichezkhel: 33; 12) Even one who is a complete evildoer all of the days of his [life], and he performs Tishuvah in the end [of his life, the Heavenly Court] will no longer mention his evil, as it says, “And the evil of the evildoer, he will not stumble in it on the day he returns from his evil”, (Yichezkhel: 33; 12) and he will be as one who is equally divided between sins and merits. Reish Lakish said that [the above teaching where we learn that the righteous person who rebels against the Torah loses the merits of his previous deeds, only applies in a case] when he regrets [having performed his] first [meritorious deeds].
RaSh”I comments on the above gemara that a person should view the world as being comprised half of righteous individuals and half of evildoers and he should view his actions as being comprised equally of merits and demerits. If he performs one mitzvah, he would move himself, and thereby the entire world, to being comprised of a majority of righteous individuals, and if he performs one sin, the world will be composed of a majority of evildoers.
Based on the above, we can see how great the implications could be of any given action. Since the world is judged based on the majority, whether for punishment or for reward, if one moves the world to the side of merit based on his meritorious action, by performing one mitzvah, then the entire world benefits. However, if one sins, he may move the entire world to be composed of a majority of demerits, thus bringing a great deal of punishment to the world and causing the world to lose a great deal of good of which it would have otherwise benefited. Thus, before performing a mitzvah or an aveirah (sin), a person should contemplate the very negligible “reward” of sinning or refraining from doing the mitzvah as compared with the awesome reward, both for him and for the entire world. By doing so, a person would come much more easily to perform a mitzvah and refrain from performing an aveirah.
Regarding a righteous individuals who becomes an evildoer at the end of his life, chas v’shalom, RaSh”I comments that it should be considered that he has an equal number of mitzvos and aveiros. However, when he regrets having performed those mitzvos which he did earlier in his life, he loses the reward for having performed those mitzvos.
 The gemara in maseches Rosh HaShanah, states as follows:
“We learn in a Baraisa, [as follows]: Beis Shammai says, there are three groups on the Day of Judgment, one [composed] of the completely righteous, one of the completely evil, and one [that includes those who are] in the middle [of the first two groups]. The completely righteous are immediately written and sealed for eternal life, [those who are] completely evil are immediately written and sealed [to enter] gehinnom, as it says, “And many of those who were “sleeping” in the dirt ground shall awaken, these for eternal life, and these for eternal shame and disgrace.” (Daniel: 12; 2) Those who are in the middle [group] will descend to gehinnom [for a moment], will scream [and cry out] and ascend, as it says, “And I shall bring a third in fire, and I shall refine them as silver is refined and I shall test them as one tests the gold, he will call out in My Name, and I shall answer him.” (Zichariah: 13; 9) With regard to [those in the middle group who are , Chanah said, “HaShem puts to death and brings to life, brings down to sh’ole (hell), and brings up [from sh’ole].” (Shmuel I: 2; 6)”
 This is the gemara quoted previously that discusses the employee who judged his employer favorably when the employer said he was unable to pay him for his three years of service, immediately at the conclusion of his three years of service. Once the employer (Rabbi Eliezer ben Hurkenos) compensated his employee (Rabbi Akiva), he asked Rabbi Akiva what he suspected him of when, at the conclusion of his three years of labor, he told him he was unable to compensate Rabbi Akiva with money and various commodities. Once he found out that Rabbi Akiva had judged him favorably, he told Rabbi Akiva that HaShem should judge Rabbi Akiva favorably just as Rabbi Akiva judged him (Rabbi Eliezer ben Hurkenos) favorably. Following this incident recorded in the gemara are two other incidents, the first one involving a chassid, the second one involving Rabbi Yihoshua, both incidents looked as if these great individuals committed a forbidden act involving the opposite sex. In both cases, these scholars asked their students what they suspected them of when they witnessed the suspicious circumstances surrounding their respective incidents. In each instance, the students judged their rabbis favorably, which turned out to be correct. In each case, the rabbis told the students that just as the students judged them favorably, so too should, they should be judged favorably by HaShem.
 This teaching is found in Midrash Shocher Tov, over there, parsha 11, in the pasukShocher Tov…” “