File size: 94,766 Bytes
8f819dd 71b9d48 8f819dd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"README.md: 100%|ββββββββββ| 2.68k/2.68k [00:00<00:00, 12.6MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n",
"train-00009-of-00100.parquet: 100%|ββββββββββ| 4.23M/4.23M [00:00<00:00, 33.0MB/s]\n",
"train-00015-of-00100.parquet: 100%|ββββββββββ| 4.12M/4.12M [00:00<00:00, 27.0MB/s]\n",
"train-00001-of-00100.parquet: 100%|ββββββββββ| 4.55M/4.55M [00:00<00:00, 24.1MB/s]\n",
"train-00007-of-00100.parquet: 100%|ββββββββββ| 5.15M/5.15M [00:00<00:00, 27.1MB/s]\n",
"train-00005-of-00100.parquet: 100%|ββββββββββ| 5.08M/5.08M [00:00<00:00, 20.5MB/s]\n",
"train-00014-of-00100.parquet: 100%|ββββββββββ| 4.32M/4.32M [00:00<00:00, 29.7MB/s]\n",
"train-00000-of-00100.parquet: 100%|ββββββββββ| 5.94M/5.94M [00:00<00:00, 22.9MB/s]\n",
"train-00008-of-00100.parquet: 100%|ββββββββββ| 7.27M/7.27M [00:00<00:00, 22.7MB/s]\n",
"train-00013-of-00100.parquet: 100%|ββββββββββ| 4.48M/4.48M [00:00<00:00, 15.7MB/s]\n",
"train-00004-of-00100.parquet: 100%|ββββββββββ| 5.47M/5.47M [00:00<00:00, 15.9MB/s]\n",
"train-00010-of-00100.parquet: 100%|ββββββββββ| 3.20M/3.20M [00:00<00:00, 19.1MB/s]\n",
"train-00006-of-00100.parquet: 100%|ββββββββββ| 5.16M/5.16M [00:00<00:00, 16.5MB/s]\n",
"train-00003-of-00100.parquet: 100%|ββββββββββ| 6.07M/6.07M [00:00<00:00, 12.3MB/s]\n",
"train-00002-of-00100.parquet: 100%|ββββββββββ| 7.84M/7.84M [00:00<00:00, 13.7MB/s]\n",
"train-00016-of-00100.parquet: 100%|ββββββββββ| 4.87M/4.87M [00:00<00:00, 16.4MB/s]\n",
"train-00011-of-00100.parquet: 100%|ββββββββββ| 7.82M/7.82M [00:00<00:00, 14.0MB/s]\n",
"train-00020-of-00100.parquet: 100%|ββββββββββ| 3.25M/3.25M [00:00<00:00, 15.5MB/s]\n",
"train-00021-of-00100.parquet: 100%|ββββββββββ| 3.82M/3.82M [00:00<00:00, 27.0MB/s]\n",
"train-00018-of-00100.parquet: 100%|ββββββββββ| 3.82M/3.82M [00:00<00:00, 28.2MB/s]\n",
"train-00012-of-00100.parquet: 100%|ββββββββββ| 8.79M/8.79M [00:00<00:00, 15.5MB/s]\n",
"train-00023-of-00100.parquet: 100%|ββββββββββ| 3.61M/3.61M [00:00<00:00, 25.2MB/s]\n",
"train-00017-of-00100.parquet: 100%|ββββββββββ| 8.54M/8.54M [00:00<00:00, 21.3MB/s]\n",
"train-00026-of-00100.parquet: 100%|ββββββββββ| 6.83M/6.83M [00:00<00:00, 56.2MB/s]\n",
"train-00027-of-00100.parquet: 100%|ββββββββββ| 2.98M/2.98M [00:00<00:00, 27.6MB/s]\n",
"train-00030-of-00100.parquet: 100%|ββββββββββ| 6.40M/6.40M [00:00<00:00, 37.7MB/s]\n",
"train-00022-of-00100.parquet: 100%|ββββββββββ| 5.63M/5.63M [00:00<00:00, 13.7MB/s]\n",
"train-00024-of-00100.parquet: 100%|ββββββββββ| 10.4M/10.4M [00:00<00:00, 27.0MB/s]\n",
"train-00029-of-00100.parquet: 100%|ββββββββββ| 6.91M/6.91M [00:00<00:00, 32.5MB/s]\n",
"train-00028-of-00100.parquet: 100%|ββββββββββ| 4.77M/4.77M [00:00<00:00, 26.2MB/s]\n",
"train-00032-of-00100.parquet: 100%|ββββββββββ| 6.43M/6.43M [00:00<00:00, 42.0MB/s]\n",
"train-00034-of-00100.parquet: 100%|ββββββββββ| 7.59M/7.59M [00:00<00:00, 26.2MB/s]\n",
"train-00038-of-00100.parquet: 100%|ββββββββββ| 4.90M/4.90M [00:00<00:00, 34.5MB/s]\n",
"train-00037-of-00100.parquet: 100%|ββββββββββ| 6.53M/6.53M [00:00<00:00, 33.9MB/s]\n",
"train-00045-of-00100.parquet: 100%|ββββββββββ| 5.20M/5.20M [00:00<00:00, 129MB/s]\n",
"train-00041-of-00100.parquet: 100%|ββββββββββ| 5.55M/5.55M [00:00<00:00, 30.5MB/s]\n",
"train-00035-of-00100.parquet: 100%|ββββββββββ| 7.33M/7.33M [00:00<00:00, 18.9MB/s]\n",
"train-00043-of-00100.parquet: 100%|ββββββββββ| 5.15M/5.15M [00:00<00:00, 26.4MB/s]\n",
"train-00040-of-00100.parquet: 100%|ββββββββββ| 5.23M/5.23M [00:00<00:00, 25.2MB/s]\n",
"train-00025-of-00100.parquet: 100%|ββββββββββ| 7.97M/7.97M [00:00<00:00, 22.6MB/s]\n",
"train-00042-of-00100.parquet: 100%|ββββββββββ| 4.71M/4.71M [00:00<00:00, 26.8MB/s]\n",
"train-00036-of-00100.parquet: 100%|ββββββββββ| 16.3M/16.3M [00:00<00:00, 34.1MB/s]\n",
"train-00044-of-00100.parquet: 100%|ββββββββββ| 4.81M/4.81M [00:00<00:00, 18.3MB/s]\n",
"train-00047-of-00100.parquet: 100%|ββββββββββ| 5.03M/5.03M [00:00<00:00, 35.6MB/s]\n",
"train-00033-of-00100.parquet: 100%|ββββββββββ| 4.10M/4.10M [00:00<00:00, 39.0MB/s]\n",
"train-00050-of-00100.parquet: 100%|ββββββββββ| 3.06M/3.06M [00:00<00:00, 26.9MB/s]\n",
"train-00048-of-00100.parquet: 100%|ββββββββββ| 4.98M/4.98M [00:00<00:00, 24.4MB/s]\n",
"train-00049-of-00100.parquet: 100%|ββββββββββ| 6.26M/6.26M [00:00<00:00, 38.8MB/s]\n",
"train-00051-of-00100.parquet: 100%|ββββββββββ| 4.55M/4.55M [00:00<00:00, 26.6MB/s]\n",
"train-00031-of-00100.parquet: 100%|ββββββββββ| 18.9M/18.9M [00:00<00:00, 31.7MB/s]\n",
"train-00057-of-00100.parquet: 100%|ββββββββββ| 6.23M/6.23M [00:00<00:00, 42.9MB/s]\n",
"train-00056-of-00100.parquet: 100%|ββββββββββ| 4.92M/4.92M [00:00<00:00, 21.6MB/s]\n",
"train-00019-of-00100.parquet: 100%|ββββββββββ| 27.7M/27.7M [00:01<00:00, 20.5MB/s]\n",
"train-00055-of-00100.parquet: 100%|ββββββββββ| 6.29M/6.29M [00:00<00:00, 20.9MB/s]\n",
"train-00058-of-00100.parquet: 100%|ββββββββββ| 5.94M/5.94M [00:00<00:00, 58.9MB/s]\n",
"train-00053-of-00100.parquet: 100%|ββββββββββ| 6.28M/6.28M [00:00<00:00, 19.9MB/s]\n",
"train-00052-of-00100.parquet: 100%|ββββββββββ| 10.7M/10.7M [00:00<00:00, 25.9MB/s]\n",
"train-00060-of-00100.parquet: 100%|ββββββββββ| 3.88M/3.88M [00:00<00:00, 18.3MB/s]\n",
"train-00061-of-00100.parquet: 100%|ββββββββββ| 3.97M/3.97M [00:00<00:00, 31.3MB/s]\n",
"train-00062-of-00100.parquet: 100%|ββββββββββ| 4.22M/4.22M [00:00<00:00, 24.6MB/s]\n",
"train-00046-of-00100.parquet: 100%|ββββββββββ| 4.78M/4.78M [00:00<00:00, 21.0MB/s]\n",
"train-00059-of-00100.parquet: 100%|ββββββββββ| 11.8M/11.8M [00:00<00:00, 35.4MB/s]\n",
"train-00054-of-00100.parquet: 100%|ββββββββββ| 5.11M/5.11M [00:00<00:00, 24.3MB/s]\n",
"train-00064-of-00100.parquet: 100%|ββββββββββ| 3.93M/3.93M [00:00<00:00, 21.9MB/s]\n",
"train-00065-of-00100.parquet: 100%|ββββββββββ| 5.50M/5.50M [00:00<00:00, 25.6MB/s]\n",
"train-00068-of-00100.parquet: 100%|ββββββββββ| 4.39M/4.39M [00:00<00:00, 31.5MB/s]\n",
"train-00066-of-00100.parquet: 100%|ββββββββββ| 4.66M/4.66M [00:00<00:00, 33.3MB/s]\n",
"train-00070-of-00100.parquet: 100%|ββββββββββ| 3.81M/3.81M [00:00<00:00, 20.7MB/s]\n",
"train-00067-of-00100.parquet: 100%|ββββββββββ| 4.80M/4.80M [00:00<00:00, 18.1MB/s]\n",
"train-00071-of-00100.parquet: 100%|ββββββββββ| 3.68M/3.68M [00:00<00:00, 17.2MB/s]\n",
"train-00069-of-00100.parquet: 100%|ββββββββββ| 11.8M/11.8M [00:00<00:00, 45.0MB/s]\n",
"train-00075-of-00100.parquet: 100%|ββββββββββ| 3.91M/3.91M [00:00<00:00, 69.6MB/s]\n",
"train-00039-of-00100.parquet: 100%|ββββββββββ| 26.7M/26.7M [00:01<00:00, 21.6MB/s]\n",
"train-00072-of-00100.parquet: 100%|ββββββββββ| 5.95M/5.95M [00:00<00:00, 28.5MB/s]\n",
"train-00076-of-00100.parquet: 100%|ββββββββββ| 5.67M/5.67M [00:00<00:00, 35.3MB/s]\n",
"train-00078-of-00100.parquet: 100%|ββββββββββ| 4.83M/4.83M [00:00<00:00, 33.3MB/s]\n",
"train-00073-of-00100.parquet: 100%|ββββββββββ| 5.58M/5.58M [00:00<00:00, 21.6MB/s]\n",
"train-00074-of-00100.parquet: 100%|ββββββββββ| 6.45M/6.45M [00:00<00:00, 23.4MB/s]\n",
"train-00080-of-00100.parquet: 100%|ββββββββββ| 5.82M/5.82M [00:00<00:00, 39.1MB/s]\n",
"train-00083-of-00100.parquet: 100%|ββββββββββ| 4.38M/4.38M [00:00<00:00, 25.6MB/s]\n",
"train-00084-of-00100.parquet: 100%|ββββββββββ| 5.13M/5.13M [00:00<00:00, 26.5MB/s]\n",
"train-00077-of-00100.parquet: 100%|ββββββββββ| 13.7M/13.7M [00:00<00:00, 32.9MB/s]\n",
"train-00079-of-00100.parquet: 100%|ββββββββββ| 8.58M/8.58M [00:00<00:00, 22.4MB/s]\n",
"train-00087-of-00100.parquet: 100%|ββββββββββ| 4.42M/4.42M [00:00<00:00, 18.8MB/s]\n",
"train-00085-of-00100.parquet: 100%|ββββββββββ| 4.85M/4.85M [00:00<00:00, 25.1MB/s]\n",
"train-00088-of-00100.parquet: 100%|ββββββββββ| 6.75M/6.75M [00:00<00:00, 28.2MB/s]\n",
"train-00086-of-00100.parquet: 100%|ββββββββββ| 7.13M/7.13M [00:00<00:00, 25.4MB/s]\n",
"train-00063-of-00100.parquet: 100%|ββββββββββ| 7.38M/7.38M [00:00<00:00, 25.2MB/s]\n",
"train-00090-of-00100.parquet: 100%|ββββββββββ| 4.69M/4.69M [00:00<00:00, 21.0MB/s]\n",
"train-00081-of-00100.parquet: 100%|ββββββββββ| 15.5M/15.5M [00:00<00:00, 33.3MB/s]\n",
"train-00093-of-00100.parquet: 100%|ββββββββββ| 3.40M/3.40M [00:00<00:00, 20.0MB/s]\n",
"train-00092-of-00100.parquet: 100%|ββββββββββ| 5.41M/5.41M [00:00<00:00, 23.7MB/s]\n",
"train-00089-of-00100.parquet: 100%|ββββββββββ| 12.7M/12.7M [00:00<00:00, 38.5MB/s]\n",
"train-00094-of-00100.parquet: 100%|ββββββββββ| 4.42M/4.42M [00:00<00:00, 25.6MB/s]\n",
"train-00082-of-00100.parquet: 100%|ββββββββββ| 13.3M/13.3M [00:00<00:00, 26.2MB/s]\n",
"train-00091-of-00100.parquet: 100%|ββββββββββ| 8.62M/8.62M [00:00<00:00, 29.5MB/s]\n",
"train-00095-of-00100.parquet: 100%|ββββββββββ| 6.39M/6.39M [00:00<00:00, 33.5MB/s]\n",
"train-00097-of-00100.parquet: 100%|ββββββββββ| 4.50M/4.50M [00:00<00:00, 78.1MB/s]\n",
"train-00099-of-00100.parquet: 100%|ββββββββββ| 7.16M/7.16M [00:00<00:00, 87.1MB/s]\n",
"train-00096-of-00100.parquet: 100%|ββββββββββ| 4.81M/4.81M [00:00<00:00, 56.9MB/s]\n",
"train-00098-of-00100.parquet: 100%|ββββββββββ| 4.07M/4.07M [00:00<00:00, 121MB/s]\n",
"Downloading data: 100%|ββββββββββ| 100/100 [00:03<00:00, 30.82files/s]\n",
"Generating train split: 100%|ββββββββββ| 2616/2616 [00:04<00:00, 576.53 examples/s]\n"
]
}
],
"source": [
"from datasets import load_dataset\n",
"\n",
"# Login using e.g. `huggingface-cli login` to access this dataset\n",
"ds = load_dataset(\"Elfsong/leetcode_data\")"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'problem_id': 1545, 'title': 'form-largest-integer-with-digits-that-add-up-to-target', 'question_content': 'Given an array of integers `cost` and an integer `target`, return *the **maximum** integer you can paint under the following rules*:\\n\\n\\n- The cost of painting a digit `(i + 1)` is given by `cost[i]` (**0\\\\-indexed**).\\n- The total cost used must be equal to `target`.\\n- The integer does not have `0` digits.\\n\\n\\nSince the answer may be very large, return it as a string. If there is no way to paint any integer given the condition, return `\"0\"`.\\n\\n\\n \\n\\n\\n**Example 1:**\\n\\n\\n\\n```\\n\\nInput: cost = [4,3,2,5,6,7,2,5,5], target = 9\\nOutput: \"7772\"\\nExplanation: The cost to paint the digit \\'7\\' is 2, and the digit \\'2\\' is 3. Then cost(\"7772\") = 2*3+ 3*1 = 9. You could also paint \"977\", but \"7772\" is the largest number.\\nDigit cost\\n 1 -> 4\\n 2 -> 3\\n 3 -> 2\\n 4 -> 5\\n 5 -> 6\\n 6 -> 7\\n 7 -> 2\\n 8 -> 5\\n 9 -> 5\\n\\n```\\n\\n**Example 2:**\\n\\n\\n\\n```\\n\\nInput: cost = [7,6,5,5,5,6,8,7,8], target = 12\\nOutput: \"85\"\\nExplanation: The cost to paint the digit \\'8\\' is 7, and the digit \\'5\\' is 5. Then cost(\"85\") = 7 + 5 = 12.\\n\\n```\\n\\n**Example 3:**\\n\\n\\n\\n```\\n\\nInput: cost = [2,4,6,2,4,6,4,4,4], target = 5\\nOutput: \"0\"\\nExplanation: It is impossible to paint any integer with total cost equal to target.\\n\\n```\\n\\n \\n\\n\\n**Constraints:**\\n\\n\\n- `cost.length == 9`\\n- `1 <= cost[i], target <= 5000`\\n\\n\\n', 'difficulty': 'Hard', 'tags': ['array', 'dynamic-programming'], 'code_prompt': {'c': 'char* largestNumber(int* cost, int costSize, int target) {\\n \\n}', 'cpp': 'class Solution {\\npublic:\\n string largestNumber(vector<int>& cost, int target) {\\n \\n }\\n};', 'csharp': 'public class Solution {\\n public string LargestNumber(int[] cost, int target) {\\n \\n }\\n}', 'dart': 'class Solution {\\n String largestNumber(List<int> cost, int target) {\\n \\n }\\n}', 'elixir': 'defmodule Solution do\\n @spec largest_number(cost :: [integer], target :: integer) :: String.t\\n def largest_number(cost, target) do\\n \\n end\\nend', 'erlang': '-spec largest_number(Cost :: [integer()], Target :: integer()) -> unicode:unicode_binary().\\nlargest_number(Cost, Target) ->\\n .', 'golang': 'func largestNumber(cost []int, target int) string {\\n \\n}', 'java': 'class Solution {\\n public String largestNumber(int[] cost, int target) {\\n \\n }\\n}', 'javascript': '/**\\n * @param {number[]} cost\\n * @param {number} target\\n * @return {string}\\n */\\nvar largestNumber = function(cost, target) {\\n \\n};', 'kotlin': 'class Solution {\\n fun largestNumber(cost: IntArray, target: Int): String {\\n \\n }\\n}', 'php': 'class Solution {\\n\\n /**\\n * @param Integer[] $cost\\n * @param Integer $target\\n * @return String\\n */\\n function largestNumber($cost, $target) {\\n \\n }\\n}', 'python': 'class Solution(object):\\n def largestNumber(self, cost, target):\\n \"\"\"\\n :type cost: List[int]\\n :type target: int\\n :rtype: str\\n \"\"\"\\n ', 'python3': 'class Solution:\\n def largestNumber(self, cost: List[int], target: int) -> str:\\n ', 'racket': '(define/contract (largest-number cost target)\\n (-> (listof exact-integer?) exact-integer? string?)\\n )', 'ruby': '# @param {Integer[]} cost\\n# @param {Integer} target\\n# @return {String}\\ndef largest_number(cost, target)\\n \\nend', 'rust': 'impl Solution {\\n pub fn largest_number(cost: Vec<i32>, target: i32) -> String {\\n \\n }\\n}', 'scala': 'object Solution {\\n def largestNumber(cost: Array[Int], target: Int): String = {\\n \\n }\\n}', 'swift': 'class Solution {\\n func largestNumber(_ cost: [Int], _ target: Int) -> String {\\n \\n }\\n}', 'typescript': 'function largestNumber(cost: number[], target: number): string {\\n \\n};'}, 'solutions': {'bash': None, 'c': None, 'cpp': ['class Solution {\\npublic:\\n string largestNumber(vector<int>& cost, int target) {\\n vector <int> dp(target+1,-1);\\n dp[0]=0;\\n for(int i=0;i<=target;i++)\\n {\\n for(int j=0;j<cost.size();j++)\\n {\\n if(i-cost[j]>=0)\\n {\\n if(dp[i-cost[j]]!=-1)\\n {\\n dp[i]=max(dp[i],dp[i-cost[j]]+1);\\n }\\n }\\n }\\n }\\n string ans=\"\";\\n if(dp[target]==-1)\\n {\\n ans=\"0\";\\n return ans;\\n }\\n else\\n {\\n int ct=0;\\n while(target!=0)\\n {\\n for(int j=cost.size()-1;j>=0;j--)\\n {\\n if(target>=cost[j])\\n {\\n if(dp[target]==dp[target-cost[j]]+1)\\n {\\n ans+=(j+\\'1\\');\\n target=target-cost[j];\\n break;\\n }\\n }\\n }\\n }\\n }\\n return ans;\\n }\\n};'], 'csharp': None, 'dart': None, 'elixir': None, 'erlang': None, 'golang': ['func largestNumber(cost []int, target int) string {\\n\\n uniq := append([]int{}, cost...)\\n sort.Ints(uniq)\\n var u int\\n for _, x := range cost {\\n var bad bool\\n for _, y := range uniq[:u] {\\n if x % y == 0 {\\n bad = true\\n break\\n }\\n }\\n if !bad {\\n uniq[u] = x\\n u++\\n }\\n }\\n uniq = uniq[:u]\\n\\n\\tcache := make([]int, target+1)\\n\\n for t := 1; t <= target; t++ {\\n\\n\\t\\tcache[t] = math.MinInt\\n\\n\\t\\tfor _, c := range uniq {\\n\\t\\t\\tif t < c {\\n continue\\n\\t\\t\\t}\\n cache[t] = max(cache[t], 1 + cache[t-c])\\n\\t\\t}\\n\\n\\t}\\n\\n\\tif cache[target] < 0 {\\n\\t\\treturn \"0\"\\n\\t}\\n\\n\\tvar best strings.Builder\\n\\n\\tfor i := 8; i >= 0; i-- {\\n c := cost[i]\\n\\t\\tfor c <= target && cache[target] == cache[target - c] + 1 {\\n\\t\\t\\tbest.WriteByte(\\'1\\' + byte(i))\\n\\t\\t\\ttarget -= cost[i]\\n\\t\\t}\\n\\t}\\n\\n\\treturn best.String()\\n}\\n'], 'java': ['class Solution {\\n public String largestNumber(int[] cost, int target) {\\n int dp[] = new int[target + 1];\\n int trace[] = new int[target + 1];\\n int ans = largestNumber(cost, target, dp, trace);\\n if (ans <= 0)\\n return \"0\";\\n StringBuilder sb = new StringBuilder();\\n while (target > 0) {\\n sb.append(trace[target]);\\n target = target - cost[trace[target] - 1];\\n }\\n return sb.toString();\\n }\\n\\n public int largestNumber(int[] cost, int target, int[] dp, int[] trace) {\\n if (target < 0)\\n return -1;\\n\\n if (target == 0)\\n return 0;\\n\\n if (dp[target] != 0)\\n return dp[target];\\n\\n int ans = -1;\\n for (int i = 9; i > 0; i--) {\\n int curr = largestNumber(cost, target - cost[i - 1], dp, trace);\\n if (curr == -1)\\n continue;\\n if (curr + 1 > ans) {\\n ans = curr + 1;\\n trace[target] = i;\\n }\\n }\\n dp[target] = ans;\\n return ans;\\n }\\n}'], 'javascript': [\"var largestNumber = function(cost, target) {\\n const arr = new Array(target+1).fill('#');\\n arr[0] = '';\\n \\n for (let i = 0; i < 9; i++) {\\n for (let j = cost[i]; j <= target; j++) {\\n if (arr[j-cost[i]] !== '#' && arr[j-cost[i]].length + 1 >= arr[j].length) {\\n arr[j] = (i+1).toString().concat(arr[j-cost[i]]);\\n }\\n }\\n }\\n \\n return arr[target] == '#' ? '0' : arr[target];\\n};\", \"var largestNumber = function(cost, target) {\\n const arr = new Array(target+1).fill('#');\\n arr[0] = '';\\n \\n for (let i = 0; i < 9; i++) {\\n for (let j = cost[i]; j <= target; j++) {\\n if (arr[j-cost[i]] !== '#' && arr[j-cost[i]].length + 1 >= arr[j].length) {\\n arr[j] = (i+1).toString().concat(arr[j-cost[i]]);\\n }\\n }\\n }\\n \\n return arr[target] == '#' ? '0' : arr[target];\\n};\"], 'kotlin': None, 'mysql': None, 'oraclesql': None, 'php': None, 'python': None, 'python3': ['class Solution:\\n def largestNumber(self, cost: List[int], target: int) -> str:\\n # Initialize dp array, dp[i] represents the maximum length of the number with cost i\\n dp = [-1] * (target + 1)\\n dp[0] = 0 # Base case, cost 0 can form a number of length 0\\n\\n # Iterate through each digit and its cost\\n for digit in range(1, 10):\\n c = cost[digit - 1] # Cost of the current digit\\n for i in range(c, target + 1):\\n # If it\\'s possible to form a number with the remaining cost\\n if dp[i - c] != -1:\\n dp[i] = max(dp[i], dp[i - c] + 1)\\n\\n # If it\\'s not possible to form any number with the target cost\\n if dp[target] == -1:\\n return \"0\"\\n\\n # Construct the largest number by backtracking\\n result = []\\n curr_target = target\\n for digit in reversed(range(1, 10)):\\n c = cost[digit - 1]\\n while curr_target >= c and dp[curr_target - c] == dp[curr_target] - 1:\\n result.append(str(digit))\\n curr_target -= c\\n\\n return \\'\\'.join(result)\\n\\n# Example usage:\\nsolution = Solution()\\ncost = [4,3,2,5,6,7,2,5,5]\\ntarget = 9\\nprint(solution.largestNumber(cost, target)) # Output: \"7772\"'], 'pythondata': None, 'racket': None, 'react': None, 'ruby': ['def largest_number(cost, target)\\n dp = Array.new(target + 1, -1)\\n dp[0] = 0\\n (1..target).each do |t|\\n cost.each do |c|\\n if t >= c && dp[t - c] != -1\\n dp[t] = [dp[t], dp[t - c] + 1].max\\n end\\n end\\n end\\n return \"0\" if dp[target] == -1\\n res = \"\"\\n remain = target\\n while remain > 0\\n 8.downto(0) do |i|\\n c = cost[i]\\n if remain >= c && dp[remain] == dp[remain - c] + 1\\n res << (i + 1).to_s\\n remain -= c\\n break\\n end\\n end\\n end\\n res\\nend', 'def largest_number(cost, target)\\n dp = Array.new(target + 1, -1)\\n dp[0] = 0\\n (1..target).each do |t|\\n cost.each do |c|\\n if t >= c && dp[t - c] != -1\\n dp[t] = [dp[t], dp[t - c] + 1].max\\n end\\n end\\n end\\n return \"0\" if dp[target] == -1\\n res = \"\"\\n remain = target\\n while remain > 0\\n 8.downto(0) do |i|\\n c = cost[i]\\n if remain >= c && dp[remain] == dp[remain - c] + 1\\n res << (i + 1).to_s\\n remain -= c\\n break\\n end\\n end\\n end\\n res\\nend'], 'rust': None, 'scala': None, 'swift': None, 'typescript': None}, 'test_case_generator': 'def generate_test_cases(num_cases: int, seed: int = 42) -> list:\\n import random\\n random.seed(seed)\\n\\n # Sample solution based on the provided sample solution in the problem description.\\n def sample_solution(cost, target):\\n # dp[i] will represent the maximum number of digits that can be formed with cost i\\n dp = [-1] * (target + 1)\\n dp[0] = 0 # base case: cost 0 yields a \"number\" of length 0\\n \\n for digit in range(1, 10):\\n c = cost[digit - 1]\\n for t in range(c, target + 1):\\n if dp[t - c] != -1:\\n dp[t] = max(dp[t], dp[t - c] + 1)\\n \\n if dp[target] == -1:\\n return \"0\"\\n \\n result = []\\n curr_target = target\\n # Iterate from digit 9 to 1 to build the largest number\\n for digit in range(9, 0, -1):\\n c = cost[digit - 1]\\n while curr_target >= c and dp[curr_target - c] == dp[curr_target] - 1:\\n result.append(str(digit))\\n curr_target -= c\\n return \\'\\'.join(result)\\n\\n tests = []\\n\\n # Fixed examples from the problem description\\n fixed_examples = [\\n ([4, 3, 2, 5, 6, 7, 2, 5, 5], 9),\\n ([7, 6, 5, 5, 5, 6, 8, 7, 8], 12),\\n ([2, 4, 6, 2, 4, 6, 4, 4, 4], 5)\\n ]\\n\\n # Add fixed examples first (if num_cases is less than fixed examples, add only a subset)\\n for i in range(min(len(fixed_examples), num_cases)):\\n cost, target = fixed_examples[i]\\n expected = sample_solution(cost, target)\\n serialized_input = \",\".join(map(str, cost)) + \" \" + str(target)\\n tests.append({\"input\": serialized_input, \"output\": expected})\\n\\n # Generate additional random test cases if needed\\n remaining = num_cases - len(tests)\\n for _ in range(remaining):\\n # Generate a cost array of length 9 with diverse random values.\\n cost = []\\n for _ in range(9):\\n r = random.random()\\n if r < 0.3:\\n cost.append(random.randint(1, 10))\\n elif r < 0.6:\\n cost.append(random.randint(1, 50))\\n else:\\n cost.append(random.randint(1, 100))\\n \\n # Generate target with diverse ranges.\\n r = random.random()\\n if r < 0.15:\\n target_val = random.randint(1, 20)\\n elif r < 0.30:\\n target_val = random.randint(1, 100)\\n elif r < 0.45:\\n target_val = random.randint(1, 5000)\\n elif r < 0.60:\\n target_val = random.randint(50, 150)\\n else:\\n target_val = random.randint(10, 300)\\n\\n expected = sample_solution(cost, target_val)\\n serialized_input = \",\".join(map(str, cost)) + \" \" + str(target_val)\\n tests.append({\"input\": serialized_input, \"output\": expected})\\n\\n return tests', 'test_case_evaluator': 'def evaluate(expected_output: str, program_output: str) -> bool:\\n # Trim whitespace and newlines before comparing.\\n expected = expected_output.strip()\\n actual = program_output.strip()\\n return expected == actual', 'test_case_runners': {'cpp': '==Code Submission==\\n#include <iostream>\\n#include <sstream>\\n#include <vector>\\n#include <string>\\nusing namespace std;\\n\\npair<vector<int>, int> deserialize_stdin(const string& input) {\\n size_t spacePos = input.find(\\' \\');\\n string cost_part = input.substr(0, spacePos);\\n string target_str = input.substr(spacePos + 1);\\n vector<int> cost;\\n stringstream ss(cost_part);\\n string token;\\n while(getline(ss, token, \\',\\')) {\\n cost.push_back(stoi(token));\\n }\\n int target = stoi(target_str);\\n return {cost, target};\\n}\\n\\nstring serialize_stdout(const string &result) {\\n return result;\\n}\\n\\nint main() {\\n ios::sync_with_stdio(false);\\n cin.tie(nullptr);\\n string line;\\n getline(cin, line);\\n auto [cost, target] = deserialize_stdin(line);\\n Solution sol;\\n string ans = sol.largestNumber(cost, target);\\n cout << serialize_stdout(ans) << \"\\\\n\";\\n return 0;\\n}', 'golang': '==Code Submission==\\n\\nfunc main() {\\n reader := bufio.NewReader(os.Stdin)\\n line, _ := reader.ReadString(\\'\\\\n\\')\\n line = strings.TrimSpace(line)\\n parts := strings.SplitN(line, \" \", 2)\\n target, _ := strconv.Atoi(parts[1])\\n arrItems := strings.Split(parts[0], \",\")\\n cost := make([]int, len(arrItems))\\n for i, s := range arrItems {\\n cost[i], _ = strconv.Atoi(s)\\n }\\n ans := largestNumber(cost, target)\\n fmt.Println(ans)\\n}', 'java': 'public class Main {\\n private static int[] deserializeIntArray(String input) {\\n String[] parts = input.split(\",\");\\n int[] arr = new int[parts.length];\\n for (int i = 0; i < parts.length; i++) {\\n arr[i] = Integer.parseInt(parts[i]);\\n }\\n return arr;\\n }\\n \\n private static String serializeOutput(String result) {\\n return result;\\n }\\n \\n public static void main(String[] args) throws Exception {\\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\\n String line = br.readLine().trim();\\n String[] inputParts = line.split(\" \", 2);\\n int target = Integer.parseInt(inputParts[1]);\\n int[] cost = deserializeIntArray(inputParts[0]);\\n Solution sol = new Solution();\\n String ans = sol.largestNumber(cost, target);\\n System.out.println(serializeOutput(ans));\\n }\\n}\\n\\n==Code Submission==', 'javascript': \"==Code Submission==\\nconst deserialize_stdin = (input) => {\\n const [arrPart, t] = input.trim().split(' ', 2);\\n const target = parseInt(t, 10);\\n const cost = arrPart.split(',').map(x => parseInt(x, 10));\\n return { cost, target };\\n};\\n\\nconst serialize_stdout = (result) => {\\n return result;\\n};\\n\\nprocess.stdin.resume();\\nprocess.stdin.setEncoding('utf8');\\nlet input = '';\\nprocess.stdin.on('data', chunk => input += chunk);\\nprocess.stdin.on('end', () => {\\n const { cost, target } = deserialize_stdin(input);\\n const ans = largestNumber(cost, target);\\n console.log(serialize_stdout(ans));\\n});\", 'python3': 'class Solution:\\n def largestNumber(self, cost: List[int], target: int) -> str:\\n dp = [-1] * (target + 1)\\n dp[0] = 0 # Base case: 0 cost can form 0 digits\\n \\n # Update dp for each digit\\'s cost\\n for c in cost:\\n for t in range(c, target + 1):\\n if dp[t - c] != -1:\\n dp[t] = max(dp[t], dp[t - c] + 1)\\n \\n # If target is not achievable\\n if dp[target] == -1:\\n return \"0\"\\n \\n # Build the result by choosing the largest digits first\\n res = []\\n remaining = target\\n # Iterate from 9 down to 1 to get the largest possible digits\\n for i in range(8, -1, -1):\\n current_cost = cost[i]\\n digit = i + 1 # since cost is 0-indexed for digits 1-9\\n while remaining >= current_cost and dp[remaining - current_cost] == dp[remaining] - 1:\\n res.append(str(digit))\\n remaining -= current_cost\\n \\n return \\'\\'.join(res)\\n\\nif __name__ == \"__main__\":\\n line = sys.stdin.read().strip()\\n cost_part, target_str = line.split(\\' \\', 1)\\n cost = list(map(int, cost_part.split(\\',\\')))\\n target = int(target_str)\\n sol = Solution()\\n ans = sol.largestNumber(cost, target)\\n print(ans)', 'ruby': \"==Code Submission==\\n\\ninput = gets.strip\\narr_part, target_str = input.split(' ', 2)\\ncost = arr_part.split(',').map(&:to_i)\\ntarget = target_str.to_i\\nans = largest_number(cost, target)\\nputs ans\", 'rust': None}, 'test_cases': '[{\"input\": \"4,3,2,5,6,7,2,5,5 9\", \"output\": \"7772\"}, {\"input\": \"7,6,5,5,5,6,8,7,8 12\", \"output\": \"85\"}, {\"input\": \"2,4,6,2,4,6,4,4,4 5\", \"output\": \"0\"}, {\"input\": \"4,32,2,70,7,2,9,72,9 3680\", \"output\": \"6666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666\"}, {\"input\": \"1,21,44,4,44,7,6,6,69 13\", \"output\": \"1111111111111\"}, {\"input\": \"5,80,47,46,4,11,13,30,47 46\", \"output\": \"55555555511\"}, {\"input\": \"5,88,78,69,21,18,82,29,99 127\", \"output\": \"5511111111111111111\"}, {\"input\": \"41,5,10,41,8,42,17,9,48 124\", \"output\": \"822222222222222222222222\"}, {\"input\": \"15,18,6,15,3,55,25,30,36 15\", \"output\": \"55555\"}, {\"input\": \"15,69,99,15,3,47,34,98,2 162\", \"output\": \"999999999999999999999999999999999999999999999999999999999999999999999999999999999\"}, {\"input\": \"65,20,11,50,1,32,6,40,4 50\", \"output\": \"55555555555555555555555555555555555555555555555555\"}, {\"input\": \"8,98,9,8,22,10,14,97,26 214\", \"output\": \"74444444444444444444444444\"}, {\"input\": \"84,34,16,6,9,4,1,1,10 85\", \"output\": \"8888888888888888888888888888888888888888888888888888888888888888888888888888888888888\"}, {\"input\": \"28,47,74,16,53,2,46,30,7 60\", \"output\": \"666666666666666666666666666666\"}, {\"input\": \"6,14,4,9,18,5,36,9,12 131\", \"output\": \"66633333333333333333333333333333\"}, {\"input\": \"8,26,22,25,8,9,63,5,1 119\", \"output\": \"99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\"}, {\"input\": \"6,10,34,9,3,2,31,37,10 3\", \"output\": \"5\"}, {\"input\": \"38,21,27,41,7,5,49,2,37 47\", \"output\": \"8888888888888888888886\"}, {\"input\": \"33,6,32,11,35,79,84,43,39 63\", \"output\": \"44422222\"}, {\"input\": \"18,2,20,10,6,5,17,7,7 32\", \"output\": \"2222222222222222\"}, {\"input\": \"3,34,8,28,8,3,24,10,3 327\", \"output\": \"9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\"}, {\"input\": \"27,86,9,53,96,4,23,4,6 220\", \"output\": \"8888888888888888888888888888888888888888888888888888888\"}, {\"input\": \"95,35,2,3,29,8,15,4,18 152\", \"output\": \"3333333333333333333333333333333333333333333333333333333333333333333333333333\"}, {\"input\": \"33,35,2,5,5,10,47,56,66 19\", \"output\": \"53333333\"}, {\"input\": \"1,1,35,95,26,5,43,85,93 269\", \"output\": \"22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222\"}, {\"input\": \"27,45,3,7,23,39,1,14,38 174\", \"output\": \"777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777\"}, {\"input\": \"29,66,48,2,10,49,5,4,1 61\", \"output\": \"9999999999999999999999999999999999999999999999999999999999999\"}, {\"input\": \"99,7,74,7,16,1,99,100,12 275\", \"output\": \"66666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666\"}, {\"input\": \"36,2,30,72,49,79,65,36,11 253\", \"output\": \"92222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222\"}, {\"input\": \"49,5,67,16,2,31,6,11,4 1252\", \"output\": \"55555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555\"}, {\"input\": \"9,22,27,7,50,45,10,1,39 224\", \"output\": \"88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\"}, {\"input\": \"48,39,63,7,25,44,93,8,80 100\", \"output\": \"88444444444444\"}, {\"input\": \"43,7,8,5,14,22,49,7,2 145\", \"output\": \"99999999999999999999999999999999999999999999999999999999999999999999994\"}, {\"input\": \"23,2,84,1,26,80,3,8,14 82\", \"output\": \"4444444444444444444444444444444444444444444444444444444444444444444444444444444444\"}, {\"input\": \"22,96,100,40,1,74,49,46,10 134\", \"output\": \"55555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555\"}, {\"input\": \"5,77,73,45,43,33,2,63,6 245\", \"output\": \"7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777771\"}, {\"input\": \"56,9,35,69,60,47,21,12,8 60\", \"output\": \"9999998\"}, {\"input\": \"43,2,21,4,17,39,36,34,11 53\", \"output\": \"9222222222222222222222\"}, {\"input\": \"49,8,63,2,4,16,38,36,28 291\", \"output\": \"44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444441\"}, {\"input\": \"45,20,2,41,9,89,4,36,98 86\", \"output\": \"3333333333333333333333333333333333333333333\"}, {\"input\": \"25,6,1,17,1,45,82,63,1 110\", \"output\": \"99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\"}, {\"input\": \"22,1,8,2,5,44,3,39,4 14\", \"output\": \"22222222222222\"}, {\"input\": \"80,9,29,10,40,4,95,4,34 90\", \"output\": \"888888888888888888884\"}, {\"input\": \"9,1,45,19,5,90,10,34,81 75\", \"output\": \"222222222222222222222222222222222222222222222222222222222222222222222222222\"}, {\"input\": \"35,3,19,3,77,73,57,5,35 113\", \"output\": \"8444444444444444444444444444444444444\"}, {\"input\": \"39,7,78,2,10,2,87,74,3 133\", \"output\": \"966666666666666666666666666666666666666666666666666666666666666666\"}, {\"input\": \"18,10,32,61,22,7,43,32,7 291\", \"output\": \"9999999999999999999999999999999999999991\"}, {\"input\": \"2,21,7,1,70,4,6,64,98 9\", \"output\": \"444444444\"}, {\"input\": \"19,45,2,78,91,9,7,2,8 88\", \"output\": \"88888888888888888888888888888888888888888888\"}, {\"input\": \"46,5,31,32,10,39,9,36,54 4160\", \"output\": \"2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222\"}, {\"input\": \"1,5,75,63,58,23,49,30,25 132\", \"output\": \"111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\"}, {\"input\": \"15,53,8,49,43,84,64,17,38 823\", \"output\": \"333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333331\"}, {\"input\": \"57,8,3,42,10,17,45,6,87 204\", \"output\": \"33333333333333333333333333333333333333333333333333333333333333333333\"}, {\"input\": \"81,98,35,2,5,96,2,91,57 39\", \"output\": \"777777777777777775\"}, {\"input\": \"6,4,6,16,37,24,2,49,31 124\", \"output\": \"77777777777777777777777777777777777777777777777777777777777777\"}, {\"input\": \"8,59,1,60,87,5,23,39,55 243\", \"output\": \"333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333\"}, {\"input\": \"26,62,7,37,5,7,10,100,7 264\", \"output\": \"9955555555555555555555555555555555555555555555555555\"}, {\"input\": \"37,30,46,4,87,99,18,81,40 27\", \"output\": \"0\"}, {\"input\": \"47,5,27,3,47,18,33,62,38 183\", \"output\": \"4444444444444444444444444444444444444444444444444444444444444\"}, {\"input\": \"60,19,29,93,51,72,26,9,6 144\", \"output\": \"999999999999999999999999\"}, {\"input\": \"41,14,61,9,40,2,60,39,15 2\", \"output\": \"6\"}, {\"input\": \"32,4,18,24,96,70,48,54,63 153\", \"output\": \"93222222222222222222\"}, {\"input\": \"6,8,47,6,42,26,2,59,4 20\", \"output\": \"7777777777\"}, {\"input\": \"6,3,27,9,4,30,10,77,3 286\", \"output\": \"99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999995\"}, {\"input\": \"3,1,6,31,2,1,7,48,8 272\", \"output\": \"66666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666\"}, {\"input\": \"29,40,9,42,8,52,7,29,2 1216\", \"output\": \"99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\"}, {\"input\": \"5,75,21,39,30,28,2,84,71 120\", \"output\": \"777777777777777777777777777777777777777777777777777777777777\"}, {\"input\": \"15,30,47,7,17,10,61,2,2 200\", \"output\": \"9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\"}, {\"input\": \"72,9,43,6,97,47,5,46,9 85\", \"output\": \"77777777777777777\"}, {\"input\": \"7,36,49,4,72,80,83,39,89 24\", \"output\": \"444444\"}, {\"input\": \"5,45,3,26,1,9,7,11,47 4650\", \"output\": \"555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555\"}, {\"input\": \"4,10,2,7,29,14,15,8,10 135\", \"output\": \"43333333333333333333333333333333333333333333333333333333333333333\"}, {\"input\": \"15,39,4,14,98,6,8,23,9 266\", \"output\": \"633333333333333333333333333333333333333333333333333333333333333333\"}, {\"input\": \"43,10,48,1,5,74,26,54,7 11\", \"output\": \"44444444444\"}, {\"input\": \"10,45,12,7,10,6,20,29,11 4\", \"output\": \"0\"}, {\"input\": \"13,45,42,31,5,10,2,8,37 239\", \"output\": \"7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777775\"}, {\"input\": \"73,80,41,29,8,36,23,20,3 10\", \"output\": \"0\"}, {\"input\": \"2,65,38,48,58,74,42,65,1 93\", \"output\": \"999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\"}, {\"input\": \"11,12,8,68,11,19,50,39,6 4\", \"output\": \"0\"}, {\"input\": \"25,10,43,3,40,90,17,6,25 178\", \"output\": \"444444444444444444444444444444444444444444444444444444442\"}, {\"input\": \"86,95,68,7,2,12,44,63,3 38\", \"output\": \"5555555555555555555\"}, {\"input\": \"13,35,68,6,80,7,3,99,22 32\", \"output\": \"77777766\"}, {\"input\": \"44,57,97,58,4,31,25,37,60 205\", \"output\": \"7555555555555555555555555555555555555555555555\"}, {\"input\": \"27,26,18,7,48,7,67,37,3 66\", \"output\": \"9999999999999999999999\"}, {\"input\": \"7,4,45,54,9,25,48,6,92 84\", \"output\": \"222222222222222222222\"}, {\"input\": \"5,61,18,61,1,3,3,47,55 10\", \"output\": \"5555555555\"}, {\"input\": \"2,7,80,8,64,2,74,3,1 133\", \"output\": \"9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\"}, {\"input\": \"12,11,24,9,33,25,6,48,1 554\", \"output\": \"99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\"}, {\"input\": \"47,14,95,18,9,42,8,62,18 15\", \"output\": \"0\"}, {\"input\": \"4,4,41,66,35,3,25,1,43 48\", \"output\": \"888888888888888888888888888888888888888888888888\"}, {\"input\": \"26,50,12,32,34,2,11,12,21 11\", \"output\": \"7\"}, {\"input\": \"40,46,45,29,6,56,1,7,48 25\", \"output\": \"7777777777777777777777777\"}, {\"input\": \"10,57,2,6,37,3,48,49,3 100\", \"output\": \"33333333333333333333333333333333333333333333333333\"}, {\"input\": \"18,2,3,25,16,5,28,37,63 18\", \"output\": \"222222222\"}, {\"input\": \"58,8,88,41,91,9,5,92,90 195\", \"output\": \"777777777777777777777777777777777777777\"}, {\"input\": \"8,18,8,9,30,71,2,7,93 102\", \"output\": \"777777777777777777777777777777777777777777777777777\"}, {\"input\": \"74,6,58,34,50,38,3,4,67 22\", \"output\": \"8777777\"}, {\"input\": \"4,34,11,9,5,12,11,38,10 182\", \"output\": \"551111111111111111111111111111111111111111111\"}, {\"input\": \"73,1,10,4,54,4,41,42,62 88\", \"output\": \"2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222\"}, {\"input\": \"30,1,7,14,10,46,23,17,66 90\", \"output\": \"222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222\"}]'}\n"
]
}
],
"source": [
"for instance in ds['train']:\n",
" print(instance)\n",
" break"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'problem_id': 1545,\n",
" 'title': 'form-largest-integer-with-digits-that-add-up-to-target',\n",
" 'question_content': 'Given an array of integers `cost` and an integer `target`, return *the **maximum** integer you can paint under the following rules*:\\n\\n\\n- The cost of painting a digit `(i + 1)` is given by `cost[i]` (**0\\\\-indexed**).\\n- The total cost used must be equal to `target`.\\n- The integer does not have `0` digits.\\n\\n\\nSince the answer may be very large, return it as a string. If there is no way to paint any integer given the condition, return `\"0\"`.\\n\\n\\n \\n\\n\\n**Example 1:**\\n\\n\\n\\n```\\n\\nInput: cost = [4,3,2,5,6,7,2,5,5], target = 9\\nOutput: \"7772\"\\nExplanation: The cost to paint the digit \\'7\\' is 2, and the digit \\'2\\' is 3. Then cost(\"7772\") = 2*3+ 3*1 = 9. You could also paint \"977\", but \"7772\" is the largest number.\\nDigit cost\\n 1 -> 4\\n 2 -> 3\\n 3 -> 2\\n 4 -> 5\\n 5 -> 6\\n 6 -> 7\\n 7 -> 2\\n 8 -> 5\\n 9 -> 5\\n\\n```\\n\\n**Example 2:**\\n\\n\\n\\n```\\n\\nInput: cost = [7,6,5,5,5,6,8,7,8], target = 12\\nOutput: \"85\"\\nExplanation: The cost to paint the digit \\'8\\' is 7, and the digit \\'5\\' is 5. Then cost(\"85\") = 7 + 5 = 12.\\n\\n```\\n\\n**Example 3:**\\n\\n\\n\\n```\\n\\nInput: cost = [2,4,6,2,4,6,4,4,4], target = 5\\nOutput: \"0\"\\nExplanation: It is impossible to paint any integer with total cost equal to target.\\n\\n```\\n\\n \\n\\n\\n**Constraints:**\\n\\n\\n- `cost.length == 9`\\n- `1 <= cost[i], target <= 5000`\\n\\n\\n',\n",
" 'difficulty': 'Hard',\n",
" 'tags': ['array', 'dynamic-programming'],\n",
" 'code_prompt': {'c': 'char* largestNumber(int* cost, int costSize, int target) {\\n \\n}',\n",
" 'cpp': 'class Solution {\\npublic:\\n string largestNumber(vector<int>& cost, int target) {\\n \\n }\\n};',\n",
" 'csharp': 'public class Solution {\\n public string LargestNumber(int[] cost, int target) {\\n \\n }\\n}',\n",
" 'dart': 'class Solution {\\n String largestNumber(List<int> cost, int target) {\\n \\n }\\n}',\n",
" 'elixir': 'defmodule Solution do\\n @spec largest_number(cost :: [integer], target :: integer) :: String.t\\n def largest_number(cost, target) do\\n \\n end\\nend',\n",
" 'erlang': '-spec largest_number(Cost :: [integer()], Target :: integer()) -> unicode:unicode_binary().\\nlargest_number(Cost, Target) ->\\n .',\n",
" 'golang': 'func largestNumber(cost []int, target int) string {\\n \\n}',\n",
" 'java': 'class Solution {\\n public String largestNumber(int[] cost, int target) {\\n \\n }\\n}',\n",
" 'javascript': '/**\\n * @param {number[]} cost\\n * @param {number} target\\n * @return {string}\\n */\\nvar largestNumber = function(cost, target) {\\n \\n};',\n",
" 'kotlin': 'class Solution {\\n fun largestNumber(cost: IntArray, target: Int): String {\\n \\n }\\n}',\n",
" 'php': 'class Solution {\\n\\n /**\\n * @param Integer[] $cost\\n * @param Integer $target\\n * @return String\\n */\\n function largestNumber($cost, $target) {\\n \\n }\\n}',\n",
" 'python': 'class Solution(object):\\n def largestNumber(self, cost, target):\\n \"\"\"\\n :type cost: List[int]\\n :type target: int\\n :rtype: str\\n \"\"\"\\n ',\n",
" 'python3': 'class Solution:\\n def largestNumber(self, cost: List[int], target: int) -> str:\\n ',\n",
" 'racket': '(define/contract (largest-number cost target)\\n (-> (listof exact-integer?) exact-integer? string?)\\n )',\n",
" 'ruby': '# @param {Integer[]} cost\\n# @param {Integer} target\\n# @return {String}\\ndef largest_number(cost, target)\\n \\nend',\n",
" 'rust': 'impl Solution {\\n pub fn largest_number(cost: Vec<i32>, target: i32) -> String {\\n \\n }\\n}',\n",
" 'scala': 'object Solution {\\n def largestNumber(cost: Array[Int], target: Int): String = {\\n \\n }\\n}',\n",
" 'swift': 'class Solution {\\n func largestNumber(_ cost: [Int], _ target: Int) -> String {\\n \\n }\\n}',\n",
" 'typescript': 'function largestNumber(cost: number[], target: number): string {\\n \\n};'},\n",
" 'solutions': {'bash': None,\n",
" 'c': None,\n",
" 'cpp': ['class Solution {\\npublic:\\n string largestNumber(vector<int>& cost, int target) {\\n vector <int> dp(target+1,-1);\\n dp[0]=0;\\n for(int i=0;i<=target;i++)\\n {\\n for(int j=0;j<cost.size();j++)\\n {\\n if(i-cost[j]>=0)\\n {\\n if(dp[i-cost[j]]!=-1)\\n {\\n dp[i]=max(dp[i],dp[i-cost[j]]+1);\\n }\\n }\\n }\\n }\\n string ans=\"\";\\n if(dp[target]==-1)\\n {\\n ans=\"0\";\\n return ans;\\n }\\n else\\n {\\n int ct=0;\\n while(target!=0)\\n {\\n for(int j=cost.size()-1;j>=0;j--)\\n {\\n if(target>=cost[j])\\n {\\n if(dp[target]==dp[target-cost[j]]+1)\\n {\\n ans+=(j+\\'1\\');\\n target=target-cost[j];\\n break;\\n }\\n }\\n }\\n }\\n }\\n return ans;\\n }\\n};'],\n",
" 'csharp': None,\n",
" 'dart': None,\n",
" 'elixir': None,\n",
" 'erlang': None,\n",
" 'golang': ['func largestNumber(cost []int, target int) string {\\n\\n uniq := append([]int{}, cost...)\\n sort.Ints(uniq)\\n var u int\\n for _, x := range cost {\\n var bad bool\\n for _, y := range uniq[:u] {\\n if x % y == 0 {\\n bad = true\\n break\\n }\\n }\\n if !bad {\\n uniq[u] = x\\n u++\\n }\\n }\\n uniq = uniq[:u]\\n\\n\\tcache := make([]int, target+1)\\n\\n for t := 1; t <= target; t++ {\\n\\n\\t\\tcache[t] = math.MinInt\\n\\n\\t\\tfor _, c := range uniq {\\n\\t\\t\\tif t < c {\\n continue\\n\\t\\t\\t}\\n cache[t] = max(cache[t], 1 + cache[t-c])\\n\\t\\t}\\n\\n\\t}\\n\\n\\tif cache[target] < 0 {\\n\\t\\treturn \"0\"\\n\\t}\\n\\n\\tvar best strings.Builder\\n\\n\\tfor i := 8; i >= 0; i-- {\\n c := cost[i]\\n\\t\\tfor c <= target && cache[target] == cache[target - c] + 1 {\\n\\t\\t\\tbest.WriteByte(\\'1\\' + byte(i))\\n\\t\\t\\ttarget -= cost[i]\\n\\t\\t}\\n\\t}\\n\\n\\treturn best.String()\\n}\\n'],\n",
" 'java': ['class Solution {\\n public String largestNumber(int[] cost, int target) {\\n int dp[] = new int[target + 1];\\n int trace[] = new int[target + 1];\\n int ans = largestNumber(cost, target, dp, trace);\\n if (ans <= 0)\\n return \"0\";\\n StringBuilder sb = new StringBuilder();\\n while (target > 0) {\\n sb.append(trace[target]);\\n target = target - cost[trace[target] - 1];\\n }\\n return sb.toString();\\n }\\n\\n public int largestNumber(int[] cost, int target, int[] dp, int[] trace) {\\n if (target < 0)\\n return -1;\\n\\n if (target == 0)\\n return 0;\\n\\n if (dp[target] != 0)\\n return dp[target];\\n\\n int ans = -1;\\n for (int i = 9; i > 0; i--) {\\n int curr = largestNumber(cost, target - cost[i - 1], dp, trace);\\n if (curr == -1)\\n continue;\\n if (curr + 1 > ans) {\\n ans = curr + 1;\\n trace[target] = i;\\n }\\n }\\n dp[target] = ans;\\n return ans;\\n }\\n}'],\n",
" 'javascript': [\"var largestNumber = function(cost, target) {\\n const arr = new Array(target+1).fill('#');\\n arr[0] = '';\\n \\n for (let i = 0; i < 9; i++) {\\n for (let j = cost[i]; j <= target; j++) {\\n if (arr[j-cost[i]] !== '#' && arr[j-cost[i]].length + 1 >= arr[j].length) {\\n arr[j] = (i+1).toString().concat(arr[j-cost[i]]);\\n }\\n }\\n }\\n \\n return arr[target] == '#' ? '0' : arr[target];\\n};\",\n",
" \"var largestNumber = function(cost, target) {\\n const arr = new Array(target+1).fill('#');\\n arr[0] = '';\\n \\n for (let i = 0; i < 9; i++) {\\n for (let j = cost[i]; j <= target; j++) {\\n if (arr[j-cost[i]] !== '#' && arr[j-cost[i]].length + 1 >= arr[j].length) {\\n arr[j] = (i+1).toString().concat(arr[j-cost[i]]);\\n }\\n }\\n }\\n \\n return arr[target] == '#' ? '0' : arr[target];\\n};\"],\n",
" 'kotlin': None,\n",
" 'mysql': None,\n",
" 'oraclesql': None,\n",
" 'php': None,\n",
" 'python': None,\n",
" 'python3': ['class Solution:\\n def largestNumber(self, cost: List[int], target: int) -> str:\\n # Initialize dp array, dp[i] represents the maximum length of the number with cost i\\n dp = [-1] * (target + 1)\\n dp[0] = 0 # Base case, cost 0 can form a number of length 0\\n\\n # Iterate through each digit and its cost\\n for digit in range(1, 10):\\n c = cost[digit - 1] # Cost of the current digit\\n for i in range(c, target + 1):\\n # If it\\'s possible to form a number with the remaining cost\\n if dp[i - c] != -1:\\n dp[i] = max(dp[i], dp[i - c] + 1)\\n\\n # If it\\'s not possible to form any number with the target cost\\n if dp[target] == -1:\\n return \"0\"\\n\\n # Construct the largest number by backtracking\\n result = []\\n curr_target = target\\n for digit in reversed(range(1, 10)):\\n c = cost[digit - 1]\\n while curr_target >= c and dp[curr_target - c] == dp[curr_target] - 1:\\n result.append(str(digit))\\n curr_target -= c\\n\\n return \\'\\'.join(result)\\n\\n# Example usage:\\nsolution = Solution()\\ncost = [4,3,2,5,6,7,2,5,5]\\ntarget = 9\\nprint(solution.largestNumber(cost, target)) # Output: \"7772\"'],\n",
" 'pythondata': None,\n",
" 'racket': None,\n",
" 'react': None,\n",
" 'ruby': ['def largest_number(cost, target)\\n dp = Array.new(target + 1, -1)\\n dp[0] = 0\\n (1..target).each do |t|\\n cost.each do |c|\\n if t >= c && dp[t - c] != -1\\n dp[t] = [dp[t], dp[t - c] + 1].max\\n end\\n end\\n end\\n return \"0\" if dp[target] == -1\\n res = \"\"\\n remain = target\\n while remain > 0\\n 8.downto(0) do |i|\\n c = cost[i]\\n if remain >= c && dp[remain] == dp[remain - c] + 1\\n res << (i + 1).to_s\\n remain -= c\\n break\\n end\\n end\\n end\\n res\\nend',\n",
" 'def largest_number(cost, target)\\n dp = Array.new(target + 1, -1)\\n dp[0] = 0\\n (1..target).each do |t|\\n cost.each do |c|\\n if t >= c && dp[t - c] != -1\\n dp[t] = [dp[t], dp[t - c] + 1].max\\n end\\n end\\n end\\n return \"0\" if dp[target] == -1\\n res = \"\"\\n remain = target\\n while remain > 0\\n 8.downto(0) do |i|\\n c = cost[i]\\n if remain >= c && dp[remain] == dp[remain - c] + 1\\n res << (i + 1).to_s\\n remain -= c\\n break\\n end\\n end\\n end\\n res\\nend'],\n",
" 'rust': None,\n",
" 'scala': None,\n",
" 'swift': None,\n",
" 'typescript': None},\n",
" 'test_case_generator': 'def generate_test_cases(num_cases: int, seed: int = 42) -> list:\\n import random\\n random.seed(seed)\\n\\n # Sample solution based on the provided sample solution in the problem description.\\n def sample_solution(cost, target):\\n # dp[i] will represent the maximum number of digits that can be formed with cost i\\n dp = [-1] * (target + 1)\\n dp[0] = 0 # base case: cost 0 yields a \"number\" of length 0\\n \\n for digit in range(1, 10):\\n c = cost[digit - 1]\\n for t in range(c, target + 1):\\n if dp[t - c] != -1:\\n dp[t] = max(dp[t], dp[t - c] + 1)\\n \\n if dp[target] == -1:\\n return \"0\"\\n \\n result = []\\n curr_target = target\\n # Iterate from digit 9 to 1 to build the largest number\\n for digit in range(9, 0, -1):\\n c = cost[digit - 1]\\n while curr_target >= c and dp[curr_target - c] == dp[curr_target] - 1:\\n result.append(str(digit))\\n curr_target -= c\\n return \\'\\'.join(result)\\n\\n tests = []\\n\\n # Fixed examples from the problem description\\n fixed_examples = [\\n ([4, 3, 2, 5, 6, 7, 2, 5, 5], 9),\\n ([7, 6, 5, 5, 5, 6, 8, 7, 8], 12),\\n ([2, 4, 6, 2, 4, 6, 4, 4, 4], 5)\\n ]\\n\\n # Add fixed examples first (if num_cases is less than fixed examples, add only a subset)\\n for i in range(min(len(fixed_examples), num_cases)):\\n cost, target = fixed_examples[i]\\n expected = sample_solution(cost, target)\\n serialized_input = \",\".join(map(str, cost)) + \" \" + str(target)\\n tests.append({\"input\": serialized_input, \"output\": expected})\\n\\n # Generate additional random test cases if needed\\n remaining = num_cases - len(tests)\\n for _ in range(remaining):\\n # Generate a cost array of length 9 with diverse random values.\\n cost = []\\n for _ in range(9):\\n r = random.random()\\n if r < 0.3:\\n cost.append(random.randint(1, 10))\\n elif r < 0.6:\\n cost.append(random.randint(1, 50))\\n else:\\n cost.append(random.randint(1, 100))\\n \\n # Generate target with diverse ranges.\\n r = random.random()\\n if r < 0.15:\\n target_val = random.randint(1, 20)\\n elif r < 0.30:\\n target_val = random.randint(1, 100)\\n elif r < 0.45:\\n target_val = random.randint(1, 5000)\\n elif r < 0.60:\\n target_val = random.randint(50, 150)\\n else:\\n target_val = random.randint(10, 300)\\n\\n expected = sample_solution(cost, target_val)\\n serialized_input = \",\".join(map(str, cost)) + \" \" + str(target_val)\\n tests.append({\"input\": serialized_input, \"output\": expected})\\n\\n return tests',\n",
" 'test_case_evaluator': 'def evaluate(expected_output: str, program_output: str) -> bool:\\n # Trim whitespace and newlines before comparing.\\n expected = expected_output.strip()\\n actual = program_output.strip()\\n return expected == actual',\n",
" 'test_case_runners': {'cpp': '==Code Submission==\\n#include <iostream>\\n#include <sstream>\\n#include <vector>\\n#include <string>\\nusing namespace std;\\n\\npair<vector<int>, int> deserialize_stdin(const string& input) {\\n size_t spacePos = input.find(\\' \\');\\n string cost_part = input.substr(0, spacePos);\\n string target_str = input.substr(spacePos + 1);\\n vector<int> cost;\\n stringstream ss(cost_part);\\n string token;\\n while(getline(ss, token, \\',\\')) {\\n cost.push_back(stoi(token));\\n }\\n int target = stoi(target_str);\\n return {cost, target};\\n}\\n\\nstring serialize_stdout(const string &result) {\\n return result;\\n}\\n\\nint main() {\\n ios::sync_with_stdio(false);\\n cin.tie(nullptr);\\n string line;\\n getline(cin, line);\\n auto [cost, target] = deserialize_stdin(line);\\n Solution sol;\\n string ans = sol.largestNumber(cost, target);\\n cout << serialize_stdout(ans) << \"\\\\n\";\\n return 0;\\n}',\n",
" 'golang': '==Code Submission==\\n\\nfunc main() {\\n reader := bufio.NewReader(os.Stdin)\\n line, _ := reader.ReadString(\\'\\\\n\\')\\n line = strings.TrimSpace(line)\\n parts := strings.SplitN(line, \" \", 2)\\n target, _ := strconv.Atoi(parts[1])\\n arrItems := strings.Split(parts[0], \",\")\\n cost := make([]int, len(arrItems))\\n for i, s := range arrItems {\\n cost[i], _ = strconv.Atoi(s)\\n }\\n ans := largestNumber(cost, target)\\n fmt.Println(ans)\\n}',\n",
" 'java': 'public class Main {\\n private static int[] deserializeIntArray(String input) {\\n String[] parts = input.split(\",\");\\n int[] arr = new int[parts.length];\\n for (int i = 0; i < parts.length; i++) {\\n arr[i] = Integer.parseInt(parts[i]);\\n }\\n return arr;\\n }\\n \\n private static String serializeOutput(String result) {\\n return result;\\n }\\n \\n public static void main(String[] args) throws Exception {\\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\\n String line = br.readLine().trim();\\n String[] inputParts = line.split(\" \", 2);\\n int target = Integer.parseInt(inputParts[1]);\\n int[] cost = deserializeIntArray(inputParts[0]);\\n Solution sol = new Solution();\\n String ans = sol.largestNumber(cost, target);\\n System.out.println(serializeOutput(ans));\\n }\\n}\\n\\n==Code Submission==',\n",
" 'javascript': \"==Code Submission==\\nconst deserialize_stdin = (input) => {\\n const [arrPart, t] = input.trim().split(' ', 2);\\n const target = parseInt(t, 10);\\n const cost = arrPart.split(',').map(x => parseInt(x, 10));\\n return { cost, target };\\n};\\n\\nconst serialize_stdout = (result) => {\\n return result;\\n};\\n\\nprocess.stdin.resume();\\nprocess.stdin.setEncoding('utf8');\\nlet input = '';\\nprocess.stdin.on('data', chunk => input += chunk);\\nprocess.stdin.on('end', () => {\\n const { cost, target } = deserialize_stdin(input);\\n const ans = largestNumber(cost, target);\\n console.log(serialize_stdout(ans));\\n});\",\n",
" 'python3': 'class Solution:\\n def largestNumber(self, cost: List[int], target: int) -> str:\\n dp = [-1] * (target + 1)\\n dp[0] = 0 # Base case: 0 cost can form 0 digits\\n \\n # Update dp for each digit\\'s cost\\n for c in cost:\\n for t in range(c, target + 1):\\n if dp[t - c] != -1:\\n dp[t] = max(dp[t], dp[t - c] + 1)\\n \\n # If target is not achievable\\n if dp[target] == -1:\\n return \"0\"\\n \\n # Build the result by choosing the largest digits first\\n res = []\\n remaining = target\\n # Iterate from 9 down to 1 to get the largest possible digits\\n for i in range(8, -1, -1):\\n current_cost = cost[i]\\n digit = i + 1 # since cost is 0-indexed for digits 1-9\\n while remaining >= current_cost and dp[remaining - current_cost] == dp[remaining] - 1:\\n res.append(str(digit))\\n remaining -= current_cost\\n \\n return \\'\\'.join(res)\\n\\nif __name__ == \"__main__\":\\n line = sys.stdin.read().strip()\\n cost_part, target_str = line.split(\\' \\', 1)\\n cost = list(map(int, cost_part.split(\\',\\')))\\n target = int(target_str)\\n sol = Solution()\\n ans = sol.largestNumber(cost, target)\\n print(ans)',\n",
" 'ruby': \"==Code Submission==\\n\\ninput = gets.strip\\narr_part, target_str = input.split(' ', 2)\\ncost = arr_part.split(',').map(&:to_i)\\ntarget = target_str.to_i\\nans = largest_number(cost, target)\\nputs ans\",\n",
" 'rust': None},\n",
" 'test_cases': '[{\"input\": \"4,3,2,5,6,7,2,5,5 9\", \"output\": \"7772\"}, {\"input\": \"7,6,5,5,5,6,8,7,8 12\", \"output\": \"85\"}, {\"input\": \"2,4,6,2,4,6,4,4,4 5\", \"output\": \"0\"}, {\"input\": \"4,32,2,70,7,2,9,72,9 3680\", \"output\": \"6666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666\"}, {\"input\": \"1,21,44,4,44,7,6,6,69 13\", \"output\": \"1111111111111\"}, {\"input\": \"5,80,47,46,4,11,13,30,47 46\", \"output\": \"55555555511\"}, {\"input\": \"5,88,78,69,21,18,82,29,99 127\", \"output\": \"5511111111111111111\"}, {\"input\": \"41,5,10,41,8,42,17,9,48 124\", \"output\": \"822222222222222222222222\"}, {\"input\": \"15,18,6,15,3,55,25,30,36 15\", \"output\": \"55555\"}, {\"input\": \"15,69,99,15,3,47,34,98,2 162\", \"output\": \"999999999999999999999999999999999999999999999999999999999999999999999999999999999\"}, {\"input\": \"65,20,11,50,1,32,6,40,4 50\", \"output\": \"55555555555555555555555555555555555555555555555555\"}, {\"input\": \"8,98,9,8,22,10,14,97,26 214\", \"output\": \"74444444444444444444444444\"}, {\"input\": \"84,34,16,6,9,4,1,1,10 85\", \"output\": \"8888888888888888888888888888888888888888888888888888888888888888888888888888888888888\"}, {\"input\": \"28,47,74,16,53,2,46,30,7 60\", \"output\": \"666666666666666666666666666666\"}, {\"input\": \"6,14,4,9,18,5,36,9,12 131\", \"output\": \"66633333333333333333333333333333\"}, {\"input\": \"8,26,22,25,8,9,63,5,1 119\", \"output\": \"99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\"}, {\"input\": \"6,10,34,9,3,2,31,37,10 3\", \"output\": \"5\"}, {\"input\": \"38,21,27,41,7,5,49,2,37 47\", \"output\": \"8888888888888888888886\"}, {\"input\": \"33,6,32,11,35,79,84,43,39 63\", \"output\": \"44422222\"}, {\"input\": \"18,2,20,10,6,5,17,7,7 32\", \"output\": \"2222222222222222\"}, {\"input\": \"3,34,8,28,8,3,24,10,3 327\", \"output\": \"9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\"}, {\"input\": \"27,86,9,53,96,4,23,4,6 220\", \"output\": \"8888888888888888888888888888888888888888888888888888888\"}, {\"input\": \"95,35,2,3,29,8,15,4,18 152\", \"output\": \"3333333333333333333333333333333333333333333333333333333333333333333333333333\"}, {\"input\": \"33,35,2,5,5,10,47,56,66 19\", \"output\": \"53333333\"}, {\"input\": \"1,1,35,95,26,5,43,85,93 269\", \"output\": \"22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222\"}, {\"input\": \"27,45,3,7,23,39,1,14,38 174\", \"output\": \"777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777\"}, {\"input\": \"29,66,48,2,10,49,5,4,1 61\", \"output\": \"9999999999999999999999999999999999999999999999999999999999999\"}, {\"input\": \"99,7,74,7,16,1,99,100,12 275\", \"output\": \"66666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666\"}, {\"input\": \"36,2,30,72,49,79,65,36,11 253\", \"output\": \"92222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222\"}, {\"input\": \"49,5,67,16,2,31,6,11,4 1252\", \"output\": \"55555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555\"}, {\"input\": \"9,22,27,7,50,45,10,1,39 224\", \"output\": \"88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\"}, {\"input\": \"48,39,63,7,25,44,93,8,80 100\", \"output\": \"88444444444444\"}, {\"input\": \"43,7,8,5,14,22,49,7,2 145\", \"output\": \"99999999999999999999999999999999999999999999999999999999999999999999994\"}, {\"input\": \"23,2,84,1,26,80,3,8,14 82\", \"output\": \"4444444444444444444444444444444444444444444444444444444444444444444444444444444444\"}, {\"input\": \"22,96,100,40,1,74,49,46,10 134\", \"output\": \"55555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555\"}, {\"input\": \"5,77,73,45,43,33,2,63,6 245\", \"output\": \"7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777771\"}, {\"input\": \"56,9,35,69,60,47,21,12,8 60\", \"output\": \"9999998\"}, {\"input\": \"43,2,21,4,17,39,36,34,11 53\", \"output\": \"9222222222222222222222\"}, {\"input\": \"49,8,63,2,4,16,38,36,28 291\", \"output\": \"44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444441\"}, {\"input\": \"45,20,2,41,9,89,4,36,98 86\", \"output\": \"3333333333333333333333333333333333333333333\"}, {\"input\": \"25,6,1,17,1,45,82,63,1 110\", \"output\": \"99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\"}, {\"input\": \"22,1,8,2,5,44,3,39,4 14\", \"output\": \"22222222222222\"}, {\"input\": \"80,9,29,10,40,4,95,4,34 90\", \"output\": \"888888888888888888884\"}, {\"input\": \"9,1,45,19,5,90,10,34,81 75\", \"output\": \"222222222222222222222222222222222222222222222222222222222222222222222222222\"}, {\"input\": \"35,3,19,3,77,73,57,5,35 113\", \"output\": \"8444444444444444444444444444444444444\"}, {\"input\": \"39,7,78,2,10,2,87,74,3 133\", \"output\": \"966666666666666666666666666666666666666666666666666666666666666666\"}, {\"input\": \"18,10,32,61,22,7,43,32,7 291\", \"output\": \"9999999999999999999999999999999999999991\"}, {\"input\": \"2,21,7,1,70,4,6,64,98 9\", \"output\": \"444444444\"}, {\"input\": \"19,45,2,78,91,9,7,2,8 88\", \"output\": \"88888888888888888888888888888888888888888888\"}, {\"input\": \"46,5,31,32,10,39,9,36,54 4160\", \"output\": \"2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222\"}, {\"input\": \"1,5,75,63,58,23,49,30,25 132\", \"output\": \"111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\"}, {\"input\": \"15,53,8,49,43,84,64,17,38 823\", \"output\": \"333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333331\"}, {\"input\": \"57,8,3,42,10,17,45,6,87 204\", \"output\": \"33333333333333333333333333333333333333333333333333333333333333333333\"}, {\"input\": \"81,98,35,2,5,96,2,91,57 39\", \"output\": \"777777777777777775\"}, {\"input\": \"6,4,6,16,37,24,2,49,31 124\", \"output\": \"77777777777777777777777777777777777777777777777777777777777777\"}, {\"input\": \"8,59,1,60,87,5,23,39,55 243\", \"output\": \"333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333\"}, {\"input\": \"26,62,7,37,5,7,10,100,7 264\", \"output\": \"9955555555555555555555555555555555555555555555555555\"}, {\"input\": \"37,30,46,4,87,99,18,81,40 27\", \"output\": \"0\"}, {\"input\": \"47,5,27,3,47,18,33,62,38 183\", \"output\": \"4444444444444444444444444444444444444444444444444444444444444\"}, {\"input\": \"60,19,29,93,51,72,26,9,6 144\", \"output\": \"999999999999999999999999\"}, {\"input\": \"41,14,61,9,40,2,60,39,15 2\", \"output\": \"6\"}, {\"input\": \"32,4,18,24,96,70,48,54,63 153\", \"output\": \"93222222222222222222\"}, {\"input\": \"6,8,47,6,42,26,2,59,4 20\", \"output\": \"7777777777\"}, {\"input\": \"6,3,27,9,4,30,10,77,3 286\", \"output\": \"99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999995\"}, {\"input\": \"3,1,6,31,2,1,7,48,8 272\", \"output\": \"66666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666\"}, {\"input\": \"29,40,9,42,8,52,7,29,2 1216\", \"output\": \"99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\"}, {\"input\": \"5,75,21,39,30,28,2,84,71 120\", \"output\": \"777777777777777777777777777777777777777777777777777777777777\"}, {\"input\": \"15,30,47,7,17,10,61,2,2 200\", \"output\": \"9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\"}, {\"input\": \"72,9,43,6,97,47,5,46,9 85\", \"output\": \"77777777777777777\"}, {\"input\": \"7,36,49,4,72,80,83,39,89 24\", \"output\": \"444444\"}, {\"input\": \"5,45,3,26,1,9,7,11,47 4650\", \"output\": \"555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555\"}, {\"input\": \"4,10,2,7,29,14,15,8,10 135\", \"output\": \"43333333333333333333333333333333333333333333333333333333333333333\"}, {\"input\": \"15,39,4,14,98,6,8,23,9 266\", \"output\": \"633333333333333333333333333333333333333333333333333333333333333333\"}, {\"input\": \"43,10,48,1,5,74,26,54,7 11\", \"output\": \"44444444444\"}, {\"input\": \"10,45,12,7,10,6,20,29,11 4\", \"output\": \"0\"}, {\"input\": \"13,45,42,31,5,10,2,8,37 239\", \"output\": \"7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777775\"}, {\"input\": \"73,80,41,29,8,36,23,20,3 10\", \"output\": \"0\"}, {\"input\": \"2,65,38,48,58,74,42,65,1 93\", \"output\": \"999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\"}, {\"input\": \"11,12,8,68,11,19,50,39,6 4\", \"output\": \"0\"}, {\"input\": \"25,10,43,3,40,90,17,6,25 178\", \"output\": \"444444444444444444444444444444444444444444444444444444442\"}, {\"input\": \"86,95,68,7,2,12,44,63,3 38\", \"output\": \"5555555555555555555\"}, {\"input\": \"13,35,68,6,80,7,3,99,22 32\", \"output\": \"77777766\"}, {\"input\": \"44,57,97,58,4,31,25,37,60 205\", \"output\": \"7555555555555555555555555555555555555555555555\"}, {\"input\": \"27,26,18,7,48,7,67,37,3 66\", \"output\": \"9999999999999999999999\"}, {\"input\": \"7,4,45,54,9,25,48,6,92 84\", \"output\": \"222222222222222222222\"}, {\"input\": \"5,61,18,61,1,3,3,47,55 10\", \"output\": \"5555555555\"}, {\"input\": \"2,7,80,8,64,2,74,3,1 133\", \"output\": \"9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\"}, {\"input\": \"12,11,24,9,33,25,6,48,1 554\", \"output\": \"99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\"}, {\"input\": \"47,14,95,18,9,42,8,62,18 15\", \"output\": \"0\"}, {\"input\": \"4,4,41,66,35,3,25,1,43 48\", \"output\": \"888888888888888888888888888888888888888888888888\"}, {\"input\": \"26,50,12,32,34,2,11,12,21 11\", \"output\": \"7\"}, {\"input\": \"40,46,45,29,6,56,1,7,48 25\", \"output\": \"7777777777777777777777777\"}, {\"input\": \"10,57,2,6,37,3,48,49,3 100\", \"output\": \"33333333333333333333333333333333333333333333333333\"}, {\"input\": \"18,2,3,25,16,5,28,37,63 18\", \"output\": \"222222222\"}, {\"input\": \"58,8,88,41,91,9,5,92,90 195\", \"output\": \"777777777777777777777777777777777777777\"}, {\"input\": \"8,18,8,9,30,71,2,7,93 102\", \"output\": \"777777777777777777777777777777777777777777777777777\"}, {\"input\": \"74,6,58,34,50,38,3,4,67 22\", \"output\": \"8777777\"}, {\"input\": \"4,34,11,9,5,12,11,38,10 182\", \"output\": \"551111111111111111111111111111111111111111111\"}, {\"input\": \"73,1,10,4,54,4,41,42,62 88\", \"output\": \"2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222\"}, {\"input\": \"30,1,7,14,10,46,23,17,66 90\", \"output\": \"222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222\"}]'}"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"instance"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.16"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
|