brain
tamnd's digital brain — notes, problems, research
41641 notes
We start with a population of AI bots arranged in levels. Initially there are only level-n bots, and there are k of them. Time advances in fixed 5-minute steps, and at each step every bot performs exactly one action.
We are given several independent test cases. Each test case is a sequence of integers representing a row of cards.
We are asked to count how many integers in the range from 0 up to a given large number satisfy a positional digit rule. The rule depends on writing each number in decimal and looking at its digits from left to right using 1-based indexing.
We are given a set of coin denominations that follow a very structured pattern: each coin is a number consisting entirely of digit 1, and the lengths grow in a special way. So we get values like 11, 111, 1111, 11111, and so on, continuing indefinitely.
The problem describes a profit process that grows in a very structured way. On the first day Harsh earns nothing, and each next day his daily gain increases by exactly one more unit than the previous increase.
We are given a directed network of cities connected by roads, where each road has a non-negative cost representing how many monsters Phoenix must fight if he travels along it. Phoenix starts at city 1 and must reach city n using any sequence of directed roads.
We are given a string and we are allowed to rearrange its characters arbitrarily. After rearrangement, we want to split the resulting string into several consecutive blocks. Every block must be a palindrome and all blocks must have the same length.
We are given a long sequence of integers, each value lying between 1 and 18. From this sequence we are allowed to pick two contiguous subarrays, and then concatenate them in order to form a new sequence.
We are given a connected undirected graph with $n$ islands and $m$ tunnels. Each island has a cost $ai$, representing the energy needed to perform a ritual if you are currently on that island. Each tunnel connects two islands and has a travel cost.
We are given two permutations of the numbers from 1 to n. The task is to count how many sequences are simultaneously subsequences of both permutations, under a very specific structural constraint.
We are building a simplified membership system that behaves like a hash-filtered set with multiple hash functions. The system stores elements in a binary array of size n, initially all zeros.
We are given a target pattern string $s$ and we want to build strings of length $n$ using lowercase English letters. Inside each constructed string, we look for occurrences of $s$ as contiguous substrings.
We are given a line of n positions, each holding a 15-bit non-negative integer. We are allowed to perform an operation on any adjacent pair of positions.
We are given a tree that comes from a transformation process applied to some directed graph. The process runs a depth-first search, assigns discovery times, maintains a stack of vertices, and whenever a specific low-link condition is met it creates a new auxiliary node and…
We are given a collection of signals. Each signal has two numeric attributes: an energy value and a frequency value. The task is to consider every ordered pair of signals and accumulate a cost defined by a product of two independent parts.
We are given a tree of cities. Each query activates a consecutive block of “movie options”, and each option corresponds to selecting all cities along the unique tree path between two given endpoints.
We are given a set of points on a 2D plane, each representing a coin. A snake starts at the origin and can only move in two directions: right and up, meaning in whatever coordinate system we choose, its x coordinate and y coordinate never decrease along its path.
We are given a small list of numbers, each of which is a power of two. That means every element can be written as $2^{ki}$ where the exponent $ki$ is a small non-negative integer.
We are given a convex polygon that represents an initial infected region on an infinite plane. Over time, the infection expands outward in a very structured but not explicitly geometric way: the only guarantee is that the “shape family” preserves radial ordering from the…
We are given a one-dimensional board of size $N$, where a token starts at cell 1 and wants to reach cell $N$. Between these endpoints, some cells contain “snakes” that push the token left by a fixed amount whenever it lands there.
We are given two rooted binary trees on the same set of vertices labeled from 0 to N−1. The first tree is the initial configuration, and the second tree is the target configuration.
We are given a construction made of $N$ independent parts. Each part has a required standard weight $si$, and the current configuration has weight $ai$.
We are given an array-like buffer of length $2N$, but $N$ is unknown. The structure of this buffer is very specific: the first $N$ positions store nonzero bytes, while the remaining $N$ positions store zeros.
We are given a collection of items, each with a positive size, and a fixed number of scouts. Each item must be assigned to exactly one scout. A scout can carry at most two items, and the load of a scout is the sum of the sizes of items assigned to them.
A rope is initially stretched from the origin to a fixed point on the positive x-axis. We then start rotating this rope counter-clockwise around whichever point is currently acting as its pivot. At the beginning, the pivot is the origin.
We are given a social graph of employees where edges represent mutual acquaintance. The task is to split all employees into three groups such that no two people who know each other end up in the same group.
We are given the final board state of a two-player card game after all six turns have already been played. The board consists of three independent locations. At each location, each player may have placed up to four cards, and each card contributes a fixed power value.
Each electronic component belongs to a type, and every type comes with a processing time. There are multiple copies of each type.
We are given three different dice. Each die has six faces, but the values on those faces are arbitrary integers between 1 and 1000 and can repeat. A game is played by first letting John choose one die, then Hans chooses one of the remaining two dice.
We are given a rooted tree with N vertices, where vertex 1 is the root. The task is to assign each vertex v a positive integer label xv such that ancestry in the tree is encoded purely through divisibility: a vertex u is an ancestor of v if and only if xu divides xv.
We are simulating a turn based game on a long binary string where each position either contains a berry or is empty. A move consists of choosing an index $i$ and removing all berries in the fixed length segment from $i$ to $i+3$.
We are building a binary sequence day by day, where each position is either zero or one. The first few days are fixed as zero. After that, each new day depends on the structure of what has already been generated.
We are given a collection of strings, each string representing a number written in a simplified Roman numeral system. Each character is one of the standard Roman symbols I, V, X, L, C, D, M with fixed values 1, 5, 10, 50, 100, 500, 1000.
We are given a set of $n$ hidden items, called dolls. Exactly one doll is special and behaves differently: whenever it is compared with any other doll, the result is always a tie.
We are given an array of flower pots. Each pot has two attributes: a number of seeds and a type label. A move consists of choosing a pot that still contains seeds, removing any positive number of seeds from it, and then performing a global operation that depends on the type of…
We are given a starting value and then a sequence of ovens, each associated with a fixed number. When a cookie passes through an oven, that oven forces the current value either upward to at least the oven’s number or downward to at most the oven’s number.
We are given a large rectangle that is composed of four identical smaller rectangles. Each small rectangle has dimensions $L times W$, and they are arranged in a $2 times 2$ grid to form a big rectangle of size $2L times 2W$.
We are given two sorted sets of integers representing positions of vibrations on a huge number line. We are allowed to perform an operation where we pick a pivot position k, and every vibration strictly to the left of k moves one step further left, every vibration strictly to…
We are given a tree with values on nodes. For any choice of a root, every node induces a subtree, and inside that subtree we imagine choosing any subset of nodes. Each chosen node contributes its value via XOR, so each subset produces one XOR result.
We are given an array of positive integers, and every contiguous subarray contributes a value based on two factors: the least common multiple of all elements in that subarray and the product of its endpoint indices.
We are given a list of forbidden “challenge points” in a two-dimensional integer grid. Each challenge is a pair of coordinates $(Pk, Sk)$, where both values lie between 2 and $2N$.
We are given a circular sweater made of $N$ equally spaced positions. A knitting pattern of length $P$ must be placed repeatedly along this circle.
We are given a single string consisting of upper and lowercase Latin letters. Conceptually, an earlier problem would enumerate all distinct substrings of this string and output each substring together with how many times it appears in the original string.
We are tracking a person’s cash balance over time under two competing forces. Every day starts with an amount of money, and the person immediately spends half of whatever they currently have, rounding the amount spent upward.
We are given a compressed “game log” from a Wordle-like system, but the actual guesses are lost. What remains is only the feedback grid: for each guess and each position, we know whether the character was marked gray or yellow.
We are working on an infinite grid where Carl starts at the origin and must physically walk step by step to a sequence of target coordinates, visiting them in the given order. Each move changes the position by exactly one unit in one of the four cardinal directions.
We are given two sequences representing the order of cards in two face-up decks. Each deck contains exactly $N cdot K$ cards, and the values come from the range $1$ to $N$.
We are given a planar drawing formed by straight fence segments. Each segment connects two grid points, and together all segments form a single connected planar graph with no crossings and no redundant edges.
We are given a rectangular field divided conceptually into unit grid positions, with dimensions $a times b$. We have exactly $N$ identical unit square tiles, and we must place all of them inside this grid. The placement is restricted in two structural ways.
The task is to take a single integer $N$, representing a total number of beats in a musical rhythm, and express it as a sum of smaller building blocks. Each building block must have size either 2 or 3, and together they must sum exactly to $N$.
We are given two distinct points on the integer grid, a start point and a target point. Between them lies an axis-aligned rectangular obstacle whose exact coordinates are unknown.
We are given a tree where a defender starts at a fixed node and an attacker repeatedly chooses a node to “bomb” over several rounds.
We are given a transport system that is essentially a single directed chain of stations from 0 to n − 1. Between station i − 1 and i, there is exactly one road segment with a fixed length, and that segment allows only certain transport modes chosen from a subset of K total…
We have a classroom with seats labeled from 1 to n, and initially each seat is meant for the student with the same number. The final student of interest is student n, who is guaranteed to be a newcomer.
The grid is an $N times M$ board where every cell initially contains crystals except one special empty cell at $(X, Y)$. From that single empty starting point, we are allowed to place a device only on currently empty cells.
We are given a line of students. Each student holds one “lucky number” between 1 and m, so the line can be seen as an array S of length n over m categories. We are allowed to assign a ranking to these m lucky numbers by choosing a permutation of 1 through m.
We are given several independent test cases. In each one, there is a sequence representing rain intensity over consecutive days. Starting from zero, Soyo’s “anticipation value” changes every day based on how much the rain intensity changes compared to the previous day.
Each test case gives a single integer $n$. The task is to split this number into two different positive integers $x$ and $y$ such that their sum equals $n$. If such a pair cannot exist, the output must be two negative ones.
We are asked to construct a rooted tree on the vertices labeled from 1 to n, where 1 is fixed as the root. The structure of the tree is heavily constrained: every edge must go from a smaller label to a larger label, so labels strictly increase along any path from the root.
We are given a permutation that represents stones placed in a line. Each day, the process removes the leftmost remaining stone from the ground and places it on top of a growing stack (a tower).
We start with a pile of identical level-1 entities. The system repeatedly allows a move whenever two entities share the same level i, provided i is not the maximum level k.
We are given a sequence of daily stock prices. You are allowed to pick at most one pair of days, buy on an earlier day and sell on a later day, and you earn profit equal to the increase in price divided by the number of days held.
We are given a rooted tree where node 1 is the root, and each edge has an index according to its input order. Every edge starts in an active state, meaning all nodes are initially fully connected. Each operation consists of two actions.
We are given several independent data sources, each representing a platform that might contribute to a mixed dataset. Each platform contributes a known fraction of the total data, and each platform also has its own probability of being “AI contaminated”.
The task describes five universities and asks us to “choose” one of them, then output its English abbreviation as a single uppercase string. There is no input, so the program does not receive any data to guide the choice at runtime.
We are given a sequence of distinct episodes, each assigned an integer enjoyment value. Two players alternate taking episodes from the remaining pool.
We are given a schedule describing when Sagar is busy, and we need to decide whether Jagjeet’s chosen moment falls inside any of those busy periods. Sagar’s busy pattern starts at time a. After that, his availability alternates in a structured way: every cycle is based on b.
We are given a string for each test case, and we need to locate a contiguous substring that contains a specific multiset of letters. The required letters correspond to the word “hardwork”, but not in the usual frequency pattern of the word itself.
We are given a sequence of queries, each describing a numeric interval $[l, r]$. For every query, we are asked to count how many integers inside that interval have a specific property related to their number of divisors.
We are given a complete grid of cards indexed by suit and rank. For every suit from 1 to n and every rank from 1 to m, exactly one card exists, so the deck forms an n by m matrix. Two players split this entire set into two equal halves.
We are building a growing army that changes over time, and after every update we want to know how long the battle can last if we assign equipment optimally. At any moment there are heroes, each with a health value, and artifacts, each with a durability value.
We are building an array of size $n$, initially filled with zeros. We process $q$ operations one by one. Each operation gives us two distinct indices $xi$ and $yi$.
We are given a string of lowercase letters. Its “score” is computed by splitting it into maximal contiguous segments of identical characters, then summing the square of each segment’s length. Long runs contribute disproportionately because squaring rewards concentration.
We are given a long ordered sequence of events in a game. Each event is either earning a single attribute point or encountering a check that depends on one of two stats, Strength or Intelligence.
We are given a set of fixed points on a number line, including the endpoints 0 and 10^9, which represent existing store locations in a city.
We are given many independent queries. Each query specifies a pair of indices $n$ and $k$, and we are asked to compute a value from a triangular table $C$ that is generated in a nonstandard way. The table is built row by row.
We are given a multiset of cards, each card carrying an integer value. Monocarp builds a sequence by picking cards one by one, removing them from the deck as he takes them.
We are given an array of even length, split conceptually into two equal parts: the left half and the right half. We are allowed to perform exactly one swap, but the swap is heavily constrained.
We start with a collection of balls colored red, yellow, and green, with counts a, b, and c. We are allowed to repeatedly pick any single ball and repaint it into one of the other two colors.
We are given two target strings, one that must end up on the first screen and another that must end up on the second screen. Both screens start empty.
We are given a single sheet and we repeatedly split it using full-length straight cuts. Every cut either goes from left to right across the entire current sheet or from top to bottom across the entire current sheet.
We are given a town modeled as a tree with N locations connected by N − 1 roads. Because it is a tree, there is exactly one simple path between any two places. Each mouse is defined by two special nodes A and B, and it only moves along the unique path between them.
We are given a line of rabbit hutches, each containing some number of rabbits. For each query, we are handed a contiguous segment of this line, and Leonardo is only allowed to operate inside that segment. Each “day” he chooses a pair of distinct hutches inside the segment.
We are given a long chain of identical structural segments. Each segment contains five directed paths, labeled A through E. Every path has a gate somewhere in the middle that allows only a limited number of sheep to pass before it permanently closes.
We are given an array of integers representing daily “cookie offers”. Each interval is a contiguous block of days, and for any chosen interval two different payment rules are applied to the same segment.
We are given two parallel rows of positions, both indexed from 0 to n − 1. The first row is already populated with birds, where multiple birds may start from the same position. The second row is initially empty, but each bird has a fixed target position on that second row.
We are given a single integer written on a cookie tray, and we should think of it as a sequence of digits placed side by side.
We start with two disjoint groups of animals, pigs and giraffes. Initially, each pig may “talk” to some giraffes, and this relationship is symmetric, so a pig is connected to a giraffe if and only if that giraffe is connected back to that pig.
We are given a rectangular grid where each cell contains a non-negative number representing larvae. A hamster starts at the top-left cell and must reach the bottom-right cell. At every step it moves to a neighboring cell that shares an edge, and it never revisits any cell.
We are given a large collection of points on the plane. These points come from repeatedly relocating the corners of a rectangle over several days.
We are given a line of eggs represented by a string. Each position contains a single concrete type, so the string is just a sequence of lowercase letters. Alongside this, we are given a pattern written in a restricted regular-expression language.
We are given several cows on a plane. Each cow starts at a fixed coordinate and occupies a circular region with a given radius. Every cow can move in any direction with speed at most one meter per second, and they all move simultaneously.
Each message consists of several symbols drawn as small 9 by 9 pictures. Every picture encodes one English letter using a semaphore system: a central pivot cell and two “arms” that extend from it in two distinct directions among the eight compass directions.
We are given two natural numbers, but they are not written in decimal form. Instead, each number is encoded using Peano arithmetic, where a number is represented as repeated applications of a successor function applied to zero.
We are given two very large positive integers written in decimal, each potentially up to one million digits. Petra can modify these numbers using a very specific operation: she picks one of the two numbers, adds 1 to it, and simultaneously subtracts 1 from the other number, so…
We are given an $n times m$ grid, and each cell contains only partial information about how many of three unknown languages are spoken there. Every cell is marked either with 1 or 2.
We are given a small number of chocolate faucets, each faucet producing chocolate at a fixed temperature, but with a controllable flow rate constrained to an interval.
We are given a fixed schedule of how a company’s workforce changes over time. Each day, a known number of workers are fired and a known number are hired, and the system guarantees that the number of firings never exceeds the number of currently employed workers.
We are interacting with a system that hides an unknown number of infected people inside a population of fixed size. The only tool we have is a probabilistic group test: we choose a subset size k, and the judge randomly selects k distinct people.
We are given a sequence of songs in the order they were written. Each song has a label, which can only be 1, 2, or 3. We want to count how many contiguous subsequences of these songs form a valid “setlist”.