{
  "index": "2017-A-4",
  "type": "COMB",
  "tag": [
    "COMB",
    "NT",
    "ALG"
  ],
  "difficulty": "",
  "question": "A class with $2N$ students took a quiz, on which the possible scores were $0,1,\\dots,10$. Each of these scores\noccurred at least once, and the average score was exactly $7.4$. Show that the class can be divided into two groups of $N$ students in such a way that the average score for each group was exactly $7.4$.",
  "solution": "\\textbf{First solution.}\nLet $a_1,\\dots,a_{2N}$ be the scores in nondecreasing order, and define the sums\n$s_i = \\sum_{j=i+1}^{i+N} a_j$ for $i=0,\\dots,N$.\nThen $s_0 \\leq \\cdots \\leq s_{N}$\nand\n$s_0 + s_{N} = \\sum_{j=1}^{2N} a_j = 7.4(2N)$,\nso $s_0 \\leq 7.4N \\leq s_N$. Let $i$ be the largest index for which $s_i \\leq 7.4N$;\nnote that we cannot have $i = N$, as otherwise $s_0 = s_N = 7.4N$ and hence \n$a_1 = \\cdots = a_{2N} = 7.4$, contradiction.\nThen $7.4N - s_i < s_{i+1} - s_i = a_{i+N+1} - a_i$ and so\n\\[\na_i < s_i + a_{i+N+1} - 7.4N \\leq a_{i+N+1};\n\\]\nsince all possible scores occur, this means that we can find $N$ scores with sum $7.4N$\nby taking $a_{i+1}, \\dots, a_{i+N+1}$ and omitting one occurrence of the value $s_i + a_{i+N+1} - 7.4N$.\n\n\\noindent\n\\textbf{Remark:}\nDavid Savitt (via Art of Problem Solving) points out that a similar argument applies provided that\nthere are an even number of students, the total score is even, and the achieved scores form a block of consecutive integers.\n\n\\noindent\n\\textbf{Second solution.}\nWe first claim that for any integer $m$ with $15 \\leq m \\leq 40$, we can find five distinct elements of the set $\\{1,2,\\ldots,10\\}$ whose sum is $m$. Indeed, for $0 \\leq k \\leq 4$ and $1 \\leq \\ell \\leq 6$, we have\n\\[\n\\left(\\sum_{j=1}^k j \\right) + (k+\\ell) + \\left(\\sum_{j=k+7}^{10} j \\right) = 34-5k+\\ell,\\]\nand for fixed $k$ this takes all values from $35-5k$ to $40-5k$ inclusive; then as $k$ ranges from $0$ to $4$, this takes all values from $15$ to $40$ inclusive.\n\nNow suppose that the scores are $a_1,\\ldots,a_{2N}$, where we order the scores so that $a_k=k$ for $k \\leq 10$ and the subsequence $a_{11},a_{12},\\ldots,a_{2N}$ is nondecreasing. For $1 \\leq k \\leq N-4$, define $S_k = \\sum_{j=k+10}^{k+N+4} a_j$. Note that for each $k$, $S_{k+1}-S_k = a_{k+N+5}-a_{k+10}$ and so $0 \\leq S_{k+1}-S_k \\leq 10$. Thus $S_1,\\ldots,S_{N-4}$ is a nondecreasing sequence of integers where each term is at most $10$ more than the previous one. On the other hand, we have \n\\begin{align*}\nS_1 + S_{N-4} &= \\sum_{j=11}^{2N} a_j \\\\\n&= (7.4)(2N)-\\sum_{j=1}^{10} a_j \\\\\n&= (7.4)(2N)-55,\n\\end{align*}\nwhence $S_1 \\leq 7.4N-27.5 \\leq S_{N-4}$. It follows that there is some $k$ such that $S_k \\in [7.4N-40, 7.4N-15]$, since this interval has length $25$ and $7.4N-27.5$ lies inside it.\n\n\nFor this value of $k$, note that both $S_k$ and $7.4N$ are integers (the latter since the sum of all scores in the class is the integer $(7.4)(2N)$ and so $N$ must be divisible by $5$). Thus there is an integer $m$ with $15 \\leq m \\leq 40$ for which $S_k = 7.4N-m$. By our first claim, we can choose five scores from $a_1,\\ldots,a_{10}$ whose sum is $m$. When we add these to the sum of the $N-5$ scores $a_{k+10},\\ldots,a_{k+N+4}$, we get precisely $7.4N$. We have now found $N$ scores whose sum is $7.4N$ and thus whose average is $7.4$.\n\n\\noindent\n\\textbf{Third solution.}\nIt will suffices to show that given any partition of the students into two groups of $N$, if the sums are not equal we can bring them closer together by swapping one pair of students between the two groups. To state this symbolically,\nlet $S$ be the set of students and, for any subset $T$ of $S$, let $\\Sigma T$ denote the sum of the scores of the students in $T$; we then show that if $S = A \\cup B$ is a partition into two $N$-element sets with\n$\\Sigma A > \\Sigma B$, then there exist students $a \\in A, B \\in B$ such that the sets\n\\[\nA' = A \\setminus \\{a\\} \\cup \\{b\\}, \\qquad\nB' = A \\setminus \\{b\\} \\cup \\{a\\}\n\\]\nsatisfy\n\\[\n0 \\leq \\Sigma A' - \\Sigma B' < \\Sigma A - \\Sigma B.\n\\]\nIn fact, this argument will apply at the same level of generality as in the remark following the first solution.\n\nTo prove the claim, let \n$a_1,\\dots,a_n$ be the scores in $A$ and let $b_1,\\dots,b_n$ be the scores in $B$ (in any order).\nSince $\\Sigma A - \\Sigma B \\equiv \\Sigma S \\pmod{2}$ and the latter is even, we must have\n$\\Sigma A - \\Sigma B \\geq 2$.\nIn particular, there must exist indices $i,j \\in \\{1,\\dots,n\\}$ such that $a_i > b_j$.\nConsequently, if we sort the sequence $a_1,\\dots,a_n,b_1,\\dots,b_n$ into nondecreasing order,\nit must be the case that some term $b_j$ is followed by some term $a_i$.\nMoreover, since the achieved scores form a range of consecutive integers, we must in fact have\n$a_i = b_j + 1$. Consequently, if we take $a = a_i$, $b = b_j$, we then have\n$\\Sigma A' - \\Sigma' B = \\Sigma A - \\Sigma B - 2$, which proves the claim.",
  "vars": [
    "a",
    "s",
    "S",
    "i",
    "j",
    "k",
    "l",
    "m",
    "n",
    "b",
    "A",
    "B",
    "\\\\Sigma"
  ],
  "params": [
    "N"
  ],
  "sci_consts": [],
  "variants": {
    "descriptive_long": {
      "map": {
        "a": "scoreval",
        "s": "subtotl",
        "S": "sumbloc",
        "i": "indexone",
        "j": "indextwo",
        "k": "indexthr",
        "l": "indexfor",
        "m": "indexfiv",
        "n": "indexsix",
        "b": "scorebrv",
        "A": "groupone",
        "B": "grouptwo",
        "\\Sigma": "totalsum",
        "N": "halfclass"
      },
      "question": "A class with $2halfclass$ students took a quiz, on which the possible scores were $0,1,\\dots,10$. Each of these scores occurred at least once, and the average score was exactly $7.4$. Show that the class can be divided into two groups of $halfclass$ students in such a way that the average score for each group was exactly $7.4$.",
      "solution": "\\textbf{First solution.}\nLet $scoreval_1,\\dots,scoreval_{2halfclass}$ be the scores in nondecreasing order, and define the sums\n$subtotl_{indexone} = \\sum_{indextwo=indexone+1}^{indexone+halfclass} scoreval_{indextwo}$ for $indexone=0,\\dots,halfclass$.\nThen $subtotl_0 \\leq \\cdots \\leq subtotl_{halfclass}$\nand\n$subtotl_0 + subtotl_{halfclass} = \\sum_{indextwo=1}^{2halfclass} scoreval_{indextwo} = 7.4(2halfclass)$,\nso $subtotl_0 \\leq 7.4halfclass \\leq subtotl_{halfclass}$. Let $indexone$ be the largest index for which $subtotl_{indexone} \\leq 7.4halfclass$;\nnote that we cannot have $indexone = halfclass$, as otherwise $subtotl_0 = subtotl_{halfclass} = 7.4halfclass$ and hence \n$scoreval_1 = \\cdots = scoreval_{2halfclass} = 7.4$, contradiction.\nThen $7.4halfclass - subtotl_{indexone} < subtotl_{indexone+1} - subtotl_{indexone} = scoreval_{indexone+halfclass+1} - scoreval_{indexone}$ and so\n\\[\nscoreval_{indexone} < subtotl_{indexone} + scoreval_{indexone+halfclass+1} - 7.4halfclass \\leq scoreval_{indexone+halfclass+1};\n\\]\nsince all possible scores occur, this means that we can find $halfclass$ scores with sum $7.4halfclass$\nby taking $scoreval_{indexone+1}, \\dots, scoreval_{indexone+halfclass+1}$ and omitting one occurrence of the value $subtotl_{indexone} + scoreval_{indexone+halfclass+1} - 7.4halfclass$.\n\n\\noindent\n\\textbf{Remark:}\nDavid Savitt (via Art of Problem Solving) points out that a similar argument applies provided that\nthere are an even number of students, the total score is even, and the achieved scores form a block of consecutive integers.\n\n\\noindent\n\\textbf{Second solution.}\nWe first claim that for any integer $indexfiv$ with $15 \\leq indexfiv \\leq 40$, we can find five distinct elements of the set $\\{1,2,\\ldots,10\\}$ whose sum is $indexfiv$. Indeed, for $0 \\leq indexthr \\leq 4$ and $1 \\leq indexfor \\leq 6$, we have\n\\[\n\\left(\\sum_{indextwo=1}^{indexthr} indextwo \\right) + (indexthr+indexfor) + \\left(\\sum_{indextwo=indexthr+7}^{10} indextwo \\right) = 34-5indexthr+indexfor,\\]\nand for fixed $indexthr$ this takes all values from $35-5indexthr$ to $40-5indexthr$ inclusive; then as $indexthr$ ranges from $0$ to $4$, this takes all values from $15$ to $40$ inclusive.\n\nNow suppose that the scores are $scoreval_1,\\ldots,scoreval_{2halfclass}$, where we order the scores so that $scoreval_{indexone}=indexone$ for $indexone \\leq 10$ and the subsequence $scoreval_{11},scoreval_{12},\\ldots,scoreval_{2halfclass}$ is nondecreasing. For $1 \\leq indexthr \\leq halfclass-4$, define $sumbloc_{indexthr} = \\sum_{indextwo=indexthr+10}^{indexthr+halfclass+4} scoreval_{indextwo}$. Note that for each $indexthr$, $sumbloc_{indexthr+1}-sumbloc_{indexthr} = scoreval_{indexthr+halfclass+5}-scoreval_{indexthr+10}$ and so $0 \\leq sumbloc_{indexthr+1}-sumbloc_{indexthr} \\leq 10$. Thus $sumbloc_1,\\ldots,sumbloc_{halfclass-4}$ is a nondecreasing sequence of integers where each term is at most $10$ more than the previous one. On the other hand, we have \n\\begin{align*}\nsumbloc_1 + sumbloc_{halfclass-4} &= \\sum_{indextwo=11}^{2halfclass} scoreval_{indextwo} \\\n&= (7.4)(2halfclass)-\\sum_{indextwo=1}^{10} scoreval_{indextwo} \\\\\n&= (7.4)(2halfclass)-55,\n\\end{align*}\nwhence $sumbloc_1 \\leq 7.4halfclass-27.5 \\leq sumbloc_{halfclass-4}$. It follows that there is some $indexthr$ such that $sumbloc_{indexthr} \\in [7.4halfclass-40, 7.4halfclass-15]$, since this interval has length $25$ and $7.4halfclass-27.5$ lies inside it.\n\n\nFor this value of $indexthr$, note that both $sumbloc_{indexthr}$ and $7.4halfclass$ are integers (the latter since the sum of all scores in the class is the integer $(7.4)(2halfclass)$ and so $halfclass$ must be divisible by $5$). Thus there is an integer $indexfiv$ with $15 \\leq indexfiv \\leq 40$ for which $sumbloc_{indexthr} = 7.4halfclass-indexfiv$. By our first claim, we can choose five scores from $scoreval_1,\\ldots,scoreval_{10}$ whose sum is $indexfiv$. When we add these to the sum of the $halfclass-5$ scores $scoreval_{indexthr+10},\\ldots,scoreval_{indexthr+halfclass+4}$, we get precisely $7.4halfclass$. We have now found $halfclass$ scores whose sum is $7.4halfclass$ and thus whose average is $7.4$.\n\n\\noindent\n\\textbf{Third solution.}\nIt will suffice to show that given any partition of the students into two groups of $halfclass$, if the sums are not equal we can bring them closer together by swapping one pair of students between the two groups. To state this symbolically,\nlet $sumbloc$ be the set of students and, for any subset $T$ of $sumbloc$, let $totalsum T$ denote the sum of the scores of the students in $T$; we then show that if $sumbloc = groupone \\cup grouptwo$ is a partition into two $halfclass$-element sets with\n$totalsum groupone > totalsum grouptwo$, then there exist students $a \\in groupone, b \\in grouptwo$ such that the sets\n\\[\ngroupone' = groupone \\setminus \\{a\\} \\cup \\{b\\}, \\qquad\ngrouptwo' = groupone \\setminus \\{b\\} \\cup \\{a\\}\n\\]\nsatisfy\n\\[\n0 \\leq totalsum groupone' - totalsum grouptwo' < totalsum groupone - totalsum grouptwo.\n\\]\nIn fact, this argument will apply at the same level of generality as in the remark following the first solution.\n\nTo prove the claim, let \n$scoreval_1,\\dots,scoreval_{indexsix}$ be the scores in $groupone$ and let $scorebrv_1,\\dots,scorebrv_{indexsix}$ be the scores in $grouptwo$ (in any order).\nSince $totalsum groupone - totalsum grouptwo \\equiv totalsum sumbloc \\pmod{2}$ and the latter is even, we must have\n$totalsum groupone - totalsum grouptwo \\geq 2$.\nIn particular, there must exist indices $indexone, indextwo \\in \\{1,\\dots,indexsix\\}$ such that $scoreval_{indexone} > scorebrv_{indextwo}$.\nConsequently, if we sort the sequence $scoreval_1,\\dots,scoreval_{indexsix},scorebrv_1,\\dots,scorebrv_{indexsix}$ into nondecreasing order,\nit must be the case that some term $scorebrv_{indextwo}$ is followed by some term $scoreval_{indexone}$.\nMoreover, since the achieved scores form a range of consecutive integers, we must in fact have\n$scoreval_{indexone} = scorebrv_{indextwo} + 1$. Consequently, if we take $a = scoreval_{indexone}$, $b = scorebrv_{indextwo}$, we then have\n$totalsum groupone' - totalsum grouptwo' = totalsum groupone - totalsum grouptwo - 2$, which proves the claim."
    },
    "descriptive_long_confusing": {
      "map": {
        "a": "pinecones",
        "s": "dragonfly",
        "S": "riverbank",
        "i": "blueberry",
        "j": "raspberry",
        "k": "cloudscape",
        "l": "honeycomb",
        "m": "thunderbolt",
        "n": "sailboats",
        "b": "marigolds",
        "A": "starlight",
        "B": "moondance",
        "\\\\Sigma": "\\\\hinterland",
        "N": "woodpecker"
      },
      "question": "A class with $2woodpecker$ students took a quiz, on which the possible scores were $0,1,\\dots,10$. Each of these scores occurred at least once, and the average score was exactly $7.4$. Show that the class can be divided into two groups of $woodpecker$ students in such a way that the average score for each group was exactly $7.4$.",
      "solution": "\\textbf{First solution.}\nLet $pinecones_1,\\dots,pinecones_{2woodpecker}$ be the scores in nondecreasing order, and define the sums\n$dragonfly_{blueberry} = \\sum_{raspberry=blueberry+1}^{blueberry+woodpecker} pinecones_{raspberry}$ for $blueberry=0,\\dots,woodpecker$.\nThen $dragonfly_0 \\leq \\cdots \\leq dragonfly_{woodpecker}$\nand\n$dragonfly_0 + dragonfly_{woodpecker} = \\sum_{raspberry=1}^{2woodpecker} pinecones_{raspberry} = 7.4(2woodpecker)$,\nso $dragonfly_0 \\leq 7.4woodpecker \\leq dragonfly_{woodpecker}$. Let blueberry be the largest index for which $dragonfly_{blueberry} \\leq 7.4woodpecker$;\nnote that we cannot have blueberry $= woodpecker$, as otherwise $dragonfly_0 = dragonfly_{woodpecker} = 7.4woodpecker$ and hence \n$pinecones_1 = \\cdots = pinecones_{2woodpecker} = 7.4$, contradiction.\nThen $7.4woodpecker - dragonfly_{blueberry} < dragonfly_{blueberry+1} - dragonfly_{blueberry} = pinecones_{blueberry+woodpecker+1} - pinecones_{blueberry}$ and so\n\\[\npinecones_{blueberry} < dragonfly_{blueberry} + pinecones_{blueberry+woodpecker+1} - 7.4woodpecker \\leq pinecones_{blueberry+woodpecker+1};\n\\]\nsince all possible scores occur, this means that we can find woodpecker scores with sum $7.4woodpecker$\nby taking $pinecones_{blueberry+1}, \\dots, pinecones_{blueberry+woodpecker+1}$ and omitting one occurrence of the value $dragonfly_{blueberry} + pinecones_{blueberry+woodpecker+1} - 7.4woodpecker$.\n\n\\noindent\n\\textbf{Remark:}\nDavid Savitt (via Art of Problem Solving) points out that a similar argument applies provided that\nthere are an even number of students, the total score is even, and the achieved scores form a block of consecutive integers.\n\n\\noindent\n\\textbf{Second solution.}\nWe first claim that for any integer thunderbolt with $15 \\leq thunderbolt \\leq 40$, we can find five distinct elements of the set $\\{1,2,\\ldots,10\\}$ whose sum is thunderbolt. Indeed, for $0 \\leq cloudscape \\leq 4$ and $1 \\leq honeycomb \\leq 6$, we have\n\\[\n\\left(\\sum_{raspberry=1}^{cloudscape} raspberry \\right) + (cloudscape+honeycomb) + \\left(\\sum_{raspberry=cloudscape+7}^{10} raspberry \\right) = 34-5cloudscape+honeycomb,\\]\nand for fixed cloudscape this takes all values from $35-5cloudscape$ to $40-5cloudscape$ inclusive; then as cloudscape ranges from $0$ to $4$, this takes all values from $15$ to $40$ inclusive.\n\nNow suppose that the scores are $pinecones_1,\\ldots,pinecones_{2woodpecker}$, where we order the scores so that $pinecones_{cloudscape}=cloudscape$ for $cloudscape \\leq 10$ and the subsequence $pinecones_{11},pinecones_{12},\\ldots,pinecones_{2woodpecker}$ is nondecreasing. For $1 \\leq cloudscape \\leq woodpecker-4$, define $riverbank_{cloudscape} = \\sum_{raspberry=cloudscape+10}^{cloudscape+woodpecker+4} pinecones_{raspberry}$. Note that for each cloudscape, $riverbank_{cloudscape+1}-riverbank_{cloudscape} = pinecones_{cloudscape+woodpecker+5}-pinecones_{cloudscape+10}$ and so $0 \\leq riverbank_{cloudscape+1}-riverbank_{cloudscape} \\leq 10$. Thus $riverbank_1,\\ldots,riverbank_{woodpecker-4}$ is a nondecreasing sequence of integers where each term is at most $10$ more than the previous one. On the other hand, we have \n\\begin{align*}\nriverbank_1 + riverbank_{woodpecker-4} &= \\sum_{raspberry=11}^{2woodpecker} pinecones_{raspberry} \\\\\n&= (7.4)(2woodpecker)-\\sum_{raspberry=1}^{10} pinecones_{raspberry} \\\\\n&= (7.4)(2woodpecker)-55,\n\\end{align*}\nwhence $riverbank_1 \\leq 7.4woodpecker-27.5 \\leq riverbank_{woodpecker-4}$. It follows that there is some cloudscape such that $riverbank_{cloudscape} \\in [7.4woodpecker-40, 7.4woodpecker-15]$, since this interval has length $25$ and $7.4woodpecker-27.5$ lies inside it.\n\nFor this value of cloudscape, note that both $riverbank_{cloudscape}$ and $7.4woodpecker$ are integers (the latter since the sum of all scores in the class is the integer $(7.4)(2woodpecker)$ and so woodpecker must be divisible by $5$). Thus there is an integer thunderbolt with $15 \\leq thunderbolt \\leq 40$ for which $riverbank_{cloudscape} = 7.4woodpecker-thunderbolt$. By our first claim, we can choose five scores from $pinecones_1,\\ldots,pinecones_{10}$ whose sum is thunderbolt. When we add these to the sum of the $woodpecker-5$ scores $pinecones_{cloudscape+10},\\ldots,pinecones_{cloudscape+woodpecker+4}$, we get precisely $7.4woodpecker$. We have now found woodpecker scores whose sum is $7.4woodpecker$ and thus whose average is $7.4$.\n\n\\noindent\n\\textbf{Third solution.}\nIt will suffices to show that given any partition of the students into two groups of woodpecker, if the sums are not equal we can bring them closer together by swapping one pair of students between the two groups. To state this symbolically,\nlet $riverbank$ be the set of students and, for any subset $T$ of $riverbank$, let $\\hinterland T$ denote the sum of the scores of the students in $T$; we then show that if $riverbank = starlight \\cup moondance$ is a partition into two woodpecker-element sets with\n$\\hinterland starlight > \\hinterland moondance$, then there exist students $a \\in starlight, B \\in moondance$ such that the sets\n\\[\nstarlight' = starlight \\setminus \\{a\\} \\cup \\{B\\}, \\qquad\nmoondance' = starlight \\setminus \\{B\\} \\cup \\{a\\}\n\\]\nsatisfy\n\\[\n0 \\leq \\hinterland starlight' - \\hinterland moondance' < \\hinterland starlight - \\hinterland moondance.\n\\]\nIn fact, this argument will apply at the same level of generality as in the remark following the first solution.\n\nTo prove the claim, let \n$pinecones_1,\\dots,pinecones_{sailboats}$ be the scores in starlight and let $marigolds_1,\\dots,marigolds_{sailboats}$ be the scores in moondance (in any order).\nSince $\\hinterland starlight - \\hinterland moondance \\equiv \\hinterland riverbank \\pmod{2}$ and the latter is even, we must have\n$\\hinterland starlight - \\hinterland moondance \\geq 2$.\nIn particular, there must exist indices blueberry,raspberry $\\in \\{1,\\dots,sailboats\\}$ such that $pinecones_{blueberry} > marigolds_{raspberry}$.\nConsequently, if we sort the sequence $pinecones_1,\\dots,pinecones_{sailboats},marigolds_1,\\dots,marigolds_{sailboats}$ into nondecreasing order,\nit must be the case that some term $marigolds_{raspberry}$ is followed by some term $pinecones_{blueberry}$.\nMoreover, since the achieved scores form a range of consecutive integers, we must in fact have\n$pinecones_{blueberry} = marigolds_{raspberry} + 1$. Consequently, if we take $a = pinecones_{blueberry}$, $B = marigolds_{raspberry}$, we then have\n$\\hinterland starlight' - \\hinterland' moondance = \\hinterland starlight - \\hinterland moondance - 2$, which proves the claim."
    },
    "descriptive_long_misleading": {
      "map": {
        "a": "penaltyscore",
        "s": "differencevalue",
        "S": "gapcollection",
        "i": "elementcontent",
        "j": "destination",
        "k": "endpointdata",
        "l": "depthvalue",
        "m": "gapnumber",
        "n": "limitless",
        "b": "rewardscore",
        "A": "voidteamset",
        "B": "fullteamset",
        "\\\\Sigma": "oppositesum",
        "N": "nullquantity"
      },
      "question": "A class with $2nullquantity$ students took a quiz, on which the possible scores were $0,1,\\dots,10$. Each of these scores occurred at least once, and the average score was exactly $7.4$. Show that the class can be divided into two groups of $nullquantity$ students in such a way that the average score for each group was exactly $7.4$.",
      "solution": "\\textbf{First solution.}\nLet $penaltyscore_1,\\dots,penaltyscore_{2nullquantity}$ be the scores in nondecreasing order, and define the sums\n$differencevalue_{\\elementcontent} = \\sum_{\\destination=\\elementcontent+1}^{\\elementcontent+nullquantity} penaltyscore_{\\destination}$ for $\\elementcontent=0,\\dots,nullquantity$.\nThen $differencevalue_0 \\leq \\cdots \\leq differencevalue_{nullquantity}$\nand\n$differencevalue_0 + differencevalue_{nullquantity} = \\sum_{\\destination=1}^{2nullquantity} penaltyscore_{\\destination} = 7.4(2nullquantity)$,\nso $differencevalue_0 \\leq 7.4nullquantity \\leq differencevalue_{nullquantity}$. Let $\\elementcontent$ be the largest index for which $differencevalue_{\\elementcontent} \\leq 7.4nullquantity$;\nnote that we cannot have $\\elementcontent = nullquantity$, as otherwise $differencevalue_0 = differencevalue_{nullquantity} = 7.4nullquantity$ and hence \n$penaltyscore_1 = \\cdots = penaltyscore_{2nullquantity} = 7.4$, contradiction.\nThen $7.4nullquantity - differencevalue_{\\elementcontent} < differencevalue_{\\elementcontent+1} - differencevalue_{\\elementcontent} = penaltyscore_{\\elementcontent+nullquantity+1} - penaltyscore_{\\elementcontent}$ and so\n\\[\npenaltyscore_{\\elementcontent} < differencevalue_{\\elementcontent} + penaltyscore_{\\elementcontent+nullquantity+1} - 7.4nullquantity \\leq penaltyscore_{\\elementcontent+nullquantity+1};\n\\]\nsince all possible scores occur, this means that we can find $nullquantity$ scores with sum $7.4nullquantity$\nby taking $penaltyscore_{\\elementcontent+1}, \\dots, penaltyscore_{\\elementcontent+nullquantity+1}$ and omitting one occurrence of the value $differencevalue_{\\elementcontent} + penaltyscore_{\\elementcontent+nullquantity+1} - 7.4nullquantity$.\n\n\\noindent\n\\textbf{Remark:}\nDavid Savitt (via Art of Problem Solving) points out that a similar argument applies provided that\nthere are an even number of students, the total score is even, and the achieved scores form a block of consecutive integers.\n\n\\noindent\n\\textbf{Second solution.}\nWe first claim that for any integer $gapnumber$ with $15 \\leq gapnumber \\leq 40$, we can find five distinct elements of the set $\\{1,2,\\ldots,10\\}$ whose sum is $gapnumber$. Indeed, for $0 \\leq endpointdata \\leq 4$ and $1 \\leq depthvalue \\leq 6$, we have\n\\[\n\\left(\\sum_{\\destination=1}^{endpointdata} \\destination \\right) + (endpointdata+depthvalue) + \\left(\\sum_{\\destination=endpointdata+7}^{10} \\destination \\right) = 34-5endpointdata+depthvalue,\\]\nand for fixed $endpointdata$ this takes all values from $35-5endpointdata$ to $40-5endpointdata$ inclusive; then as $endpointdata$ ranges from $0$ to $4$, this takes all values from $15$ to $40$ inclusive.\n\nNow suppose that the scores are $penaltyscore_1,\\ldots,penaltyscore_{2nullquantity}$, where we order the scores so that $penaltyscore_{endpointdata}=endpointdata$ for $endpointdata \\leq 10$ and the subsequence $penaltyscore_{11},penaltyscore_{12},\\ldots,penaltyscore_{2nullquantity}$ is nondecreasing. For $1 \\leq endpointdata \\leq nullquantity-4$, define $gapcollection_{endpointdata} = \\sum_{\\destination=endpointdata+10}^{endpointdata+nullquantity+4} penaltyscore_{\\destination}$. Note that for each $endpointdata$, $gapcollection_{endpointdata+1}-gapcollection_{endpointdata} = penaltyscore_{endpointdata+nullquantity+5}-penaltyscore_{endpointdata+10}$ and so $0 \\leq gapcollection_{endpointdata+1}-gapcollection_{endpointdata} \\leq 10$. Thus $gapcollection_1,\\ldots,gapcollection_{nullquantity-4}$ is a nondecreasing sequence of integers where each term is at most $10$ more than the previous one. On the other hand, we have \n\\begin{align*}\ngapcollection_1 + gapcollection_{nullquantity-4} &= \\sum_{\\destination=11}^{2nullquantity} penaltyscore_{\\destination} \\\\\n&= (7.4)(2nullquantity)-\\sum_{\\destination=1}^{10} penaltyscore_{\\destination} \\\\\n&= (7.4)(2nullquantity)-55,\n\\end{align*}\nwhence $gapcollection_1 \\leq 7.4nullquantity-27.5 \\leq gapcollection_{nullquantity-4}$. It follows that there is some $endpointdata$ such that $gapcollection_{endpointdata} \\in [7.4nullquantity-40, 7.4nullquantity-15]$, since this interval has length $25$ and $7.4nullquantity-27.5$ lies inside it.\n\n\nFor this value of $endpointdata$, note that both $gapcollection_{endpointdata}$ and $7.4nullquantity$ are integers (the latter since the sum of all scores in the class is the integer $(7.4)(2nullquantity)$ and so $nullquantity$ must be divisible by $5$). Thus there is an integer $gapnumber$ with $15 \\leq gapnumber \\leq 40$ for which $gapcollection_{endpointdata} = 7.4nullquantity-gapnumber$. By our first claim, we can choose five scores from $penaltyscore_1,\\ldots,penaltyscore_{10}$ whose sum is $gapnumber$. When we add these to the sum of the $nullquantity-5$ scores $penaltyscore_{endpointdata+10},\\ldots,penaltyscore_{endpointdata+nullquantity+4}$, we get precisely $7.4nullquantity$. We have now found $nullquantity$ scores whose sum is $7.4nullquantity$ and thus whose average is $7.4$.\n\n\\noindent\n\\textbf{Third solution.}\nIt will suffice to show that given any partition of the students into two groups of $nullquantity$, if the sums are not equal we can bring them closer together by swapping one pair of students between the two groups. To state this symbolically,\nlet $gapcollection$ be the set of students and, for any subset $T$ of $gapcollection$, let oppositesum T denote the sum of the scores of the students in $T$; we then show that if $gapcollection = voidteamset \\cup fullteamset$ is a partition into two $nullquantity$-element sets with\noppositesum voidteamset > oppositesum fullteamset, then there exist students $penaltyscore \\in voidteamset, rewardscore \\in fullteamset$ such that the sets\n\\[\nvoidteamset' = voidteamset \\setminus \\{penaltyscore\\} \\cup \\{rewardscore\\}, \\qquad\nfullteamset' = voidteamset \\setminus \\{rewardscore\\} \\cup \\{penaltyscore\\}\n\\]\nsatisfy\n\\[\n0 \\leq oppositesum voidteamset' - oppositesum fullteamset' < oppositesum voidteamset - oppositesum fullteamset.\n\\]\nIn fact, this argument will apply at the same level of generality as in the remark following the first solution.\n\nTo prove the claim, let \n$penaltyscore_1,\\dots,penaltyscore_{limitless}$ be the scores in voidteamset and let $rewardscore_1,\\dots,rewardscore_{limitless}$ be the scores in fullteamset (in any order).\nSince $oppositesum\\,voidteamset - oppositesum\\,fullteamset \\equiv oppositesum\\,gapcollection \\pmod{2}$ and the latter is even, we must have\n$oppositesum\\,voidteamset - oppositesum\\,fullteamset \\geq 2$.\nIn particular, there must exist indices $elementcontent,destination \\in \\{1,\\dots,limitless\\}$ such that $penaltyscore_{elementcontent} > rewardscore_{destination}$.\nConsequently, if we sort the sequence $penaltyscore_1,\\dots,penaltyscore_{limitless},rewardscore_1,\\dots,rewardscore_{limitless}$ into nondecreasing order,\nit must be the case that some term $rewardscore_{destination}$ is followed by some term $penaltyscore_{elementcontent}$.\nMoreover, since the achieved scores form a range of consecutive integers, we must in fact have\n$penaltyscore_{elementcontent} = rewardscore_{destination} + 1$. Consequently, if we take $penaltyscore = penaltyscore_{elementcontent}$, $rewardscore = rewardscore_{destination}$, we then have\n$oppositesum\\,voidteamset' - oppositesum\\,fullteamset = oppositesum\\,voidteamset - oppositesum\\,fullteamset - 2$, which proves the claim."
    },
    "garbled_string": {
      "map": {
        "a": "zyxwvuts",
        "s": "qlpnhrsm",
        "S": "tbcdwfrs",
        "i": "hgfedcba",
        "j": "plmoknij",
        "k": "wsxedcrf",
        "l": "bajshdke",
        "m": "ujmkoijn",
        "n": "rfvtgbyh",
        "b": "lkjhgfds",
        "A": "poiuytre",
        "B": "mnbvcxza",
        "\\Sigma": "qwertyui",
        "N": "asdfghjk"
      },
      "question": "A class with $2asdfghjk$ students took a quiz, on which the possible scores were $0,1,\\dots,10$. Each of these scores occurred at least once, and the average score was exactly $7.4$. Show that the class can be divided into two groups of $asdfghjk$ students in such a way that the average score for each group was exactly $7.4$.",
      "solution": "\\textbf{First solution.}\nLet $zyxwvuts_1,\\dots,zyxwvuts_{2asdfghjk}$ be the scores in nondecreasing order, and define the sums\n$qlpnhrsm_{hgfedcba} = \\sum_{plmoknij = hgfedcba + 1}^{hgfedcba + asdfghjk} zyxwvuts_{plmoknij}$ for $hgfedcba = 0,\\dots,asdfghjk$.\nThen $qlpnhrsm_0 \\leq \\cdots \\leq qlpnhrsm_{asdfghjk}$\nand\n$qlpnhrsm_0 + qlpnhrsm_{asdfghjk} = \\sum_{plmoknij=1}^{2asdfghjk} zyxwvuts_{plmoknij} = 7.4(2asdfghjk)$,\nso $qlpnhrsm_0 \\leq 7.4asdfghjk \\leq qlpnhrsm_{asdfghjk}$. Let $hgfedcba$ be the largest index for which $qlpnhrsm_{hgfedcba} \\leq 7.4asdfghjk$;\nnote that we cannot have $hgfedcba = asdfghjk$, as otherwise $qlpnhrsm_0 = qlpnhrsm_{asdfghjk} = 7.4asdfghjk$ and hence \n$zyxwvuts_1 = \\cdots = zyxwvuts_{2asdfghjk} = 7.4$, contradiction.\nThen $7.4asdfghjk - qlpnhrsm_{hgfedcba} < qlpnhrsm_{hgfedcba+1} - qlpnhrsm_{hgfedcba} = zyxwvuts_{hgfedcba+asdfghjk+1} - zyxwvuts_{hgfedcba}$ and so\n\\[\nzyxwvuts_{hgfedcba} < qlpnhrsm_{hgfedcba} + zyxwvuts_{hgfedcba+asdfghjk+1} - 7.4asdfghjk \\leq zyxwvuts_{hgfedcba+asdfghjk+1};\n\\]\nsince all possible scores occur, this means that we can find $asdfghjk$ scores with sum $7.4asdfghjk$\nby taking $zyxwvuts_{hgfedcba+1}, \\dots, zyxwvuts_{hgfedcba+asdfghjk+1}$ and omitting one occurrence of the value $qlpnhrsm_{hgfedcba} + zyxwvuts_{hgfedcba+asdfghjk+1} - 7.4asdfghjk$.\n\n\\noindent\n\\textbf{Remark:}\nDavid Savitt (via Art of Problem Solving) points out that a similar argument applies provided that\nthere are an even number of students, the total score is even, and the achieved scores form a block of consecutive integers.\n\n\\noindent\n\\textbf{Second solution.}\nWe first claim that for any integer $ujmkoijn$ with $15 \\leq ujmkoijn \\leq 40$, we can find five distinct elements of the set $\\{1,2,\\ldots,10\\}$ whose sum is $ujmkoijn$. Indeed, for $0 \\leq wsxedcrf \\leq 4$ and $1 \\leq bajshdke \\leq 6$, we have\n\\[\n\\left(\\sum_{plmoknij=1}^{wsxedcrf} plmoknij \\right) + (wsxedcrf+bajshdke) + \\left(\\sum_{plmoknij=wsxedcrf+7}^{10} plmoknij \\right) = 34-5wsxedcrf+bajshdke,\\]\nand for fixed $wsxedcrf$ this takes all values from $35-5wsxedcrf$ to $40-5wsxedcrf$ inclusive; then as $wsxedcrf$ ranges from $0$ to $4$, this takes all values from $15$ to $40$ inclusive.\n\nNow suppose that the scores are $zyxwvuts_1,\\ldots,zyxwvuts_{2asdfghjk}$, where we order the scores so that $zyxwvuts_{wsxedcrf}=wsxedcrf$ for $wsxedcrf \\leq 10$ and the subsequence $zyxwvuts_{11},zyxwvuts_{12},\\ldots,zyxwvuts_{2asdfghjk}$ is nondecreasing. For $1 \\leq wsxedcrf \\leq asdfghjk-4$, define $tbcdwfrs_{wsxedcrf} = \\sum_{plmoknij=wsxedcrf+10}^{wsxedcrf+asdfghjk+4} zyxwvuts_{plmoknij}$. Note that for each $wsxedcrf$, $tbcdwfrs_{wsxedcrf+1}-tbcdwfrs_{wsxedcrf} = zyxwvuts_{wsxedcrf+asdfghjk+5}-zyxwvuts_{wsxedcrf+10}$ and so $0 \\leq tbcdwfrs_{wsxedcrf+1}-tbcdwfrs_{wsxedcrf} \\leq 10$. Thus $tbcdwfrs_1,\\ldots,tbcdwfrs_{asdfghjk-4}$ is a nondecreasing sequence of integers where each term is at most $10$ more than the previous one. On the other hand, we have \n\\begin{align*}\ntbcdwfrs_1 + tbcdwfrs_{asdfghjk-4} &= \\sum_{plmoknij=11}^{2asdfghjk} zyxwvuts_{plmoknij} \\\\\n&= (7.4)(2asdfghjk)-\\sum_{plmoknij=1}^{10} zyxwvuts_{plmoknij} \\\\\n&= (7.4)(2asdfghjk)-55,\n\\end{align*}\nwhence $tbcdwfrs_1 \\leq 7.4asdfghjk-27.5 \\leq tbcdwfrs_{asdfghjk-4}$. It follows that there is some $wsxedcrf$ such that $tbcdwfrs_{wsxedcrf} \\in [7.4asdfghjk-40, 7.4asdfghjk-15]$, since this interval has length $25$ and $7.4asdfghjk-27.5$ lies inside it.\n\n\nFor this value of $wsxedcrf$, note that both $tbcdwfrs_{wsxedcrf}$ and $7.4asdfghjk$ are integers (the latter since the sum of all scores in the class is the integer $(7.4)(2asdfghjk)$ and so $asdfghjk$ must be divisible by $5$). Thus there is an integer $ujmkoijn$ with $15 \\leq ujmkoijn \\leq 40$ for which $tbcdwfrs_{wsxedcrf} = 7.4asdfghjk-ujmkoijn$. By our first claim, we can choose five scores from $zyxwvuts_1,\\ldots,zyxwvuts_{10}$ whose sum is $ujmkoijn$. When we add these to the sum of the $asdfghjk-5$ scores $zyxwvuts_{wsxedcrf+10},\\ldots,zyxwvuts_{wsxedcrf+asdfghjk+4}$, we get precisely $7.4asdfghjk$. We have now found $asdfghjk$ scores whose sum is $7.4asdfghjk$ and thus whose average is $7.4$.\n\n\\noindent\n\\textbf{Third solution.}\nIt will suffices to show that given any partition of the students into two groups of $asdfghjk$, if the sums are not equal we can bring them closer together by swapping one pair of students between the two groups. To state this symbolically,\nlet $tbcdwfrs$ be the set of students and, for any subset $T$ of $tbcdwfrs$, let $qwertyui T$ denote the sum of the scores of the students in $T$; we then show that if $tbcdwfrs = poiuytre \\cup mnbvcxza$ is a partition into two $asdfghjk$-element sets with\n$qwertyui poiuytre > qwertyui mnbvcxza$, then there exist students zyxwvuts \\in poiuytre, lkjhgfds \\in mnbvcxza such that the sets\n\\[\npoiuytre' = poiuytre \\setminus \\{zyxwvuts\\} \\cup \\{lkjhgfds\\}, \\qquad\nmnbvcxza' = poiuytre \\setminus \\{lkjhgfds\\} \\cup \\{zyxwvuts\\}\n\\]\nsatisfy\n\\[\n0 \\leq qwertyui poiuytre' - qwertyui mnbvcxza' < qwertyui poiuytre - qwertyui mnbvcxza.\n\\]\nIn fact, this argument will apply at the same level of generality as in the remark following the first solution.\n\nTo prove the claim, let \nzyxwvuts_1,\\dots,zyxwvuts_{rfvtgbyh} be the scores in poiuytre and let lkjhgfds_1,\\dots,lkjhgfds_{rfvtgbyh} be the scores in mnbvcxza (in any order).\nSince $qwertyui poiuytre - qwertyui mnbvcxza \\equiv qwertyui tbcdwfrs \\pmod{2}$ and the latter is even, we must have\n$qwertyui poiuytre - qwertyui mnbvcxza \\geq 2$.\nIn particular, there must exist indices hgfedcba,plmoknij \\in \\{1,\\dots,rfvtgbyh\\} such that zyxwvuts_{hgfedcba} > lkjhgfds_{plmoknij}.\nConsequently, if we sort the sequence zyxwvuts_1,\\dots,zyxwvuts_{rfvtgbyh},lkjhgfds_1,\\dots,lkjhgfds_{rfvtgbyh} into nondecreasing order,\nit must be the case that some term lkjhgfds_{plmoknij} is followed by some term zyxwvuts_{hgfedcba}.\nMoreover, since the achieved scores form a range of consecutive integers, we must in fact have\nzyxwvuts_{hgfedcba} = lkjhgfds_{plmoknij} + 1. Consequently, if we take zyxwvuts = zyxwvuts_{hgfedcba}, lkjhgfds = lkjhgfds_{plmoknij}, we then have\n$qwertyui poiuytre' - qwertyui mnbvcxza' = qwertyui poiuytre - qwertyui mnbvcxza - 2$, which proves the claim."
    },
    "kernel_variant": {
      "question": "A workshop had 2L participants, where L is a positive integer.  Each participant received an integer rating and the only possible ratings were the 15 consecutive integers 3,4,…,17.  Every one of these ratings was awarded to at least one participant.  The overall average rating of the workshop was exactly 10.6.  Prove that the participants can be partitioned into two groups of L participants each whose average rating is also 10.6.",
      "solution": "Let the 2L ratings be listed in non-decreasing order\n        a_1 \\le a_2 \\le \\dots \\le a_{2L}.\nBecause the ratings are integers and each of the 15 values 3,…,17 appears at least once, we certainly have\n        3 = a_1 \\le a_2 \\le \\dots \\le a_{2L} = 17.                 (0)\n(The extreme equalities follow from the assumption that 3 and 17 do occur and that no value lies outside that range.)\n\nThe total sum of all scores equals\n        (2L)·10.6 = 21.2L = \\dfrac{106}{5}L.\nHence 21.2L is an integer, so L must be a multiple of 5; in particular 10.6L is an integer as well.\n\nStep 1.  Consecutive block sums.\nFor i = 0,1,…,L define\n        s_i = a_{i+1}+a_{i+2}+⋯+a_{i+L}\n(the sum of the L consecutive ratings starting at index i+1).\nBecause the sequence (a_j) is non-decreasing, replacing a_{i+1} by the larger (or equal) a_{i+L+1} cannot decrease the sum; hence\n        s_0 ≤ s_1 ≤ ⋯ ≤ s_L.                                         (1)\nMoreover,\n        s_0 + s_L = \\sum_{j=1}^{2L} a_j = 21.2L,                    (2)\nso\n        s_0 ≤ 10.6L ≤ s_L.                                           (3)\n\nStep 2.  A perfect block or a straddle.\nIf some s_i equals 10.6L, then the block a_{i+1},…,a_{i+L} already gives the required group of L participants.  Hence assume no s_i equals 10.6L.  Choose the largest index i∈{0,1,…,L−1} for which\n        s_i < 10.6L < s_{i+1}.                                       (4)\nPut\n        d = 10.6L − s_i > 0,   and   x = a_{i+L+1} − d.             (5)\nBecause both 10.6L and s_i are integers, d is an integer, so x is an integer as well.  From (4) we also have\n        0 < d < s_{i+1} − s_i = a_{i+L+1} − a_{i+1},\nwhence\n        a_{i+1} < x < a_{i+L+1}.                                     (6)\n\nStep 3.  The value x really occurs among the ratings.\nBy (0) we know 3 ≤ a_{i+1} and a_{i+L+1} ≤ 17, so (6) forces\n        3 ≤ x ≤ 17.\nSince every integer from 3 through 17 occurs at least once, x is in fact one of the ratings.  Because the list (a_j) is non-decreasing and x lies strictly between a_{i+1} and a_{i+L+1}, the index of (at least one) occurrence of x must satisfy\n        j ∈ { i+2, i+3, … , i+L }.                                  (7)\n\nStep 4.  Remove x to get a sum of 10.6L.\nLet\n        B = { a_{i+1}, a_{i+2}, … , a_{i+L+1} }     (a multiset of size L+1).\nIts total is\n        Σ_{y∈B} y = s_i + a_{i+L+1}.                                (8)\nDelete one occurrence of x from B to obtain a multiset B′ of size L.  Using (5) and (8):\n        Σ_{y∈B′} y = (s_i + a_{i+L+1}) − x\n                     = s_i + a_{i+L+1} − [a_{i+L+1} − (10.6L − s_i)]\n                     = 10.6L.                                        (9)\nHence the L ratings in B′ have average 10.6.\n\nStep 5.  The complementary group also works.\nThe remaining L participants have total rating\n        21.2L − 10.6L = 10.6L,\nso their average is likewise 10.6.  Thus the class can be split into two equal halves, each with the required average.\n\nTherefore, under the stated conditions, such a partition always exists.",
      "_meta": {
        "core_steps": [
          "Sort all 2N scores increasingly.",
          "Define sliding-window sums s_i of N consecutive scores; the sequence s_i is non-decreasing.",
          "Use s_0 + s_N = total score to locate an index i with s_i ≤ target_sum ≤ s_{i+1}.",
          "Note s_{i+1}−s_i = a_{i+N+1}−a_i, so replacing a_i by a_{i+N+1} adjusts the sum by exactly that gap.",
          "Because every integer score in the interval occurs, one can choose N scores summing to the target, giving two groups with the required average."
        ],
        "mutable_slots": {
          "slot1": {
            "description": "Total number of students (must be even so both groups are equal-sized).",
            "original": "2N"
          },
          "slot2": {
            "description": "Consecutive integer score range available to students.",
            "original": "0–10 (inclusive)"
          },
          "slot3": {
            "description": "Common average score to be matched by each half of the class.",
            "original": "7.4"
          }
        }
      }
    }
  },
  "checked": true,
  "problem_type": "proof",
  "iteratively_fixed": true
}