2095A — Piecing It Together
Credits: flamestorm
If you complete the puzzle, you will get a line of Python code reading $$$\texttt{print("puzzling")}$$$. To solve the problem, you just need to print $$$\texttt{puzzling}$$$.
#include <bits/stdc++.h>
using namespace std;
void solve() {
cout << "puzzling\n";
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
solve();
}
print("puzzling")
2095B — Plinko
Credits: AlperenT
In this problem you need to drop a ball from a column of your choosing and get it to the green area.
With simple analysis (similar to Pascal's triangle), one can notice that best chance of winning is by dropping the ball from column $$$0$$$ or $$$16$$$ where you get $$$\frac{1}{2}$$$ chance to win. This means expected number of plays to win $$$10$$$ times is $$$2^{10} = 1024$$$, which is a lot (technically though, it is $$$2^{9} = 512$$$ as the first game always wins for penalty reasons).
However, one can notice that the green area spans further than columns $$$0$$$ to $$$16$$$. This allows one to win simply by dropping the ball from any column outside that range.
If anyone got accepted by chance using columns $$$[0, 16]$$$, please write in comments.
Lastly, if you have not noticed already, this was a hint for this problem.
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <vector>
typedef long long ll;
typedef long double ld;
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout << "-10000\n";
return 0;
}
2095C — Would It Be Unrated?
Credits: prvocislo
To solve this problem, you just need to do what the task asks — output the number of tests in this problem.
How do you do that? Well, if nobody has gotten accepted yet, there is not much you can do besides guess the answer through brute force.
However, you can just wait for someone else to do this tedious work for you. As soon as there is at least one accepted submission, you can use a trick:

This box on the status page will let you filter for submissions based on their failing test. If a submission got accepted, then it will show up if you query any number, as long as that number doesn't exceed the number of tests. This means that you can use this to binary search on the answer — keep cutting down the search space until you find the largest value that still shows at least one accepted submission.
Another way to get a reasonable estimate of the number of testcases are to watch as someone's accepted submission gets judged (running on test x), or to look at how many tries it took people to get accepted (assuming they start guessing from $$$1$$$, it should be around $$$140$$$).
Trivia: By writing print(143) in Python (or an equivalent in another language), you can solve both problems B and C in just $$$10$$$ characters!
Trivia 2: Some time during contest, a mysterious contestant AprilFoolsClairvoyant from the future submitted the first accepted. Such behaviour is unacceptable as time machines are prohibited by the codeforces rules, so we quickly disqualified him.
print(143)
2095D — Where Am I?
In this problem, as can be understood from the name "Where am I?", you need to find the location of the photo.
From the output style (two real numbers, first in $$$[-90, 90]$$$ and second in $$$[-180, 180]$$$), we can deduce that the problem is asking for the latitude and the longitude of the location. Given an answer, the checker returns the distance (using Haversine formula) to the actual location and accepts an answer if it is closer than 100 meters.
Easiest way to solve this problem is to just examine the photo. The first obvious thing is the "New York" sign. Do not be fooled though, the location is not in New York. A closer examination allows us to see the "Las Vegas" sign and a quick google search gives us the "New York-New York Hotel & Casino" in Las Vegas.
Knowing this and analyzing the angle of the photo we can find the exact location using street view on Google Maps (although any other map should be fine).
This gives us the coordinates $$$36.104300, -115.172835$$$, which should give accepted (however any location nearby by 100 meters is accepted as to not cause annoyance.)
Additionally, it is possible to solve this problem with different methods without even looking at the photo as the checker returns the distance. Feel free to write your ideas in the comments and we can add them here.
#include <bits/stdc++.h>
using namespace std;
int main(){
cout << "36.104300 -115.172835";
}
2095E — Pair Count
Credits: temporary1
If you click on the link to the bitwise XOR operation, you will actually be taken to a Wordle. Solving it will give you the answer $$$\texttt{MULTIPLY}$$$ (Since you can submit non-English words, and you have infinite tries (The page actually only allows 6 tries, but you can get around this by revisiting the page in incognito mode), the solution is actually relatively straightforward — you can find all the letters and where they appear by submitting strings each consisting of the same letter, then just combine all the guesses.). Thus $$$\oplus$$$ actually denotes the multiply operation.
So the solution is actually to find the number pairs of indexes $$$(i, j)$$$ for which $$$a_i^3 a_j^3 \equiv k \bmod p$$$. We can do this in $$$\mathcal{O}(n \log n + n \log p)$$$ time if we go from left to right and, for each $$$j$$$, count the number of $$$i$$$ such that $$$a_i^3 \equiv k a_j^{-3} \bmod p$$$ by keeping a map storing how frequent each $$$a_j^3$$$ was so far.
Note that there is an edge case when $$$k = 0$$$ which you should handle separately.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int a[300005];
ll power(ll x, int n, int p) {
x %= p;
ll res = 1;
while (n) {
if (n&1)res = (res*x)%p;
x = (x*x)%p;
n >>= 1;
}
return res;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, p, k;
cin >> n >> p >> k;
for (int i = 1; i <= n; ++i) {
cin >> a[i];
}
if (k == 0) {
cout << (*min_element(a+1,a+n+1) == 0 ? n-1 : 0) << '\n';
return 0;
}
map<int,int> mp;
ll ans = 0;
for (int i = 1; i <= n; ++i) {
if (a[i] == 0)continue;
int x = power(a[i],3,p);
int inv = power(x,p-2,p);
ans += mp[(k*(ll)inv)%p];
++mp[x];
}
cout << ans << '\n';
return 0;
}
2095F — ⅓ оf а Рrоblеm
Credits: flamestorm
$$$\frac{1}{3}$$$ of the problem is in the English statement, and the other $$$\frac{2}{3}$$$ is in the Russian statement. (This is hinted because the title of the problem in English has some Cyrillic characters, and the title of the problem in Russian has some Latin characters. These characters look identical, but if you search the text up, you'll notice the results are quite strange — because some of the characters are in a different script!)
Combining them, noting that the Russian part should go first to make sense, gives the expression $$$12a + 14ab + |a - b| + (a - 3b) b + 2$$$, which is what you should compute.
print((lambda a, b: 12*a + 14*a*b + abs(a - b) + (a - 3*b) * b + 2)(*map(int, input().split())))
2095G — Definitely a Geometry Problem
Credits: ToxicPie9
No three slimes lie on the same circle, so in fact all of them lie on the same line.
This means that you only need to sort the slimes $$$s_1, \dots, s_n$$$, and find the smallest diameter $$$d := \min_{1 \leq i \leq n-k+1} \text{dist}(s_i, s_{i+k-1})$$$. Then we just need to output $$$\pi \frac{d^2}{4}$$$.
import Data.List (sort)
dist :: [Int] -> [Int] -> Double
dist [x1, y1] [x2, y2] = hypot (fromIntegral (x1 - x2)) (fromIntegral (y1 - y2))
where hypot x y = sqrt (x * x + y * y)
solve :: Int -> [[Int]] -> Double
solve k points = min_r * min_r * pi
where
min_d = minimum $ zipWith dist points (drop (k - 1) points)
min_r = min_d / 2
main :: IO ()
main = do
[_n, k] <- (map read . words) <$> getLine
points <- (map (map read . words) . lines) <$> getContents
print $ solve k (sort points)
2095H — Blurry Vision
Credits: AlperenT
import cv2
import numpy as np
from scipy.signal import wiener
def gaussian_kernel(size, sigma):
k = cv2.getGaussianKernel(size, sigma)
kernel = np.outer(k, k)
return kernel
def wiener_deconvolution(blurred, kernel, noise_power=0.000005):
kernel /= np.sum(kernel)
img_fft = np.fft.fft2(blurred)
kernel_fft = np.fft.fft2(kernel, s=blurred.shape)
kernel_fft_conj = np.conj(kernel_fft)
denominator = kernel_fft * kernel_fft_conj + noise_power
result_fft = (img_fft * kernel_fft_conj) / denominator
result = np.fft.ifft2(result_fft).real
return np.clip(result, 0, 255).astype(np.uint8)
def deblur_image(path, kernel_size, sigma):
blurred = cv2.imread(path, cv2.IMREAD_GRAYSCALE)
kernel = gaussian_kernel(kernel_size, sigma)
deblurred = wiener_deconvolution(blurred, kernel)
cv2.imwrite("deblurred.png", deblurred)
deblur_image("blurred.png", 25, 7)
2095I — Mysterious Script
Credits: ToxicPie9
The Balikons use base-9 numbers. This can be easily seen from the very important Figure 1 which clearly shows that the species has 9 fingers.
Now we need to know how to read the mysterious script. Except weird diagonal attachments which work as word ending markers, all characters are formed by horizontal and vertical strokes. In fact, each unique set of horizontal or vertical strokes has its own reading, and a character's reading is a defined by its horizontal and vertical components. For more information see Figure 2.
Observe that numbers are denoted by words that end with -s. We can see that characters used as digits all have a specific form: two long horizontal strokes and two long vertical strokes. Also, notice that each Balikon character resembles a 3x3 grid. Combining these and the base-9 fact, we can see that each digit character creates a square on the grid. From all digits in the example (1, 2, 3, 5, 6, 7) we can see that the numbers are ordered from top to bottom from left to right.

Figure 2: Balikon script
Now we know all digits in the Balikon script and how to read them.
mod balikon {
#[derive(Debug)]
pub struct BalikonNum(pub u64);
#[derive(Debug)]
pub struct ParseBalikonError;
impl BalikonNum {
const BASE: u64 = 9;
const DIGITS: [&str; Self::BASE as usize] =
["la", "le", "lon", "sha", "she", "shon", "ta", "te", "ton"];
fn parse_inner(s: &str) -> Option<u64> {
if s.is_empty() {
return Some(0);
}
(0..Self::BASE)
.filter_map(|i| {
Self::parse_inner(s.strip_suffix(Self::DIGITS[i as usize])?)
.map(|x| x * Self::BASE + i)
})
.next()
}
}
impl<T> From<T> for BalikonNum
where
u64: From<T>,
{
fn from(value: T) -> Self {
Self(value.into())
}
}
impl std::str::FromStr for BalikonNum {
type Err = ParseBalikonError;
fn from_str(s: &str) -> Result<Self, Self::Err> {
s.strip_suffix("s")
.and_then(Self::parse_inner)
.map(BalikonNum)
.ok_or(ParseBalikonError)
}
}
impl std::fmt::Display for BalikonNum {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut n = self.0;
let mut digits = vec![];
while n > 0 {
digits.push(n % Self::BASE);
n /= Self::BASE;
}
if digits.is_empty() {
digits.push(0);
}
for i in digits.into_iter().rev() {
write!(f, "{}", Self::DIGITS[i as usize])?;
}
write!(f, "s")
}
}
impl std::ops::Add for BalikonNum {
type Output = Self;
fn add(self, rhs: Self) -> Self::Output {
BalikonNum(self.0 + rhs.0)
}
}
}
use balikon::BalikonNum;
fn main() {
let mut input = String::new();
std::io::stdin().read_line(&mut input).expect("what");
let (a, b) = input.trim().split_once(' ').expect("parse error");
let a: BalikonNum = a.parse().expect("parse error");
let b: BalikonNum = b.parse().expect("parse error");
println!("{}", a + b);
}
2095J — Premiere at a Wrong Time
Look at the problem name. What can be premiered at a wrong time?
Yes, the video editorial. Where can you usually find an editorial?
Yes, the blog. In the last paragraphs of the blog, there's a link to the editorial. Click it and watch it carefully.
Is there anything unusual with this editorial?
You're right! Who puts musics while recording a video editorial? Also, Kent mentioned that "the songs we're using as the background music are in our favorite playlist; we enjoy them a lot, and you should definitely check them out!" Figure out what the songs are!
There's still something accessible. Can you find it?
Brilliant idea to steal the solution from the slide! The link is clearly visible in the video. You can manually copy the URL and read it at your end.
In Step 4, you can use Shazam, Google's hum-a-song search, or any other music identification tools, and find that the musics (in playing order) are:
- What's The Problem? (by OSKI)
- 23 (by Diamond Eyes)
- Time (by OVSKY)
- 51 (by THYKIER)
- A&B (by MADZI & ETikka)
- On (by Alisky)
- Code (by MANSHN)
- Forces (by Jim Yosef)
Combining all these words, you'll get "what's the problem 23 time 51 A&B on code forces". As $$$23 \times 51 = 1173$$$, this is asking what 1173A and 1173B are on Codeforces.
If you read the slide, you can find the input and output format of this problem. The input can be either first or second. Therefore, if the input is first, output Nauuo and Votes; otherwise, output Nauuo and Chess.









