Update
Browse files- app.py +6 -6
- playground.ipynb +79 -0
app.py
CHANGED
@@ -9,13 +9,13 @@ with st.spinner("Loading data...", show_time=True):
|
|
9 |
tab_problem, tab_model = st.tabs(["Problems", "Models"])
|
10 |
|
11 |
with tab_problem:
|
12 |
-
for problem in
|
13 |
with st.container(border=True):
|
14 |
-
id_col, title_col, difficulty_col, dp_col = st.columns(
|
15 |
-
id_col.write(problem)
|
16 |
-
title_col.write(problem)
|
17 |
-
difficulty_col.write(problem)
|
18 |
-
dp_col.write(
|
19 |
|
20 |
with tab_model:
|
21 |
st.header("Models")
|
|
|
9 |
tab_problem, tab_model = st.tabs(["Problems", "Models"])
|
10 |
|
11 |
with tab_problem:
|
12 |
+
for problem in ds:
|
13 |
with st.container(border=True):
|
14 |
+
id_col, title_col, difficulty_col, dp_col = st.columns([1,3,1,1])
|
15 |
+
id_col.write(problem['problem_id'])
|
16 |
+
title_col.write(problem['title'])
|
17 |
+
difficulty_col.write(problem['difficulty'])
|
18 |
+
dp_col.write(0)
|
19 |
|
20 |
with tab_model:
|
21 |
st.header("Models")
|
playground.ipynb
CHANGED
@@ -148,6 +148,85 @@
|
|
148 |
" break"
|
149 |
]
|
150 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
{
|
152 |
"cell_type": "code",
|
153 |
"execution_count": null,
|
|
|
148 |
" break"
|
149 |
]
|
150 |
},
|
151 |
+
{
|
152 |
+
"cell_type": "code",
|
153 |
+
"execution_count": 5,
|
154 |
+
"metadata": {},
|
155 |
+
"outputs": [
|
156 |
+
{
|
157 |
+
"data": {
|
158 |
+
"text/plain": [
|
159 |
+
"{'problem_id': 1545,\n",
|
160 |
+
" 'title': 'form-largest-integer-with-digits-that-add-up-to-target',\n",
|
161 |
+
" '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",
|
162 |
+
" 'difficulty': 'Hard',\n",
|
163 |
+
" 'tags': ['array', 'dynamic-programming'],\n",
|
164 |
+
" 'code_prompt': {'c': 'char* largestNumber(int* cost, int costSize, int target) {\\n \\n}',\n",
|
165 |
+
" 'cpp': 'class Solution {\\npublic:\\n string largestNumber(vector<int>& cost, int target) {\\n \\n }\\n};',\n",
|
166 |
+
" 'csharp': 'public class Solution {\\n public string LargestNumber(int[] cost, int target) {\\n \\n }\\n}',\n",
|
167 |
+
" 'dart': 'class Solution {\\n String largestNumber(List<int> cost, int target) {\\n \\n }\\n}',\n",
|
168 |
+
" '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",
|
169 |
+
" 'erlang': '-spec largest_number(Cost :: [integer()], Target :: integer()) -> unicode:unicode_binary().\\nlargest_number(Cost, Target) ->\\n .',\n",
|
170 |
+
" 'golang': 'func largestNumber(cost []int, target int) string {\\n \\n}',\n",
|
171 |
+
" 'java': 'class Solution {\\n public String largestNumber(int[] cost, int target) {\\n \\n }\\n}',\n",
|
172 |
+
" 'javascript': '/**\\n * @param {number[]} cost\\n * @param {number} target\\n * @return {string}\\n */\\nvar largestNumber = function(cost, target) {\\n \\n};',\n",
|
173 |
+
" 'kotlin': 'class Solution {\\n fun largestNumber(cost: IntArray, target: Int): String {\\n \\n }\\n}',\n",
|
174 |
+
" '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",
|
175 |
+
" '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",
|
176 |
+
" 'python3': 'class Solution:\\n def largestNumber(self, cost: List[int], target: int) -> str:\\n ',\n",
|
177 |
+
" 'racket': '(define/contract (largest-number cost target)\\n (-> (listof exact-integer?) exact-integer? string?)\\n )',\n",
|
178 |
+
" 'ruby': '# @param {Integer[]} cost\\n# @param {Integer} target\\n# @return {String}\\ndef largest_number(cost, target)\\n \\nend',\n",
|
179 |
+
" 'rust': 'impl Solution {\\n pub fn largest_number(cost: Vec<i32>, target: i32) -> String {\\n \\n }\\n}',\n",
|
180 |
+
" 'scala': 'object Solution {\\n def largestNumber(cost: Array[Int], target: Int): String = {\\n \\n }\\n}',\n",
|
181 |
+
" 'swift': 'class Solution {\\n func largestNumber(_ cost: [Int], _ target: Int) -> String {\\n \\n }\\n}',\n",
|
182 |
+
" 'typescript': 'function largestNumber(cost: number[], target: number): string {\\n \\n};'},\n",
|
183 |
+
" 'solutions': {'bash': None,\n",
|
184 |
+
" 'c': None,\n",
|
185 |
+
" '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",
|
186 |
+
" 'csharp': None,\n",
|
187 |
+
" 'dart': None,\n",
|
188 |
+
" 'elixir': None,\n",
|
189 |
+
" 'erlang': None,\n",
|
190 |
+
" '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",
|
191 |
+
" '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",
|
192 |
+
" '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",
|
193 |
+
" \"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",
|
194 |
+
" 'kotlin': None,\n",
|
195 |
+
" 'mysql': None,\n",
|
196 |
+
" 'oraclesql': None,\n",
|
197 |
+
" 'php': None,\n",
|
198 |
+
" 'python': None,\n",
|
199 |
+
" '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",
|
200 |
+
" 'pythondata': None,\n",
|
201 |
+
" 'racket': None,\n",
|
202 |
+
" 'react': None,\n",
|
203 |
+
" '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",
|
204 |
+
" '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",
|
205 |
+
" 'rust': None,\n",
|
206 |
+
" 'scala': None,\n",
|
207 |
+
" 'swift': None,\n",
|
208 |
+
" 'typescript': None},\n",
|
209 |
+
" '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",
|
210 |
+
" '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",
|
211 |
+
" '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",
|
212 |
+
" '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",
|
213 |
+
" '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",
|
214 |
+
" '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",
|
215 |
+
" '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",
|
216 |
+
" '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",
|
217 |
+
" 'rust': None},\n",
|
218 |
+
" '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\"}]'}"
|
219 |
+
]
|
220 |
+
},
|
221 |
+
"execution_count": 5,
|
222 |
+
"metadata": {},
|
223 |
+
"output_type": "execute_result"
|
224 |
+
}
|
225 |
+
],
|
226 |
+
"source": [
|
227 |
+
"instance"
|
228 |
+
]
|
229 |
+
},
|
230 |
{
|
231 |
"cell_type": "code",
|
232 |
"execution_count": null,
|