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:

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

Orthogonal Planes

I have a backlog of at least 6,000 words and still too many events to blog about, so these posts will not reflect things currently happening to me for a long, long time, except for the little blurbs on top of posts like this one when they exist.

Blogging is hard.

Also, I don’t have a good title.

It begins with an airplane.

[View of airplane wing and clouds from airplane]

For Zarquon’s sake, you’re entrusting me with my own passport and airline tickets and luggage and all this stuff I can’t even. I still layover people for months on end in Pocket Planes sometimes. (Watch the graceful descent of this reference into personally overused snowclone territory.)

Source: Taiwan, my home for the previous twelve years, which I am now bidding farewell to for the longest time in forever (…which is only (“only”?) five months, assuming I fly back for winter break as already planned). Destination: Seattle, for this year’s Google Code Jam World Finals, which I still don’t know how I managed to qualify for (more on that in later posts); and, before that, an accompanying interview for an internship that I scored as part of the bargain.

I successfully get on the plane, sort some nice things to have on hand into my MIT tote bag (how did I ever survive airplanes without keeping a tote bag on hand?), and put my backpack with the rest of my stuff into the overhead compartment. An old-ish guy who is probably Korean sits next to me. Plane takeoff is a bit delayed due to traffic congestion. Once during the flight, after an attendant passes out forms to everybody entering South Korea and I tell him I’m not, the guy asks me where I’m going and we have a short conversation. But for the most part, it’s typical airplane shenanigans. I listen to Avril Lavigne and Ellie Goulding, do a little homework, and eat the airplane food. Nothing remarkable happens.

Until near the end of the flight: a guy in a suit shows up in the aisle and, looking at some sort of checklist, calls my name.

Paranoid thoughts race through my head, like maybe I’m on the wrong flight or my ticket hadn’t been paid for or something. But all that happened was, because the flight I was on had been delayed and the gap between arrival in Incheon and departure of my transfer flight from there to Seattle was pretty small, I might need to hurry, so the guy helps me get my stuff and moves me to a front-row(-of-economy-class) seat.

After landing, I run through the Incheon airport, not even stopping to put my belt back on after the security checkpoint. There’s an electric car I have to take first, and then I have to walk a long distance to find my gate. I don’t have time to notice much about the airport, except that there are lots of posters about MERS as one would expect, and once I pass by a few people performing a symphonic version of “Let It Go”.

[Signs informing travelers about MERS in English and Korean]
Continue reading

[CIMC 2015 Part 3] Monsters and Pandas and Tigers, Oh My!

My inner perfectionist is crying that I have to post this, in particular over my pathetic snowclone title, but my inner pragmatist knows that, judging by my old blogging patterns, it’s now or never.

18.06: 56%, haven’t touched it in a while, but I think I can do lots more on the plane.

As a non-contestant, I confess I feel totally uninvested in the results and find the Closing Ceremony boring. All contestants go up, country by country, and have their awards read off. No effort is made to make any sort of buildup to a climax. But maybe this is for the best; we don’t want anybody feeling shafted or discouraged from continuing to do math due to a mere elementary-/middle-school competition. Meanwhile, though, I’m browsing reddit on my phone.

After this ceremony, the entire Taiwan delegation spends some time walking around outside while the guides make confused phone calls trying to decide where we eat lunch. My parents offer me some potato chips they bought somewhere, which are (as the label is really eager to point out) baked, not fried. Some time passes this way; eventually, the guides figure it out and we go through amazingly long queues to eat at the cafeteria, as usual. Then we are sent to a massive shopping mall for the afternoon, a place so large that its exits have number labels that go up into the double digits so that people don’t get lost.

I take trippy failed panorama photos from the bus windows.

[trippy panorama of a shopping mall]
Continue reading

[CIMC 2015 Part 2] Journey of the Blue-White Slippers

(Nontopical life update: Current 18.06 homework status: 34% (mildly screwed, probably won’t finish before I leave my cozy home for the U.S. and I usually struggle to get into the mood for homework while traveling, but I guess I’ll have to))

[18.06 status panel: 34%]

(I’ve been spending most of my uptime doing said homework and running errands, and my downtime catching up on Last Week Tonight with John Oliver while farming the Flight Rising Coliseum. And, okay, making the above status panel. Live version here courtesy of Dropbox’s Public folder. No regrets.)

Day 3 (Excursions)

Morning routine snipped. We come to the middle school again to eat breakfast and gather; the contestants will be taking their tests here (accompanied by one bottle of “Buff” energy drink each) while the rest of us will be going on an excursion. Before this happens, though, two Taiwanese contestants ask me and Hsin-Po some math problems. There’s a geometry problem, which I fail to solve:

(paraphrased) In triangle △ABC, ∠A is 40° and ∠B is 60°. The angle bisector of ∠A meets BC at D; E is on AB such that ∠ADE is 30°. Find ∠DEC.

Hsin-Po figures out that, once you guess (ROT13) gur bgure boivbhf privna vf nyfb na natyr ovfrpgbe naq gurl vagrefrpg ng gur vapragre, lbh pna cebir vg ol pbafgehpgvat gur vapragre naq fubjvat sebz gur tvira natyr gung gurl vaqrrq pbvapvqr.1 Then, there’s a combinatorics problem in a book with a solution that they’re not sure about:

(paraphrased) 15 rays starting at the same point are drawn. What is the maximum number of pairs of rays that form obtuse angles?

