Codeforces will be possibly unavailable in the period between Jan. 16, 19:00 (UTC) and Jan. 16, 21:00 (UTC) because of maintenance. ×

By KADR, 11 years ago, translation,
There are regular after-contest competitions on Topcoder named shortest code competitions. Sometimes it is very interesting to see how the code of some easy task can be compressed to weird and unreadable one, but at the same time this code passes all the test cases. I suggest to hold such competitions here.

I will start from task C from Codeforces Beta Round #24. The rules are simple: each next code should be shorter than previous one. The winner is the person whose code is not beaten by anyone else. Length of the code is the number of non-whitespace characthers in it. Of course, the code should be AC on at least one of the allowed compilers. As far as I know, defines are not used on Topcoder shortest code competitions, so I suggest not to use them here either.

There are some special features in different languages, so I suggest to have different standings for different languages, because I doubt that C++ or Pascal can compete with Haskell or Python.

214:
#include <iostream>
__int64 n,k,x,y,a['   '],b['   '],d;
int main()
{
std::cin>>n>>k>>x>>y;
for(k%=2*n;d<n;d++) std::cin>>a[d]>>b[d],d<k?x=2*a[d]-x,y=2*b[d]-y:0;
for (d=0,k-=n;k>0;--k,++d) x=2*a[d]-x,y=2*b[d]-y;
std::cout<<x<<" "<<y;
}

• +5

 11 years ago, # |   0 164:#include __int64 n,k,x,y,a['   '],b['   '],d,i;main(){    std::cin>>n>>k>>x>>y;    for(k%=2*n;d>a[d]>>b[d],x=2*a[d%n]-x,y=2*b[d%n]-y;    std::cout<
•  7 years ago, # ^ | ← Rev. 2 →   0 I like the idea of having winners per language, especially difficult to compete with Java :-DBut seriously, you can use code formatting... Is there a tool counting length? You know, I'm wondering if b[' '] is 5 characters or 8...edit: Ok, I found that you cannot use code formatting — in the comment above, 3 spaces were replaced with 1, hm HTML...
 » 7 years ago, # |   -28 These shortest code competitions really rub me the wrong way, to an extent I can hardly convey. I have spent well over twenty years honing my skill at writing code that would win no prizes for either length or brevity, by merely for clarity. Code clarity reigns supreme in my book. Not cleverness, brevity, or obfuscation. A shortest code competition to me is like a competition to see who can make love in the shortest time. Well, if that's what you are into, enjoy. But my priorities are completely different.
•  » » 7 years ago, # ^ | ← Rev. 2 →   +15 Well this is just for having fun no need to be so serious :O
•  » » » 7 years ago, # ^ |   +15 And he even revived a 4-year old blog post to say that. Talk about serious business.
•  » » » » 7 years ago, # ^ |   +4 O_o4 years oldI didn't look at the posting time and thought it was a new thing, purely because of how many such things there have been in CF recently (achievements, stats, Polygon updates...)
•  » » » » 7 years ago, # ^ |   0 I didn't realize too. And I was wondering why such old contest :-D
•  » » 7 years ago, # ^ |   0 Programmers are doing "strange" things to have some fun :-DThis is what I discovered recently — JSFuck.disclaimer: no I'm not a fun of such things, but comparing with code above, this is "advanced level"...
•  » » 7 years ago, # ^ |   0 The point of these competitions are exploiting the language and just playing around with code. It's your opinion but i feel that being clever and knowing the language will definitely make you a better programmer. Code clarity is no big deal. If you find this obfuscated, look at languages like Brainfuck or Intercal.
 » 7 years ago, # | ← Rev. 3 →   -20 >I doubt that C++ or Pascal can compete with Haskell or Pythonor Perl"There was this bug running on my keyboard, I tried to hit it but the little bitch always dodged... and look, I wrote a Perl script!"If we consider CF problems, then there should be general limitations concerning bizzare languages.UPD: number of downvotes: 7, number of replies: 0. How impressive.UPD2: oh, it's 4 years old. Maybe that's why (but I probably shouldn't try to find logic in CF downvotes).
•  » » 7 years ago, # ^ |   0 What do you mean "general limitations"?
•  » » » 7 years ago, # ^ |   0 Dunno exactly, maybe making separate categories for some languages. Or restricting the set of usable languages. But a code for a non-DS-heavy problem in Java can't compete with a code in Perl, purely to the languages' syntax verbosity.