-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathseed_evol.json
86 lines (86 loc) · 7.68 KB
/
seed_evol.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
[
{
"instruction": "Suggest a completion for the following python code.\nimport json\n\ndef read_task_from_jsonl(data_file):\n '''This function will read a .jsonl file and return the ``task`` fields in all the lines.'''",
"output": "import json\n\ndef read_task_from_jsonl(data_file):\n '''This function will read a .jsonl file and return the ``task`` fields in all the lines.'''\n with open(data_file) as fin:\n return [json.loads(line)['task'] for line in fin]"
},
{
"instruction": "Using the comment as a guide, replace the \"TODO\" comment in the code with the proper code.\ndef greet_to(name):\n \"\"\"Print a greeting to the name provided.\"\"\"\n # TODO: assert name is a string\n print(\"Hello, \" + name + \"!\")",
"output": "def greet_to(name):\n \"\"\"Print a greeting to the name provided.\"\"\"\n # assert name is a string\n assert isinstance(name, str), \"name must be a string\"\n print(\"Hello, \" + name + \"!\")"
},
{
"instruction": "Generate a correct python program to fulfill the following purpose:\nCount the occurrence of an element x in a list y.",
"output": "def count_x(x, y):\n count = 0\n for i in range(y):\n if i == x:\n count += 1\n return count"
},
{
"instruction": "write a code to get the current value of a Bitcoin in US dollars using the bitcoincharts API.",
"output": "\"\"\"\nGet the current value of a Bitcoin in US dollars using the bitcoincharts api\n\"\"\"\n\nimport requests\nimport json\n\ndef get_bitcoin_price():\n url = 'http://api.bitcoincharts.com/v1/weighted_prices.json'\n response = requests.get(url)\n data = json.loads(response.text)\n return data['USD']['24h']\n \nif __name__ == '__main__':\n print(get_bitcoin_price())"
},
{
"instruction": "Write a program to compute the sum of integers from k to n.",
"output": "def sum(k, n):\n sum = 0\n for i in range(k, n+1):\n sum += i\n return sum"
},
{
"instruction": "Write a script in JavaScript for printing the current date and time.",
"output": "var newDate = new Date();\nvar currentDateTime = newDate.toLocaleString();\nconsole.log(currentDateTime);"
},
{
"instruction": "Write Python code to solve this leetcode problem.\nProblem: You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list.\n\nYou may assume the two numbers do not contain any leading zero, except the number 0 itself.",
"output": "class Solution(object):\n def addTwoNumbers(self, l1, l2):\n \"\"\"\n :type l1: ListNode\n :type l2: ListNode\n :rtype: ListNode\n \"\"\"\n carry = 0\n root = n = ListNode(0)\n while l1 or l2 or carry:\n v1 = v2 = 0\n if l1:\n v1 = l1.val\n l1 = l1.next\n if l2:\n v2 = l2.val\n l2 = l2.next\n carry, val = divmod(v1+v2+carry, 10)\n n.next = ListNode(val)\n n = n.next\n return root.next"
},
{
"instruction": "Identify the pos tag of the word in the given sentence.\nWord: excited\nSentence: She felt so excited that her application got approval.",
"output": "Adjective, JJ."
},
{
"instruction": "You need to read a code and detect if there is a syntax error or not. Outpus true if there is error, output false if there is not.\ndef quick_sort(arr):\n if len(arr) < 2:\n return arr\n else:\n pivot = arr[0]\n less = [i for i in arr[1:] if i <= pivot]\n greater = [i for i in arr[1:] if i > pivot]\n return quick_sort(less) + [pivot] + quick_sort(greater)",
"output": "false"
},
{
"instruction": "Write a Python function to find all prime numbers up to the given number n.",
"output": "def is_prime(n):\n if n <= 1:\n return False\n for i in range(2, int(n**0.5) + 1):\n if n % i == 0:\n return False\n return True\n\ndef find_prime_numbers(n):\n primes = []\n for i in range(2, n + 1):\n if is_prime(i):\n primes.append(i)\n return primes"
},
{
"instruction": "Write a simple C# program that prints \"Hello, World!\".",
"output": "using System;\n\nnamespace HelloWorld\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(\"Hello, World!\");\n }\n }\n}"
},
{
"instruction": "Write an SQL query to select all columns from a table named 'employees' where the age is greater than 30.",
"output": "SELECT * FROM employees WHERE age > 30;"
},
{
"instruction": "Write a Python function to check if a given word is a palindrome or not. A palindrome is a word that reads the same backwards as forwards.",
"output": "def is_palindrome(word):\n return word == word[::-1]"
},
{
"instruction": "Write a JavaScript code snippet to show an alert message with the text \"Welcome to my website!\".",
"output": "alert('Welcome to my website!');"
},
{
"instruction": "Write a Python function to reverse a given list of integers.",
"output": "def reverse_list(numbers):\n return numbers[::-1]"
},
{
"instruction": "Write a basic HTML structure with a title \"My First Web Page\".",
"output": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>My First Web Page</title>\n</head>\n<body>\n\n</body>\n</html>"
},
{
"instruction": "Write a simple C++ program that prints \"Hello, World!\".",
"output": "#include <iostream>\n\nint main() {\n std::cout << \"Hello, World!\" << std::endl;\n return 0;\n}"
},
{
"instruction": "Write a Python function that takes two numbers as input and returns their sum.\n5, 7",
"output": "def add_numbers(a, b):\n return a + b\n\nresult = add_numbers(5, 7)\nprint(result)"
},
{
"instruction": "Create a JavaScript function that takes an array of numbers and returns the product of all elements.\n[2, 3, 4]",
"output": "function multiplyArrayElements(arr) {\n let product = 1;\n for (const num of arr) {\n product *= num;\n }\n return product;\n}\n\nconst result = multiplyArrayElements([2, 3, 4]);\nconsole.log(result);"
},
{
"instruction": "Can you provide a shell script that displays the total number of lines in all '*.txt' files in the current directory?\n\"file1.txt:\\nHello\\nWorld\\n\\nfile2.txt:\\nAnother\\nExample\"",
"output": "#!/bin/sh\n\ntotal_lines=0\n\nfor file in *.txt; do\n lines=$(wc -l < \"$file\")\n total_lines=$((total_lines + lines))\ndone\n\necho \"Total lines: $total_lines\""
},
{
"instruction": "Implement a Java method to reverse a string without using any built-in functions.\n\"Hello, World!\"",
"output": "public class StringReversal {\n public static String reverseString(String input) {\n char[] charArray = input.toCharArray();\n int left = 0;\n int right = charArray.length - 1;\n\n while (left < right) {\n char temp = charArray[left];\n charArray[left] = charArray[right];\n charArray[right] = temp;\n\n left++;\n right--;\n }\n return new String(charArray);\n }\n\n public static void main(String[] args) {\n String str = \"Hello, World!\";\n System.out.println(\"Reversed string: \" + reverseString(str));\n }\n}"
}
]