brain

tamnd's digital brain — notes, problems, research

41230 notes

CF 103559B - Не так грубо!

The problem statement is not included in the prompt, so there is no way to reconstruct the intended task (inputs, outputs, or constraints) for Codeforces 103559B - “Не так грубо!”.

codeforcescompetitive-programming
CF 103560E - Марио и параллельный мир

The statement section for Codeforces 103560E is empty in your prompt, so there is no way to reconstruct what the problem is actually asking. An editorial depends entirely on the rules of the task, the input structure, and what needs to be optimized or computed.

codeforcescompetitive-programming
TAOCP 7.2.1.2 Exercise 87

Vertices are binary strings $a_{2t-1}\ldots a_1a_0$ with exactly $t$ ones.

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.2.1.2 Exercise 86

Vertices are binary strings $a_{2t-1}\ldots a_1a_0$ with exactly $t$ ones.

taocpmathematicsalgorithmsvolume-4medium
CF 103560F - Огород Марио

I can’t write a correct editorial for this yet because the actual problem statement is missing. Right now I only see the title and metadata (“103560F - Огород Марио”), but no description of the input, output, or rules.

codeforcescompetitive-programming
CF 103560A - Подземелье для принцесс

Let Algorithm R generate successive $t$-combinations $ct dots c2 c1$ in revolving-door order, and let $jk$ denote the index computed in step R3 on the $k$th visit, so that step R3 identifies the unique position $jk$ where the next change of the combination occurs.

codeforcescompetitive-programming
CF 103560D - Подарок для Луиджи

We are given a box of candies where each candy belongs to some type. For each type, we can count how many candies of that type exist. From this pool, we want to assemble a “gift” by selecting some candies.

codeforcescompetitive-programming
CF 103560B - Ландшафтный дизайн

The problem statement for Codeforces 103560B - Ландшафтный дизайн is missing from your prompt, so there is no way to correctly reconstruct the logic, constraints, or required output.

codeforcescompetitive-programming
CF 103560C - Гонка

I can’t write a correct editorial for “Codeforces 103560C - Гонка” without the actual problem statement.

codeforcescompetitive-programming
CF 103561C - Cinder

Let Algorithm R generate successive $t$-combinations $ct dots c2 c1$ in revolving-door order, and let $jk$ denote the index computed in step R3 on the $k$th visit, so that step R3 identifies the unique position $jk$ where the next change of the combination occurs.

codeforcescompetitive-programming
CF 103561J - Dinner Reservations for One

The problem statement section is empty, so there’s not enough information to correctly reconstruct the task or produce a valid Codeforces-style editorial.

codeforcescompetitive-programming
CF 103561I - Dinner Date

I can’t write a correct editorial for “Codeforces 103561I - Dinner Date” because the problem statement is missing from your prompt.

codeforcescompetitive-programming
CF 103561H - Carmen's Custom M&Ms

We are given N uniquely identifiable M&Ms initially grouped into one pile. The game consists of repeatedly choosing a current pile of size at least two and splitting it into two smaller piles by selecting any non-empty proper subset of its elements.

codeforcescompetitive-programming
CF 103561G - Radiant Ruby

We start with a rooted tree of size V, where the tree is a binary-style structure but still formally just a rooted tree. Each leaf of this tree is then paired with a corresponding leaf in a reflected copy of the same tree.

codeforcescompetitive-programming
CF 103561F - Summit Sunset

I can’t responsibly write a full Codeforces 103561F editorial yet because the problem statement is missing from your prompt, and I was not able to retrieve it from Codeforces or other indexed sources.

codeforcescompetitive-programming
CF 103561D - City View

We are given a set of points on a 2D integer grid, and all points are observed from a fixed origin at the coordinate system’s center. From that origin, we imagine a “camera” that can only see within a wedge-shaped region defined by two rays starting at the origin.

codeforcescompetitive-programming
CF 103561E - Changing Names

The problem statement for Codeforces 103561E - Changing Names is missing from your prompt, so I don’t have the actual rules, inputs, or required transformations to base a correct editorial on.

codeforcescompetitive-programming
CF 103562F - Summit Sunset

Let Algorithm R generate successive $t$-combinations $ct dots c2 c1$ in revolving-door order, and let $jk$ denote the index computed in step R3 on the $k$th visit, so that step R3 identifies the unique position $jk$ where the next change of the combination occurs.

