Once a year, there comes a day in February when 100 000+ developers get ready to work on a single programming challenge.
The participants gather in small teams of 2-4 people. They are all over the world, from Cape Town to Oslo and from San Francisco to Tokyo. Some participate independently, others represent their local university or a developer group. Over the course of just four hours, they will all be solving a single open-ended problem, fuelled by curiosity and (often) pizza. When the time is up, no one should feel discouraged if they didn’t find the definite best solution – because it usually doesn’t exist. Welcome to Hash Code , an annual team programming competition organized by Google!
I’ve been part of the volunteer engineering team at Google that created the competition back in 2013/2014, and then scaled it to the global event that it is today. As Hash Code is fast approaching its 10th anniversary, I thought it’s a good occasion to reflect on what we’ve learned so far and share a few fun stories from behind-the-scenes.
How was Hash Code started?
Back in 2013, the engineering team at Google Paris was new, relatively small and growing fast. As a new kid in town, we felt we could benefit from more outreach, including building more connections with French students and universities. And what do you do when you want to build connections with someone? Obviously, you invite them over for a pizza-and-coding session!
But what should the coding session be about?
In a brainstorming session, we agreed on three pillars that remarkably still guide Hash Code 10 years later:
- create a fun, welcoming environment – to make the event interesting, we decided to make it a competition. But we also wanted to make sure it works for participants at all skill levels ➡️ this is why Hash Code problems are open-ended: to make it easy to develop a naive solution first, and iterate from there.
- offer a reasonably realistic view into how engineering teams work ➡️ This is why Hash Code is a team competition of 2-4 people per team
- focus our time and energy on the essentials – because it started as a side project for a few engineers with full-time commitments elsewhere, we couldn’t plan to build anything too fancy (like a real-time battle of AI bots) ➡️ This is why in Hash Code you only need to upload the resulting output of your program (while the program itself runs on your computer) – we chose to focus more time on developing the competition problem and less time on the competition infrastructure.
That sounds great in principle but then again, what should the competition be about?
For this, we didn’t look far for inspiration – at the time one of the engineering teams at Google Paris was working on optimizing routes of Street View cars taking imagery of a city: we took this idea and adapted it into a competition problem .
Directly modeling a Hash Code problem on an actual engineering project at Google is something we try to do each time – but it’s not always easy to find the right idea.
The first edition of Hash Code (Hash Code 2014)
Scope (who can register)
France
Locations
Paris 🇫🇷
Registered
200
Preparations for the first Hash Code event were exhilarating! It was a new type of event for everyone involved and we got to work on things we wouldn’t otherwise encounter in our day jobs. For example:
- how to actually run the competition and score contestant submissions ➡️ we put together a pretty ad-hoc system, developed on a short timeline by a few very enthusiastic, but not very experienced in this type of work engineers. (This only became a problem 🔥 a year later, see Hash Code 2015 )
- does the office canteen have enough electrical power and WiFi capacity for 200 students working on 200 laptops? ➡️We checked with the facilities team and they said yes – but to be sure, on the day of the event we had a technician on-call in case we managed to break the office.
- how much pizza to order? ➡️ we took the estimate of how much pizza 200 people can be expected to eat, and then (assuming that students like pizza very much), we multiplied this by 2.
Most importantly, will the students be interested? We set up a site and sent an invitation to local universities. The first paragraph of the site read:
The event was a two-day affair, starting on Friday afternoon with an introduction ceremony and a practice round using a toy problem. The practice round was very useful – for the participants, it allowed every team to test their setup and test-run their teamwork a day before the competition. For the organizers, it gave us some reassurance that the infrastructure (electricity, WiFi) can handle the event load.
Saturday was the big day, and it was the test for all our merry preparations. Things went well – the sound I remember the best was the silence of the canteen in which 200 intensely focused students worked on solving the Street View car routing problem. I also warmly remember a few tongue-in-cheek solutions created by the contestants – in one of them, the Street View cars were scheduled to drive routes that resembled the word “Google” when viewed from above ❤️. (This type of playfulness later became a bit less frequent during Hash Code onsite finals, as the competition expanded its reach and became more competitive.)
The one major issue we encountered was a pizza shortage. It turns out that multiplying the standard estimate by 2 was not enough – based on the experience of Hash Code 2014 we now believe that the right pizza coefficient is around 3.5.
The event worked, the students were happy, we were happy, everyone had an appetite for more. We just had one major issue to resolve if we wanted to organize Hash Code again…
Scaling issues (Hash Code 2015)
Scope
France, Luxembourg, Belgium, Switzerland
Locations
Qualification Round: online Final Round: Paris 🇫🇷
Registered
1538
The main limitation of the first edition of Hash Code was the physical size of our office canteen – at 200 participants, the space was packed. Even more people had filled in the registration form and we sadly weren’t able to invite everyone.
In the second edition we wanted to enable everyone interested in Hash Code to participate. But we also wanted to preserve what made the first Hash Code fun – the feeling of a local community gathering. How can we make the competition bigger without sacrificing the local feel?
The solution we came up with is Hash Code “hubs”. We invited universities and developer groups across France to organize Hash Code events of their own at their own location (and with their own pizza 🍕). We provided the competition problem and the online scoring system – including a per-hub scoreboard, to help create an engaging local experience. The best scoring teams in the Qualification Round were to be invited for the Final Round at Google Paris.
Adding the online Qualification Round was the single biggest change in the history of the competition. Because every year we have many more participants in the qualifications than we can invite for the finals, the Qualification Round is our top-of-mind priority and the make-or-break moment of each edition.
Now, speaking of breaking, the 2015 was also the year of our biggest technical issue to date (knock knock on my wooden desk). Our ad-hoc scoring system created a year earlier had scalability limitations (related to how the scoring application was using the underlying database) that we didn’t fully understand before the event. These limitations became apparent when ~1500 contestants attempted to submit solutions at the same time. At a few times large groups of contestants were not able to use the scoring system:
And to make this especially ironic, the competition problem we prepared for the round was about data center reliability… (to be fair, the breakage wasn’t because of a data center issue. It was purely a problem in the scoring system – more on this below ).
The evening was saved by a Google Form – we set up an emergency backup submission form that wasn’t scoring anything, but allowed the contestants to continue submitting their solutions to the competition problem. The next day we spent a pretty tense workday feeding those emergency-system submissions back to the scoring system and calculating the results.
While the evening of the competition was very tense because of the breakage, we were reassured by the feedback from the participants and hub organizers – despite the glitch, people had a good time! On our side, we firmly resolved to be better prepared for the next year.
At least things worked correctly for the onsite Final Round, for which we prepared a fun problem about coordinating Loon balloons . These balloons don’t have a propulsion system, so the only way to control where they go is rely on different wind direction at different altitudes.
It was a lot of fun and balloons #HashCode2015 pic.twitter.com/Hl0Yxd8zJy
— Cecile (@CecileHbh) March 30, 2015
New, scalable system (Hash Code 2016)
Scope
Europe, the Middle East and Africa
Locations
Qualification Round: online Final Round: Paris 🇫🇷
Registered
17307
For Hash Code 2016, we wanted to expand the competition geographically, for the first time inviting participants from most of the EMEA (Europe, the Middle East and Africa) region. With the technical issues of 2015 fresh in mind, we knew that we needed a bigger boat, that is – a scoring system that can scale.
Our original system was developed with a small event in mind, and we didn’t pay particular attention to scalability. The development stack we picked was a combination of a Python application running on App Engine, using a MySQL database as storage and the Django framework to link the database to the application. This is a pretty good stack, especially if the primary goal is development speed. It is also certainly possible to develop scalable applications on it – especially if you have relevant experience and know which pitfalls to avoid. We didn’t, and the scoring system was making too many database writes upon a visit, overloading our MySQL database during the Online Qualifications…
It was possible to mitigate the issue by reducing the number of database writes. But, as we were thinking about expanding Hash Code, we didn’t only want to only address the issues that come with the current expected load – we wanted to be ready for years to come.
So we got back to the drawing board and developed a new scoring system, still using App Engine to host the application (this part does scale very well) but now using Datastore as the backing database. Datastore is a database specialized in scalability – it has this beautiful property that things that would be slow in a traditional SQL database, are just impossible with Datastore. It means it’s harder to design and develop your application – but once you have it, it’s likely pretty scalable.
Developing this new system in the months before the 2016 competition in a small team on which everyone was a volunteer with limited time was challenging – but it was worth it, as the new system worked nicely not just for this, but for 6 full editions!
Of course, the scoring system was only one element of scaling Hash Code in 2016. We expanded the network of Hash Code hubs thanks to fantastic new hub organizers from across the EMEA who joined us that year. We also started to invest more in preparing Hash Code live streams – more on this below ).
Quick pizza break and back to hacking @Andela_Kenya @Andela #hashcode2016 pic.twitter.com/LZpnzQRqnK
— Anthony Nandaa (@ProfNandaa) February 11, 2016
Better features (Hash Code 2017)
Scope
Europe, the Middle East and Africa
Locations
Qualification Round: online Final Round: Paris 🇫🇷
Registered
26420
If the previous edition was a race against time to have a new scoring system ready, the 2017 edition was when we caught a breath and were able to land some pragmatic quality-of-life improvements in the scoring system, including push-notification banner (handy if we need to announce a problem statement clarification or react to technical issues), per-country scoreboards, a new experience for hub managers and – behind the scenes – more automated testing.
To celebrate pizza – one of the preferred food type for Hash Code participants – we ran a practice problem where the challenge was to optimally cut pizza into slices 🍕.
Seems that someone is cutting pizza... 🍕 #hashcode2017 #ready4hashcode @Google pic.twitter.com/EHCGzXfD7x
— Ana Roig Jiménez (@anicacortes) February 16, 2017
Speaking of problem development, we also started to pay more attention to making the Qualification Round problem easy to understand – after what we felt was a pretty tough Delivery drone routing problem in 2016, this time we run a neat optimization task about caching YouTube videos , increasing the number of teams who submitted a solution by 3x!
Road to Dublin (Hash Code 2018)
Scope
Europe, the Middle East and Africa
Locations
Qualification Round: online Final Round: Dublin 🇮🇪
Registered
37778
In 2018 we ran a Qualification Round competition problem inspired by self-driving cars , which was one of the hottest topics of the time.
The KU Leuven #hashcode hub is ready to participate with a full house tonight! Good luck to all teams! #kuleuven #hype pic.twitter.com/avVYxZ8nfC
— Thomas De Backer (@mosterdt) March 1, 2018
As the office event space at Google France was closed for renovation works, we needed to find a new home for the competition finals. We settled on Google Dublin, one of the company’s biggest offices in EMEA and ran a problem about urban planning – a reference to the newly re-architected Grand Canal Dock area where the Google office in Dublin is based.
Another first for Hash Code: two of Google Dublin volunteers who came to help with the Final Round in 2018 met during the event, and later got married in the summer of 2021 ❤️.
Going global (Hash Code 2019)
Scope
Global
Locations
Qualification Round: online Final Round: Dublin 🇮🇪
Registered
70865
By 2019 we had been discussing the if, the how and the when of going global for at least 3 years.
After long discussions about the logistics, we agreed that the signature property of Hash Code we want to preserve is the “unity of time” – the feeling of participating together in one intense, but approachable event. This determined everything else – for the event to stay approachable, we needed to keep the original formula of a 4h programming round (longer programming marathons are less appealing to beginners) and to preserve the unity of time, we needed to stick with a single Qualification Round.
As we became a global competition, we started to better coordinate and integrate with the other two global coding competitions organized by Google: Code Jam and Kick Start, together forming an umbrella brand of Google’s Coding Competitions. In practice this meant transitioning to a new unified website, managing contestant registration and contestant profile for all three competitions. This was a nice simplification, as we went from a triad of systems (website – registration system – scoring system) to the remaining two.
On 28 February 2019, Hash Code became a global programming competition! We ran a fun, easy-to-explain problem about arranging a photo gallery in the most “interesting” way possible (see the problem statement to find out what that means:)). We were happy to see that the problem was approachable – the best type of posts I personally look forward to is feedback from people who participated in Hash Code for the first time:
Last week I took part with @KinnzaZ in a coding competition (#hashcode ) for the first time.
— Dalia Simons (@SimonsDalia) March 7, 2019
It was a blast, we failed and I wrote a new post about it: https://t.co/KAt0n3A8Xt
A big thanx to @Baot_IL for introducing us to this competition and hosting a hub #hashcodesolved
Virtual finals (Hash Code 2020)
Scope
Global
Locations
Qualification Round: online World Finals: online
Registered
111955
By 2020 our scoring system was battle-tested. We also had a pretty stable set of processes to manage the competition that we’ve been developing over the years, including a handy list of backup solutions in case something goes wrong. This list included some pretty unlikely scenarios such as loss of power in the office.
But, our emergency plans didn’t include the one issue we encountered during the Qualification Round on February 20, right after the submission window closed. YouTube live streaming system had a very short (and rare!) outage , precisely during our livestream show in which we wanted to announce the results. What were the chances of that happening? 😅 We could hardly believe it when we realized that the stream isn’t working.
Fortunately, this was not a critical part of the event – we simply unfrozen the scoreboard (making preliminary results visible) and sent the livestream recording link to everyone via email.
The 2020 finals were planned to take place in Dublin 🇮🇪 for the third time. But before then, the pandemic struck and for the first time we needed to pivot the finals to take place online. For me, I got to participate in the Hash Code closing ceremony… from my bedroom. In the end we got some very nice messages from the contestants who were understanding of the situation and wanted to let us know they still had a great time ❤️.
Virtual hubs (Hash Code 2021)
Scope
Global
Locations
Qualification Round: online World Finals: online
Registered
128410
The 2021 edition was even more affected by the pandemic than the previous one. Due to the ongoing disruption and risk created by Covid in most geographies, we didn’t want to take or encourage unnecessary risks and switched the Qualification Round hubs to a virtual-only model.
For the competition problems, we intentionally picked two topics not not related to the pandemic: city traffic lights and organizing software projects. With all the disruption and hardship created by Covid we wanted to offer an opportunity to think about and work on something unrelated.
The Hash Code community showed up more than ever before, reaching 111 000 registered contestants!
New competition platform (Hash Code 2022)
As I write this, we just opened the registration for the 2022 event. Hubs are once more virtual, but we keep our fingers crossed for the next year.
Very importantly, in 2022 we’re finishing the big unification of the Coding Competitions stacks at Google – for the first time, the competition will take place directly in the same website we’ve been using for contestant registration since 2019. This is great news for the long run of Hash Code and Coding Competitions at Google:
- the Coding Competition website stack (unlike the two generations of the Hash Code judge system) has a very small but excellent team of full-time engineers dedicated to developing and improving the system (while the Hash Code eng team are part-time volunteers)
- a lot of the functionality of the Hash Code Judge System was also available in the Coding Competitions system. By transitioning to the new stack, the volunteer engineer Hash Code team will be able to focus more on preparing the competitions problem and less on developing the infrastructure (which we didn’t always get right )
- most importantly, we hope the new unified stack is a better experience for our contestants and hub organizers – for sure it’s one less system to jump between. For the first time all three systems of our original trio (info website / registration system / scoring system) are replaced by one website.
That said, all change is disruptive and this is a significant change. I hope you give Hash Code a try in 2022, and if you notice any issues or have feedback about the competition system – please let us know !
What have we learned so far?
Looking back at the last 10 years, I have two takeaways.
Start small and iterate. There was no way we’d even try to start a global programming competition as a side project at Google France in 2013. Why would we? There were already many excellent programming competitions to choose from. But we did feel it’s worth starting a local event, tailored to what we feel would make sense in our local context, using the limited resources (including time) that we had to prepare it. From there, Hash Code grew iteratively, allowing us to make changes, stumble on a few errors (see the 2015 judge system issues), learn and correct them.
Community comes first. Each Hash Code edition needs a good competition problem and a scoring system to run the competition. But the secret ingredient was always pizza, by which I mean the community behind the competition. It’s the fact that Hash Code is a team competition that allows contestants to practice teamwork and enjoy problem-solving more. It’s the Hash Code hubs, led by community-minded professors, students and organizers around the world that offer the chance to meet up and build local connections. It’s social media, online forums and blogs that we all, contestants and organizers, use to share impressions, tips and feedback.
For the next 10 years of Hash Code I have one aspiration for the Hash Code community: to stay focused on building a friendly competition that is welcoming to everyone – and especially to people new to programming events. Looking forward to seeing what we can do together the next 10 years 🚀!
Acknowledgements
Thank you to all Hash Code contestants – for participating and for all the feedback on the competition ✨. Thank you to the Hub organizers – for the work you put into organizing your hubs 🎉.
Thank you to all my colleagues on the Hash Code team @ Google – for almost 10 years of working on Hash Code together, and to the many volunteers from various functions and geographies across Google.
A special callout is due to the tireless lead organizer of the first editions of the event and the discoverer of the Hash Code pizza coefficient, engineering site lead for Google France, Vincent Simonet.