10 Things to Know About Speed Programming Competitions

If you’re a budding computer science student in the early stages of getting a college degree, you might have come across, or at least heard, about speed programming competitions.

Almost every university with a computer science program holds its own technology olympiad in Pakistan; NUST arranges its own NUST Olympiad, FAST has Procom, IBA boasts ProBattle, Karachi University’s UBIT conducts ProQuest and more.

One thing that is common in all these events is that none of them is complete without a battle of the coders— the prize jewel of tech-related competitions, “Speed Programming”.

What is Speed Programming?

Speed Programming, also known as competitive programming, is a competition for IT-disciplined students to show off their programming skills by solving logical puzzles using code. Aptly named, speed programming is a timed competition in which the faster and the more programs you solve, the better your chances are of winning it.

Generally, a Speed Programming competition consists of two rounds; Qualification and a Final. In each round, you get from five to six problems and the ones who solve the most problems move on to the next round.

However, solving all of the problems is almost never possible and most competitors barely manage to solve a couple, or at most, three or four problems. For some tough competitions, even if you manage to solve just one problem, you have a chance of moving on to the next round.

A programmer myself, I have participated in more than a couple of programming competitions since I started college. As a starter, I didn’t find enough decent online resources to help me prepare for me for a Speed Programming competition and only after abysmally failing to solve even a single problem in my first competition did I learn how it all worked.

So, for beginners like myself, here is a helpful guide for taking part in a speed programming competition,

  • Learn File I/O:

File I/O stands for File Input/Output. One of the most basic requirements of taking part in a speed programming competition in almost any university in Pakistan is the ability to take input from a file. Without it, there is no way you can solve even a single problem as every question requires you to take input for your program from a text file.

The methods of reading or writing from/to a file differ from language to language and a single programming language can also have multiple ways to achieve that. For example, if you are programming in Java, Buffered Reader and Scanner are generally used to read input from a file. Generally, the output is given on the console so learning to write on a file isn’t as important as reading from it.

  • Be familiar with your coding environment

PCs provided to you at the time of the competition usually come pre-installed with most popular IDEs, text-editors, and programming softwares. You can also request for a particular software of your choice in some cases. You should go with the coding environment you are most familiar or used to.

  • Forming a good team

Speed programming competitions are mostly team-based, allowing up to 3 people to compete as a team. Form your team carefully. There are a lot of ways to form a good team, depending on your personal preference.

One way is to have one person who is good at logic puzzles and designing algorithms for them, one who is good at typing fast, and one who has good knowledge of programming libraries and built-in functions.

  • Knowledge of Data Structures

At least one person in your team needs to have a good knowledge of data structures, including arrays, linked lists, trees, graphs, etc.

  • Go for brute force, not optimization

The datasets given in programming competitions are not that large and don’t require much computing power. Therefore, there is no point of wasting your time by going for optimization. Time is the thing you lack the most, not computing power. Just go for the most straightforward way of solving a problem you can think of!

  • Ditch Exception Handling

There is no point in adding exception handling to your code. An exception means there is a problem in your code, and if there is a problem in your code, you won’t get any marks for solving it, regardless of the fact if it has exception handling or not. There are no half marks for “nearly” solving it. So adding exception handling is just a waste of precious time.

  • Learn how to submit

Most competitions use PC^2, a programming contest control tool, for checking codes submitted by the competitors. Usually, you have to submit just the source code files (.c, .cpp, .java, etc). However, the procedure of submission may differ from competition to competition. Learn about it beforehand so as not to waste time when you have to submit a code.

  • Tackle the easiest problem first

Go through all the problems first and try to figure out which one is the easiest. Once you have done that, do that one first! If you get stuck, just move on to the next-easiest problem. Solving all the problems is almost unattainable so there is no point in getting stuck over just one.

  • Test your program before submission

Test your program thoroughly before submission by adding or changing the input values to check if it works as a generalized code. Also, try to figure out some unique input values that could break your code and test them out. Your code needs to be completely generalized and should work with any input given within the described constraints.

  • Practice!

There is no better way to get ready for a competition than to practice. You can find lots of resources online with just a simple google search. You can also try out past problems given at Google’s Code Jam competition, a kind of a speed programming for the whole world. They may be a little harder than your average competition but they are the best practice you can get.


  • Mushif Ali Nawaz

    Yeah, I myself have participated in many “Speed Programming Competitions” and won a lot of them! Many students asked me how did you manage to do that? I always say: “Practice!”.

    There is no other way to develop this skill. Secondly, you need to be a good typist too. Because if you somehow managed to make logic of the code on paper (algorithm) you need to implement that in code so that PC can understand that. There are many online resources there to learn touch typing (typing without peeking on the keyboard).

    Other important skill needed is to know the algorithms like “Dijkstra’s algorithm” to find the shortest path etc. Work hard on learning these algorithms and also learn when and where you should use these algorithms. And practice as much as you can, then you can easily ace such competitions. :)

    Most important thing is, competitive programming helps you in your normal day programming too. It will help you make the logic faster, you’ll become better at debugging the code. So I think every CS student should learn and participate in “Speed Programming Competitions”.

  • Ez katka

    The brute force point is no longer applicable. Time complexity matters in competitions nowadays.Pc^2 supports time complexity and the organisers can set a time limit in which the program must complete its execution. If you have used poor performing algorithms you will get an error of time limit exceeded upon submission on pc^2.

    • Rabi Ul Islam

      its a game though, tough tou hogi

    • Mushif Ali Nawaz

      Yeah! That’s correct too! If you’re using nested loops up-to 10^6 or above for more than 2 or 3 levels. Then the code will always take more time. We shouldn’t use this approach. But mostly the time limit is more than 5 seconds for a C++ program to execute. And we can easily give output in the allotted time. Second thing is that languages also matter in execution. C++ is the fastest as compared to Java or Python in execution time. So I prefer C++ always! :)

      • Rehan Ahmed

        Exactly my point, mostly the time limit is modest enough to comfortably execute almost any problem given in speed programming competitions without any excessive optimization required.

        • Mushif Ali Nawaz

          Yeah indeed, if someone can find the logic behind the program then he can easily make the program execute, given he knows related algorithms. Main thing is to understand what the problem is asking and how to tackle that.

    • Rehan Ahmed

      I agree with your point but I have written this article as a beginner’s point of view, and most organizers set a really modest time limit – 20 to 30 seconds, and it is more than enough for most basic problem-solving algorithms, even without optimization.
      However, for most complex problems, time complexity is indeed important. Personally, I think it depends on what kind of competition you are taking part in.

  • Lol. Exception handling doesn’t mean there is a problem in your code.