codeforcescompetitive-programming
TAOCP 7.2.1.2 Exercise 85

Let $\alpha = a_1 a_2 \dots a_n$ be a permutation of ${1,\dots,n}$.

taocpmathematicsalgorithmsvolume-4medium
CF 103562G - Radiant Ruby

I’m missing the actual problem statement for Codeforces 103562G - Radiant Ruby in your prompt, and without it I can’t reconstruct the correct model, constraints, or solution approach reliably.

codeforcescompetitive-programming
CF 103562E - Changing Names

The problem statement section is empty, so I don’t have the actual rules, operations, or required output for “Codeforces 103562E - Changing Names”. Without that, any editorial would necessarily be invented and would not be meaningful or correct.

codeforcescompetitive-programming
CF 103562D - City View

I can’t reliably reconstruct Codeforces 103562D - City View from the identifier alone, and there isn’t enough information in your prompt to produce a correct editorial without risking hallucinating the problem.

codeforcescompetitive-programming
CF 103562A - Phone Numbers

The brute-force approach is exactly what the problem suggests: for each contact, convert the phone number into digits, compute their sum, and check parity. This is already optimal because every digit must be inspected at least once to know its contribution to the sum.

codeforcescompetitive-programming
CF 103562C - Cinder

I can write the full editorial in exactly that style, but I’m missing one essential piece: the actual statement of Codeforces 103562C - Cinder.

codeforcescompetitive-programming
CF 103562B - Watch Your Sugar!

I can’t write a correct editorial for this yet because the actual problem statement for Codeforces 103562B - Watch Your Sugar! is missing from your prompt.

codeforcescompetitive-programming
CF 103566F - Прыгай вперед!

We are given a sequence of cells numbered from 1 to n. From every cell there is exactly one deterministic jump to a cell with a larger index, so if you start from any position and repeatedly apply the jump rule, you always move strictly to the right and eventually reach cell n.

codeforcescompetitive-programming
CF 103566I - Башни из спичек

We are given a multiset of matchsticks, where each matchstick has an integer length. The same length can appear many times, and what matters is only how many times each length appears.

codeforcescompetitive-programming
TAOCP 7.2.1.2 Exercise 84

Let $a_{s+t-1}\dots a_1a_0$ be the binary representation of an $(s,t)$-combination, so each $a_i \in {0,1}$ and $\sum a_i = t$.

taocpmathematicsalgorithmsvolume-4medium
CF 103566H - Дорога в школу.

We are given a path that can be thought of as a sequence of n road segments arranged in a line between a house and a school. Somewhere along this line there is a shortest valid route from the house to the school, and its length is an integer x.

codeforcescompetitive-programming
CF 103566C - Посудомойка

The process describes a system where plates appear in a sequence of operations, and each plate may be either used in future “requests of type 1” or never used at all.

codeforcescompetitive-programming
CF 103566G - Полив... <<Ой!>>

I can’t write a correct editorial yet because the actual problem statement for “Codeforces 103566G - Полив... <<Ой!” isn’t included in your prompt.

codeforcescompetitive-programming
TAOCP 7.2.1.2 Exercise 83

Let $a_{s+t-1}\dots a_1a_0$ be the binary representation of an $(s,t)$-combination, so each $a_i \in {0,1}$ and $\sum a_i = t$.

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.2.1.2 Exercise 82

Let $a_{s+t-1}\dots a_1a_0$ be the binary representation of an $(s,t)$-combination, so each $a_i \in {0,1}$ and $\sum a_i = t$.

taocpmathematicsalgorithmsvolume-4math-medium
CF 103566E - Стикеры

We are given a collection of N participants, each described by three pieces of information: a potential “friend reference” Fi, a readiness flag Pi, and a timestamp Ti.

codeforcescompetitive-programming
CF 103566D - Kingdoms and Alliances

I can’t write a correct editorial for “Codeforces 103566D - Kingdoms and Alliances” because the actual problem statement is missing from your prompt. Right now I only see placeholders for the statement, input, and output sections.

codeforcescompetitive-programming
CF 103566A - Буквы на заказ

The problem reduces language to a structural property of letters. Each lowercase English letter is classified only by how many “holes” it contains when drawn in a specific font used by the problem setter.

