The Book of Romans address Sin very clearly, please look through the book of Romans so that you may gain more insight.
To address your question, let me take the following verses from the Romans 2:12-16
12 All who sin apart from the law will also perish apart from the law,
and all who sin under the law will be judged by the law. 13 For it is
not those who hear the law who are righteous in God’s sight, but it is
those who obey the law who will be declared righteous. 14 (Indeed,
when Gentiles, who do not have the law, do by nature things required
by the law, they are a law for themselves, even though they do not
have the law. 15 They show that the requirements of the law are
written on their hearts, their consciences also bearing witness, and
their thoughts sometimes accusing them and at other times even
defending them.) 16 This will take place on the day when God judges
people’s secrets through Jesus Christ, as my gospel declares.
In verse 14, it talks about gentile who didn't receive the law of Moses, I doubt if anyone who can 100% saying that have obey all according to the 10 Commandments, that they have done no sin.
Verse 13 first explained that, it is not that someone hears the law that he is righteous in God's eyes. But rather to those who obey the law, may God declare him to be righteous. Anyhow, God is the judge. A justice God.
During Jesus time however, the salvation has not yet complete. Yet, Jesus has been declaring the kingdom of God is near. The salvation is near, where people may find themselves righteous in God's eyes as they accept Jesus as their personal Savior and obey His teaching as a disciple. Two criteria in one obedience.
You believe Jesus, then you do what He says.
Verse 15, when the gentiles have not bound to the law of Moses. Then it talks about the heart of the gentiles, and indeed as human being, we have a sense of moral, anyhow from the beginning of time until the day when Jesus completed the Salvation, for them it's the same all along. That in their consciousness, they know what is right and wrong. And because of this, God may judge them according to their hearts. Not by the law of Moses.
And everyone who died in anytime from the beginning of time, until the second coming of Jesus Christ in the future. They are not in heaven or hell, but rather, all will be risen from the dead. That is the resurrection before the Final Judgement. Those who died can not change their course, but those who are living can still make their choice. To be righteous in God's eyes is what matters.
Glory to God for his wisdom, justice, grace and mercy. Amen.