D for competitive programming

Ivan Kazmenko via Digitalmars-d digitalmars-d at puremagic.com
Sat Jul 30 03:43:15 PDT 2016


Hi!

On Thursday, 28 July 2016 at 21:20:29 UTC, urxvt1 wrote:
> I wanted to try topcoder problems (never used this site before)
> and I found out that it doesn't support dlang.
> They only have c++, java, c#, vb.net, python languages.
> It would be great to see D on this list.

I highly doubt TopCoder would adopt D anytime soon.  TopCoder 
definitely had their time as The Site for Competitive 
Programming, but that was like ten years ago.
For a very long time already, they don't actively evolve 
algorithmic competitions, and seem to be driven by other tracks 
which actually make them some money.  So, unless there are plenty 
of clients who want to do crowdsourcing in D and use TopCoder 
platform for that, it's unlikely to be added.

Fortunately, competitive programming sites are now aplenty, so 
one can focus on other sites instead.

> I've also checked google code jam statistics and unfortunately 
> D isn't very popular here compared to say golang or scala.
> https://www.go-hero.net/jam/16/languages
> https://www.go-hero.net/jam/15/languages
> https://www.go-hero.net/jam/14/languages
> https://www.go-hero.net/jam/13/languages

D is at an odd position there, because only a few use it, yet 
some of them (like Kazuhiro Hosaka) are strong competitors and 
get to the finals.

Generally, as already mentioned, there are a number of 
competition series where one can use any language, since only the 
answers are checked:
Google Code Jam (https://code.google.com/codejam)
Facebook Hacker Cup (https://facebook.com/hackercup)
Internet Problem Solving Contest (https://ipsc.ksp.sk)
ICFP Contest (https://icfpc2016.blogspot.com, weekend contest)
Al Zimmermann's Programming Contests (https://azspcs.com, three 
months long)
Most of the above happen only once a year though.

Among the sites which actually compile your code, there are a few 
which already support D, again, some already mentioned:
Codeforces (http://codeforces.com, DMD 2.069.2 32-bit)
AtCoder (https://atcoder.jp, all three: DMD/GDC/LDC; the site is 
new to international community, but competitive programming in D 
looks strong in Japan)
HackerRank (https://hackerrank.com, DMD 2.071.1)
CodeChef (https://codechef.com, outdated GDC 4.9.2 which I had 
trouble with, same platform as SPOJ)
Yandex.Contest (https://contest.yandex.com, outdated GDC 4.9 but 
didn't give me trouble on top of that)

And these are only the sites I tried personally.  Sure, there are 
other competition sites which also support D.

On the other hand, the two competitions which have the most 
influence on the competitive programming community are IOI for 
high school students and ACM ICPC for teams from universities, 
and their many national and local sub-rounds.  These are pretty 
conservative when it comes to programming languages: in the last 
20 years, the only languages which got at least some time frame 
and degree of support are Pascal, C, C++, Java and Python.

There are a number of problems when reasoning for the adoption 
here.  One of them is the chicken - egg problem revisited.  The 
competitions have multi-stage selection process: there are at 
least regional, national and international rounds for IOI, and 
quaterfinals, semifinals and World Finals for ACM ICPC.  If the 
world final round doesn't support some language X, regional 
rounds are reluctant to support X as well, since by doing that, 
they would allow strong competitors using X to pass to the later 
round, but no support for their tool exists in that round, which 
certainly has its downsides.  On the other hand, if the world 
final round starts to support X without massive desire for such 
support from regional rounds, they would end up spending 
resources for very little gain.

Another problem sounds like this: if support for language X is 
added, this opens a flurry of requests to support dozen of other 
comparable languages.  For an established international 
competition, this means quite a bit of research must be done to 
choose what to support and what not to.  And for each language 
getting support, it means either a great increase in effort to 
ensure every problem can be comfortably solved in every language, 
or only limited support, which also has its downsides.  The 
latter is what happens in the case of Python: it is not 
guaranteed that every problem will be solvable in Python, and, in 
all likelihood, some problems will really be unsolvable.

That said, for competitions which already support quite a few 
languages but not D (among what I've seen, HackerEarth and 
CodeFights sites come to mind), one could have more success in 
persuading them to include a D compiler as well.  When many 
languages are already onboard, adding another one is more likely 
to be straightforward when motivation is present.

Ivan Kazmenko.



More information about the Digitalmars-d mailing list