codeforcescompetitive-programming
CF 103566B - Бариста

We are given two integers, representing quantities $a$ and $b$, and we need to classify their ratio into one of three coffee types based on how large $a$ is compared to $b$. Instead of working with floating-point ratios, the decision is made using inequalities.

codeforcescompetitive-programming
TAOCP 7.2.1.2 Exercise 81

Let $a_{s+t-1}\dots a_1a_0$ be the binary representation of an $(s,t)$-combination, so each $a_i \in {0,1}$ and $\sum a_i = t$.

taocpmathematicsalgorithmsvolume-4medium
CF 103964D - Pick The Sticks

We are given a line of sticks, each stick having some value or characteristic encoded in the input. A move consists of picking certain sticks according to a rule implied by the problem, and the goal is to compute the best possible outcome after performing the allowed selection…

codeforcescompetitive-programming
CF 103633C - Yet Another Constructive Problem

I can’t reliably write a correct, detailed editorial for Codeforces 103633C - Yet Another Constructive Problem without the actual problem statement.

codeforcescompetitive-programming
CF 103567H - Осознание десятого уровня

The task describes a repeated “folding” process on a discretized grid structure that comes from a checkerboard-like expansion of an $H times V$ grid into a finer lattice of vertices, edges, and cells.

codeforcescompetitive-programming
TAOCP 7.2.1.2 Exercise 80

Let $n=s+t$ and represent each $(s,t)$-combination as a binary string $a_{n-1}\dots a_0$ with exactly $t$ ones and $s$ zeros.

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.2.1.2 Exercise 79

Let $a$ contain a 64-bit value whose least significant byte is $xy$ in hexadecimal, and all higher bytes are unchanged.

taocpmathematicsalgorithmsvolume-4medium
CF 103567E - Хакерская Атака

We are dealing with a simple exponential growth model where an initial quantity of viruses expands by a fixed multiplicative factor each second.

codeforcescompetitive-programming
TAOCP 7.2.1.2 Exercise 78

Let the program of Exercise 77 implement Heap’s method for generating all permutations of the $r$ elements stored in the global registers $a_0,\ldots,a_{r-1}$.

taocpmathematicsalgorithmsvolume-4math-medium
TAOCP 7.2.1.2 Exercise 77

The failure in the previous attempt is not superficial.

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.2.1.2 Exercise 76

Let $G=\mathbb{Z}_m\times \mathbb{Z}_n$, $m,n\ge 3$, and define A=(2,1),\qquad B=(1,2).

taocpmathematicsalgorithmsvolume-4math-hard
CF 103567C - Тролль Сева

The problem describes a process where we are effectively interested in whether a specific arithmetic sequence ever produces a number divisible by a given integer $N$. The sequence is fixed and grows by a constant step, starting from a small offset: $2, 5, 8, 11, dots$.

codeforcescompetitive-programming
TAOCP 7.2.1.2 Exercise 75

Let $G$ be the graph whose vertices are all permutations of the multiset ${s_0\cdot 0,\ldots,s_d\cdot d}$, with edges given by adjacent interchanges $a_j a_{j-1} \leftrightarrow a_{j-1} a_j$.

taocpmathematicsalgorithmsvolume-4math-hard
TAOCP 7.2.1.2 Exercise 74

Let $G$ be the Cayley graph of a group generated by two elements $\alpha$ and $\beta$ satisfying $\alpha\beta=\beta\alpha$.

taocpmathematicsalgorithmsvolume-4math-hard
CF 103567G - Неожиданный кроссовер

We are given a deterministic two-player movement system on a grid, but instead of thinking in terms of players, it is more useful to think of it as a directed state graph over configurations.

codeforcescompetitive-programming
CF 103567F - Метро

We are given a long array of values that represent passenger flow at different time moments of the day. A “shift” is defined by three parameters: a starting time index s, a fixed number of trips k, and a constant time gap d between consecutive trips.

codeforcescompetitive-programming
CF 103567D - (Не)достижимый идеал

We are given a fixed integer $N$ and a range of integers $[L, R)$, meaning all integers $X$ such that $L le X < R$. For each such $X$, we need to determine whether it satisfies a condition involving the greatest common divisor with $N$.

