<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Notes</title>
		<link>https://prabowo02.github.io/</link>
		<description>Recent content on Notes</description>
		<generator>Hugo 0.112.5 -- gohugo.io</generator>
		<language>en-us</language>
		<lastBuildDate>Thu, 22 Jan 2026 01:15:37 +0800</lastBuildDate>
		<atom:link href="https://prabowo02.github.io/index.xml" rel="self" type="application/rss+xml" />
		<item>
			<title>My Preferences</title>
			<link>https://prabowo02.github.io/preferences/</link>
			<pubDate>Sat, 24 Jan 2026 00:08:03 +0800</pubDate>
			<guid isPermaLink="true">https://prabowo02.github.io/preferences/</guid>
			<description>&lt;h2 id=&#34;tier-lists&#34;&gt;Tier Lists&lt;/h2&gt;
&lt;h3 id=&#34;philosopher-tier-list&#34;&gt;Philosopher Tier List&lt;/h3&gt;
&lt;img src=&#34;https://prabowo02.github.io/philosopher.png&#34; /&gt;
&lt;h3 id=&#34;religion-tier-list&#34;&gt;Religion Tier List&lt;/h3&gt;
&lt;img src=&#34;https://prabowo02.github.io/religion.png&#34; /&gt;
&lt;h3 id=&#34;sexuality-tier-list&#34;&gt;Sexuality Tier List&lt;/h3&gt;
&lt;img src=&#34;https://prabowo02.github.io/sexuality.png&#34; /&gt;
&lt;h3 id=&#34;cities-i-visited-tier-list&#34;&gt;Cities I Visited Tier List&lt;/h3&gt;
&lt;img src=&#34;https://prabowo02.github.io/cities.png&#34; /&gt;
&lt;h2 id=&#34;political-values&#34;&gt;Political Values&lt;/h2&gt;
&lt;p&gt;I prefer:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;equality over free market;&lt;/li&gt;
&lt;li&gt;globalism over nationalism;&lt;/li&gt;
&lt;li&gt;civil liberty over authority;&lt;/li&gt;
&lt;li&gt;progression over tradition.&lt;/li&gt;
&lt;/ul&gt;
</description>
		</item>
		<item>
			<title>On IOI with Indonesia Team from the Lens of Non-Contestant</title>
			<link>https://prabowo02.github.io/posts/ioi-journey/</link>
			<pubDate>Thu, 22 Jan 2026 01:15:37 +0800</pubDate>
			<guid isPermaLink="true">https://prabowo02.github.io/posts/ioi-journey/</guid>
			<description>&lt;p&gt;This is a very overdue post, but I decided to write it while my memory still serves, and for some unknown reason, I simply had the motivation.
