I know competitive programming is all about how fast you can solve that problem and the machine will judge you , but while sharing your code for review or for helping others , please follow the points ,
- Try to avoid using letters as variables , unless mentioned in the problem , use some word which can say for what the variable is used.
- Properly use indentation and braces , do not write too much on a single line.
- Use spaces instead of tabs for indentation.
- If possible document it properly.
Well there are some others (though all wont agree on those),
- For C++ users , try to avoid , using namespace xxx; I know this means you have to write the namespace everywhere but trust me, sooner or later this will hurt you.
- Another , try to avoid using primitive arrays like int matrix[][]; ,C++ has given you STL , there is no point in using that thing which ups the speed a little but in turn carries the risk of memory corruption.
- Try to avoid declaring variables globally , though declaring them globally gives a little bit of more time but most problems test your approach , I , at least havent found any difference between using global and local variables , plus declaring variables locally also saves you from some potential bugs.
More tips and why's in the discussion.