You're welcome ;).
you need to get banned
G was the best problem "no three slimes lie on the same circle" :skull: :skull: :skull: :skull:
ideas were so creative (especially problem F and J lol) good contest
J is so based lol
I tougth that the req. in 3 meanth that all n < 3
whoever came up with these deserve a raise, these problems were genius
C was brutal
In Problem B, I actually copy pasted the empty output which gave <0x200b>. Printed 200 and got AC :)
for B, i just printed x and it got AC lol
you are very lucky. i done same but get WA
It because you read in "Game", and print the ASCII of 'e'.
The problems were great; I was having fun.
What is the purpose of ава, the girl on the side image?
to recognize the participant https://codeforces.me/profile/AprilFoolsClairvoyant (it's his avatar) and he submitted the problem C first so you can see his submission and get the number of test cases
Yeah, I saw that. However, I am interested if there's more to the image. Also, it's super unlikely you'll find that alt just from image.
Lol. I saw that I could add an announcement and added smth(the first thing i found on my computer was my avatar). I thought it would help with task J, but it seems like it's just a feature I didn't notice before.
bro we had a heated discussion in the preparation server of why there is an anime girl attached in the announcements :sob:
How do you come up with such problems?
solution for H uses numpy which is an external library .. is it available to be used in codeforces... what other libraries are available for other languages ??
or does that code just mean that use this code on your machine ( where you can have numpy ) to decipher the blur ?
He used it on his machine
ok, makes sense. thank you for the reply.
I noticed that there were 2 announcements
The second announcement leads to an image:
Am I missing something? Or is it just an Easter egg?
Maybe it's just the avatar of AprilFoolsClairvoyant.
AprilFoolsClairvoyant did first AC to problem C, not sure how it could have been useful though
explained in editorial, towards the end "trivia 2"
I just copy pasted the coordinates of new york hotel,Las Vegas from internet and got WA :(
I think you were supposed to print the coordinate(upto 100m range) of the person who took the photograph
yes this is also what I did, I went to google map and then street view and went to the location FROM WHERE photo was taken... and then I got AC
first I entered location of hotel and got WA, which said that you are at some distance which gave me a hint.
Another approach for problem I
0) DON'T look at any image in this problem, because thats useless (i think so... its just for fun)
1) With hint (example) in table 1 and example test, you will get: le → 1, sha → 3, shon → 5, te → 7.
2) Turn 998244358 (in table 1) into base IX so that the number is 2516331737 and you will get: lon → 2 and ta → 6 by using translation of (1): [lon shon le ta sha sha le te sha te s] and "s" in the end is useless (i think).
3) Missing 0, 4, 8. Look closer, you will see a rule:
- At the number 1 and 2 it started with l, at the number 3 and 5 it started with sh, at the number 6 and 7 it started with t. So: 0 → l#, 4 → sh# and 8 → t#.
- At the number 3 and 6 it ended with a, at the number 2 and 5 it ended with e, at the number 1 and 7 it ended with on. So: 0 → #a, 4 → #e, 8 → #on.
- Combine with the above 2 ideas, you will get la → 0, she → 4 and ton → 8
4) Have fun with a + b with base 9 after translating 2 strings into number :)
I actually got AC in B for just printing 0 for three submissions lol
(actually the first and second got idle limit exceeded, so I did it the third time which proved to be a charm)
Frane Salek's luck fr
crazy
what are you doing solving these questions, go invest in stocks LMAO
If there are 10000 participants in round and all of them try to submit 'print(0)', for every such submission there is 1/1024 chance to succeed, then the expected number of ACs on such submissions is around 10.
Although I wasn't able to solve much but I think this was the best April Fools Day Contest ever!!
In problem I, I was convinced that 0 should be "she" (#) because shezali is a dish in traditional Balikon cuisine (and starts with she), similar to meatballs (and 0 is round). Also, the Balikon script of that text contains #, which I assumed is a part of the word shezali :D.
problem J was a absolute genius
Obviously I didn't click the Video Editorial, assuming it was just a rickroll.
Obviously it wasn't the reason I put a rickroll comment on original blog.
Why do people go on the internet and tell lies?
I found the unusual link in E when there's only 10 min left and solved the Wordle in only 2 tries. Wrote the code in 5 min but my last submission (when there's only 29s left) got WA on #19, which was a corner case :(
sorry lmao, when adding the test cases i didnt think too much of it
anyways here are some trivia about E
Anyway it's nothing because I didn't check for k=0 :(
bad luck lol
the problem is also fun
Does any real solution for E exist? I would like to know...
I doubt it since it's hard to separate the xor and multiplication.
dude... changing language to Russian to reveal question was so brutal and genius .. oh man!!!
I wonder if there exists a solution to problem E if ⊕ indeed denotes bitwise XOR operation.
Loved problem I
cursed C
I usually don't participate in April Fools Contests because it is frustrating rather than fun for me. But I do read the editorials afterwards to see what crazy stuff authors came up with this time. And I have to say that G is absolutely amazing. Other problems are also nice this time, except maybe for F.
Deeeeaaaar coooonteeeestaaaant, pleeeeaaaaseeee teeeell meeee theeee nuuuumbeeeer oooof teeeests heeeereeee!! Theeee faaaateeee oooof Apriiiil Fooooooools roooouuuund deeeepeeeend oooon yoooouuuu!!Haahahhahhahahhaha, great testcase for C!!
Bro spent 18 minutes saying "This is incorrect"
Because it's able to see the checker log of test one,you can use binary search to find the anwser of problem D :)
Interesting fact: I is the 9th character of the alphabet which hints towards using base 9 numbers.
Эх, я не подумал вне коробки
During the round the tasks seemed very difficult and unsolvable, but after watching the showdown, it became clear how cool the tasks were thought out and how much effort was put into them. Thank you for the contest!
Interesting fact: The 3rd character of the author's name is e (-1e11) which hints towards using "exceptional out of the box thinking" to solve the problems.
actually printing -1e11 itself solves one of the problems (B) ;)
When I saw I, I was like, “is this the linguistics olympiad?”
Is it pronounced lee shee tee or leh sheh teh
What does it mean by no 3 slimes are in the same circle? Can't you just make a bigger circle? And how does this have anything to do with them all being on the same line?
A circle is not the same as a disk.
W
Can anyone please explain why sorting works in problem G? And why does "no three points lie on the same circle" imply they are in a line? Thanks in advance.
If points do not lie on the same line, you can always draw a circle over those points. You can think of it as circumscribing a circle over a triangle. If points lie on the same, circle will always intersect at most two points (line can't have more than 2 mutual points).
Points on the line are always lie in some order. That's why with sorting we can order them from left-right (or bottom-up if we have the equation $$$x = a$$$). It always optimal to have the circle to intersect the line in the given two points, as otherwise we can decrease the radii (obtaining more optimal answer). We bruteforce $$$i$$$ -th point, considering it as leftmost (or lowest); as we need to have the circle to intersect at least k points, next one gotta be $$$(i + k - 1)$$$ -th.