This happens really close to the test starts and although I have this feeling it’s isomorphic to a notable combinatorial problem, I don’t manage to articulate the isomorphism until it’s too late and they have to go. Indeed, this is more or less equivalent to (ROT13) Ghena: gur tencu unf ab sbhe-pyvdhr naq n pbzcyrgr guerr-cnegvgr tencu vf pbafgehpgvoyr. After thinking though the solution on their book, though, I realize I’ve never seen this proof of said theorem before! (But later I realize it’s actually the just very first proof that Proofs from the BOOK offers. I probably skipped it because it involved induction as well as some algebraic manipulations that looked much less intuitive and natural than they really were, so it didn’t look as cool as the later proofs. Oooooops.)

I suspect I wouldn’t do too well if I had to participate in that contest right then. But anyway, excursion.

After a long bus ride, we arrive at our first destination, Jingyuetan (淨月潭 lit. Clear Moon Lake2), allegedly the sister lake to Taiwan’s own famous[citation needed] Sun Moon Lake. We tour the place on a wall-less car and look at the lake and lots of trees. During a stop, I take some pictures of sunflowers and bees, as well as a stand selling Taiwanese sausages.

[Lake and ferry]

[Bee and sunflower]

[Sausages advertised as from Taiwan!]

The car blares weird music during the tour, such as a version of Für Elise with all the accents on different beats and a disjointed remix of the viral Chinese song 小蘋果 (Little Apple)3 with two other Chinese songs, connected with mumbling English rap segues. We also eat boxed lunches here while sitting on tiny, cramped foam mattresses on the dirt floor.

Our next stop is a museum, where there are lots of ancient historical artifacts I’m not very interested in. I find a collection of certificates involving or quoting Chairman Mao more intriguing:

Continue reading

[CIMC 2015 Part 1] Rainy Days in July (and Other Months)

We get up at 3:40 AM. By 4 AM we have left our house, speeding like a bullet into the dark.

(Ohai. Somehow it slipped my mind that I was ending my streak by leaving the country for a competition that would likely be highly bloggable, like my last two international olympiads, both of which led to notable post sequences on this blog. (Admittedly, the first one was never really completed…) My only excuse was that I was worried I might not be able to access my blog from inside the Great Firewall, but I did (via vpn.mit.edu) and even if I hadn’t, I could still have drafted posts locally in Markdown as I usually do, so I don’t know what I was thinking.)

(Also: because, as I’ve said way too many times recently, I need to do linear algebra homework, these posts aren’t going to be as complete or as perfect as I’d like them to be. Although I’m probably just saying this to persuade myself; I tend to include many of the boring parts as well as the interesting parts of the trip, which maybe benefits my future self at the expense of other readers. I probably need to get out of this habit more if I want to blog for a wider audience, though. Oh well.)


The International Mathematics Competition (IMC) is, as it says, an international mathematics competition. But I should add that it is for elementary and middle-school students (in other words, I am not competing, okay??). (edit: Also, one or two letters are often prefixed to indicate the host country, for whatever reason. This year it would be CIMC, C for China.) I am tagging along because I am a student of Dr. Sun, one of the chief organizers, and have been slotted to give a talk and possibly help with grading the papers and translating. My father is coming to help arrange a side event, a domino puzzle game competition, which he programmed the system for; and my mom and sister are also coming to help with translation and other duties. Other people in our group: Dr. Sun himself, his longtime assistant slash fellow teacher Mr. Li (wow I’m sorry I forgot you while first writing this), my friend and fellow math student Hsin-Po, who is an expert at making polyhedra from origami or binder clips (and at Deemo); Chin-Ling, my father’s student/employee who also programmed lots of the domino puzzle server and possesses a professional camera; and, of course, all the elementary- and middle-school contestants, as well as most of their parents.

I don’t think I’ve ever given this amount of background exposition about any event I’ve attended to my not-so-imaginary audience before. It feels weird. Some part of me is worried about breaking these people’s privacy by posting this, which makes a little bit of sense but not enough for me to think that it’s actually a valid reason to avoid or procrastinate blogging. I think it’s a rationalization.

Here we go.

Day 1

The only interesting thing that happens at the airport is a short loud argument in the queues for luggage check-in, perhaps partly fueled by our high number of people and of heavy boxes (gifts for other countries and raw materials for Hsin-Po’s polyhedra). I don’t know whose fault it is.

In case I fail to scale the firewall, I attempt to download Facebook on my phone for one last look before boarding, but it fails during installation twice and I give up.

Our plane is not fancy enough to offer personal screens and entertainment centers for everybody, but thankfully the ride lasts only three hours, so this is tolerable. Instead, the plane plays the second Divergence movie on overhead screens, which I watch half-heartedly. The plot setup seems interesting but the ending seems to me to involve two Ass Pulls™, although since I haven’t been paying much attention I am not confident if I just missed some foreshadowing or character development. On the flight, I also read the proof of the irrationality of powers of e in Proofs from THE BOOK and leaf through the magazines.

I don’t hear any good music on-board, except maybe “Space Oddity”, which is a little freaky to be listening to while cruising at so may kilometers in the sky. Perhaps because of this, I find myself singing and humming “Space Oddity” unexpectedly often over the next few days.


The very first sign we see after alighting the plane consists entirely of characters that are the same in Simplified and Traditional Chinese — if I remember correctly, 「前有坡道,小心慢走」1. The Changchun airport looks like any other airport, coolly blue-themed with moving platforms. The restrooms have fancy bright purple soap. Even though I consciously think about how I have suddenly arrived in a country that places notable restrictions on freedom of speech and Internet access, I don’t feel it. Eep, what an anticlimax.

[People dragging luggage boxes over gravelly ground outdoors.]
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.


    not good at solving problems

    O_o and people wonder why I’m humble…