Nickolas's blog

By Nickolas, 12 years ago, translation, In English

A couple of days ago I wondered how many authors (except for me) write problems about programming languages. I was hoping to be not alone in my passion to this topic; but the reality exceeded all expectations. Of course, problems which feature programming languages are much scarcer than ones about computers, processors, microchips, parallel computing, databases and other IT things, but still much more frequent than ones about, say, dragons :-)

1. TopCoder

The early years of TopCoder presented the participants with several programming-languages-featuring problems.

Full text and comments »

  • Vote: I like it
  • +28
  • Vote: I do not like it

By Nickolas, 12 years ago, translation, In English

Roco is a very simple language. On one hand, it's esoteric, so everything you need to know about it fits in two pages. On the other hand, it's powerful enough to enable writing rather complicated programs in it without racking one's brains over each elementary operation (like in Brainfuck). Being able to refer variables using names (numerical, but names nevertheless) is already a gift to the programmer :-)

188A - Hexagonal Numbers

As usual, the first problem tests the competitor's understanding of basic arithmetic operations. The solution is very similar to the example.

iin [0]
mul [1] [0] 2
dec [1]
mul [1] [1] [0]
iout [1]
ac

Starting with the second one, the problems need learning the main feature of the language — the coroutines.

Full text and comments »

  • Vote: I like it
  • +38
  • Vote: I do not like it

By Nickolas, 13 years ago, translation, In English

The contest is over; the editorial is here. I've mis-estimated the complexity of the problems — but how could I possibly guess who will arrive and finish everything in 40 minutes :-) Congratulations to the winners — the slowest and the most relaxed of them took under an hour to solve all the problems.


Today's round features Roco — a little-known esoteric language with a special approach to loops and subroutines. The programs written in it look a bit bulky, especially when compared to Befunge, but this is compensated by their relative simplicity and readability. Here is a program which calculates the sum of two given numbers:

iin [0]
iin [1]
add [2] [1] [0]
iout [2]
ac

There is little information about this language on the web — the only two sources known to me are the author's site and Progopedia article with commented sample programs.

There is also exactly one interpreter for Roco, written by its author. To run it, one has to have C++ installed (the author uses g++, and so do we), compile the interpreter source code into an executable file and run programs using command "roco program.roco". You can download the interpreter here.


Full text and comments »

Announcement of Surprise Language Round 6
  • Vote: I like it
  • +79
  • Vote: I do not like it

By Nickolas, 13 years ago, translation, In English

Challenge24 finals are finally over, and as usual, I hurry to share my impressions about them. The impressions are sponsored by team Progopedia (Andrii Maksay a.k.a. maksay, Sergii Dymchenko a.k.a. kit1980 and me). Such things are the best to write immediately after the contest, while the emotions still invade you. Of course, one can start writing them while still in the competition (and last year I did so — I was pretty useless at night anyways), but this year we felt alert and fought for the points till the last minutes of the contest, so the blog post was postponed.

The main part of Challenge 24 took a bit less than 48 hours: registration and optional sightseeing on Friday, the round itself from Saturday morning to Sunday morning, and winners announcement and closing ceremony (for the toughest contestants who don't really need all that sleep) on Sunday noon.

Full text and comments »

  • Vote: I like it
  • +73
  • Vote: I do not like it

By Nickolas, 13 years ago, translation, In English

I'm a huge fan of Surprise/Unknown Language Round competition format. Theoretically I enjoy participating in them, but in practice I mostly run them. What's so special about them that makes me like them so much?

  1. They are unusual. At some point of time (which arrived pretty soon for me) traditional competitions pall and become a blur. If I give it a thought, I can clearly remember only a couple of the 80 SRMS and CF rounds I've done. The SRM which featured MooresLaw problem (great challenge phase and my only ever room win), TCO elimination round which I passed thanks to a last-minute submission on 500pt, a GCJ round from back when it was held on TopCoder platform, when I got stuck at input parsing and never got to the actual solution... and that's all. Marathon memory is a bit better, probably because I've participated in fewer of them, and each match took more time and effort. But unusual competitions leave the most lasting and vivid impression.

  2. They fit my skills. I'm not the one to get intimidated, let alone scared by a language which misses loops, strings or anything else from the commonly used programmer's toolkit. Well, there are a couple of languages which I'm uneasy about, but they are very unlikely to appear in an ULR.

Full text and comments »

  • Vote: I like it
  • +58
  • Vote: I do not like it

By Nickolas, 13 years ago, translation, In English

Congratulations to KADR who was the first of two people to solve all 8 problems!

171A - Mysterious numbers - 1

The easiest way to make the problem statement unusual is to omit it. This is an extremely convenient approach — you don't have to maintain the statement in two languages or to worry that it might turn out to be ambiguous or too long or too scary. 690 people solved this problem, so evidently we can omit statements even in regular rounds :-)

As for the problem itself, it required to sum the first number and the reverse of the second number.

171B - Star

They say it's better to see once than to hear ten times or to read a hundred times. In this problem we decided to check this and to replace the traditional textual statement with a single image. Same as in the previous problem, it did well — at least 645 participants recognized star numbers (sequence http://oeis.org/A003154 in OEIS), the numbers of balls needed to form a six-pointed start of certain size. After this one had only to code the formula —

Full text and comments »

  • Vote: I like it
  • +48
  • Vote: I do not like it

By Nickolas, 13 years ago, translation, In English

Editorial

You might have already noticed the next contest in the events calendar, the one named April Fools Day Contest. The name hints that the contest is unusual, nowhere near serious and maybe even snide. One could even guess the author of the contest — the meanest of all out there, that would be me :-)

I love unusual contests — Surprise/Unknown Language which require solutions in unusual languages, Time Limit Exceeded which require solutions in C but written in an unusual manner... Most of such contests exploit the domain of unusual solutions. I've decided to take a peek at the dual domain — unusual problem statements.

In this round you'll be given several weird problems and 2 hours to solve them. The contest will be unrated (you bet!), and it will follow ACM ICPC rules (no hacks, the standings are decided by the number of solved problems and penalty time earned on them). You can submit solutions in any language allowed by Codeforces — of course, unless the problem says otherwise :-)

Be warned, to enjoy competing in this round you'll need a sense of humor compatible with mine! It's April Fools Day, after all. Enjoy!

P.S. This contest exists solely due to maksay who volunteered to do all technical preparations. Thanks!

Full text and comments »

Announcement of April Fools Day Contest
  • Vote: I like it
  • +140
  • Vote: I do not like it

By Nickolas, 13 years ago, translation, In English

So here goes the editorial. Note that Factor allows pretty random codes, feel free to put all words in one line, but all words must be separated by at least one space, don't try to skip a space between a bracket and a word or something like that.

162A - Pentagonal numbers

This problem was almost the same as 130A - Hexagonal numbers from Befunge round. Data input and output is done exactly as in the sample code, and besides them the program needs only basic stack operations.

USING: io kernel math math.parser ;

readln string>number
dup 3 * 1 - * 2 /
number>string print

Factor has a very system of built-in libraries which liberate the programmer from solving a lot of basic routine tasks. So after the first (trivial) probllem I gave several one-liners

Full text and comments »

  • Vote: I like it
  • +42
  • Vote: I do not like it

By Nickolas, 13 years ago, translation, In English

The contest is over. My sincere respect to the winner in overall run nab who solved all 10 problems in 1h 25m, and congratulations to the winner in the official contest winger who repeated this heroic deed in 1h 52m.

Here is the editorial.


The language of this round is Factor — a stack-based functional language with a sophisticated system of built-in libraries (dictionaries).

Full text and comments »

  • Vote: I like it
  • +78
  • Vote: I do not like it

By Nickolas, 13 years ago, translation, In English

Anybody feels like sharing the thoughts about Challenge24 online round? Like who was in which team and who solved what? I miss the detailed information — participants' countries and total points earned is too little :-)

Here is the list of teams known so far:

Place Team Team members
1 Havka-papstvo Egor, Petr, pashka
4 Charles_University_Legion fhlasek, Mimino, k21
5 Progopedia maksay, kit1980, Nickolas
8 Unpretired Michael, ilyakor, Vasiliy Astahov
9 DrinkLess arseny30, valich, levlam
13 _NiN_ ashmelev, mmatrosov, Anton Demidov
14 Saratov.SU2.Retired ralekseenkov, ivanromanov, Igor Kulkin
16 petrsu_ginger Eledven, zurg, Jughead
18 despise_oimaster sevenkplus, wuzhengkai, Zekun Ni
20 any_random Zhukov_Dmitry, zeliboba, ifsmirnov
22 PigsAndHedgehogs Joshik, andrewzta, dgozman
27 Accept_iterator asaveljevs, ulzha, visockas
33 PMP_Forever poopi, Mohammad_JRS, piloop
34 KNURE_Team SkorKNURE, DryukAlex, Daiver19
36 LT_United Leonid, KrK, Lomir

Full text and comments »

  • Vote: I like it
  • +40
  • Vote: I do not like it

By Nickolas, 13 years ago, translation, In English

Here goes a review of the problems. I tried to set them so that each of them shows a certain aspect of the language — a commonly used verb or a specific feature. Once it was recognized and found, the solution should become evident.

153A - A + B

Let me note right away that the sample code provided in the blog post does work both in Custom test and in ideone (as well as locally), as long as the numbers are written one per line and (attention!) each of them, including the last one, is followed by the end-of-line character. The last '\n' is not shown in the tests, but it is there, and COBOL minds it. All test cases at Codeforces are generated with this in mind, so there should be no problems like this when the code is submitted.

The most evident COBOL feature is storing numbers in decimal notation, with width set by the programmer. In this case we focused on the fact that by default the number is printed in a fixed-width way, padded with leading zeros if needed. These zeros where what you needed to get rid of.

Full text and comments »

  • Vote: I like it
  • +34
  • Vote: I do not like it

By Nickolas, 13 years ago, translation, In English

The round is over, I hope you have enjoyed it. Here is the editorial.

The language of this round is COBOL (dialect COBOL85), one of the oldest programming languages (date of “birth”: 1959, so it’s twice older than I am). Despite being so old, it’s still in active use, though not in programming competitions, so I think it should be enough of a surprise for you :-)

The problem "A+B" (numbers A and B given in separate lines) can be solved in a following way:

       IDENTIFICATION DIVISION.
       PROGRAM-ID. SOLUTION.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 A        PIC 9(10)   VALUE ZEROES.
       01 B        PIC 9(10)   VALUE ZEROES.
       01 STR      PIC X(10).

       PROCEDURE DIVISION.
         ACCEPT STR
         MOVE STR TO A
         ACCEPT STR
         MOVE STR TO B
         ADD A TO B
         DISPLAY B
         STOP RUN.

Full text and comments »

Announcement of Surprise Language Round 5
  • Vote: I like it
  • +166
  • Vote: I do not like it

By Nickolas, 13 years ago, translation, In English

A couple of days ago I was asked to answer the question "What is it like to be a problem writer for programming competitions?" at Quora web-site. My first idea of the answer had only one word, but then I've thought of a more detailed one, and then of a story I must include, hmm, and I should definitely mention this... Around the second page I realized that this is becoming more than an answer, and at the third one I decided to share this article with a qualified audience — that would be you.

So, what is it like to be a problem writer for programming competitions?

In one word (the one I've thought of at first), it's "awesome". In a bit more detail, "hard, sometimes unrewarding, but anyways fascinating job". In even more detail...

Full text and comments »

  • Vote: I like it
  • +216
  • Vote: I do not like it

By Nickolas, 13 years ago, translation, In English

So, here goes the editorial. I'll tell you right away that nobody guessed MikeMirzayanov's problem (nice disguise, er?) — it was problem C about the picky princess. Actually, this was the first problem of the round, the rest of problems I invented to keep up the lovely topic.

148A - Insomnia cure

The number of dragons D can be quite small, so the problem can be solved in a straightforward way, by iterating over dragons 1 through D and checking each dragon individually. Time complexity of such solution is O(D).

Full text and comments »

  • Vote: I like it
  • +47
  • Vote: I do not like it

By Nickolas, 13 years ago, translation, In English

Hello,

Codeforces Round #105 will take place on February 2nd, 20:00 Moscow time.

This is a themed round, based on the fairy tales I write in Russian.

In this round we decided to conduct an experiment on smoothing the effects of problem setters misestimating the complexities of the problems: all problems have point values of 1000. We tried to order the problems by increasing difficulty, but this is a subjective opinion, so surprises are possible.

Thanks to MikeMirzayanov for the problem contributed to the round (who can guess which one of the five is not mine?) and to RAD for his help in preparing the problems.

Good luck at the round!

Full text and comments »

  • Vote: I like it
  • +166
  • Vote: I do not like it

By Nickolas, 13 years ago, translation, In English

The Unknown Language Round format is becoming popular outside of Codeforces: Chaos. There are only 6 problems, which is less than an ULR typically has, and the problems themselves are easier, but that's a good start.

P.S. I know it's too late for a contest announcement but I had no time earlier - I even got late for the contest itself.

P.P.S. My report of the contest participation: Chaos Chef.

Full text and comments »

  • Vote: I like it
  • +25
  • Vote: I do not like it

By Nickolas, 13 years ago, translation, In English

A. HQ9+

The problem described HQ9+ programming language and asked whether the given program will print anything. Given the extraordinary simplicity of the language, it was enough to check whether the program contains at least one of the characters H, Q and 9.

Full text and comments »

  • Vote: I like it
  • +58
  • Vote: I do not like it

By Nickolas, 13 years ago, translation, In English

Codeforces Beta Round #96 will take place on Saturday, December 3rd, and it will be my first classical Codeforces round. To smoothen the transition between Unknown Language and known ones, I've made the problems of the round follow a certain topic, which is of course programming languages :-)

Thanks to MikeMirzayanov, maksay и RAD for their help in preparing this round.

Good luck!

P.S. Points cost for problems: division 1 — 500-1500-1500-2000-2500, division 2 — 500-1000-1500-2500-2500.

Full text and comments »

  • Vote: I like it
  • +135
  • Vote: I do not like it

By Nickolas, 13 years ago, translation, In English

So here goes an editorial for the round. For me Befunge is one of the languages in which it's much easier to write code than to read it (and debugging code written by someone else is a complete torture; that's why we don't have hacking in ULRs). That's why I'll post just the general idea of the solution and my own codes — the latter just to show that I can code in Befunge too.

A. Hexagonal numbers

&:2*1-*.@

A "consolation" problem, which requires only to understand the principles of working with stack. Read n, duplicate it, multiply the topmost copy by 2 and decrement the result. Now the stack contains two numbers n and 2n - 1; multiply them and print the result.

Full text and comments »

  • Vote: I like it
  • +64
  • Vote: I do not like it

By Nickolas, 13 years ago, translation, In English

The round is over; I hope you enjoyed it. Here is the editorial.


The language of this round is Befunge, a lovely two-dimensional esoteric language. It's quite neat and convenient, especially for an esoteric language. Thus, for example, "A+B" problem, where A and B are given in separate lines, can be solved like this:

&&+.@

To learn the language you can read the original documentation (the rumor is that it is broken in some browsers), examples of programs at Rosetta Code and Progopedia article with annotated examples.

Our testing system uses befungee interpreter, which implements Befunge-93 dialect. To run the interpreter, one needs to have Python installed (version 2.6 or so, but not 3.*). Download files befungee.py, boards.py and funge.py to the directory with your programs and run the interpreter with python befungee.py <Befunge program name> command. Note the built-in debugger (run with --debug --delay=100 option) which allows to watch the movement of instruction pointer through the program and the effect it has on the stack.

As an alternative local IDE you can use WASABI which requires Java. Download interpreter arhive, unzip it and run with java -jar "Wasabi v1_4.jar" <Befunge program name> command.

In input data end of line is marked with #10 character (you'll need this for problems which require reading the string till the end of line). Your program's return is checked to be accurate within the whitespace and line feeds; it's not necessary to end the printed lines with line feeds, and if a problem requires printing several numbers, they can be separated with any number of spaces. Extra spaces at the end of line are also allowed.

Full text and comments »

Announcement of Unknown Language Round 4
  • Vote: I like it
  • +142
  • Vote: I do not like it

By Nickolas, 13 years ago, translation, In English

Every time I win a trip to any kind of tournament onsites (so far this happened three times, so I can generalize), I find myself facing a serious problem, named "souvenirs". I've settled this question once and for all as long as it concerns myself: the best souvenir is a pile of photos accompanied by a thrilling story. The second-best is a couple of Swiss chocolates, though I can handle both at the same time :-) But one can't live in a society and be free of it; and it's the souvenirs for people around me that become a real problem.

Take, for example, my last year's trip to Las Vegas. I went there with a t-shirt demand from my future husband's sister. Besides, my future husband himself stayed at home (his visa application was unexpectedly refused, and there's not much point in winning a trip without the visa), and I felt I had to bring him something to cheer him up. So my shopping plans were quite intense.

Full text and comments »

  • Vote: I like it
  • +46
  • Vote: I do not like it