Jam-Packed Fun and Games

Did I say “fun”? That was short for function calls. Which are fun too, admittedly. Blah, I always go to such lengths to come up with snappy yet justified post titles and end up achieving neither.

One more complimentary breakfast later:

This is it.

Google Code Jam World Finals.

[Google Code Jam 2015 name tag with my name and handle and country]

Let me take a moment to reflect. Seriously. I do not know how I made it this far this year. I guess I might be a top-500-ish competitive programmer globally, maybe even top-150-ish, but definitely not top-25-ish. And Log Set, the hard problem that got me through Round 3, doesn’t seem like it plays to my forte particularly either. It’s a bit mathy, but the math bits aren’t the hard part; I think it’s largely implementation, with one psychological hurdle where you have to realize that, because of how few distinct integers there are in S′, you can efficiently solve the subset-sum instances you need to produce the lexicographically earliest answer. I’m actually kind of impressed I got that. It seems like the sort of hurdle I usually get stuck on. How did this happen?

Maybe randomness. Maybe I was just particularly clear-minded during the round and wrote less buggy code than usual, because I had no expectation of making it whatsoever and so could look at the contest detachedly (until midway through the contest I accidentally noticed that my rank was under 20, and even then I tried very very hard not to think about it, and it kind of worked).

But it happened, and now I’m here. Time to roll.

In some emails much earlier in the Code Jam logistical process, Google had asked for “requests for changes and/or additions” to the software that would be installed on our competition computers, and I had sent them a long list:

Hi,
Here are some things I’d like if they were installed, in decreasing order of priority:

  1. The Vim plugin syntastic ( https://github.com/scrooloose/syntastic )
  2. a Haskell compiler (probably Haskell Platform 2014.2.0.0 https://www.haskell.org/platform/ even though it’s a year old)
  3. the Haskell package hdevtools ( https://hackage.haskell.org/package/hdevtools ) so that the above two may be integrated
  4. (I don’t have enough Linux experience to name a specific thing to install, but command-line utilities that are the equivalent of pbcopy and pbpaste on Mac OS X, which allow me to redirect text into or out of the clipboard from the command line easily)

Of course, this is my first Code Jam and I don’t know how reasonable these requests are. Any nontrivial subset would be appreciated.

Continue reading

Advertisements

Variance

It’s olympiad season. Taiwan placed 18th in the IMO rankings1. Next day there are news stories about how it’s our “third worst performance in history”, and commenters drawing casual arrows from changes in Taiwan’s standardized tests and curriculum to this result, and the Ministry of Education saying they’d review their procedures or something.

What.

Did you forget our performance last year? Do you think our olympiad training system is completely overhauled on an annual basis, or has even a tangential relationship with the overall education system?? Do you think people can be turned towards or away from mathematical olympiads because of standardized tests?? Do you think these contestants’ training plans are so transient that they’d be completely overthrown by one year of progress towards the implementation of faraway edicts about math topics for the layman???? If a measurement gives you a result of 3rd place one year and 18th place the next — both of which are more than 1.5 standard deviations from the mean2 — how can your first (or second, or third) thought possibly be “we performed 15 places worse so something needs to be changed” instead of “oh wait this is not a very precise metric, maybe we shouldn’t read too much into it”?

Yes, I’m ranting here, but even though these things are so clear to me, I know it’s not obvious to most people at all because they don’t understand just how huge the variance in mathematics competitions are. Or in any similar competition, really. (And I know I’m likely preaching to the choir here by writing on my blog — a very understaffed choir to boot. But I have to do this. Remember? Streak?)

It’s like… I’m trying to come up with a suitably crazy analogy, but it’s not easy… it’s like, you decide one day to look at the front pages of The New York Times and of Al Jazeera. You don’t even read any articles, you just look at the front page layout and graphics and text, and you notice that Al Jazeera has a video on its front page and the NYT doesn’t. You don’t even come back the next day to check again, you just conclude based on that one day’s whim that the New York Times needs more variety in its journalism, and you write and publish an article to that effect.

Where do I even begin.

Continue reading

X + Y (movie)

On Wednesday I got to see a special screening of the film X + Y. You know, the one about the autistic boy who goes to compete in the IMO. You can watch the trailer if you haven’t already.

Disclosure: the ticket was free, courtesy of my math teacher (who appears at 1:06–1:07 in the trailer) having helped the filming process. (I visited once and got to look at some of the cool equipment. Also, far away from everything, one of the director assistants sort of interviewed me. That is the full extent of my contribution, okay?) Except I was also sick with a cold so I might have been kind of miserable. Also I didn’t really have dinner that day, and we got home really late so I had to stay up even later doing homework. So those are the extent of my biases.

I guess this is a review of sorts.

The most important thing I have to say is this: X + Y is not a film primarily about math competitions or the IMO. It is a film about love, about autism, about accepting people who are different, about conquering your own psychological demons, about gender and family and cultural roles. But mostly about love. The film gets big novelty bonus points for a reasonably authentic look at the high school mathematics olympiad scene, but if you go watch this as a former contestant looking to relive some vicarious moments of glory and triumph through hard mathematical work and thinking, I’m pretty sure you’ll be disappointed. None of the main character’s important character development moments are related to becoming better at math. The IMO is largely a well-researched and extensively utilized plot device. (This is one of the acceptable usages of the word “utilize”, okay? Dear classmates: please stop using it as a seven-letter synonym for “use”.)

Continue reading

[IOI 2014 Outtakes]

Miscellaneous observations that didn’t make it into a compelling narrative, sometimes because I have forgotten exactly when they happened, sometimes because I only remembered when they happened after blogging about it, sometimes because it just seemed too tangential, sometimes just because of the circumference of the mooooooooooooooooon! (That made no sense and I’m not going to remember what I’m alluding to in a few months.)

  • During the first day a guy came into the secret computer room that the Taiwan team had concealed themselves in, saw us watching anime (SAO 2 among others), and innocently asked, "Are you the Japanese team?"

  • The organizers had provided a free whack-a-mole machine, two basketball machines, a Kinect, and a table soccer table in the basement outside the dining hall. I don’t know what it is with science olympiads and table soccer; it’s been provided at all three Olympiads I’ve gone to. Can this be just a fluke?

  • Paul spent most mornings and evenings playing Kingdom Rush in our room. Kingdom Rush is a great game, but the reason I put it here is that I was mildly amused to see a Kingdom Rush screenshot in Evan’s IMO 2014 report when it came out. Things that transcend boundaries…

  • Somewhere among the many occasions when I abruptly switched to English to greet my classmates, our team developed the "Hey, Brian!" meme, which then got two letters transposed. Just for your information.

  • I spotted T-shirts from IOI 2011, IOI 2012, IOI 2013, IMO 2012, Google Code Jam, TopCoder, Codeforces, Dropbox, and Quora.

  • There really does appear to be a critical mass of confused people dining in one place above which clapping for no reason is contagious. I observed this during IMO 2012 too. The new thing I learned was that the same trick also works with singing “Happy Birthday” to some degree.

  • During one of the bus rides, I was randomly pulled into a conversation about Phineas & Ferb. I impressed some contestant (I don’t remember which country he came from, unfortunately; it might have started with a T?) by mentioning the English name of the evil genius, Doofenshmirtz. (For a few seconds I wondered if I had met a certain IMO legend again.) The guy congratulated me, then remarked that my eye cover made me look like a character from Happy Tree Friends. "It’s not good news to be a character from Happy Tree Friends. Especially since we’re on a bus. Do you know the episode on a bus?"

    I didn’t know the episode on a bus, and I was pretty sure I preferred not to know.

  • I still remember xyz111, the full scorer from China, for writing the Codeforces round (#254) that totally pwned me (my first rating decrease!) and then issuing an editorial in response to an unexpected solution saying,

    This is my mistake, and I feel sorry for not noticing that, I’m too naive, and not good at solving problems. Please forgive me.

    o_O

    not good at solving problems

    O_o and people wonder why I’m humble…

[IOI 2014 Part 4] Shades of Xanthous

No, I didn’t forget. Not for one minute. I was doing homework. I am very happy because that means I was actually carrying out my priorities as I envisioned them. I’ve probably edited this post too many times, though. Meh. But it’s the first weekend after finishing summer homework, so here we go again!

Fun fact: This is by far my favorite post title in the entire series. Possibly in the entire history of this blog.


In the morning of the last day of official IOI activities, there were a bunch of cultural activities, e.g. writing Chinese characters calligraphically, doing tricks with the diabolo, or picking up beans with chopsticks, and noncultural activities, e.g. getting somebody to pour water into a cup on your head while he or she was blindfolded. Due to the last activity I got wet, but my shirt dried really quickly. And alas, even though I had taken calligraphy summer classes a long time ago, my calligraphy was awful — robotic, lifeless strokes without the right aesthetic proportions to make up for it. Blargh.

Anyway, lunch followed, and then it was time for the closing ceremony, in the same building as the other ceremonies and contests. Our team caught the ending song of in a Chinese musical being rehearsed as we walked into the auditorium. While we waited for everybody, we milled about waving flags that our various teachers had brought, including not only Taiwan’s flag but also flags of my school, thoughtfully brought by teachers who had volunteered. A little later our leader told us that all the leaders had discussed the matter during a meeting and decided that we shouldn’t bring any flags to the stage while receiving our medals, so we were going to have to make do with being patriotic and school-respecting off stage.

There were a few performances, including two aboriginal music performances and the musical we had seen rehearsed ealier, which was a fun rock musical rendition of some Chinese tale that seemed to have been sharply abridged, giving it the plot depth of a Wikipedia stub-article synopsis — a conflict, boy-meets-girl-and-falls-in-love, and a lamenting Aesop song conclusion with thrillingly vague general applicability. But the singing and counterpointing and atmosphere were good. I guess it was proportional to the relative importance of the performance to the closing ceremony. The program interleaved them with the long-awaited medal presentations: one round of bronze medalists, one round of silver, one round of gold.

Dum-dum-dum-dum, medals! The home team advantage was really obvious here; the cheering and the medal-presenter handshakes were both significantly more forceful for Taiwan’s medalists.

I think our leader made this. Thanks.

I think our leader made this. Thanks.

Naturally, after the normal medals had been exhausted, the three full scorers received bags with prizes that may forever remain unknown to my sorry self, as well as a standing ovation from everybody in the auditorium. The orchestra had been going through ABBA songs during the ceremony, and very considerately played “The Winner Takes It All” for this part. It was impossible not to mentally fill in the lyrics.

The winner takes it all
The loser has to fall
It’s simple and it’s plain
Why should I complaiiiiiiiin?

Speeches followed. Most were just average forgettable speeches, but Forster gave another speech that was somehow even better than the one he gave at the opening ceremony, with nonstop golden quotables such as:

Continue reading

[IOI 2014 Part 2] One Line to Solve Them All

I started trying to sleep at 9 the night before the contest, tossed and turned in bed until 10, then fell asleep and got up at 3:35 in the morning. Blah. At that point, I went to the bathroom and applied some chapstick before trying to go back to sleep until 6. After breakfast, I grabbed a few minutes of sleep on the bus to the convention center where our contest would be, then slept on a sofa outside the actual contest hall alongside most of the rest of our team as we waited for a very long time until it was okay for us to enter. Competitions really mess with one’s sleep schedule.

Then, much too soon, we could enter. Day 1 of the contest was about to start.

The laptops were as yesterday, although they were protected with a white screensaver that indicated my name and ID as well as a countdown to the start of the contest. I was glad to see that my mousepad and all my writing utensils had survived without me. Somebody had the sense of humor to project an online stopwatch with an animated bomb fuse onto the screens to indicate the remaining time, which, once again, there was a lot of.

I conferred briefly with Paul (TZW (alphaveros (?))) about vim settings for a bit, but there were still fifteen minutes left or so. I idly stretched, practiced typing my .vimrc on an imaginary keyboard, and watched as the US dude two tables to my left unplugged his laptop’s mouse and rearranged absolutely everything on his table using the surface under his chair as swap space. (Well, that was how I mentally described it at the time, pending further revelations. (hint hint))

Then it began.

Continue reading

[IOI 2014 Part 1] Everything is More Exciting with Lightsabers

Okay, I guess it was really naïve of me to suppose that I could get any considerable amount of blogging done before the IOI ended. Onward…

We left off at the end of the practice session. As if somebody were taking revenge against us for not having to suffer through any airplane trips, we were served a cold airplane meal for lunch.

Seriously, the box had a sticker that noted its manufacturer as something something Air Kitchen and another translucent sticker that badly covered an inscription saying the same thing in much bigger letters. It contained a cold apple salad, a cold chicken bun, a cold flat plastic cylinder of orange juice, and a package of plastic utensils that was exactly like the utensils that came with every airplane meal ever. I was disappointed, but at least the salad tasted okay, and I ate an extra one because two of my teammates volunteered theirs.

To pass the time, we played an extra-evil ninety-nine variant. Apparently this is a very Taiwanese game because lots of student guides were teaching their teams the game, although our special cards differ from the ones Wikipedia lists in a lot of ways and our evil variant created more opportunity for sabotage and counter-sabotage and bluffing. 7s are used to draw your replacement card from somebody else’s hand, and that person cannot draw again and will have one less card; aces are used to swap your entire hand with somebody else, who also cannot draw a card; small-value cards can be combined to form special values (e.g. play a 2 and 5 for the effect of a 7) but after playing a combination you can only draw one replacement card; and later, to speed up the game, we added a rule where all 9s had to be unconditionally discarded without replacement but would still get shuffled back into the draw pile. Players lose if it’s their turn and they have no playable cards, including no cards at all.

While we were playing and repeatedly reveling in everybody ganging up to beat the winner from the last round, an instrumental version of “You Are My Sunshine” played on repeat in the background for literally the entire time. It wasn’t a very good version either. If you didn’t listen carefully for the fade-out and few seconds of silence at the end of each loop, you’d think that the loop was only one verse long.

Continue reading