I also wanted to write about IOI 2022 from the perspective of a Scientific Committee member, but sadly, the details are already blurred. Maybe I&amp;rsquo;ll try to dedicate one day to recalling them and slip them in this same post.&lt;/p&gt;
&lt;p&gt;I am not a very good writer, so you may find the tone here to be more informative rather than narrative.
I will first write about IOI 2023 as a team leader, then IOI 2024 as an invited guest (problem author).&lt;/p&gt;
&lt;h2 id=&#34;ioi-2023&#34;&gt;IOI 2023&lt;/h2&gt;
&lt;p&gt;The training camp for Indonesian IOI usually happens right before the IOI itself.&lt;/p&gt;
&lt;p&gt;These are the contestants for IOI 2023 and their aliases:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Metal: Matthew Allan&lt;/li&gt;
&lt;li&gt;Ariel: Albert Ariel Putra&lt;/li&gt;
&lt;li&gt;Vannes: Vannes Wijaya&lt;/li&gt;
&lt;li&gt;Joel: Joel Gunawan&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The team that helped me onsite were:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Zanite: Albert Yulius Ramahalim&lt;/li&gt;
&lt;li&gt;Novaryo: Steven Novaryo&lt;/li&gt;
&lt;li&gt;Pak Mush: Mushthofa&lt;/li&gt;
&lt;li&gt;Pak Adi: Adi Mulyanto&lt;/li&gt;
&lt;li&gt;Mas Kadek: Sudhi Arsana&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;And the rest of the delegation members who also flew to the IOI:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Yohandi: Yohandi&lt;/li&gt;
&lt;li&gt;Irvin: Jonathan Irvin Gunawan&lt;/li&gt;
&lt;li&gt;Ashar: Ashar Fuadi&lt;/li&gt;
&lt;li&gt;Brian: Brian Marshal&lt;/li&gt;
&lt;li&gt;Dewi: Dewi Yuliani&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;day-0&#34;&gt;Day 0&lt;/h3&gt;
&lt;p&gt;My day started with the smell of leftover &lt;em&gt;martabak&lt;/em&gt; from the night before.
As this is the last day of staying at the hotel, I started to do some packing.
There were a number of items left by the contestants in my room, which I keep safe for now (my room was essentially the base camp for the contestants during the whole IOI training).&lt;/p&gt;
&lt;p&gt;In the midst of reorganising the rooms, Pak Adi gave me a call that he entrusted me with the four contestants for the competition.
He had given a quick visit to each of their room to give some encouragement, then asked me to keep watch for the mental stability of the contestants.&lt;/p&gt;
&lt;p&gt;The rooms had been requested for a late check-out, so we still had time to have lunch in the hotel.
As the time hit 12.00 WIB, I went down and invited some people to play pools then finally had our final lunch in the hotel.&lt;/p&gt;
&lt;p&gt;The team then departed from Golden Tulip Essential Tangerang at 14.00 WIB sharp.
Novaryo went his separate way, so we bid farewell to him.
All the team (except for Joel, he check out earlier with his parents) departed by a van, while Metal&amp;rsquo;s parents and Zanite departed by a car.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2023_pools.png&#34; style=&#34;width: 500px&#34;/&gt;
&lt;em&gt;Pools with Puspresnas before heading to the airport.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;We reached the Soekarno Hatta International Airport and had a final photo with Puspresnas before they wished us good luck for the competition.
Terminal 3 was busier than usual, and it was hard to find a good spot to chill and relax.
In the end, we simply waited for the others (Brian, Dewi, and Ashar) at HokBen.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2023_pools.png&#34; style=&#34;width: 500px&#34;/&gt;
&lt;em&gt;Final photo with Puspresnas.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Joel and Metal&amp;rsquo;s parents also joined the wait at HokBen, with them interrogating my life for the whole time.
Brian finally arrived with all boxes containing souvenirs and prizes from IOI 2022 (as a context, IOI 2022 was held hybrid, in which some countries participated online and did not receive their merchandise).
Dewi also greeted the contestants&amp;rsquo; parents, and they seem to have created a WhatsApp group of moms &amp;ndash; typical Asian parents wanting to keep watch and gossip about their kids the whole time.&lt;/p&gt;
&lt;p&gt;The delegation bid a final farewell as we proceeded through the final security checks.
The immigration gates were packed by several groups of pilgrims, and some of the delegation members were unable to use the autogate (for a reason I can&amp;rsquo;t remember).
The passport was finally stamped, which marks the beginning of the journey.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2023_depart.png&#34; style=&#34;width: 600px&#34;/&gt;
&lt;em&gt;Final group photo before departure&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;The wait for the boarding was uneventful.
As Brian was the one who did the web check-in for us, he managed to choose the seats for us as well so that we are all clustered together.&lt;/p&gt;
&lt;p&gt;Nothing of interests were happening during the CGK-DOH flight as most people were asleep, with two wakes for meals.
The flight was generally smooth, and I can hardly recall experiencing any turbulence.&lt;/p&gt;
&lt;p&gt;As we landed, we then boarded a bus that took us to the airport terminal.
In the terminal, we had to go through security checks again, with Joel having to have his bag scanned twice and unpacked by the security.
We then regrouped near a figure which has a resembling look of a defective Pikachu.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2023_pikachu.png&#34; style=&#34;width: 500px&#34;/&gt;
&lt;p&gt;We then finally do another wait for our next leg of flight.
During the wait, I, Brian, and Ashar had a discussion about Pelatnas and how they compare with the current training.&lt;/p&gt;
&lt;p&gt;The next flight&amp;rsquo;s seating had been picked by Brian as well, but this time we were separated into three groups of three.&lt;/p&gt;
&lt;p&gt;As it was still dawn, most of us were also asleep during the flight with one meal in between.&lt;/p&gt;
&lt;h3 id=&#34;day-1&#34;&gt;Day 1&lt;/h3&gt;
&lt;p&gt;The plane landed in the early morning.
The airport is rather quiet as our flight seems to be one of the first flights of the day to land.&lt;/p&gt;
&lt;p&gt;A Saudi Arabian IOI team member recognised the TOKI logo on my hoodie and greeted our team.
After a quick chat, we proceeded to the baggage collection area.&lt;/p&gt;
&lt;p&gt;One suitcase was stuck on the belt, and there were no officers nearby to report to.
Dewi then courageously climbed the belt to retrieve it.
The front zip of the suitcase was damaged, but fortunately, no items were stored there.&lt;/p&gt;
&lt;p&gt;Zoltan greeted us at the exit and guided us to a waiting room that had been reserved for the IOI team&amp;rsquo;s arrivals.
Inside, they provided some snacks and sodas.
There was also WiFi, so we could report our arrival to the home country as well.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2023_budapest.jpg&#34; style=&#34;width: 600px&#34;/&gt;
&lt;em&gt;The waiting room at Budapest airport&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;After sufficient people had arrived, we proceeded to a minibus.
The weather outside was quite chilly with some wind.&lt;/p&gt;
&lt;p&gt;A wagon was attached to the back of the bus, and our luggage was stored there.
There was no locking mechanism that prevented the luggage from falling due to inertia, so I can only trust the driver on this.&lt;/p&gt;
&lt;p&gt;The drive lasts for around two hours.
Though I did not see any speed limit, the bus was considered slow.
The view for most of the bus trip was a rural area with a few small European-style houses.&lt;/p&gt;
&lt;p&gt;We finally arrived in Szeged.
It is the third-largest city in Hungary, but it looks pretty small by my Southeast Asian standards.
Most people here use bicycles, and the cars they used were generally small.
All of us were dropped in Forras Hotel, the hotel for contestants.&lt;/p&gt;
&lt;p&gt;The delegation was then paired with a guide.
The IOI 2023 had a rule that, outside of the hotel, contestants must be accompanied by either the guide or their team leaders.
The guide for the Indonesian team was a Mongolian student from Szeged University.
After she introduced herself, we then did our team registration and collected our IOI bags.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2023_bag.jpg&#34; style=&#34;width: 600px&#34;/&gt;
&lt;em&gt;The content of the IOI bag.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;After the contestants had checked in, we went our separate ways from the contestants and proceeded to the next hotel &amp;ndash; the Novotel.&lt;/p&gt;
&lt;p&gt;There, we had PopMie as our lunch (no lunch was provided on arrival day). After which, Ashar, Brian and Dewi went to their own hotels to rest.&lt;/p&gt;
&lt;p&gt;There was a little miscommunication about the hotel allocation. Long story short, the last information that I received was for Brian and Dewi to stay in Art Hotel, but they apparently also stayed in Science Hotel, so a committee member has to drive them to the correct hotel.&lt;/p&gt;
&lt;p&gt;The dinner for non-contestants is only served in the Novotel, so we met Brian and the others again during the dinner.&lt;/p&gt;
&lt;h3 id=&#34;day-2&#34;&gt;Day 2&lt;/h3&gt;
&lt;p&gt;After breakfast, we immediately proceeded to the very first General Assembly (GA) of IOI 2023.
Each country had its own pigeon hole, where other countries can distribute things (such as souvenirs, ads, notices, etc) to these pigeon holes.
The pigeon holes were located at the back of the GA room.
The Wi-Fi password for the GA room was &lt;code&gt;Sunshine+3662&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The first GA consists of:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Welcoming everyone to the IOI 2023&lt;/li&gt;
&lt;li&gt;Announcing Libya as an invited observer&lt;/li&gt;
&lt;li&gt;Announcing changes in IC members (Yugo was replaced by Brian due to a health issue, and Agnes was replaced by Jobbagy due to internal political drama that I am not aware of)&lt;/li&gt;
&lt;li&gt;Introducing the GA chair&lt;/li&gt;
&lt;li&gt;Code of Conduct reminder&lt;/li&gt;
&lt;li&gt;Approval of contest rules.&lt;/li&gt;
&lt;li&gt;etc.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A few delegation countries approached me to ask about their certificates for IOI 2022, to which I replied that they will be distributed later (because Brian overslept and did not attend this GA) to their own pigeon holes at the next GA.&lt;/p&gt;
&lt;p&gt;The use of the IOI bot during the online IOI continues to be used for this full onsite IOI.
The IOI bot usually helps in administrative tasks involving the GA, mainly for taking votes.
However, the bot was not awake this morning, so the votes for this GA use the traditional &amp;ldquo;raising the country placard&amp;rdquo;.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2023_bot.jpg&#34; style=&#34;width: 600px&#34;/&gt;
&lt;em&gt;Voting for &#34;Is the bot awake?&#34;.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;After the GA, we proceeded to Pick Aréna, where the practice session was held.
The practice session lasts for 2 hours.
During the first hour, the leaders can only observe their contestants from the second floor.&lt;/p&gt;
&lt;p&gt;In the second hour, leaders can enter the contest floor, so we did.
At the end of the practice session, the contestants left their belongings there, and we went our separate ways again to each of our hotels.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2023_hall.jpg&#34; style=&#34;width: 600px&#34;/&gt;
&lt;em&gt;The contest hall during the practice sesssion.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;After lunch, we had our second GA meeting, &lt;a href=&#34;https://docs.google.com/presentation/d/1rvyJUOk9QNkq-cWsQVn12a7dquoNG_COncm0ZbI1tsw/edit#slide=id.p&#34;&gt;discussing the practice session&lt;/a&gt;.
The IOI 2022 certificates and goodies had been distributed, which were then announced by Brian.
A few countries thanked us for these.
There were no major issues, so the meeting quickly concluded.&lt;/p&gt;
&lt;p&gt;We then go to TIK for the opening ceremony.
The IDN team agreed to wear the IOI 2022 polo as our dress code for the opening.
A Turkmenistan deputy leader, to my surprise, greeted us in Indonesian.
He said that he had lived and worked in Bandung for a few years.
The guy seems very fond of Indonesia, and would ocassionally approached us again throughout the whole IOI.&lt;/p&gt;
&lt;!-- The [seating plan](https://ioi2023.hu/wp-content/uploads/2023/08/Seating_chart_opening.pdf) for the opening ceremony is grouped by contestants, leaders, and committees. --&gt;
&lt;p&gt;The view from the leaders&amp;rsquo; seats was not great.
The ceremony was, well, ceremonial, with ceremonial button pressing, speeches, dances accompanied by Rubik&amp;rsquo;s performance (trivia: Rubik&amp;rsquo;s cube originated from Hungary), and finally, teams introduction.&lt;/p&gt;
&lt;!-- Photo of teams introduction --&gt;
&lt;p&gt;You can rewatch the opening ceremony &lt;a href=&#34;https://www.youtube.com/watch?v=yMO9hXl-Iio&#34;&gt;on YouTube&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;After the closing ceremony, we regrouped again with the contestants, gave my own final &amp;ldquo;speech&amp;rdquo;, and had a photo session using our national flag.
A Latvian team borrowed our flag and had a photo too, with eduardische and his iconic MU shirt lying down to mimic the bottom red stripe of the Latvian flag.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2023_latvia.png&#34; style=&#34;width: 600px&#34;/&gt;
&lt;em&gt;Posing as the Latvian flag using Indonesian flag.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Brian also bought chocolate as a lucky charm for IDN contestants.
But since the practice session was already over, I had to submit the chocolate to the technical committee at the next GA as an &amp;ldquo;additional item&amp;rdquo; for IDN contestants.&lt;/p&gt;
&lt;p&gt;We then had a walk and some photos in front of &lt;a href=&#34;https://maps.app.goo.gl/2s1RopbuBrNkPmar6&#34;&gt;a reformed church&lt;/a&gt;, then to &lt;a href=&#34;https://maps.app.goo.gl/KNNb232UiFactVJd6&#34;&gt;a supermarket&lt;/a&gt; where I bought some Bocchi chocolate (for the memes), and hanging around in &lt;a href=&#34;https://maps.app.goo.gl/on6q3pA7kmkzboyU8&#34;&gt;University of Szeged (Faculty of Dentistry)&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I then returned to my hotel and had my dinner. At this point, I was no longer allowed to communicate with the contestants until the end of the Day 1 contest.&lt;/p&gt;
&lt;p&gt;We finally arrived at the main spotlight of the day, the GA 3 &amp;ndash; task selection and translation of day 1 problems.&lt;/p&gt;
&lt;p&gt;The task selection process is roughly as follows. The tasks are made available through the translation system, which can be accessed by each country after obtaining its credentials through the IOI bot. Leaders then read the tasks and can raise objections to the tasks.
There are two kinds of objections: major objections and minor objections. Minor objections usually concerns of correcting typos, rewording, making statements clearer, etc. Major objections are those that can alter the problemset (e.g. rejecting a problem because similar problems appeared elsewhere). All these objections are made through the IOI matrix chat. If there are no more objections after a while, a vote is then cast to accept the problemset, and we can finish the translation afterwards.&lt;/p&gt;
&lt;p&gt;Discussions during the GA are also happening in the IOI matrix chat.
After being briefed on the task selection process, we were then asked to obtain our credentials for the translation system through the IOI bot.
However, the bot was still not awake.
Written credentials were then distributed.&lt;/p&gt;
&lt;p&gt;I first read the task &lt;code&gt;soccer&lt;/code&gt;.
It&amp;rsquo;s funny how IOI task statements become so verbose nowadays, which made Brian laughingly said that some of the paragraphs can be intuitively explained in one sentence.
I had trouble understanding the scoring section, which Ashar agreed was indeed confusing, so I raised an objection on it.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2023_objection.jpg&#34; style=&#34;width: 350px&#34;/&gt;
&lt;em&gt;An example on how an objection was raised. A plus emoji means the objection was accepted.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;After several objections from other countries, the final revision looked so much better.
There&amp;rsquo;s also a fun objection regarding the sport name.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2023_soccer.jpg&#34; style=&#34;width: 350px&#34;/&gt;
&lt;em&gt;What is soccer?&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;There was no major objections. Since I had no issue with the other two tasks, we went ahead with the translation.
A vote to accept the tasks is then cast, and we finalise our translations for printing.
We finished the translation at around 1 am local time, and this was considered early as half of the countries were still in the room by the time we left.&lt;/p&gt;
&lt;h3 id=&#34;day-3&#34;&gt;Day 3&lt;/h3&gt;
&lt;p&gt;It is finally the contest day!
The contest started on time. While the contestants were competing, the leaders went to the IOI conference.
To be very blunt, none of the conference topics were interesting.
I came mainly to see Brian presenting two reports about the Indonesian team.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2023_conference.jpg&#34; style=&#34;width: 600px&#34;/&gt;
&lt;em&gt;Brian presenting in a conference.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;After the conference was over, we went to the contest site.
We waited while having our lunch in the dining area.
Here, I greeted and was greeted by some familiar people: delegations from PHL, MYS, SGP.
Sadly, I recognised far fewer people compared to those who came for IOI 2022.
I had some discussions about the problem with kevinsogo who made me feel inferior as he already solved all the problems.&lt;/p&gt;
&lt;p&gt;The contest was over, and we guided IDN contestants to the dining area.
They did not discuss much about the problems while they were enjoying their lunch.
Our guide asked us whether we wanted to join the excursion on the next day, and of course we wanted to!
(In fact, if the contestants refused to do so, this may be a bad sign of deteriorating mental condition which may affect contest day 2, IMO, and that actually happened before).
There were no more agenda so everyone went back to their own hotels, but I decided to walk the contestants to their hotel.&lt;/p&gt;
&lt;p&gt;Aside from crossing the bridge, there was not much of a view when walking from the contest site to the contestant&amp;rsquo;s hotel.
Reaching the hotel, we went to the game room, which has the usual ping pong tables and some board games.
There were foosball and PS5 too.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2023_pingpong.png&#34; style=&#34;width: 600px&#34;/&gt;
&lt;em&gt;Ping Pong in the game room.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;I followed to their rooms afterwards and had a little rest.
Metal, Vannes, and Ariel then followed me to have a little walk in the city to see places with more architectural establishment.
This was the path that we took, ending with a visit to a minimarket.&lt;/p&gt;
&lt;p&gt;I walked them back to their hotel and also had my dinner there (by right, I was not allowed to have dinner there).
Unfortunately, I spent too much time with them, and I missed both the GA meeting 4 and the APIO meeting, but thanks Brian for covering me.
Thankfully, he said that nothing of importance happened, which I just trusted (there was definitely some interesting information that I did miss).&lt;/p&gt;
&lt;h3 id=&#34;day-4&#34;&gt;Day 4&lt;/h3&gt;
&lt;p&gt;It&amp;rsquo;s the excursion day.
There were two batches: the first batch was the contestants, and the second batch was the leaders and guests.
Both batches have the same itinerary (I think), but the first batch started one hour earlier.&lt;/p&gt;
&lt;p&gt;We first went to ELI-ALPS, and proceeded to have a one-hour lecture about lasers.
During the lecture, I was mostly focusing on uploading the day 1 tasks to TLX.
After the lecture was over, we walked around the facility.
I met the Yoneda brothers, had some talk with them, and had a photo.
There was nothing much to see in the facility, as it is not exactly a museum.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2023_laser.png&#34; style=&#34;width: 600px&#34;/&gt;
&lt;em&gt;Lecture about laser in ELI-ALPS.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;We then proceeded to Opustaszer.
The main show case in this place was a giant painting surrounding a room, and we were not allowed to take any photo inside the room.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2023_painting.jpg&#34; style=&#34;width: 600px&#34;/&gt;
&lt;em&gt;The supposedly unallowed photo, taken from the IOI official page.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;I finally met with the contestants again, who were taking picture of the windmill there.
The lunch was not particularly enticing, so I did not have one (a normal thing to happen to me).&lt;/p&gt;
&lt;p&gt;We had the group photo with the whole IOI people in this park too.
Brian also mentioned that it totally slipped his mind to take a group photo in IOI 2022.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2023_group.png&#34; style=&#34;width: 600px&#34;/&gt;
&lt;em&gt;The unofficial group photo taken by Brian.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Returning to the hotel, Brian and I continued to have a walk in the city (this is no longer part of the excursion).
We went to visit a cafe, and I also had a chance to use the &lt;a href=&#34;https://en.wikipedia.org/wiki/Lime_(transportation_company)&#34;&gt;Lime&lt;/a&gt; mobile app to rent an electric scooter.
We also went to Árkád Szeged, which, upon entering, really took me off guard, as if I was teleported from a quiet antique small town into a modern, spacious shopping mall.
Árkád was the biggest mall in Szeged, but nothing was out of the ordinary (from the point of view of me who has lived in Singapore, a city full of shopping malls).
After strolling around, we went back to Brian&amp;rsquo;s hotel, then took on the shuttle bus for GA meeting 5.&lt;/p&gt;
&lt;p&gt;GA meeting 5 was where the task selection for competition day 2 took place.
This time, asking for credentials via the IOI bot works for me, but the paper credentials were still distributed nevertheless.&lt;/p&gt;
&lt;p&gt;One task was immediately shot down by a major objection from IOI2 country, due to &lt;em&gt;almost the same problem&lt;/em&gt; was used for their team selection in the same year.
AUS also mentioned that he has seen a similar setup of the problem from 2011.
The ISC then finally announced that they were going to use one of their backup tasks, &lt;code&gt;overtaking&lt;/code&gt;, as a substitute to the easiest problem.&lt;/p&gt;
&lt;p&gt;I personally had no issue with the statements of day 2, aside from the stupidly long &lt;code&gt;overtaking&lt;/code&gt; (the information is too verbose to the point that some subtasks became &amp;ldquo;free&amp;rdquo;).
The statement for &lt;code&gt;beechtree&lt;/code&gt;, however, received so many minor objections as they were considered by many to be too convoluted.
Indeed, there was even a major objection for this task for being &lt;em&gt;too hard to understand and artificial&lt;/em&gt;.
Due to this, a somewhat heated debate happened on how to best write an IOI task statement.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2023_overtaking.jpg&#34; style=&#34;width: 350px&#34;/&gt;
&lt;em&gt;Me complaining about the overtaking statement.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;beechtree&lt;/code&gt; statement underwent major revisions, which I agree became so much better compared to the initial version.
As a fun fact, the sentence &amp;ldquo;Árpád&amp;rsquo;s discovery involved a lot of playing with pen and paper, and he suspects you might need to do the same to understand it&amp;rdquo; was added after the revision, which was proven to be useful by one of IDN contestants.
I had one, extremely minor, objection after the revision.
Though there were still few inconsistencies after the revision, I decided to let them slide as it&amp;rsquo;s getting very late.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2023_arpad.jpg&#34; style=&#34;width: 350px&#34;/&gt;
&lt;em&gt;A very minor objection on beechtree.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Quite a number of people stopped by and had a chat on the IDN table, probably because Brian was also sitting there and helped with the translations.
The task statement was finalised at 1 am, and we were, again, be able to finish the translations pretty early at 2 am (spoiler alert: all our translations have a lot of typos, which I apologise).&lt;/p&gt;
&lt;h3 id=&#34;day-5&#34;&gt;Day 5&lt;/h3&gt;
&lt;p&gt;The day 2 contest started on time.
While the contestants were competing, the leaders went for the IOI group discussions.
There were a lot of topics that were discussed, and I joined the &amp;ldquo;IOI Alumni&amp;rdquo; and &amp;ldquo;Decreasing the Cost of Hosting an IOI&amp;rdquo; discussions.&lt;/p&gt;
&lt;p&gt;The IOI alumni topic mainly discussed establishing a platform for IOI alumni (both contestants and leaders).
This topic was led by Prof Sun Teck Tan.&lt;/p&gt;
&lt;p&gt;The second topic concerns lessening the burden for the host country to host an IOI.
It has become increasingly difficult to find new hosts for future IOIs, hence the discussion.
Some of the ideas include: raising the registration fees, reducing the number of IOI days, charging more other fees, removing the role of IOI deputy leaders, etc.&lt;/p&gt;
&lt;p&gt;Some other discussions were going on after that, but I did not join them.
Around the same time, Brian and I joined a TOKI Gathering (OSN was also held at that time) via Zoom and introduced ourselves to the future IDN IOI contestants.
I was just chilling out for the rest of the morning while watching the scoreboard.&lt;/p&gt;
&lt;p&gt;The scoreboard was quite the watch.
While three of the IDN contestants had safely secured 2S1B, one contestant was going back and forth between bronze and silver.
Thankfully, he was still trying to obtain subtask points during the last 10 minutes, which secured a silver medal for him.&lt;/p&gt;
&lt;p&gt;Everyone congratulated them, and they had their lunch.
After lunch, we headed back to the contestants&amp;rsquo; hotel and went to Aquanopolis, which is connected directly to the hotel.
Metal lent his swimming trunk to me as I did not prepare anything for the swimming trip.&lt;/p&gt;
&lt;p&gt;Contestants did not have to pay for the entry, but they had to be accompanied by an adult (i.e. their leaders, although I did not see any enforcement).
Apparently, their wristbands had NFCs that served as both hotel room keys and water park access keys.
I had to pay for the entry, though I was able to use the student&amp;rsquo;s pricing.
The water park was fine, and I mostly stayed idle thanks to my inability to swim.
The others mostly played with slides.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2023_aquapolis.jpg&#34; style=&#34;width: 600px&#34;/&gt;
&lt;em&gt;Szeged Aquapolis.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;After some long hours (teenagers do not easily get bored with this kind of activity yet), we cleaned ourselves, and I immediately headed back to my hotel for GA meeting 6.
Since I was already late, I joined the meeting via Teams while walking to the GA meeting room.
I arrived 15 minutes late.&lt;/p&gt;
&lt;p&gt;The GA meeting 6 started with the report for competition day 2.
There were no major issues, so the report quickly concluded.
Next, there was an announcement by the host that there was an ongoing fish festival on the bank of the River Tisza, and he warned us to ensure that contestants must not go out alone at night (I do not know why this sounded so serious).&lt;/p&gt;
&lt;p&gt;The next agenda is the presentation of IC, ISC, and ITC candidates.
There was only a single ITC candidate, and I already knew who to vote for IC members.&lt;/p&gt;
&lt;p&gt;The candidate presentations were over, and there were supposedly no more items on the agenda, so we could start to have our most needed rest.
Except that the president of IOI suddenly presented an agenda about the IC election reform.
The president presented a proposal to change the regulation of the IC election such that candidates from the minority gender are given a reserved slot (I do not remember the exact change, but it&amp;rsquo;s something to that effect).&lt;/p&gt;
&lt;p&gt;Brian, who had gone back earlier, immediately booked a taxi to join the discussion.
The debate went back and forth, and finally, a vote was made to determine whether the proposal should be formalised and discussed further at the next GA.&lt;/p&gt;
&lt;p&gt;As the majority voted yes (&amp;gt; 50%), the formal change would be presented at the next and final GA.
The GA was finally over.&lt;/p&gt;
&lt;h3 id=&#34;day-6&#34;&gt;Day 6&lt;/h3&gt;
&lt;p&gt;It&amp;rsquo;s the second excursion day.
We visited Mako and brought them to an open field with various activities (badminton, ping pong, real-life-size 4-connect, foosball, etc).
Nothing much to share here as I mostly watched others play.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2023_connect.jpg&#34; style=&#34;width: 600px&#34;/&gt;
&lt;em&gt;4-connect because why not.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;The next destination was a zoo near Szeged.
Halfway into the zoo, we decided to have some ice cream and talked about TLX development.
Since noone were interested in continuing the zoo tour, Irvin booked a cab, and we went back early.
The rest of the afternoon was just us sleeping in my room.&lt;/p&gt;
&lt;p&gt;After the dinner, we went to the Cultural Night.
There, I saw Metal and Vannes running around asking people to sign their shirts (I also signed one iirc).&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2023_signs.png&#34; style=&#34;width: 450px&#34;/&gt;
&lt;em&gt;T-shirt signing.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Most of the evening was just filled with music, dances, and performances.
The IDN contestants (together with the PHL team, I think) sang the IOI 2022 song for the Cultural Night.
The leaders, however, had another agenda, so they left earlier.
The agenda in question is the traditional &amp;ldquo;coffee break&amp;rdquo; where leaders brought their &amp;ldquo;national drinks&amp;rdquo; to be shared with the others.
Brian brought coffee liquor, and a pink alcoholic drink.
I went around, poured myself some drinks and had a chat with leaders from various countries.&lt;/p&gt;
&lt;h3 id=&#34;day-7&#34;&gt;Day 7&lt;/h3&gt;
&lt;p&gt;The closing ceremony day is here.
But before that, the leaders had to attend the final GA meeting.
The GA started a bit late, possibly due to the event from the preceding night.
There were a lot of things that were going on this GA, which I think is better for you to read directly from &lt;a href=&#34;https://ioinformatics.org/files/ioi2023minutes.pdf&#34;&gt;the minutes&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;During the whole course of GA, the IDN team who had access to the matrix mainly discussed everything in a private matrix room.
Most of us were simply commenting on the discussion that was taking place, and also discussed Indonesian&amp;rsquo;s stance on various decisions.
The duration of the final GA was stretched to 5.5 hours.&lt;/p&gt;
&lt;p&gt;After the GA, we prepared our Batik, then headed to Pick Arena for the closing ceremony.
The contestants were seated according to their ranking order, and the leaders were seated in a different section.
Overall, the closing was very smooth.&lt;/p&gt;
&lt;p&gt;We had a lot of photos afterwards.
The Indonesian team had a photo with a few other SEA teams, and the Japanese team too.
TOKI alumni, &lt;a href=&#34;https://osn.toki.id/statistik/peserta/1129&#34;&gt;Ilham Kurnia&lt;/a&gt; and &lt;a href=&#34;https://osn.toki.id/statistik/peserta/1708&#34;&gt;Roberto&lt;/a&gt;, also came from the neighbouring countries to greet the Indonesian team.
I asked a few questions about the TOKI history from them while having our dinner.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2023_japan.jpg&#34; style=&#34;width: 700px&#34;/&gt;
&lt;em&gt;Indonesia and Japanese teams.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;We headed to our respective hotels afterwards, and I started packing.
I did not expect I would have so many items with me that I needed an extra box which I requested from Dewi.&lt;/p&gt;
&lt;h3 id=&#34;day-8&#34;&gt;Day 8&lt;/h3&gt;
&lt;p&gt;The departure day. There were buses at 4 am and 6 am.
Our flight was 10.30 am but we decided to use the 4 am bus anyway.
All of us obviously did not get much sleep, but fortunately everyone could wake up and board the 4 am bus.&lt;/p&gt;
&lt;p&gt;We reached the airport around
There was nothing much to see in the airport, so we mainly waited in the waiting area.&lt;/p&gt;
&lt;p&gt;The transit in Doha was only for a short while, and Irvin went on his separate way here to Singapore, while the rest of the team was heading to Jakarta.&lt;/p&gt;
&lt;p&gt;Once back in Indonesia, Puspresnas welcomed us and did a little interview.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2023_arrival.png&#34; style=&#34;width: 700px&#34;/&gt;
&lt;em&gt;Photo with the acting head of Puspresnas.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Most of us went our separate ways after this.
Ariel, Metal (and his parents), and I had lunch together at Soto Betawi.
Metal&amp;rsquo;s parents also offered me a ride to my hotel.&lt;/p&gt;
&lt;p&gt;In the evening, I invited the training camp team and contestants (who were based in Jakarta) for dinner.
Zanite, Novaryo, Metal and his brother showed up at the Emporium mall.
I played one DDR game with Zanite, playing the Hungarian Dance track (because I just came back from Hungary, so why not).
We had Pizza Hut afterwards, and finally said goodbye to them before going back to my daily routine again in the following day.&lt;/p&gt;
&lt;h3 id=&#34;more-photos&#34;&gt;More Photos&lt;/h3&gt;
&lt;div style=&#34;display:flex; width: 120%; justify-content: space-around&#34;&gt;
  &lt;div&gt;
    &lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2023_itin.png&#34; style=&#34;width: 400px&#34;/&gt;
    &lt;em&gt;The itinerary from Jakarta to Budapest&lt;/em&gt;&lt;/p&gt;
  &lt;/div&gt;
  &lt;div&gt;
    &lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2023_itin2.png&#34; style=&#34;width: 400px&#34;/&gt;
    &lt;em&gt;The itinerary from Budapest to Jakarta&lt;/em&gt;&lt;/p&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;div style=&#34;display:flex; justify-content: space-around; align-items: center&#34;&gt;
  &lt;div&gt;
    &lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2023_testcase.jpg&#34; style=&#34;width: 400px&#34;/&gt;
    &lt;em&gt;Nitpicky objection that you&#39;d commonly see.&lt;/em&gt;&lt;/p&gt;
  &lt;/div&gt;
  &lt;div&gt;
    &lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2023_chat.jpg&#34; style=&#34;width: 300px&#34;/&gt;
    &lt;em&gt;IOI 2023 had its own chat app. It was barely used, and only contained this kind of chat.&lt;/em&gt;&lt;/p&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;div style=&#34;display:flex; justify-content: space-around; align-items: center&#34;&gt;
  &lt;div&gt;
    &lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2023_museum.jpg&#34; style=&#34;width: 400px&#34;/&gt;
    &lt;em&gt;A museum in Szeged.&lt;/em&gt;&lt;/p&gt;
  &lt;/div&gt;
  &lt;div&gt;
    &lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2023_architecture.jpg&#34; style=&#34;width: 400px&#34;/&gt;
    &lt;em&gt;A Szeged architecture.&lt;/em&gt;&lt;/p&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;div style=&#34;display:flex; justify-content: space-around; align-items: center&#34;&gt;
  &lt;div&gt;
    &lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2023_regis.png&#34; style=&#34;width: 500px&#34;/&gt;
    &lt;em&gt;A group photo right after registration with IDN guide.&lt;/em&gt;&lt;/p&gt;
  &lt;/div&gt;
  &lt;div&gt;
    &lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2023_awake.jpg&#34; style=&#34;width: 300px&#34;/&gt;
    &lt;em&gt;The IOI bot was not awake quite often, but it was resolved quickly.&lt;/em&gt;&lt;/p&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;div style=&#34;display:flex; justify-content: space-around; width: 120%; align-items: center&#34;&gt;
  &lt;div&gt;
    &lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2023_desk.jpg&#34; style=&#34;width: 400px&#34;/&gt;
    &lt;em&gt;The contestant desk.&lt;/em&gt;&lt;/p&gt;
  &lt;/div&gt;
  &lt;div&gt;
    &lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2023_opusztaszer.jpg&#34; style=&#34;width: 500px&#34;/&gt;
    &lt;em&gt;Somewhere in Ópusztaszer.&lt;/em&gt;&lt;/p&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;div style=&#34;display:flex; justify-content: space-around; width: 120%; align-items: center&#34;&gt;
  &lt;div&gt;
    &lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2023_closing.jpg&#34; style=&#34;width: 500px&#34;/&gt;
    &lt;em&gt;Group photo after closing.&lt;/em&gt;&lt;/p&gt;
  &lt;/div&gt;
  &lt;div&gt;
    &lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2023_medals.jpg&#34; style=&#34;width: 400px&#34;/&gt;
    &lt;em&gt;IDN medals.&lt;/em&gt;&lt;/p&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;div style=&#34;display:flex; justify-content: space-around; width: 120%; align-items: center&#34;&gt;
  &lt;div&gt;
    &lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2023_mall.jpg&#34; style=&#34;width: 500px&#34;/&gt;
    &lt;em&gt;The largest mall in Szeged.&lt;/em&gt;&lt;/p&gt;
  &lt;/div&gt;
  &lt;div&gt;
    &lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2023_cafe.jpg&#34; style=&#34;width: 400px&#34;/&gt;
    &lt;em&gt;A random cafe in Szeged.&lt;/em&gt;&lt;/p&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;div style=&#34;display:flex; justify-content: space-around; width: 120%; align-items: center&#34;&gt;
  &lt;div&gt;
    &lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2023_souvenirs.png&#34; style=&#34;width: 300px&#34;/&gt;
    &lt;em&gt;The IOI souvenirs that I brought.&lt;/em&gt;&lt;/p&gt;
  &lt;/div&gt;
  &lt;div&gt;
    &lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2023_farewell.jpg&#34; style=&#34;width: 400px&#34;/&gt;
    &lt;em&gt;Final hangout before I head back to normal life.&lt;/em&gt;&lt;/p&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;ioi-2024&#34;&gt;IOI 2024&lt;/h2&gt;
&lt;p&gt;The contestants for IOI 2024 are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Metal: Matthew Allan&lt;/li&gt;
&lt;li&gt;Kelven: Kelven Nathanael&lt;/li&gt;
&lt;li&gt;Aufan: Aufan Ahmad Mumtaza&lt;/li&gt;
&lt;li&gt;Gunadi: Gunadi Gani&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;And the rest of the delegation members who also flew to the IOI:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Vio: Vio Albert Ferdinand&lt;/li&gt;
&lt;li&gt;Ammar: Ammar Fathin Sabili&lt;/li&gt;
&lt;li&gt;Pikatan: Pikatan Arya Bramajati&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;day-0-1&#34;&gt;Day 0&lt;/h3&gt;
&lt;p&gt;This time, since I was not really part of the core delegation member, I had the liberty to depart from my city of residence, Singapore.&lt;/p&gt;
&lt;p&gt;My flight was scheduled at 2 am, and I arrived at the airport around 11 pm.
The check-in counter was not open yet, so I wandered around for a while.
By the time I was back, there was suddenly a huge line for the check-in, and so I joined the queue.
While queueing, I met Irvin, who coincidentally had the same flight as mine. He travelled alone, while the Singaporean team had departed first (can&amp;rsquo;t really recall the reason, but I think his travel to IOI was unplanned and only notified a few days before).&lt;/p&gt;
&lt;p&gt;After checking in, we both waited for the gate to open.
We did a little catch-up while waiting since we had not met for a while.&lt;/p&gt;
&lt;p&gt;The gate finally opened, and I boarded the flight for Qatar.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2024_itinerary.png&#34; style=&#34;width: 350px&#34;/&gt;
&lt;em&gt;My flight to Egypt.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;This was the second time I landed at the Hamad International Airport, Doha, so some of the places were already familiar.
This time, I had more free time, about 3 hours, so I decided to explore the airport more.
I explored alone since Irvin had other work to do.&lt;/p&gt;
&lt;p&gt;While walking around the airport garden, a Philippine contestant noticed my IOI 2022 polo T-shirt and called &amp;ldquo;IOI! IOI!&amp;rdquo;, and so I approached and greeted them.
I asked where their team leader was, and then found him sitting on the floor while preparing lecture material for his university.
I greeted him for a while and asked what he had been doing lately, then continued exploring the airport.&lt;/p&gt;
&lt;p&gt;I returned to the gate and waited for the boarding. There, I met the Malaysian team and I had a little chat with their team leader.
There were also the IOI president, the Brazilian team, the Japanese team, and many more.
I think half of the flight was IOI people.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2024_landing.png&#34; style=&#34;width: 500px&#34;/&gt;
&lt;em&gt;Landing in Egypt.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;I landed at the Borg El Arab International Airport, Alexandria, and immediately had the impression of how arid the place was.
After the immigration, contestants and leaders were immediately directed to their buses.
Guests were directed to a different bus as we stayed at a different hotel.
The venue, contestant hotel, and leaders hotel were located around the same area, but the guest hotel is quite out of the place.
There was also a little confusion on which bus I should board as they apparently do not know what &amp;ldquo;invited guest&amp;rdquo; role is, so they just boarded me on a random bus.
In the end, they figured out that invited guests were going to stay in the committee hotel, but the bus was going to stop at the contestant&amp;rsquo;s hotel anyway, so I did not really understand the confusion they had.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2024_bus.png&#34; style=&#34;width: 500px&#34;/&gt;
&lt;em&gt;The IOI bus.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;The guest bus was empty, and I think we had to wait for about 90 minutes before the bus started to move.
I killed my time by playing Persona 4 Golden on a PSP emulator at that time.
There was no information at all about when the bus would start moving, and I made a bet on whether we would have GTA 6 before it (unfortunately, the bus started moving first).&lt;/p&gt;
&lt;p&gt;I finally arrived at my hotel, Sheraton Montazah, in the afternoon.
After registration, I immediately went to my room and slept until the next day.
I was so tired that I skipped dinner (which was only served near the venue), even though I had barely eaten that day.&lt;/p&gt;
&lt;p&gt;I was supposed to share a room with Pikatan, another invited guest from Indonesia, but he (now she) was arriving at a later date, separate from the main Indonesian delegation team too.&lt;/p&gt;
&lt;h3 id=&#34;day-1-1&#34;&gt;Day 1&lt;/h3&gt;
&lt;p&gt;I had my breakfast and saw a few familiar faces.
The guests were supposed to have a tour in the Montazah area, which I was not interested in and preferred to observe the GA and practice session.
After breakfast, I went to the lobby and waited for the supposedly promised shuttle bus.
Since there was no information at all on when the shuttle for AAST (the main venue) would arrive, Irvin booked an Uber instead, and we departed for AAST.&lt;/p&gt;
&lt;p&gt;We alighted right before the main entrance of the AAST since the taxi was not allowed to enter.
It was just a short walk to the dining area.
In the dining area, Kelven saw me and waved, so I approached them.
There, I finally met the Indonesian team, who apparently just arrived the night before.&lt;/p&gt;
&lt;p&gt;I also attended the first GA.
The GA room had a very limited number of seats, and a delegation was assigned with only two chairs (with no tables), which clearly were not enough.
The GA room also had no pigeonholes.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2024_ga.jpg&#34; style=&#34;width: 600px&#34;/&gt;
&lt;em&gt;The GA room. Those without tables were where the leader&#39;s seats were assigned.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;There were two &lt;em&gt;circles&lt;/em&gt; of tables that were only partially filled by committee members, so I took one empty seat and sat there by myself.
All the remaining delegations were seated on the &amp;ldquo;outer&amp;rdquo; circle surrounding the perimeter of the room.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2024_seat.jpg&#34; style=&#34;width: 600px&#34;/&gt;
&lt;em&gt;The view from the empty seat I randomly took.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;After the first GA, it was then followed by the practice session.&lt;/p&gt;
&lt;p&gt;Nothing eventful happened during the practice, except that one IDN contestant&amp;rsquo;s workstation was given the wrong username.&lt;/p&gt;
&lt;p&gt;The second GA then followed to discuss issues that arose during the practice session.&lt;/p&gt;
&lt;p&gt;After the second GA, it was also announced that we could use those tables for the next meetings.
We then proceeded to the opening ceremony at Alexandria Bibliotheca.
Due to time constraints, the Bibliotheca exploration was canceled so we were only there for the opening ceremony.&lt;/p&gt;
&lt;p&gt;In the opening hall, a Nigerian team leader approached me to ask about their IOI 2022 certificates, for which I delegated the matter to Brian.
The opening ceremony started, and was followed by mentioning each team one by one, with the neighbouring Arabic countries receiving a more grand mention.&lt;/p&gt;
&lt;p&gt;After the opening ceremony, we were immediately led back to AAST.
Once arrived, everyone had their dinner. The leaders had a GA meeting afterwards.&lt;/p&gt;
&lt;p&gt;I arrived early and &lt;em&gt;booked&lt;/em&gt; the inner table in the GA room, since I knew we would really need the table, and I was going to help the team with translation anyway.&lt;/p&gt;
&lt;p&gt;The main focus of the GA was the task selection for the Day 1 contest.
I read the tasks, asked Ammar to raise a few minor objections (which were accepted), and then continued with the translation.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2024_objections.jpg&#34; style=&#34;width: 400px&#34;/&gt;
&lt;em&gt;The objection I asked Ammar to raise.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;There was a shuttle for me to head back, so I headed back once the team finished the translation (around 2 am).&lt;/p&gt;
&lt;h3 id=&#34;day-2-1&#34;&gt;Day 2&lt;/h3&gt;
&lt;p&gt;The guest had an itinerary for a &lt;a href=&#34;https://maps.app.goo.gl/MXCmiMMBJPnwiSgF7&#34;&gt;Qaitbay Citadel&lt;/a&gt; tour, but I was tired and not interested, so I slept longer. I departed for AAST at 12 pm and had lunch there.
I waited for the contest to finish with the Indonesian team, and we also coordinated with Pikatan on how to get to the venue.&lt;/p&gt;
&lt;p&gt;The contest ended, and so we visited the contest hall to find our contestants.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2024_hall.jpg&#34; style=&#34;width: 600px&#34;/&gt;
&lt;em&gt;The contest hall. You may notice that their desktop wallpaper was AI-generated.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;The contestants then had lunch. I wandered around in the afternoon, and also visited the Jane Street Hub for a while and attempted a few of their puzzles.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2024_puzzle.png&#34; style=&#34;width: 500px&#34;/&gt;
&lt;em&gt;A puzzle from the hub.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;The next GA happened after dinner, and they mainly discussed the Gaza, which you can read from &lt;a href=&#34;https://ioinformatics.org/files/ioi2024minutes.pdf&#34;&gt;the minutes&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;day-3-1&#34;&gt;Day 3&lt;/h3&gt;
&lt;p&gt;It&amp;rsquo;s the excursion day, and the itinerary for the day was to visit the &lt;a href=&#34;https://maps.app.goo.gl/kUEr8BdqFuyXh6hJ6&#34;&gt;Montazah Beach&lt;/a&gt;. This time, we had a shuttle bus waiting for us to visit the beach.&lt;/p&gt;
&lt;p&gt;After arriving, I tried to find the Indonesian team and found them just chilling under the beach umbrella while blasting some music from a speaker brought by Metal.
A lot of people were playing in the sea too, and I think Gunadi also joined for a little while.
We were then slowly realising that we were simply being dumped on the beach under the glaring sun until who-knows-when.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2024_beach.jpg&#34; style=&#34;width: 600px&#34;/&gt;
&lt;em&gt;Montazah beach.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;We decided to explore the Montazah area by ourselves, so we had a stroll and ended up at a cafe.
We ordered some food, and it took forever for them to serve the food.
I read online, and apparently it is common for cafes in Egypt to take their time to serve the food.
The cafe was apparently already booked for the IOI guests, and the waiters thought we were there as IOI guests, so we did not have to pay for the food (but I think Ammar paid for it anyway using the government pocket money).&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2024_cafe.jpg&#34; style=&#34;width: 600px&#34;/&gt;
&lt;em&gt;Escaping the beach trip.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;We headed for the bus that was going back to AAST.
I think Aufan was a little sic,k and Vio took care of it.
I was then chilling in Ammar and Vio&amp;rsquo;s room, with Irvin also came along.
In that very room, I conceived a problem idea which later became &lt;a href=&#34;https://tlx.toki.id/problems/icpc-jakarta-2024/J&#34;&gt;an ICPC problem&lt;/a&gt;.
We waited until dinner time and proceeded to the next GA.&lt;/p&gt;
&lt;p&gt;The GA was going to select the task for day 2 contest.
The tasks were revealed, and I saw my problem being part of the set. The team congratulated me, and Irvin also immediately realised which one is mine since he already understood my problem taste very well.
Not long after, there was a major objection for Hiereoglaph which was quickly dismissed.
Another major objection then came, saying that the task was similar to an AtCoder problem.
A long discussion was then held to determine whether the task should be kept or to see the backup task. A vote was held, and the decision was to keep the task.&lt;/p&gt;
&lt;p&gt;The Malaysian team leader approached me and asked whether my task appeared in the problemset, to which I said &amp;ldquo;Yes&amp;rdquo;. He then asked whether I was happy, to which I laughingly replied &amp;ldquo;not sure&amp;rdquo;, and he immediately understood which task was mine.&lt;/p&gt;
&lt;p&gt;To be honest, I really was neither happy nor sad with the state of the task, but I do realise there have been a lot of polarising discussions about it. I initially came up with the problem when brainstorming an idea for the Indonesian National Olympiad, which was not accepted, so I just submitted it to IOI with no expectation.&lt;/p&gt;
&lt;p&gt;We proceeded with the translation, which lasted until 1 am and headed back to my hotel using a shuttle bus.&lt;/p&gt;
&lt;h3 id=&#34;day-4-1&#34;&gt;Day 4&lt;/h3&gt;
&lt;p&gt;It&amp;rsquo;s the day 2 contest. As usual, there&amp;rsquo;s an itinerary for the guest which I did not follow, and I headed for AAST. I think I headed alone, since Pikatan was still resting and we agreed to go for AAST at our own timing.&lt;/p&gt;
&lt;p&gt;An Indonesian ambassador in Egypt, along with a few Indonesian high-school students studying in Egypt, visited the Indonesian team to observe the competition. Ammar had a little chat with them, and also introduced the contestants to them after the contest had ended.&lt;/p&gt;
&lt;p&gt;I had lunch with the contestants.
One of them was a little disappointed with his result, so I tried to calm him down a bit.&lt;/p&gt;
&lt;p&gt;There&amp;rsquo;s also an informal APIO discussion with the APIO members in the meeting room.
Steven Halim headed the meeting, and I recall not much was decided then. We had a photo session afterward,s and the meeting was concluded.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2024_apio.jpg&#34; style=&#34;width: 600px&#34;/&gt;
&lt;em&gt;APIO meeting.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;We had a rest in Ammar and Vio&amp;rsquo;s room while waiting for the next GA meeting.
The GA meeting mainly reported on the day 2 competitions. There&amp;rsquo;s also a discussion about contestants who had their mobile phones with them during the competition and what decision was reached.
Candidates for the committee also made their presentation during this GA.
Finally, the final result was confirmed by the GA.&lt;/p&gt;
&lt;h3 id=&#34;day-5-1&#34;&gt;Day 5&lt;/h3&gt;
&lt;p&gt;The agenda of the day was entirely in Cairo.
We boarded the bus from our hotel, and our first destination was the &lt;a href=&#34;https://maps.app.goo.gl/FJY9VdhcxmvPETkZ9&#34;&gt;The Grand Egyptian Museum&lt;/a&gt;, which took 3 hours to reach.
Apparently, at the time of this writing, the museum wasn&amp;rsquo;t open to the public yet and seemed to be only available to certain guests, so I guess we were lucky to become the first few to see the museum.&lt;/p&gt;
&lt;p&gt;The museum was actually grand as the name suggested.
It was really spacious with a lot of large pillars and statues.
At the top of the museum, we could see the Giza pyramid.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2024_museum.jpg&#34; style=&#34;width: 600px&#34;/&gt;
&lt;em&gt;The entrance of the museum.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;After the museum tour, there was a mall just beside it (I&amp;rsquo;m actually not sure whether it was part of the museum).
There was not much else to do until lunch, so I just browsed the mall and then went to Starbucks with Vio.&lt;/p&gt;
&lt;p&gt;The lunch was also held in the same area.
The Indonesian team sat at a round table with the New Zealand team, and they talked about how long the trip was to get to Egypt.
After lunch, there really was nothing else to do, and we were simply stuck in the lunch hall.
People then started to build towers of cans to kill the time.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2024_can.jpg&#34; style=&#34;width: 350px&#34;/&gt;
&lt;em&gt;A lot of tables started to build soda can towers out of boredom.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;One of the IDN contestants also started to lie down on the floor.
A few organisers came and asked whether he was okay, and I told them we were totally fine.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2024_floor.png&#34; style=&#34;width: 400px&#34;/&gt;
&lt;em&gt;IDN contestant watching TikTok videos while lying down.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;They finally started to call us to board the bus, onto the next destination, the Grand Pyramid of Giza.
My bus was one of the first to arrive, so I got to see the view before it was crowded.
The surroundings of the pyramid was quite smelly, and it was quite hard to walk around it.&lt;/p&gt;
&lt;p&gt;When all the buses arrived, all the IOI people had a group photo.
It took like 20 minutes to get everyone on their position before the first photo was taken.
We were then ushered to the bus again for the closing ceremony.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2024_pyramid.jpg&#34; style=&#34;width: 600px&#34;/&gt;
&lt;em&gt;The Indonesian team in front of a pyramid.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;I also heard that some buses did not manage to get to the pyramid, so those teams obviously were not very happy.
They asked to visit the pyramid again, but the organiser said it was not possible, as during nighttime, the pyramid is actually guarded by armed soldiers.
They provided an alternative, which was to visit the next day, but I think the teams did not take the offer.&lt;/p&gt;
&lt;p&gt;The closing ceremony was held in an open-air, and we could see the pyramids clearly.
The dinner served was pretty fancy as well.
The closing ceremony generally consisted of performances and speeches, and finally the awarding.
The awarding was quite slow (imo), because there were performances after every few medalists called.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2024_closing.jpg&#34; style=&#34;width: 600px&#34;/&gt;
&lt;em&gt;The closing ceremony venue before it was dark.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;After the ceremony, we had to go back to the bus for a 3h trip back to our respective hotels.
There were not many places to take a photo with the medalists, because it was an open area and was quite dark.&lt;/p&gt;
&lt;h3 id=&#34;day-6-1&#34;&gt;Day 6&lt;/h3&gt;
&lt;p&gt;This is my last day in IOI 2024.
There&amp;rsquo;s a tour for the guests to a museum, which I did not join as usual.
I headed for the final GA in AAST.
I think while in the taxi, they announced who the problem setters were and gave an applause, but I wasn&amp;rsquo;t there ye,t unfortunately.&lt;/p&gt;
&lt;p&gt;When I arrived there, Ben was giving a speech concerning the LGBT.
There were some discussions about it, which you can read from &lt;a href=&#34;https://ioinformatics.org/files/ioi2024minutes.pdf&#34;&gt;the minutes&lt;/a&gt;.
Next, the treasurer presented some financial matters, and the GA voted for approval.&lt;/p&gt;
&lt;p&gt;After that, it was just a bunch of voting: committee election and regulation changes.
Finally, they announced the host for IOI 2027, which is Postdam, Germany.&lt;/p&gt;
&lt;p&gt;After the final GA, I chilled around the contestant&amp;rsquo;s room and had a photo with them before heading back to my hotel.
I think they head for Bibliotheca again in their free time to actually explore it, but I did not join since I had a flight at night.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2024_team.jpg&#34; style=&#34;width: 600px&#34;/&gt;
&lt;em&gt;Final photo with the team before parting.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;I waited for the 7 pm bus.
Since there&amp;rsquo;s no information at all from the organisers, the leaders and guests coordinated themselves by informing each other where the buses were.
I waited there with Ben, J.P., and Eduard.
My 7 pm bus arrived at 8.30 pm, and I said farewell to them.&lt;/p&gt;
&lt;p&gt;The bus was actually quite full, and it was still going to pick up more people from different hotels.
Somehow, the bus managed to board everyone and headed to the airport.
I was all by myself at this point, and said farewell to Egypt.&lt;/p&gt;
&lt;h3 id=&#34;more-photos-1&#34;&gt;More Photos&lt;/h3&gt;
&lt;div style=&#34;display:flex; justify-content: space-around; width: 100%; align-items: center&#34;&gt;
  &lt;div&gt;
    &lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2024_room.jpg&#34; style=&#34;width: 400px&#34;/&gt;
    &lt;em&gt;The view from my room in Egypt.&lt;/em&gt;&lt;/p&gt;
  &lt;/div&gt;
  &lt;div&gt;
    &lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2024_elevator.jpg&#34; style=&#34;width: 300px&#34;/&gt;
    &lt;em&gt;The elevator buttons in Egypt.&lt;/em&gt;&lt;/p&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;div style=&#34;display:flex; justify-content: space-around; width: 100%; align-items: center&#34;&gt;
  &lt;div&gt;
    &lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2024_desk.png&#34; style=&#34;width: 400px&#34;/&gt;
    &lt;em&gt;The contestant desk.&lt;/em&gt;&lt;/p&gt;
  &lt;/div&gt;
  &lt;div&gt;
    &lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2024_hostel.jpg&#34; style=&#34;width: 400px&#34;/&gt;
    &lt;em&gt;The hostel where the contestants stayed.&lt;/em&gt;&lt;/p&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;div style=&#34;display:flex; justify-content: space-around; width: 100%; align-items: center&#34;&gt;
  &lt;div&gt;
    &lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2024_bibliotheca.jpg&#34; style=&#34;width: 400px&#34;/&gt;
    &lt;em&gt;Bibliotheca entrance.&lt;/em&gt;&lt;/p&gt;
  &lt;/div&gt;
  &lt;div&gt;
    &lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2024_opening.jpg&#34; style=&#34;width: 400px&#34;/&gt;
    &lt;em&gt;The opening ceremony.&lt;/em&gt;&lt;/p&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;div style=&#34;display:flex; justify-content: space-around; width: 100%; align-items: center&#34;&gt;
  &lt;div&gt;
    &lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2024_huawei.jpg&#34; style=&#34;width: 400px&#34;/&gt;
    &lt;em&gt;The Huawei arena.&lt;/em&gt;&lt;/p&gt;
  &lt;/div&gt;
  &lt;div&gt;
    &lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2024_promenade.jpg&#34; style=&#34;width: 400px&#34;/&gt;
    &lt;em&gt;The promenade around the Montazah area.&lt;/em&gt;&lt;/p&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;div style=&#34;display:flex; justify-content: space-around; width: 100%; align-items: center&#34;&gt;
  &lt;div&gt;
    &lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2024_exterior.jpg&#34; style=&#34;width: 400px&#34;/&gt;
    &lt;em&gt;The exterior or the Grand Museum.&lt;/em&gt;&lt;/p&gt;
  &lt;/div&gt;
  &lt;div&gt;
    &lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2024_window.jpg&#34; style=&#34;width: 400px&#34;/&gt;
    &lt;em&gt;The view of Giza from the museum.&lt;/em&gt;&lt;/p&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;div style=&#34;display:flex; justify-content: space-around; width: 100%; align-items: center&#34;&gt;
  &lt;div&gt;
    &lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2024_excursion.png&#34; style=&#34;width: 300px&#34;/&gt;
    &lt;em&gt;Vio escorting the contestants.&lt;/em&gt;&lt;/p&gt;
  &lt;/div&gt;
  &lt;div&gt;
    &lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2024_selfie.jpg&#34; style=&#34;width: 400px&#34;/&gt;
    &lt;em&gt;Hanging out at Giza.&lt;/em&gt;&lt;/p&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;div style=&#34;display:flex; justify-content: space-around; width: 100%; align-items: center&#34;&gt;
  &lt;div&gt;
    &lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2024_giza.jpg&#34; style=&#34;width: 400px&#34;/&gt;
    &lt;em&gt;The pyramid with all the IOI people.&lt;/em&gt;&lt;/p&gt;
  &lt;/div&gt;
  &lt;div&gt;
    &lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2024_dining.jpg&#34; style=&#34;width: 400px&#34;/&gt;
    &lt;em&gt;The IDN dining table during the closing.&lt;/em&gt;&lt;/p&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;div style=&#34;display:flex; justify-content: space-around; width: 100%; align-items: center&#34;&gt;
  &lt;div&gt;
    &lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2024_food.jpg&#34; style=&#34;width: 400px&#34;/&gt;
    &lt;em&gt;The food served during the closing.&lt;/em&gt;&lt;/p&gt;
  &lt;/div&gt;
  &lt;div&gt;
    &lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/ioi2024_night.jpg&#34; style=&#34;width: 400px&#34;/&gt;
    &lt;em&gt;The pyramid and Sphinx at night.&lt;/em&gt;&lt;/p&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
		</item>
		<item>
			<title>History of Indonesia Informatics Olympiad</title>
			<link>https://prabowo02.github.io/posts/history-toki/</link>
			<pubDate>Sat, 17 Jan 2026 00:43:09 +0800</pubDate>
			<guid isPermaLink="true">https://prabowo02.github.io/posts/history-toki/</guid>
			<description>&lt;p&gt;Can&amp;rsquo;t find any written archive on how the whole Indonesian IOI teams originated. I will try to write a brief timeline about it, based on my experience and from what I have heard before.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;1997: &lt;a href=&#34;https://stats.ioinformatics.org/people/3171&#34;&gt;Suryana Setiawan&lt;/a&gt; selected students from a few local schools in Jakarta to form the first IOI team.&lt;/li&gt;
&lt;li&gt;2002: The first OSN (National Olympiad) was hosted. The IOI team was now selected from the students who won the OSN. I think this is also the time when TOKI first formed. Not sure who the first members are, but they were lecturers from universities in Indonesia, who were also the judges for OSN. I am not sure what kind of entity TOKI is until now, but it serves as a bridge between the government and any event related to the IOI selection. I am not even sure whether TOKI is an actual legal entity or just a collective term for people involved in the events.&lt;/li&gt;
&lt;li&gt;2002-2010: During this time, a lot of the selections used problems from USACO. The trainers communicated about these with whoever was responsible with USACO during that time. Suryana Setiawan also developed Ranau, basically the ancestor of the current &lt;a href=&#34;https://tlx.toki.id/&#34;&gt;TLX&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;2010-2013: I think &lt;a href=&#34;https://web.archive.org/web/20141231041451/http://tokilearning.org/guest&#34;&gt;TOKI Learning Center (TLC)&lt;/a&gt; was developed around this time (?) and replaced Ranau. TLC was developed as a final year project by a student who participated in the training camp before.&lt;/li&gt;
&lt;li&gt;2013: IA-TOKI was founded by &lt;a href=&#34;https://stats.ioinformatics.org/people/377&#34;&gt;Brian Marshal&lt;/a&gt; (?) under the approval of &lt;a href=&#34;https://stats.ioinformatics.org/people/3391&#34;&gt;Adi Mulyanto&lt;/a&gt;, so now there is a clear (actually still kinda blurry for me lol) distinction between the alumni (those who participated in IOI training camps before), and TOKI (the facilitator of OSN and training camps).&lt;/li&gt;
&lt;li&gt;2015: The early version of &lt;a href=&#34;https://web.archive.org/web/20180411210629/https://training.ia-toki.org/&#34;&gt;TLX Training Gate&lt;/a&gt; was developed and was slowly replacing TLC. The name TLX comes from TLC, with the X replacing C, simply because X is next to C on the Qwerty keyboard. Indonesia also hosted &lt;a href=&#34;https://web.archive.org/web/20160311070457/http://apio2015.org/&#34;&gt;APIO&lt;/a&gt; for the first time this year.&lt;/li&gt;
&lt;li&gt;2017: The first ISC member representing &lt;a href=&#34;https://stats.ioinformatics.org/people/2724&#34;&gt;Indonesia&lt;/a&gt; was elected.&lt;/li&gt;
&lt;li&gt;2018: TLX was revamped and TLX Training Gate was deprecated. The first time an IOI problem was authored by &lt;a href=&#34;https://stats.ioinformatics.org/people/3054&#34;&gt;Indonesian&lt;/a&gt;. Indonesia also won the bid to host &lt;a href=&#34;https://ioi2022.id/&#34;&gt;IOI 2022&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;2020: The first online OSN due to COVID. Also for some silly reasons, OSN was renamed to KSN only for the years 2020 and 2021. This is also the first time the grading for the olympiads were done in the cloud, marking the end of bringing a physical grader as luggage to the onsite OSN. Due to restructure of the ministry, OSN was also now hosted by Puspresnas (previously by PSMA); training camps also hosted by Puspresnas (previously directly under the ministry (?)).&lt;/li&gt;
&lt;li&gt;2020-2021: Indonesia hosted two APIOs &lt;a href=&#34;https://apio2020.toki.id/&#34;&gt;back&lt;/a&gt;-to-&lt;a href=&#34;https://apio2021.toki.id/&#34;&gt;back&lt;/a&gt;. The motivation was to use APIO as a &lt;em&gt;practice&lt;/em&gt; for IOI. Indonesia also planned to have the first APIO onsite ever, but was cancelled due to the COVID-19 pandemic.&lt;/li&gt;
&lt;li&gt;2022: Indonesia hosted IOI. OSN was now under BPTI, with Puspresnas still hosting the training camps.&lt;/li&gt;
&lt;li&gt;2023: The first time the IOI delegation team is composed entirely of alumni (usually there&amp;rsquo;s a government representative).&lt;/li&gt;
&lt;li&gt;2025: They started to do AI, and sent the first IOAI team. An experimental &lt;em&gt;exhibition&lt;/em&gt; for AI OSN was also done that year.&lt;/li&gt;
&lt;/ul&gt;
</description>
		</item>
		<item>
			<title>Blog Collection</title>
			<link>https://prabowo02.github.io/posts/blogs/</link>
			<pubDate>Thu, 15 Jan 2026 15:43:19 +0800</pubDate>
			<guid isPermaLink="true">https://prabowo02.github.io/posts/blogs/</guid>
			<description>&lt;p&gt;Do people nowadays still write personal blogs? Or more importantly, do people still &lt;em&gt;read&lt;/em&gt; personal blogs?
Apparently my blog does have visitors? Thank you my loyal readers, since I rarely write, I have collected here a few other blogs from people with similar interests for you to enjoy.&lt;/p&gt;
&lt;h2 id=&#34;blogs-from-toki-fellows&#34;&gt;Blogs From TOKI Fellows&lt;/h2&gt;
&lt;p&gt;This is a list of personal blogs of people from the Indonesian Informatics Olympiad Team (TOKI).
They are people who participated in the Indonesian National Olympiads and the Indonesian IOI Training Camp.
I myself am from TOKI 2015 (the year 2015 is the year I graduated from high school, and the batch is usually called by &amp;ldquo;TOKI [year]&amp;rdquo;).&lt;/p&gt;
&lt;p&gt;Only the first &lt;strong&gt;three&lt;/strong&gt; blogs listed here have recent articles, while the rest are mostly dead. Those three happen to be some of my closest friends as well; I guess &amp;ldquo;&lt;em&gt;similar&lt;/em&gt;&amp;rdquo; people do come across naturally.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Name/alias&lt;/th&gt;
&lt;th&gt;Blogs&lt;/th&gt;
&lt;th&gt;Notes&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Hocky Yudhiono&lt;/td&gt;
&lt;td&gt;&lt;a href=&#34;https://blog.hocky.id/&#34;&gt;https://blog.hocky.id/&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;TOKI 2019. Wrote a lot about self-reflection, and occasionally Competitive Programming stuff.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Zanite&lt;/td&gt;
&lt;td&gt;&lt;a href=&#34;https://blog.zanite.dev/&#34;&gt;https://blog.zanite.dev/&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;TOKI 2022. Wrote mostly about Competitive Programming.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ayaz&lt;/td&gt;
&lt;td&gt;&lt;a href=&#34;https://ayazdz.me/&#34;&gt;https://ayazdz.me/&lt;/a&gt; &lt;br/&gt; &lt;a href=&#34;https://ayazdzulfikar.blogspot.com/&#34;&gt;https://ayazdzulfikar.blogspot.com/&lt;/a&gt; (older)&lt;/td&gt;
&lt;td&gt;TOKI 2015 (same batch as me). Wrote about his life journey and Competitive Programming stuff. The older blog talks a lot about his Competitive Programming journey, mostly written in Indonesian.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;William Gozali&lt;/td&gt;
&lt;td&gt;&lt;a href=&#34;https://kupaskode.blogspot.com/&#34;&gt;https://kupaskode.blogspot.com/&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;TOKI 2011. He shares the same name as an internet personality, but they are not the same person. Wrote about Competitive Programming in Indonesian. Also the main trainer during my training camp year.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;fushar&lt;/td&gt;
&lt;td&gt;&lt;a href=&#34;https://fushar.wordpress.com/&#34;&gt;https://fushar.wordpress.com/&lt;/a&gt; &lt;br /&gt; &lt;a href=&#34;https://web.archive.org/web/20191120003101/http://fusharblog.com/&#34;&gt;http://fusharblog.com&lt;/a&gt; (older, internet archive)&lt;/td&gt;
&lt;td&gt;TOKI 2010. His newer blog only has one article about his life written in Indonesian in 2016. The older blog talked a lot about his Competitive Programming journey in English.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Suhendry&lt;/td&gt;
&lt;td&gt;&lt;a href=&#34;https://web.archive.org/web/20180409115955/http://www.suhendry.net/blog/&#34;&gt;http://www.suhendry.net&lt;/a&gt; (internet archive)&lt;/td&gt;
&lt;td&gt;Not exactly a TOKI member, but was actively involved with them. Blog contains mostly news about ICPC Regional Jakarta, and sometimes written in Indonesian language.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;faishol&lt;/td&gt;
&lt;td&gt;&lt;a href=&#34;https://web.archive.org/web/20191019034041/http://faishol.net/&#34;&gt;http://faishol.net&lt;/a&gt; (internet archive)&lt;/td&gt;
&lt;td&gt;TOKI 2018. Wrote about CP journey in Indonesian.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RWHendry&lt;/td&gt;
&lt;td&gt;&lt;a href=&#34;https://web.archive.org/web/20220319180411/https://rwhendry.com/&#34;&gt;https://rwhendry.com/&lt;/a&gt; (internet archive) &lt;br /&gt; &lt;a href=&#34;https://rwhendry.blogspot.com/&#34;&gt;https://rwhendry.blogspot.com/&lt;/a&gt; (older)&lt;/td&gt;
&lt;td&gt;TOKI 2017. Wrote about CP journey in Indonesian.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Windi Chandra&lt;/td&gt;
&lt;td&gt;&lt;a href=&#34;https://codebie.blogspot.com/&#34;&gt;https://codebie.blogspot.com/&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;TOKI 2016. Wrote about CP journey in Indonesian.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;KnightSaber77&lt;/td&gt;
&lt;td&gt;&lt;a href=&#34;https://knightsaber77.wordpress.com/&#34;&gt;https://knightsaber77.wordpress.com/&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;TOKI 2015. Wrote about CP journey in Indonesian.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Stacia Edina Johanna&lt;/td&gt;
&lt;td&gt;&lt;a href=&#34;https://staciaedina.wordpress.com/&#34;&gt;https://staciaedina.wordpress.com/&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;TOKI 2015. The first post talked about her IOI journey in Indonesian.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Felik Junvianto&lt;/td&gt;
&lt;td&gt;&lt;a href=&#34;https://felikjunvianto.wordpress.com/&#34;&gt;https://felikjunvianto.wordpress.com/&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;TOKI 2011. Mostly news about Indonesian CP competitions written in Indonesian.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Jessica Handojo&lt;/td&gt;
&lt;td&gt;&lt;a href=&#34;https://there10han.wordpress.com/&#34;&gt;https://there10han.wordpress.com/&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;TOKI 2011. The older posts talked about her CP journey in Indonesian.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Risan Petrus&lt;/td&gt;
&lt;td&gt;&lt;a href=&#34;https://www.risanp.com/notes/&#34;&gt;https://www.risanp.com/notes/&lt;/a&gt; &lt;br/&gt; &lt;a href=&#34;https://risan.wordpress.com/&#34;&gt;https://risan.wordpress.com/&lt;/a&gt; (older)&lt;/td&gt;
&lt;td&gt;TOKI 2009. Talked about CP and also his journey in Indonesian.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id=&#34;more-blogs&#34;&gt;More Blogs&lt;/h2&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Name/alias&lt;/th&gt;
&lt;th&gt;Blogs&lt;/th&gt;
&lt;th&gt;Notes&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;errorgorn&lt;/td&gt;
&lt;td&gt;&lt;a href=&#34;https://errorgorn.github.io/&#34;&gt;https://errorgorn.github.io/&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Talked a lot about CP.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;min25&lt;/td&gt;
&lt;td&gt;&lt;a href=&#34;https://web.archive.org/web/20211104125457/https://min-25.hatenablog.com&#34;&gt;https://min-25.hatenablog.com&lt;/a&gt; (internet archive)&lt;/td&gt;
&lt;td&gt;A lot of novel mathematical stuff here. They are also referenced a lot in advanced CP discussions. Everything is in Japanese.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;griff&lt;/td&gt;
&lt;td&gt;&lt;a href=&#34;https://gbroxey.github.io/blog/&#34;&gt;https://gbroxey.github.io/blog/&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Advanced mathematical stuff.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ethan Tan&lt;/td&gt;
&lt;td&gt;&lt;a href=&#34;https://web.archive.org/web/20220102030231/https://how-did-i-get-here.com/&#34;&gt;https://how-did-i-get-here.com/&lt;/a&gt; (internet archive)&lt;/td&gt;
&lt;td&gt;14 y/o IMO gold medalist. Talked about various topics (not necessarily mathematical) that I found very interesting.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
</description>
		</item>
		<item>
			<title>Improving Competitive Skills</title>
			<link>https://prabowo02.github.io/posts/skills/</link>
			<pubDate>Tue, 30 Dec 2025 23:22:50 +0800</pubDate>
			<guid isPermaLink="true">https://prabowo02.github.io/posts/skills/</guid>
			<description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;Back in 2014, I started Competitive Programming, and I reached &lt;a href=&#34;https://codeforces.com/profile/prabowo&#34;&gt;Codeforces&lt;/a&gt; &lt;span style=&#34;color: red; font-weight: 600;&#34;&gt;Grandmaster&lt;/span&gt; after about 6 years.
In 2022, I started &lt;a href=&#34;https://en.wikipedia.org/wiki/Chunithm&#34;&gt;Chunithm&lt;/a&gt; and reached &lt;span style=&#34;background: linear-gradient(
#ff0000 0%,
#ff7f00 25%,
#ffff00 50%,
#00ff00 100%
);background-clip: text;-webkit-text-fill-color: transparent;font-weight:600; font-size: 18px; -webkit-text-stroke:0.7px #000&#34;&gt;16.00&lt;/span&gt; after ~3 years (1300-ish play counts).
I never had a target for these two &lt;em&gt;games&lt;/em&gt; (well, I did, but only when I was already near the milestones), and only competing/playing as my hobbies.
Those ranks are admittedly still very far from the pinnacle of each field, but I do take pride on achieving them.
Contrary to what people may think about me, I am not really a competitive person, nor am I an achiever.&lt;/p&gt;
&lt;p&gt;The time I took to achieve those was definitely not the quickest one, and I was never under the &lt;em&gt;improvement&lt;/em&gt; mindset while engaging in those activities.
However, I do notice some common patterns/frameworks that can probably be applied to other competitive fields if you really aim for improvement.&lt;/p&gt;
&lt;p&gt;The general advice to improve is always this one word: &amp;ldquo;&lt;strong&gt;practice&lt;/strong&gt;&amp;rdquo;.
No matter what kind of guidance, coaching, or tips you receive, you will never improve if you do not have the patience to practice.
But here, I will try to point out a few things that might help with improvement from the point of view of a Competitive Programmer and Chunithm Player (both can be coincidentally abbreviated as CP-er).&lt;/p&gt;
&lt;p&gt;Since I am explaining things for both fields as once, I may use these two words interchangeably:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;solving and playing;&lt;/li&gt;
&lt;li&gt;problem and chart;&lt;/li&gt;
&lt;li&gt;rating and level.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Note that the source of everything laid down here is &amp;ldquo;trust me bro&amp;rdquo;.&lt;/p&gt;
&lt;h2 id=&#34;skill-floor-vs-ceiling&#34;&gt;Skill Floor vs Ceiling&lt;/h2&gt;
&lt;p&gt;Some of the knowledge from this section is actually borrowed from this document: &lt;a href=&#34;https://docs.google.com/document/d/1gwuauPmfOTm99oOQlbZLBDRdIHUHi0Mnz3UW3hImmNc/edit?tab=t.0&#34;&gt;Mentality for Improvement in Rhythm Games&lt;/a&gt;.
I do believe some of them can be applied to other competitive fields as well.&lt;/p&gt;
&lt;p&gt;First is to define:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Skill floor: the (maximum) level at which you are able to perform consistently.&lt;/li&gt;
&lt;li&gt;Skill ceiling: the level at which you can &lt;em&gt;sometimes&lt;/em&gt; perform beyond your current ability.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To illustrate:&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/skill_range.png&#34; style=&#34;width: 700px&#34;/&gt;&lt;/p&gt;
&lt;p&gt;With that said, I do believe your current skill level can&amp;rsquo;t actually be defined as a single number, but more accurately with a range. Your current rating must be somewhere in that range.&lt;/p&gt;
&lt;p&gt;I believe it can be further generalised as the sigmoid function:&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/rating_sigmoid.png&#34; style=&#34;width: 500px&#34;/&gt;&lt;/p&gt;
&lt;p&gt;But you can just stick to the single line thing for simplicity.&lt;/p&gt;
&lt;p&gt;Pushing your floor and ceiling may require a different kind of practice.&lt;/p&gt;
&lt;h3 id=&#34;skill-floor&#34;&gt;Skill Floor&lt;/h3&gt;
&lt;p&gt;What you need to improve your skill floor in terms of:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Chunithm&lt;/strong&gt;: you need to be exposed to a lot of charts (and hence patterns) and be able to consistently perform at SS+ or SSS performance (or whatever standard that is high enough for you).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Competitive Programming&lt;/strong&gt;: you need to be exposed to a lot of problems (and hence topics) and be able to consistently solve them within a certain time range.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So to push your skill floor, it naturally follows that for:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Chunithm&lt;/strong&gt;: play charts at a level lower than your rating (e.g. your rating - 3) and try to achieve a high performance across different charts consistently.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Competitive programming&lt;/strong&gt;: solve problems below your current rating (e.g. your rating - 200) and try to solve them within, say, 20 minutes. Do this routinely, possibly as a warm-up.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;skill-ceiling&#34;&gt;Skill Ceiling&lt;/h3&gt;
&lt;p&gt;You only need to be able to perform beyond your skill level for specific problems or charts.&lt;/p&gt;
&lt;p&gt;To push your skill ceiling on:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Chunithm&lt;/strong&gt;: pick a chart, aim to SSS (or whatever performance that is atypical for you at that moment) it by playing repeatedly (possibly across sessions). You may also want to study the chart offline.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Competitive Programming&lt;/strong&gt;: pick a problem of your choice, may be from your favourite topic or a topic you want to master, solve it at your leisure (e.g. during commute, inside a plane). The aim is to rewire your brain so that it can solve problems of a higher rating (or problems you were unfamiliar with); hence, you will require less effort to solve problems of the same rating in the future.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;which-skill-to-push&#34;&gt;Which skill to push?&lt;/h3&gt;
&lt;p&gt;Both skill floor and ceiling are not independent. Pushing one may affect the other, but I do believe pushing skill ceiling is more effective for overall improvement.&lt;/p&gt;
&lt;p&gt;To illustrate:&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/push_skill.png&#34; style=&#34;width: 600px&#34;/&gt;&lt;/p&gt;
&lt;p&gt;Depending on your goals, the skill you should focus on may differ.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Goal&lt;/th&gt;
&lt;th&gt;Focus&lt;/th&gt;
&lt;th&gt;Rationale&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Chunithm rating&lt;/td&gt;
&lt;td&gt;Skill ceiling&lt;/td&gt;
&lt;td&gt;The rating is calculated only by your top plays&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Onsite or annual contests (IOI/ICPC/Hacker Cup)&lt;/td&gt;
&lt;td&gt;Skill floor&lt;/td&gt;
&lt;td&gt;You only had one chance to perform well, skill floor is important if you want a medal&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Online weekly contests&lt;/td&gt;
&lt;td&gt;Balanced&lt;/td&gt;
&lt;td&gt;Skill floor to not lose too much rating, skill ceiling for rating boost. Your rating fluctuates if the gap between them is huge.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;But that does not mean you should solely focus on one skill.&lt;/p&gt;
&lt;p&gt;For &lt;strong&gt;IOI training&lt;/strong&gt;, for instance, I think focusing on the skill floor is more important only during the last 3 months before the contest (they may also act as a mental boost). Before that, improve your ceiling as much as possible.
As another food for thought, I wonder if having &amp;ldquo;rank variations&amp;rdquo; is a good metric when selecting the country&amp;rsquo;s delegation, since consistency is also a key factor to win a medal.&lt;/p&gt;
&lt;p&gt;For &lt;strong&gt;online programming contests&lt;/strong&gt;, you might need to hope that the contest suits well with your skillset, and possibly avoid contests where the authors are infamous for topics you dislike.
That being said, you do not really need to master all topics (i.e. a solid skill floor), and generally skill ceiling is more important if you aim to raise your max rating.&lt;/p&gt;
&lt;h2 id=&#34;recommendation-problemscharts&#34;&gt;Recommendation Problems/Charts&lt;/h2&gt;
&lt;p&gt;How do you pick charts to play or problems to solve? Just &lt;strong&gt;pick anything at random&lt;/strong&gt; (within your skill range, of course). Or better, pick anything that you find interesting, since it is essentially random too!
You can also use any randomiser tools you find to pick things for you.&lt;/p&gt;
&lt;p&gt;A few of these methods, however, do NOT really help in boosting your progress (at least for me).&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://chunirec.net/stat/best&#34;&gt;chunirec&lt;/a&gt; BEST entries stats.&lt;/li&gt;
&lt;li&gt;Problems that were also solved by your peers.&lt;/li&gt;
&lt;li&gt;Rating up folder on Chunithm&lt;/li&gt;
&lt;li&gt;Problems sorted by most solvers&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;They are all essentially random, so do not feel demotivated if they did not boost as you might have expected, even though some of those lists came from statistical data.
You can, of course, use them as your &amp;ldquo;randomiser&amp;rdquo;, but do not expect any rating boost from those lists.&lt;/p&gt;
&lt;p&gt;If you have a good trainer that understand your current skillset, then this trainer may actually help you in improving your performance by giving you pointers or actually recommending problemset that matches your skill.&lt;/p&gt;
&lt;h2 id=&#34;coaching&#34;&gt;Coaching&lt;/h2&gt;
&lt;blockquote&gt;
&lt;p&gt;This section is a bit loosely written, so you may skip it. I do not have much teaching experience, and I do not like to teach (it&amp;rsquo;s fun once in a while, but not as a job). I&amp;rsquo;m also not a very good teacher as I often struggle to pour my thoughts into words. Yes, this entire blog is a giant irony.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Does a trainer or a coach actually help? They sure do, but only up to a certain level. They act as a catalyst, so you will still need to practice and act on your own. Meaning that, do not solely depend on their guidance or wait for their instructions.&lt;/p&gt;
&lt;p&gt;A coach may help you to kickstart, so you do not have to reinvent the wheel for every basic stuff.
They may help pointing out the topic/pattern you are weak at.
They may be able to see that you have solidify your fundamentals and ready to move to the next level.&lt;/p&gt;
&lt;p&gt;However, coaches also have their limit. At some point, you may already be performing beyond what the coach can see. Then, the coach can only give you a random problemset for the sake of &amp;ldquo;training&amp;rdquo;.
Can you still see them as a coach at that point? At least he is your new randomiser (lol).&lt;/p&gt;
&lt;p&gt;Coaching and playing are two different skills. A good coach may not perform well in a competition (they are only good at identifying things to learn). Similarly, a good player may not be able to teach well (they only know what is best for themself, not guiding others).
Surely, there are correlations between the two, but identifying a good coach is certainly not easy as it is hard to get a good metric for it.&lt;/p&gt;
&lt;p&gt;Can a good coach be identified by the number of successful students they have? Not necessarily. Take the Indonesian CP lesson market as an example (which is a hot market at the time of this writing). Even if a certain camp advertised that they dominated the medal ranking, but when you see the bigger picture, they simply have an enormous number of students, and some of them happen to win by chance. That is, statistically, you gained no edge to win a medal by joining that camp.&lt;/p&gt;
&lt;p&gt;What I am trying to say in this section is that, do not waste your time finding a good coach; any decent coach with decent experience will do (if you need one). Even if you find a good one, you&amp;rsquo;ll need to be independent at some point, especially if you aim to win something.&lt;/p&gt;
&lt;h2 id=&#34;milestones&#34;&gt;Milestones&lt;/h2&gt;
&lt;p&gt;Progress is not linear. I think it is more of something like this.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/performance.png&#34; style=&#34;width: 650px&#34;/&gt;&lt;/p&gt;
&lt;p&gt;So do not be demotivated when you can&amp;rsquo;t seem to improve even when you were very near to your next milestone.
It might be that you have unfortunately hit your next wall that is very near to your milestone.&lt;/p&gt;
&lt;p&gt;When you&amp;rsquo;re practising, you are actually accumulating your latent skill that is yet to be realised into your actual skill. Your body needs some time to convert this latent skill into an acquired skill.&lt;/p&gt;
&lt;p&gt;I also believe that the accumulated latent skill can only hold a finite capacity.
So it is important to &lt;strong&gt;take a break&lt;/strong&gt; and let your body catch up with what you have trained with.
This also implies that training one day before competition day isn&amp;rsquo;t particularly useful.&lt;/p&gt;
&lt;h2 id=&#34;practice&#34;&gt;Practice&lt;/h2&gt;
&lt;p&gt;All in all, what you need to do is consistently &lt;strong&gt;practice&lt;/strong&gt;.
The insights above may help, but I believe they won&amp;rsquo;t give you that large of an advantage even if you know them beforehand.
By practising, you may also discover your own style.&lt;/p&gt;
&lt;p&gt;I also believe that a lot of competitive skills are ultimately &lt;em&gt;pattern recognition&lt;/em&gt; (so if you have a good memory, you are better at improving competitive skills).
In competitive programming, once you are familiar with how problems are commonly set up, your brain will automatically &lt;em&gt;tell&lt;/em&gt; you how to approach those problems. Similarly, in Chunithm, your hand muscles just automatically move when you see certain patterns. That pattern recognition can only be developed through a lot of practice.&lt;/p&gt;
&lt;h2 id=&#34;closing&#34;&gt;Closing&lt;/h2&gt;
&lt;p&gt;This article may possibly be yet another &amp;ldquo;how to improve&amp;rdquo; article, but I often like to explain things from my perspective.&lt;/p&gt;
&lt;p&gt;A few other things I did (or did not do) but I couldn&amp;rsquo;t generalise them into a single framework that fit within the article, possibly because they are indeed irrelevant:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;I sometimes watch people play Chunithm on YouTube, and possibly shadow the play (so I&amp;rsquo;ll need to make sure the chart is indeed within my skill level).&lt;/li&gt;
&lt;li&gt;Studying to execute a pattern using slow motion, or figuring out which finger to play which notes, are not helpful. You can execute the pattern naturally when the time comes.&lt;/li&gt;
&lt;li&gt;I do not watch people livestream problem solving, and I do not find listening to their train of thought to be useful. People imagine things differently and can have very different thought processes.&lt;/li&gt;
&lt;li&gt;I think I give up pretty easily. I usually do not think of a problem for days, and usually just look at the editorial after 20-30 minutes of thinking, sometimes even under 5 minutes.&lt;/li&gt;
&lt;li&gt;I like to think of a problem to procrastinate during my actual work. I think a lot while commuting during my active CP years too.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A few things that I would tell my past:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Study 4k patterns using fingers earlier. Execute stairs and rolls using your index and ring fingers.&lt;/li&gt;
&lt;li&gt;Competitive programming costs you a LOT of time. It costs that much that it literally has to be part of your life (imagine requiring 1 hour per problem, or 5 hours per contest for a single feedback on your performance). Be sure that you are not leaving things you like behind, and the time that you dedicate is indeed worth it.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Now, as per tradition, I will also show my best charts the moment I reached R16 Chunithm:&lt;/p&gt;
&lt;!-- &lt;div style=&#34;display: flex&#34;&gt;
  &lt;div style=&#34;align-content: center;&#34;&gt;
    &lt;img src=&#34;https://prabowo02.github.io/posts/achievement1.png&#34; style=&#34;width: 400px&#34;/&gt;
  &lt;/div&gt;
  &lt;div&gt;
    &lt;img src=&#34;https://prabowo02.github.io/posts/achievement2.jpg&#34; style=&#34;width: 400px&#34;/&gt;&lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt; --&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/achievement3.png&#34; style=&#34;width: 600px&#34;/&gt;&lt;/p&gt;
