Here are some of my codes used to solve mostly online judges problems. I have been working on them since I started my BSc degree.
Perhaps there are more other programs here not directly related to programming contests, however I also find them interesting.
Another important thing to point out is that not all of them solve the problem, but most do.
You may freely use these codes. Nevertheless, bear in mind that the most important in these problems are the logic behind.
Here are the sites from where I have taken the problems: