You are in a political game whether you want to be or not and not speaking up first is a losing move. Your work speaks for itself 0% of the time without you speaking up for it. No one else will know what you did if you don't speak up.
You need to make sure to make yourself visible. You need to make sure that others are aware of what you do.
Letting people take credit in public for your work is also a losing move unless the person is your boss. Speak up and say it was your idea. But it is easiest if you present the idea publicly first so the other person doesn't even have a chance to take credit.
Please do yourself a favor and get some books on office politics.