&lt;!-- Maybe write a separate what-if article?

It is still funny to think about how a single municipal informatics olympiad (OSK in Indonesia) that I participated in back in 2014 for fun eventually built up my current life. Until 2025, I still learnt and get to know a lot of great people. I don&#39;t think this article would exist if I had not joined my school&#39;s programming club back then (which I wasn&#39;t aware was for olympiads). Heck, I wouldn&#39;t even be in Singapore, and who knows what kind of NEET I would become. I am also very grateful to the people in the Discord server that I own; I think they (unknowingly) do well to keep my sanity in check.

I&#39;m planning to write more about my life in the upcoming articles. --&gt;
</description>
		</item>
		<item>
			<title>Why are we opposing the &#34;villains&#34; in JRPGs?</title>
			<link>https://prabowo02.github.io/posts/jrpg/</link>
			<pubDate>Tue, 30 Dec 2025 15:10:00 +0800</pubDate>
			<guid isPermaLink="true">https://prabowo02.github.io/posts/jrpg/</guid>
			<description>&lt;p&gt;In numerous JRPG titles, the goals of the &lt;em&gt;villains&lt;/em&gt; make a lot of sense.
While some of them indeed were straight-up maniacs, some of those villains actually tried to offer solutions to the unjust world they were living in.
I am going to analyse and provide some short antithesis essays of the protagonist&amp;rsquo;s actions for a few games here.&lt;/p&gt;
&lt;p&gt;This article contains spoilers for the following games: Persona 5, Final Fantasy XVI, Xenoblade 3.&lt;/p&gt;
&lt;h2 id=&#34;persona-5-royal--third-semester&#34;&gt;Persona 5 Royal — Third Semester&lt;/h2&gt;
&lt;p&gt;After the protagonist defeated Yaldabaoth, Dr Takuto Maruki awakened his Persona that granted him the ability to rewrite reality.
He wrote an ideal reality that erased people&amp;rsquo;s pain by:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;restoring the dead;&lt;/li&gt;
&lt;li&gt;undid any traumas or illness;&lt;/li&gt;
&lt;li&gt;gave the people the lives they would have chosen.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The citizens of this reality were statistically and objectively happier: suicide rates dropped, crime rates dropped, and mental illness was removed. The people, including the Phantom Thieves, also described themselves as fulfilled.&lt;/p&gt;
&lt;p&gt;The protagonist claimed that people were robbed of their free will; however, there was neither rebellion nor resistance in the first place. If given the choice, the majority of the people would have preferred this alternate reality. By opposing Dr Maruki, the protagonist&amp;rsquo;s stance also becomes paradoxical in the sense that they &lt;em&gt;forced&lt;/em&gt; the people to live in the &amp;ldquo;authentic&amp;rdquo; reality.&lt;/p&gt;
&lt;p&gt;The protagonist also made the selfish claim that: everyone can heal and want to endure pain.
Clearly, this is something that can&amp;rsquo;t be universally applied to everyone.
The protagonist never gave any guarantee nor mechanism that the society could do better or grow in the authentic reality.&lt;/p&gt;
&lt;p&gt;Does trading freedom for pain really justify the act by the Phantom Thieves?&lt;/p&gt;
&lt;p&gt;Their very actions from the beginning of the game were questionable at best. Is forcing people to change (by stealing their &lt;em&gt;hearts&lt;/em&gt;) the morally correct way to save people? They have been robbing people of their free will this entire time.&lt;/p&gt;
&lt;h2 id=&#34;final-fantasy-xvi&#34;&gt;Final Fantasy XVI&lt;/h2&gt;
&lt;p&gt;The antagonist, Ultima, did a lot of yapping in a very cryptic way, and I was having a hard time understanding his intention. From what I understand, he created humankind with the ultimate goal of reviving the Ultima race. What Ultima did not expect was for the human to develop free will and become corrupt. Ultima decided to erase back humanity, and also end the endless wars and resource scarcity the human was causing.&lt;/p&gt;
&lt;p&gt;Clive, the protagonist, acknowledged that humanity indeed failed, but it was because they were still learning and that will change. However, humankind&amp;rsquo;s history has seen repeated wars over the mothercrystals, and they never shown any form of learning.&lt;/p&gt;
&lt;p&gt;Clive seems to be also aware that either way, humankind would still suffer anyway, yet he chose to be rebellious against Ultima, and Ultima failed to understand the reason behind it.
What Clive was trying to fight for was just prolonging the human suffering, while Ultima wanted to give immediate salvation to all.&lt;/p&gt;
&lt;p&gt;Clive seems to value freedom at any cost, and thus accepted natural suffering. He decided to selfishly reject Ultima&amp;rsquo;s decision to end his own failed creation. In the end, the world was left uncertain with no hints of becoming more prosperous.&lt;/p&gt;
&lt;h2 id=&#34;xenoblade-3&#34;&gt;Xenoblade 3&lt;/h2&gt;
&lt;p&gt;The conflicts in this game run much deeper than the specific problem I am going to explore.&lt;/p&gt;
&lt;p&gt;In short, the people of Keves and Agnus lived for only ten years.
Their life began from physical age 9, were given the purpose to serve the queen, and aimed to reach the Homecoming after fulfilling their 10-year lifespan.
During Homecoming, the people would be sent back to heaven by the queen and were considered the greatest honour.
The people who watched the Homecoming were happy for them; there was neither grief nor people being left behind.&lt;/p&gt;
&lt;p&gt;Since they lived for only 10 years, there was no concept of ageing, no concept of attachments such as family (so they would never experience loss). The people also started their lives as equals. Having a life longer than 10 years was also viewed as greed for them.&lt;/p&gt;
&lt;p&gt;Noah (the MC) argued that one&amp;rsquo;s future should be chosen on one&amp;rsquo;s own, not given.
An uncertain future is better than a guaranteed empty present.
However, one&amp;rsquo;s life meaning is not solely determined by one&amp;rsquo;s choices in life. When a purpose is already assigned, that purpose is already a value on its own. Imposing a self-authorship of one&amp;rsquo;s life is under the assumption that all people desire an open-ended future, which clearly some may reject.&lt;/p&gt;
&lt;p&gt;Noah also witnessed a family in his journey, saw the concept of love, and also accepted that grieving is part of love. He believed life is fuller in that way. However, the soldiers were already experiencing fullness in a different way. Fullness is not necessarily associated with chronological duration, childhood, or family. They were already fulfilled by the way they fight, bond, and achieve in their 10-term life. They value their limited time very much and hence really enjoyed the 10-year life span of theirs.&lt;/p&gt;
&lt;p&gt;One might also argue that abolishing the 10-term life is just a consequence of ending the &lt;em&gt;Endless Now&lt;/em&gt;, the state of the world that the Moebius (the main antagonist) is imposing on the universe, wherein the flow of time is frozen in that instant.&lt;/p&gt;
&lt;p&gt;They did the Endless Now because the world they were in was born from two universes that were merging with each other. Continuing this process has an unknown consequence that might annihilate the world. Hence, the Endless Now stops time to guarantee that they will not become extinct. Noah also tried to oppose this simply because he had faith in the future of the world, and that should be the way of life. He can say this due to his emotional resilience, which clearly millions of others do not have.&lt;/p&gt;
&lt;h2 id=&#34;remark&#34;&gt;Remark&lt;/h2&gt;
&lt;p&gt;I think JRPGs should offer a choice to side with the villain, or give a second act of the game where we become the villains. Fire Emblem: Three Houses actually provided multiple routes, but the consequences of the choices were not obvious since the choices were made at the beginning of the game.&lt;/p&gt;
</description>
		</item>
		<item>
			<title>On Dirichlet hyperbola method</title>
			<link>https://prabowo02.github.io/posts/hyperbola/</link>
			<pubDate>Mon, 04 Aug 2025 23:00:09 +0800</pubDate>
			<guid isPermaLink="true">https://prabowo02.github.io/posts/hyperbola/</guid>
			<description>&lt;h2 id=&#34;dirichlet-convolution&#34;&gt;Dirichlet Convolution&lt;/h2&gt;
&lt;p&gt;We are going to deal with this kind of sum:&lt;/p&gt;
&lt;p&gt;$$\sum_{d|n} f(d) g(\frac{n}{d})$$&lt;/p&gt;
&lt;p&gt;Some examples are:&lt;/p&gt;
&lt;p&gt;$$\varphi(n) = \sum_{d|n} \mu(d) \frac{n}{d}$$&lt;/p&gt;
&lt;p&gt;and&lt;/p&gt;
&lt;p&gt;$$n = \sum_{d|n} \varphi(d)$$&lt;/p&gt;
&lt;p&gt;The sums above are actually known as the Dirichlet convolution, which can be formally written as&lt;/p&gt;
&lt;p&gt;$$(f * g)(n) = \sum_{d|n} f(d) g(\frac{n}{d})$$&lt;/p&gt;
&lt;p&gt;If we let $\textbf{1}(n) = 1$ and $\textbf{Id}(n) = n$, then our examples can be rewritten as $\varphi = \mu * \text{Id}$ and $\text{Id} = \varphi * \text{1}$.&lt;/p&gt;
&lt;p&gt;We can then also observe from the examples that $\mu$ and $\text{1}$ are inverses of each other. A Dirichlet inverse $f^{-1}$ is a function such that $f * f^{-1} = \varepsilon$, where $\varepsilon(n) = 1$ when $n = 1$, otherwise $\varepsilon(n) = 0$. To put more concisely, $\text{1} * \mu = \varepsilon$.&lt;/p&gt;
&lt;h2 id=&#34;hyperbola-method&#34;&gt;Hyperbola Method&lt;/h2&gt;
&lt;p&gt;Suppose we want to compute
$$\sum_{i=1}^n (f * g)(i) = \sum_{ij \leq n} f(i) g(j)$$&lt;/p&gt;
&lt;p&gt;Visually, we want to sum the lattice point &lt;em&gt;values&lt;/em&gt; under the curve $y = \frac{n}{x}$, where the point $(x, y)$ has a value of $f(x) g(y)$. Below, we are going to sum the blue area, the red area, then subtract the double-counted square at the corner.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;https://prabowo02.github.io/posts/Dirichlet_hyperbola.png&#34; style=&#34;width: 500px&#34;/&gt;&lt;/p&gt;
&lt;p&gt;Let $F$ and $G$ be the &lt;em&gt;prefix sum&lt;/em&gt; of $f$ and $g$ respectively. Formally, $F(n) = f(1) + &amp;hellip; + f(n)$. Then,&lt;/p&gt;
&lt;p&gt;$$\sum_{ij \leq n} f(i) g(j) = \sum_{i=1}^{\lfloor \sqrt n \rfloor} f(i) G\left(\left\lfloor\frac{n}{i}\right\rfloor\right) + \sum_{j = 1}^{\lfloor \sqrt n \rfloor} F\left(\left\lfloor\frac{n}{j}\right\rfloor\right) g(j) - F(\lfloor \sqrt{n} \rfloor) G(\lfloor \sqrt{n} \rfloor)$$&lt;/p&gt;
&lt;p&gt;which can be computed in $\mathcal{O}(\sqrt{n})$ operations (assuming all of $f$, $g$, $F$, and $G$ are easy to compute).&lt;/p&gt;
&lt;p&gt;In a lot of cases, it&amp;rsquo;s either $F(n)$ or $G(n)$ that is hard to compute, so let&amp;rsquo;s rearrange the equation above so that $F(n)$ is at the left-hand side of the equation.&lt;/p&gt;
&lt;p&gt;$$F(n) g(1) = \sum_{ij \leq n} f(i) g(j) + F(\lfloor \sqrt{n} \rfloor) G(\lfloor \sqrt{n} \rfloor) - \sum_{i=1}^{\lfloor \sqrt n \rfloor} f(i) G\left(\left\lfloor\frac{n}{i}\right\rfloor\right) - \sum_{j=2}^{\lfloor \sqrt n \rfloor} F\left(\left\lfloor\frac{n}{j}\right\rfloor\right) g(j)$$&lt;/p&gt;
&lt;p&gt;There are $\mathcal{O}(\sqrt{n})$ different values of $\left\lfloor\frac{n}{i}\right\rfloor$, so $F$ can be computed in the increasing order of $\left\lfloor\frac{n}{i}\right\rfloor$. In fact, if we have precomputed $F(i)$ for $i &amp;lt; n^{2/3}$, then $F(n)$ can be computed in $\mathcal{O}(n^{2/3})$ operations.&lt;/p&gt;
&lt;h3 id=&#34;euler-summatory-function&#34;&gt;Euler Summatory Function&lt;/h3&gt;
&lt;p&gt;Let&amp;rsquo;s take an example by trying to compute&lt;/p&gt;
&lt;p&gt;$$\Phi(n) = \sum_{i=1}^n \varphi(i)$$&lt;/p&gt;
&lt;p&gt;We are going to make use of $\text{Id} = \varphi * 1$. We note that $\sum_{i=1}^n \text{Id}(i) = \frac{n(n+1)}{2}$ and $\sum_{i=1}^n \text{1}(i) = n$, so they are easy to compute.&lt;/p&gt;
&lt;p&gt;Applying the hyperbola method, we obtain:&lt;/p&gt;
&lt;p&gt;$$\Phi(n) = \frac{n(n+1)}{2} + \lfloor\sqrt{n}\rfloor \Phi(\lfloor\sqrt{n}\rfloor) - \sum_{i=1}^{\lfloor\sqrt{n}\rfloor} \varphi(i) \left\lfloor\frac{n}{i}\right\rfloor - \sum_{j=2}^{\lfloor\sqrt{n}\rfloor} \Phi\left(\left\lfloor\frac{n}{j}\right\rfloor\right)$$&lt;/p&gt;
&lt;p&gt;So $\Phi(n)$ can be computed in sublinear time.&lt;/p&gt;
&lt;p&gt;A sample implementation in Python can be seen as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-py&#34; data-lang=&#34;py&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;@functools.cache&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;Phi&lt;/span&gt;(n):
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; n &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; PRECOMPUTED:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; _Phi[n]
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    sn &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; math&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;isqrt(n)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    ret &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; n&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;(n&lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;) &lt;span style=&#34;color:#f92672&#34;&gt;//&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; sn&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;Phi(sn)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    ret &lt;span style=&#34;color:#f92672&#34;&gt;-=&lt;/span&gt; sum(_phi[i] &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt; (n&lt;span style=&#34;color:#f92672&#34;&gt;//&lt;/span&gt;i) &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; i &lt;span style=&#34;color:#f92672&#34;&gt;in&lt;/span&gt; range(&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;, sn&lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;))
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    ret &lt;span style=&#34;color:#f92672&#34;&gt;-=&lt;/span&gt; sum(Phi(n&lt;span style=&#34;color:#f92672&#34;&gt;//&lt;/span&gt;i) &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; i &lt;span style=&#34;color:#f92672&#34;&gt;in&lt;/span&gt; range(&lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;, sn&lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;))
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; ret
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You can attempt with your own implementation on this &lt;a href=&#34;https://judge.yosupo.jp/problem/sum_of_totient_function&#34;&gt;Library Checker&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;mertens-function&#34;&gt;Mertens Function&lt;/h3&gt;
&lt;p&gt;We will try to compute:&lt;/p&gt;
&lt;p&gt;$$M(n) = \sum_{i=1}^n \mu(i)$$&lt;/p&gt;
&lt;p&gt;By noting that $1 * \mu = \varepsilon$, we can then apply the hyperbola method and obtain:&lt;/p&gt;
&lt;p&gt;$$M(n) = 1 + \lfloor \sqrt{n} \rfloor M(\lfloor \sqrt{n} \rfloor) - \sum_{i=1}^{\sqrt{n}} \mu(i) \left\lfloor \frac{n}{i} \right\rfloor - \sum_{j=2}^{\sqrt{n}} M\left(\left\lfloor\frac{n}{j}\right\rfloor\right)$$&lt;/p&gt;
&lt;p&gt;so $M(n)$ can be computed in sublinear time.&lt;/p&gt;
&lt;p&gt;Other interesting properties that you may find infer from $1 * \mu = \varepsilon$ are:&lt;/p&gt;
&lt;p&gt;$$1 = \sum_{k=1}^n \mu(k) \left\lfloor\frac{n}{k}\right\rfloor = \sum_{k=1}^n M\left(\left\lfloor\frac{n}{k}\right\rfloor\right)$$&lt;/p&gt;
&lt;h3 id=&#34;project-euler-319&#34;&gt;Project Euler #319&lt;/h3&gt;
&lt;p&gt;You can read the problem &lt;a href=&#34;https://projecteuler.net/problem=319&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Without diving deep into the math details, the quantity we are looking for can be computed by the following.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-py&#34; data-lang=&#34;py&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;solve&lt;/span&gt;(n):
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    a &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; [&lt;span style=&#34;color:#ae81ff&#34;&gt;3&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;**&lt;/span&gt;i &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;**&lt;/span&gt;i &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; i &lt;span style=&#34;color:#f92672&#34;&gt;in&lt;/span&gt; range(n)]
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; i &lt;span style=&#34;color:#f92672&#34;&gt;in&lt;/span&gt; range(&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;, n):
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; j &lt;span style=&#34;color:#f92672&#34;&gt;in&lt;/span&gt; range(i&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;, n, i):
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            a[j] &lt;span style=&#34;color:#f92672&#34;&gt;-=&lt;/span&gt; a[i]
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; sum(a)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Of course, it can get pretty slow when $n = 10^{10}$, so we have to do something about it.&lt;/p&gt;
&lt;p&gt;Let $f(n) = 3^n - 2^n$. We can see that the function &lt;code&gt;solve&lt;/code&gt; is doing a &lt;a href=&#34;https://codeforces.com/blog/entry/119082&#34;&gt;Möbius transform&lt;/a&gt; on $f$ then computes its sum. To put more concisely, we are trying to evaluate&lt;/p&gt;
&lt;p&gt;$$\sum_{i=1}^n (f * \mu)(i)$$&lt;/p&gt;
&lt;p&gt;There are two approaches here, and they both involve the hyperbola method.&lt;/p&gt;
&lt;h4 id=&#34;first-approach&#34;&gt;First approach&lt;/h4&gt;
&lt;p&gt;First, we compute the Mertens function $M\left(\left\lfloor\frac{n}{i}\right\rfloor\right)$ for all possible values of $\left\lfloor\frac{n}{i}\right\rfloor$ (there are around $2\sqrt{n}$ of them) using the hyperbola method. Also note that $F(n) = f(1) + f(2) + &amp;hellip; + f(n)$ has an $\mathcal{O}(1)$ formula. Then, apply the hyperbola method again to compute the final sum:&lt;/p&gt;
&lt;p&gt;$$\sum_{i=1}^{\lfloor\sqrt{n}\rfloor} f(i) M\left(\left\lfloor\frac{n}{i}\right\rfloor\right) + \sum_{j=1}^{\lfloor\sqrt{n}\rfloor} F\left(\left\lfloor\frac{n}{j}\right\rfloor\right) \mu(j) - F(\lfloor\sqrt{n}\rfloor) M(\lfloor\sqrt{n}\rfloor)$$&lt;/p&gt;
&lt;p&gt;This requires two hyperbola methods, which are already sufficient, but we can do something simpler.&lt;/p&gt;
&lt;h4 id=&#34;second-approach&#34;&gt;Second approach&lt;/h4&gt;
&lt;p&gt;Let $g = f * \mu$, we can rewrite it as $f = g * \text{1}$. We want the value of $G(n) = g(1) + g(2) + &amp;hellip; + g(n)$ which can be computed by the hyperbola method:&lt;/p&gt;
&lt;p&gt;$$G(n) = F(n) + \lfloor\sqrt{n}\rfloor G(\lfloor\sqrt{n}\rfloor) - \sum_{i=1}^{\sqrt{n}} g(i) \left\lfloor\frac{n}{i}\right\rfloor - \sum_{j=2}^{\sqrt{n}} G\left(\left\lfloor\frac{n}{i}\right\rfloor\right)$$&lt;/p&gt;
&lt;p&gt;which solves the problem.&lt;/p&gt;
&lt;h2 id=&#34;dirichlet-series&#34;&gt;Dirichlet Series&lt;/h2&gt;
&lt;p&gt;I will briefly mention the Dirichlet series here.&lt;/p&gt;
&lt;p&gt;The Dirichlet series for a function $f$ can be defined as follows.&lt;/p&gt;
&lt;p&gt;$$F(s) = \sum_{n \geq 1} \frac{f(n)}{n^s}$$&lt;/p&gt;
&lt;p&gt;So if we have $h = f * g$, then $H(s) = F(s)G(s)$! Here are a few examples of the Dirichlet series.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;$\zeta(s)$: the &lt;a href=&#34;https://en.wikipedia.org/wiki/Riemann_zeta_function&#34;&gt;Riemann zeta function&lt;/a&gt; is a Dirichlet series for $\text{1}$.&lt;/li&gt;
&lt;li&gt;$\frac{1}{\zeta(s)} = \sum_{n \geq 1} \frac{\mu(n)}{n^s}$ by noting that $1$ and $\mu$ are inverses of each other.&lt;/li&gt;
&lt;li&gt;$\zeta(s-1)$ is a Dirichlet series for $\text{Id}$.&lt;/li&gt;
&lt;li&gt;$\zeta(s-a)$ is a Dirichlet series for $f(n) = n^a$.&lt;/li&gt;
&lt;li&gt;$\frac{\zeta(s-1)}{\zeta(s)} = \sum_{n \geq 1} \frac{\varphi(n)}{n^s}$ by noting that $\varphi = \mu * \text{Id}$.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Interestingly, the formal power operations, such as $\exp$ and $\log$, can also be applied to the Dirichlet series, and one can show that $\log \zeta(s)$ has a relation with the &lt;a href=&#34;https://en.wikipedia.org/wiki/Prime_zeta_function&#34;&gt;prime zeta function&lt;/a&gt;, which I will explore more in the next article (hopefully).&lt;/p&gt;
&lt;h2 id=&#34;further-readings&#34;&gt;Further Readings&lt;/h2&gt;
&lt;p&gt;Some more properties of the Dirichlet convolution can be found on this &lt;a href=&#34;https://en.wikipedia.org/wiki/Dirichlet_convolution#Properties_and_examples&#34;&gt;Wikipedia article&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;A more advanced discussion can also be found on this &lt;a href=&#34;https://codeforces.com/blog/entry/117635&#34;&gt;CF blog&lt;/a&gt;.&lt;/p&gt;
</description>
		</item>
		<item>
			<title>How to incorrectly use Generating Function</title>
			<link>https://prabowo02.github.io/posts/not-gf/</link>
			<pubDate>Mon, 17 Jul 2023 21:22:18 +0800</pubDate>
			<guid isPermaLink="true">https://prabowo02.github.io/posts/not-gf/</guid>
			<description>&lt;p&gt;Generating functions can be used to &lt;em&gt;cheese&lt;/em&gt; numerous counting problems without too much thinking.
Here, I will show the &lt;strong&gt;not&lt;/strong&gt; proper way to use generating function to solve such problems.&lt;/p&gt;
&lt;p&gt;A few people may find the generating function approach for some of these problems is more &amp;ldquo;intuitive&amp;rdquo;, as the combinatorial approach is a bit out of the blue.&lt;/p&gt;
&lt;h2 id=&#34;codeforces-1549-e----the-three-little-pigshttpscodeforcescomcontest1549probleme&#34;&gt;&lt;a href=&#34;https://codeforces.com/contest/1549/problem/E&#34;&gt;Codeforces 1549 E &amp;ndash; The Three Little Pigs&lt;/a&gt;&lt;/h2&gt;
&lt;blockquote&gt;
&lt;p&gt;Given $N$, then given $Q$ queries, each gives you an integer $K$ and asks you to compute $\sum_{i=0}^N \binom{3i}{K}$&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;$N \le 1\,000\,000$&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;h3 id=&#34;proper-solution&#34;&gt;Proper solution&lt;/h3&gt;
&lt;p&gt;Let $\text{dp}_0(K)$, $\text{dp}_1(K)$, and $\text{dp}_2(K)$ be the sum $\sum_{i=0}^N \binom{3i}{K}$, $\sum_{i=0}^N \binom{3i + 1}{K}$, and $\sum_{i=0}^N \binom{3i + 2}{K}$ respectively.&lt;/p&gt;
&lt;p&gt;We can see that:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;$\text{dp}_0(K) + \text{dp}_1(K) + \text{dp}_2(K) = \sum_{i=0}^{3N+2} \binom{i}{K} = \binom{3N + 3}{K + 1}$ using the Hockey-stick identity;&lt;/li&gt;
&lt;li&gt;$\text{dp}_1(K) = \text{dp}_0(K) + \text{dp}_0(K - 1)$ using the Pascal&amp;rsquo;s rule; and&lt;/li&gt;
&lt;li&gt;$\text{dp}_2(K) = \text{dp}_1(K) + \text{dp}_1(K - 1)$ using the Pascal&amp;rsquo;s rule.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;With three equations and three unknowns, the values of all DP can then be inferred.&lt;/p&gt;
&lt;h3 id=&#34;generating-function-approach&#34;&gt;Generating function approach&lt;/h3&gt;
&lt;p&gt;Suppose we are able to evaluate $\sum_{i=0}^N (1 + x)^{3i}$, then for each query, the answer is the $K$-th coefficient of that generating function.&lt;/p&gt;
&lt;p&gt;To evaluate that polynomial,&lt;/p&gt;
&lt;p&gt;$$
\begin{align*}
\sum_{i=0}^N (1 + x)^{3i} &amp;amp;= \frac{1 - (1 + x)^{3N + 3}}{1 - (1 + x)^3} \\
&amp;amp;= \frac{\sum_{i=1}^{3N + 3} \left(\binom{3N + 3}{i} x^i\right)}{-3x -3x^2 - x^3}
\end{align*}
$$&lt;/p&gt;
&lt;p&gt;The binomial coefficients from the numerator can be easily computed, then perform a standard long division to get the final G.F. in $\mathcal{O}(N)$.&lt;/p&gt;
&lt;h2 id=&#34;atcoder-regular-contest-110-d----binomial-coefficient-is-funhttpsatcoderjpcontestsarc110tasksarc110_d&#34;&gt;&lt;a href=&#34;https://atcoder.jp/contests/arc110/tasks/arc110_d&#34;&gt;AtCoder Regular Contest 110 D &amp;ndash; Binomial Coefficient is Fun&lt;/a&gt;&lt;/h2&gt;
&lt;blockquote&gt;
&lt;p&gt;Given a sequence $A$ of $N$ integers, compute the sum $\prod_{i=1}^N \binom{B_i}{A_i}$ over all sequences $B$ of $N$ non-negative integers whose sum is at most $M$.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;$1 \le N \le 2000$&lt;/li&gt;
&lt;li&gt;$1 \le M \le 10^9$&lt;/li&gt;
&lt;li&gt;$0 \le A_i \le 2000$&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;h3 id=&#34;proper-solution-1&#34;&gt;Proper solution&lt;/h3&gt;
&lt;p&gt;Suppose you have $\sum A_i + N$ bars and $M - \sum A_i$ stars.
The stars and bars before the $a_1$-th bar correspond to $\binom{B_1}{A_1}$; the stars and bars strictly between the $a_1$-th and $a_1 + a_2$-th bars correspond to $\binom{B_2}{A_2}$; and so on; and the stars after the $\sum A_i$-th bar are those that does not make the $B$ sum up to $M$.&lt;/p&gt;
&lt;p&gt;The number of ways to arrange those stars and bars is then $\binom{M + N}{\sum A_i + N}$.&lt;/p&gt;
&lt;h3 id=&#34;generating-function-approach-1&#34;&gt;Generating function approach&lt;/h3&gt;
&lt;p&gt;Recall that $[x^n] \frac{x^k}{(1 - x)^{k + 1}} = \binom{n}{k}$.&lt;/p&gt;
&lt;p&gt;That means the sum of products from the description such that $B$ has a sum of exactly $m$ is the $m$-th coefficient of:&lt;/p&gt;
&lt;p&gt;$$\prod_{i = 1}^N \frac{x^{A_i}}{(1 - x)^{A_i + 1}} = \frac{x^{\sum A_i}}{(1 - x)^{\sum A_i + N}}$$&lt;/p&gt;
&lt;p&gt;And to get the sum for all coefficients of $x^m$ with $m \le M$, we can get the &amp;ldquo;prefix-sum&amp;rdquo; of the above G.F. (by multiplying it with $(1 - x)^{-1}$, and simply get the $M$-th coefficient. In short,&lt;/p&gt;
&lt;p&gt;$$[x^M] \frac{x^{\sum A_i}}{(1 - x)^{\sum A_i + N + 1}}$$&lt;/p&gt;
&lt;p&gt;which conveniently equals to $\binom{M + N}{\sum A_i + N}$.&lt;/p&gt;
&lt;h2 id=&#34;ioi-2022-circuithttpsioinformaticsorgfilesioi2022problem4pdf&#34;&gt;&lt;a href=&#34;https://ioinformatics.org/files/ioi2022problem4.pdf&#34;&gt;IOI 2022 Circuit&lt;/a&gt;&lt;/h2&gt;
&lt;blockquote&gt;
&lt;p&gt;Given a rooted tree of $N$ nodes, its leaves has initial state of $0$ or $1$. You can assign an integer parameter $p$ for each internal node (and $p$ is at most the number of its children), then its state will be $1$ if at least $p$ of its children have state $1$. Given $Q$ updates which toggle the state of the leaf nodes from $L$ to $R$, find the number of ways to assign those parameters such that the root node has a state of $1$.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3 id=&#34;proper-solution-2&#34;&gt;Proper solution&lt;/h3&gt;
&lt;p&gt;The assignment of a parameter to a node can be reinterpreted as an operator that takes a value from one of its children.
Hence, for each leaf with state $1$, we count how many ways are there to have its value reaching the root, which equals the product of all internal nodes&amp;rsquo;, excluding the nodes that are in the path between the leaf to the root, number of children.&lt;/p&gt;
&lt;h3 id=&#34;generating-function-approach-2&#34;&gt;Generating function approach&lt;/h3&gt;
&lt;p&gt;Denote $\text{dp}_0(v)$ and $\text{dp}_1(v)$ as the number of ways to assign parameters for all subtree of $v$ such that the state of $v$ is $0$ and $1$ respectively.&lt;/p&gt;
&lt;p&gt;Suppose $v_1, \ldots, v_c$ is the children of $v$, then the number of ways such that exactly $k$ children of $v$ has state of $1$ is the $k$-th coefficient of:&lt;/p&gt;
&lt;p&gt;$$\prod_{i=1}^c (\text{dp}_0(v_i) + x \text{dp}_1(v_i))$$&lt;/p&gt;
&lt;p&gt;That means the number of ways to get state $1$ if we assign parameter $p$ to node $v$, is the sum of $k$-th ($k \ge p$) coefficient of the above G.F..
Summing for all possible $p$, we can see that we actually need the value $k$ times the $k$-th coefficient.
So we can transform the generating function by doing its derivative:&lt;/p&gt;
&lt;p&gt;$$
\begin{align*}
&amp;amp;x \frac{\mathrm{d}}{\mathrm{d}x} \prod_{i=1}^c (\text{dp}_0(v_i) + x \text{dp}_1(v_i)) \\
=&amp;amp;x \frac{\mathrm{d}}{\mathrm{d}x} \exp \log \prod_{i=1}^c (\text{dp}_0(v_i) + x \text{dp}_1(v_i)) \\
=&amp;amp;x \frac{\mathrm{d}}{\mathrm{d}x} \exp \sum_{i=1}^c \log (\text{dp}_0(v_i) + x \text{dp}_1(v_i)) \\
=&amp;amp;\sum_{i=1}^c \frac{x \text{dp}_1(v_i)}{(\text{dp}_0(v_i) + x \text{dp}_1(v_i))} \exp \sum_{i=1}^c \log (\text{dp}_0(v_i) + x \text{dp}_1(v_i)) \\
=&amp;amp;\sum_{i=1}^c \frac{x \text{dp}_1(v_i)}{(\text{dp}_0(v_i) + x \text{dp}_1(v_i))} \prod_{i=1}^c(\text{dp}_0(v_i) + x \text{dp}_1(v_i)) \\
\end{align*}
$$&lt;/p&gt;
&lt;p&gt;And because we only need the sum of all those coefficients, we substitute $x = 1$, then obtain the final formula of the DP as:&lt;/p&gt;
&lt;p&gt;$$\text{dp}_1(v) = \sum_{i=1}^c \frac{\text{dp}_1(v_i)}{(\text{dp}_0(v_i) + \text{dp}_1(v_i))} \prod_{i=1}^c(\text{dp}_0(v_i) + \text{dp}_1(v_i))$$&lt;/p&gt;
&lt;p&gt;Now see that $\text{dp}_0(v) + \text{dp}_1(v)$ is equal to $\prod_{u \in \text{subtree}(v)} \deg(u)$ (where $\deg(u)$ is the number of children of $u$, except when $u$ is a leaf which we set to be $1$ for convenience) because we can assign any parameter to the nodes in the subtree of $v$ without any restriction to the end state of $v$. We denote this value as $p(v)$ which can be precomputed and stays constant throughout the whole update.&lt;/p&gt;
&lt;p&gt;Rewrite our DP formula:&lt;/p&gt;
&lt;p&gt;$$
\begin{align*}
\text{dp}_1(v) &amp;amp;= \sum_{i=1}^c \frac{\text{dp}_1(v_i)}{p(v_i)} \prod_{i=1}^c p(v_i) \\
&amp;amp;= \sum_{i=1}^c \left(\frac{p(v)}{\deg(v) p(v_i)} \text{dp}_1(v_i)\right)
\end{align*}
$$&lt;/p&gt;
&lt;p&gt;Now, here comes the &amp;ldquo;Competitive Programming&amp;rdquo; part. Imagine you recurse the above formula up to the leaves.
Then, suppose $[u_0, u_1, \ldots, u_k]$ is the path from the root node $u_0$ to a leaf node $u_k$, compute $\prod_{i=1}^k \frac{p(u_{i-1})}{\deg(u_{i-1}) p(u_i)}$, and assign this value to the leaf node $u_k$. If the source gate $u_k$ is $1$, then the assigned value will contribute to the sum of the final answer. Otherwise, its contribution is $0$.&lt;/p&gt;
&lt;p&gt;This problem is actually authored by me, but I was not aware of the GF approach at that time.&lt;/p&gt;
</description>
		</item>
		<item>
			<title>On counting the number of zigzag sequences</title>
			<link>https://prabowo02.github.io/posts/zigzag-sequences/</link>
			<pubDate>Sun, 10 Jul 2022 18:30:00 +0800</pubDate>
			<guid isPermaLink="true">https://prabowo02.github.io/posts/zigzag-sequences/</guid>
			<description>&lt;p&gt;I feel like these are classical, but it&amp;rsquo;s hard to find a good discussion about them, so here we go.&lt;/p&gt;
&lt;p&gt;We will discuss two things here:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;find the number of zigzag permutations, and&lt;/li&gt;
&lt;li&gt;find the number of zigzag sequences.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;counting-zigzag-permutations&#34;&gt;Counting Zigzag permutations&lt;/h2&gt;
&lt;p&gt;Given $N \le 200\;000$, find the number of permutations that satisfy $p_1 \lt p_2 \gt p_3 \lt p_4 \gt \ldots p_N$.&lt;/p&gt;
&lt;p&gt;You may stop here if you are interested to solve the problem by yourself first.&lt;/p&gt;
&lt;h3 id=&#34;terminologies&#34;&gt;Terminologies&lt;/h3&gt;
&lt;p&gt;First, let us clear up the terminology we are going to use.&lt;/p&gt;
&lt;p&gt;A &lt;em&gt;permutation&lt;/em&gt; of length $N$ is a sequence of length $N$ where $1, 2, \ldots, N$ each appears exactly once.
In this article, whenever I omit the &amp;ldquo;of length $N$&amp;rdquo;, the permutation always has length $N$ by default.&lt;/p&gt;
&lt;p&gt;A &lt;em&gt;zigzag permutation&lt;/em&gt; is a permutation $p$, such that $p_1 \lt p_2 \gt p_3 \lt p_4 \gt \ldots p_n$.
More formally, the relation $p_i \lt p_{i+1}$ is satisfied when $i$ is odd, and $p_i \gt p_{i+1}$ when $i$ is even.&lt;/p&gt;
&lt;p&gt;We define similarly a &lt;em&gt;zagzig permutation&lt;/em&gt; as a permutation $p$, such that $p_1 \gt p_2 \lt p_3 \gt p_4 \gt \ldots p_n$.
This is the same as zigzag permutation, as they both have alternating relations, but this one starts with $\gt$.&lt;/p&gt;
&lt;p&gt;We will also collectively refer both &lt;em&gt;zigzag&lt;/em&gt; and &lt;em&gt;zagzig&lt;/em&gt; permutations as &lt;em&gt;alternating permutations&lt;/em&gt;&lt;/p&gt;
&lt;h3 id=&#34;catalan-like-dp&#34;&gt;Catalan-like DP&lt;/h3&gt;
&lt;p&gt;Before getting to the calculation, we first note that there exists a bijection between zigzag permutations and zagzig permutations.
This is easy to show: for a zigzag permutation $p$, we map $p_i$ to $N - p_i + 1$.&lt;/p&gt;
&lt;p&gt;Moreover, for $N \ge 2$ the set of zigzag permutations are mutually exclusive from the set of zagzig permutations.
This means that, if we know the cardinality of a set of alternating permutations (of length $N \ge 2$), then the cardinality of the zigzag permutations is exactly half of it.&lt;/p&gt;
&lt;p&gt;Let $a_n$ be the number of zigzag permutations of length $n$.
That is, the number of alternating permutations is $2a_n$ for $n \ge 2$.&lt;/p&gt;
&lt;p&gt;The key to compute $a_n$ is we consider every position of its largest element $n$, then we &amp;ldquo;attach&amp;rdquo; a reversed zigzag permutation to the left, then attach another zigzag permutation to the right of the largest element. Note that this will give you all the alternating permutations instead of the zigzag permutations alone. The elements that are to the left of the largest can be chosen from any of the remaining $n - 1$ elements.&lt;/p&gt;
&lt;p&gt;To sum up:&lt;/p&gt;
&lt;p&gt;$$2a_n = \sum_{k=0}^{n-1} \binom{n - 1}{k} a_k a_{n-1-k}$$&lt;/p&gt;
&lt;p&gt;or to make it prettier:&lt;/p&gt;
&lt;p&gt;$$2a_{n+1} = \sum_{k=0}^{n} \binom{n}{k} a_k a_{n-k}$$&lt;/p&gt;
&lt;p&gt;for $n \ge 1$ with the base case $a_0 = a_1 = 1$.&lt;/p&gt;
&lt;p&gt;This can be easily computed using DP in $O(N^2)$.&lt;/p&gt;
&lt;h3 id=&#34;faster-computation&#34;&gt;Faster Computation&lt;/h3&gt;
&lt;p&gt;Let $A(x)$ be the exponential generating function of the sequence $(a)_n$. That is,&lt;/p&gt;
&lt;p&gt;$$A(x) = \sum_{k=0}^\infty \frac{a_k}{k!} x^k$$&lt;/p&gt;
&lt;p&gt;Then,&lt;/p&gt;
&lt;p&gt;$$2A(x) = \int A(x)^2 dx + x + 2$$&lt;/p&gt;
&lt;p&gt;The purpose of the integration is to &amp;ldquo;shift&amp;rdquo; the EGF by one, and the $x + 2$ part is to make the base case of $[x^0]$ and $[x^1]$ be both $2$ (recall that we are computing $2A(x)$, not a single $A(x)$).&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s solve the integration formula. We derive both sides:&lt;/p&gt;
&lt;p&gt;$$2 \frac{\mathrm{d}}{\mathrm{d}x} A(x) = A(x)^2 + 1$$&lt;/p&gt;
&lt;p&gt;Since I have nothing better to do, I will derive this ordinary differential equation in more details.
We divide both sides by $A(x)^2 + 1$ then integrate both sides.&lt;/p&gt;
&lt;p&gt;$$\int \frac{2}{A(x)^2 + 1} \mathrm{d}A(x) = \int dx$$&lt;/p&gt;
&lt;p&gt;Use the trigonometry substituion $A(x) = \tan(t)$ and we obtain:&lt;/p&gt;
&lt;p&gt;$$\int \frac{2}{\tan(t)^2 + 1} \sec(t)^2 dt = x + C$$&lt;/p&gt;
&lt;p&gt;Note the trigonometry identity $\tan(t)^2 + 1 = \sec(t)^2$, then:&lt;/p&gt;
&lt;p&gt;$$2\arctan(A(x)) = x + C$$&lt;/p&gt;
&lt;p&gt;We note that when $x = 0$, $A(0) = 1$, hence:&lt;/p&gt;
&lt;p&gt;$$A(x) = \tan\left(\frac{x}{2} + \frac{\pi}{4}\right)$$&lt;/p&gt;
&lt;p&gt;Use the tangent half-angle formula, and we finally obtain:&lt;/p&gt;
&lt;p&gt;$$A(x) = \sec(x) + \tan(x) = \frac{1 + \sin(x)}{\cos(x)}$$&lt;/p&gt;
&lt;p&gt;and this can be easily calculated in $O(N \log N)$ using FFT.&lt;/p&gt;
&lt;p&gt;Apparently, the resulting generating function is also known as André&amp;rsquo;s theorem.&lt;/p&gt;
&lt;h2 id=&#34;counting-zigzag-sequences&#34;&gt;Counting Zigzag Sequences&lt;/h2&gt;
&lt;p&gt;Given $N \le 200\;000$ and $M \le 10^9$, find the number of sequences of positive integers such that $a_i \le M$ and $a_1 \lt a_2 \gt a_3 \lt a_4 \gt \ldots a_N$.&lt;/p&gt;
&lt;p&gt;To solve this problem, we must first forget everything from the previous section as they prove to be useless for this problem.&lt;/p&gt;
&lt;p&gt;The key idea here is inclusion-exclusion, and we have to solve by cases.&lt;/p&gt;
&lt;h3 id=&#34;n-is-even&#34;&gt;N is even&lt;/h3&gt;
&lt;p&gt;We will apply inclusion-exclusion on the &amp;ldquo;$\gt$&amp;rdquo; part.
What this means is we keep all the &amp;ldquo;$\lt$&amp;rdquo; signs, ignore some of the &amp;ldquo;$\gt$&amp;rdquo; conditions, and replace all the other &amp;ldquo;$\gt$&amp;rdquo; with &amp;ldquo;$\le$&amp;rdquo;.
For every such replacement, count the number of the inequalities, then multiply by $(-1)^{\text{\# of ≤}}$, then sum for all of the possible replacements.&lt;/p&gt;
&lt;p&gt;The sum is not straightforward to come. Instead, for one possible replacement, we will consider a &lt;em&gt;chain&lt;/em&gt; as the maximal subsegment such that $a_{2i+1} \lt a_{2i+2} \le a_{2i+3} \lt \ldots \le a_{2j}$. That is, the chain is a maximal consecutive subsequence such that it contains either &amp;ldquo;$\lt$&amp;rdquo; or &amp;ldquo;$\le$&amp;rdquo;. Notice that such a chain always has an even length.&lt;/p&gt;
&lt;p&gt;The number of sequences $b$ of length $2n$ (an even number) such that $b_1 \lt b_2 \le b_3 \lt \ldots \le b_{2n}$ can be easily found out as $\binom{M + n - 1}{2n}$.&lt;/p&gt;
&lt;p&gt;Now, we just have to &amp;ldquo;glue&amp;rdquo; up all these chains to form a sequence of length $N$.&lt;/p&gt;
&lt;p&gt;So we obtain this DP formula:&lt;/p&gt;
&lt;p&gt;$$dp(n) = \sum_{k=1}^n (-1)^{k-1} \binom{M+k-1}{2k} dp(n-k)$$&lt;/p&gt;
&lt;p&gt;and our answer is $dp(\frac{N}{2})$ which can be solved in $O(N^2)$.&lt;/p&gt;
&lt;p&gt;To speed it up, define $P(x)$ as the generating function:&lt;/p&gt;
&lt;p&gt;$$P(x) = \sum_{k=1}^\infty (-1)^{k-1} \binom{M+k-1}{2k} x^{2k}$$.&lt;/p&gt;
&lt;p&gt;then we simply need to find:&lt;/p&gt;
&lt;p&gt;$$[x^N](1 + P(x) + P(x)^2 + \ldots) = [x^N]\frac{1}{1 - P(x)}$$&lt;/p&gt;
&lt;p&gt;using FFT in $O(N \log N)$.&lt;/p&gt;
&lt;h3 id=&#34;n-is-odd&#34;&gt;N is odd&lt;/h3&gt;
&lt;p&gt;We continue from the result of the even case. What we need to do now is to add a single odd chain at the end.&lt;/p&gt;
&lt;p&gt;So we define the generating function of the odd chain:&lt;/p&gt;
&lt;p&gt;$$Q(x) = \sum_{k=0}^\infty (-1)^k \binom{M+k}{2k+1} x^{2k+1}$$&lt;/p&gt;
&lt;p&gt;Then we can simply find&lt;/p&gt;
&lt;p&gt;$$[x^N] \frac{Q(x)}{1 - P(x)}$$&lt;/p&gt;
&lt;p&gt;with FFT in $O(N \log N)$.&lt;/p&gt;
&lt;h3 id=&#34;combining-both-cases&#34;&gt;Combining both cases&lt;/h3&gt;
&lt;p&gt;Since both GFs are &amp;ldquo;independent&amp;rdquo;, we can simply find:&lt;/p&gt;
&lt;p&gt;$$[x^N] \frac{1 + Q(x)}{1 - P(x)}$$&lt;/p&gt;
&lt;p&gt;without the need for a parity check of $N$.&lt;/p&gt;
</description>
		</item>
		<item>
			<title>My Problems</title>
			<link>https://prabowo02.github.io/problems/</link>
			<pubDate>Mon, 03 Jan 2022 12:08:03 +0800</pubDate>
			<guid isPermaLink="true">https://prabowo02.github.io/problems/</guid>
			<description>&lt;h2 id=&#34;problemsetting&#34;&gt;Problemsetting&lt;/h2&gt;
&lt;p&gt;I set various problems for Informatics olympiads and competitions.&lt;/p&gt;
&lt;h3 id=&#34;icpc&#34;&gt;ICPC&lt;/h3&gt;
&lt;h4 id=&#34;regional&#34;&gt;Regional&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://tlx.toki.id/problems/icpc-jakarta-2025/G&#34;&gt;2025 ICPC Regional Jakarta — Grid Game 2×2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://tlx.toki.id/problems/icpc-jakarta-2024/J&#34;&gt;2024 ICPC Regional Jakarta — Xorderable Array&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://tlx.toki.id/problems/icpc-jakarta-2024/F&#34;&gt;2024 ICPC Regional Jakarta — Grid Game 3-angle&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://codeforces.com/contest/1938/problem/L&#34;&gt;2024 ICPC Asia Pacific Championship — XOR Operations&lt;/a&gt; (coauthor)&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://tlx.toki.id/problems/icpc-jakarta-2023/G&#34;&gt;2023 ICPC Regional Jakarta — Grid Game 2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://tlx.toki.id/problems/icpc-jakarta-2023/B&#34;&gt;2023 ICPC Regional Jakarta — Button Pressing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://tlx.toki.id/problems/icpc-jakarta-2022/H&#34;&gt;2022 ICPC Regional Jakarta — Grid Game&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://tlx.toki.id/problems/icpc-jakarta-2022/J&#34;&gt;2022 ICPC Regional Jakarta — Sharing Bread&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://tlx.toki.id/problems/icpc-jakarta-2021/K&#34;&gt;2021 ICPC Regional Jakarta — White-Black Tree&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://codeforces.com/contest/1252/problem/K&#34;&gt;2019 ICPC Regional Jakarta — Addition Robot&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;national&#34;&gt;National&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://tlx.toki.id/problems/inc-2023/L&#34;&gt;2023 ICPC Indonesia National Contest — Numbers Combination&lt;/a&gt; (coauthor)&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://tlx.toki.id/problems/inc-2023/J&#34;&gt;2023 ICPC Indonesia National Contest — Counting Pairs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://tlx.toki.id/problems/inc-2022/D&#34;&gt;2022 ICPC Indonesia National Contest — Robot Upgrades&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://tlx.toki.id/problems/inc-2021/C&#34;&gt;2021 ICPC Indonesia National Contest — Card Game&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://tlx.toki.id/problems/inc-2021/J&#34;&gt;2021 ICPC Indonesia National Contest — Sum Mod Pair of A&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://tlx.toki.id/problems/inc-2020/G&#34;&gt;2020 ICPC Indonesia National Contest — Hallway and Butler&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;olympiad-in-informatics&#34;&gt;Olympiad in Informatics&lt;/h3&gt;
&lt;h4 id=&#34;international&#34;&gt;International&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/ioi-2024/tasks/blob/main/day2/mosaic/statements/en.pdf&#34;&gt;2024 International Olympiad in Informatics — Mosaic&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://ioi2022.id/data/day2/circuit-en_ISC.pdf&#34;&gt;2022 International Olympiad in Informatics — Digital Circuit&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;national-1&#34;&gt;National&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://tlx.toki.id/problems/osn-2025/2C&#34;&gt;2025 Indonesia National Olympiad in Informatics — XOR Exchange&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://tlx.toki.id/problems/osn-2025/1B&#34;&gt;2025 Indonesia National Olympiad in Informatics — Twist List&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://tlx.toki.id/problems/osn-2023/2A&#34;&gt;2023 Indonesia National Olympiad in Informatics — Television Flickers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://tlx.toki.id/problems/ksn-2021/1B&#34;&gt;2021 Indonesia National Olympiad in Informatics — Binary Sea&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://tlx.toki.id/problems/ksn-2020/2C&#34;&gt;2020 Indonesia National Olympiad in Informatics — Finding Balls&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://tlx.toki.id/problems/ksn-2020/2A&#34;&gt;2020 Indonesia National Olympiad in Informatics — Evil Spirit&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://tlx.toki.id/problems/osn-2016/1C&#34;&gt;2016 Indonesia National Olympiad in Informatics — River Tourism Spots&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;toki-regular-open-contest&#34;&gt;TOKI Regular Open Contest&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://tlx.toki.id/problems/troc-20/G&#34;&gt;TOKI Regular Open Contest #20 — Obscure Superstring&lt;/a&gt; (coauthor)&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://tlx.toki.id/problems/troc-17/H&#34;&gt;TOKI Regular Open Contest #17 — Guitar Gift&lt;/a&gt; (coauthor)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;hellip; and more problems incoming.&lt;/p&gt;
&lt;h2 id=&#34;scientific-committee&#34;&gt;Scientific Committee&lt;/h2&gt;
&lt;h3 id=&#34;coordinator&#34;&gt;Coordinator&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://codeforces.com/blog/entry/129720&#34;&gt;TOKI Open 2024&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://ksn2021.toki.id/&#34;&gt;2021 Indonesia National Olympiad in Informatics&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://apio2021.toki.id/&#34;&gt;2021 Asia-Pacific Informatics Olympiad&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://tlx.toki.id/problems/problemsets?archive=troc&#34;&gt;TOKI Regular Open Contests #7 — #26&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;committee-member&#34;&gt;Committee Member&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://ioi2022.id/&#34;&gt;2022 International Olympiad in Informatics&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://ksn2020.toki.id/&#34;&gt;2020 Indonesia National Olympiad in Informatics&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://apio2020.toki.id/&#34;&gt;2020 Asia-Pacific Informatics Olympiad&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://osn2019.toki.id/&#34;&gt;2019 Indonesia National Olympiad in Informatics&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://codeforces.com/blog/entry/59182&#34;&gt;2018 TOKI Open&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;testersobservers&#34;&gt;Testers/Observers&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://codeforces.com/blog/entry/108503&#34;&gt;CodeTON Round 3&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://codeforces.com/blog/entry/108451&#34;&gt;Codeforces Round #831&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://ioi2021.sg/&#34;&gt;International Olympiad in Informatics 2021&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://ioi2020.sg/&#34;&gt;International Olympiad in Informatics 2020&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://codeforces.com/blog/entry/104491&#34;&gt;CodeTON Round 2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://codeforces.com/blog/entry/104880&#34;&gt;Codeforces Round #808&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://codeforces.com/blog/entry/98471&#34;&gt;Codeforces Good Bye 2021&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://codeforces.com/blog/entry/92093&#34;&gt;Codeforces Round #728&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://codeforces.com/contest/1575&#34;&gt;COMPFEST 13 Finals&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://codeforces.com/blog/entry/86048&#34;&gt;Codeforces Good Bye 2020&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://codeforces.com/blog/entry/84662&#34;&gt;Codeforces Round #684&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://codeforces.com/blog/entry/84500&#34;&gt;Codeforces Round #682 (Div. 2)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://codeforces.com/blog/entry/83730&#34;&gt;Codeforces Raif Round 1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://codeforces.com/blog/entry/80422&#34;&gt;Codeforces Round #659&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://codeforces.com/blog/entry/81167&#34;&gt;Codeforces Round #663&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://codeforces.com/blog/entry/79620&#34;&gt;Codeforces Global Round 9&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
		</item>
		<item>
			<title>Sum of $C(N, i) \times i^K$</title>
			<link>https://prabowo02.github.io/posts/sum-cnk-xk/</link>
			<pubDate>Tue, 01 Jun 2021 23:08:09 +0800</pubDate>
			<guid isPermaLink="true">https://prabowo02.github.io/posts/sum-cnk-xk/</guid>
			<description>&lt;p&gt;Have you ever felt the need to compute:&lt;/p&gt;
&lt;p&gt;$$\sum_{i=0}^N \binom{N}{i} i^K $$&lt;/p&gt;
&lt;p&gt;where $N \le 10^9$ and $K \le 10^5$? Well you are in luck, because I&amp;rsquo;m about to show you how.&lt;/p&gt;
&lt;p&gt;Consider the binomial expansion:&lt;/p&gt;
&lt;p&gt;$$f_0(x) := (1 + x)^N = \sum_{i=0}^N \binom{N}{i} x^i$$&lt;/p&gt;
&lt;p&gt;If you differentiate then multiply by $x$, you will get:&lt;/p&gt;
&lt;p&gt;$$f_1(x) := x \frac{\mathrm{d}}{\mathrm{d}x}(1 + x)^N = \sum_{i=0}^N \binom{N}{i}\cdot i \cdot x^i$$&lt;/p&gt;
&lt;p&gt;Then repeatedly differentiate and multiply by $x$ (i.e. $f_k(x) = x \frac{\mathrm{d}}{\mathrm{d}x} f_{k - 1}(x)$), then you will end up with:&lt;/p&gt;
&lt;p&gt;$$f_K(x) = \sum_{i=0}^N \binom{N}{i} i^K x^i$$&lt;/p&gt;
&lt;p&gt;Evaluate $f_K(1)$ then you will get the answer to the original question.&lt;/p&gt;
&lt;p&gt;The value of $f_K$ is actually:&lt;/p&gt;
&lt;p&gt;$$f_K(x) = \sum_{i=0}^K S(K, i) \cdot (N)_i \cdot (1 + x)^{N-i}$$&lt;/p&gt;
&lt;p&gt;where $S$ is the Stirling number of the second kind and $(N)_i$ is the falling factorial $N(N - 1) \ldots (N - i + 1)$.
The formula can be easily shown using induction following the property $S(N, K) = K \cdot S(N - 1, K) + S(N - 1, K - 1)$.&lt;/p&gt;
&lt;p&gt;The computation of $(N)_i$ for all $0 \le i \le K$ can be easily computed in $O(K)$, and the computation of $S(K, i)$ can be done using FFT (&lt;a href=&#34;https://en.wikipedia.org/wiki/Touchard_polynomials&#34;&gt;Touchard Polynomial&lt;/a&gt;) in $O(K \log K)$.&lt;/p&gt;
&lt;p&gt;In case you need something more general:&lt;/p&gt;
&lt;p&gt;$$\sum_{i=0}^N \binom{N}{i} \cdot i^K \cdot A^i \cdot B^{N - i} = \sum_{i=0}^K S(K, i) \cdot (N)_i \cdot A^i \cdot (A + B)^{N - i}$$&lt;/p&gt;
&lt;p&gt;which can actually be obtained by starting the initial equation from $(Ax + B)^N$.&lt;/p&gt;
&lt;p&gt;You can now solve &lt;a href=&#34;https://codeforces.com/problemset/problem/1278/F&#34;&gt;Codeforces edu round problem Cards&lt;/a&gt; for $K \le 10^5$.&lt;/p&gt;
&lt;h2 id=&#34;moment-generating-function&#34;&gt;Moment Generating Function&lt;/h2&gt;
&lt;p&gt;Another way (and perhaps more elegant way) to arrive at that equation is to use the moment generating function. Let&lt;/p&gt;
&lt;p&gt;$$M_X(t) = \mathrm{E}(\exp(tX)) = \sum_{i=0}^\infty \frac{t^i \mathrm{E}(X^i)}{i!}$$&lt;/p&gt;
&lt;p&gt;Now, if you differentiate $M_X(t)$ for $k$ times, and substitute $t = 0$, you will end up with $\mathrm{E}(X^k)$.&lt;/p&gt;
&lt;p&gt;So if you start from $(A \exp(x) + B)^N$, then you differentiate $K$ times, you will obtain:&lt;/p&gt;
&lt;p&gt;$$\frac{\mathrm{d}^K}{\mathrm{d}x^K} (A \exp(x) + B)^N = \sum_{i = 0}^K S(K, i) \cdot (N)_i \cdot A^i \cdot (A \exp(x) + B)^{N - i} \cdot \exp(ix)$$&lt;/p&gt;
&lt;p&gt;Again, the formula above can be easily shown (roughly shown below) using induction following the recursion property of the Stirling second kind.&lt;/p&gt;
&lt;p&gt;Substituting $x = 0$, then you will arrive at the same equation.&lt;/p&gt;
&lt;h3 id=&#34;some-kind-of-proof&#34;&gt;Some kind of proof&lt;/h3&gt;
&lt;p&gt;We will prove that equation from the moment generating function section.&lt;/p&gt;
&lt;p&gt;Let $f(i) = (N)_i \cdot A^i \cdot (A \exp(x) + B)^{N - i} \cdot \exp(ix)$, which in particular $f(0) = (A \exp(x) + B)^N$.&lt;/p&gt;
&lt;p&gt;Then,&lt;/p&gt;
&lt;p&gt;$$\frac{\mathrm{d}f(i)}{\mathrm{d}x} = (N)_{i + 1} \cdot A^{i + 1} (A \exp(x) + B)^{N - i - 1} \exp((i+1)x) + i \cdot (N)_i \cdot A^i \cdot (A \exp(x) + B)^{N - i} \cdot \exp(ix)$$&lt;/p&gt;
&lt;p&gt;Substitute them back using $f$:&lt;/p&gt;
&lt;p&gt;$$\frac{\mathrm{d}f(i)}{\mathrm{d}x} = f(i + 1) + i \cdot f(i)$$&lt;/p&gt;
&lt;p&gt;Now write:&lt;/p&gt;
&lt;p&gt;$$\frac{\mathrm{d}^k}{\mathrm{d}x^k} (A \exp(x) + B)^N = \sum_{i = 0}^k c_{k, i} \cdot f(i)$$&lt;/p&gt;
&lt;p&gt;Differentiate it once, then you will get:&lt;/p&gt;
&lt;p&gt;$$\frac{\mathrm{d}^{k+1}}{\mathrm{d}x^{k+1}} (A \exp(x) + B)^N = \sum_{i = 0}^{k+1} (c_{k, i - 1} + i \cdot c_{k, i}) \cdot f(i)$$&lt;/p&gt;
&lt;p&gt;And notice that $c_{k + 1, i} = c_{k, i - 1} + i \cdot c_{k, i}$ is actually the same recurrence as the Stirling number of the second kind, which roughly end the proof.&lt;/p&gt;
</description>
		</item>
		<item>
			<title>Notes on Fast Fourier Transform</title>
			<link>https://prabowo02.github.io/posts/fft/</link>
			<pubDate>Thu, 17 Dec 2020 17:55:15 +0800</pubDate>
			<guid isPermaLink="true">https://prabowo02.github.io/posts/fft/</guid>
			<description>&lt;p&gt;This is not a tutorial. It&amp;rsquo;s just an overview for those who already (hopefully) understood FFT.
(Actually, more of a personal note to myself)&lt;/p&gt;
&lt;h3 id=&#34;so-what-is-fft&#34;&gt;So what is FFT?&lt;/h3&gt;
&lt;p&gt;DFT but fast&lt;/p&gt;
&lt;h3 id=&#34;what-dft-does&#34;&gt;What DFT does?&lt;/h3&gt;
&lt;p&gt;Converts a polynomial into point value forms where the points sampled are principal $n$-th root of unity.&lt;/p&gt;
&lt;h3 id=&#34;can-you-inverse-the-transformation&#34;&gt;Can you inverse the transformation?&lt;/h3&gt;
&lt;p&gt;Yes, by doing the exact same thing as DFT but the sampled points are inverted too, then divide the final result by $n$.&lt;/p&gt;
&lt;h3 id=&#34;how-to-do-dft&#34;&gt;How to do DFT?&lt;/h3&gt;
&lt;p&gt;Evaluate each sample point in $O(N)$, and you end up in $O(N^2)$ transformation.&lt;/p&gt;
&lt;h3 id=&#34;can-you-do-better&#34;&gt;Can you do better?&lt;/h3&gt;
&lt;p&gt;Yes, that&amp;rsquo;s when FFT comes in.&lt;/p&gt;
&lt;h3 id=&#34;how-to-fft&#34;&gt;How to FFT?&lt;/h3&gt;
&lt;p&gt;The most commonly used algorithm is Cooley-Tukey algorithm, and the DFT size is usually taken in the form of $2^k$. It is basically a Divide and Conquer algorithm, by separating the odd and even terms, and does FFT recursively. By doing some reordering using bit reversal, you can actually does an iterative version of it. Final complexity is $O(N \log N)$ without any additional space.
Details on FFT can be found in this &lt;a href=&#34;https://codeforces.com/blog/entry/43499&#34;&gt;Codeforces blog&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;how-does-fft-help-to-solve-problems&#34;&gt;How does FFT help to solve problems?&lt;/h3&gt;
&lt;p&gt;The main idea is sum-convolution (can also be viewed as polynomial multiplication). That is, given two sequences $a$ and $b$, for each pair of $i$, $j$, $a_i \times b_j$ is &amp;ldquo;contributed&amp;rdquo; to $c_{i + j}$, where $c$ is the convolution.
The way to do that is: $c = IFFT(FFT(a) * FFT(b))$, where $*$ is point-wise multiplication.&lt;/p&gt;
&lt;p&gt;Note that by default DFT is a cyclic convolution, i.e. $a_i b_j$ is actually contributed to $c_{(i + j) \bmod n}$ (in other words, the multiplication is in modulo $(x^n - 1)$). Therefore, to avoid &amp;ldquo;overflow&amp;rdquo;, you pad the polynoms with $0$s until the polynom size is of size $2^k ≥ |a| + |b|$.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://open.kattis.com/problems/aplusb&#34;&gt;An example problem&lt;/a&gt; on how FFT helps. For this problem, you create a polynom where the coefficient of $x^i$ is the number of elements in a that are equal to $i$. After that, you square the polynomial, then start processing from there.&lt;/p&gt;
&lt;p&gt;Sometimes FFT is closely related to string &amp;ldquo;matching&amp;rdquo; too. In this case, usually each alphabet is associated with a polynom where coefficient $x^i$ equals to $1$ if $s_i$ is equal to the associated alphabet, or $0$ otherwise. Here is &lt;a href=&#34;https://codeforces.com/problemset/problem/528/D&#34;&gt;an example&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Another time, a DP problem can be optimized using FFT too. This can be noticed when the transition is $O(N)$ and looks like a convolution. In the case of DP, often we mention the polynomial as (Ordinary) Generating Function. The coefficients of the OGF will be of the interest when arriving at the final answer.&lt;/p&gt;
&lt;p&gt;Talking about generating functions, there is also something called Exponential Generating Function. In EGF, the coefficient of $x^i$ is $\frac{\text{actual value}}{i!}$. And when you multiply, the contributed value is $\binom{i + j}{i} a_i b_j$.&lt;/p&gt;
&lt;h3 id=&#34;what-are-some-popular-generating-functions&#34;&gt;What are some popular generating functions?&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;$(1 + x)^n$. OGF for binomial coefficients $(\binom{n}{0}, \binom{n}{1}, \dots, \binom{n}{n})$.&lt;/li&gt;
&lt;li&gt;$\frac{1}{1 - x}$. OGF for $(1, 1, \dots)$. This is handy if you want to get the &amp;ldquo;prefix sum&amp;rdquo; of a GF by simply divides it by $(1 - x)$.&lt;/li&gt;
&lt;li&gt;$\frac{1}{(1 - x)^k}$. OGF for $(\kern-.5em(\genfrac{}{}{0pt}{}{n}{k})\kern-.5em) = \binom{n + k - 1}{k - 1}$. Used for counting multisets.&lt;/li&gt;
&lt;li&gt;$\frac{x^k}{(1 - x)^{k + 1}}$. OGF for $\binom{n}{k}$. The &amp;ldquo;column&amp;rdquo; of binomial cofficients.&lt;/li&gt;
&lt;li&gt;$y = xy + xy^2 + 1 \implies y = \frac{1}{1 - x - x^2}$. OGF for Fibonacci number.&lt;/li&gt;
&lt;li&gt;$y = 1 + xy^2 \implies y = \frac{2}{1 + \sqrt{1 - 4x}}$. OGF for Catalan number.&lt;/li&gt;
&lt;li&gt;$\exp(x)$. EGF for $(1, 1, \dots)$.&lt;/li&gt;
&lt;li&gt;$\exp(\exp(x) - 1)$. EGF for Bell numbers. It can be used to count number of set partitions.&lt;/li&gt;
&lt;li&gt;$\prod_{i=0}^{n-1}(x + i)$. OGF for Stirling number first kind.&lt;/li&gt;
&lt;li&gt;$\exp(-x) \sum_{i=0}^n \frac{i^n x^i}{i!}$. OGF for Stirling number second kind, also known as Touchard polynomial.&lt;/li&gt;
&lt;li&gt;$\frac{(-\log(1 - x))^k}{k!}$. EGF for &amp;ldquo;column&amp;rdquo; Stirling number first kind. Note that $-\log(1 - x) = \sum \frac{x^i}{i}$.&lt;/li&gt;
&lt;li&gt;$\frac{(\exp(x) - 1)^k}{k!}$. EGF for &amp;ldquo;column&amp;rdquo; Stirling number second kind.&lt;/li&gt;
&lt;li&gt;$y \exp(y) = x$. Lambert W function. Also EGF for number of rooted enumerated trees. Can be computed using Lagrange–Bürmann formula.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;why-are-there-divisions-and-exponent&#34;&gt;Why are there divisions and exponent?&lt;/h3&gt;
&lt;p&gt;These are operations on formal power series. The idea is, if you want to compute $Q$ that satisfies $f(Q) = 0$, for some polynom $Q$ and function $f$, we can use the Newton&amp;rsquo;s method $Q_{n+1} = Q_n - \frac{f(P)}{f&amp;rsquo;(P)}$.&lt;/p&gt;
&lt;p&gt;For example, computing $Q = \frac{1}{P} \implies Q^{-1} - P = 0 \implies f(Q) = Q^{-1} - P$ &lt;br&gt;
$Q := Q - \frac{Q^{-1} - P}{-Q^{-2}} = Q + (Q - PQ) = 2Q - PQ^2$&lt;/p&gt;
&lt;p&gt;Another example, computing $Q = \sqrt{P} \implies Q^2 - P = 0 \implies f(Q) = Q^2 - P$ &lt;br&gt;
$Q := Q - \frac{Q^2 - P}{2Q} = \frac{1}{2}(Q + \frac{P}{Q})$&lt;/p&gt;
&lt;p&gt;In every iteration of the Newton&amp;rsquo;s method, the precision is doubled, i.e. the degree of $Q$ is improved from $n$ to $2n + 1$, and initially $Q$ is only a constant.&lt;/p&gt;
&lt;p&gt;And here are several operations along with their tricks:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Additions and subtractions are obvious.&lt;/li&gt;
&lt;li&gt;Multiplication done by FFT.&lt;/li&gt;
&lt;li&gt;Differentiation and integral are straightforward.&lt;/li&gt;
&lt;li&gt;$\frac{1}{P}$, $\sqrt{P}$, $\exp(P)$ can be done using Newton&amp;rsquo;s method.&lt;/li&gt;
&lt;li&gt;$\log(P) = \int \frac{P&amp;rsquo;}{P}$&lt;/li&gt;
&lt;li&gt;$P(x)^a = \exp(a \log(P(x)))$&lt;/li&gt;
&lt;li&gt;$\arctan(P) = \int \frac{1}{1 + P^2}$&lt;/li&gt;
&lt;li&gt;Generally, inverse trigonometric function can be computed from &lt;a href=&#34;https://en.wikipedia.org/wiki/Inverse_trigonometric_functions#Derivatives_of_inverse_trigonometric_functions&#34;&gt;their derivatives&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;$P^{-1}(x)$ i.e. the inverse function, can be done using Lagrange–Bürmann formula&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;what-about-modulo&#34;&gt;What about modulo?&lt;/h3&gt;
&lt;p&gt;You can find the details of division, modulo, multipoint evaluation, and interpolation in &lt;a href=&#34;https://drive.google.com/file/d/1B9BIfATnI_qL6rYiE5hY9bh20SMVmHZ7/view&#34;&gt;adamant&amp;rsquo;s lecture note&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;do-the-points-must-be-roots-of-unity&#34;&gt;Do the points must be roots of unity?&lt;/h3&gt;
&lt;p&gt;You can actually compute for $\{{z^i\}}_{i=0}^{n-1}$, for any complex number $z$. This is called Chirp Z-transform and can be done using Bluestein&amp;rsquo;s algorithm. The main idea is to write $ij = \binom{i + j}{2} - \binom{i}{2} - \binom{j}{2}$. &lt;br&gt;
Hence, $\sum(a_i z^{ik}) = \sum \left(a_i z^{-\binom{i}{2}} z^{\binom{i + k}{2}} \right) z^{-\binom{k}{2}}$, which is exactly a convolution and can be computed using FFT. &lt;a href=&#34;https://codeforces.com/problemset/problem/1054/H&#34;&gt;Example problem&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;can-we-compute-any-size-dft-quickly&#34;&gt;Can we compute any size DFT quickly?&lt;/h3&gt;
&lt;p&gt;Yes, by using CZT, and $z$ such that $z$ is primitive $n$-th root of unity where $n$ is the DFT size. One example problem that use DFT any size can be found on &lt;a href=&#34;https://codeforces.com/contest/901/problem/E&#34;&gt;Codeforces&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;must-the-polynomial-be-monic&#34;&gt;Must the polynomial be monic?&lt;/h3&gt;
&lt;p&gt;Multidimentional DFT can be done by performing DFT on each dimension one by one. An example problem can be found &lt;a href=&#34;https://codeforces.com/gym/102441/problem/E&#34;&gt;here&lt;/a&gt;. In this problem, &lt;span style=&#34;color:white&#34;&gt;you will need both sum-convolution for one variable, and xor-convolution for the other in a single polynomial&lt;/span&gt; (spoiler in white text).&lt;/p&gt;
&lt;h3 id=&#34;xor-convolution&#34;&gt;Xor-convolution?&lt;/h3&gt;
&lt;p&gt;Xor convolution means that $a_i b_j$ is contributed to $c_{i \oplus j}$. It is basically the standard DFT but multidimensional, and each dimension is DFT of size $2$. This is working because xor is basically addition in vector space $\bmod 2$.&lt;/p&gt;
&lt;h3 id=&#34;can-we-have-other-bitwise-convolutions&#34;&gt;Can we have other bitwise convolutions?&lt;/h3&gt;
&lt;p&gt;In XOR, you tranform $(u, v)$ to $(u + v, u - v)$. &lt;br&gt;
In AND, you tranform $(u, v)$ to $(u + v, v)$. After performing AND-tranform, you actually ends up with sum of supermasks. &lt;br&gt;
In OR, you tranform $(u, v)$ to $(u, u + v)$. After performing OR-tranform, you actually ends up with sum of submasks. &lt;br&gt;
In NAND, you perform AND, then do the bit inverting (i.e. swap coefficients of bit 0 and bit 1).&lt;/p&gt;
&lt;p&gt;An example problem that uses various binary gates can be found on &lt;a href=&#34;https://codeforces.com/contest/1033/problem/F&#34;&gt;Codeforces&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;must-dft-be-operated-in-complex&#34;&gt;Must DFT be operated in complex?&lt;/h3&gt;
&lt;p&gt;DFT works over an arbitrary ring, as long as you are using the principal $n$-th root of unity as the sampled points. Primitive $n$-th root is also principal $n$-th root. Since primitive roots are roots of the $n$-th cyclotomic polynomial, by ensuring your points satisfy $\Phi_n(x) = 0$, then DFT should work. &lt;a href=&#34;https://codeforces.com/problemset/problem/1103/E&#34;&gt;An example problem&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;can-we-compute-the-product-of-multiple-polynomials&#34;&gt;Can we compute the product of multiple polynomials?&lt;/h3&gt;
&lt;p&gt;Suppose that the sum of degrees of the given polynomials is $N$, then we can do either of the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use priority queue, and compute the multiplication of every two polynomials with the lowest degrees.&lt;/li&gt;
&lt;li&gt;Use Divide and Conquer, then split the polynomials to sum of degrees approximately N/2, then recurse&lt;/li&gt;
&lt;li&gt;Divide and Conquer, then split half of the polynomials, regardless of the degrees&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;All of these run in $O(N \log^2 N)$. &lt;a href=&#34;https://codeforces.com/problemset/problem/1257/G&#34;&gt;This problem&lt;/a&gt; require this technique.&lt;/p&gt;
</description>
		</item>
		<item>
			<title>Factorial mod prime</title>
			<link>https://prabowo02.github.io/posts/factorial-mod-p/</link>
			<pubDate>Mon, 02 Nov 2020 18:00:15 +0800</pubDate>
			<guid isPermaLink="true">https://prabowo02.github.io/posts/factorial-mod-p/</guid>
			<description>&lt;p&gt;We are to compute $n! \bmod p$ in $O(\sqrt{p} \log p)$, where $p$ prime.&lt;/p&gt;
&lt;h2 id=&#34;basic-idea&#34;&gt;Basic Idea&lt;/h2&gt;
&lt;p&gt;If we define the polynomial $f(x) := \prod_{i=1}^n (x + i)$, then we can write $n! = f(0)$.&lt;/p&gt;
&lt;p&gt;Let $v := \lfloor \sqrt n \rfloor$ and $g(x) := \prod_{i=1}^v (x+i)$, then&lt;/p&gt;
&lt;p&gt;$$ n! = \left( \prod_{i=0}^{v-1} g(vi) \right) \prod_{i=v^2 + 1}^n i $$&lt;/p&gt;
&lt;p&gt;The latter part of the product can be computed in $O(\sqrt p)$. We will try to find a fast way to compute
$g(0), g(v), \dots, g(v(v-1))$.&lt;/p&gt;
&lt;h2 id=&#34;method&#34;&gt;Method&lt;/h2&gt;
&lt;h3 id=&#34;1-osqrt-p-log-p2&#34;&gt;1. $O(\sqrt p (\log p)^2)$&lt;/h3&gt;
&lt;p&gt;Using FFT multipoint evaluation, we can compute $g(0), \dots, g(v(v+1))$ simultaneously. However, this algorithm uses a lot of polynomial division, which has heavy constant factor, and the speed will not be much faster than $O(p)$.&lt;/p&gt;
&lt;h3 id=&#34;2-osqrt-p-log-p&#34;&gt;2. $O(\sqrt p \log p)$&lt;/h3&gt;
&lt;p&gt;$g(x)$ has roots $-1, -2, \dots, -v$ which is an arithmetic progression, and we want to evaluate $g(x)$ at $0, v, \dots, v(v-1)$ which is also an arithmetic progression. In this case, we will make use of Lagrange Interpolation.&lt;/p&gt;
&lt;p&gt;Next, for a fixed $d$, we define $g_d(x) := \prod_{i=1}^d (x+i)$. Suppose we are able to compute $g_d(0), g_d(v), \dots, g_d(dv)$, then we can compute $g_{2d}(0), g_{2d}(v), \dots, g_{2d}(2dv)$ in $O(d \log d)$. If we are able to achieve this, then we can achieve the desired complexity.&lt;/p&gt;
&lt;p&gt;Notice that $g_{2d}(x) = g_d(x) \cdot g_d(x + d)$. Let $G_d(i) := (g_d(i), g_d(v+i), \dots, g_d(dv + i))$, then from $G_d(0)$, we want to interpolate $G_d(d), G_d(dv), G_d(dv + d)$. This can be achieved using Lagrange Interpolation and FFT (NTT) in $O(d \log d)$ as described below.&lt;/p&gt;
&lt;p&gt;Let $h(x)$ be a $d$-degree polynomial and the values $h(0), h(1), \dots, h(d)$ are known, then the value $h(m + k)$ can be computed using Lagrange Interpolation (assuming $m + k - j$ has an inverse):&lt;/p&gt;
&lt;p&gt;$$
\begin{align*}
h(m + k) &amp;amp;= \sum_{i = 0}^d h(i) \prod_{j=0, i \neq j}^d \frac{m+k-j}{i-j} \\\
&amp;amp;= \left(\prod_{j=0}^d (m + k - j) \right) \left( \sum_{i=0}^d \frac{h(i)}{i! (d-i)! (-1)^{d-i}} \cdot \frac{1}{m + k - i} \right)
\end{align*}
$$&lt;/p&gt;
&lt;p&gt;Notice that the right parenthesis is actually a convolution, so $h(m), h(m+1), \dots, h(m+d)$ can be computed in $O(d \log d)$. To interpolate $G_d(a)$ from $G_d(0)$, it is enough to substitute $m := av^{-1}$.&lt;/p&gt;
&lt;p&gt;From the above, $n! \bmod p$ can be computed in $O(\sqrt p \log p)$.&lt;/p&gt;
</description>
		</item>
		<item>
			<title>Project Euler #100</title>
			<link>https://prabowo02.github.io/posts/project-euler-100/</link>
			<pubDate>Fri, 10 Jul 2020 00:24:26 +0800</pubDate>
			<guid isPermaLink="true">https://prabowo02.github.io/posts/project-euler-100/</guid>
			<description>&lt;p&gt;This post will give the analysis to &lt;a href=&#34;https://www.hackerrank.com/contests/projecteuler/challenges/euler100/problem&#34;&gt;Project Euler #100&lt;/a&gt; from hackerrank, which is an extended version from the &lt;a href=&#34;https://projecteuler.net/problem=100&#34;&gt;original&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;problem&#34;&gt;Problem&lt;/h2&gt;
&lt;p&gt;Given $P$, $Q$, and $M$, find smallest $n$ such that $\frac{b(b-1)}{n(n-1)} = \frac{P}{Q}$, where $b$ and $n$ are positive integers and $n &amp;gt; M$.&lt;/p&gt;
&lt;p&gt;Constraints:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;$2 ≤ M ≤ 10^{15}$.&lt;/li&gt;
&lt;li&gt;$0 &amp;lt; P &amp;lt; Q ≤ 10^7$.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;solution&#34;&gt;Solution&lt;/h2&gt;
&lt;p&gt;To simplify matters, we assume $P$ and $Q$ are coprime. If they are not, simply divide both of them with their gcd.
The equation $\frac{b(b-1)}{n(n-1)} = \frac{P}{Q}$ can be rewritten as $Q(b(b-1)) = P(n(n-1)) \Rightarrow Q(2b-1)^2 - P(2n-1)^2 = Q - P$ by completing the square.&lt;/p&gt;
&lt;p&gt;Let $Q = qr^2$ where $r$ is the largest divisor of $Q$ such that $r^2 | Q$. Therefore $q$ is squarefree.
Multiplying both sides of the equation with $q$, we obtain:&lt;/p&gt;
&lt;p&gt;$$(qr(2b-1))^2 - Pq(2n-1)^2 = q(Q-P)$$&lt;/p&gt;
&lt;p&gt;Notice that this is actually the generalized Pell equation $x^2 - Dy^2 = N$, with $D = Pq$ and $N = q(Q-P)$.
Some readers may notice that multiplying both sides with $Q$ instead of $q$ will make the equation looks easier, but the reason to that may have to wait until the next few parts of the solution.&lt;/p&gt;
&lt;p&gt;There are two cases when solving the Pell equation $x^2 - Dy^2 = N$:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;$D$ is a square.&lt;/li&gt;
&lt;li&gt;$D$ is not a square.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;d-is-a-square&#34;&gt;$D$ is a square&lt;/h3&gt;
&lt;p&gt;If $D$ is a square, that means $Pq$ is a square, or equivalently $PQ$ is also a square.
Let $d = \sqrt{PQ}$, $x = Q(2b-1)$, $y = (2n-1)$, then we can rewrite the equation $x^2 - PQy^2 = Q(Q-P)$ as:&lt;/p&gt;
&lt;p&gt;$(x - dy)(x + dy) = Q(Q-P)$&lt;/p&gt;
&lt;p&gt;Factoring $Q(Q-P)$ into $a \times b$ where $a$ and $b$ are integers, we solve these two simultaneous linear equations:&lt;/p&gt;
&lt;p&gt;$$x - dy = a$$
$$x + dy = b$$&lt;/p&gt;
&lt;p&gt;After solving these two equations for all $a$ and $b$, we obtain all solutions to $x$ and $y$. Hence, $b$ and $n$ can also be determined.&lt;/p&gt;
&lt;h3 id=&#34;d-is-not-a-square&#34;&gt;$D$ is not a square&lt;/h3&gt;
&lt;p&gt;If $D$ is not a square, apply the LMM algorithm (&lt;a href=&#34;http://www.jpr2718.org/pell.pdf&#34;&gt;Solving the generalized Pell equation by John P. Robertson&lt;/a&gt; page 16). The first part of the algorithm is to find all $z$ such that $z^2 = D \pmod {|m|}$ where $m = \frac{N}{f^2}$ and $f^2 | N$. Finding such $z$ may be hard in general, but there are a few special property on this specific equation:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;It can be seen that $q$ and $Q-P$ are coprime. Therefore we can split the congruence into two congruences and merge them later using CRT (Chinese Remainder Theorem).&lt;/li&gt;
&lt;li&gt;$f^2$ only divides $Q-P$ because $q$ is squarefree. Therefore we do not need to consider the divisors of $q$ when considering the equation $x^2 = Pq \mod q$.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;solving-x2--pq-mod-q&#34;&gt;Solving $x^2 = Pq \mod q$&lt;/h4&gt;
&lt;p&gt;It is obvious that $Pq = 0 \mod q$ because $q | Pq$. The congruence became $x^2 = 0 mod q$. Since q is squarefree, there is only one solution to $x$, which is $0$ (how convenient). This is the reason why we are not using the equation $x^2 - PQ = Q(Q-P)$, because solving $x^2 = 0 \mod Q$ may yield tens or hundreds of solutions.&lt;/p&gt;
&lt;h4 id=&#34;solving-x2--pq-mod-q-p&#34;&gt;Solving $x^2 = Pq \mod (Q-P)$&lt;/h4&gt;
&lt;p&gt;First, rewrite the congruence:&lt;/p&gt;
&lt;p&gt;$ \ \ \ \ \ \ \  x^2 = Pq \pmod{Q-P}$ &lt;br&gt;
$\Longrightarrow x^2 = Pq + q(Q-P) \pmod{Q-P}$ &lt;br&gt;
$\Longrightarrow x^2 = Qq \pmod {Q-P}$ &lt;br&gt;
$\Longrightarrow x^2 = (qr)^2 \pmod{Q-P}$&lt;/p&gt;
&lt;p&gt;This also works when the modulo is $\frac{Q-P}{f^2}$, we will obtain the same congruence $x^2 = (qr)^2 \pmod{\frac{Q-P}{f^2}}$.&lt;/p&gt;
&lt;p&gt;Since we already know one solution to $x$ (which is $qr$), then the other solutions can be determined quite easily.&lt;/p&gt;
&lt;p&gt;To solve $x^2 = a^2 \pmod m$, factor $m$ into its prime factors $p_1^{k_1} \times p_2^{k_2} \times \ldots \times p_n^{k_n}$.
Then solve $x^2 = a^2 \pmod{p^k}$ for each prime factor $p$ of $m$. Lastly, merge them using CRT.
Since $qr$ and $Q-P$ are coprime, we assume that $a$ and $m$ are coprime too.&lt;/p&gt;
&lt;h5 id=&#34;solving-x2--a2-pmod-2k&#34;&gt;Solving $x^2 = a^2 \pmod {2^k}$&lt;/h5&gt;
&lt;p&gt;Three cases:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;$k = 1$: Only one solution to $x$, namely $x = 1$.&lt;/li&gt;
&lt;li&gt;$k = 2$: Two solutions, namely $x = 1$ and $x = 3$.&lt;/li&gt;
&lt;li&gt;$k &amp;gt; 2$: Four solutions, $x = a \pmod {2^k}$, $x = -a \pmod {2^k}$ $x = a + 2^{k-1} \pmod {2^k}$, $x = -a + 2^{k-1} \pmod {2^k}$.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Proves are left to the readers.&lt;/p&gt;
&lt;h5 id=&#34;solving-x2--a2-pmod-pk-where-p-odd-primes&#34;&gt;Solving $x^2 = a^2 \pmod {p^k}$ where $p$ odd primes.&lt;/h5&gt;
&lt;p&gt;Only two solutions exist: $x = a \pmod {p^k}$ and $x = -a \pmod {p^k}$.&lt;/p&gt;
&lt;p&gt;At this point, we already have a way to obtain all $z$ quickly.
Apply PQa with $P_0 = z$, $Q_0 = \frac{N}{f^2}$, $D = D$ until we find the first $(f \times G_i)^2 - (f \times Q_i)^2 = N$ (refer to the paper above for more explanations)&lt;/p&gt;
&lt;p&gt;We also have to find sufficiently many solutions to $x^2 - Dy^2 = 1$ to generate the solutions from the fundamentals above.
With these, the solution to the original equation can be found.&lt;/p&gt;
</description>
		</item>
		<item>
			<title>On Prime Counting in Sublinear Time</title>
			<link>https://prabowo02.github.io/posts/prime-counting/</link>
			<pubDate>Sun, 22 Dec 2019 14:00:39 +0800</pubDate>
			<guid isPermaLink="true">https://prabowo02.github.io/posts/prime-counting/</guid>
			<description>&lt;p&gt;We are to count how many prime numbers are there up to $N$ ($N \leq 10^{11}$).&lt;/p&gt;
&lt;h2 id=&#34;computation&#34;&gt;Computation&lt;/h2&gt;
&lt;p&gt;Let $\pi(N)$ be the number of primes up to $N$, and $f(n, p)$ be the number of integers $x$, for $2 \leq x \leq N$, such that it contains no prime factor $&amp;lt; p$.&lt;/p&gt;
&lt;p&gt;If $p$ is not prime, then $f(n, p) = f(n, p-1)$. Otherwise:&lt;/p&gt;
&lt;p&gt;\begin{align}
f(n, p) = f(n, p-1) - \left(f\Big(\big\lfloor\frac{n}{p} \big\rfloor, p-1\Big) - \pi(p-1)\right)
\tag{1}
\end{align}&lt;/p&gt;
&lt;p&gt;The value $f(\lfloor\frac{n}{p} \rfloor, p-1) - \pi(p-1)$ gives the number of integer $\leq N$ that has $p$ as its prime factor but no prime factor $&amp;lt; p$. In other words, it is subtracting $|\{pk | 1 \leq k \leq n/p, \forall_{\text{prime }q  &amp;lt; p} q \nmid k \}|$ from $f(n, p-1)$.&lt;/p&gt;
&lt;p&gt;Our goal is to compute $\pi(N) = f(N, \sqrt N)$.&lt;/p&gt;
&lt;h3 id=&#34;implementation&#34;&gt;Implementation&lt;/h3&gt;
&lt;p&gt;The idea is similar to the standard prime sieving: eliminate all numbers that is multiple of $2, 3, 5, \ldots, \sqrt N$.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Denote &lt;code&gt;dp[n]&lt;/code&gt; as an array to store the number of primes up to $n$, and initiate the array &lt;code&gt;dp[n]&lt;/code&gt; $= f(n, 1) = n-1$ for all unique values of $\lfloor \frac{N}{i} \rfloor$ (there are $O(\sqrt N) $such values).&lt;/li&gt;
&lt;li&gt;For every prime $p$ in the range $[2, N]$, update &lt;code&gt;dp[n] -= dp[n/p] - dp[p-1]&lt;/code&gt;, for all unique values of $n = \lfloor \frac{N}{i} \rfloor$ and $n \geq p^2$.
&lt;ul&gt;
&lt;li&gt;This is because when iterating prime $p$, all values of &lt;code&gt;dp[n]&lt;/code&gt; is storing $f(n, p-1)$. In particular, for $n &amp;lt; p^2$, it is already storing the number of primes up to &lt;code&gt;n&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Therefore, the operation &lt;code&gt;dp[n] -= dp[n/p] - dp[p-1]&lt;/code&gt; is actually performing the equation from $(1)$.&lt;/li&gt;
&lt;li&gt;By the end of this iteration, &lt;code&gt;dp[n]&lt;/code&gt; will store $f(n, p)$.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Return &lt;code&gt;dp[N]&lt;/code&gt; as our answer.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;pseudo-code&#34;&gt;Pseudo Code&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-cpp&#34; data-lang=&#34;cpp&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;primeCounting&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; N) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Ni &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; sort_descending(unique([N&lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt;i &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; i in [&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; .. N]]))
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; (n: Ni) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    dp[n] &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; n&lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; (p &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;; p&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;p &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;=&lt;/span&gt; N; &lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;p) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (dp[p] &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; dp[p&lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;]) &lt;span style=&#34;color:#66d9ef&#34;&gt;continue&lt;/span&gt;; &lt;span style=&#34;color:#75715e&#34;&gt;// p is not a prime
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; (n: Ni) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (n &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; i&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;i) &lt;span style=&#34;color:#66d9ef&#34;&gt;break&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      dp[n] &lt;span style=&#34;color:#f92672&#34;&gt;-=&lt;/span&gt; dp[n&lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt;p] &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; dp[p];
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; dp[N];
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;complexity&#34;&gt;Complexity&lt;/h3&gt;
&lt;p&gt;It can be seen that the transition operation of $(1)$ is $O(1)$. Therefore, we just need to compute the space of $f(n, p)$.&lt;/p&gt;
&lt;p&gt;There are two cases:&lt;/p&gt;
&lt;h4 id=&#34;case-1-n-leq-sqrt-n&#34;&gt;Case 1: $n \leq \sqrt N$&lt;/h4&gt;
&lt;p&gt;All values of $n \leq \sqrt N$ exists in the set $\{ \lfloor \frac{N}{i} \rfloor \}$, and for each $n$, only $p^2 \leq n$ will be considered.&lt;/p&gt;
&lt;p&gt;Therefore the overall time complexity for this case:&lt;/p&gt;
&lt;p&gt;$$ \sum_{i=1}^{\sqrt N} \sqrt i = O\left( \int_1^{\sqrt N} \sqrt x \, dx \right) = O(N^{3/4})$$&lt;/p&gt;
&lt;h4 id=&#34;case-2-n--sqrt-n&#34;&gt;Case 2: $n &amp;gt; \sqrt N$&lt;/h4&gt;
&lt;p&gt;The values of $n$ in this case is $\frac{N}{1}, \frac{N}{2}, \ldots, \frac{N}{\sqrt N}$. Since every $n$ needs to consider all $p^2 \leq n$, the time complexity for this case is:&lt;/p&gt;
&lt;p&gt;$$ \sum_{i=1}^{\sqrt N} \sqrt{\frac{N}{i}} = O\left(\sqrt N \int_1^{\sqrt N} \frac{1}{\sqrt x} \, dx \right) = O(N^{3/4})$$&lt;/p&gt;
&lt;h4 id=&#34;total-complexity&#34;&gt;Total Complexity&lt;/h4&gt;
&lt;p&gt;Since the complexity for both cases are the same, the total complexity is $O(N^{3/4})$&lt;/p&gt;
&lt;h2 id=&#34;remarks&#34;&gt;Remarks&lt;/h2&gt;
&lt;h3 id=&#34;speeding-up-computation&#34;&gt;Speeding Up Computation&lt;/h3&gt;
&lt;p&gt;It seems that we can speed up the computation by precomputing the first few prime numbers using the standard sieve of eratosthenes. Precompute the first $f(n, p)$ for $n \leq N^{2/3}$, then for the rest of the $n$, use the same iteration as above. This should run in a little more than $O(N^{2/3})$.&lt;/p&gt;
&lt;h3 id=&#34;other-usages&#34;&gt;Other Usages&lt;/h3&gt;
&lt;p&gt;With a few tweaks, we can compute the following with the same method:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Sum of prime up to $n$.&lt;/li&gt;
&lt;li&gt;Sum of prime of the form $4k + 1$ up to $n$.&lt;/li&gt;
&lt;li&gt;Totient summatory function up to $n$.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Looks like it is also possible to further generalize this method using the Dirichlet Hyperbola method.&lt;/p&gt;
&lt;h2 id=&#34;references&#34;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://en.wikipedia.org/wiki/Prime-counting_function#The_Meissel%E2%80%93Lehmer_algorithm&#34;&gt;The Meissel-Lehmer algorithm&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://math.stackexchange.com/questions/316376/how-to-calculate-these-totient-summation-sums-efficiently&#34;&gt;Efficient Totient Summatory Function&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://math.stackexchange.com/questions/1378286/find-the-sum-of-all-primes-smaller-than-a-big-number&#34;&gt;Sum of primes smaller than a big number&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://en.wikipedia.org/wiki/Dirichlet_hyperbola_method&#34;&gt;Dirichlet Hyperbola Method&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
		</item>
		<item>
			<title>Binomial Modulo Prime Power</title>
			<link>https://prabowo02.github.io/posts/binomial-mod-pe/</link>
			<pubDate>Wed, 04 Dec 2019 16:03:30 +0800</pubDate>
			<guid isPermaLink="true">https://prabowo02.github.io/posts/binomial-mod-pe/</guid>
			<description>&lt;p&gt;This is an attempt to translate &lt;a href=&#34;https://min-25.hatenablog.com/entry/2017/11/01/185400&#34;&gt;min_25&amp;rsquo;s article&lt;/a&gt; with the help of Google Translate, and with a bit of modification.&lt;/p&gt;
&lt;p&gt;Our goal is to solve ${n \choose m} \pmod{p^e}$, ($n, m, p^e &amp;lt; 10^{300}$, $p$: prime number).&lt;/p&gt;
&lt;p&gt;The method differ from Andrew Granville&amp;rsquo;s Binomial Coefficients modulo prime powers (&lt;a href=&#34;https://web.archive.org/web/20170202003812/http://www.dms.umontreal.ca/~andrew/PDF/BinCoeff.pdf&#34;&gt;BinCoeff.pdf&lt;/a&gt;). &lt;br&gt;
After precomputation, the number of operation to compute ${n \choose m} \pmod{p^e}$ is reduced from $O\left(e^2\left(\frac{\log n}{\log p} + \min(\log n, \log p)\right)\right)$ to $O(e \log n)$.&lt;/p&gt;
&lt;p&gt;For the rest of the article, denote ${n \brack m}$ as &lt;a href=&#34;https://en.wikipedia.org/wiki/Stirling_numbers_of_the_first_kind&#34;&gt;Stirling number of the first kind&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;computation-method&#34;&gt;Computation Method&lt;/h3&gt;
&lt;p&gt;Define $(n!)_p$ as the product of all positive integers $i \not\equiv 0 \pmod p$ for all $1 \leq i \leq n$. Our goal is to compute $(n!)_p \pmod {p^e}$.&lt;/p&gt;
&lt;p&gt;Let $n = up + v$ where $u, v$ non-negative integers and $0 \leq v &amp;lt; p$.&lt;/p&gt;
&lt;p&gt;For simplicity, we assume that $e &amp;lt; p$,&lt;/p&gt;
&lt;p&gt;$$
\begin{align*}
((up+v)!)_p &amp;amp;= \left( \prod_{i=0}^{u-1} \prod_{j=1}^{p-1} (ip+j) \right) \cdot \prod_{j=1}^v (up + j) \\\
&amp;amp;\equiv \left(\prod_{i=0}^{u-1} \left( \sum_{k=0}^{e-1} (ip)^k {p \brack {k+1}}\right)\right) \cdot \left(\sum_{k=0}^{e-1}(up)^k {{v+1} \brack {k+1}}\right) \pmod {p^e} \\\
&amp;amp;= {p \brack 1}^u \left(\prod_{i=0}^{u-1}\left( 1 + \sum_{k=1}^{e-1} \frac{{p \brack {k+1}}}{{p \brack 1}}(ip)^k \right) \right) \cdot \left( \sum_{k=0}^{e-1} (up)^k {{v+1} \brack {k+1}} \right) \\\
&amp;amp;= {p \brack 1}^u f_{p,e}(u) \left( \sum_{k=0}^{e-1} (up)^k {{v+1} \brack {k+1}} \right)
\end{align*}
$$&lt;/p&gt;
&lt;p&gt;It can be shown that $f_{p, e}$ is a polynomial of degree $(2e - 2)$ (proven below). By calculating the value of $f_{p, e}(0), \ldots, f_{p, e}(2e-2)$, the value of $f_{p, e}(u)$ can be computed in $O(e \log n)$ using &lt;a href=&#34;https://en.wikipedia.org/wiki/Lagrange_polynomial&#34;&gt;Lagrange interpolation&lt;/a&gt; (in $O(e)$ if you precompute the modular inverses).&lt;/p&gt;
&lt;h4 id=&#34;implementation-and-time-complexity&#34;&gt;Implementation and Time Complexity&lt;/h4&gt;
&lt;p&gt;First, compute the &lt;a href=&#34;https://en.wikipedia.org/wiki/P-adic_order&#34;&gt;$p$-adic valuation&lt;/a&gt; of ${n \choose m}$. If it is not less than $e$, then the modulo is 0. Otherwise, we factor out all the $p$ factors in $n!, m!, (n-m)!$ then we compute the factorials, and multiply with the $p$ factors at the end of the ${n \choose m}$ computation below.&lt;/p&gt;
&lt;p&gt;After the 0 case handling, we do the steps as follow:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;${n \brack m} (1 \leq n \leq p, 1 \leq m \leq \min(p, e))$ is precomputed in $O(p \cdot \min(p, e))$&lt;/li&gt;
&lt;li&gt;$f_{p, e}(0), \ldots, f_{p, e}(2e-2)$ for interpolation are precomputed in $O(e \cdot \min(p, e) + e \log p)$&lt;/li&gt;
&lt;li&gt;Computation of $n!$ without the factor $p$ can be done by $\sum_{k=0}^\infty \left(\left\lfloor\frac{n}{p^k}\right\rfloor_p\right)!$ in $O(e \log n)$&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In total, there are around $O(pe + e^2 + e \log n)$ time complexity to compute ${n \choose m}$&lt;/p&gt;
&lt;h4 id=&#34;proof-that-f_p-e-is-a-polynomial&#34;&gt;Proof that $f_{p, e}$ is a polynomial&lt;/h4&gt;
&lt;p&gt;For any $e, p$ $(e \geq 1, p \geq 2)$, let $a_k$ be a rational number that exists under modulo $p$. Let,&lt;/p&gt;
&lt;p&gt;$$ g(x, u) := \prod_{i=0}^{u-1} \left( 1 + \sum_{k=1}^{e-1} a_k (xi)^k \right) $$&lt;/p&gt;
&lt;p&gt;Let $b_k$ be some other rational number satisfying:&lt;/p&gt;
&lt;p&gt;$$
\begin{align*}
\log(g(x, u)) &amp;amp;= \sum_{i=0}^{u-1} \log\left( 1 + \sum_{k=1}^{e-1} a_k(xi)^k \right) \\\
&amp;amp;= \sum_{i=0}^{u-1} \sum_{k=0}^\infty b_k x^k i^k \\\
&amp;amp;= \sum_{k=1}^\infty b_k x^k s_k(u)
\end{align*}
$$&lt;/p&gt;
&lt;p&gt;where $s_k(x) = \sum_{i=0}^x i^k$ is a polynomial of degree $k+1$. Continuing from above,&lt;/p&gt;
&lt;p&gt;$$
\begin{align*}
g(x, u) &amp;amp;= \exp\left( \sum_{k=1}^\infty b_k x^k s_k(u) \right) \\\
&amp;amp;= 1 + \sum_{k=1}^\infty t_k(u) x^k
\end{align*}
$$&lt;/p&gt;
&lt;p&gt;where $t_k(u)$ is a polynomial of degree $2k$, because the highest polynomial degree obtained at $x^k$ is from $(b_1 x s_1(u))^k$. The coefficients of $t_k(u)$ are also rational number which exists under modulo $p$.&lt;/p&gt;
&lt;p&gt;Substituting $x = p$ gives us the polynomial of $f_{p, e}(u)$:&lt;/p&gt;
&lt;p&gt;$$ g(p, u) \equiv 1 + \sum_{k=1}^{e-1} t_k(u) \cdot p^k \pmod{p^e} $$&lt;/p&gt;
&lt;p&gt;Therefore, $f_{p, e}(x)$ is a polynomial of degree $(2e - 2)$.&lt;/p&gt;
&lt;h3 id=&#34;remark&#34;&gt;Remark&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;If $p$ is prime, ${p \brack i}$ $(2 \leq i &amp;lt; p)$ is divisible by $p$.&lt;/li&gt;
&lt;li&gt;If $p \geq 5$, ${p \brack 2}$ is divisible by $p^2$&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Using these properties, looks like it is possible to further reduce the degree of $f_{p, e}(x)$.&lt;/p&gt;
&lt;h3 id=&#34;source-codes&#34;&gt;Source Codes&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;min_25&amp;rsquo;s implementation using &lt;a href=&#34;https://gist.github.com/min-25/a5496354e10064a581d6b0c52c727a26&#34;&gt;Python&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;My implementation using &lt;a href=&#34;https://github.com/prabowo02/CP/blob/master/binomial_mod_pe.cpp&#34;&gt;C++&lt;/a&gt; (but it is not using big integer, only &lt;code&gt;__int128&lt;/code&gt;, so it can only support for $n$ up to $10^{18}$).&lt;/li&gt;
&lt;/ul&gt;
</description>
		</item>
		<item>
			<title>Project Euler #242</title>
			<link>https://prabowo02.github.io/posts/project-euler-242/</link>
			<pubDate>Fri, 29 Nov 2019 12:15:14 +0800</pubDate>
			<guid isPermaLink="true">https://prabowo02.github.io/posts/project-euler-242/</guid>
			<description>&lt;p&gt;This post will give the analysis to &lt;a href=&#34;https://www.hackerrank.com/contests/projecteuler/challenges/euler242/problem&#34;&gt;Project Euler #242&lt;/a&gt; from hackerrank, which is an extended version from the &lt;a href=&#34;https://projecteuler.net/problem=242&#34;&gt;original&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;problem-statement&#34;&gt;Problem Statement&lt;/h3&gt;
&lt;p&gt;Given 5 integers $m$, $r$, $n$, $k$, and $M$, count the number of k-subsets of $\{1, 2, \ldots, n\}$ such that the sum of the subset is $r \pmod m$. Let the answer be $S$, output $S \times m$ modulo $M$.&lt;/p&gt;
&lt;h4 id=&#34;constraints&#34;&gt;Constraints&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;$2 \leq m \leq 10^{11}$&lt;/li&gt;
&lt;li&gt;$0 \leq r \leq m$&lt;/li&gt;
&lt;li&gt;$1 \leq k \leq n \leq 10^{18}$&lt;/li&gt;
&lt;li&gt;For each positive divisor $d$ of $m$: $n \mod d \leq k \mod d$&lt;/li&gt;
&lt;li&gt;$2 \leq M \leq 2^{62}$&lt;/li&gt;
&lt;li&gt;The largest prime factor of $M$ is less than $10^5$&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;solution&#34;&gt;Solution&lt;/h3&gt;
&lt;p&gt;This is actually an extended version of &lt;a href=&#34;https://www.imo-official.org/year_info.aspx?year=1995&#34;&gt;IMO 1995 P6&lt;/a&gt; (having $m = p$, $n = 2p$, $k = p$, $r = 0$). A discussion to this problem can be found in &lt;a href=&#34;https://artofproblemsolving.com/community/c6h15112p107230&#34;&gt;AOPS&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Back to the original problem, consider the generating function $(1 + xy)(1 + xy^2) \ldots (1 + xy^n)$. Our answer will be the sum of coefficients of $x^k y^r, x^k y^{r+m}, x^k y^{r+2m}, \ldots$.&lt;/p&gt;
&lt;p&gt;To get this sum, we use the &lt;a href=&#34;https://en.wikipedia.org/wiki/Series_multisection&#34;&gt;Series Multisection&lt;/a&gt; formula on the y coefficients, then our generating function become:&lt;/p&gt;
&lt;p&gt;$$\frac{1}{m} \sum_{l=0}^{m-1} \left( \omega^{-lr} \prod_{i=1}^n (1 + x\omega^{li}) \right)$$&lt;/p&gt;
&lt;p&gt;where $\omega$ is the primitive $m$-th root of unity. Since the final answer will be multiplied by $m$, the $\frac{1}{m}$ will be ignored for the rest of this post. Now our goal is to find the coefficient of $x^k$ from that equation.&lt;/p&gt;
&lt;p&gt;Using the &lt;a href=&#34;http://mathworld.wolfram.com/CauchyBinomialTheorem.html&#34;&gt;Cauchy Binomial Theorem&lt;/a&gt;, we convert our equation above to:&lt;/p&gt;
&lt;p&gt;$$\sum_{l=0}^{m-1} \left( \omega^{-lr} \sum_{i=0}^n x^i \omega^{li(i+1)/2} {n \brack i}_{\omega^l} \right)$$&lt;/p&gt;
&lt;p&gt;Since we only care with the $x^k$ coefficient, then the answer to our original problem is the evaluation of:&lt;/p&gt;
&lt;p&gt;$$ \sum_{i=0}^{m-1} \left( (\omega^{i})^{k(k+1)/2 - r} {n \brack k}_{\omega^i} \right) $$&lt;/p&gt;
&lt;p&gt;We will compute the sum for each primitive of $\omega^i$ separately. Denote $\omega_d$ as the primitive $d$-th root of unity. Also note the &lt;a href=&#34;https://www.math.upenn.edu/~peal/polynomials/q-analogues.htm#prelimQanaloguesQLucas&#34;&gt;q-Lucas theorem&lt;/a&gt;: ${n \brack k}_{\omega_d} = {\lfloor n/d \rfloor \choose \lfloor k/d \rfloor } {n \mod d \brack k \mod d}_{\omega_d}$. &lt;br&gt;
Since $n \mod d \leq k \mod d$, the value of ${n \mod d \brack k \mod d} = 1$ if $n \equiv k \pmod d$, $0$ otherwise. &lt;br&gt;
With these in mind, we rewrite our equation to:&lt;/p&gt;
&lt;p&gt;$$ \sum_{d|m} \left( \sum_{(d, i) = 1}^d (\omega_d^i)^{k(k+1)/2 - r}  {n \choose k}[n \equiv k \pmod d] \right) $$&lt;/p&gt;
&lt;p&gt;where $[]$ is the &lt;a href=&#34;https://en.wikipedia.org/wiki/Iverson_bracket&#34;&gt;Iverson bracket&lt;/a&gt;. Recall that the sum of $k$-th power of the $d$-th root of unity is $\frac{\mu(d / \gcd(k, d)) \varphi(d)}{\varphi(d / \gcd(k, d))}$, where $\mu$ is the &lt;a href=&#34;https://en.wikipedia.org/wiki/M%C3%B6bius_function&#34;&gt;Möbius function&lt;/a&gt; and $\varphi$ is the &lt;a href=&#34;https://en.wikipedia.org/wiki/Euler%27s_totient_function&#34;&gt;Euler&amp;rsquo;s Totient function&lt;/a&gt;. &lt;br&gt;
Therefore, our final answer is:&lt;/p&gt;
&lt;p&gt;$$ \sum_{d|m} \left( \frac{\mu\left(\frac{d}{\gcd(k(k+1)/2 - r, d)}\right) \varphi(d)}{\varphi\left(\frac{d}{\gcd(k(k+1)/2 - r, d)}\right)} {n \choose k}[n \equiv k \pmod d] \right) $$&lt;/p&gt;
&lt;p&gt;And now, for the computational part. Compute the final sum for every prime factor of $M$, then combine the answers using &lt;a href=&#34;https://en.wikipedia.org/wiki/Chinese_remainder_theorem&#34;&gt;Chinese Remainder Theorem&lt;/a&gt;. The computation of binomial theorem modulo $p^e$ can be computed in $O(e(p + e + \log n))$, which is described in this &lt;a href=&#34;https://prabowo02.github.io/posts/binomial-mod-pe&#34;&gt;post&lt;/a&gt;. &lt;br&gt;
The computation of the divisors of $m$ and all its mobius and euler totient values can be computed in $O(\sqrt m)$&lt;/p&gt;
&lt;p&gt;Therefore, the overall complexity is $O(\sqrt m + \log M \log n)$.&lt;/p&gt;
</description>
		</item>
		<item>
			<title>About</title>
			<link>https://prabowo02.github.io/about/</link>
			<pubDate>Fri, 29 Nov 2019 12:08:03 +0800</pubDate>
			<guid isPermaLink="true">https://prabowo02.github.io/about/</guid>
			<description>&lt;p&gt;My real name is Prabowo Djonatan. &lt;br&gt;
I usually go by the username prabowo on several online judges:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://codeforces.com/profile/Prabowo&#34;&gt;Codeforces&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://atcoder.jp/users/prabowo&#34;&gt;AtCoder&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.hackerrank.com/Prabowo&#34;&gt;Hackerrank&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://open.kattis.com/users/prabowo&#34;&gt;Kattis&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://tlx.toki.id/profiles/prabowo&#34;&gt;TLX&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://csacademy.com/user/prabowo&#34;&gt;CS Academy&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I set various problems for Informatics competitions and olympiads.
The list can be found &lt;a href=&#34;https://prabowo02.github.io/problems&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;About the content of this blog, I will mostly talk about algorithms.&lt;/p&gt;
</description>
		</item>
	</channel>
</rss>