codeforcescompetitive-programming
CF 103567B - Шахматная доска

We are working with an $N times N$ chessboard where each cell is colored either black or white in the usual alternating pattern. Instead of just counting cells, each cell is assigned a growing integer value, and we need the total sum of all values on the board.

codeforcescompetitive-programming
CF 103567A - Треугольники

We are working with a fixed geometric configuration of 12 equally spaced points placed on a circle. Each triple of distinct points forms a triangle, and we are asked to count how many of these triangles have all three interior angles strictly acute.

codeforcescompetitive-programming
CF 103573C - Свободное перемещение

Let the alphabet be ${x1 < x2 < cdots < xt}$ with multiplicities $n1,ldots,nt$ and $sum{i=1}^t ni = n$. Algorithm L generates permutations in strict lexicographic order with respect to this ordered alphabet.

codeforcescompetitive-programming
CF 103573D - Подрыв ветряка

I don’t have the actual statement for Codeforces 103573D (“Подрыв ветряка”) in your prompt, so I can’t safely reconstruct the problem or produce a correct editorial without guessing.

codeforcescompetitive-programming
CF 103573B - Биомаркеры

I can’t reliably write a correct Codeforces-style editorial for “103573B - Биомаркеры” because the problem statement (input/output definition and constraints) is missing from your message.

codeforcescompetitive-programming
CF 103573A - Стать сильнее

I’m missing the actual problem statement for Codeforces 103573A - Стать сильнее, so I can’t responsibly write a correct editorial yet.

codeforcescompetitive-programming
TAOCP 7.2.1.2 Exercise 73

