Weird Algorithm
Generate the Collatz sequence starting from n and print every value until the sequence reaches 1.
Short constructive, simulation, and arithmetic tasks that make good first passes for the archive. Official CSES statements are linked on every page instead of being mirrored here.
Solved pages include an original summary, rendered editorial, optional pseudocode, complexity analysis, and the exact `solution.cpp` source file.
Generate the Collatz sequence starting from n and print every value until the sequence reaches 1.
One value from 1 through n is absent from the input list; recover it without sorting.
Find the longest contiguous block of equal characters in the given string.
Count the minimum total increment needed to make the array non-decreasing.
Construct a permutation of 1 through n where neighboring values never differ by exactly 1.
For each grid coordinate, compute the value stored there in the square spiral without simulating the whole grid.
For every board size from 1 to n, count how many ways two knights can be placed without attacking each other.
Split 1 through n into two groups with equal sum, or report that such a partition does not exist.
Count how many binary strings of length n exist, modulo 1e9+7.
Count how many zeros appear at the end of n! without computing the factorial itself.
Decide whether two piles can both be emptied when each move removes two coins from one pile and one coin from the other.
Rearrange the letters into a palindrome when possible, otherwise report that no such arrangement exists.
Print all n-bit Gray codes so that consecutive strings differ in exactly one bit.
Print the minimum sequence of moves that transfers all disks from the first peg to the third peg.
Enumerate every distinct permutation of the given string in lexicographic order.