Hey, Codeforces!
I’m AmirReza PourAkhavan, the former Codeforces Contest Coordinator. I let the story become complete, and I’m sharing it now.
The story is about a 16-year-old competitive programmer who left his family and migrated to another city alone to follow competitive programming. After seven years, he advanced to the International Collegiate Programming Contest World Finals twice.
Read the previous parts: 1, 2, 3, 4.
Read the Persian version here.
This part covers from December 2016 to November 2017.
The Codeforces Contest
Our contest was held on Codeforces, and it broke several records.
- The record for the highest number of upvotes on an editorial.
- The record for the most comments under a contest announcement.
- And probably, the record for the longest delay for a contest!
Famous people like Errichto even called its editorial the best they had ever read. I remember I once commented that I was unlucky because my contest had been postponed. Around that time, I received an email — I think from Morocco. The sender praised me for organizing such a contest and said, “You’re actually very lucky to be hosting one at your age.” That message made me realize I should look at the glass as half full — which, in truth, was nearly overflowing.
In the Div. 1 E problem, I used an algorithm I had invented myself: Arpa’s Trick! Immediately after publishing the editorial, I wrote another blog post describing it in detail, titled Arpa’s Trick, and linked it from the editorial. A Chinese user commented that they had been using this method for years and that it wasn’t new!
The post started getting downvotes, and I felt it had become pointless. I deleted it. Soon, people began asking me everywhere to bring it back. I restored it under a new title: Some Method for Solving RMQ.
Two years later, I found out through a friend that the algorithm had become known in the community under the same name — Arpa’s Trick — and was even mentioned in CP Algorithms. Years later, in 2024, when Hamidreza Kalbasi was teaching the RMQ problem at the INOI summer camp, one of the students suggested using Arpa’s Trick!
After the contest, I told Nikolay Kalinin (KAN), Codeforces’ contest coordinator, that I’d love to collaborate more with Codeforces after my university entrance exams, and he welcomed the idea.
That contest, with all its chaos, passed — and the shadow of the entrance exam grew heavier day by day.
Continuing the Olympiad Game
Even after finishing the Olympiad, I didn’t quit ever. I actively taught. Among my regular students were Ali Tavassoly (AliTavassoly) and Sina Pakseresht (m.Sina). All these classes were text-based, which was quite an innovation in Olympiad training at the time — text-based teaching!
During my exam year, I participated in three Codeforces contests. I received positive ratings in all three. I outperformed every gold medalist of my cohort in at least one of the contests. I ranked up from Candidate Master to Master. But my proudest moment that year was the 13th Quera contest, where I finished first. At least 12 gold medalists participated — both former and future ones. The contest was held in January, and my joy after winning was indescribable. These victories helped heal the wounds I had suffered.
My rating changes during 12th grade.
The Codecup Exception
Codecup was a special case. It’s a national contest — one of the largest in Iran in terms of participants. I teamed up with my dear friend Ali Shafiei (ToTLeS), one of that year’s gold medalists — and one of the strongest competitive programmers in Iranian history. The contest was held in Tehran in November, and I traveled there to compete.
On the first day, we achieved an exceptional result. Among all the medalists from previous and upcoming years, we finished second! We even beat the legendary team of Ali Haghani (Haghani) and Peyman Jabarzadeh (JeBeK) (IOI gold and bronze medalists and two-time ICPC World Final high-honorees).
That evening, we were planning how to seal the championship on the second day — but everything flipped. We ended up 23rd overall and won no prizes. The same legendary team of Haghani and Jabarzadeh became champions. The issue was that Ali and I were too similar in our strengths. The first day’s problems fit our style perfectly; the second day’s did not.
The Entrance Exam
Ah, the entrance exam — what a misery. It never suited me. My goal was ambitious: to get into Computer Engineering at Sharif University of Technology, which required ranking under 100. But my effort didn’t match my ambition. My practice test results didn’t match either. I hated textbooks. I had only four or five test-prep books; the rest I practiced online — and between all that, I still coded and taught!
By late autumn, I began reading Saadi’s poems every night. Their beauty was indescribable. Understanding and enjoying them gave me a sense of pride. My love for Persian literature grew stronger. I even wrote a poem — though it was nearly a copy of another one. Gradually, I drifted toward music. Shahin Najafi’s rap caught my attention. My father had always been serious about traditional Iranian music — our home was filled with it. This shift — from classical to loud rap — was perhaps a product of teenage rebellion. Until September 2016, I barely listened to any songs. Then I discovered Adele, whose voice mesmerized me. Later, in winter, Shahin Najafi joined my playlist. I never listened to the loud pop songs of taxis. In short, that year’s dive into literature and music both deepened my taste and improved my Persian literature exam score from 20% to 90%!
Although in the first exams after entering the university entrance exam track, I showed promise of performing very well, I didn’t study properly — on average, only about two hours a day — so I didn’t make much progress. In fact, my scores at the beginning and end of the exam year were almost the same.
The Final Days of Darkness
As the New Persian Year approached, I decided to attend Energy High School’s spring camp in Tehran — I was suffocating in my own small school in Yazd. Thankfully, the principal agreed, and I escaped to Tehran. I stayed with relatives and, from that spring onward, focused solely on studying. I stopped coding and spent my days buried in books.
Away from my family and that dreadful school, I found more joy. During breaks, I hung out with younger Olympiad students. I still remember when the assistant principal told me, “PourAkhavan, I don’t know if you’re a senior preparing for the exam or a junior Olympiad student.”
After fifty days, I returned to Yazd for the final exams. The end felt easier. I was counting the days until this torment ended. Sometimes, I browse through old contest ideas, planning to host many competitions in the future. Around that time, Mr. Asadi — that year’s summer camp director — messaged me, inviting me to join as a teaching assistant in the coding class. Unbelievable! I, who had no medal, was going to teach at the national summer camp!
The days passed quickly. The day of the exam arrived. It wasn’t a special day. I went, took the exam, and came back.
The Summer Before University
The day of the exam came and went. When I returned home, we immediately set out north for a short trip. It wasn’t great. The plan was that on our way back, I’d stay in Tehran to start my teaching work — but things didn’t go as planned. I only managed to arrange a private tutoring session for one student at Helli 10 school.
Soon after, I also pursued the teaching assistant role in the Summer Camp, organized yearly by the Young Scholars Club. It’s an eight-week camp where selected Olympiad participants earn gold, silver, or bronze medals. The most exciting part of the Informatics Olympiad camp is the coding class, where students gather in the afternoons to solve programming problems with help from teaching assistants.
I discussed it with Mr. Asadi, who initially agreed, but later, Ali Behjati (LiTi), the coding class supervisor, rejected my application — and honestly, he wasn’t wrong. I was probably one of the worst candidates at that time. I returned to Yazd, disappointed but undeterred.
My family bought me my first smartphone. A week later, I went back to Tehran and rented a bunk bed in a shared dorm near Seyed Khandan for $75 per month.
I started teaching Hamidreza Kalbasi, then a 10th grader with remarkable talent. He later won a silver, then a gold medal. I charged $10 per hour.
My talks with Helli 10 didn’t lead to a job, but I began volunteering for IRYSC, helping them with tasks. Around that time, I also messaged Nikolay Kalinin again — and officially became a Codeforces tester. Back then, there were maybe 7–8 testers per contest, so being one meant your name appeared on Codeforces’ front page — quite an honor!
The dorm I had rented was quite something. Five or six bunk beds crammed into a space of maybe thirty or forty square meters. My roommates were rather suspicious people — none of them seemed to have a proper job. They stayed up past midnight, glued to their phones, watching movies. Bedbugs crawled up the walls and generously shared their blessings with everyone at night. It lacked nothing.
Left: The room while Codeforces was open on my laptop.
Right: Woke up at midnight, killed a few bedbugs, and took a photo.
For meals, I survived on bread and cheese. For lunch, I’d buy homemade meals from cars parked by Seyed Khandan Square. That summer was pure torment for my stomach — I don’t recall eating a single fruit.
My income was about $100 a month.
Around this time, I discussed Quera with Mehdi Shokri. We signed a contract, and I officially became Quera’s contest coordinator, earning $3 per hour.
One of the most disastrous photos of my life: bald head, and I had just discovered my phone’s “beauty” filter, thinking it looked good.
Mehdi Shokri’s notes from our first Quera meeting.
I later reached an agreement with Ali Behjati to attend a few coding class sessions as a trial. So, on August 8th, I entered the Summer Camp as a teaching assistant — finally. It was an unforgettable moment. I, who had no medal, was now helping students who were all about to win one. It was a healing experience.
Naturally, the coding class meant everything to me. I was precise, organized, and determined to be the best version of myself for the students. I even added a few problems to the coding set — one of them was called “M2 Rejected,” a personal reference to my own past!
Teaching assistants of the coding class (right to left): AmirReza Shirmast, Mojtaba Shahbazi, Iman Gholami, Ali Ahmadi, Majid Gerosi, me.
Alongside the coding class, I was working at Quera, and I was also teaching private lessons. It felt good — I was working and making progress.
It was September 5th, around noon. The weather was pleasant. I went out with one of the younger students from Shahid Rajaee University — where the summer camp was being held. We took a walk and ended up at a nearby park. It was near the end of the camp. We were talking about how the program had gone and what the outcomes were when my father sent me a message that appeared in my phone’s notification bar: the message was www.sanjesh.pdf. Yes! The university entrance exam results had been announced, and my father had sent me my result file.
You won’t believe it, but I didn’t open it. I continued the conversation. My friend asked, “Aren’t you excited or nervous? Don’t you want to see the result?” I said, “Whatever it is, whether it’s rank 1 or 2000, it doesn’t matter to me.” A few minutes later, we headed back to Rajaee. My friend went his way, and I went to the mosque to pray. Just before entering the mosque, I opened my exam results. I ranked 1913, just shy of the 2000 I joked about.
During the summer camp, I got to know Danial Erfanian, one of the participants of the Informatics Olympiad summer camp. He was from Mashhad, but had moved to Tehran and was studying at Allameh Tabataba’i. His home was far away, so he stayed in the dormitory. Our commutes to the dorm and our collaboration in the coding classes gradually brought us closer. He was an above-average Olympiad student — kind, cheerful, and funny.
Time passed, and just a few days remained until the final exams of the summer camp. I was settled in the dorm by then. Around that time, I caught a cold that left me short of breath. My poor diet that summer had finally taken its toll. I returned to the dorm feeling awful and went straight to the shower. I turned on the water, and the bathroom filled with warm, humid air. I must have fallen asleep there. When I woke up, I felt a bit better and went to my friends’ room in the dorm. I had stopped visiting the instructors’ room and instead spent time with Danial and a few others. There were also two cool guys from Qazvin in that room.
The dorm atmosphere was all about gaming. Open any room’s door, and you’d see four people running a Counter-Strike server, shouting and laughing. Of course, we couldn’t resist joining in. That’s when Danial also fell sick — naturally, he had caught it from me. He got quite ill, and I didn’t know what to do. It was just two days before the final exams, and getting sick then was the last thing we needed. Thankfully, he recovered within a day or two and managed to take the exams.
The afternoon he returned from the last exam, we suddenly decided to go to Mashhad. So the next day, we packed up and left. Not that I had much to pack — everything I owned fit into a small laptop bag.
We stayed in Mashhad for a few days. On September 15th, at 8:25 p.m., the university admission results were released. I was in Mashhad, at a relative’s house. I checked my result — and couldn’t believe it. I had been accepted into Mathematics at Amirkabir University of Technology. I hadn’t expected it at all. The previous year, students with ranks up to 2200 had been accepted into Computer Science at Shahid Beheshti University, yet I hadn’t even made it into Computer Science at Beheshti — nor Mathematics at Sharif or Tehran. Somehow, I ended up in Mathematics at Amirkabir.
I accepted what fate had offered, and on September 21st, 2017, with just a laptop bag and a few clothes, I entered the Shahid Nejatollahi dormitory at Amirkabir University to begin my university student life.
To be continued...








I really liked the story, but I can't wait for another 23 months.
Sorry about that. I'll try to publish the next parts every 2 months. Let's see what happens. I plan to finish this Ten years of competitive programming in 9 parts.
waiting for you Arpa, it's been two months. ;)