brain
tamnd's digital brain — notes, problems, research
41641 notes
We are given a directed graph where each edge represents a financial transaction between two companies. For every transaction, we must assign a value from the set {-1, 0, 1}.
There is a single music device that plays songs one after another. Each guest arrives at a specific time, selects a song with a fixed duration, and that song is normally appended to the end of the playback queue.
We are asked to count how many length-n sequences we can build using k symbols, where each position is a quiz answer choice. The constraint forbids any run of four identical consecutive values.
We are given a sequence of decks, each deck containing only two types of cards: red and blue. In each round, the current dealer chooses one unused deck, the deck is shuffled, and the other player picks one card uniformly at random.
We are given a sequence of length $n$, where each position represents how many problems a friend solved on that day. Some values are already known, some are unknown and marked as $-1$, meaning they can be freely chosen. We are also given two types of constraints.
We are asked to construct any number of a given length $n$, where $2 le n le 6$, such that two conditions hold simultaneously. First, the number must be rotationally symmetric under a 180-degree rotation.
We are given a rooted tree where node 1 is the root and every node carries a value that can be positive or negative. The tree does not change structurally, but the values at nodes change over time through updates.
We are given a circular arrangement of stores, each store containing some number of pancakes. Two players, Lura and Oscar, will each end up visiting a contiguous segment of stores along the circle, but their segments are constrained by a key rule: neither of them is allowed to…
We are given several independent test cases. In each test case, there are $n$ intervals. From each interval $[li, ri]$, we must choose exactly one integer $xi$. After making all choices, we compute the sum of all selected values.
We are given several independent test cases. In each test case, there is a sequence of words arranged in a line. The task is to count how many pairs of positions $(i, j)$ with $i < j$ satisfy a simple visual condition: the two words at these positions “fascinate Ahmad” if…
We are given several test cases. In each test case, there is an array of positive integers representing values of food bags. Rama must choose exactly $n-1$ of these bags and her “satisfaction” is defined as the bitwise OR of the chosen values.
Each test case describes a collection of dishes, where every dish belongs to a specific restaurant and has a numeric taste value. The key constraint is that you cannot mix restaurants. You must pick exactly one restaurant and take all dishes belonging to it.
We are given several collections of flower types, where each collection (called a bouquet) is essentially a set of allowed flower labels drawn from a universe of size at most 60. For each test case, Osama chooses exactly one bouquet and then builds a garden of length $m$.
We are given a number of independent queries. Each query provides an integer n, and we must output a single integer a, where a is the prime number closest to n. If two primes are equally close, the smaller one must be chosen.
Each test case describes a classroom snapshot. For every test case, we are given several students, and for each student we receive exactly eight integers representing their scores in eight different subjects.
We are given multiple independent test cases. In each test case there are $n$ lockers and $q$ rental requests. Each request fixes one locker $x$ and a time interval $[l, r]$, meaning that locker $x$ is occupied throughout that entire interval.
We are given a deterministic process that starts with exactly three single-digit cards. Each card holds a value from 1 to 9. The process repeatedly transforms the whole collection: every card value is multiplied by 3, and then the result is split back into its decimal digits.
We are given a very small grid, at most 10 by 10, where every cell contains a lowercase letter. From any cell we are allowed to move to any of its 8 neighbors, including diagonals, and we are allowed to revisit cells arbitrarily many times.
We are given a very small set of distinct characters in a string $T$, and a much larger string $S$ that contains exactly the same multiset of characters as $T$, just in repeated quantities. We are allowed to permute both strings freely.
We are given a tree with $n$ nodes representing neighborhoods connected by roads. Some of these neighborhoods are already completed, while the rest still need work. Each day, a team of three workers chooses exactly three neighborhoods that form a connected subgraph in the tree.
We are given an array of $n$ cards laid out in a line, where each card carries a value from 1 to 13. Over time, the values change through updates, and we are also asked to answer range queries. A query of the first type changes a single position in the array to a new value.
We are given a line of buildings, each containing some number of students. Freddy always starts from the first building and moves strictly to the right. As he visits buildings in order, he accumulates the number of students he has seen so far.
We are given a line segment of integer positions from 0 to n. Several students stand on integer points between 1 and n−1, and multiple students may share the same position.
We are given a binary string representing a line of lanterns, where each position is either lit or unlit. In one move, we are allowed to pick any contiguous segment and flip every bit inside it, turning zeros into ones and ones into zeros.
We are given a round-robin tournament with $N$ teams where every pair plays exactly one match and every match produces a winner. A win gives 1 point, a loss gives 0 points. After all matches, teams are ranked by total points, and ties are resolved using run rate.
We are given an upper bound $n$. From all pairs of integers $(a, b)$ such that both lie between 1 and $n$ and $a < b$, we are only allowed to consider those pairs where the bitwise AND of the two numbers is zero.
We are given a set of points on a grid, each point having an integer position and a weight. For any rectangle anchored at the origin and defined by coordinates $(a, b)$, we look at all points whose $x$-coordinate is at most $a$ and whose $y$-coordinate is at most $b$.
We are given a tree on $n$ nodes where each edge has a weight. Over time, the tree is modified in a very controlled way: each day removes exactly one existing edge and adds exactly one new edge, and the structure always remains a tree.
We are given several short strings, and for each one we must decide whether it can be rearranged to form the word “hola”. Rearranging means we are allowed to permute the characters freely, but we cannot add or remove any character.
We are working with a rectangular grid that starts completely empty in the sense that every cell initially holds zero. Then we perform a sequence of operations.
We are given an array and we only care about its prefixes. For each prefix, we must decide whether it has a special property called “good”.
We are given multiple queries. Each query describes two integers $n$ and $k$, and asks us to work with the number formed by selecting $k$ distinct elements from a set of size $n$, ordered, which is the falling factorial $$P(n,k) = n cdot (n-1) cdot dots cdot (n-k+1).
We are given several test cases. Each test case describes a set of monsters placed on a number line and a set of weapons. Every monster sits at a single integer coordinate, and multiple monsters can share the same position.
We are working with a complete undirected graph on $n$ countries, but some edges have been destroyed. After these removals, we are left with a simple undirected graph.
We are given a single positive real number written as a string with a decimal point. The task is to compute its floor, meaning the greatest integer that does not exceed the value, and output that integer without any decimal part.
We are given an array of non-negative values representing rewards earned at each level of a game. For any contiguous segment starting at position l and ending at r, the player’s performance score is computed as the rounded average of that segment: take the sum of values on…
We are given a one-dimensional garden represented as a line of m cells. Several existing slabs are already placed along this line, each occupying a continuous interval.
We are given a collection of cards, each card carrying two numbers: one written on its front side and one on its back side.
We are given a collection of animals, each described by its species name and a numeric influence value. Among these animals, we must form a leadership council by selecting any subset, but the selection is constrained by a single special species called pigs.
We are given a fixed permutation $p$ of size $n$. We are allowed to choose another permutation $q$ of the indices $1$ to $n$.
We are given a permutation of length $n$. Jesse is allowed to split the positions into two nonempty groups. One group is colored yellow, the other blue.
We are given an integer X, and we consider all multisets made of powers of two such that their sum equals X. Each multiset is just a collection like {1, 1, 2, 8, 8} whose total sum is X. From each such multiset S, we imagine splitting its elements into two groups S1 and S2.
We are counting how many pairs of arrays $a$ and $b$, both of length $n$, can be formed using values from $1$ to $m$, such that a specific symmetry condition holds between every pair of positions. Pick any two indices $i < j$.
We are given an even number of students, specifically 2n, each with a numeric chemistry skill. The teacher must split them into n disjoint pairs, so every student belongs to exactly one pair.
We are given an $n times n$ grid where each cell contains a value between 0 and 4. We must choose exactly one cell from every row and every column, which means we are effectively selecting a permutation of columns for the rows.
We are given a weighted tree with up to half a million vertices, and each edge carries a weight that can change temporarily during each query. For every query we first modify exactly one edge weight, and then we are allowed to choose $k$ simple paths in the tree.
We are given a convex polygon with vertices ordered counterclockwise. Each vertex carries a value, and we are allowed to pick any subset of vertices.
We are given several test cases. Each test case describes a complete graph, but the graph is not defined on individual vertices directly. Instead, vertices are grouped by colors. For each color i, there are ai identical vertices.
We are given a string and we can rotate it cyclically to the left by some number of positions. A left shift by $d$ means taking the substring starting from position $d$ to the end and attaching the prefix $0 dots d-1$ at the end.
We are given a line of positions indexed from 0 to n − 1. Initially every position is marked red. Over time, we repeatedly pick one position and permanently flip it to blue. After each flip, we look at a collection of intervals, called sensors.
We are given an integer array and we are allowed to split it into exactly $k$ contiguous non-empty segments. Each segment contributes its sum, but the contribution is weighted by the segment’s position from the left.
We are given several test cases. In each test case, we receive a list of strings. We need to count how many triples of indices $(a, b, c)$ with $a < b < c$ satisfy a special “triangle” condition defined using string concatenation and lexicographic comparison.
We are given several printing machines that run independently but contribute to the same shared goal: producing at least $k$ total copies of a document. Each printer does not work at a constant long-term rate in a simple linear way. Instead, it follows a cycle.
We are given a convex polygon representing a pizza, and a circular region inside it representing a pineapple topping.
We are given a graph of cities connected by undirected roads, where each road belongs to a company and has a length. The structure is fixed, but movement is constrained by a sequence of tickets that must be used in order.
We are given a string and we are allowed to cyclically shift it. After choosing a shift, we look at the resulting string arranged in a circle, meaning the last character is considered adjacent to the first.
We are asked to build a permutation of numbers from 0 to n minus 1 such that when we read it from left to right, the XOR of every prefix is strictly positive.
We are given a sequence of events on a number line of integer cells. Each event is a coin that appears at a specific time and position, and it exists for exactly one second.
We are given several contests. Each contest has a “star rating” and a vector of properties. The score of a contest is simply the sum of all its properties. Some property values are already fixed, while others are missing and marked as unknown.
We are working on a very large grid, but only a sparse set of cells are relevant: some cells contain castles and some contain obstacles. Two castles can “see” each other if they lie in the same row or column and nothing important lies strictly between them.
We are given a rectangular board with $n$ rows and $m$ columns. Each cell is a hexagon in a honeycomb layout, which means every cell can touch up to six neighbors instead of the usual four in a grid.
We are given two rectangles. One represents a car trunk with sides a and b, the other represents a folded stroller with sides c and d. The stroller can be rotated by 90 degrees, meaning we can swap its sides, but we cannot deform it.
We are given a deterministic sequence of integers generated by repeatedly multiplying the previous value by a fixed factor and then taking a modulo. The sequence starts from a given initial value and produces exactly $n$ numbers.
We are given a database of questions, each question having a computed difficulty score derived from how many teams answered incorrectly relative to attempts. After scaling by 10000 and flooring, each question becomes a single integer rating.
We are given a very large grid, but only a small number of cells inside it are marked. From this state, we are allowed to choose a single empty cell and pick one of four cardinal directions.
We are given a binary grid that represents an image after a morphological operation called dilation has been applied. Each cell is either black () or white (.).
We are given several independent instances of a Nim game. Each instance consists of multiple piles, and a move consists of selecting one pile and removing a positive number of stones from it.
We are given a very specific geometric bug to exploit. A point is fixed at the origin, and we are asked to construct simple lattice polygons that truly enclose this point strictly inside them. “Strictly inside” means the origin cannot lie on any edge or vertex.
We are given a set of vertical line segments in the plane, each anchored on the x-axis and extending upward. Concretely, the i-th grass is a segment from $(xi, 0)$ to $(xi, yi)$, and all x-coordinates are distinct.
We are given a univariate polynomial $A(x)$ and we build a multivariate polynomial $D(x1, dots, xm)$ by taking two ingredients. The first is a copy of $A$ applied independently to each variable, so every variable contributes a factor $A(xi)$.
We are given a rooted binary tree with up to 300,000 nodes. Each node carries a weight a[i], and each node also has a target value b[i]. For every node i, we look only at the nodes on the path from the root to i, including i itself.
We are given two integers, a target sum s and a constraint value x. The task is to construct an array whose elements add up exactly to s, while every element in the array must be coprime with x. Coprime here means that each element shares no common prime factor with x.
We are given a target string $s$ and a fixed number of seconds $m$. Starting from an empty string $t$, each second we apply exactly one operation.
We are given a binary string and a parameter $k$. For each value of $k$ from $1$ up to $lfloor n/2 rfloor$, we are allowed to repeatedly apply a transformation that acts on a window of length $2k$.
We are given items that must be washed using one of three washing programs, A, B, or C. Each laundry load uses exactly one program and can contain at most $k$ items. Every item does not have a single fixed program, instead it comes with a set of allowed programs.
We are given a collection of $n$ jigsaw puzzles. Each puzzle has two attributes: the number of pieces it contains and a difficulty value that can be positive or negative. A “gift” is defined as choosing any subset of these puzzles.
We are given a collection of university names, a set of rivalries between some pairs of universities, and a sequence of news articles. For each article, we must decide whether it is “balanced enough” or whether it would anger at least one coach.
We are given a finite collection of cards, each card representing a unary operation on a shared integer state. Each move, a player picks an unused card and applies its operation to the current value. The players alternate until all cards are consumed.
We are working on a one-dimensional alley of positions from 1 to n. At certain positions we may place or remove lamps, each lamp having a positive brightness value.
We are given a collection of cuboid-shaped books, and each book can be freely rotated in 3D before being placed. All books must be placed upright on a shelf in a single horizontal row, meaning each book contributes exactly one rectangular footprint on the shelf surface, and…
We are given a social network of people where friendships form an undirected graph. The aliens cannot abduct individuals independently.
We are given a line of positions from 1 to N, and we must assign each position a value between 0 and K. On top of this array, there are M constraints. Each constraint specifies a segment [l, r] and demands that the sum of values inside that segment is exactly K.
We are simulating a probabilistic turn-based game where two players repeatedly play rock-paper-scissors, but the outcome does not immediately determine the winner.
We have a set of $N$ clubs whose scores are already fixed, and one additional club called RUN whose score we are free to choose at the end.
We start with an $N times N$ grid where every cell is initially white. The grid is then modified through a fixed sequence of operations, each operation recolors either an entire row or an entire column to black or white.
We are asked to construct a set of coin denominations that interact with the greedy change-making strategy in a very specific way. For any amount, the greedy strategy always picks the largest coin not exceeding the remaining sum.
Each test case gives two arrays of scores, one belonging to Arturo and one belonging to Benito. For every index we have a pair of values, but the pairing is completely unknown: we are free to assign Arturo’s numbers and Benito’s numbers to different contest problems in any…
We are given a line of stones, each stone having either a fixed color already assigned or being unpainted. Our task is to fill in all unpainted stones using a palette of c colors so that no two adjacent stones share the same color.
We start with an empty grid of size $n times m$, where every cell is initially white. The only way to modify the grid is to choose whole rows or whole columns and paint them completely black.
We are given several independent test cases. Each test case provides a list of positive integers. The task is to determine whether there exists at least one element in the list that can divide every element in the same list, including itself in a trivial way.
We are given a segment on a line, marked by two fixed points. Inside this segment there are several objects, each placed at a distinct coordinate. Every object is initially facing either left toward the first mark or right toward the second mark.
We are given a list of integers and asked to verify a very specific structural property: every pair of numbers in the list must share exactly the same greatest common divisor.
We are simulating a small economy that evolves over a fixed number of days. Alice starts with a single chicken that already produces eggs every day after it has finished its initial sleep requirement.
We are given a set of positions on a number line where eggs are placed. We are also allowed to place a fixed number of heat lamps, each at an integer coordinate.
We are given a collection of eggs, where each egg requires a specific amount of time to be fully cooked. Jacob has a fixed total time budget and a single pot, which means he can only cook one egg at a time without overlap.
We are given a deterministic process that generates a sequence of egg orientations. Each egg has a state in the range from 0 to 5, and the sequence starts from a fixed initial state for the first egg.
We are looking at a dynamical system over the finite field $mathbb{F}p$. We pick a starting point $x0$, then repeatedly apply a randomly chosen polynomial function $f : mathbb{F}p to mathbb{F}p$.
We are given a system that evolves over a limited number of days. Initially there is exactly one chicken and a stock of eggs that starts at zero.
We are given a one-dimensional landscape represented as an array of heights. Each index is a position in a mountain range, and the height value is the elevation at that position.
We are given a set of integers from 1 to n, each appearing exactly once, and we must arrange them in some order. From this arrangement, we look at contiguous segments and focus on those segments where values increase by exactly 1 at every step.