Dataset Viewer
Auto-converted to Parquet Duplicate
messages
listlengths
2
2
[ { "role": "user", "content": "I want to check whether a number is prime using Python." }, { "role": "assistant", "content": "def is_prime(n):\n if n < 2:\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" } ]
[ { "role": "user", "content": "I need a JavaScript function that debounces another function call." }, { "role": "assistant", "content": "function debounce(fn, delay) {\n let timer;\n return function(...args) {\n clearTimeout(timer);\n timer = setTimeout(() => fn.apply(this, ar...
[ { "role": "user", "content": "I would like to check if a value exists inside a slice in Go." }, { "role": "assistant", "content": "func contains(arr []int, val int) bool {\n for _, v := range arr {\n if v == val {\n return true\n }\n }\n return false\n}" } ]
[ { "role": "user", "content": "Can you show me how to write a recursive factorial function in Rust?" }, { "role": "assistant", "content": "fn factorial(n: u64) -> u64 {\n if n == 0 { return 1; }\n n * factorial(n - 1)\n}" } ]
[ { "role": "user", "content": "I want to implement factorial using recursion in C++." }, { "role": "assistant", "content": "int factorial(int n) {\n if (n == 0) return 1;\n return n * factorial(n - 1);\n}" } ]
[ { "role": "user", "content": "Please generate Fibonacci numbers using Python in a simple loop." }, { "role": "assistant", "content": "def fib(n):\n a, b = 0, 1\n for _ in range(n):\n print(a)\n a, b = b, a + b" } ]
[ { "role": "user", "content": "How can I calculate factorial recursively in Java?" }, { "role": "assistant", "content": "int factorial(int n) {\n if (n == 0) return 1;\n return n * factorial(n - 1);\n}" } ]
[ { "role": "user", "content": "I want to determine if a number is even using JavaScript." }, { "role": "assistant", "content": "const isEven = n => n % 2 === 0;" } ]
[ { "role": "user", "content": "Show me how to merge two Python lists together." }, { "role": "assistant", "content": "merged = list1 + list2" } ]
[ { "role": "user", "content": "How do I find duplicate email addresses using SQL?" }, { "role": "assistant", "content": "SELECT email, COUNT(*) FROM users GROUP BY email HAVING COUNT(*) > 1;" } ]
[ { "role": "user", "content": "I need a recursive factorial function in C#." }, { "role": "assistant", "content": "int Factorial(int n) {\n if (n == 0) return 1;\n return n * Factorial(n - 1);\n}" } ]
[ { "role": "user", "content": "Please show me how to compute factorial in Go using recursion." }, { "role": "assistant", "content": "func factorial(n int) int {\n if n == 0 {\n return 1\n }\n return n * factorial(n - 1)\n}" } ]
[ { "role": "user", "content": "I want to check if a string is a palindrome in Python." }, { "role": "assistant", "content": "def is_palindrome(s):\n return s == s[::-1]" } ]
[ { "role": "user", "content": "Show me a JavaScript function that checks for palindrome strings." }, { "role": "assistant", "content": "const isPalindrome = s => s === s.split('').reverse().join('');" } ]
[ { "role": "user", "content": "I want to determine if a number is even in Rust." }, { "role": "assistant", "content": "fn is_even(n: i32) -> bool {\n n % 2 == 0\n}" } ]
[ { "role": "user", "content": "I need a C++ function that checks if a number is prime." }, { "role": "assistant", "content": "bool isPrime(int n) {\n if (n < 2) return false;\n for (int i = 2; i * i <= n; i++) {\n if (n % i == 0) return false;\n }\n return true;\n}" } ]
[ { "role": "user", "content": "How can I find the maximum of three numbers in Python?" }, { "role": "assistant", "content": "max(a, b, c)" } ]
[ { "role": "user", "content": "Show me how to reverse a string in Java." }, { "role": "assistant", "content": "boolean isPalindrome(String s) {\n return new StringBuilder(s).reverse().toString().equals(s);\n}" } ]
[ { "role": "user", "content": "I want to reverse a string using Go." }, { "role": "assistant", "content": "func reverse(s string) string {\n r := []rune(s)\n for i, j := 0, len(r)-1; i < j; i, j = i+1, j-1 {\n r[i], r[j] = r[j], r[i]\n }\n return string(r)\n}" } ]
[ { "role": "user", "content": "Please show me how to get the maximum salary from a SQL table." }, { "role": "assistant", "content": "SELECT MAX(salary) FROM employees;" } ]
[ { "role": "user", "content": "I want to merge two dictionaries in Python." }, { "role": "assistant", "content": "merged = {**dict1, **dict2}" } ]
[ { "role": "user", "content": "How can I remove an item from a JavaScript array?" }, { "role": "assistant", "content": "arr = arr.filter(x => x !== item);" } ]
[ { "role": "user", "content": "I need to sum an array in Rust." }, { "role": "assistant", "content": "fn sum(arr: &[i32]) -> i32 {\n arr.iter().sum()\n}" } ]
[ { "role": "user", "content": "Show me how to sum an array in C#." }, { "role": "assistant", "content": "int sum = arr.Sum();" } ]
[ { "role": "user", "content": "I want to count vowels in a Python string." }, { "role": "assistant", "content": "def count_vowels(s):\n return sum(1 for c in s.lower() if c in 'aeiou')" } ]
[ { "role": "user", "content": "How can I count vowels using Java streams?" }, { "role": "assistant", "content": "long count = s.chars().filter(c -> \"aeiou\".indexOf(c) != -1).count();" } ]
[ { "role": "user", "content": "I want to calculate factorial iteratively in Go." }, { "role": "assistant", "content": "func factorial(n int) int {\n result := 1\n for i := 2; i <= n; i++ {\n result *= i\n }\n return result\n}" } ]
[ { "role": "user", "content": "Show me how to calculate average salary using SQL." }, { "role": "assistant", "content": "SELECT AVG(salary) FROM employees;" } ]
[ { "role": "user", "content": "I need to find the minimum value in a Python list." }, { "role": "assistant", "content": "min(my_list)" } ]
[ { "role": "user", "content": "How can I find the maximum value in a JavaScript array?" }, { "role": "assistant", "content": "Math.max(...arr)" } ]
[ { "role": "user", "content": "I want to get the length of a string in Rust." }, { "role": "assistant", "content": "let len = s.len();" } ]
[ { "role": "user", "content": "Show me how to get string length in C++." }, { "role": "assistant", "content": "int len = str.length();" } ]
[ { "role": "user", "content": "I want to square every number in a Python list." }, { "role": "assistant", "content": "list(map(lambda x: x*x, my_list))" } ]
[ { "role": "user", "content": "How can I sum an array using Java streams?" }, { "role": "assistant", "content": "int sum = Arrays.stream(arr).sum();" } ]
[ { "role": "user", "content": "I want to create a map in Go with string keys and integer values." }, { "role": "assistant", "content": "m := map[string]int{\"a\": 1, \"b\": 2}" } ]
[ { "role": "user", "content": "Show me how to join two tables in SQL." }, { "role": "assistant", "content": "SELECT * FROM a JOIN b ON a.id = b.id;" } ]
[ { "role": "user", "content": "I want to flatten a nested list in Python." }, { "role": "assistant", "content": "[item for sublist in list_of_lists for item in sublist]" } ]
[ { "role": "user", "content": "How can I flatten an array in JavaScript?" }, { "role": "assistant", "content": "arr.flat()" } ]
[ { "role": "user", "content": "Print hello world using Rust." }, { "role": "assistant", "content": "println!(\"Hello\");" } ]
[ { "role": "user", "content": "I want to reverse a string in C#." }, { "role": "assistant", "content": "new string(s.Reverse().ToArray());" } ]
[ { "role": "user", "content": "Generate a list of numbers from 0 to 9 in Python." }, { "role": "assistant", "content": "list(range(10))" } ]
[ { "role": "user", "content": "Show me how to reverse a string in Java." }, { "role": "assistant", "content": "new StringBuilder(s).reverse().toString();" } ]
[ { "role": "user", "content": "I want to handle errors in Go properly." }, { "role": "assistant", "content": "if err != nil {\n log.Fatal(err)\n}" } ]
[ { "role": "user", "content": "How can I delete duplicate rows in SQL?" }, { "role": "assistant", "content": "DELETE FROM users WHERE id NOT IN (SELECT MIN(id) FROM users GROUP BY email);" } ]
[ { "role": "user", "content": "I want to zip two lists in Python." }, { "role": "assistant", "content": "list(zip(list1, list2))" } ]
[ { "role": "user", "content": "Show me how to sort an array in JavaScript." }, { "role": "assistant", "content": "arr.sort((a, b) => a - b);" } ]
[ { "role": "user", "content": "I want to push a value into a Rust vector." }, { "role": "assistant", "content": "vec.push(10);" } ]
[ { "role": "user", "content": "Show me how to push an element into a C++ vector." }, { "role": "assistant", "content": "v.push_back(10);" } ]
[ { "role": "user", "content": "I want to check if a Python list is sorted." }, { "role": "assistant", "content": "def is_sorted(lst):\n return lst == sorted(lst)" } ]
[ { "role": "user", "content": "I want to check if a JavaScript array contains a value." }, { "role": "assistant", "content": "arr.includes(value)" } ]
[ { "role": "user", "content": "Show me how to reverse a slice in Go." }, { "role": "assistant", "content": "for i, j := 0, len(arr)-1; i < j; i, j = i+1, j-1 {\n arr[i], arr[j] = arr[j], arr[i]\n}" } ]
[ { "role": "user", "content": "I want to check if a string contains text in Rust." }, { "role": "assistant", "content": "s.contains(\"text\")" } ]
[ { "role": "user", "content": "Show me how to check if a C++ vector is empty." }, { "role": "assistant", "content": "if (v.empty()) {\n // empty\n}" } ]
[ { "role": "user", "content": "I want to compute the sum of a list in Python." }, { "role": "assistant", "content": "sum(my_list)" } ]
[ { "role": "user", "content": "I want to check for null values in Java." }, { "role": "assistant", "content": "if (obj == null) {\n // handle\n}" } ]
[ { "role": "user", "content": "Show me how to order SQL results by salary descending." }, { "role": "assistant", "content": "SELECT * FROM employees ORDER BY salary DESC;" } ]
[ { "role": "user", "content": "I want to convert a string to uppercase in JavaScript." }, { "role": "assistant", "content": "str.toUpperCase()" } ]
[ { "role": "user", "content": "I want to convert a string to lowercase in Python." }, { "role": "assistant", "content": "str.lower()" } ]
[ { "role": "user", "content": "Show me how to convert a string to int in Go." }, { "role": "assistant", "content": "i, _ := strconv.Atoi(str)" } ]
[ { "role": "user", "content": "I want to parse a string into an integer in Rust." }, { "role": "assistant", "content": "let num: i32 = s.parse().unwrap();" } ]
[ { "role": "user", "content": "Show me how to convert an int to string in C#." }, { "role": "assistant", "content": "x.ToString();" } ]
[ { "role": "user", "content": "I want to get the absolute value in Python." }, { "role": "assistant", "content": "abs(x)" } ]
[ { "role": "user", "content": "Show me absolute value in JavaScript." }, { "role": "assistant", "content": "Math.abs(x)" } ]
[ { "role": "user", "content": "I want to get absolute value in Java." }, { "role": "assistant", "content": "Math.abs(x);" } ]
[ { "role": "user", "content": "Show me how to loop through a range in Python." }, { "role": "assistant", "content": "for i in range(10):\n print(i)" } ]
[ { "role": "user", "content": "I want to loop in Go." }, { "role": "assistant", "content": "for i := 0; i < 10; i++ {\n fmt.Println(i)\n}" } ]
[ { "role": "user", "content": "Show me how to break a loop in Rust." }, { "role": "assistant", "content": "for i in 0..10 {\n if i == 5 {\n break;\n }\n}" } ]
[ { "role": "user", "content": "I want a for loop in C++." }, { "role": "assistant", "content": "for (int i = 0; i < 10; i++) {\n cout << i;\n}" } ]
[ { "role": "user", "content": "Show me how to enumerate a list in Python." }, { "role": "assistant", "content": "for i, v in enumerate(my_list):\n print(i, v)" } ]
[ { "role": "user", "content": "I want to use forEach in JavaScript." }, { "role": "assistant", "content": "arr.forEach(x => console.log(x));" } ]
[ { "role": "user", "content": "Show me how to select distinct values in SQL." }, { "role": "assistant", "content": "SELECT DISTINCT column_name FROM table;" } ]
[ { "role": "user", "content": "I want to get dictionary keys in Python." }, { "role": "assistant", "content": "my_dict.keys()" } ]
[ { "role": "user", "content": "Show me how to create a HashMap in Java." }, { "role": "assistant", "content": "Map<String, Integer> map = new HashMap<>();" } ]
[ { "role": "user", "content": "I want to append to a slice in Go." }, { "role": "assistant", "content": "arr = append(arr, 10)" } ]
[ { "role": "user", "content": "Show me how to get vector length in Rust." }, { "role": "assistant", "content": "vec.len()" } ]
[ { "role": "user", "content": "I want to add an item to a C# list." }, { "role": "assistant", "content": "list.Add(item);" } ]
[ { "role": "user", "content": "Show me how to check if a key exists in a Python dictionary." }, { "role": "assistant", "content": "key in my_dict" } ]
[ { "role": "user", "content": "I want to get object keys in JavaScript." }, { "role": "assistant", "content": "Object.keys(obj)" } ]
[ { "role": "user", "content": "Show me how to create a SQL table." }, { "role": "assistant", "content": "CREATE TABLE users (id INT, name TEXT);" } ]
[ { "role": "user", "content": "I want to zip two lists in Python again." }, { "role": "assistant", "content": "list(zip(a, b))" } ]
[ { "role": "user", "content": "Show me how to check a map key in Go." }, { "role": "assistant", "content": "val, ok := m[key]" } ]
[ { "role": "user", "content": "I want to use if let in Rust." }, { "role": "assistant", "content": "if let Some(x) = option {\n println!(\"{}\", x);\n}" } ]
[ { "role": "user", "content": "Show me an if statement in C++." }, { "role": "assistant", "content": "if (x > 0) {\n cout << x;\n}" } ]
[ { "role": "user", "content": "I want to raise an error in Python." }, { "role": "assistant", "content": "raise ValueError(\"error\")" } ]
[ { "role": "user", "content": "Show me how to throw an error in JavaScript." }, { "role": "assistant", "content": "throw new Error('error');" } ]
[ { "role": "user", "content": "I want to throw an exception in Java." }, { "role": "assistant", "content": "throw new Exception(\"error\");" } ]
[ { "role": "user", "content": "Show me SQL group by usage." }, { "role": "assistant", "content": "SELECT department, COUNT(*) FROM employees GROUP BY department;" } ]
[ { "role": "user", "content": "I want to filter an array in JavaScript." }, { "role": "assistant", "content": "arr.filter(x => x > 0)" } ]
[ { "role": "user", "content": "Show me reduce in JavaScript." }, { "role": "assistant", "content": "arr.reduce((a, b) => a + b, 0)" } ]
[ { "role": "user", "content": "I want to initialize a struct in Go." }, { "role": "assistant", "content": "p := Person{Name: \"John\"}" } ]
[ { "role": "user", "content": "Show me a struct in Rust." }, { "role": "assistant", "content": "struct Person {\n name: String,\n}" } ]
[ { "role": "user", "content": "I want to define a class in C#." }, { "role": "assistant", "content": "class Person {\n public string Name;\n}" } ]
[ { "role": "user", "content": "Show me how to create a set in Python." }, { "role": "assistant", "content": "my_set = {1, 2, 3}" } ]
[ { "role": "user", "content": "I want to create a set in Java." }, { "role": "assistant", "content": "Set<Integer> set = new HashSet<>();" } ]
[ { "role": "user", "content": "Show me a set in JavaScript." }, { "role": "assistant", "content": "const set = new Set([1,2,3]);" } ]
[ { "role": "user", "content": "I want to limit SQL results." }, { "role": "assistant", "content": "SELECT * FROM users LIMIT 10;" } ]
[ { "role": "user", "content": "Show me how to check empty string in Python." }, { "role": "assistant", "content": "if not s:\n print(\"empty\")" } ]
[ { "role": "user", "content": "I want to handle errors in Go." }, { "role": "assistant", "content": "if err != nil {\n log.Fatal(err)\n}" } ]
[ { "role": "user", "content": "Show me error handling in Rust." }, { "role": "assistant", "content": "match result {\n Ok(v) => v,\n Err(e) => panic!(\"error\"),\n}" } ]
[ { "role": "user", "content": "I need a Python example that checks whether a string is empty or not." }, { "role": "assistant", "content": "if not s:\n print(\"string is empty\")" } ]
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
51