This teaching is taken from a Mishna in maseches Makos, which, in the context of our discussion, states as follows:
““By word of two witnesses or three witnesses, the one [destined for] death shall be put to death…” (Divarim: 17; 6) If the testimony stands with two [witnesses], why does the verse specify three [witnesses]? Rather, [the verse mentions three witnesses in order] to make a connection between two [witnesses] and three [witnesses]. Just as three [witnesses] can perjure two [witnesses], so too, two [witnesses] can perjure three [witnesses]. From where do we know that even one-hundred [witnesses can be perjured by two witnesses]? The verse states, “witnesses”. Rabbi Shimon says, just as two [witnesses] can not be put to death until they are both perjured, so too, three [witnesses] are not put to death until all three of them are perjured. From where do we know that [this teaching even applies] to one-hundred [witnesses]? The verse states, “witnesses”. Rabbi Akiva says, the third [witness] did not come to make [the law] more lenient for him, rather, [he comes to make the law] stricter upon himself and to make the law as it applies to him just as the law applies to [the first two witnesses]. Therefore, the verse punishes the one who unites with the sinners to be [treated] as [the law treats] the sinners. How much more so will the reward be given to the one who unites with the performer of a mitzvah, as [the reward of] the [other] performers of the mitzvah. Just as [it is the case] if one [of the witnesses] is found to be a relative or [otherwise] unfit [to testify, in that case] the testimony of all of the witnesses is invalid, so too [is this true] with three [witnesses]: If one of the [three witnesses] is found to be a relative or [otherwise] unfit, the testimony [of all three] is invalid. From where do we know that this is true regarding one-hundred [witnesses]? The verse states, “witnesses”…”
From here we see that even if someone is not one of the main sinners in a group, they are treated as one of the main sinners due to their association with the sinners. However, just as one witness can invalidate the testimony of one-hundred witnesses, so too, one individual can save an entire group of sinners by stopping them from sinning. However, there are better ways to stop sinners than by associating with them. For, if one would grow tired of rebuking such sinners while in their midst, it would be considered a sin on the part of that person. Furthermore, in Parshas Shilach, we learn that in the incident involving the spies, only Yihoshua and Calev did not speak slanderously against the Land of Israel. Yihoshua was not negatively influenced by the sinful council of the spies, for he spoke his mind. Therefore, Moshe gave him a bracha that would be saved from the evil council of the spies by adding a letter “yud” onto his name, changing his name from “Hoshea” to “Yihoshua”. (Bamidbar: 13; 16) Calev went to Chevron in order to pray by the graves of our forefathers, beseeching them to intercede on his behalf before HaShem so that he wouldn’t be negatively influenced by the council of the ten spies. We learn that Calev went to the graves of our forefathers in Chevron, for the pasuk states: “And they ascended in the South, and he came to Chevron…” (Bamidbar: 13; 22) The gemara in maseches Sotah teaches us that the singular “…he came to Chevron…” teaches us that only Calev went to Chevron. (Sotah, 34b) Calev was later given the city of Chevron as part of his inheritance as he followed HaShem, (Shoftim: 1; 20) defending the Land of Israel against the slander and libel spoken by the ten spies. (Bamidbar: 13; 30)
The Chofetz Chaim points out (sefer “Shmiras HaLashon”, volume 2, chapter 19 (14th of Av)) that only Calev spoke out against the ten spies, for the ten spies thought that he was in agreement with their council as he decided to verbally agree with them during the forty days spying out The Land of Israel, when, in fact, he opposed their libel and slander against the Land of Israel. Yihoshua did not speak against the spies before the Israelites, for the spies knew that he opposed their council, for he was outspoken against them. The Chofetz Chaim explains that Yihoshua had the advantage of expressing his sentiments, protecting himself from being taken in as easily by the ten spies. However, Calev, who verbally agreed with the spies, went to pray by the graves of our forefathers, as his silence led him to be more vulnerable to joining their evil council. Calev prayed that the merit of our forefathers should assist him so that he not be corrupted by the sinful council of the ten spies. Moshe’s prayer for Yihoshua helped save him from any potential physical danger posed by the spies who knew that Yihoshua was opposed to their council.
 The Mishna in maseches “Avos” states that a person who brings the masses to sin will not be able to perform Teshuvah. However, in maseches “Yoma” (87a) it states that the individual would almost be unable to perform Teshuvah. According to the RaMBa”M, as quoted in the Kehati, this individual loses the free will to perform Teshuvah. The gemara in maseches Yoma states that the one who leads the masses to sin is not given sufficient opportunity to perform Teshuvah so that his “students” will not suffer in gehinnom while he is enjoying living in The World to Come. The same is true in the converse, as the Mishna in “Pirkei Avos” states, “All those who bring merit to the masses will not have sin come by way of him…” so that he will not suffer in gehinnom, while his “students” enjoy their reward in The World to Come. (Yoma, 87a)