{"task_id": 757454, "prompt": "def f_757454(num):\n\treturn ", "suffix": "", "canonical_solution": "math.modf(num)[0]", "test_start": "\nimport math\n\ndef check(candidate):", "test": ["\n assert (candidate(123.45) - 0.45) < 1e-6\n", "\n assert (candidate(123.4445) - 0.4445) < 1e-6\n", "\n assert (candidate(-0.01) - 0.01) < 1e-6\n", "\n assert (candidate(0.) - 0.0) < 1e-6\n", "\n assert (candidate(1000000) - 0.0) < 1e-6\n"], "entry_point": "f_757454", "intent": "\u0412\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0434\u0440\u043e\u0431\u043d\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0447\u0438\u0441\u043b\u0430 `num`", "library": ["math"]} {"task_id": 757454, "prompt": "def f_757454(num):\n\treturn ", "suffix": "", "canonical_solution": "num % 1", "test_start": "\ndef check(candidate):", "test": ["\n assert (candidate(123.45) - 0.45) < 1e-6\n", "\n assert (candidate(123.4445) - 0.4445) < 1e-6\n", "\n assert (candidate(-0.01) - 0.99) < 1e-6\n", "\n assert (candidate(0.) - 0.0) < 1e-6\n", "\n assert (candidate(1000000) - 0.0) < 1e-6\n"], "entry_point": "f_757454", "intent": "\u0412\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0434\u0440\u043e\u0431\u043d\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0447\u0438\u0441\u043b\u0430 `num`", "library": []} {"task_id": 247377, "prompt": "def f_247377(whole, part):\n\treturn ", "suffix": "", "canonical_solution": "100 / whole * part", "test_start": "\ndef check(candidate):", "test": ["\n assert (candidate(54, 100) - 185.185) < 0.02\n", "\n assert (candidate(100, 1) - 1.0) < 1e-6\n", "\n assert (candidate(4, 24) - 600.0) < 1e-6\n"], "entry_point": "f_247377", "intent": "\u0412\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u043e\u0432 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0447\u0438\u0441\u043b\u043e `part` \u043e\u0442 \u0447\u0438\u0441\u043b\u0430 `whole`", "library": []} {"task_id": 712792, "prompt": "def f_712792(s):\n\treturn ", "suffix": "", "canonical_solution": "s.title()", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate('test') == 'Test'\n", "\n assert candidate('Test') == 'Test'\n", "\n assert candidate('TEST') == 'Test'\n", "\n assert candidate(' ') == ' '\n"], "entry_point": "f_712792", "intent": "\u0421\u0434\u0435\u043b\u0430\u0442\u044c \u0437\u0430\u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u043f\u0435\u0440\u0432\u0443\u044e \u0431\u0443\u043a\u0432\u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 `s`", "library": []} {"task_id": 775089, "prompt": "def f_775089(func):\n\t", "suffix": "\n\treturn time_work", "canonical_solution": "t = time.time()\n\n\tfunc()\n\n\ttime_work = time.time()-t", "test_start": "\nimport time \n\ndef check(candidate):", "test": ["\n def print_str(): return \"hello world!\"\n assert candidate(print_str) < 10\n", "\n def sleep_one_sec(): time.sleep(1)\n assert 1 < candidate(sleep_one_sec) < 10\n"], "entry_point": "f_775089", "intent": "\u0418\u0437\u043c\u0435\u0440\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f `time_work` \u0444\u0443\u043d\u043a\u0446\u0438\u0438 `func`", "library": ["time"]} {"task_id": 157675, "prompt": "def f_157675(s):\n\treturn ", "suffix": "", "canonical_solution": "re.findall('(\\d+)', s)", "test_start": "\nimport re\n\ndef check(candidate):", "test": ["\n assert candidate('123abc456') == ['123', '456']\n", "\n assert candidate('123456') == ['123456'] \n", "\n assert candidate('afbnjig') == []\n"], "entry_point": "f_157675", "intent": "\u041d\u0430\u0439\u0442\u0438 \u0447\u0438\u0441\u043b\u0430 \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 `s`", "library": ["re"]} {"task_id": 210870, "prompt": "def f_210870(num, file_path):\n\t", "suffix": "\n\treturn ", "canonical_solution": "file_1 = open(file_path, \"w\")\n\n\tfile_1.write(str(num))\n\tfile_1.close()", "test_start": "\ndef check(candidate):", "test": ["\n candidate(12.34, \"tmp.txt\")\n with open('tmp.txt', 'r') as fr:\n lines = fr.readlines()\n assert len(lines) == 1 and lines[0] == '12.34'\n", "\n candidate(0, \"tmp.txt\")\n with open('tmp.txt', 'r') as fr:\n lines = fr.readlines()\n assert len(lines) == 1 and lines[0] == '0'\n"], "entry_point": "f_210870", "intent": "\u0417\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0447\u0438\u0441\u043b\u043e `nums` \u0432 \u0444\u0430\u0439\u043b `file_path`", "library": []} {"task_id": 210870, "prompt": "def f_210870(num, file_path):\n\t", "suffix": "\n\treturn ", "canonical_solution": "\n\twith open(file_path, 'w') as f:\n\t\tprint(str(num), file=f)\n", "test_start": "\ndef check(candidate):", "test": ["\n candidate(12.34, \"tmp.txt\")\n with open('tmp.txt', 'r') as fr:\n lines = fr.readlines()\n assert len(lines) == 1 and lines[0] == '12.34\\n'\n"], "entry_point": "f_210870", "intent": "\u0417\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0447\u0438\u0441\u043b\u043e `nums` \u0432 \u0444\u0430\u0439\u043b `file_path`", "library": []} {"task_id": 681594, "prompt": "def f_681594(url, data):\n\treturn ", "suffix": "", "canonical_solution": "requests.post(url, json=data)", "test_start": "\nimport requests\n\ndef check(candidate):", "test": ["\n url = 'https://www.google.com/'\n myobj = {'somekey': 'somevalue'}\n x = candidate(url, myobj)\n assert x.request.body == b'{\"somekey\": \"somevalue\"}'\n assert x.request.url == url\n"], "entry_point": "f_681594", "intent": "\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c POST-\u0437\u0430\u043f\u0440\u043e\u0441 `res` c JSON \u0434\u0430\u043d\u043d\u044b\u043c\u0438 `data` \u043d\u0430 `url`", "library": ["requests"]} {"task_id": 584129, "prompt": "def f_584129(my_dict):\n\treturn ", "suffix": "", "canonical_solution": "json.dumps(my_dict, ensure_ascii=False)", "test_start": "\nimport json\n\ndef check(candidate):", "test": ["\n assert candidate({'a': 123, 'Bb': None}) == json.dumps({'a': 123, 'Bb': None}, ensure_ascii=False)\n", "\n assert candidate({123: 123, 'Bb': None}) == json.dumps({123: 123, 'Bb': None}, ensure_ascii=False)\n", "\n assert candidate({}) == json.dumps({}, ensure_ascii=False)\n"], "entry_point": "f_584129", "intent": "\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0443\u0441\u0441\u043a\u043e\u044f\u0437\u044b\u0447\u043d\u044b\u0439 \u0441\u043b\u043e\u0432\u0430\u0440\u044c `my_dict` \u0432 JSON ", "library": ["json"]} {"task_id": 37137, "prompt": "def f_37137(my_list1, my_list2):\n\t", "suffix": "\n\treturn common_items", "canonical_solution": "count_values_l1 = Counter(my_list1)\n\n\tcount_values_l2 = Counter(my_list2)\n\n\tkeys1 = count_values_l1.keys()\n\n\tkeys2 = count_values_l2.keys()\n\n\tcommon_items = []\n\n\tfor key in keys1:\n\n\t\tif key in keys2:\n\n\t\t\tcommon_items += [key] * min(count_values_l1[key], count_values_l2[key])\n\t", "test_start": "\nfrom collections import Counter \n\ndef check(candidate):", "test": ["\n assert set(candidate([1,2,3.5,'a'], [3.4, 'bb', 'a', 1])) == set([1, 'a']) \n", "\n assert set(candidate([1,2,3], [4,5,6])) == set([]) \n", "\n assert set(candidate(['ger','ferags',34.56], ['ger','ferags',34.56])) == set(['ger','ferags',34.56]) \n"], "entry_point": "f_37137", "intent": "\u041d\u0430\u0439\u0442\u0438 \u043e\u0431\u0449\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b `common_items` \u0441\u043f\u0438\u0441\u043a\u0430 `my_list1` \u0438 \u0441\u043f\u0438\u0441\u043a\u0430 `my_list2` ", "library": ["collections"]} {"task_id": 37137, "prompt": "def f_37137(my_list1, my_list2):\n\treturn ", "suffix": "", "canonical_solution": "list(set(my_list1) & set(my_list2))", "test_start": "\ndef check(candidate):", "test": ["\n assert set(candidate([1,2,3.5,'a'], [3.4, 'bb', 'a', 1])) == set([1, 'a']) \n", "\n assert set(candidate([1,2,3], [4,5,6])) == set([]) \n", "\n assert set(candidate(['ger','ferags',34.56], ['ger','ferags',34.56])) == set(['ger','ferags',34.56]) \n"], "entry_point": "f_37137", "intent": "\u041d\u0430\u0439\u0442\u0438 \u043e\u0431\u0449\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b `common_items` \u0441\u043f\u0438\u0441\u043a\u0430 `my_list1` \u0438 \u0441\u043f\u0438\u0441\u043a\u0430 `my_list2` ", "library": []} {"task_id": 645227, "prompt": "def f_645227(n):\n\t", "suffix": "\n\treturn factors", "canonical_solution": "\n\tfactors = []\n\twhile n % 2 == 0:\n\t\tfactors.append(2)\n\t\tn = n // 2\n\tfor i in range(3, int(math.sqrt(n)) + 1, 2):\n\t\twhile (n % i) == 0:\n\t\t\tfactors.append(i)\n\t\t\tn = n // i\n\tif n > 2: \n \t\tfactors.append(n)\n", "test_start": "\nimport math\n\ndef check(candidate):", "test": ["\n assert candidate(17) == [17]\n", "\n assert sorted(candidate(10)) == [2, 5]\n", "\n assert sorted(candidate(100)) == [2, 2, 5, 5]\n"], "entry_point": "f_645227", "intent": "\u0420\u0430\u0437\u043b\u043e\u0436\u0438\u0442\u044c \u0447\u0438\u0441\u043b\u043e `n` \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u0438 `factors`", "library": ["math"]} {"task_id": 565846, "prompt": "def f_565846(val1, val2, N):\n\t", "suffix": "\n\treturn my_list", "canonical_solution": "my_list = [random.randint(val1, val2) for i in range(N)]", "test_start": "\nimport random\n\ndef check(candidate):", "test": ["\n result = candidate(0, 18, 10)\n assert len(result) == 10\n assert min(result) >= 0\n assert max(result) <= 18\n assert all([isinstance(a, int) for a in result])\n"], "entry_point": "f_565846", "intent": "\u0421\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043a\u043e\u043a `my_list` \u0434\u043b\u0438\u043d\u043d\u043e\u0439 `N` \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435 \u043e\u0442 `val1` \u0434\u043e `val2`", "library": ["random"]} {"task_id": 925879, "prompt": "def f_925879(my_list, i, j):\n\t", "suffix": "\n\treturn my_list", "canonical_solution": "my_list[i], my_list[j] = my_list[j], my_list[i]", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate([1,2,3,4,5], 2, 4) == [1,2,5,4,3]\n", "\n assert candidate([1,2,3,4,5], 2, 0) == [3,2,1,4,5]\n", "\n assert candidate([1,2,3,4,5], 0, 0) == [1,2,3,4,5]\n"], "entry_point": "f_925879", "intent": "\u041f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u043c\u0435\u0441\u0442\u0430\u043c\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0441\u043f\u0438\u0441\u043a\u0430 `my_list` \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u043c\u0438 `i` \u0438 `j`", "library": []} {"task_id": 649828, "prompt": "def f_649828():\n\t", "suffix": "\n\treturn my_list", "canonical_solution": "my_list = input().split()", "test_start": "\nimport builtins\nfrom unittest.mock import Mock\n\ndef check(candidate):", "test": ["\n builtins.input = Mock(return_value = '6 6')\n assert candidate() == ['6', '6']\n", "\n builtins.input = Mock(return_value = 'hello world !')\n assert candidate() == [\"hello\", \"world\", \"!\"]\n"], "entry_point": "f_649828", "intent": "\u0412\u0432\u0435\u0441\u0442\u0438 \u0441 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0431\u0435\u043b \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0442\u0440\u043e\u043a `my_list`", "library": ["builtins"]} {"task_id": 752179, "prompt": "def f_752179(my_dict, my_key):\n\treturn ", "suffix": "", "canonical_solution": "my_key in my_dict", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate({'k': 123}, 'k') == True\n", "\n assert candidate({'k': 123}, 'aa') == False\n"], "entry_point": "f_752179", "intent": "\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043a\u043b\u044e\u0447\u0430 `my_key` \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u0435 `my_dict`", "library": []} {"task_id": 540082, "prompt": "def f_540082(file_path):\n\t", "suffix": "\n\treturn file_extension", "canonical_solution": "filename, file_extension = os.path.splitext(file_path)", "test_start": "\nimport os\n\ndef check(candidate):", "test": ["\n assert candidate('file_name.txt') == '.txt'\n", "\n assert candidate('file_name') == ''\n", "\n assert candidate('test.json') == '.json'\n"], "entry_point": "f_540082", "intent": "\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 `file_extension` \u0444\u0430\u0439\u043b\u0430 `file_path`", "library": ["os"]} {"task_id": 540082, "prompt": "def f_540082(file_path):\n\t", "suffix": "\n\treturn file_extension", "canonical_solution": "file_extension= file_path.split('.')[-1]", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate('file_name.txt') == 'txt'\n"], "entry_point": "f_540082", "intent": "\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 `file_extension` \u0444\u0430\u0439\u043b\u0430 `file_path`", "library": []} {"task_id": 502573, "prompt": "def f_502573(s, symbol):\n\t", "suffix": "\n\treturn s", "canonical_solution": "s = s[:s.find(symbol)]", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate('123abcyyl', 'cy') == '123ab'\n", "\n assert candidate('123abcyyl', '123') == ''\n"], "entry_point": "f_502573", "intent": "\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0432\u0441\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 `s` \u043f\u043e\u0441\u043b\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 `symbol`", "library": []} {"task_id": 502573, "prompt": "def f_502573(s, symbol):\n\t", "suffix": "\n\treturn s", "canonical_solution": "s = s.split(symbol)[0]", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate('123abcyyl', 'cy') == '123ab'\n", "\n assert candidate('123abcyyl', '234') == '123abcyyl'\n"], "entry_point": "f_502573", "intent": "\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0432\u0441\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 `s` \u043f\u043e\u0441\u043b\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 `symbol`", "library": []} {"task_id": 21825, "prompt": "def f_21825(my_list1, my_list2):\n\t", "suffix": "\n\treturn diff_list", "canonical_solution": "count_values1 = Counter(my_list1)\n\n\tcount_values2 = Counter(my_list2)\n\n\t\n\tkeys1 = list(count_values1.keys())\n\n\tkeys2 = list(count_values2.keys())\n\n\t\n\tdiff_list = []\n\n\tfor key in set(keys1 + keys2):\n\n\t\tif key in keys1 and key in keys2:\n\n\t\t\tdiff_list += [key] * abs(count_values1[key] - count_values2[key])\n\n\t\telif key in keys1:\n\n\t\t\tdiff_list += [key] * count_values1[key]\n\n\t\telif key in keys2:\n\n\t\t\tdiff_list += [key] * count_values2[key]\n", "test_start": "\nfrom collections import Counter\n\ndef check(candidate):", "test": ["\n list1 = [1, 3, 4]\n list2 = [5, 4, 9]\n assert candidate(list1, list2) == [1, 3, 5, 9]\n", "\n list1 = ['abc', 'klm']\n list2= ['pqr', 'xyz']\n assert len(candidate(list1, list2)) == 4\n"], "entry_point": "f_21825", "intent": "\u041d\u0430\u0439\u0442\u0438 \u0440\u0430\u0437\u043d\u0438\u0446\u0443 `diff_list` \u0441\u043f\u0438\u0441\u043a\u043e\u0432 `my_list1` \u0438 `my_list2`", "library": ["collections"]} {"task_id": 21825, "prompt": "def f_21825(my_list1, my_list2):\n\t", "suffix": "\n\treturn diff_list", "canonical_solution": "diff_list = list(set(my_list1)-set(my_list2)) + list(set(my_list2)-set(my_list1))", "test_start": "\ndef check(candidate):", "test": ["\n assert sorted(candidate([1,2,3,4],[2,3,4,5])) == [1,5]\n", "\n assert sorted(candidate([1,2,3,4],[])) == [1,2,3,4]\n"], "entry_point": "f_21825", "intent": "\u041d\u0430\u0439\u0442\u0438 \u0440\u0430\u0437\u043d\u0438\u0446\u0443 `diff_list` \u0441\u043f\u0438\u0441\u043a\u043e\u0432 `my_list1` \u0438 `my_list2`", "library": []} {"task_id": 513149, "prompt": "def f_513149(s, my_char):\n\treturn ", "suffix": "", "canonical_solution": " s.index(my_char)", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate('123abc456', 'ab') == 3\n", "\n assert candidate('123abc456', 'bc') == 4\n", "\n assert candidate('23abc123', '2') == 0\n"], "entry_point": "f_513149", "intent": "\u041d\u0430\u0439\u0442\u0438 \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0441\u0438\u043c\u0432\u043e\u043b\u0430 `my_char` \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 `s`", "library": []} {"task_id": 513149, "prompt": "def f_513149(s, my_char):\n\treturn ", "suffix": "", "canonical_solution": " s.find(my_char)", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate('123abc456', 'ab') == 3\n", "\n assert candidate('123abc456', 'bc') == 4\n", "\n assert candidate('23abc123', '2') == 0\n"], "entry_point": "f_513149", "intent": "\u041d\u0430\u0439\u0442\u0438 \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0441\u0438\u043c\u0432\u043e\u043b\u0430 `my_char` \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 `s`", "library": []} {"task_id": 934453, "prompt": "def f_934453():\n\t", "suffix": "\n\treturn my_list", "canonical_solution": "my_list = list(map(int, input().split()))", "test_start": "\nimport builtins\nfrom unittest.mock import Mock\n\ndef check(candidate):", "test": ["\n builtins.input = Mock(return_value = '3 2')\n my_list = candidate()\n assert my_list == [3, 2]\n", "\n builtins.input = Mock(return_value = '300 2')\n my_list = candidate()\n assert my_list == [300, 2]\n"], "entry_point": "f_934453", "intent": "\u0412\u0432\u0435\u0441\u0442\u0438 \u0441 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b \u0447\u0438\u0441\u043b\u0430 \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0431\u0435\u043b \u0432 \u0441\u043f\u0438\u0441\u043e\u043a `my_list`", "library": ["builtins"]} {"task_id": 934453, "prompt": "def f_934453():\n\t", "suffix": "\n\treturn my_list", "canonical_solution": "my_list = [int(a) for a in input().split()]", "test_start": "\nimport builtins\nfrom unittest.mock import Mock\n\ndef check(candidate):", "test": ["\n builtins.input = Mock(return_value = '3 2')\n my_list = candidate()\n assert my_list == [3, 2]\n", "\n builtins.input = Mock(return_value = '100 2 200 3')\n my_list = candidate()\n assert my_list == [100, 2, 200, 3]\n"], "entry_point": "f_934453", "intent": "\u0412\u0432\u0435\u0441\u0442\u0438 \u0441 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b \u0447\u0438\u0441\u043b\u0430 \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0431\u0435\u043b \u0432 \u0441\u043f\u0438\u0441\u043e\u043a `my_list`", "library": ["builtins"]} {"task_id": 515513, "prompt": "def f_515513(template_path, output_file_path):\n\t", "suffix": "\n\treturn ", "canonical_solution": "#python-docx-template\n\n\tdoc = DocxTemplate(template_path)\n\n\tdata = { 'var_name' : \"HELLO WORLD!\" }\n\n\tdoc.render(data)\n\n\tdoc.save(output_file_path)", "test_start": "\nimport os\nimport aspose.words as aw\nfrom docxtpl import DocxTemplate\n\ndef check(candidate):", "test": ["\n # create document object\n doc = aw.Document()\n\n # create a document builder object\n builder = aw.DocumentBuilder(doc)\n\n # add text to the document\n builder.write(\"Hello world!\")\n\n # save document\n doc.save(\"out.docx\")\n candidate(\"out.docx\", \"new.docx\")\n assert os.path.exists(\"new.docx\")\n"], "entry_point": "f_515513", "intent": "\u0421\u0433\u043d\u0435\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c word \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 `output_file_path` \u043f\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0443 \u0438\u0437 word \u0444\u0430\u0439\u043b\u0430 `template_path` \u0441 JSON \u0434\u0430\u043d\u043d\u044b\u043c\u0438 data", "library": ["aspose", "docxtpl", "os"]} {"task_id": 524081, "prompt": "def f_524081(my_list):\n\treturn ", "suffix": "", "canonical_solution": "not my_list", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate([]) == True\n", "\n assert candidate(['rehg tg', 325]) == False\n"], "entry_point": "f_524081", "intent": "\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043f\u0443\u0441\u0442\u043e\u0439 \u043b\u0438 \u0441\u043f\u0438\u0441\u043e\u043a `my_list`", "library": []} {"task_id": 524081, "prompt": "def f_524081(my_list):\n\treturn ", "suffix": "", "canonical_solution": "not my_list", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate([]) == True\n", "\n assert candidate(['rehg tg', 325]) == False\n"], "entry_point": "f_524081", "intent": "\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043f\u0443\u0441\u0442\u043e\u0439 \u043b\u0438 \u0441\u043f\u0438\u0441\u043e\u043a `my_list`", "library": []} {"task_id": 766573, "prompt": "def f_766573(num):\n\t", "suffix": "\n\treturn ", "canonical_solution": "for i in range(1, num):\n\n\t\tprint(*range(i, i*num+1, i), sep='\t')\n", "test_start": "\nimport sys\n\ndef check(candidate):", "test": ["\n f = open('output.txt', 'w')\n old = sys.stdout\n sys.stdout = f\n candidate(5)\n sys.stdout = old\n f.close()\n with open ('output.txt', 'r') as f1:\n lines = f1.readlines()\n assert int(lines[-1].split()[-1]) == 20\n"], "entry_point": "f_766573", "intent": "\u0421\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043e \u0447\u0438\u0441\u043b\u0430 `num`", "library": ["sys"]} {"task_id": 724582, "prompt": "def f_724582(file_path, url, data):\n\t", "suffix": "\n\treturn r", "canonical_solution": "files = {\n\n\t 'file': open(file_path, 'rb')\n\t}\n\t\n\tr = requests.post(url, data=data, files=files)", "test_start": "\nimport requests\nfrom unittest.mock import Mock\n\ndef check(candidate):", "test": ["\n r = requests.Response()\n r.status_code = 200\n requests.post = Mock(return_value = r)\n file_path = 'a.txt'\n with open (file_path, 'w') as f:\n f.write('abc')\n assert candidate(file_path, 'https://def.xyz', {'key':'value'}).status_code == 200\n"], "entry_point": "f_724582", "intent": "\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c POST-\u0437\u0430\u043f\u0440\u043e\u0441 \u0441 JSON \u0434\u0430\u043d\u043d\u044b\u043c\u0438 `data` \u0438 \u0444\u0430\u0439\u043b\u043e\u043c `file_path` \u043d\u0430 `url`", "library": ["requests"]} {"task_id": 735924, "prompt": "def f_735924(s):\n\treturn ", "suffix": "", "canonical_solution": "Counter(s)", "test_start": "\nfrom collections import Counter\n\ndef check(candidate):", "test": ["\n assert candidate('123abccb') == Counter({'1': 1, '2': 1, '3': 1, 'a': 1, 'b': 2, 'c': 2})\n", "\n assert candidate('111abccb') == Counter({'1': 3, 'a': 1, 'b': 2, 'c': 2})\n"], "entry_point": "f_735924", "intent": "\u041f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 `s`", "library": ["collections"]} {"task_id": 735924, "prompt": "def f_735924(s):\n\treturn ", "suffix": "", "canonical_solution": "{c:s.count(c) for c in set(s)}", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate('123abccb') == {'1': 1, '2': 1, '3': 1, 'a': 1, 'b': 2, 'c': 2}\n", "\n assert candidate('111abaab') == {'1': 3, 'a': 3, 'b': 2}\n"], "entry_point": "f_735924", "intent": "\u041f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 `s`", "library": []} {"task_id": 504426, "prompt": "def f_504426(my_dict, my_key):\n\treturn ", "suffix": "", "canonical_solution": "my_dict[my_key]", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate({'a': 123, 'b': 'aas'}, 'a') == 123\n", "\n assert candidate({'a': 123, 'b': 'aas'}, 'b') == \"aas\"\n"], "entry_point": "f_504426", "intent": "\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u043b\u043e\u0432\u0430\u0440\u044f `my_dict` \u043f\u043e \u043a\u043b\u044e\u0447\u0443 `my_key`", "library": []} {"task_id": 387249, "prompt": "def f_387249():\n\t", "suffix": "\n\treturn ", "canonical_solution": "# -*- coding: utf-8 -*-", "test_start": "\ndef check(candidate):", "test": ["\n candidate()\n s = \"\u041f\u0440\u0438\u0432\u0435\u0442\"\n assert s == \"\u041f\u0440\u0438\u0432\u0435\u0442\"\n"], "entry_point": "f_387249", "intent": "\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0443 utf-8 \u0434\u043b\u044f \u0444\u0430\u0439\u043b\u0430", "library": []} {"task_id": 66490, "prompt": "def f_66490(my_list, sep):\n\t", "suffix": "\n\treturn s", "canonical_solution": "s = sep.join(my_list)", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate(['a','b','c'], '-') == 'a-b-c'\n", "\n assert candidate(['aa','bb','cc'], '-') == 'aa-bb-cc'\n"], "entry_point": "f_66490", "intent": "\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a `my_list` \u0432 \u0441\u0442\u0440\u043e\u043a\u0443 `s` c \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0435\u043c `sep` ", "library": []} {"task_id": 66490, "prompt": "def f_66490(my_list, sep):\n\t", "suffix": "\n\treturn s", "canonical_solution": "s = sep.join(map(str, my_list))", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate(['a','b','c'], '-') == 'a-b-c'\n", "\n assert candidate(['a','b','c'], '.') == 'a.b.c'\n"], "entry_point": "f_66490", "intent": "\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a `my_list` \u0432 \u0441\u0442\u0440\u043e\u043a\u0443 `s` c \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0435\u043c `sep` ", "library": []} {"task_id": 363427, "prompt": "def f_363427(s):\n\treturn ", "suffix": "", "canonical_solution": "re.sub(r'[^\\w\\s]+|[\\d]+', r'',s)", "test_start": "\nimport re\n\ndef check(candidate):", "test": ["\n assert candidate('1a2b34c') == 'abc'\n", "\n assert candidate('hello world') == 'hello world'\n", "\n assert candidate('1234567890') == ''\n"], "entry_point": "f_363427", "intent": "\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0432\u0441\u0435 \u0446\u0438\u0444\u0440\u044b \u0438\u0437 \u0441\u0442\u0440\u043e\u043a\u0438 `s`", "library": ["re"]} {"task_id": 224298, "prompt": "def f_224298(s):\n\treturn ", "suffix": "", "canonical_solution": "[ord(c) for c in s]", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate('example string') == [101, 120, 97, 109, 112, 108, 101, 32, 115, 116, 114, 105, 110, 103]\n", "\n assert candidate('hello world!') == [104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 33]\n"], "entry_point": "f_224298", "intent": "\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u043e\u0434\u044b \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0441\u0442\u0440\u043e\u043a\u0438 `s`", "library": []} {"task_id": 182910, "prompt": "def f_182910(url):\n\t", "suffix": "\n\treturn code", "canonical_solution": "with urllib.request.urlopen(url) as res:\n\t code = res.read()", "test_start": "\nimport urllib\n\ndef check(candidate):", "test": ["\n assert candidate(\"https://www.google.com/\").find(b\"title\")\n"], "entry_point": "f_182910", "intent": "\u0421\u043f\u0430\u0440\u0441\u0438\u0442\u044c HTML-\u043a\u043e\u0434 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b `code` \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 `url`", "library": ["urllib"]} {"task_id": 850118, "prompt": "def f_850118(my_obj, My_class):\n\t", "suffix": "\n\treturn result", "canonical_solution": "\n\tclass ClassEncoder(json.JSONEncoder):\n\t\tdef default(self, obj):\n\t\t\tif isinstance(obj, My_class):\n\t\t\t\treturn obj.__dict__\n\t\t\treturn json.JSONEncoder.default(self, obj)\n\tresult = json.dumps(my_obj, cls=ClassEncoder)\n", "test_start": "\nimport json\n\ndef check(candidate):", "test": ["\n obj = {'name': 'hall', 'id': 344}\n assert str(candidate(obj, dict)) == '{\"name\": \"hall\", \"id\": 344}'\n"], "entry_point": "f_850118", "intent": "\u0421\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 `my_obj` \u043a\u043b\u0430\u0441\u0441\u0430 `My_class`", "library": ["json"]} {"task_id": 673692, "prompt": "def f_673692(s):\n\t", "suffix": "\n\treturn words", "canonical_solution": "words = s.split()", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate('first second third') == ['first', 'second', 'third']\n", "\n assert candidate('first-second-third') == ['first-second-third']\n"], "entry_point": "f_673692", "intent": "\u0420\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 `s` \u043d\u0430 \u0441\u043b\u043e\u0432\u0430 `words`", "library": []} {"task_id": 843929, "prompt": "def f_843929(s):\n\treturn ", "suffix": "", "canonical_solution": "isinstance(s, str)", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate('1a2b34c') == True\n", "\n assert candidate(123) == False\n"], "entry_point": "f_843929", "intent": "\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 `s` \u0441\u0442\u0440\u043e\u043a\u043e\u0439", "library": []} {"task_id": 705331, "prompt": "def f_705331(my_list):\n\t", "suffix": "\n\treturn my_set", "canonical_solution": "my_set = set(my_list)", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate(['a', 12, '45.6', 45.6]) == set(['a', 12, '45.6', 45.6])\n", "\n assert candidate([1,2,3,12,123,12,123]) == set([1,2,3,12,123])\n"], "entry_point": "f_705331", "intent": "\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a `my_list` \u0432 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e `my_set`", "library": []} {"task_id": 262786, "prompt": "def f_262786(num):\n\treturn ", "suffix": "", "canonical_solution": "list(str(num))", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate(43524) == ['4', '3', '5', '2', '4']\n", "\n assert candidate(\"hello, world!\") == ['h', 'e', 'l', 'l', 'o', ',', ' ', 'w', 'o', 'r', 'l', 'd', '!']\n"], "entry_point": "f_262786", "intent": "\u0420\u0430\u0437\u0431\u0438\u0442\u044c \u0447\u0438\u0441\u043b\u043e `num` \u043d\u0430 \u0440\u0430\u0437\u0440\u044f\u0434\u044b", "library": []} {"task_id": 262786, "prompt": "def f_262786(num):\n\treturn ", "suffix": "", "canonical_solution": "[int(i) for i in str(num)]", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate('43524') == [4,3,5,2,4]\n"], "entry_point": "f_262786", "intent": "\u0420\u0430\u0437\u0431\u0438\u0442\u044c \u0447\u0438\u0441\u043b\u043e `num` \u043d\u0430 \u0440\u0430\u0437\u0440\u044f\u0434\u044b", "library": []} {"task_id": 313184, "prompt": "def f_313184(func):\n\t", "suffix": "\n\treturn time_work", "canonical_solution": "t = time.time()\n\n\tfunc()\n\n\ttime_work = time.time()-t", "test_start": "\nimport time\n\ndef check(candidate):", "test": ["\n def func(): print('Hello World!')\n assert (candidate(func) - 8.368492126464844e-05) < 1e-6\n"], "entry_point": "f_313184", "intent": "\u0418\u0437\u043c\u0435\u0440\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f `time_work` \u0444\u0443\u043d\u043a\u0446\u0438\u0438 `func`", "library": ["time"]} {"task_id": 678639, "prompt": "def f_678639(s):\n\treturn ", "suffix": "", "canonical_solution": "any(map(str.isdigit, s))", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate('124dhe5') == True\n", "\n assert candidate('absbf') == False\n"], "entry_point": "f_678639", "intent": "\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0435\u0441\u0442\u044c \u043b\u0438 \u0447\u0438\u0441\u043b\u0430 \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 `s`", "library": []} {"task_id": 678639, "prompt": "def f_678639(s):\n\treturn ", "suffix": "", "canonical_solution": "re.search('\\d+', s)", "test_start": "\nimport re \n\ndef check(candidate):", "test": ["\n assert candidate('124dhe5').group() == '124'\n", "\n assert candidate('absbf') is None\n"], "entry_point": "f_678639", "intent": "\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0435\u0441\u0442\u044c \u043b\u0438 \u0447\u0438\u0441\u043b\u0430 \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 `s`", "library": ["re"]} {"task_id": 830473, "prompt": "def f_830473():\n\t", "suffix": "\n\treturn num", "canonical_solution": "num = int(input().strip())", "test_start": "\nimport builtins\nfrom unittest.mock import Mock\n\ndef check(candidate):", "test": ["\n builtins.input = Mock(return_value = '8')\n assert candidate() == 8\n", "\n builtins.input = Mock(return_value = '80 ')\n assert candidate() == 80\n"], "entry_point": "f_830473", "intent": "\u0421\u0447\u0438\u0442\u0430\u0442\u044c \u0441 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b \u0447\u0438\u0441\u043b\u043e \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e `num`", "library": ["builtins"]} {"task_id": 773920, "prompt": "def f_773920(val1, val2, N):\n\t", "suffix": "\n\treturn my_list", "canonical_solution": "my_list = [random.randint(val1, val2) for i in range(N)]", "test_start": "\nimport random \n\ndef check(candidate):", "test": ["\n my_list = candidate(0, 10, 4) \n assert len(my_list) == 4\n assert all([isinstance(a, int) for a in my_list])\n assert min(my_list) >= 0\n assert max(my_list) <= 10\n"], "entry_point": "f_773920", "intent": "\u0421\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043a\u043e\u043a `my_list` \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435 \u043e\u0442 `val1` \u0434\u043e `val2` \u0434\u043b\u0438\u043d\u043d\u043e\u0439 `N`", "library": ["random"]} {"task_id": 115592, "prompt": "def f_115592(my_list, sep):\n\t", "suffix": "\n\treturn splitted", "canonical_solution": "splitted = [[]]\n\n\tfor item in my_list:\n\n\t\tif item == sep:\n\n\t\t\tsplitted.append([])\n\n\t\telse:\n\n\t\t\tsplitted[-1].append(item)", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate(['ab', '-', 'c', '24v', '-', 'vd', '33', '-', '000'], '-') == [['ab'], ['c', '24v'], ['vd', '33'], ['000']]\n"], "entry_point": "f_115592", "intent": "\u0420\u0430\u0437\u0431\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a `my_list` \u043d\u0430 \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043f\u0438\u0441\u043a\u043e\u0432 `splitted` \u043f\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044e `sep`", "library": []} {"task_id": 158145, "prompt": "def f_158145(M, N, val):\n\t", "suffix": "\n\treturn my_list", "canonical_solution": "my_list = [[val for _ in range(N)] for _ in range(M)]", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate(2, 3, 0.5) == [[0.5, 0.5, 0.5], [0.5, 0.5, 0.5]]\n", "\n assert candidate(1, 1, None) == [[None]]\n"], "entry_point": "f_158145", "intent": "\u0421\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a `my_list` \u0440\u0430\u0437\u043c\u0435\u0440\u0430 `M`x`N` \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0439 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c `val`", "library": []} {"task_id": 592250, "prompt": "def f_592250(n, f):\n\t", "suffix": "\n\treturn s", "canonical_solution": "s = 0\n\n\tfor x in range(1, n+ 1):\n\n\t\ts += f(x)\n", "test_start": "\ndef check(candidate):", "test": ["\n def f(a): return a + 1\n assert candidate(2, f) == 5\n", "\n def g(a): return a * a + 1\n assert candidate(5, g) == 60\n"], "entry_point": "f_592250", "intent": "\u041f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u0443\u043c\u043c\u0443 `n` \u0447\u043b\u0435\u043d\u043e\u0432 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441\u0438\u0438 \u0441 \u0447\u043b\u0435\u043d\u043e\u043c \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 `f(x)`", "library": []} {"task_id": 592250, "prompt": "def f_592250(n, f):\n\t", "suffix": "\n\treturn s", "canonical_solution": "s = 0\n\n\tx = 0\n\n\twhile True:\n\n\t\tx+= 1\n\n\t\ts += f(x)\n\n\t\tif x == n:\n\n\t\t\tbreak\n", "test_start": "\ndef check(candidate):", "test": ["\n def f(a): return a + 1\n assert candidate(2, f) == 5\n", "\n def g(a): return a * a + 1\n assert candidate(5, g) == 60\n"], "entry_point": "f_592250", "intent": "\u041f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u0443\u043c\u043c\u0443 `n` \u0447\u043b\u0435\u043d\u043e\u0432 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441\u0438\u0438 \u0441 \u0447\u043b\u0435\u043d\u043e\u043c \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 `f(x)`", "library": []} {"task_id": 419321, "prompt": "def f_419321(old_date, date_format):\n\t", "suffix": "\n\treturn new_date", "canonical_solution": "new_date = datetime.strptime(old_date, date_format)", "test_start": "\nfrom datetime import datetime\n\ndef check(candidate):", "test": ["\n time_data = \"25/05/99 02:35:5.523\"\n format_data = \"%d/%m/%y %H:%M:%S.%f\"\n date = candidate(time_data, format_data)\n assert date.microsecond == 523000\n"], "entry_point": "f_419321", "intent": "\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u0442\u044b `old_date` \u0432 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 `new_date` \u0444\u043e\u0440\u043c\u0430\u0442\u0430 `date_format` \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 datetime ", "library": ["datetime"]} {"task_id": 419321, "prompt": "def f_419321(old_date, date_format):\n\t", "suffix": "\n\treturn new_date", "canonical_solution": "locale.setlocale(locale.LC_TIME, 'ru_RU.UTF-8')\n\n\tnew_date = datetime.strptime(old_date, date_format).date()", "test_start": "\nimport locale\nfrom datetime import datetime\nfrom unittest.mock import Mock\n\ndef check(candidate):", "test": ["\n locale.setlocale =Mock()\n time_data = \"25/05/99 02:35:5.523\"\n format_data = \"%d/%m/%y %H:%M:%S.%f\"\n date = candidate(time_data, format_data)\n assert str(date) == '1999-05-25'\n"], "entry_point": "f_419321", "intent": "\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u0442\u044b `old_date` \u0432 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 `new_date` \u0444\u043e\u0440\u043c\u0430\u0442\u0430 `date_format` \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 datetime ", "library": ["datetime", "locale"]} {"task_id": 404985, "prompt": "def f_404985(sub, s):\n\t", "suffix": "\n\treturn count", "canonical_solution": "count = 0\n\n\ti = -1\n\n\twhile True:\n\n\t\ti = s.find(sub, i+1)\n\n\t\tif i == -1:\n\n\t\t\tbreak\n\n\t\tcount += 1", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate('ab', 'abcccccabcca') == 2\n"], "entry_point": "f_404985", "intent": "\u041d\u0430\u0439\u0442\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0435\u0440\u0435\u043a\u0440\u044b\u0432\u0430\u044e\u0449\u0438\u0445 \u0432\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0439 `count` \u043f\u043e\u0434\u0441\u0442\u0440\u043e\u043a\u0438 `sub` \u0432 \u0441\u0442\u0440\u043e\u043a\u0443 `s`", "library": []} {"task_id": 427051, "prompt": "def f_427051(my_list):\n\t", "suffix": "\n\treturn my_list", "canonical_solution": "my_list.reverse()", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate([1,2,3]) == [3,2,1]\n", "\n assert candidate([1,3,2,3,1]) == [1,3,2,3,1]\n"], "entry_point": "f_427051", "intent": "\u041f\u0435\u0440\u0435\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a `my_list`", "library": []} {"task_id": 427051, "prompt": "def f_427051(my_list):\n\t", "suffix": "\n\treturn my_list", "canonical_solution": "my_list = my_list[::-1]", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate([1,2,3]) == [3,2,1]\n", "\n assert candidate([1,2,3,4,1]) == [1,4,3,2,1]\n"], "entry_point": "f_427051", "intent": "\u041f\u0435\u0440\u0435\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a `my_list`", "library": []} {"task_id": 427051, "prompt": "def f_427051(my_list):\n\t", "suffix": "\n\treturn my_list", "canonical_solution": "my_list = list(reversed(my_list))", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate([1,2,3]) == [3,2,1]\n"], "entry_point": "f_427051", "intent": "\u041f\u0435\u0440\u0435\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a `my_list`", "library": []} {"task_id": 789625, "prompt": "def f_789625(list_key, list_value):\n\t", "suffix": "\n\treturn my_dict", "canonical_solution": "my_dict = dict(zip(list_key, list_value))", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate(['a','b','c'], [1,2,3]) == {'a':1, 'b':2, 'c':3}\n", "\n assert candidate(\n ['green','happy','sunny'], [\"red\",\"sad\",\"rainy\"]\n ) == {\"green\":\"red\", \"happy\":\"sad\", \"sunny\":\"rainy\"}\n"], "entry_point": "f_789625", "intent": "\u041e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u043a\u043b\u044e\u0447\u0435\u0439 `list_key` \u0438 \u0441\u043f\u0438\u0441\u043e\u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 `list_value` \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u044c `my_dict`", "library": []} {"task_id": 789625, "prompt": "def f_789625(list_key, list_value):\n\t", "suffix": "\n\treturn my_dict", "canonical_solution": "my_dict = {list_key[i]: list_value[i] for i in range(len(list_key))}", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate(['a','b','c'], [1,2,3]) == {'a':1, 'b':2, 'c':3}\n", "\n assert candidate(\n ['green','happy','sunny'], [\"red\",\"sad\",\"rainy\"]\n ) == {\"green\":\"red\", \"happy\":\"sad\", \"sunny\":\"rainy\"}\n"], "entry_point": "f_789625", "intent": "\u041e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u043a\u043b\u044e\u0447\u0435\u0439 `list_key` \u0438 \u0441\u043f\u0438\u0441\u043e\u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 `list_value` \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u044c `my_dict`", "library": []} {"task_id": 477678, "prompt": "def f_477678(s, n, sep):\n\treturn ", "suffix": "", "canonical_solution": "sep.join([s] * n)", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate('abk', 3, ';') == 'abk;abk;abk'\n", "\n assert candidate('', 3, ';') == ';;'\n"], "entry_point": "f_477678", "intent": "\u0412\u044b\u0432\u0435\u0441\u0442\u0438 \u0441\u0442\u0440\u043e\u043a\u0443 `s` `n` \u0440\u0430\u0437 \u0447\u0435\u0440\u0435\u0437 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c `sep`", "library": []} {"task_id": 635319, "prompt": "def f_635319(df, list_indexes):\n\t", "suffix": "\n\treturn cols", "canonical_solution": "cols = df.iloc[:, list_indexes]", "test_start": "\nimport pandas as pd\n\ndef check(candidate):", "test": ["\n df = pd.DataFrame({'a': [1,2,3], 'b': [4,5,6], 'c': [7,8,9]})\n assert candidate(df, [1,2]).shape == (3, 2)\n"], "entry_point": "f_635319", "intent": "\u0412\u044b\u0431\u0440\u0430\u0442\u044c \u0441\u0442\u043e\u043b\u0431\u0446\u044b `cols` \u0441 \u0438\u043d\u0434\u0435\u043a\u0430\u0441\u0430\u043c\u0438 `list_indexes` pandas \u0434\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u043c\u0430 `df`", "library": ["pandas"]} {"task_id": 1085344, "prompt": "def f_1085344(my_list):\n\t", "suffix": "\n\treturn total", "canonical_solution": "total = sum(my_list)", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate([345, 576, 12]) == 933\n", "\n assert candidate([1.0, 2.2, 3.5]) == 6.7\n"], "entry_point": "f_1085344", "intent": "\u041d\u0430\u0439\u0442\u0438 \u0441\u0443\u043c\u043c\u0443 \u0447\u0438\u0441\u0435\u043b `total` \u0441\u043f\u0438\u0441\u043a\u0430 `my_list`", "library": []} {"task_id": 1085344, "prompt": "def f_1085344(my_list):\n\t", "suffix": "\n\treturn total", "canonical_solution": "total = 0\n\n\tfor i in my_list:\n\n\t\ttotal += i\n", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate([345, 576, 12]) == 933\n"], "entry_point": "f_1085344", "intent": "\u041d\u0430\u0439\u0442\u0438 \u0441\u0443\u043c\u043c\u0443 \u0447\u0438\u0441\u0435\u043b `total` \u0441\u043f\u0438\u0441\u043a\u0430 `my_list`", "library": []} {"task_id": 759476, "prompt": "def f_759476(my_list):\n\t", "suffix": "\n\treturn max_value", "canonical_solution": "max_value = {x: y for x, y in filter(lambda x: my_list[x[0]] == max(my_list.values()), my_list.items())}", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate({'a':3, 'b':2, 'r':36}) == {'r': 36}\n"], "entry_point": "f_759476", "intent": "\u041d\u0430\u0439\u0442\u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0435\u0447\u043d\u0438\u0435 `max_value` \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u0435 `my_list`", "library": []} {"task_id": 759476, "prompt": "def f_759476(my_list):\n\t", "suffix": "\n\treturn max_value", "canonical_solution": "max_value = max(my_list.values())", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate({'a':3, 'b':2, 'r':36}) == 36\n"], "entry_point": "f_759476", "intent": "\u041d\u0430\u0439\u0442\u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0435\u0447\u043d\u0438\u0435 `max_value` \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u0435 `my_list`", "library": []} {"task_id": 407127, "prompt": "def f_407127(my_list, n):\n\treturn ", "suffix": "", "canonical_solution": "random.sample(set(my_list),n)", "test_start": "\nimport random \n\ndef check(candidate):", "test": ["\n data = [i for i in range(10)]\n s1 = candidate(data, 3)\n assert len(s1) == 3\n assert all([(a in data) for a in s1])\n", "\n data = [i//2 for i in range(10)]\n s2 = candidate(data, 4)\n assert len(s2) == 4\n assert all([(a in data) for a in s2])\n assert len(set(s2)) == 4\n"], "entry_point": "f_407127", "intent": "\u0412\u044b\u0432\u0435\u0441\u0442\u0438 `n` \u0441\u043b\u043e\u0432 \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 `my_list` \u0432 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0431\u0435\u0437 \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u0439", "library": ["random"]} {"task_id": 446920, "prompt": "def f_446920(my_list, my_tuple):\n\t", "suffix": "\n\treturn my_list", "canonical_solution": "my_list.extend(my_tuple)", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate([1,2,3], (2,3)) == [1,2,3,2,3]\n", "\n assert candidate([1,2,3], (2,)) == [1,2,3,2]\n"], "entry_point": "f_446920", "intent": "\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u0440\u0442\u0435\u0436 `my_tuple` \u043a \u0441\u043f\u0438\u0441\u043a\u0443 `my_list`", "library": []} {"task_id": 103581, "prompt": "def f_103581(s, i, symbol):\n\treturn ", "suffix": "", "canonical_solution": "s[:i] + symbol + s[i + 1:]", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate('dsgfjksdlh', 3, 'abc') == 'dsgabcjksdlh'\n", "\n assert candidate('dsgfjksdlh', 3, '.') == 'dsg.jksdlh'\n"], "entry_point": "f_103581", "intent": "\u0417\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 `s` \u0441\u0438\u043c\u0432\u043e\u043b \u043d\u0430 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 `i` \u043d\u0430 \u0441\u0438\u043c\u0432\u043e\u043b `symbol`", "library": []} {"task_id": 28096, "prompt": "def f_28096(my_list):\n\t", "suffix": "\n\treturn my_list", "canonical_solution": "my_list = sorted(my_list)", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate([3,2,1]) == [1,2,3]\n", "\n assert candidate([1,1,1]) == [1,1,1]\n", "\n assert candidate(['a', 'b', 'c']) == ['a', 'b', 'c']\n"], "entry_point": "f_28096", "intent": "\u041e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a `my_list`", "library": []} {"task_id": 28096, "prompt": "def f_28096(my_list):\n\t", "suffix": "\n\treturn my_list", "canonical_solution": "my_list.sort()", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate([3,2,1]) == [1,2,3]\n", "\n assert candidate([1,1,1]) == [1,1,1]\n", "\n assert candidate(['a', 'b', 'c']) == ['a', 'b', 'c']\n"], "entry_point": "f_28096", "intent": "\u041e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a `my_list`", "library": []} {"task_id": 133137, "prompt": "def f_133137():\n\t", "suffix": "\n\treturn my_ip", "canonical_solution": "conn = http.client.HTTPConnection(\"ifconfig.me\")\n\n\tconn.request(\"GET\", \"/ip\")\n\n\tmy_ip = conn.getresponse().read()\n", "test_start": "\nimport http.client\n\ndef check(candidate):", "test": ["\n ans = candidate()\n parts = ans.decode('utf-8').split('.')\n assert len(parts) == 4\n"], "entry_point": "f_133137", "intent": "\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c ip-\u0430\u0434\u0440\u0435\u0441 `my_ip` \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430 \u0432 \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435 ", "library": ["http"]} {"task_id": 134564, "prompt": "def f_134564(first_date, second_date):\n\treturn ", "suffix": "", "canonical_solution": "second_date - first_date", "test_start": "\nimport datetime\n\ndef check(candidate):", "test": ["\n d1 = datetime.datetime(2000, 1, 2)\n d2 = datetime.datetime(2000, 2, 2)\n assert candidate(d1, d2) == datetime.timedelta(days=31)\n"], "entry_point": "f_134564", "intent": "\u041d\u0430\u0439\u0442\u0438 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u0440\u043e\u0448\u043b\u043e \u043c\u0435\u0436\u0434\u0443 \u0434\u0430\u0442\u0430\u043c\u0438 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 datetime `first_date` \u0438 `second_date` ", "library": ["datetime"]} {"task_id": 236635, "prompt": "def f_236635():\n\treturn ", "suffix": "", "canonical_solution": "sys.argv", "test_start": "\nimport sys\n\ndef check(candidate):", "test": ["\n assert candidate() == sys.argv\n"], "entry_point": "f_236635", "intent": "\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 `params` \u0438\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438", "library": ["sys"]} {"task_id": 273613, "prompt": "def f_273613(file_path, prefix):\n\t", "suffix": "\n\treturn ", "canonical_solution": "\n\ttext = \"\"\n\twith open(file_path, 'r') as f:\n\t for line in f:\n\t if not re.search(r\"^({})\".format(prefix), line):\n\t text += line\n\t\n\twith open(file_path, 'w') as f:\n\t f.write(text)", "test_start": "\nimport re\n\ndef check(candidate):", "test": ["\n with open('o.txt', 'w') as f:\n f.write('chalo 123\\n')\n f.write('chalo 456\\n')\n f.write('abc def\\n')\n candidate('o.txt', 'chalo')\n with open('o.txt', 'r') as f:\n assert f.readline() == 'abc def\\n'\n"], "entry_point": "f_273613", "intent": "\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 `file_path` \u0441\u0442\u0440\u043e\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442\u0441\u044f \u0441\u043e \u0441\u0442\u0440\u043e\u043a\u0438 `prefix`", "library": ["re"]} {"task_id": 9096, "prompt": "def f_9096(s):\n\treturn ", "suffix": "", "canonical_solution": "Counter(s.split())", "test_start": "\nfrom collections import Counter\n\ndef check(candidate):", "test": ["\n assert candidate('my string') == Counter({'my': 1, 'string': 1})\n", "\n assert candidate('this string contains repetitive words words words words ...') == Counter({\n '...': 1, 'contains': 1, 'repetitive': 1, 'string': 1, 'this': 1, 'words': 4})\n"], "entry_point": "f_9096", "intent": "\u041f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u043b\u043e\u0432\u0430 \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 `s`", "library": ["collections"]} {"task_id": 157783, "prompt": "def f_157783(num, base):\n\t", "suffix": "\n\treturn new_num", "canonical_solution": "new_num = int(str(num), base) ", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate(100, 8) == 64\n"], "entry_point": "f_157783", "intent": "\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0447\u0438\u0441\u043b\u043e `num` \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0441\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0441 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0435\u043c `base` \u0432 \u0447\u0438\u0441\u043b\u043e `new_num` \u0432 \u0434\u0435\u0441\u044f\u0442\u0438\u0447\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0441\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f ", "library": []} {"task_id": 224243, "prompt": "def f_224243(db_path):\n\t", "suffix": "\n\treturn cur", "canonical_solution": "con = sqlite3.connect(db_path)\n\n\tcur = con.cursor()\n", "test_start": "\nimport sqlite3\n\ndef check(candidate):", "test": ["\n assert 'sqlite3.Cursor' in str(type(candidate('dev.db'))) \n"], "entry_point": "f_224243", "intent": "\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 sqlite3 `db_path`", "library": ["sqlite3"]} {"task_id": 225896, "prompt": "def f_225896(cmd):\n\t", "suffix": "\n\treturn result", "canonical_solution": "result = os.popen(cmd, 'r', 1)", "test_start": "\nimport os\nfrom unittest.mock import Mock\n\ndef check(candidate):", "test": ["\n os.popen = Mock(return_value = True)\n assert candidate('python3') == True\n"], "entry_point": "f_225896", "intent": "\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u0442\u043e\u043a \u0432\u044b\u0432\u043e\u0434\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b `cmd` \u0432 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 `result`", "library": ["os"]} {"task_id": 319317, "prompt": "def f_319317(s):\n\t", "suffix": "\n\treturn my_dict", "canonical_solution": "my_dict = json.loads(s)", "test_start": "\nimport json\n\ndef check(candidate):", "test": ["\n assert candidate('{\"abc\":1, \"dfhgfrh\": 3435}') == {\"abc\":1, \"dfhgfrh\": 3435}\n"], "entry_point": "f_319317", "intent": "\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 `s` \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u044c `my_dict`", "library": ["json"]} {"task_id": 319317, "prompt": "def f_319317(s):\n\t", "suffix": "\n\treturn my_dict", "canonical_solution": "my_dict = dict(ast.literal_eval(s))", "test_start": "\nimport ast\n\ndef check(candidate):", "test": ["\n assert candidate(\"{'a': [1, 2, 3]}\") == {'a': [1, 2, 3]}\n"], "entry_point": "f_319317", "intent": "\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 `s` \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u044c `my_dict`", "library": ["ast"]} {"task_id": 235923, "prompt": "def f_235923(file_path):\n\t", "suffix": "\n\treturn my_list", "canonical_solution": "with open(file_path) as file:\n\n\t\tmy_list = [row.strip() for row in file]", "test_start": "\ndef check(candidate):", "test": ["\n with open('test.txt', 'w') as fw:\n fw.write('hello \\n')\n fw.write('world!\\n')\n assert candidate('test.txt') == [\"hello\", \"world!\"]\n"], "entry_point": "f_235923", "intent": "\u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 `file_path` \u0432 \u0441\u043f\u0438\u0441\u043e\u043a `my_list`", "library": []} {"task_id": 235923, "prompt": "def f_235923(file_path):\n\t", "suffix": "\n\treturn my_list", "canonical_solution": "with open(file_path, 'r') as f:\n\n\t\tmy_list = f.read().splitlines()\n", "test_start": "\ndef check(candidate):", "test": ["\n with open('test.txt', 'w') as fw:\n fw.write('hello \\n')\n fw.write('world!\\n')\n assert candidate('test.txt') == [\"hello \", \"world!\"]\n"], "entry_point": "f_235923", "intent": "\u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 `file_path` \u0432 \u0441\u043f\u0438\u0441\u043e\u043a `my_list`", "library": []} {"task_id": 235923, "prompt": "def f_235923(file_path):\n\t", "suffix": "\n\treturn my_list", "canonical_solution": "\n\twith io.open(file_path, encoding='utf-8') as f:\n\t\tmy_list = f.read().splitlines()\n", "test_start": "\nimport io\n\ndef check(candidate):", "test": ["\n with open('test.txt', 'w') as fw:\n fw.write('hello \\n')\n fw.write('world!\\n')\n assert candidate('test.txt') == [\"hello \", \"world!\"]\n"], "entry_point": "f_235923", "intent": "\u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 `file_path` \u0432 \u0441\u043f\u0438\u0441\u043e\u043a `my_list`", "library": ["io"]} {"task_id": 44503, "prompt": "def f_44503(s):\n\t", "suffix": "\n\treturn nums", "canonical_solution": "regexp = re.compile( \"\\s*(-?(?:0|[1-9]\\d*)(?:\\.\\d+)?)\\s*;\", re.M )\n\n\tnums = regexp.findall(s)\n", "test_start": "\nimport re\n\ndef check(candidate):", "test": ["\n assert candidate('a:=-1;b:=4') == ['-1']\n"], "entry_point": "f_44503", "intent": "\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0447\u0438\u0441\u0435\u043b `nums` \u0438\u0437 \u0441\u0442\u0440\u043e\u043a\u0438 `s`", "library": ["re"]} {"task_id": 197142, "prompt": "def f_197142(s):\n\t", "suffix": "\n\treturn sentences", "canonical_solution": "split_regex = re.compile(r'[.|!|?|\u2026]')\n\n\tsentences = list(filter(lambda t: t, [t.strip() for t in split_regex.split(s)]))", "test_start": "\nimport re\n\ndef check(candidate):", "test": ["\n assert candidate('this is the first piece. Is there another one? Maybe...') == ['this is the first piece', 'Is there another one', 'Maybe']\n"], "entry_point": "f_197142", "intent": "\u0420\u0430\u0437\u0431\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 `s` \u043d\u0430 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0439 `sentences`", "library": ["re"]} {"task_id": 166814, "prompt": "def f_166814(s):\n\treturn ", "suffix": "", "canonical_solution": "print(s, end=\" \")", "test_start": "\nimport sys\nfrom io import StringIO\n\ndef check(candidate):", "test": ["\n stdout = sys.stdout\n s = StringIO()\n sys.stdout = s\n candidate('hello world!')\n sys.stdout = stdout \n s.seek(0)\n assert len(s.read()) == 13\n"], "entry_point": "f_166814", "intent": "\u0412\u044b\u0432\u0435\u0441\u0442\u0438 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u0441\u0442\u0440\u043e\u043a\u0443 `s` \u0431\u0435\u0437 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u0441\u0442\u0440\u043e\u043a\u0438", "library": ["io", "sys"]} {"task_id": 91763, "prompt": "def f_91763(my_dict):\n\t", "suffix": "\n\treturn my_dict", "canonical_solution": "\n\tkeys = list(my_dict.keys()).copy()\n\tfor my_key in keys:\n\t\tif my_key in my_dict:\n\t\t\tdel my_dict[my_key]\n", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate({'a': 1}) == {}\n"], "entry_point": "f_91763", "intent": "\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441\u043b\u043e\u0432\u0430\u0440\u044f `my_dict` \u0441 \u043a\u043b\u044e\u0447\u0435\u043c `my_key` \u0432\u043d\u0443\u0442\u0440\u0438 \u0446\u0438\u043a\u043b\u0430 for ", "library": []} {"task_id": 297129, "prompt": "def f_297129(num):\n\treturn ", "suffix": "", "canonical_solution": "str(num).encode()", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate(123) == b'123'\n"], "entry_point": "f_297129", "intent": "\u041f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438 \u0447\u0438\u0441\u043b\u043e `num` \u0432 \u0431\u0430\u0439\u0442 \u0441\u0442\u0440\u043e\u043a\u0443", "library": []} {"task_id": 55256, "prompt": "def f_55256(s, my_dict):\n\t", "suffix": "\n\treturn s", "canonical_solution": "for i, symbol in enumerate(s):\n\n\t\tif symbol in my_dict:\n\n\t\t\ts = s[:i] + str(my_dict[symbol]) + s[i+1:]\n", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate('123', {'a': 'a', 'b': 0, '2': 'x'}) == '1x3'\n"], "entry_point": "f_55256", "intent": "\u0417\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 `s` \u043f\u043e \u0441\u043b\u043e\u0432\u0430\u0440\u044e `my_dict`", "library": []} {"task_id": 105134, "prompt": "def f_105134():\n\t", "suffix": "\n\treturn path", "canonical_solution": "\n\tclass Owner:\n\t\tdef __init__(self, id):\n\t\t\tself.id = id\n\tclass Instance:\n\t\tdef __init__(self, owner, slug):\n\t\t\tself.owner = owner\n\t\t\tself.slug = slug\n\n\tdef get_upload_path(instance, filename):\n\t\treturn os.path.join(\"user_%d\" % instance.owner.id, \"car_%s\" % instance.slug, filename)\n\n\towner = Owner(1)\n\tinst = Instance(owner, \"hello\")\n\tpath = get_upload_path(inst, 'hello.txt')\n", "test_start": "\nimport os\n\ndef check(candidate):", "test": ["\n assert candidate() == 'user_1/car_hello/hello.txt'\n"], "entry_point": "f_105134", "intent": "\u0421\u0433\u0435\u043d\u0435\u043d\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0443\u0442\u044c \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 Django upload_to", "library": ["os"]} {"task_id": 185524, "prompt": "def f_185524(s, suff):\n\treturn ", "suffix": "", "canonical_solution": "\" \".join(list(filter( lambda x : not x.endswith(suff), list(s.split()))))", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate('agfgf gfg123 afg345 safg123', '123') == 'agfgf afg345'\n"], "entry_point": "f_185524", "intent": "\u0418\u0437 \u0441\u0442\u0440\u043e\u043a\u0438 `s` \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0441\u043b\u043e\u0432\u0430 \u0441 \u0441\u0443\u0444\u0438\u043a\u0441\u043e\u043c `suff`", "library": []} {"task_id": 294170, "prompt": "def f_294170(my_var):\n\t", "suffix": "\n\treturn exists", "canonical_solution": "\n\tglobs = globals().copy()\n\tvar_name = list(filter(lambda x: id(globs[x]) == id(my_var), globs))[0]\n\texists = var_name in globals()\n", "test_start": "\nu = 5\ndef check(candidate):", "test": ["\n assert candidate(u) == True\n"], "entry_point": "f_294170", "intent": "\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u0435 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 `my_var`", "library": []} {"task_id": 205516, "prompt": "def f_205516(dict_list, my_key):\n\t", "suffix": "\n\treturn values_by_key", "canonical_solution": "values_by_key = [x[my_key] for x in dict_list if my_key in x] \n\t", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate([{'x':123}, {'a':5435.0, 'x': 'fdg'}], 'a') == [5435.0]\n", "\n assert candidate([{'x':123}, {'a':5435.0, 'x': 'fdg'}], 'x') == [123, 'fdg']\n"], "entry_point": "f_205516", "intent": "\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 `values_by_key` \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 \u0441\u043b\u043e\u0432\u0430\u0440\u0435\u0439 `dict_list` \u043f\u043e \u043a\u043b\u044e\u0447\u0443 `my_key`", "library": []} {"task_id": 45499, "prompt": "def f_45499(url):\n\t", "suffix": "\n\treturn code", "canonical_solution": "with urllib.request.urlopen(url) as res:\n\t code = res.read()", "test_start": "\nimport urllib \n\ndef check(candidate):", "test": ["\n assert 'Wikipedia' in str(candidate('https://www.wikipedia.org'))\n", "\n assert 'Google' in str(candidate('https://www.google.com'))\n"], "entry_point": "f_45499", "intent": "\u0421\u043f\u0430\u0440\u0441\u0438\u0442\u044c HTML-\u043a\u043e\u0434 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b `code` \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 `url`", "library": ["urllib"]} {"task_id": 211668, "prompt": "def f_211668(values, filename):\n\t", "suffix": "\n\treturn ", "canonical_solution": "book = xlwt.Workbook()\n\n\tsheet1 = book.add_sheet(\"sheet1\")\n\n\t\n\tfor row_index, row_values in enumerate(values):\n\n\t\trow = sheet1.row(row_index)\n\n\t\tfor col_index, col in enumerate(row_values):\n\n\t\t\tvalue = row_values[col_index]\n\n\t\t\trow.write(col_index, value)\n\n\t\n\tbook.save(filename)", "test_start": "\nimport os\nimport xlwt\n\ndef check(candidate):", "test": ["\n values = [[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]]\n candidate(values, 'k.xlsx')\n assert os.path.exists('k.xlsx')\n"], "entry_point": "f_211668", "intent": "\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 `values` \u0432 excel \u0444\u0430\u0439\u043b `filename`", "library": ["os", "xlwt"]} {"task_id": 163083, "prompt": "def f_163083(my_list):\n\treturn ", "suffix": "", "canonical_solution": "list(map(lambda x: x[0]+x[1], zip(my_list[0::2], my_list[1::2])))", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate(['cute', 'dog', 'sunny', 'day']) == ['cutedog', 'sunnyday']\n"], "entry_point": "f_163083", "intent": "\u041e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u043f\u043e\u043f\u0430\u0440\u043d\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0441\u043f\u0438\u0441\u043a\u0430 `my_list` \u0432 \u0441\u0442\u0440\u043e\u043a\u0438", "library": []} {"task_id": 62533, "prompt": "def f_62533(s):\n\treturn ", "suffix": "", "canonical_solution": "s.encode()\n\t", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate(\"hello python\") == b\"hello python\"\n", "\n assert candidate(\"?!?\") == b\"?!?\"\n"], "entry_point": "f_62533", "intent": "\u041f\u0435\u0440\u0435\u0432\u0435\u0442\u0438 \u0441\u0442\u0440\u043e\u043a\u0430 `s` \u0432 \u0431\u0430\u0439\u0442-\u0441\u0442\u0440\u043e\u043a\u0443", "library": []} {"task_id": 215531, "prompt": "def f_215531(s):\n\t", "suffix": "\n\treturn my_json", "canonical_solution": "my_json = json.loads(s)\n\t", "test_start": "\nimport json\n\ndef check(candidate):", "test": ["\n s = json.dumps({'a':\"hello python\", 'b': 123})\n assert candidate(s) == {'a':\"hello python\", 'b': 123}\n"], "entry_point": "f_215531", "intent": "\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 `s` \u0432 JSON \u043e\u0431\u044a\u0435\u043a\u0442 `my_json`", "library": ["json"]} {"task_id": 1666, "prompt": "def f_1666(s):\n\treturn ", "suffix": "", "canonical_solution": "hashlib.md5(s)", "test_start": "\nimport hashlib\n\ndef check(candidate):", "test": ["\n assert candidate(b'opera').hexdigest() == '9ed987966c06808b50f9fddc24931bd1'\n"], "entry_point": "f_1666", "intent": "\u0417\u0430\u0445\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 `s` \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 MD5", "library": ["hashlib"]} {"task_id": 151750, "prompt": "def f_151750(file_path):\n\treturn ", "suffix": "", "canonical_solution": "open(file_path, encoding='utf-8')", "test_start": "\ndef check(candidate):", "test": ["\n fw = open('test.txt', 'w')\n fw.close()\n \n f = candidate('test.txt')\n assert f.name == 'test.txt'\n assert f.encoding == 'utf-8'\n"], "entry_point": "f_151750", "intent": "\u041e\u0442\u043a\u0440\u044b\u0442\u044c \u0444\u0430\u0439\u043b `file_path` \u0441 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u043e\u0439 UTF-8", "library": []} {"task_id": 271764, "prompt": "def f_271764(strings):\n\t", "suffix": "\n\treturn strings", "canonical_solution": "strings.sort()", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate([\"afsdv\", \"csdfgrtyw356\", \"&*%&(%gs\"]) == ['&*%&(%gs', 'afsdv', 'csdfgrtyw356']\n"], "entry_point": "f_271764", "intent": "\u041e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0442\u0440\u043e\u043a `strings` \u043f\u043e \u0430\u043b\u0444\u0430\u0432\u0438\u0442\u0443 \u0438 \u0434\u043b\u0438\u043d\u0435", "library": []} {"task_id": 306224, "prompt": "def f_306224(file_path1, file_path2):\n\t", "suffix": "\n\treturn diff", "canonical_solution": "\n\tfrom difflib import ndiff\n\t\n\tt1 = open(file_path1).read().splitlines(1)\n\tt2 = open(file_path2).read().splitlines(1)\n\t\n\tdiff = ''.join(ndiff(t1, t2))\n", "test_start": "\nfrom difflib import ndiff\n\ndef check(candidate):", "test": ["\n with open('test1.txt', 'w') as f:\n f.write('abc\\ndef\\nhij\\n')\n with open('test2.txt', 'w') as f:\n f.write('abc\\ntyh\\nkil\\nhij\\n')\n res = candidate('test1.txt', 'test2.txt')\n assert '+ tyh' in res\n assert '- def' in res\n", "\n with open('test1.txt', 'w') as f:\n f.write('abc\\ndef\\nhij\\n')\n res = candidate('test1.txt', 'test1.txt')\n assert not any([(ch in res) for ch in ['-','?','+']])\n"], "entry_point": "f_306224", "intent": "\u0421\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u0444\u0430\u0439\u043b\u044b `file_path1` \u0438 `file_path2` \u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e", "library": ["difflib"]} {"task_id": 157647, "prompt": "def f_157647(s, old_sub, new_sub, count):\n\treturn ", "suffix": "", "canonical_solution": "s.replace(old_sub, new_sub, count)", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate(\"this string contains some old words old old old\", 'old', 'new', 3) == 'this string contains some new words new new old'\n"], "entry_point": "f_157647", "intent": "\u0417\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u043e\u0434\u0441\u0442\u0440\u043e\u043a\u0443 `old_sub` \u043d\u0430 \u043f\u043e\u0434\u0441\u0442\u043e\u043a\u0443 `new_sub` \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 `s` `count` \u0440\u0430\u0437", "library": []} {"task_id": 303166, "prompt": "def f_303166(s, sep):\n\t", "suffix": "\n\treturn my_dict", "canonical_solution": "my_dict = dict([[x[1:-1] for x in s.split(sep)], ])", "test_start": "\ndef check(candidate):", "test": ["\n s = \"hello, world!\"\n assert candidate(s, ',') == {'ell': 'world'}\n", "\n s = \"hello, world!\"\n assert candidate(s, '!') == {'ello, worl': ''}\n"], "entry_point": "f_303166", "intent": "\u0420\u0430\u0441\u043f\u0430\u0440\u0441\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u043a\u043b\u044e\u0447-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 `s` \u043f\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044e `sep` \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u044c `my_dict`", "library": []} {"task_id": 101677, "prompt": "def f_101677(num):\n\t", "suffix": "\n\treturn num", "canonical_solution": "\n\tnum = str(num)\n\tif \".\" in num:\n\t\tinteger, tail = num.split(\".\")\n\t\ttail = re.sub(r'[0]*$', '', tail)\n\t\tif not tail:\n\t\t\tnum = integer\n\t\telse:\n\t\t\tnum = integer + \".\" + tail\n", "test_start": "\nimport re \n\ndef check(candidate):", "test": ["\n assert candidate(\"123.45\") == \"123.45\"\n", "\n assert candidate(\"123.00\") == \"123\"\n", "\n assert candidate(\"1.500\") == \"1.5\"\n"], "entry_point": "f_101677", "intent": "\u041e\u0442\u0431\u0440\u043e\u0441\u0438\u0442\u044c \u043d\u0435\u0437\u043d\u0430\u0447\u0430\u0449\u0438\u0435 \u043d\u0443\u043b\u0438 \u0441\u043f\u0440\u0430\u0432\u0430 `num`", "library": ["re"]} {"task_id": 74955, "prompt": "def f_74955(s):\n\treturn ", "suffix": "", "canonical_solution": "re.sub(r'[^\\w\\s]', '', s)", "test_start": "\nimport re\n\ndef check(candidate):", "test": ["\n assert candidate('ergf, earg. f?') == 'ergf earg f'\n"], "entry_point": "f_74955", "intent": "\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0437\u043d\u0430\u043a\u0438 \u043f\u0440\u0435\u043f\u0438\u043d\u0430\u043d\u0438\u044f \u0438\u0437 \u0441\u0442\u0440\u043e\u043a\u0438 `s`", "library": ["re"]} {"task_id": 74955, "prompt": "def f_74955(s):\n\t", "suffix": "\n\treturn s", "canonical_solution": "for p in string.punctuation:\n\n\t\tif p in s:\n\n\t\t\ts = s.replace(p, '')\n", "test_start": "\nimport string\n\ndef check(candidate):", "test": ["\n assert candidate(\"hello\") == \"hello\"\n", "\n assert candidate(\"hello, world!\") == \"hello world\"\n", "\n assert candidate(\"# % ^ . &\") == \" \"\n"], "entry_point": "f_74955", "intent": "\u041e\u0442\u0431\u0440\u043e\u0441\u0438\u0442\u044c \u043d\u0435\u0437\u043d\u0430\u0447\u0430\u0449\u0438\u0435 \u043d\u0443\u043b\u0438 \u0441\u043f\u0440\u0430\u0432\u0430 `num`", "library": ["string"]} {"task_id": 300050, "prompt": "def f_300050(my_list, sep):\n\t", "suffix": "\n\treturn s", "canonical_solution": "s = sep.join(my_list)", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate(['a','b','c','d','z'], '') == 'abcdz'\n", "\n assert candidate(['a',' ','%',' ','!!'], '|') == 'a| |%| |!!'\n"], "entry_point": "f_300050", "intent": "\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a `my_list` \u0432 \u0441\u0442\u0440\u043e\u043a\u0443 `s` c \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0435\u043c `sep` ", "library": []} {"task_id": 300050, "prompt": "def f_300050(my_list, sep):\n\t", "suffix": "\n\treturn s", "canonical_solution": "s = sep.join(map(str, my_list))", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate(['a','b','c','d','z'], '') == 'abcdz'\n", "\n assert candidate(['a',' ','%',' ','!!'], '|') == 'a| |%| |!!'\n"], "entry_point": "f_300050", "intent": "\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a `my_list` \u0432 \u0441\u0442\u0440\u043e\u043a\u0443 `s` c \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0435\u043c `sep` ", "library": []} {"task_id": 52873, "prompt": "def f_52873(s):\n\t", "suffix": "\n\treturn chars", "canonical_solution": "chars = list(s)", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate('*%^&gym3 34') == ['*','%','^','&','g','y','m','3',' ','3','4']\n"], "entry_point": "f_52873", "intent": "\u0420\u0430\u0437\u0431\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 `s` \u043d\u0430 \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 `chars`", "library": []} {"task_id": 52873, "prompt": "def f_52873(s):\n\t", "suffix": "\n\treturn chars", "canonical_solution": "chars = [c for c in s]", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate('*%^&gym3 34') == ['*','%','^','&','g','y','m','3',' ','3','4']\n"], "entry_point": "f_52873", "intent": "\u0420\u0430\u0437\u0431\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 `s` \u043d\u0430 \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 `chars`", "library": []} {"task_id": 648454, "prompt": "def f_648454(num, n):\n\treturn ", "suffix": "", "canonical_solution": "round(num, n)", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate(100, 2) == 100\n", "\n assert candidate(100.12345, 3) == 100.123\n"], "entry_point": "f_648454", "intent": "\u041e\u043a\u0440\u0443\u0433\u043b\u0438\u0442\u044c `num` \u0434\u043e `n` \u0437\u043d\u0430\u043a\u043e\u0432 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u044f\u0442\u043e\u0439 ", "library": []} {"task_id": 359110, "prompt": "def f_359110(s):\n\t", "suffix": "\n\treturn s", "canonical_solution": "s = s.replace(' ', '')", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate(' ') == ''\n", "\n assert candidate('hello hi') == 'hellohi'\n", "\n assert candidate('') == ''\n", "\n assert candidate('same') == 'same'\n", "\n assert candidate(' _ _ _') == '___'\n"], "entry_point": "f_359110", "intent": "\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0432\u0441\u0435 \u043f\u0440\u043e\u0431\u0435\u043b\u044b \u0438\u0437 \u0441\u0442\u0440\u043e\u043a\u0438 `s`", "library": []} {"task_id": 359110, "prompt": "def f_359110(s):\n\t", "suffix": "\n\treturn s", "canonical_solution": "s = ''.join(s.split())", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate(' ') == ''\n", "\n assert candidate('hello hi') == 'hellohi'\n", "\n assert candidate('') == ''\n", "\n assert candidate('same') == 'same'\n", "\n assert candidate(' _ _ _') == '___'\n"], "entry_point": "f_359110", "intent": "\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0432\u0441\u0435 \u043f\u0440\u043e\u0431\u0435\u043b\u044b \u0438\u0437 \u0441\u0442\u0440\u043e\u043a\u0438 `s`", "library": []} {"task_id": 418982, "prompt": "def f_418982(my_list):\n\t", "suffix": "\n\treturn list_value_counts", "canonical_solution": "list_value_counts = Counter(my_list)", "test_start": "\nfrom collections import Counter\n\ndef check(candidate):", "test": ["\n c_1 = candidate([1,1,1,0])\n assert len(c_1) == 2 and c_1[1] == 3 and c_1[0] == 1\n", "\n c_2 = candidate([])\n assert len(c_2) == 0 \n", "\n c_3 = candidate(['h', 'h', 'a', -1])\n assert len(c_3) == 3 and c_3['h'] == 2 and c_3['a'] == 1 and c_3[-1] == 1\n", "\n c_4 = candidate([5])\n assert len(c_4) == 1 and c_4[5] == 1\n", "\n c_5 = candidate([-1,-1,-1])\n assert len(c_5) == 1 and c_5[-1] == 3 \n"], "entry_point": "f_418982", "intent": "\u041f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 `my_list` \u0432 `list_value_counts`", "library": ["collections"]} {"task_id": 418982, "prompt": "def f_418982(my_list):\n\t", "suffix": "\n\treturn list_value_counts", "canonical_solution": "list_value_counts = {i: my_list.count(i) for i in my_list}", "test_start": "\ndef check(candidate):", "test": ["\n c_1 = candidate([1,1,1,0])\n assert len(c_1) == 2 and c_1[1] == 3 and c_1[0] == 1\n", "\n c_2 = candidate([])\n assert len(c_2) == 0 \n", "\n c_3 = candidate(['h', 'h', 'a', -1])\n assert len(c_3) == 3 and c_3['h'] == 2 and c_3['a'] == 1 and c_3[-1] == 1\n", "\n c_4 = candidate([5])\n assert len(c_4) == 1 and c_4[5] == 1\n", "\n c_5 = candidate([-1,-1,-1])\n assert len(c_5) == 1 and c_5[-1] == 3 \n"], "entry_point": "f_418982", "intent": "\u041f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 `my_list` \u0432 `list_value_counts`", "library": []} {"task_id": 575604, "prompt": "def f_575604(my_list):\n\t", "suffix": "\n\treturn my_list", "canonical_solution": "my_list = [el for el, _ in groupby(my_list)]", "test_start": "\nfrom itertools import groupby\n\ndef check(candidate):", "test": ["\n assert(candidate([1,1,2,2,3,3])) == [1,2,3]\n", "\n assert(candidate([])) == []\n", "\n assert(candidate([12,20,21,21,21,21,21])) == [12,20,21]\n", "\n assert(candidate([0,0,0,0,0,0,0,0,0])) == [0]\n", "\n assert(candidate([-100,-99,-98,-98,-91,-91,0])) == [-100,-99,-98,-91,0]\n"], "entry_point": "f_575604", "intent": "\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0435\u0441\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0441\u043f\u0438\u0441\u043a\u0435 `my_list`", "library": ["itertools"]} {"task_id": 575604, "prompt": "def f_575604(my_list):\n\t", "suffix": "\n\treturn my_list", "canonical_solution": "my_list = list(set(my_list))", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate([1,2,3,4,5]) == [1,2,3,4,5]\n", "\n assert sorted(candidate([1,2,3,4,2,3,4])) == [1,2,3,4]\n", "\n assert sorted(candidate(['a', 'b', 'bb'])) == ['a', 'b', 'bb']\n"], "entry_point": "f_575604", "intent": "\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0435\u0441\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0441\u043f\u0438\u0441\u043a\u0435 `my_list`", "library": []} {"task_id": 397222, "prompt": "def f_397222(num):\n\treturn ", "suffix": "", "canonical_solution": "math.sqrt(num)", "test_start": "\nimport math \n\ndef check(candidate):", "test": ["\n assert candidate(1) == 1\n", "\n assert candidate(144) == 12\n", "\n assert candidate(400.0) == 20.0\n"], "entry_point": "f_397222", "intent": "\u041d\u0430\u0439\u0442\u0438 \u043a\u0432\u0430\u0440\u0430\u0442\u043d\u044b\u0439 \u043a\u043e\u0440\u0435\u043d\u044c \u0438\u0437 `num`", "library": ["math"]} {"task_id": 459401, "prompt": "def f_459401(my_number_strs):\n\t", "suffix": "\n\treturn my_numbers", "canonical_solution": "my_numbers = [int(item) for item in my_number_strs]", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate('123') == [1,2,3]\n", "\n assert candidate(['1','2','3']) == [1,2,3]\n"], "entry_point": "f_459401", "intent": "\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0442\u0440\u043e\u043a `my_number_strs` \u0432 \u0441\u043f\u0438\u0441\u043e\u043a \u0447\u0438\u0441\u0435\u043b `my_numbers`", "library": []} {"task_id": 235938, "prompt": "def f_235938(s, my_subs):\n\treturn ", "suffix": "", "canonical_solution": "re.search(my_subs, s)", "test_start": "\nimport re\n\ndef check(candidate):", "test": ["\n assert candidate('this is a test string','test').group() == 'test'\n", "\n assert candidate('this is another test string','thi').group() == 'thi'\n", "\n assert candidate('','test') is None\n"], "entry_point": "f_235938", "intent": "\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0435\u0441\u0442\u044c \u043b\u0438 \u043f\u043e\u0434\u0441\u0442\u0440\u043e\u043a\u0430 `my_subs` \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 `s`", "library": ["re"]} {"task_id": 235938, "prompt": "def f_235938(s, my_subs):\n\treturn ", "suffix": "", "canonical_solution": "my_subs in s", "test_start": "\nimport re\n\ndef check(candidate):", "test": ["\n assert candidate('this is a test string','test') == True\n", "\n assert candidate('this is another test string','thi') == True\n", "\n assert candidate('','test') == False\n", "\n assert candidate('checking space', ' ') == True\n"], "entry_point": "f_235938", "intent": "\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0435\u0441\u0442\u044c \u043b\u0438 \u043f\u043e\u0434\u0441\u0442\u0440\u043e\u043a\u0430 `my_subs` \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 `s`", "library": ["re"]} {"task_id": 235938, "prompt": "def f_235938(s, my_subs):\n\treturn ", "suffix": "", "canonical_solution": "s.find(my_subs) != -1 ", "test_start": "\nimport re\n\ndef check(candidate):", "test": ["\n assert candidate('this is a test string','test') == True\n", "\n assert candidate('this is another test string','thi') == True\n", "\n assert candidate('','test') == False\n", "\n assert candidate('checking space', ' ') == True\n"], "entry_point": "f_235938", "intent": "\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0435\u0441\u0442\u044c \u043b\u0438 \u043f\u043e\u0434\u0441\u0442\u0440\u043e\u043a\u0430 `my_subs` \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 `s`", "library": ["re"]} {"task_id": 427942, "prompt": "def f_427942(my_list1, my_list2):\n\t", "suffix": "\n\treturn common_items", "canonical_solution": "count_values_l1 = Counter(my_list1)\n\n\tcount_values_l2 = Counter(my_list2)\n\n\tkeys1 = count_values_l1.keys()\n\n\tkeys2 = count_values_l2.keys()\n\n\tcommon_items = []\n\n\tfor key in keys1:\n\n\t\tif key in keys2:\n\n\t\t\tcommon_items += [key] * min(count_values_l1[key], count_values_l2[key])\n\t", "test_start": "\nfrom collections import Counter\n\ndef check(candidate):", "test": ["\n l1 = []\n l2 = []\n assert (candidate(l1, l2) == [])\n", "\n l1 = [1, 2, 3]\n l2 = [4, 5, 6]\n assert (candidate(l1, l2)) == []\n", "\n l1 = [1, 2, 3]\n l2 = [1, 2, 3]\n assert (candidate(l1, l2) == [1, 2, 3])\n", "\n l1 = [1, 2, 3, 4]\n l2 = [3, 4, 5, 6]\n assert (candidate(l1, l2) == [3, 4])\n", "\n l1 = [1, 2, 3, 4]\n l2 = [5, 6, 7, 8]\n assert (candidate(l1, l2) != [1])\n"], "entry_point": "f_427942", "intent": "\u041d\u0430\u0439\u0442\u0438 \u043e\u0431\u0449\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b `common_items` \u0441\u043f\u0438\u0441\u043a\u0430 `my_list1` \u0438 \u0441\u043f\u0438\u0441\u043a\u0430 `my_list2` ", "library": ["collections"]} {"task_id": 427942, "prompt": "def f_427942(my_list1, my_list2):\n\t", "suffix": "\n\treturn common_items", "canonical_solution": "common_items = list(set(my_list1) & set(my_list2))", "test_start": "\nfrom collections import Counter\n\ndef check(candidate):", "test": ["\n l1 = []\n l2 = []\n assert (candidate(l1, l2) == [])\n", "\n l1 = [1, 2, 3]\n l2 = [4, 5, 6]\n assert (candidate(l1, l2)) == []\n", "\n l1 = [1, 2, 3]\n l2 = [1, 2, 3]\n assert (candidate(l1, l2) == [1, 2, 3])\n", "\n l1 = [1, 2, 3, 4]\n l2 = [3, 4, 5, 6]\n assert (candidate(l1, l2) == [3, 4])\n", "\n l1 = [1, 2, 3, 4]\n l2 = [5, 6, 7, 8]\n assert (candidate(l1, l2) != [1])\n"], "entry_point": "f_427942", "intent": "\u041d\u0430\u0439\u0442\u0438 \u043e\u0431\u0449\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b `common_items` \u0441\u043f\u0438\u0441\u043a\u0430 `my_list1` \u0438 \u0441\u043f\u0438\u0441\u043a\u0430 `my_list2` ", "library": ["collections"]} {"task_id": 414593, "prompt": "def f_414593(file_path):\n\treturn ", "suffix": "", "canonical_solution": "os.path.exists(file_path)", "test_start": "\nimport os\n\ndef check(candidate):", "test": ["\n assert candidate(\"random_script.ipynb\") == False\n", "\n with open('existing_script.sh', 'w') as fw: \n fw.write(\"echo 'hello!'\")\n assert candidate('existing_script.sh') == True\n"], "entry_point": "f_414593", "intent": "\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043b\u0438 \u0444\u0430\u0439\u043b `file_path`", "library": ["os"]} {"task_id": 50064, "prompt": "def f_50064(data, file_path):\n\t", "suffix": "\n\treturn ", "canonical_solution": "\n\twith open(file_path, \"w\") as file:\n\t\tprint(data, file=file)\n", "test_start": "\ndef check(candidate):", "test": ["\n names = ['Jessa', 'Eric', 'Bob']\n file_path = './test_1.txt'\n candidate(names, file_path)\n\n with open(file_path, 'r') as fr:\n lines = fr.readlines()\n assert lines == [\"['Jessa', 'Eric', 'Bob']\\n\"]\n"], "entry_point": "f_50064", "intent": "\u0417\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 `data` \u0432 \u0444\u0430\u0439\u043b `file_path`", "library": []} {"task_id": 50064, "prompt": "def f_50064(data, file_path):\n\t", "suffix": "\n\treturn ", "canonical_solution": "\n\twith open(file_path, mode='a', encoding='utf-8') as f:\n\t\tprint(data, file=f)\n", "test_start": "\ndef check(candidate):", "test": ["\n names = ['Jessa', 'Eric', 'Bob']\n file_path = './test_1.txt'\n candidate(names, file_path)\n\n with open(file_path, 'r') as fr:\n lines = fr.readlines()\n assert lines == [\"['Jessa', 'Eric', 'Bob']\\n\"]\n"], "entry_point": "f_50064", "intent": "\u0417\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 `data` \u0432 \u0444\u0430\u0439\u043b `file_path`", "library": []} {"task_id": 507330, "prompt": "def f_507330(my_dict, val):\n\t", "suffix": "\n\treturn my_key", "canonical_solution": "my_key = None\n\n\tfor k, v in my_dict.items():\n\n\t\tif v == val:\n\n\t\t\tmy_key = k\n\n\t\t\tbreak", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate({1:\"abc\", 5:\"klm\", 2:\"pqr\"}, \"pqr\") == 2\n", "\n assert candidate({1:\"abc\", 5:\"klm\", 2:\"pqr\"}, \"tuv\") == None\n", "\n assert (candidate({4.221:\"uwv\", -1.009:\"pow\"}, \"uwv\") - 4.221 ) < 1e-6\n", "\n assert candidate({\"as2q\":\"piqr\", \"#wwq\":\"say\", \"Rwc\":\"koala\", \"35\":\"kangaroo\"}, \"say\") == \"#wwq\"\n"], "entry_point": "f_507330", "intent": "\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u043b\u044e\u0447 `my_key` \u0438\u0437 \u0441\u043b\u043e\u0432\u0430\u0440\u044f `my_dict` \u043f\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e `val` ", "library": []} {"task_id": 507330, "prompt": "def f_507330(my_dict, val):\n\t", "suffix": "\n\treturn my_key", "canonical_solution": "reversed_dict = dict(zip(my_dict.values(), my_dict.keys()))\n\n\tmy_key = reversed_dict[val]", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate({1:\"abc\", 5:\"klm\", 2:\"pqr\"}, \"pqr\") == 2\n", "\n assert (candidate({4.221:\"uwv\", -1.009:\"pow\"}, \"uwv\") - 4.221 ) < 1e-6\n", "\n assert candidate({\"as2q\":\"piqr\", \"#wwq\":\"say\", \"Rwc\":\"koala\", \"35\":\"kangaroo\"}, \"say\") == \"#wwq\"\n"], "entry_point": "f_507330", "intent": "\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u043b\u044e\u0447 `my_key` \u0438\u0437 \u0441\u043b\u043e\u0432\u0430\u0440\u044f `my_dict` \u043f\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e `val` ", "library": []} {"task_id": 30653, "prompt": "def f_30653(num):\n\treturn ", "suffix": "", "canonical_solution": "num % 2 == 0", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate(0) == True\n", "\n assert candidate(99) == False\n", "\n assert candidate(3) == False\n", "\n assert candidate(4) == True\n"], "entry_point": "f_30653", "intent": "\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0447\u0438\u0441\u043b\u043e 'num' \u043d\u0430 \u0447\u0435\u0442\u043d\u043e\u0441\u0442\u044c", "library": []} {"task_id": 299026, "prompt": "def f_299026(my_list):\n\t", "suffix": "\n\treturn my_list", "canonical_solution": "my_list.reverse()", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate([1, 2, 3]) == [3, 2, 1]\n", "\n assert candidate([1, 2, 3, 4, 5]) == [5, 4, 3, 2, 1]\n", "\n assert candidate([1, 1, 0, 1]) == [1, 0, 1, 1]\n"], "entry_point": "f_299026", "intent": "\u041f\u0435\u0440\u0435\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a `my_list`", "library": []} {"task_id": 299026, "prompt": "def f_299026(my_list):\n\t", "suffix": "\n\treturn my_list", "canonical_solution": "my_list = my_list[::-1]", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate([1, 2, 3]) == [3, 2, 1]\n", "\n assert candidate([1, 2, 3, 4, 5]) == [5, 4, 3, 2, 1]\n", "\n assert candidate([1, 1, 0, 1]) == [1, 0, 1, 1]\n"], "entry_point": "f_299026", "intent": "\u041f\u0435\u0440\u0435\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a `my_list`", "library": []} {"task_id": 299026, "prompt": "def f_299026(my_list):\n\t", "suffix": "\n\treturn my_list", "canonical_solution": "my_list = list(reversed(my_list))", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate([1, 2, 3]) == [3, 2, 1]\n", "\n assert candidate([1, 2, 3, 4, 5]) == [5, 4, 3, 2, 1]\n", "\n assert candidate([1, 1, 0, 1]) == [1, 0, 1, 1]\n"], "entry_point": "f_299026", "intent": "\u041f\u0435\u0440\u0435\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a `my_list`", "library": []} {"task_id": 81572, "prompt": "def f_81572(my_list, item):\n\t", "suffix": "\n\treturn my_list", "canonical_solution": "my_list.remove(item)", "test_start": "\ndef check(candidate):", "test": ["\n data = [1, 4, 5]\n candidate(data, 4)\n assert data == [1, 5]\n", "\n data = [1, 5]\n try:\n candidate(data, 0)\n except:\n assert data == [1, 5]\n"], "entry_point": "f_81572", "intent": "\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 `item` \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 `my_list`", "library": []} {"task_id": 81572, "prompt": "def f_81572(my_list, item):\n\t", "suffix": "\n\treturn my_list", "canonical_solution": "del my_list[my_list.index(item)]", "test_start": "\ndef check(candidate):", "test": ["\n data = [1, 4, 5]\n candidate(data, 4)\n assert data == [1, 5]\n", "\n data = [1, 5]\n try:\n candidate(data, 0)\n except:\n assert data == [1, 5]\n"], "entry_point": "f_81572", "intent": "\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 `item` \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 `my_list`", "library": []} {"task_id": 592812, "prompt": "def f_592812(s, sep):\n\t", "suffix": "\n\treturn s_list", "canonical_solution": "s_list = s.strip().split(sep)", "test_start": "\ndef check(candidate):", "test": ["\n s = \" Jam, sauce, ketchup, penguins \"\n assert candidate(s, ',') == ['Jam', ' sauce', ' ketchup', ' penguins']\n"], "entry_point": "f_592812", "intent": "\u0420\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 `s` \u043d\u0430 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u043e\u0434\u0441\u0442\u0440\u043e\u043a `s_list` \u043f\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044e `sep` ", "library": []} {"task_id": 506457, "prompt": "def f_506457(num):\n\t", "suffix": "\n\treturn digits", "canonical_solution": "digits = [int(i) for i in str(num)]", "test_start": "\ndef check(candidate):", "test": ["\n s = \"5400\"\n assert candidate(s) == [5, 4, 0, 0]\n", "\n s1 = \"b33\"\n try:\n candidate(s1)\n except:\n assert True\n"], "entry_point": "f_506457", "intent": "\u0420\u0430\u0437\u0431\u0438\u0442\u044c \u0447\u0438\u0441\u043b\u043e `num` \u043d\u0430 \u0441\u043f\u0438\u0441\u043e\u043a \u0447\u0438\u0441\u0435\u043b `digits`", "library": []} {"task_id": 597892, "prompt": "def f_597892(file_path):\n\t", "suffix": "\n\treturn lines", "canonical_solution": "with open(file_path) as file:\n\n\t\tlines = [line.rstrip() for line in file.readlines()]", "test_start": "\ndef check(candidate):", "test": ["\n res = ['12', '10', '9', '15', '10', '120']\n with open('./test.txt', 'w') as fw: \n for a in res: \n fw.write(f'{a}\\n')\n assert candidate('./test.txt') == res\n"], "entry_point": "f_597892", "intent": "\u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 `file_path` \u0432 `lines` \u0431\u0435\u0437 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430 \u0441\u0442\u0440\u043e\u043a\u0438", "library": []} {"task_id": 251048, "prompt": "def f_251048(my_list):\n\t", "suffix": "\n\treturn ", "canonical_solution": "for x in my_list:\n \n\t\tprint(x)", "test_start": "\nimport io\nimport sys\n\ndef check(candidate):", "test": ["\n capturedOutput = io.StringIO() \n sys.stdout = capturedOutput \n candidate([1, 2, 3]) \n sys.stdout = sys.__stdout__ \n assert capturedOutput.getvalue() == '1\\n2\\n3\\n'\n"], "entry_point": "f_251048", "intent": "\u0412\u044b\u0432\u0435\u0441\u0442\u0438 \u0441\u043f\u0438\u0441\u043e\u043a `my_list` \u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e", "library": ["io", "sys"]} {"task_id": 251048, "prompt": "def f_251048(my_list):\n\treturn ", "suffix": "", "canonical_solution": "'\\n'.join(my_list)", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate(['a', 'bb', 'vvv']) == 'a\\nbb\\nvvv'\n"], "entry_point": "f_251048", "intent": "\u0412\u044b\u0432\u0435\u0441\u0442\u0438 \u0441\u043f\u0438\u0441\u043e\u043a `my_list` \u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e", "library": []} {"task_id": 251048, "prompt": "def f_251048(my_list):\n\treturn ", "suffix": "", "canonical_solution": "'\\n'.join(list(map(str, my_list)))", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate(['a', 'bb', 'vvv']) == 'a\\nbb\\nvvv'\n", "\n assert candidate([1, 2, 3]) == '1\\n2\\n3'\n"], "entry_point": "f_251048", "intent": "\u0412\u044b\u0432\u0435\u0441\u0442\u0438 \u0441\u043f\u0438\u0441\u043e\u043a `my_list` \u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e", "library": []} {"task_id": 33868, "prompt": "def f_33868(file_path):\n\t", "suffix": "\n\treturn data", "canonical_solution": "f = codecs.open(file_path, \"r\", \"utf_8_sig\" )\n\tdata = f.read()\n\tf.close()", "test_start": "\nimport io\nimport codecs\n\ndef check(candidate):", "test": ["\n with open('test.txt', 'w') as fw:\n fw.write('hello world!')\n assert candidate('test.txt') == 'hello world!'\n"], "entry_point": "f_33868", "intent": "\u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0444\u0430\u0439\u043b `file_path` \u0441 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u043e\u0439 utf-8 \u0432 `data`", "library": ["codecs", "io"]} {"task_id": 33868, "prompt": "def f_33868(file_path):\n\t", "suffix": "\n\treturn data", "canonical_solution": "\n\twith io.open(file_path, encoding='utf-8') as f:\n\t\tdata = f.read()\n", "test_start": "\nimport io\nimport codecs\n\ndef check(candidate):", "test": ["\n with open('test.txt', 'w') as fw:\n fw.write('hello world!')\n assert candidate('test.txt') == 'hello world!'\n"], "entry_point": "f_33868", "intent": "\u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0444\u0430\u0439\u043b `file_path` \u0441 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u043e\u0439 utf-8 \u0432 `data`", "library": ["codecs", "io"]} {"task_id": 248267, "prompt": "def f_248267(s):\n\t", "suffix": "\n\treturn s", "canonical_solution": "s = ' '.join(s.split())", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate(\"x fe a\") == \"x fe a\"\n"], "entry_point": "f_248267", "intent": "\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u043b\u0438\u0448\u043d\u0438\u0435 \u043f\u0440\u043e\u0431\u0435\u043b\u044b \u0438\u0437 \u0441\u0442\u0440\u043e\u043a\u0438 `s`", "library": []} {"task_id": 607802, "prompt": "def f_607802(num, from_base, to_base):\n\t", "suffix": "\n\treturn num", "canonical_solution": "n = int(str(num), from_base)\n\n\talphabet = \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\"\n\n\tnew_num = \"\"\n\n\twhile n > 0:\n\n\t\tn, m = divmod(n, to_base)\n\n\t\tnew_num += alphabet[m]\n\n\tnum = new_num[::-1]", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate('AA16342F', 16, 8) == '25205432057'\n", "\n assert candidate('111', 2, 10) == '7'\n", "\n assert candidate(33, 10, 16) == '21'\n", "\n assert candidate(33333, 10, 20) == '436D'\n", "\n assert candidate(3333333, 10, 20) == '10GD6D'\n"], "entry_point": "f_607802", "intent": "\u041f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438 \u0447\u0438\u0441\u043b\u043e `num` \u0438\u0437 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f `from_base` \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0441\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f `to_base` ", "library": []} {"task_id": 585259, "prompt": "def f_585259(num):\n\treturn ", "suffix": "", "canonical_solution": "isinstance(num, int)", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate(1) == True\n", "\n assert candidate(\"1\") == False\n", "\n assert candidate(123) == True\n", "\n assert candidate([1, 2, 3]) == False\n"], "entry_point": "f_585259", "intent": "\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0447\u0442\u043e \u0447\u0438\u0441\u043b\u043e `num` \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0435", "library": []} {"task_id": 446226, "prompt": "def f_446226(s):\n\t", "suffix": "\n\treturn s", "canonical_solution": "\n\treg = re.compile('[^a-zA-Z ]')\n\ts = reg.sub('', s)\n", "test_start": "\nimport re\n\ndef check(candidate):", "test": ["\n assert candidate('Hello!@#!%!#&&!*!#$#%@*+_{ world!') == 'Hello world'\n"], "entry_point": "f_446226", "intent": "\u041e\u0447\u0438\u0441\u0442\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 `s` \u043e\u0442 \u043b\u0438\u0448\u043d\u0438\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432", "library": ["re"]} {"task_id": 446226, "prompt": "def f_446226(s):\n\t", "suffix": "\n\treturn s", "canonical_solution": "good_chars = (ascii_letters + whitespace).encode()\n\n\tjunk_chars = bytearray(set(range(0x100)) - set(good_chars))\n\n\ts = s.encode('ascii', 'ignore').translate(None, junk_chars).decode()", "test_start": "\nfrom string import ascii_letters, whitespace \n\ndef check(candidate):", "test": ["\n assert candidate('Hello!@#!%!#&&!*!#$#%@*+_{ world!') == 'Hello world'\n"], "entry_point": "f_446226", "intent": "\u041e\u0447\u0438\u0441\u0442\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 `s` \u043e\u0442 \u043b\u0438\u0448\u043d\u0438\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432", "library": ["string"]} {"task_id": 542210, "prompt": "def f_542210(file_path):\n\t", "suffix": "\n\treturn my_list", "canonical_solution": "with open(file_path) as file:\n\n\t\tmy_list = [row.strip() for row in file]", "test_start": "\ndef check(candidate):", "test": ["\n file_path = 'a.txt'\n arr = ['abc', 'def']\n with open(file_path, 'w') as f:\n for i in range (0, len(arr)):\n f.write(arr[i]+'\\n')\n my_list = candidate(file_path)\n for i in range (0, len(arr)):\n assert my_list[i] == arr[i]\n"], "entry_point": "f_542210", "intent": "\u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 `file_path` \u0432 \u0441\u043f\u0438\u0441\u043e\u043a `my_list`", "library": []} {"task_id": 542210, "prompt": "def f_542210(file_path):\n\t", "suffix": "\n\treturn my_list", "canonical_solution": "with open(file_path, 'r') as f:\n\n\t\tmy_list = f.read().splitlines()\n", "test_start": "\ndef check(candidate):", "test": ["\n file_path = 'a.txt'\n arr = ['abc', 'def']\n with open(file_path, 'w') as f:\n for i in range (0, len(arr)):\n f.write(arr[i]+'\\n')\n my_list = candidate(file_path)\n for i in range (0, len(arr)):\n assert my_list[i] == arr[i]\n"], "entry_point": "f_542210", "intent": "\u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 `file_path` \u0432 \u0441\u043f\u0438\u0441\u043e\u043a `my_list`", "library": []} {"task_id": 542210, "prompt": "def f_542210(file_path):\n\t", "suffix": "\n\treturn my_list", "canonical_solution": "\n\twith io.open(file_path, encoding='utf-8') as f:\n\t\tmy_list = f.read().splitlines()\n", "test_start": "\nimport io\n\ndef check(candidate):", "test": ["\n file_path = 'a.txt'\n arr = ['abc', 'def']\n with open(file_path, 'w') as f:\n for i in range (0, len(arr)):\n f.write(arr[i]+'\\n')\n my_list = candidate(file_path)\n for i in range (0, len(arr)):\n assert my_list[i] == arr[i]\n"], "entry_point": "f_542210", "intent": "\u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 `file_path` \u0432 \u0441\u043f\u0438\u0441\u043e\u043a `my_list`", "library": ["io"]} {"task_id": 60925, "prompt": "def f_60925(link, file_path):\n\t", "suffix": "\n\treturn ", "canonical_solution": "with urllib.request.urlopen(link) as url:\n\n\t\tdownloaded_file = url.read()\n\n\t\twith open(file_path, \"wb\") as f:\n\n\t\t\tf.write(downloaded_file)", "test_start": "\nimport urllib \n\ndef check(candidate):", "test": ["\n file_path = 'a.html'\n candidate('https://en.wikipedia.org/wiki/List_of_national_independence_days', file_path)\n with open(file_path, 'r') as f:\n lines = f.readlines()\n for line in lines:\n if 'Wikipedia' in line:\n assert True\n"], "entry_point": "f_60925", "intent": "\u0421\u043a\u0430\u0447\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 `link` \u0432 `file_path`", "library": ["urllib"]} {"task_id": 274131, "prompt": "def f_274131(file_path, word):\n\treturn ", "suffix": "", "canonical_solution": "word in open(file_path,'r').read()", "test_start": "\ndef check(candidate):", "test": ["\n file_path = 'a.txt'\n with open(file_path, 'w') as f:\n f.write(\"abc\\ndef\\nijk\")\n assert candidate(file_path, 'abc') == True\n assert candidate(file_path, 'xyz') == False\n"], "entry_point": "f_274131", "intent": "\u041d\u0430\u0439\u0442\u0438 \u0441\u043b\u043e\u0432\u043e `word` \u0432 \u0444\u0430\u0439\u043b\u0435 `file_path`", "library": []} {"task_id": 505115, "prompt": "def f_505115(s):\n\t", "suffix": "\n\treturn words", "canonical_solution": "words = s.split()\n\twords.sort()", "test_start": "\ndef check(candidate):", "test": ["\n s = \"The quick fox jumped upon a rat\"\n assert candidate(s) == ['The', 'a', 'fox', 'jumped', 'quick', 'rat', 'upon']\n"], "entry_point": "f_505115", "intent": "\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 `s` \u0432 \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043b\u043e\u0432 `words` \u0438 \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c", "library": []} {"task_id": 565252, "prompt": "def f_565252(char_code):\n\t", "suffix": "\n\treturn my_symbol", "canonical_solution": "my_symbol = chr(char_code)", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate(65) == 'A'\n", "\n assert candidate(67) == 'C'\n"], "entry_point": "f_565252", "intent": "\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b `my_symbol` \u043f\u043e \u0435\u0433\u043e \u043a\u043e\u0434\u0443 `char_code` ", "library": []} {"task_id": 509576, "prompt": "def f_509576(file_path):\n\t", "suffix": "\n\treturn f", "canonical_solution": "with open(file_path, mode='a', encoding='utf-8') as f:\n\n\t\tpass", "test_start": "\ndef check(candidate):", "test": ["\n assert str(type(candidate('a.txt'))) == \"\"\n"], "entry_point": "f_509576", "intent": "\u041e\u0442\u043a\u0440\u044b\u0442\u044c \u0444\u0430\u0439\u043b `file_path` \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0441 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u043e\u0439 utf-8 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e f", "library": []} {"task_id": 509576, "prompt": "def f_509576(file_path):\n\t", "suffix": "\n\treturn f", "canonical_solution": "f = open(file_path,'a', encoding='utf-8')", "test_start": "\ndef check(candidate):", "test": ["\n file_path = 'a.txt'\n f = candidate(file_path)\n f.write('abc')\n f.close()\n with open (file_path, 'r') as f1:\n lines = f1.readlines()\n assert lines[0] == 'abc'\n"], "entry_point": "f_509576", "intent": "\u041e\u0442\u043a\u0440\u044b\u0442\u044c \u0444\u0430\u0439\u043b `file_path` \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0441 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u043e\u0439 utf-8 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e f", "library": []} {"task_id": 42621, "prompt": "def f_42621(my_path):\n\t", "suffix": "\n\treturn ", "canonical_solution": "sys.path.append(my_path)\n\t", "test_start": "\nimport sys\n\ndef check(candidate):", "test": ["\n path = '/home/User/Desktop123/file.txt'\n candidate(path)\n assert path in sys.path\n"], "entry_point": "f_42621", "intent": "\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0443\u0442\u044c `my_path` \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043c\u043e\u0434\u0443\u043b\u0435\u0439", "library": ["sys"]} {"task_id": 615741, "prompt": "def f_615741(word, s):\n\treturn ", "suffix": "", "canonical_solution": "re.search(r\"\\b{}\\b\".format(word), s)", "test_start": "\nimport re\n\ndef check(candidate):", "test": ["\n s = \"hi my name is sarah and i am 5\"\n assert candidate('sarah', s) is not None\n", "\n s = \"hi my name is sarah and i am 5\"\n assert candidate('hello', s) is None\n", "\n s = \"hi my name is sarah and i am 5\"\n assert candidate(5, s) is not None\n", "\n s = \"hi my name is sarah and i am 5\"\n assert candidate('5', s) is not None\n"], "entry_point": "f_615741", "intent": "\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0435\u0441\u0442\u044c \u043b\u0438 \u0441\u043b\u043e\u0432\u043e `word` \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 `s`", "library": ["re"]} {"task_id": 615741, "prompt": "def f_615741(word, s):\n\treturn ", "suffix": "", "canonical_solution": "word in s.split()", "test_start": "\nimport re\n\ndef check(candidate):", "test": ["\n s = \"hi my name is sarah and i am 5\"\n assert candidate('sarah', s) == True\n", "\n s = \"hi my name is sarah and i am 5\"\n assert candidate('hello', s) == False\n", "\n s = \"hi my name is sarah and i am 5\"\n assert candidate(5, s) == False\n", "\n s = \"hi my name is sarah and i am 5\"\n assert candidate('5', s) == True\n"], "entry_point": "f_615741", "intent": "\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0435\u0441\u0442\u044c \u043b\u0438 \u0441\u043b\u043e\u0432\u043e `word` \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 `s`", "library": ["re"]} {"task_id": 500957, "prompt": "def f_500957(matrix):\n\t", "suffix": "\n\treturn new_matrix", "canonical_solution": "new_matrix = matrix.transpose()", "test_start": "\nimport numpy as np\n\ndef check(candidate):", "test": ["\n a = np.array([[0, 1, 2], [4, 5, 6]])\n resA = np.array([[0, 4], [1, 5], [2, 6]])\n assert np.array_equal(candidate(a), resA)\n", "\n b = np.array([['a', 'b', 'c'], ['d', 'e', 'f']])\n resB = np.array([['a', 'd'], ['b', 'e'], ['c', 'f']])\n assert np.array_equal(candidate(b), resB)\n"], "entry_point": "f_500957", "intent": "\u0422\u0440\u0430\u043d\u0441\u043f\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u0442\u0440\u0438\u0446\u0443 `matrix` \u0432 \u043c\u0430\u0442\u0440\u0438\u0446\u0443 `new_matrix`", "library": ["numpy"]} {"task_id": 500957, "prompt": "def f_500957(matrix):\n\t", "suffix": "\n\treturn new_matrix", "canonical_solution": "new_matrix = matrix.T", "test_start": "\nimport numpy as np\n\ndef check(candidate):", "test": ["\n a = np.array([[0, 1, 2], [4, 5, 6]])\n resA = np.array([[0, 4], [1, 5], [2, 6]])\n assert np.array_equal(candidate(a), resA)\n", "\n b = np.array([['a', 'b', 'c'], ['d', 'e', 'f']])\n resB = np.array([['a', 'd'], ['b', 'e'], ['c', 'f']])\n assert np.array_equal(candidate(b), resB)\n"], "entry_point": "f_500957", "intent": "\u0422\u0440\u0430\u043d\u0441\u043f\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u0442\u0440\u0438\u0446\u0443 `matrix` \u0432 \u043c\u0430\u0442\u0440\u0438\u0446\u0443 `new_matrix`", "library": ["numpy"]} {"task_id": 500957, "prompt": "def f_500957(matrix):\n\t", "suffix": "\n\treturn new_matrix", "canonical_solution": "new_matrix = []\n\n\tfor i in range(len(matrix[0])):\n\n\t\tnew_matrix.append(list())\n\n\t\tfor j in range(len(matrix)):\n\n\t\t\tnew_matrix[i].append(matrix[j][i])\n", "test_start": "\nimport numpy as np\n\ndef check(candidate):", "test": ["\n a = np.array([[0, 1, 2], [4, 5, 6]])\n resA = np.array([[0, 4], [1, 5], [2, 6]])\n assert np.array_equal(candidate(a), resA)\n", "\n b = np.array([['a', 'b', 'c'], ['d', 'e', 'f']])\n resB = np.array([['a', 'd'], ['b', 'e'], ['c', 'f']])\n assert np.array_equal(candidate(b), resB)\n"], "entry_point": "f_500957", "intent": "\u0422\u0440\u0430\u043d\u0441\u043f\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u0442\u0440\u0438\u0446\u0443 `matrix` \u0432 \u043c\u0430\u0442\u0440\u0438\u0446\u0443 `new_matrix`", "library": ["numpy"]} {"task_id": 786730, "prompt": "def f_786730(df, cond):\n\t", "suffix": "\n\treturn df", "canonical_solution": "df = df.loc[cond]", "test_start": "\nimport pandas as pd\n\ndef check(candidate):", "test": ["\n data = [['abc', 50], ['def', 70], ['hij', 67]]\n df = pd.DataFrame(data, index = ['a', 'b', 'c'])\n assert candidate(df, 'c').to_dict() == {0: 'hij', 1: 67}\n"], "entry_point": "f_786730", "intent": "\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0438\u0437 \u0434\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u043c\u0430 `df` \u0441\u0442\u0440\u043e\u043a\u0438 \u043f\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u044e `cond`", "library": ["pandas"]} {"task_id": 528474, "prompt": "def f_528474(my_dict):\n\treturn ", "suffix": "", "canonical_solution": "OrderedDict(sorted(my_dict.items(), key=lambda t: t[0]))", "test_start": "\nfrom collections import OrderedDict\n\ndef check(candidate):", "test": ["\n my_dict = {6 : \"abc\", 5 : \"def\", 1: \"hij\", 2 : \"klm\"}\n k = OrderedDict([(1, 'hij'), (2, 'klm'), (5, 'def'), (6, 'abc')])\n assert candidate(my_dict) == k\n"], "entry_point": "f_528474", "intent": "\u041e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u043e\u0432\u0430\u0440\u044c `my_dict` \u043f\u043e \u043a\u043b\u044e\u0447\u0430\u043c \u043f\u043e \u0432\u043e\u0437\u0440\u043e\u0441\u0442\u0430\u043d\u0438\u044e", "library": ["collections"]} {"task_id": 229015, "prompt": "def f_229015():\n\t", "suffix": "\n\treturn ", "canonical_solution": "## -*- coding: utf-8 -*-", "test_start": "\ndef check(candidate):", "test": ["\n candidate()\n s = \"\u041f\u0440\u0438\u0432\u0435\u0442\"\n assert s == \"\u041f\u0440\u0438\u0432\u0435\u0442\"\n"], "entry_point": "f_229015", "intent": "\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0443 utf-8 \u0434\u043b\u044f \u0444\u0430\u0439\u043b\u0430", "library": []} {"task_id": 517085, "prompt": "def f_517085(file_path):\n\t", "suffix": "\n\treturn f", "canonical_solution": "with open(file_path, mode='a', encoding='utf-8') as f:\n\n\t\tpass", "test_start": "\ndef check(candidate):", "test": ["\n file_path = 'opera.txt'\n f = candidate(file_path)\n assert f.name == file_path\n assert f.encoding == 'utf-8'\n"], "entry_point": "f_517085", "intent": "\u041e\u0442\u043a\u0440\u044b\u0442\u044c \u0444\u0430\u0439\u043b `file_path` \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0441 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u043e\u0439 utf-8 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e f", "library": []} {"task_id": 517085, "prompt": "def f_517085(file_path):\n\t", "suffix": "\n\treturn f", "canonical_solution": "f = open(file_path,'a', encoding='utf-8')", "test_start": "\ndef check(candidate):", "test": ["\n file_path = 'opera.txt'\n f = candidate(file_path)\n assert f.name == file_path\n assert f.encoding == 'utf-8'\n"], "entry_point": "f_517085", "intent": "\u041e\u0442\u043a\u0440\u044b\u0442\u044c \u0444\u0430\u0439\u043b `file_path` \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0441 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u043e\u0439 utf-8 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e f", "library": []} {"task_id": 690089, "prompt": "def f_690089(url, data):\n\treturn ", "suffix": "", "canonical_solution": "requests.post(url, json=data)", "test_start": "\nimport requests\n\ndef check(candidate):", "test": ["\n data_dict = {'name': 'dev', 'role': 'leader'}\n res = candidate('https://reqres.in/api/users', data_dict)\n assert res.url == 'https://reqres.in/api/users'\n for k, v in data_dict.items():\n assert res.json()[k] == v\n"], "entry_point": "f_690089", "intent": "\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c POST-\u0437\u0430\u043f\u0440\u043e\u0441 c JSON \u0434\u0430\u043d\u043d\u044b\u043c\u0438 `data` \u043d\u0430 `url`", "library": ["requests"]} {"task_id": 550742, "prompt": "def f_550742(file_path):\n\t", "suffix": "\n\treturn count_lines", "canonical_solution": "count_lines = sum(1 for line in open(file_path, 'r'))", "test_start": "\ndef check(candidate):", "test": ["\n file_path = 'a.txt'\n with open(file_path, mode = 'a') as f:\n f.write('3\\n4\\n5\\n')\n assert candidate(file_path) == 3\n"], "entry_point": "f_550742", "intent": "\u0412\u044b\u0432\u0435\u0441\u0442\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0440\u043e\u043a `count_lines` \u0432 \u0444\u0430\u0439\u043b\u0435 `file_path`", "library": []} {"task_id": 928295, "prompt": "def f_928295(file_path):\n\t", "suffix": "\n\treturn my_list", "canonical_solution": "with open(file_path) as file:\n\n\t\tmy_list = [row.strip() for row in file]", "test_start": "\ndef check(candidate):", "test": ["\n file_path = 'a.txt'\n with open(file_path, mode = 'a') as f:\n f.write('3\\n4\\n5\\n')\n assert candidate(file_path) == ['3', '4', '5']\n"], "entry_point": "f_928295", "intent": "\u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 `file_path` \u0432 \u0441\u043f\u0438\u0441\u043e\u043a `my_list`", "library": []} {"task_id": 928295, "prompt": "def f_928295(file_path):\n\t", "suffix": "\n\treturn my_list", "canonical_solution": "with open(file_path, 'r') as f:\n\n\t\tmy_list = f.read().splitlines()\n", "test_start": "\ndef check(candidate):", "test": ["\n file_path = 'a.txt'\n with open(file_path, mode = 'a') as f:\n f.write('3\\n4\\n5\\n')\n assert candidate(file_path) == ['3', '4', '5']\n"], "entry_point": "f_928295", "intent": "\u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 `file_path` \u0432 \u0441\u043f\u0438\u0441\u043e\u043a `my_list`", "library": []} {"task_id": 928295, "prompt": "def f_928295(file_path):\n\t", "suffix": "\n\treturn my_list", "canonical_solution": "\n\twith io.open(file_path, encoding='utf-8') as f:\n\t\tmy_list = f.read().splitlines()\n", "test_start": "\nimport io\n\ndef check(candidate):", "test": ["\n file_path = 'a.txt'\n with open(file_path, mode = 'a') as f:\n f.write('3\\n4\\n5\\n')\n assert candidate(file_path) == ['3', '4', '5']\n"], "entry_point": "f_928295", "intent": "\u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 `file_path` \u0432 \u0441\u043f\u0438\u0441\u043e\u043a `my_list`", "library": ["io"]} {"task_id": 255207, "prompt": "def f_255207():\n\t", "suffix": "\n\treturn ", "canonical_solution": "## -*- coding: utf-8 -*-", "test_start": "\ndef check(candidate):", "test": ["\n candidate()\n s = \"\u041f\u0440\u0438\u0432\u0435\u0442\"\n assert s == \"\u041f\u0440\u0438\u0432\u0435\u0442\"\n"], "entry_point": "f_255207", "intent": "\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0443 utf-8 \u0434\u043b\u044f \u0444\u0430\u0439\u043b\u0430", "library": []} {"task_id": 777723, "prompt": "def f_777723(s, sub_s):\n\treturn ", "suffix": "", "canonical_solution": "s.replace(sub_s, \"\")\n\t", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate(\"1;2;3;4;5\", \";\") == \"12345\"\n", "\n assert candidate(\"1 2 3 4 5\", \" \") == \"12345\"\n"], "entry_point": "f_777723", "intent": "\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u043f\u043e\u0434\u0441\u0442\u0440\u043e\u043a\u0443 `sub_s` \u0438\u0437 \u0441\u0442\u0440\u043e\u043a\u0438 `s`", "library": []} {"task_id": 422461, "prompt": "def f_422461(my_list):\n\t", "suffix": "\n\treturn my_list", "canonical_solution": "my_list = [value for value in my_list if value]\n\t", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate([1, 2, 0, 3, 4, 5]) == [1, 2, 3, 4, 5]\n", "\n assert candidate(['1', '2', '', '3', '4', '5']) == ['1', '2', '3', '4', '5']\n"], "entry_point": "f_422461", "intent": "\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 `my_list`", "library": []} {"task_id": 422461, "prompt": "def f_422461(my_list):\n\t", "suffix": "\n\treturn my_list", "canonical_solution": "my_list = [value for value in my_list if value != [None]]\n\t", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate([1, 2, [None], 3, 4, 5]) == [1, 2, 3, 4, 5]\n"], "entry_point": "f_422461", "intent": "\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 `my_list`", "library": []} {"task_id": 533108, "prompt": "def f_533108(my_list):\n\t", "suffix": "\n\treturn list_value_counts", "canonical_solution": "list_value_counts = Counter(my_list)", "test_start": "\nfrom collections import Counter\n\ndef check(candidate):", "test": ["\n my_list = [10, 10, 23, 10, 123, 66, 78, 123] \n list_value_counts = {10: 3, 23: 1, 123: 2, 66: 1, 78: 1}\n\n assert candidate(my_list) == list_value_counts\n"], "entry_point": "f_533108", "intent": "\u041f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 `my_list` \u0432 `list_value_counts`", "library": ["collections"]} {"task_id": 533108, "prompt": "def f_533108(my_list):\n\t", "suffix": "\n\treturn list_value_counts", "canonical_solution": "list_value_counts = {i: my_list.count(i) for i in my_list}", "test_start": "\ndef check(candidate):", "test": ["\n my_list = [10, 10, 23, 10, 123, 66, 78, 123] \n list_value_counts = {10: 3, 23: 1, 123: 2, 66: 1, 78: 1}\n\n assert candidate(my_list) == list_value_counts\n"], "entry_point": "f_533108", "intent": "\u041f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 `my_list` \u0432 `list_value_counts`", "library": []} {"task_id": 594690, "prompt": "def f_594690(s, shift):\n\t", "suffix": "\n\treturn new_s", "canonical_solution": "alpha = ' abcdefghijklmnopqrstuvwxyz'\n\n\tnew_s = ''\n\n\tfor c in s:\n\n\t\tnew_s += alpha[(alpha.index(c) + shift) % len(alpha)]\n\t", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate('hello', 3) == 'khoor'\n", "\n assert candidate('world', 3) == 'zruog'\n"], "entry_point": "f_594690", "intent": "\u0417\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 `s` \u0432 \u0441\u0442\u0440\u043e\u043a\u0443 `new_s` \u0448\u0438\u0444\u0440\u043e\u043c \u0426\u0435\u0437\u0430\u0440\u044f \u0441\u043e \u0441\u0434\u0432\u0438\u0433\u043e\u043c `shift`", "library": []} {"task_id": 424441, "prompt": "def f_424441(s):\n\treturn ", "suffix": "", "canonical_solution": "s == s[::-1]", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate('racecar') == True\n", "\n assert candidate('world') == False\n"], "entry_point": "f_424441", "intent": "\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u0441\u0442\u0440\u043e\u043a\u0430 `s` \u043f\u0430\u043b\u0438\u043d\u0434\u0440\u043e\u043c\u043e\u043c", "library": []} {"task_id": 424441, "prompt": "def f_424441(s):\n\treturn ", "suffix": "", "canonical_solution": "s ==''.join([c for c in reversed(s)])", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate('racecar') == True\n", "\n assert candidate('world') == False\n"], "entry_point": "f_424441", "intent": "\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u0441\u0442\u0440\u043e\u043a\u0430 `s` \u043f\u0430\u043b\u0438\u043d\u0434\u0440\u043e\u043c\u043e\u043c", "library": []} {"task_id": 630116, "prompt": "def f_630116(my_f, x):\n\t", "suffix": "\n\treturn d", "canonical_solution": "d = derivative(my_f, x)", "test_start": "\nfrom scipy.misc import derivative\n\ndef check(candidate):", "test": ["\n def f(x):\n return x**3 + x**2\n \n assert candidate(f, 1.0) == 6.0\n"], "entry_point": "f_630116", "intent": "\u041d\u0430\u0439\u0442\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u0443\u044e `d` \u0444\u0443\u043d\u043a\u0446\u0438\u0438 `my_f`\u0432 \u0442\u043e\u0447\u043a\u0435 `x`", "library": ["scipy"]} {"task_id": 577060, "prompt": "def f_577060(s, n, new_char):\n\t", "suffix": "\n\treturn s", "canonical_solution": "s = s[:n] + new_char + s[n+1:]", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate(\"Hello, world!\", 0, \"y\") == \"yello, world!\"\n"], "entry_point": "f_577060", "intent": "\u0417\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c `n` \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 `s` \u043d\u0430 `new_char`", "library": []} {"task_id": 458373, "prompt": "def f_458373(s):\n\t", "suffix": "\n\treturn chars", "canonical_solution": "chars = list(s)", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate(\"Hello!\") == [\"H\", \"e\", \"l\", \"l\", \"o\", \"!\"] \n"], "entry_point": "f_458373", "intent": "\u0420\u0430\u0437\u0431\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 `s` \u043d\u0430 \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 `chars`", "library": []} {"task_id": 458373, "prompt": "def f_458373(s):\n\t", "suffix": "\n\treturn chars", "canonical_solution": "chars = [c for c in s]", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate(\"Hello!\") == [\"H\", \"e\", \"l\", \"l\", \"o\", \"!\"] \n"], "entry_point": "f_458373", "intent": "\u0420\u0430\u0437\u0431\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 `s` \u043d\u0430 \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 `chars`", "library": []} {"task_id": 879670, "prompt": "def f_879670(s, i):\n\t", "suffix": "\n\treturn s", "canonical_solution": "s = s[:i] + s[i+1:]", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate(\"Hello!\", 0) == \"ello!\"\n", "\n assert candidate(\"Hello!\", 2) == \"Helo!\"\n"], "entry_point": "f_879670", "intent": "\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c `i` \u0438\u0437 \u0441\u0442\u0440\u043e\u043a\u0438 `s`", "library": []} {"task_id": 119418, "prompt": "def f_119418(dicts):\n\t", "suffix": "\n\treturn common_dict", "canonical_solution": "\n\tcommon_dict = {}\n\tfor cur_dict in dicts:\n\t\tfor key in cur_dict:\n\t\t\tif key not in common_dict:\n\t\t\t\tcommon_dict[key] = [cur_dict[key]]\n\t\t\t\tcontinue\n\t\t\tcommon_dict[key] += [cur_dict[key]]\n", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate([{\"key1\": \"value1\"}, {\"key2\":\"value2\"}, {\"key1\":\"value3\", \"key3\": \"value4\"}]) == {'key1': ['value1', 'value3'], 'key2': ['value2'], 'key3': ['value4']}\n"], "entry_point": "f_119418", "intent": "\u041e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043b\u043e\u0432\u0430\u0440\u0435\u0439 `dicts` \u0441 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c\u0438 \u043a\u043b\u044e\u0447\u0430\u043c\u0438 \u0432 \u043e\u0431\u0449\u0438\u0439 \u0441\u043b\u043e\u0432\u0430\u0440\u044c `common_dict`", "library": []} {"task_id": 60790, "prompt": "def f_60790(filepath):\n\t", "suffix": "\n\treturn lib", "canonical_solution": "lib = CDLL(filepath)", "test_start": "\nfrom ctypes import CDLL\n\ndef check(candidate):", "test": ["\n assert candidate(\"libc.so.6\")._name == \"libc.so.6\"\n"], "entry_point": "f_60790", "intent": "\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c dll \u0444\u0430\u0439\u043b `filepath` \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e `lib`", "library": ["ctypes"]} {"task_id": 299217, "prompt": "def f_299217(url):\n\t", "suffix": "\n\treturn cookies", "canonical_solution": "\n\tsession = requests.Session()\n\tresponse = session.get(url)\n\tcookies = session.cookies.get_dict()\n", "test_start": "\nimport requests\nfrom datetime import date\n\ndef check(candidate):", "test": ["\n today = date.today().strftime(\"%Y-%m-%d\")\n assert candidate(\"http://google.com\")['1P_JAR'].startswith(today)\n"], "entry_point": "f_299217", "intent": "\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c cookie `cookies` \u0441 \u0441\u0430\u0439\u0442\u0430 `url`", "library": ["datetime", "requests"]} {"task_id": 65166, "prompt": "def f_65166(f):\n\treturn ", "suffix": "", "canonical_solution": " inspect.getargspec(f)", "test_start": "\nimport inspect\n\ndef check(candidate):", "test": ["\n def f(x): return 2*x\n assert candidate(f) == inspect.ArgSpec(args=['x'], varargs=None, keywords=None, defaults=None)\n", "\n def g(x, y=2): return x*y\n assert candidate(g) == inspect.ArgSpec(args=['x', 'y'], varargs=None, keywords=None, defaults=(2,))\n"], "entry_point": "f_65166", "intent": "\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 `f`", "library": ["inspect"]} {"task_id": 206151, "prompt": "def f_206151(cmd):\n\t", "suffix": "\n\treturn result", "canonical_solution": "result = os.popen(cmd, 'r', 1)", "test_start": "\nimport os\nfrom unittest.mock import Mock\n\ndef check(candidate):", "test": ["\n os.popen = Mock(return_value = True)\n assert candidate('python3') == True\n"], "entry_point": "f_206151", "intent": "\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u0442\u043e\u043a \u0432\u044b\u0432\u043e\u0434\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b `cmd` \u0432 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 `result`", "library": ["os"]} {"task_id": 118927, "prompt": "def f_118927(my_tuple):\n\treturn ", "suffix": "", "canonical_solution": "list(my_tuple)", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate((1, 2, 3)) == [1, 2, 3]\n", "\n assert candidate((1, \"222\", 3)) == [1, \"222\", 3]\n"], "entry_point": "f_118927", "intent": "\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0440\u0442\u0435\u0436 `my_tuple` \u0432 \u0441\u043f\u0438\u0441\u043e\u043a", "library": []} {"task_id": 175425, "prompt": "def f_175425(username, my_encode):\n\treturn ", "suffix": "", "canonical_solution": "os.environ(username).decode(my_encode)", "test_start": "\nimport os\nfrom unittest.mock import Mock\n\ndef check(candidate):", "test": ["\n os.environ = Mock(return_value = b'abc')\n assert candidate('username', 'utf-8') == 'abc'\n"], "entry_point": "f_175425", "intent": "\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0443 `my_encode` \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f `username`", "library": ["os"]} {"task_id": 141157, "prompt": "def f_141157(my_func):\n\t", "suffix": "\n\treturn my_var", "canonical_solution": "my_var = my_func()", "test_start": "\ndef check(candidate):", "test": ["\n def my_func(): return -1\n assert candidate(my_func) == -1\n"], "entry_point": "f_141157", "intent": "\u041f\u0440\u0438\u0441\u0432\u043e\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 `my_var` \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0438 `my_func`", "library": []} {"task_id": 209059, "prompt": "def f_209059(my_symbol, my_string):\n\treturn ", "suffix": "", "canonical_solution": "re.sub(' +', my_symbol, my_string)", "test_start": "\nimport re \n\ndef check(candidate):", "test": ["\n assert candidate('?','abc def jkl') == 'abc?def?jkl'\n"], "entry_point": "f_209059", "intent": "\u0417\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u0435\u043b\u044b \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 `my_string` \u043d\u0430 \u0441\u0438\u043c\u0432\u043e\u043b `my_symbol`", "library": ["re"]} {"task_id": 256777, "prompt": "def f_256777(old_words, new_words, s):\n\t", "suffix": "\n\treturn s", "canonical_solution": "\n\twords = dict(zip(old_words, new_words))\n\tfor word in words:\n\t\ts = re.sub(r\"{}\".format(word), words[word], s)\n", "test_start": "\nimport re \n\ndef check(candidate):", "test": ["\n s = 'I do not love you anymore. I hate you and shall never pardon for this crime.'\n o = ['love', 'hate', 'pardon']\n n = ['like', 'detest', 'forgive']\n assert candidate(o, n, s) == 'I do not like you anymore. I detest you and shall never forgive for this crime.'\n"], "entry_point": "f_256777", "intent": "\u0417\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043b\u043e\u0432 `old_words` \u043d\u0430 \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043b\u043e\u0432 `new_words` \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 `s`", "library": ["re"]} {"task_id": 112581, "prompt": "def f_112581(tree, val):\n\t", "suffix": "\n\treturn node", "canonical_solution": "\n\tdef search(root, key):\n\t\tif root is None or root.val == key:\n\t\t\treturn root\n\t\tif root.val < key:\n\t\t\treturn search(root.right,key)\n\t\treturn search(root.left,key)\n\tnode = search(tree, val)\n", "test_start": "\nclass Node:\n def __init__(self, val):\n self.val = val\n self.left = None\n self.right = None\n\ndef check(candidate):", "test": ["\n root7 = Node(7)\n root3 = Node(3)\n root11 = Node(11)\n root4 = Node(4)\n root7.left = root3\n root7.right = root11\n root3.right = root4\n assert candidate(root7, 4) == root4\n"], "entry_point": "f_112581", "intent": "\u041d\u0430\u0439\u0442\u0438 \u0443\u0437\u0435\u043b `node` \u0440\u0430\u0432\u043d\u044b\u0439 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e `val` \u0432 \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u043c \u0434\u0435\u0440\u0435\u0432\u0435 `tree`", "library": []} {"task_id": 186169, "prompt": "def f_186169(a):\n\t", "suffix": "\n\treturn a", "canonical_solution": "l = len(a)\n\n\tfor k in range(l-1): \n\n\t\tfor i in range(l-1):\n\n\t\t\tif a[i][i] < a[i+1][i+1]:\n\n\t\t\t\ta[i][i],a[i+1][i+1] = a[i+1][i+1],a[i][i]\n", "test_start": "\ndef check(candidate):", "test": ["\n a = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]\n assert(candidate(a) == [[9, 2, 3], [4, 5, 6], [7, 8, 1]])\n", "\n b = [[1, 2, 3], [4, 5, 6]]\n assert(candidate(b) == [[5, 2, 3], [4, 1, 6]])\n"], "entry_point": "f_186169", "intent": "\u041e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043d\u0430 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u0438 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b `a` \u043f\u043e \u0443\u0431\u044b\u0432\u0430\u043d\u0438\u044e", "library": []} {"task_id": 186169, "prompt": "def f_186169(a):\n\t", "suffix": "\n\treturn a", "canonical_solution": "l = len(a)\n\n\titems = [a[i][i] for i in range(l)]\n\n\titems.sort(reverse=True)\n\n\tfor i in range(l):\n\n\t\ta[i][i] = items[i]\n", "test_start": "\ndef check(candidate):", "test": ["\n a = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]\n assert(candidate(a) == [[9, 2, 3], [4, 5, 6], [7, 8, 1]])\n", "\n b = [[1, 2, 3], [4, 5, 6]]\n assert(candidate(b) == [[5, 2, 3], [4, 1, 6]])\n"], "entry_point": "f_186169", "intent": "\u041e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043d\u0430 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u0438 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b `a` \u043f\u043e \u0443\u0431\u044b\u0432\u0430\u043d\u0438\u044e", "library": []} {"task_id": 298270, "prompt": "def f_298270(s):\n\treturn ", "suffix": "", "canonical_solution": "s.encode('unicode_escape')", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate(\"hello\") == b\"hello\"\n"], "entry_point": "f_298270", "intent": "\u042d\u043a\u0440\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0435\u0446\u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 `s`", "library": []} {"task_id": 72284, "prompt": "def f_72284(my_list, f):\n\treturn ", "suffix": "", "canonical_solution": "list(filter(f, my_list))", "test_start": "\ndef check(candidate):", "test": ["\n def f(x): return x > 1\n assert candidate([1, 2, 3], f) == [2, 3]\n", "\n def g(x): return x%5\n assert candidate([1, 2, 3, 5], g) == [1, 2, 3]\n"], "entry_point": "f_72284", "intent": "\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0441\u043f\u0438\u0441\u043a\u0430 `my_list` \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0449\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 `f`", "library": []} {"task_id": 83341, "prompt": "def f_83341(dicts, key):\n\t", "suffix": "\n\treturn dicts", "canonical_solution": "dicts.sort(key=lambda x: x[key])", "test_start": "\ndef check(candidate):", "test": ["\n dicts = [\n {'k1': 234, 'f4': 57e6, 'gp': 0}, \n {'k1': 436, 'f4': 436, 'gp': 45}, \n {'k1': -33234, 'f4': -2.5, 'gp': 0.0}\n ]\n assert candidate(dicts, 'k1') == [\n {'k1': -33234, 'f4': -2.5, 'gp': 0.0}, \n {'k1': 234, 'f4': 57e6, 'gp': 0}, \n {'k1': 436, 'f4': 436, 'gp': 45}, \n ]\n"], "entry_point": "f_83341", "intent": "\u041e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043b\u043e\u0432\u0430\u0440\u0435\u0439 `dicts` \u043f\u043e \u043a\u043b\u044e\u0447\u0443 `key`", "library": []} {"task_id": 30683, "prompt": "def f_30683(filepath):\n\t", "suffix": "\n\treturn lines", "canonical_solution": "with open(filepath) as f:\n\n\t\tlines = f.readlines()[1::2]", "test_start": "\ndef check(candidate):", "test": ["\n filepath = \"odd_lines.txt\"\n with open(filepath, 'w') as fw: \n for idx in range(10): fw.write(f\"{idx}\\n\")\n assert candidate(filepath) == [f\"{idx}\\n\" for idx in range(1,10,2)]\n", "\n filepath = \"odd_lines.txt\"\n with open(filepath, 'w') as fw: \n for idx in range(20): \n if (idx % 2) == 0: fw.write(f\"{idx}\\n\")\n else: fw.write(\"\\n\")\n assert candidate(filepath) == [\"\\n\" for _ in range(10)]\n"], "entry_point": "f_30683", "intent": "\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u043d\u0435\u0447\u0435\u0442\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u043a `lines` \u0444\u0430\u0439\u043b\u0430 `filepath` ", "library": []} {"task_id": 30683, "prompt": "def f_30683(filepath):\n\t", "suffix": "\n\treturn lines", "canonical_solution": "with open(filepath) as file:\n\n\t\tlines = [i.rstrip() for i in itertools.islice(file, 0, None, 2)]", "test_start": "\nimport itertools \n\ndef check(candidate):", "test": ["\n filepath = \"odd_lines.txt\"\n with open(filepath, 'w') as fw: \n for idx in range(10): fw.write(f\"{idx}\\n\")\n assert candidate(filepath) == [f\"{idx}\" for idx in range(0,10,2)]\n", "\n filepath = \"odd_lines.txt\"\n with open(filepath, 'w') as fw: \n for idx in range(20): \n if idx % 2: fw.write(f\"{idx}\\n\")\n else: fw.write(\"\\n\")\n assert candidate(filepath) == [\"\" for _ in range(10)]\n"], "entry_point": "f_30683", "intent": "\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u043d\u0435\u0447\u0435\u0442\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u043a `lines` \u0444\u0430\u0439\u043b\u0430 `filepath` ", "library": ["itertools"]} {"task_id": 241337, "prompt": "def f_241337(s):\n\treturn ", "suffix": "", "canonical_solution": "urllib.parse.quote(s)", "test_start": "\nimport urllib \n\ndef check(candidate):", "test": ["\n s = \"abc def/foo?bar=baz\"\n assert candidate(s) == \"abc%20def/foo%3Fbar%3Dbaz\"\n"], "entry_point": "f_241337", "intent": "\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0438\u0440\u0438\u043b\u043b\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 `s` \u0432 \u0441\u0442\u0440\u043e\u043a\u0443 \u0441\u043f\u0435\u0446\u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0434\u043b\u044f http \u0437\u0430\u043f\u0440\u043e\u0441\u0430 ", "library": ["urllib"]} {"task_id": 241337, "prompt": "def f_241337(s):\n\treturn ", "suffix": "", "canonical_solution": "urllib.parse.quote_plus(s)", "test_start": "\nimport urllib \n\ndef check(candidate):", "test": ["\n s = \"abc def/foo?bar=baz\"\n assert candidate(s) == \"abc+def%2Ffoo%3Fbar%3Dbaz\"\n"], "entry_point": "f_241337", "intent": "\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0438\u0440\u0438\u043b\u043b\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 `s` \u0432 \u0441\u0442\u0440\u043e\u043a\u0443 \u0441\u043f\u0435\u0446\u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0434\u043b\u044f http \u0437\u0430\u043f\u0440\u043e\u0441\u0430 ", "library": ["urllib"]} {"task_id": 64496, "prompt": "def f_64496():\n\t", "suffix": "\n\treturn pub, priv", "canonical_solution": "(pub, priv) = rsa.newkeys(512)", "test_start": "\nimport rsa \n\ndef check(candidate):", "test": ["\n pub, priv = candidate()\n assert pub.__class__ == rsa.key.PublicKey\n assert priv.__class__ == rsa.key.PrivateKey\n"], "entry_point": "f_64496", "intent": "\u0421\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 \u043a\u043b\u044e\u0447 `pub` \u0438 \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u0439 \u043a\u043b\u044e\u0447 `priv` \u0434\u043b\u044f RSA \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f", "library": ["rsa"]} {"task_id": 121512, "prompt": "def f_121512(my_dict, key, my_var):\n\treturn ", "suffix": "", "canonical_solution": "my_dict[key] == my_var", "test_start": "\ndef check(candidate):", "test": ["\n dict1 = {1 : 'abc', 2 : 'def'}\n assert candidate(dict1, 1, 'abc')\n", "\n dict1 = {1 : 'abc', 2 : 'def'}\n assert candidate(dict1, 2, 'abc') == False\n"], "entry_point": "f_121512", "intent": "\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0440\u0430\u0432\u043d\u043e \u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0441\u043b\u043e\u0432\u0430\u0440\u044f `my_dict` \u0441 \u043a\u043b\u044e\u0447\u043e\u043c `key` \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 `my_var`", "library": []} {"task_id": 316065, "prompt": "def f_316065(n):\n\treturn ", "suffix": "", "canonical_solution": "(n & (n-1) == 0) and n != 0", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate(2) == True\n", "\n assert candidate(16) == True\n", "\n assert candidate(40) == False\n"], "entry_point": "f_316065", "intent": "\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u0447\u0438\u0441\u043b\u043e `n` \u0441\u0442\u0435\u043f\u0435\u043d\u044c\u044e 2", "library": []} {"task_id": 205664, "prompt": "def f_205664(url):\n\t", "suffix": "\n\treturn code", "canonical_solution": "with urllib.request.urlopen(url) as res:\n\t code = res.read()", "test_start": "\nimport urllib \n\ndef check(candidate):", "test": ["\n assert 'Wikipedia' in str(candidate('https://www.wikipedia.org'))\n", "\n assert 'Google' in str(candidate('https://www.google.com'))\n"], "entry_point": "f_205664", "intent": "\u0421\u043f\u0430\u0440\u0441\u0438\u0442\u044c HTML-\u043a\u043e\u0434 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b `code` \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 `url`", "library": ["urllib"]} {"task_id": 300767, "prompt": "def f_300767(strings, sep):\n\t", "suffix": "\n\treturn strings_dict", "canonical_solution": "strings_dict = dict([x[0].strip().split(sep) for x in strings])", "test_start": "\ndef check(candidate):", "test": ["\n strings = [[\"Hello=world!\"], [\"Hey=World!\"], [\"hi=world\"]]\n sep = \"=\"\n assert list(candidate(strings, sep).items()) == [(\"Hello\",\"world!\"), (\"Hey\",\"World!\"), (\"hi\",\"world\")]\n", "\n strings = [[\"Hello:1!\"], [\"Hey:2!\"], [\"hi:3\"]]\n sep = \":\"\n assert list(candidate(strings, sep).items()) == [(\"Hello\",\"1!\"), (\"Hey\",\"2!\"), (\"hi\",\"3\")]\n"], "entry_point": "f_300767", "intent": "\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u0442\u0440\u043e\u043a `strings` \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u044c `strings_dict` \u043f\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044e `sep`", "library": []} {"task_id": 127208, "prompt": "def f_127208(filepath):\n\t", "suffix": "\n\treturn res", "canonical_solution": "with open(filepath, 'r') as f:\n\n\t\tlines = [i for i in f.readlines() if not i.startswith('[')]\n\n\t\tp = re.compile('(?P\\S*(?==))\\S*(?P(?<==)\\S*)')\n\n\t\tres = {}\n\n\t\tfor line in lines:\n\n\t\t\tparsed = re.findall(p, line)[0]\n\n\t\t\tres[parsed[0]] = parsed[1]\n", "test_start": "\nimport re \n\ndef check(candidate):", "test": ["\n filepath = \"sample.ini\"\n lines = [\n \"[[config]]\", \"controlPort=8900\", \"idleTimeout=20\", \n \"[[admin]]\", \"login=petrovich\", \"email=petrovich@zavod.ru\", \"password=secret\"\n ]\n with open(filepath, 'w') as fw:\n for line in lines: fw.write(line + '\\n')\n assert candidate(filepath) == {'controlPort': '8900', \n 'idleTimeout': '20',\n 'login': 'petrovich',\n 'email': 'petrovich@zavod.ru',\n 'password': 'secret'}\n", "\n filepath = \"test.ini\"\n lines = [\n \"[[config]]\", \"controlPort=8080\", \"idleTimeout=100\", \n \"[[admin]]\", \"login=admin\", \"email=admin@email.ru\", \"password=secret\"\n ]\n with open(filepath, 'w') as fw:\n for line in lines: fw.write(line + '\\n')\n assert candidate(filepath) == {'controlPort': '8080', \n 'idleTimeout': '100',\n 'login': 'admin',\n 'email': 'admin@email.ru',\n 'password': 'secret'}\n"], "entry_point": "f_127208", "intent": "\u0420\u0430\u0441\u043f\u0430\u0440\u0441\u0438\u0442\u044c ini-\u0444\u0430\u0439\u043b `filepath` \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u044c `res`", "library": ["re"]} {"task_id": 316488, "prompt": "def f_316488(filepath):\n\t", "suffix": "\n\treturn nums", "canonical_solution": "with open(filepath) as f:\n\n\t\tnums = list(map(int, f.read().split()))\n", "test_start": "\ndef check(candidate):", "test": ["\n with open('test.txt', 'w') as fw:\n for s in ['1', '2', '3', '4']:\n fw.write(s + '\\n')\n\n lines = candidate('test.txt')\n assert isinstance(lines, list)\n", "\n with open('test.txt', 'w') as fw:\n for s in ['1', '2', '3', '4']:\n fw.write(s + '\\n')\n\n lines = candidate('test.txt')\n assert lines[0] == 1\n", "\n with open('test.txt', 'w') as fw:\n for s in ['1', '2', '3', '4']:\n fw.write(s + '\\n')\n\n lines = candidate('test.txt')\n assert len(lines) == 4\n"], "entry_point": "f_316488", "intent": "\u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0447\u0438\u0441\u0435\u043b `nums` \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 `filepath`", "library": []} {"task_id": 77855, "prompt": "def f_77855(url, data):\n\t", "suffix": "\n\treturn res", "canonical_solution": "res = requests.post(url, json=data)", "test_start": "\nimport requests\n\ndef check(candidate):", "test": ["\n data = {'key': 'value'}\n url = \"http://ptsv2.com/t/6ju5j-1661859736/post\"\n res = candidate(url, data)\n assert res.url == url\n assert res.text == \"Thank you for this dump. I hope you have a lovely day!\"\n assert res.request.body == b'{\"key\": \"value\"}'\n"], "entry_point": "f_77855", "intent": "\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c POST-\u0437\u0430\u043f\u0440\u043e\u0441 `res` c JSON \u0434\u0430\u043d\u043d\u044b\u043c\u0438 `data` \u043d\u0430 `url`", "library": ["requests"]} {"task_id": 25811, "prompt": "def f_25811(arrs):\n\t", "suffix": "\n\treturn ", "canonical_solution": "for a in arrs:\n\n\t\tprint(a)\n", "test_start": "\nimport sys\nfrom io import StringIO\n\ndef check(candidate):", "test": ["\n stdout = sys.stdout\n s = StringIO()\n sys.stdout = s\n arrs = [[1,2,3], [4,5,6]]\n candidate(arrs)\n sys.stdout = stdout \n s.seek(0)\n assert len(s.read()) == 20\n", "\n stdout = sys.stdout\n s = StringIO()\n sys.stdout = s\n arrs = [[\"H\", \"W\"], [\"A\", \"B\", \"C\"]]\n candidate(arrs)\n sys.stdout = stdout \n s.seek(0)\n assert len(s.read()) == 27\n"], "entry_point": "f_25811", "intent": "\u0412\u044b\u0432\u0435\u0441\u0442\u0438 \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 `arrs` \u043d\u0430 \u044d\u043a\u0440\u0430\u043d", "library": ["io", "sys"]} {"task_id": 25811, "prompt": "def f_25811(arrs):\n\t", "suffix": "\n\treturn ", "canonical_solution": "\n\tfor a in arrs:\n\t\tfor i in a:\n\t\t\tprint(i, end=\" \")\n\tprint()\n", "test_start": "\nimport sys\nfrom io import StringIO\n\ndef check(candidate):", "test": ["\n stdout = sys.stdout\n s = StringIO()\n sys.stdout = s\n arrs = [[1,2,3], [4,5,6]]\n candidate(arrs)\n sys.stdout = stdout \n s.seek(0)\n assert len(s.read()) == 13\n", "\n stdout = sys.stdout\n s = StringIO()\n sys.stdout = s\n arrs = [[\"H\", \"W\"], [\"A\", \"B\", \"C\"]]\n candidate(arrs)\n sys.stdout = stdout \n s.seek(0)\n assert len(s.read()) == 11\n"], "entry_point": "f_25811", "intent": "\u0412\u044b\u0432\u0435\u0441\u0442\u0438 \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 `arrs` \u043d\u0430 \u044d\u043a\u0440\u0430\u043d", "library": ["io", "sys"]} {"task_id": 54032, "prompt": "def f_54032(num_start, num_end):\n\t", "suffix": "\n\treturn num", "canonical_solution": "num = random.randint(num_start, num_end)", "test_start": "\nimport random\n\ndef check(candidate):", "test": ["\n random_res = candidate(10, 20)\n assert random_res >= 10 and random_res <= 20\n", "\n random_res = candidate(15, 30)\n assert random_res >= 15 and random_res <= 30\n"], "entry_point": "f_54032", "intent": "\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u0430 `num` \u0432 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0435 \u043e\u0442 \u0447\u0438\u0441\u043b\u0430 `num_start` \u0434\u043e \u0447\u0438\u0441\u043b\u0430 `num_end`", "library": ["random"]} {"task_id": 71878, "prompt": "def f_71878(l):\n\t", "suffix": "\n\treturn indices, l", "canonical_solution": "x = list(enumerate(l))\n\n\trandom.shuffle(x)\n\n\tindices, l = zip(*x)\n", "test_start": "\nimport random\n\ndef check(candidate):", "test": ["\n l = [1,2,3,4,5]\n indices, res = candidate(l)\n assert set(res) == set(l)\n assert set(indices) == set([0,1,2,3,4])\n", "\n l = [\"a\",\"b\",\"c\",\"d\",\"e\"]\n indices, res = candidate(l)\n assert set(res) == set(l)\n assert set(indices) == set([0,1,2,3,4])\n"], "entry_point": "f_71878", "intent": "\u041f\u0435\u0440\u0435\u043c\u0435\u0448\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a `l` \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b `indices`", "library": ["random"]} {"task_id": 197093, "prompt": "def f_197093(n, total):\n\t", "suffix": "\n\treturn nums", "canonical_solution": "my_total = -1\n\n\twhile my_total != total:\n\n\t\tnums = [random.randint(0,total) for _ in range(n)]\n\n\t\tmy_total = sum(nums)\n", "test_start": "\nimport random \n\ndef check(candidate):", "test": ["\n nums = candidate(2, 10) \n assert len(nums) == 2 and sum(nums) == 10\n", "\n nums = candidate(3, 10) \n assert len(nums) == 3 and sum(nums) == 10\n"], "entry_point": "f_197093", "intent": "\u0421\u0433\u0435\u043d\u0435\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c `n` \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b `nums`, \u0441\u0443\u043c\u043c\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0440\u0430\u0432\u043d\u0430 `total`", "library": ["random"]} {"task_id": 295537, "prompt": "def f_295537(class_name):\n\t", "suffix": "\n\treturn my_obj", "canonical_solution": "my_obj = globals()[class_name]", "test_start": "\nimport random \n\ndef check(candidate):", "test": ["\n class_name = random.sample(globals().keys(), 1)[0]\n assert candidate(class_name).__class__ == globals()[class_name].__class__\n"], "entry_point": "f_295537", "intent": "\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 `my_obj` \u043f\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 `class_name`", "library": ["random"]} {"task_id": 240287, "prompt": "def f_240287(tupels):\n\t", "suffix": "\n\treturn my_dict", "canonical_solution": "my_dict = dict(tupels)", "test_start": "\ndef check(candidate):", "test": ["\n tupels = ((0,0),(1,1),(2,2),(100,99))\n assert candidate(tupels) == {0:0, 1:1, 2:2, 100:99}\n", "\n tupels = ((0,0),(1,1),(2,2),(1,99))\n assert candidate(tupels) == {0:0, 1:99, 2:2}\n", "\n tupels = ((0,0),(1,1),(2,2),(80,None))\n assert candidate(tupels) == {0:0, 1:1, 2:2, 80: None}\n"], "entry_point": "f_240287", "intent": "\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0440\u0442\u0435\u0436 \u043a\u043e\u0440\u0442\u0435\u0436\u0435\u0439 \u043f\u0430\u0440 \u043a\u043b\u044e\u0447-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 `tupels` \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u044c `my_dict`", "library": []} {"task_id": 26594, "prompt": "def f_26594(s):\n\t", "suffix": "\n\treturn url", "canonical_solution": "url = re.findall(r\"\\[url=(.*)\\]\", s)[0]", "test_start": "\nimport re \n\ndef check(candidate):", "test": ["\n s = \"[url=http://forum.sibnet.ru/index.php?showuser=xxxxx]\"\n assert candidate(s) == \"http://forum.sibnet.ru/index.php?showuser=xxxxx\"\n"], "entry_point": "f_26594", "intent": "\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443 `url` \u0438\u0437 BBCode \u0441\u0442\u0440\u043e\u043a\u0438 `s`", "library": ["re"]} {"task_id": 262974, "prompt": "def f_262974(pattern, s, text):\n\treturn ", "suffix": "", "canonical_solution": "re.sub(pattern, r'{}'.format(s), text) ", "test_start": "\nimport re\n\ndef check(candidate):", "test": ["\n text= '\u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \\n \u0421\u043b\u043e\u0432\u043e \u0441\u043b\u043e\u0432\u043e \u0441\u043b\u043e\u0432\u043e \u0441\u043b\u043e\u0432\u043e \u0441\u043b\u043e\u0432\u043e \u0441\u043b\u043e\u0432\u043e \u0441\u043b\u043e\u0432\u043e.'\n res = '\\x01\\n \u0421\u043b\u043e\u0432\u043e \u0441\u043b\u043e\u0432\u043e \u0441\u043b\u043e\u0432\u043e \u0441\u043b\u043e\u0432\u043e \u0441\u043b\u043e\u0432\u043e \u0441\u043b\u043e\u0432\u043e \u0441\u043b\u043e\u0432\u043e.'\n pattern = \"^([\u0410-\u042f]{1}.{,30}\\n)\"\n assert candidate(pattern, '\\1\\n', text) == res\n"], "entry_point": "f_262974", "intent": "\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 `s` \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u0434\u0441\u0442\u0440\u043e\u043a\u0438 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0440\u0435\u0433\u0443\u043b\u0440\u043d\u044b\u043c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c `pattern` \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 `text`", "library": ["re"]} {"task_id": 178993, "prompt": "def f_178993(url):\n\t", "suffix": "\n\treturn code", "canonical_solution": "with urllib.request.urlopen(url) as res:\n\t code = res.read()", "test_start": "\nimport urllib.request\n\ndef check(candidate):", "test": ["\n f = urllib.request.urlopen('http://www.python.org/')\n res = f.read()\n assert candidate('http://www.python.org/') == res\n"], "entry_point": "f_178993", "intent": "\u0421\u043f\u0430\u0440\u0441\u0438\u0442\u044c HTML-\u043a\u043e\u0434 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b `code` \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 `url`", "library": ["urllib"]} {"task_id": 50259, "prompt": "def f_50259(num, f):\n\treturn ", "suffix": "", "canonical_solution": "\"{:.{}f}\".format(num, f)", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate(500, 2) == '500.00'\n\n"], "entry_point": "f_50259", "intent": "\u0412\u044b\u0432\u0435\u0441\u0442\u0438 \u0447\u0438\u0441\u043b\u043e `num` \u0441 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044e \u0434\u043e `f` \u0437\u043d\u0430\u043a\u043e\u0432", "library": []} {"task_id": 27963, "prompt": "def f_27963(a1, a2):\n\t", "suffix": "\n\treturn ", "canonical_solution": "for a in zip(a1, a2):\n\n\t\tprint(*a)\n", "test_start": "\nimport sys\nimport io\n\ndef check(candidate):", "test": ["\n a1 = [1, 2, 3]\n a2 = [4, 5, 6]\n capturedOutput = io.StringIO() \n sys.stdout = capturedOutput \n candidate(a1, a2)\n sys.stdout = sys.__stdout__\n assert capturedOutput.getvalue() == '1 4\\n2 5\\n3 6\\n'\n"], "entry_point": "f_27963", "intent": "\u0412\u044b\u0432\u0435\u0441\u0442\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0441\u043f\u0438\u0441\u043a\u043e\u0432 `a1`\u0438 `a2` \u043f\u043e\u043f\u0430\u0440\u043d\u043e", "library": ["io", "sys"]} {"task_id": 61709, "prompt": "def f_61709(nums, target_num):\n\t", "suffix": "\n\treturn num", "canonical_solution": "delta_nums = [abs(target_num - i) for i in nums]\n\tnum = nums[delta_nums.index(min(delta_nums))]", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate([34, 65, 95, 37, 573], 84) == 95\n"], "entry_point": "f_61709", "intent": "\u041d\u0430\u0439\u0442\u0438 \u0441\u0430\u043c\u043e\u0435 \u0431\u043b\u0438\u0437\u043a\u043e\u0435 \u0447\u0438\u0441\u043b\u043e `n` \u043a \u0447\u0438\u0441\u043b\u0443 `target_num` \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 `nums`", "library": []} {"task_id": 111347, "prompt": "def f_111347(filepath):\n\treturn ", "suffix": "", "canonical_solution": "os.access(filepath, os.R_OK)", "test_start": "\nimport os\nfrom unittest.mock import Mock\n\ndef check(candidate):", "test": ["\n filepath= '/'\n os.access = Mock(return_value = True)\n assert candidate(filepath) == True\n", "\n filepath= '/'\n os.access = Mock(return_value = False)\n assert candidate(filepath) == False\n"], "entry_point": "f_111347", "intent": "\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u044c \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 `filepath`", "library": ["os"]} {"task_id": 37423, "prompt": "def f_37423(html):\n\t", "suffix": "\n\treturn root", "canonical_solution": "root = etree.HTML(html)", "test_start": "\nfrom lxml import etree\n\ndef check(candidate):", "test": ["\n assert etree.tostring(candidate('

data

')) == b'

data

'\n"], "entry_point": "f_37423", "intent": "\u0420\u0430\u0441\u043f\u0430\u0440\u0441\u0438\u0442\u044c html \u0441\u0442\u0440\u043e\u043a\u0443 `html` \u0432 \u0434\u0435\u0440\u0435\u0432\u043e `root`", "library": ["lxml"]} {"task_id": 93346, "prompt": "def f_93346(url):\n\t", "suffix": "\n\treturn Response", "canonical_solution": "\n\twith urllib.request.urlopen(url) as Response:\n\t\tLength = Response.getheader('content-length')\n\t\tBlockSize = 1000000 # default value\n\n\t\tif Length: \n\t\t\tLength = int(Length)\n\t\t\tBlockSize = max(4096, Length // 20)\n\t\tprint(\"UrlLib len, blocksize: \", Length, BlockSize)\n \n\t\tBufferAll = io.BytesIO()\n\t\tSize = 0\n\t\twhile True:\n\t\t\tBufferNow = Response.read(BlockSize)\n\t\t\tif not BufferNow: break\n\t\t\tBufferAll.write(BufferNow)\n\t\t\tSize += len(BufferNow)\n\t\t\tif Length:\n\t\t\t\tPercent = int((Size / Length)*100)\n\t\t\t\tprint('download: {Percent}% {Url}')\n\t\tprint(\"Buffer All len:\", len(BufferAll.getvalue()))\n", "test_start": "\nimport io\nimport urllib \n\ndef check(candidate):", "test": ["\n response = candidate('https://en.wikipedia.org/wiki/Pratap_Singh_(Raja_of_Satara)')\n assert 'Response' in str(type(response))\n"], "entry_point": "f_93346", "intent": "\u0421\u043a\u0430\u0447\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u0441 \u0441\u0430\u0439\u0442\u0430 `url` \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044f \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441\u0431\u0430\u0440", "library": ["io", "urllib"]} {"task_id": 319702, "prompt": "def f_319702(dicts):\n\t", "suffix": "\n\treturn dicts", "canonical_solution": "dicts = [json.dumps(i) for i in dicts]\n\n\tdicts = [json.loads(i) for i in set(dicts)]\n", "test_start": "\nimport json \n\ndef check(candidate):", "test": ["\n dicts = [{'a': 1}, {\"b\": 2}, {\"c\": 3}, {\"b\": 2}, {\"b\": '2'}]\n assert sorted(candidate(dicts), key=lambda x: list(x.keys())[0]) == [{'a': 1}, {'b': 2}, {'b': '2'}, {'c': 3}]\n"], "entry_point": "f_319702", "intent": "\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u0441\u043b\u043e\u0432\u0430\u0440\u0438 \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 \u0441\u043b\u043e\u0432\u0430\u0440\u0435\u0439 `dicts`", "library": ["json"]} {"task_id": 151936, "prompt": "def f_151936(url):\n\t", "suffix": "\n\treturn query", "canonical_solution": "\n\tparsed_url = urlparse(url)\n\tquery = parsed_url.query\n", "test_start": "\nfrom urllib.parse import urlparse\n\ndef check(candidate):", "test": ["\n assert candidate('https://reqres.in/api/users?page=2') == 'page=2'\n"], "entry_point": "f_151936", "intent": "\u0420\u0430\u0441\u043f\u0430\u0440\u0441\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b get \u0437\u0430\u043f\u0440\u043e\u0441\u0430 url `url` \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u044c `query`", "library": ["urllib"]} {"task_id": 306957, "prompt": "def f_306957(filepath, newfilepath):\n\t", "suffix": "\n\treturn ", "canonical_solution": "os.replace(filepath, newfilepath)", "test_start": "\nimport os\nfrom unittest.mock import Mock\n\ndef check(candidate):", "test": ["\n os.replace = Mock()\n try:\n candidate('abc.txt', 'abc.csv')\n assert True\n except:\n assert False\n"], "entry_point": "f_306957", "intent": "\u041f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b `filepath` \u0432 \u0444\u0430\u0439\u043b `newfilepath`", "library": ["os"]} {"task_id": 249773, "prompt": "def f_249773(a):\n\t", "suffix": "\n\treturn nums", "canonical_solution": "\n\tr = range(min(a), max(a) + 1)\n\tnums = sorted(list(set(r) - set(a)))\n", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate([1, 3, 5]) == ([2, 4])\n"], "entry_point": "f_249773", "intent": "\u041d\u0430\u0439\u0442\u0438 \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 `nums` \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 `a`", "library": []} {"task_id": 122711, "prompt": "def f_122711(filepath):\n\treturn ", "suffix": "", "canonical_solution": "subprocess.check_output(['g++', filepath])", "test_start": "\nimport subprocess\nfrom unittest.mock import Mock\n\ndef check(candidate):", "test": ["\n samp_output = '1'\n subprocess.check_output = Mock(return_value = samp_output)\n assert candidate('a.cpp') == samp_output\n"], "entry_point": "f_122711", "intent": "\u0421\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c c++ \u0444\u0430\u0439\u043b `filepath`", "library": ["subprocess"]} {"task_id": 249444, "prompt": "def f_249444(s, base_s):\n\treturn ", "suffix": "", "canonical_solution": "set(s.split()) & set(base_s.split())", "test_start": "\ndef check(candidate):", "test": ["\n s = 'hello hi'\n base_s = 'hello God'\n assert len(candidate(s, base_s)) > 0\n", "\n s = 'hello hi'\n base_s = 'llo God'\n assert len(candidate(s, base_s)) == 0\n"], "entry_point": "f_249444", "intent": "\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043b\u0438 \u0441\u0442\u0440\u043e\u043a\u0430 `s` \u0441\u043b\u043e\u0432\u0430 \u0438\u0437 \u0441\u0442\u0440\u043e\u043a\u0438 `base_s`", "library": []} {"task_id": 210480, "prompt": "def f_210480(filepath):\n\t", "suffix": "\n\treturn line_counts", "canonical_solution": "\n\twith open(filepath) as f:\n\t\tlines = f.readlines()\n\t\tline_counts = collections.Counter(lines)\n", "test_start": "\nimport collections\n\ndef check(candidate):", "test": ["\n lines = ['a\\n', 'b\\n', 'c\\n']\n filepath = 'a.txt'\n with open (filepath, 'a') as f:\n for line in lines:\n f.write(line)\n \n line_counts = candidate(filepath)\n for i in range (0, len(lines)):\n assert line_counts[lines[0]] == 1\n"], "entry_point": "f_210480", "intent": "\u041f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u0444\u0430\u0439\u043b\u0435 `filepath` \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u044c line_counts", "library": ["collections"]} {"task_id": 51160, "prompt": "def f_51160(f, n):\n\treturn ", "suffix": "", "canonical_solution": "sympy.integrate(f, (sympy.symbols('x'), n, sympy.oo))", "test_start": "\nimport sympy\n\ndef check(candidate):", "test": ["\n x = sympy.symbols('x')\n f = ( x * x)\n n = 1\n assert str(candidate(f, n)) == 'oo'\n"], "entry_point": "f_51160", "intent": "\u041f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043d\u0435\u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u043b \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 `f` \u043e\u0442 \u0447\u0438\u0441\u043b\u0430 `n` \u0434\u043e \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0441\u0442\u0438", "library": ["sympy"]} {"task_id": 560, "prompt": "def f_560(dict1, dict2):\n\t", "suffix": "\n\treturn ", "canonical_solution": "for key in dict2:\n\n\t\tif key in dict1:\n\n\t\t\tdel dict1[key]\n", "test_start": "\ndef check(candidate):", "test": ["\n x = {'a': 1, 'b': 2}\n y = {'b': 1, 'c': 2}\n candidate(x, y)\n assert x == {'a': 1}\n"], "entry_point": "f_560", "intent": "\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0438\u0437 \u0441\u043b\u043e\u0432\u0430\u0440\u044f `dict1` \u043a\u043b\u044e\u0447\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0435\u0441\u0442\u044c \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u0435 `dict2`", "library": []} {"task_id": 18892, "prompt": "def f_18892(filepath):\n\treturn ", "suffix": "", "canonical_solution": "open(filepath,\"w\", encoding=\"utf-8\")", "test_start": "\ndef check(candidate):", "test": ["\n f = candidate(\"tmp.txt\")\n assert f.encoding == \"utf-8\"\n assert f.name == \"tmp.txt\"\n", "\n f = candidate(\"sample_100.pkl\")\n assert f.encoding == \"utf-8\"\n assert f.name == \"sample_100.pkl\"\n"], "entry_point": "f_18892", "intent": "\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0430\u0439\u043b `filepath` \u0441 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u043e\u0439 utf-8", "library": []} {"task_id": 242841, "prompt": "def f_242841(obj, name):\n\treturn ", "suffix": "", "canonical_solution": "getattr(obj, name)()", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate(\"hello\", \"encode\") == b'hello'\n", "\n assert candidate(100, \"conjugate\") == 100\n", "\n assert candidate([1,2,3], \"sort\") is None\n"], "entry_point": "f_242841", "intent": "\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043c\u0435\u0442\u043e\u0434 c \u0438\u043c\u0435\u043d\u0435\u043c `name` \u043e\u0431\u044a\u0435\u043a\u0442\u0430 `obj`", "library": []} {"task_id": 265219, "prompt": "def f_265219(s, old_data, new_data):\n\t", "suffix": "\n\treturn s", "canonical_solution": "\n\tword_dict = dict(zip(old_data, new_data))\n\tfor word in word_dict:\n\t\ts = re.sub(r\"\\b{}\\b\".format(word), word_dict[word], s)\n", "test_start": "\nimport re\n\ndef check(candidate):", "test": ["\n assert candidate(\"hello, world!\", [\"happy\", \"green\"], [\"angry\", \"yellow\"]) == \"hello, world!\"\n", "\n assert candidate(\"hello, green!\", [\"happy\", \"green\"], [\"angry\", \"yellow\"]) == \"hello, yellow!\"\n", "\n assert candidate(\"happy, yellow!\", [\"happy\", \"green\"], [\"angry\", \"yellow\"]) == \"angry, yellow!\"\n"], "entry_point": "f_265219", "intent": "\u0417\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 `s` \u0441\u043b\u043e\u0432\u0430 \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 `old_words` \u043d\u0430 \u0441\u043b\u043e\u0432\u0430 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 `new_words` ", "library": ["re"]} {"task_id": 14314, "prompt": "def f_14314(url):\n\t", "suffix": "\n\treturn headers", "canonical_solution": "\n\tresponse = urllib.request.urlopen(url)\n\n\theaders = response.headers\n", "test_start": "\nimport urllib\n\ndef check(candidate):", "test": ["\n assert str(candidate(\"https://www.google.com\").__class__) == \"\"\n"], "entry_point": "f_14314", "intent": "\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 `headers` \u0441 \u0441\u0430\u0439\u0442\u0430 `url`", "library": ["urllib"]} {"task_id": 25915, "prompt": "def f_25915(s):\n\treturn ", "suffix": "", "canonical_solution": "s.encode('unicode_escape')", "test_start": "\ndef check(candidate):", "test": ["\n assert candidate(\"hello, world!\") == b'hello, world!'\n", "\n assert candidate(\"\") == b''\n"], "entry_point": "f_25915", "intent": "\u042d\u043a\u0440\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0435\u0446\u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 `s`", "library": []} {"task_id": 76183, "prompt": "def f_76183(sign, s):\n\t", "suffix": "\n\treturn l", "canonical_solution": "p = 1 << (len(s)-1)\n\tl = []\n\tfor i in range(1, p):\n\t\tdef rf(first, sec):\n\t\t\tc = first[0]\n\t\t\ts1 = sec\n\t\t\tif c & i > 0 :\n\t\t\t\ts1 = sign+s1\n\t\t\treturn (c >> 1, first[1]+s1)\n\t\tl.append(functools.reduce(rf, s[1:], (p >> 1, s[0]))[1])", "test_start": "\nimport functools\n\ndef check(candidate):", "test": ["\n assert candidate(\"-\", \"101\") == ['10-1', '1-01', '1-0-1']\n", "\n assert candidate(\".\", \"101\") == ['10.1', '1.01', '1.0.1']\n"], "entry_point": "f_76183", "intent": "\u041f\u0435\u0440\u0435\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u043a\u0430 `sign` \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 `s` \u043a\u0430\u043a \u0432 \u0431\u0438\u0442\u043e\u0432\u043e\u043c \u0447\u0438\u0441\u043b\u0435", "library": ["functools"]}