Let $G$ be the Cayley graph whose vertices are the $N$ permutations of the multiset ${s_0\cdot 0,\dots,s_d\cdot d}$ and whose edges correspond to adjacent interchanges $a_{\delta_k}\leftrightarrow a_{...

taocpmathematicsalgorithmsvolume-4math-hard
CF 103575B - Even Tree

Let the alphabet be ${x1 < x2 < cdots < xt}$ with multiplicities $n1,ldots,nt$ and $sum{i=1}^t ni = n$. Algorithm L generates permutations in strict lexicographic order with respect to this ordered alphabet.

codeforcescompetitive-programming
CF 103575E - Draft Laws

We are given a tree with $n$ vertices, and a palette of $k$ colors. Some vertices may already be fixed to a specific color, while others are free.

codeforcescompetitive-programming
CF 103575D - Add and Multiply

We are given two arrays of the same length. We are allowed to increase individual elements of the first array by some nonnegative amounts, and we increase the corresponding elements of the second array by the same chosen nonnegative amounts.

codeforcescompetitive-programming
CF 103575A - Designing a New Logo

We are working with a rectangular grid that needs to be “painted” using two types of cells, black cells that form a structural skeleton and white cells that can be expanded freely from that skeleton.

codeforcescompetitive-programming
CF 103575C - Primle

We are interacting with an unknown secret number that is guaranteed to be prime and has a fixed digit length. The only way to obtain information is by making queries: we output a candidate number, and for each position we receive feedback indicating whether our guess matches…

codeforcescompetitive-programming
CF 103577G - Matematical Transformation

We are given a tree rooted at node $1$, where every node stores a numeric value, initially $0$. Two types of operations are performed online. The first operation asks for the sum of values along the unique simple path between two nodes $u$ and $v$.

codeforcescompetitive-programming
TAOCP 7.2.1.2 Exercise 72

Let the multiset be $\{s_0 \cdot 0,\; s_1 \cdot 1,\; \ldots,\; s_d \cdot d\}, \qquad s_0 + s_1 + \cdots + s_d = n.$ Let $V$ be the set of all distinct permutations of this multiset.

taocpmathematicsalgorithmsvolume-4math-medium
TAOCP 7.2.1.2 Exercise 71

Let the multiset be $\{s_0 \cdot 0,\; s_1 \cdot 1,\; \ldots,\; s_d \cdot d\}, \qquad s_0 + s_1 + \cdots + s_d = n.$ Let $V$ be the set of all distinct permutations of this multiset.

taocpmathematicsalgorithmsvolume-4research
TAOCP 7.2.1.2 Exercise 70

Let $\sigma$ and $\tau$ be the two involutions on permutations of ${1,2,\dots,n}$ given by adjacent transpositions on disjoint parity classes, in the standard TAOCP σ–τ framework, so that every step o...

taocpmathematicsalgorithmsvolume-4math-hard
CF 103577L - Convert to heap

We are given a rooted tree where each vertex already has an integer value. The root is node 1. Alongside the tree, we are given a list of update values. Each update lets us pick any subset of vertices and add that update value to every chosen vertex.

codeforcescompetitive-programming
CF 103577M - Classroom Reordering

We are given an array that encodes a directed structure over n labeled chairs. Each index represents a chair, and each value tells us which chair is directly in front of it.

codeforcescompetitive-programming
CF 103577K - Walking Tiles

We are given two sets of points on an infinite 2D integer grid. One set contains “loose tiles” and the other contains “fixed tiles”.

codeforcescompetitive-programming
CF 103577J - Just enough squares

We are given a simple polygon drawn on top of a rectangular grid of unit squares. Each vertex of the polygon lies on integer coordinates, and the polygon edges are straight segments between consecutive vertices.

codeforcescompetitive-programming
CF 103577I - Impossible problems

We are given a set of $n$ problem setters and $n$ topics. Each ordered pair $(setter, topic)$ may have a cost, meaning how many hours that setter needs to prepare a problem of that topic. Only some of these pairs are available, given as $m$ entries.

codeforcescompetitive-programming
CF 103577H - Hiking trip

Three participants move along a straight line segment from position 0 to position d. Two of them, Eli and Rafa, move independently toward the same destination d with constant speeds, but they start at different positions and have different speeds.

codeforcescompetitive-programming
CF 103577F - Flow of binary matrix

We are maintaining an $n times n$ binary matrix that changes over time, and after every update we must report a single summary value called the flow. The flow is defined as the number of rows that consist entirely of ones plus the number of columns that consist entirely of ones.

codeforcescompetitive-programming
CF 103577E - Molecules

We are given a tree describing an open-chain molecule, meaning there are n atoms connected by n−1 bonds and there are no cycles. The task is to output a permutation of all atoms. For any such permutation, consider a fixed atom u.

codeforcescompetitive-programming
CF 103577C - Corona

Each test case gives a genome string, and we must assign a numerical score that comes from all of its contiguous substrings. For any substring, we look at how strongly its prefix pattern repeats at the end of itself.

codeforcescompetitive-programming
CF 103577A - Artistic Swimming

We are given a directed weighted graph where nodes represent designated points in a swimming pool and edges represent direct swimming routes between them. Each edge has a travel time.

codeforcescompetitive-programming
CF 103577D - Derivative of polynomial

The input is a single string that represents a polynomial written in a compact grammar. Unlike standard algebraic notation, there are no spaces and the structure is encoded using signs, digits, the variable x, and an optional exponent marker b.

codeforcescompetitive-programming
CF 103577B - Blockchain

We are given one or more undirected multigraphs. Each edge connects two vertices and carries a positive integer weight.

codeforcescompetitive-programming
CF 103584E - Truffula Trouble

I’m missing the actual problem statement for Codeforces 103584E - only the template is present. Without the description of the task, inputs, and outputs, I can’t reliably reconstruct the intended algorithm or write a correct editorial.

codeforcescompetitive-programming
TAOCP 7.2.1.2 Exercise 69

Each vertex is a permutation of the multiset ${0,0,0,1,1,1}$, hence each vertex is uniquely represented by a strictly increasing triple $c_3c_2c_1 \quad\text{with}\quad 5 \ge c_3 > c_2 > c_1 \ge 0,$ w...

taocpmathematicsalgorithmsvolume-4hard
CF 103584I - Baobab

The problem statement for Codeforces 103584I - Baobab is missing from your message, so I don’t have the actual rules, inputs, or task definition needed to write a correct editorial.

codeforcescompetitive-programming
CF 103584H - Sling Trees

I cannot produce a correct editorial yet because the actual problem statement for Codeforces 103584H - Sling Trees is not present in your prompt, and it is not accessible from the information provided.

codeforcescompetitive-programming
CF 103584G - Perfect Cacti: Part 1

The problem statement is missing, so there isn’t enough information to reconstruct what needs to be solved. “Perfect Cacti: Part 1” alone doesn’t tell us the input format, the required output, or even the core graph or combinatorial condition the solution is supposed to…

codeforcescompetitive-programming
CF 103584A - New Garden

We are given a nursery with a fixed number of tree slots, and a shop that sells several types of trees. Each type has a limited supply of identical seeds, and every seed of a type produces a tree with a fixed beauty value.

codeforcescompetitive-programming
CF 103584F - Giant Sequoia

I can’t write a correct Codeforces editorial without the actual problem statement. Right now “103584F - Giant Sequoia” is just a title in the prompt, and everything else (input format, task, constraints, operations on the “giant sequoia”, etc.) is missing.

codeforcescompetitive-programming
TAOCP 7.2.1.2 Exercise 68

Each vertex is a permutation of the multiset ${0,0,0,1,1,1}$, hence each vertex is uniquely represented by a strictly increasing triple $c_3c_2c_1 \quad\text{with}\quad 5 \ge c_3 > c_2 > c_1 \ge 0,$ w...

taocpmathematicsalgorithmsvolume-4math-hard
CF 103584B - White Goosefoot

Let $a{n-1}dots a1a0$ be a binary string with $sum{j=0}^{n-1} aj=t$ and define $bj=ajoplus a{j-1}$ for $1le jle n-1$. The energy is $r=sum{j=1}^{n-1} bj.$ Each $bj=1$ exactly when $ajne a{j-1}$, so $r$ equals the number of transitions in the sequence $a0,a1,dots,a{n-1}$.

codeforcescompetitive-programming
CF 103584D - Collecting Syrup

I can’t reliably write a correct editorial for this yet because the full statement of Codeforces 103584D - Collecting Syrup is not actually available in what you provided, and it also isn’t present in a standard accessible form from the problemset snippet I retrieved.

codeforcescompetitive-programming
TAOCP 7.2.1.2 Exercise 67

Each vertex is a permutation of the multiset ${0,0,0,1,1,1}$, hence each vertex is uniquely represented by a strictly increasing triple $c_3c_2c_1 \quad\text{with}\quad 5 \ge c_3 > c_2 > c_1 \ge 0,$ w...

taocpmathematicsalgorithmsvolume-4hard
CF 103584C - Redwoods

The problem statement is missing, so there isn’t enough information to write a correct editorial yet. “Codeforces 103584C - Redwoods” alone doesn’t tell us the actual task (tree structure, queries, DP, geometry, etc.

codeforcescompetitive-programming
CF 104508L - List of Orders

I can’t produce a correct editorial for this as-is because the actual problem content is missing. Right now the statement you provided only shows the title “List of Orders” with empty input/output sections, so there’s no way to know what the algorithmic task is, what…

codeforcescompetitive-programming
TAOCP 7.2.1.2 Exercise 66

Vertices are all permutations of the multiset ${0,0,0,1,1,1}$, equivalently all binary strings $a_5a_4a_3a_2a_1a_0$ with $\sum_{i=0}^5 a_i = 3$.

taocpmathematicsalgorithmsvolume-4medium
CF 104508M - More Japanese Monsters

A set $V subseteq {0,1}^n$ closed under $oplus$ (bitwise addition modulo $2$) is a vector space over $mathbb{F}2$ under the usual operations. The zero vector $0^n$ belongs to $V$, and closure under $oplus$ implies closure under finite XOR-sums.

codeforcescompetitive-programming
CF 104508F - Fake Solution

The problem statement you provided only contains the label “F” without any description of the input, output, or rules.

codeforcescompetitive-programming
TAOCP 7.2.1.2 Exercise 65

Let $q$ be a primitive $m$th root of unity and let N = n_1 + \cdots + n_t.

taocpmathematicsalgorithmsvolume-4math-medium
TAOCP 7.2.1.2 Exercise 64

Let $q$ be a primitive $m$th root of unity and let N = n_1 + \cdots + n_t.

taocpmathematicsalgorithmsvolume-4medium
CF 104508K - Known Problem

Let $C=(c1,c2,c3,c4,c5)$ be an ordered 5-card selection of distinct cards from a standard $52$-card deck, and let $k in {1,2,3,4,5}$ designate the starter card. The object counted is the pair $(C,k)$. Let $Sigma(C,k)$ denote the cribbage score defined by rules (i)-(v).

codeforcescompetitive-programming