Which language is better for competitive coding?

Which language is better for competitive coding? Given I already knew C and Java(only basic) and I code in C.
but I am unable to improve performance.Please suggest me language with why that language is good.


If you know C and java than you can either move to C++ or java .

C++ :
Less running time and STL library is available which is very good .

Java : It can handle big integers easily .

But you can choose any language , because if your algorithm is right than choice of language doesn`t matter much . Every code which can be done in C++ can also be done in java and vice - versa . It depends on you which language you find yourself comfortable take that language .

Happy Coding !!!


I think language does not matter much other than when you do submit code on SPOJ. I code in C# and if you have correct algorithm in place it will pass in all the coding contest like codechef , codeforces , hackerrank etc. I have only found that on SPOJ if the question has lot of input data C# do have the TLE issue otherwise C# also works great. Choose any language that you are comfortable with it . Sometime some language has in build functions but still you can manage in your own language

Hi @himanshu_9419

According to my research, people use c++ over c for stl

and C++ over Java for time of execution as it is less in c++ over Java…

Now coming,to C++ v/s Java…

I have found many of the universities teaches first C or C++ to the beginners or either most programmer begin with C++ over Java…which all points to be more flexible and enjoyable with C++…

Hope it helps!

Happy coding…:slight_smile:



Basically Language doesn’t matter but the algorithm should be correct.Therefore codechef provides lots of languages of your choice.Every Language has its own benefits like C has good Time of execution over Java,Python but Java ,C++ or Python already has predefined functions which make coding faster.But at the end without algorithm languages doesn’t matters here.I hope you get the point.

1 Like

Assuming that by competitive coding, you refer to ICPC or time-bound coding contests, mastery of C++ with a basic knowledge of Java will get you through it.

Most competitive programmers prefer C++ over C because of the in-built functions associated with it. In C++, you can simply use sort(a, a+n) to sort an array a[] of size n, or use lower_bound(a, a+n, num) to binary search a number instead of writing the entire code (imagine the benefits in a time bound contest).
Moreover there are inbuilt data structures like vector (resizeable arrays), list, queue, stack, etc. in C++.

Java, albeit slower, has a powerful BigInteger, String Processing, HashTable and GregorianCalendar API.
Suppose you have to calculate the factorial of 25 (the answer has 26 digits), creating a C/C++ code from scratch will take time and effort, whereas a Java solution is this:

BigInteger fac = new BigInteger.valueOf(1);  
for (int i = 2; i <= 25; i++)  
  fac = fac.multiply(BigInteger.valueOf(i)); // wow :)  

Bottomline: To actually excel in these contests, use better data structures and algorithms. No kidding. If you encounter a graph problem and you are not familiar with graphs, it doesn’t really matter which language you are using.


Excuse me brother,

By the way everything is relative in this world, there’s nothing absolute. If you know a certain programming language get proficient in it because as long as a certain language is allowed for a problem, it means solving it is possible in that particular language so cool bro.


Thanks for answer.

Welcome @himanshu_9419

@dev8546 Thanks for Answer. I think language matters as a beginner because you can’t optimize a code after some extent. What I see is C++ is used more than any other coding language I don’t know why? But I want somebody to answer that why C++ is preferred over C, java and C#.

@tech_boy thanks for answer

you can accept it as well

@himanshu_9419 your welcome :slight_smile:

If you are not going to participate in the ACM ICPC or the IOI you don’t need java to handle big integers (which is the only reason some people use it even though they hate it), you can use python to do that even easier (by default).

@michelangelo Thanks for answering in such detail.

don’t be so rude. Use any language, it doesn’t matter which language you are using, until or unless your logic is correct


@amitt001 I don’t understand why you are saying rude but I have a suggestion for you. It seems to me that you think language does not matter at all than leave c++ and start submitting code in c. After having experience of submitting code in both language( not for easy level but for medium or hard one) than comment back. Please don’t comment on thing which you don’t know.

My friend I know this but you can’t start everything from scratch at the time of contest.Write a code in c++ for hard problem than write it in C you will come to know you have wasted you lot of time in comparison to code writing in c++.
Here I take c and C++ only for example.