instruction stringlengths 14 5.13k | messages listlengths 2 2 | generator stringclasses 1
value | reasoning stringclasses 1
value | synthetic_model stringclasses 1
value | thinking_disabled bool 1
class |
|---|---|---|---|---|---|
Write a SQL query to find all the users in a database who have an age greater than 25 and whose first name starts with the letter 'J'. Additionally, the query should only return users whose last name ends with the letter 's'.
Furthermore, the query should return the users in descending order of their ages. | [
{
"role": "user",
"content": "Write a SQL query to find all the users in a database who have an age greater than 25 and whose first name starts with the letter 'J'. Additionally, the query should only return users whose last name ends with the letter 's'. \nFurthermore, the query should return the users in ... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Rewrite the given Python code using a for-loop and ensure that the loop iterates only for odd values of 'i' within the range of 1 to 100, and terminates if 'i' exceeds 50. | [
{
"role": "user",
"content": "Rewrite the given Python code using a for-loop and ensure that the loop iterates only for odd values of 'i' within the range of 1 to 100, and terminates if 'i' exceeds 50."
},
{
"role": "assistant",
"content": "Certainly! Here's the Python code rewritten using a `fo... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Count the number of vowels in the string and return a dictionary where the keys are the vowels and the values are the counts of each vowel. However, you are not allowed to use any built-in functions or libraries that directly count the number of vowels in the string.
text = "Hello World!"
For example, for the given t... | [
{
"role": "user",
"content": "Count the number of vowels in the string and return a dictionary where the keys are the vowels and the values are the counts of each vowel. However, you are not allowed to use any built-in functions or libraries that directly count the number of vowels in the string.\n\ntext = ... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Edit the following code to print out all even numbers from 1 to 100, but exclude numbers that are divisible by both 3 and 5. | [
{
"role": "user",
"content": "Edit the following code to print out all even numbers from 1 to 100, but exclude numbers that are divisible by both 3 and 5."
},
{
"role": "assistant",
"content": "Sure! Here's the edited code that prints all even numbers from 1 to 100, but **excludes numbers that a... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write a function that takes in a list of integers and returns the sum of all the numbers that are a multiple of 3. If there is no number that is a multiple of 3, the function should return 0.
Please note that the input list can contain both positive and negative numbers.
Example:
Input: [8, -2, 14, 25, -33, 6]
Outpu... | [
{
"role": "user",
"content": "Write a function that takes in a list of integers and returns the sum of all the numbers that are a multiple of 3. If there is no number that is a multiple of 3, the function should return 0.\n\nPlease note that the input list can contain both positive and negative numbers.\n\n... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Create a JSON object with five key-value pairs. The keys should be "name", "age", "city", "occupation", and "hobbies", and the corresponding values should be your name, your age, your city of residence, your occupation, and a list of your hobbies. The hobbies should be stored as an array within the JSON object. Additio... | [
{
"role": "user",
"content": "Create a JSON object with five key-value pairs. The keys should be \"name\", \"age\", \"city\", \"occupation\", and \"hobbies\", and the corresponding values should be your name, your age, your city of residence, your occupation, and a list of your hobbies. The hobbies should b... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Edit the following code to add a try-except block that handles the specific exception of ValueError and prints a custom error message when the input values cannot be converted to integers. Additionally, modify the code to handle a KeyboardInterrupt exception and terminate the program gracefully when the user interrupts... | [
{
"role": "user",
"content": "Edit the following code to add a try-except block that handles the specific exception of ValueError and prints a custom error message when the input values cannot be converted to integers. Additionally, modify the code to handle a KeyboardInterrupt exception and terminate the p... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write a Python function to convert a given string to lowercase and remove any punctuation marks, but preserve any whitespace characters. The function should also remove any digits from the string.
string = "FOO, BAR! 123" | [
{
"role": "user",
"content": "Write a Python function to convert a given string to lowercase and remove any punctuation marks, but preserve any whitespace characters. The function should also remove any digits from the string.\nstring = \"FOO, BAR! 123\""
},
{
"role": "assistant",
"content": "He... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Increase the difficulty by asking to print the square of each number in reverse order using a while loop instead of a for loop. Additionally, ask to only print the squares of odd numbers.
i = n
while i >= 1:
if i % 2 != 0:
print(i ** 2)
i -= 1 | [
{
"role": "user",
"content": "Increase the difficulty by asking to print the square of each number in reverse order using a while loop instead of a for loop. Additionally, ask to only print the squares of odd numbers.\n\ni = n\nwhile i >= 1:\n if i % 2 != 0:\n print(i ** 2)\n i -= 1"
},
{
... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Implement a function to check if a given string is a valid palindrome. The function should return True if the string is a valid palindrome, and False otherwise. A valid palindrome is a string that reads the same forwards and backwards, ignoring any non-alphabetic characters and considering only lowercase alphabets. The... | [
{
"role": "user",
"content": "Implement a function to check if a given string is a valid palindrome. The function should return True if the string is a valid palindrome, and False otherwise. A valid palindrome is a string that reads the same forwards and backwards, ignoring any non-alphabetic characters and... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Please rewrite the following code using nested ternary operators and add a condition to check if num1 is divisible by num2.
num1 = 15
num2 = 3
# Incorrect code added for misdirection
output = "num1 is smaller than num2" if num1 < num2 else "num1 is greater than or equal to num2" if num1 > num2 else "num1 is equal to ... | [
{
"role": "user",
"content": "Please rewrite the following code using nested ternary operators and add a condition to check if num1 is divisible by num2.\n\nnum1 = 15\nnum2 = 3\n\n# Incorrect code added for misdirection\noutput = \"num1 is smaller than num2\" if num1 < num2 else \"num1 is greater than or eq... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write a SQL query to return the sum of salaries for each department, excluding any departments where the average salary is less than or equal to $75,000. Additionally, exclude departments where the total salary of all employees in the department is less than or equal to $500,000. | [
{
"role": "user",
"content": "Write a SQL query to return the sum of salaries for each department, excluding any departments where the average salary is less than or equal to $75,000. Additionally, exclude departments where the total salary of all employees in the department is less than or equal to $500,00... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write a function that takes in a matrix of numbers and reverses the order of the rows and columns. The matrix will have at least 2 rows and 2 columns. The function should handle matrices of any size, with the number of rows and columns being greater than or equal to 2. Additionally, you should ensure that the function ... | [
{
"role": "user",
"content": "Write a function that takes in a matrix of numbers and reverses the order of the rows and columns. The matrix will have at least 2 rows and 2 columns. The function should handle matrices of any size, with the number of rows and columns being greater than or equal to 2. Addition... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Parse the string and return the number of unique consonants in the string. The input string can contain both lowercase and uppercase letters. Return the count of unique consonants in a case-insensitive manner.
Example:
Input: "ApplE"
Output: 2
Input: "MissiSsippi"
Output: 2 | [
{
"role": "user",
"content": "Parse the string and return the number of unique consonants in the string. The input string can contain both lowercase and uppercase letters. Return the count of unique consonants in a case-insensitive manner.\n\nExample: \nInput: \"ApplE\"\nOutput: 2\n\nInput: \"MissiSsippi\"\... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write a function that removes all vowels from a given string and returns the string sorted in descending order of character frequency.
Example:
Input: "Hello World"
Output: "llWrHd"
Note:
- The input string may contain uppercase and lowercase vowels.
- The function should return the string sorted in descending order ... | [
{
"role": "user",
"content": "Write a function that removes all vowels from a given string and returns the string sorted in descending order of character frequency.\n\nExample:\nInput: \"Hello World\"\nOutput: \"llWrHd\"\n\nNote:\n- The input string may contain uppercase and lowercase vowels.\n- The functio... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
# This program prints a conversion table from Fahrenheit to Celsius
# Print a heading for the table in the following format:
# Temperature Conversion Table (Fahrenheit to Celsius)
# Print the column headings in the following format:
# Fahrenheit Celsius
# Calculate and print the table body. The table should inc... | [
{
"role": "user",
"content": "# This program prints a conversion table from Fahrenheit to Celsius\n\n# Print a heading for the table in the following format:\n# Temperature Conversion Table (Fahrenheit to Celsius)\n\n# Print the column headings in the following format:\n# Fahrenheit Celsius\n\n# Calcul... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Create a function in JavaScript to find the number of occurrences of a word in a sentence. The function should consider both uppercase and lowercase occurrences of the word. If the word is not found in the sentence, the function should return 0. The function should have a time complexity of O(n), where n is the length ... | [
{
"role": "user",
"content": "Create a function in JavaScript to find the number of occurrences of a word in a sentence. The function should consider both uppercase and lowercase occurrences of the word. If the word is not found in the sentence, the function should return 0. The function should have a time ... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Edit the code to create a try-except block to handle the exception and include a custom error message. The custom error message should indicate the specific variables that were involved in the division. Additionally, modify the code to ensure that the program continues running even if an exception occurs, and print the... | [
{
"role": "user",
"content": "Edit the code to create a try-except block to handle the exception and include a custom error message. The custom error message should indicate the specific variables that were involved in the division. Additionally, modify the code to ensure that the program continues running ... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write a code to sort the following array in increasing order. The array may contain duplicate elements. The time complexity of the algorithm should be O(n^2).
[10, 2, 7, 8, 32, 4, 8, 7, 10, 2]
*Provide an example solution that uses a sorting algorithm with a time complexity of O(n^2). | [
{
"role": "user",
"content": "Write a code to sort the following array in increasing order. The array may contain duplicate elements. The time complexity of the algorithm should be O(n^2).\n\n[10, 2, 7, 8, 32, 4, 8, 7, 10, 2]\n\n*Provide an example solution that uses a sorting algorithm with a time complexi... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Create a function to calculate the area of a given circle. The input parameter for the radius should be a string instead of a number. Additionally, the function should handle invalid inputs and return an error message if the input is not a valid number.
The function should also validate that the radius is a positive n... | [
{
"role": "user",
"content": "Create a function to calculate the area of a given circle. The input parameter for the radius should be a string instead of a number. Additionally, the function should handle invalid inputs and return an error message if the input is not a valid number.\n\nThe function should a... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Create a function that takes an array of integers as an argument and returns the sum of all the prime numbers in the array. If the array does not contain any prime numbers, return 0.
Example:
Input: [1, 2, 3, 4, 5]
Output: 10
Input: [1, 3, 5]
Output: 9
Input: [2, 4, 6, 8]
Output: 2
Input: [1, 2, 3, 4, 5, 6, 7, 8, ... | [
{
"role": "user",
"content": "Create a function that takes an array of integers as an argument and returns the sum of all the prime numbers in the array. If the array does not contain any prime numbers, return 0.\n\nExample:\n\nInput: [1, 2, 3, 4, 5]\nOutput: 10\n\nInput: [1, 3, 5]\nOutput: 9\n\nInput: [2, ... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Create a CSS script that not only centers the login form on the webpage, but also adds a transition effect when the form is hovered over. The transition effect should smoothly change the background color of the form from white to a light shade of blue. Additionally, the form should have a border radius of 10px and a dr... | [
{
"role": "user",
"content": "Create a CSS script that not only centers the login form on the webpage, but also adds a transition effect when the form is hovered over. The transition effect should smoothly change the background color of the form from white to a light shade of blue. Additionally, the form sh... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write an HTML template to display a greeting message. The message should include the name of the user who visits the website. The username variable should be assigned dynamically using JavaScript.
<script>
// Write code here to dynamically assign a value to the username variable
// The value should be retrieve... | [
{
"role": "user",
"content": "Write an HTML template to display a greeting message. The message should include the name of the user who visits the website. The username variable should be assigned dynamically using JavaScript.\n\n<script>\n // Write code here to dynamically assign a value to the username... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Create a nested loop to print every combination of numbers between 0-9, excluding any combination that contains the number 5. Additionally, exclude any combination that contains a repeating digit. Implement the solution without using any built-in functions or libraries to check for repeating digits. | [
{
"role": "user",
"content": "Create a nested loop to print every combination of numbers between 0-9, excluding any combination that contains the number 5. Additionally, exclude any combination that contains a repeating digit. Implement the solution without using any built-in functions or libraries to check... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write a JavaScript function that takes in an array of numbers and returns the sum of all the even numbers in the array. Additionally, the function should ignore any duplicate numbers in the array and only consider the unique even numbers for the sum calculation. The function should also handle negative numbers and deci... | [
{
"role": "user",
"content": "Write a JavaScript function that takes in an array of numbers and returns the sum of all the even numbers in the array. Additionally, the function should ignore any duplicate numbers in the array and only consider the unique even numbers for the sum calculation. The function sh... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
numbers = [i for i in range(10) if i % 2 == 0]
is_greater_than_five = all(num > 5 for num in numbers)
is_sum_even = sum(numbers) % 2 == 0
result = is_greater_than_five and is_sum_even | [
{
"role": "user",
"content": "numbers = [i for i in range(10) if i % 2 == 0] \nis_greater_than_five = all(num > 5 for num in numbers)\nis_sum_even = sum(numbers) % 2 == 0\nresult = is_greater_than_five and is_sum_even"
},
{
"role": "assistant",
"content": "Let's break down the code step by step ... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Edit the following code to remove the bugs and also make it case-insensitive. The input string must contain at least one letter and cannot be longer than 100 characters. The function should also remove any special characters and only reverse the alphabetic characters.
def reverse_string(user_string):
if len(user_st... | [
{
"role": "user",
"content": "Edit the following code to remove the bugs and also make it case-insensitive. The input string must contain at least one letter and cannot be longer than 100 characters. The function should also remove any special characters and only reverse the alphabetic characters.\n\ndef re... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write a function that calculates the factorial of each number in the list using recursion, but without using any built-in libraries or mathematical operators.
arr = [1, 2, 3, 4, 5] | [
{
"role": "user",
"content": "Write a function that calculates the factorial of each number in the list using recursion, but without using any built-in libraries or mathematical operators.\narr = [1, 2, 3, 4, 5]"
},
{
"role": "assistant",
"content": "To calculate the factorial of each number in ... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
What is the output of the following code?
list1 = ['a', 'b', 'c', 'd', 'e', 'f']
list2 = [1, 2, 3, 4, 5, 6]
for x, y in zip(list1[::-1], list2[::3]):
print(x * y) | [
{
"role": "user",
"content": "What is the output of the following code?\nlist1 = ['a', 'b', 'c', 'd', 'e', 'f']\nlist2 = [1, 2, 3, 4, 5, 6]\n\nfor x, y in zip(list1[::-1], list2[::3]):\n print(x * y)"
},
{
"role": "assistant",
"content": "Let's break down the code step by step to determine th... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write a C# program to find the maximum and minimum of an array of integers. Additionally, the program should only use a single line of code to accomplish this task. The program should have a time complexity of O(n) and a space complexity of O(1).
However, you are not allowed to use any built-in functions or methods fo... | [
{
"role": "user",
"content": "Write a C# program to find the maximum and minimum of an array of integers. Additionally, the program should only use a single line of code to accomplish this task. The program should have a time complexity of O(n) and a space complexity of O(1).\n\nHowever, you are not allowed... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write an algorithm in Python to determine if a number is prime or composite. Your algorithm should have a time complexity of O(n^2).
Note: You are not allowed to use any built-in functions or libraries to check if a number is prime. You have to implement the algorithm from scratch.
Examples:
1. Input: 2
Output: Pr... | [
{
"role": "user",
"content": "Write an algorithm in Python to determine if a number is prime or composite. Your algorithm should have a time complexity of O(n^2).\n\nNote: You are not allowed to use any built-in functions or libraries to check if a number is prime. You have to implement the algorithm from s... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Create a React component using JSX that renders a "Hello, World!" message in the browser. The rendered message should have a font size of 20px, be displayed in the center of the page, and be surrounded by a border with a width of 2px and a color of red. Additionally, the message should be animated to fade in and out ev... | [
{
"role": "user",
"content": "Create a React component using JSX that renders a \"Hello, World!\" message in the browser. The rendered message should have a font size of 20px, be displayed in the center of the page, and be surrounded by a border with a width of 2px and a color of red. Additionally, the mess... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write code that removes spaces and punctuation marks from a given string and returns the modified string. The input string may contain uppercase and lowercase letters, spaces, punctuation marks (such as periods, commas, exclamation marks, etc.), and digits. The modified string should only contain the alphanumeric chara... | [
{
"role": "user",
"content": "Write code that removes spaces and punctuation marks from a given string and returns the modified string. The input string may contain uppercase and lowercase letters, spaces, punctuation marks (such as periods, commas, exclamation marks, etc.), and digits. The modified string ... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write a SQL query to calculate the total number of orders in the "orders" table, where the orders have been placed in the last 30 days, have a total order value greater than $1000, and have at least 3 different items included in the order. | [
{
"role": "user",
"content": "Write a SQL query to calculate the total number of orders in the \"orders\" table, where the orders have been placed in the last 30 days, have a total order value greater than $1000, and have at least 3 different items included in the order."
},
{
"role": "assistant",
... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Follow the comments to complete the code that finds the maximum value in an array. The array must contain at least 20 elements and the maximum value must be greater than or equal to 1000. Additionally, the solution should have a time complexity of O(n log n) or better.
# Find the maximum value in an array
arr = [2018,... | [
{
"role": "user",
"content": "Follow the comments to complete the code that finds the maximum value in an array. The array must contain at least 20 elements and the maximum value must be greater than or equal to 1000. Additionally, the solution should have a time complexity of O(n log n) or better.\n\n# Fin... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Create a function in Java that takes a string and returns a new string that is reversed and contains only the unique characters in the original string. The function should also convert all uppercase characters to lowercase in the reversed string before returning it. Additionally, the function should remove all digits a... | [
{
"role": "user",
"content": "Create a function in Java that takes a string and returns a new string that is reversed and contains only the unique characters in the original string. The function should also convert all uppercase characters to lowercase in the reversed string before returning it. Additionall... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Compose a function named average_list which takes a list of numbers as its argument and computes the average. The list may contain both positive and negative numbers.
The function should handle the following edge cases:
- If the list is empty, the function should return None.
- If the list contains only one element, t... | [
{
"role": "user",
"content": "Compose a function named average_list which takes a list of numbers as its argument and computes the average. The list may contain both positive and negative numbers.\n\nThe function should handle the following edge cases:\n- If the list is empty, the function should return Non... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write a Python program to concatenate all elements in a list into a string separated by a given separator. The separator must be a non-alphanumeric character. If the separator is not provided, the default separator should be a hyphen ("-").
Additionally, if the input list contains any nested lists, the program should ... | [
{
"role": "user",
"content": "Write a Python program to concatenate all elements in a list into a string separated by a given separator. The separator must be a non-alphanumeric character. If the separator is not provided, the default separator should be a hyphen (\"-\").\n\nAdditionally, if the input list ... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Modify the code below to make it calculate the sum of all the prime numbers from 1 to n. The final sum should be stored in the variable "total". Also, add a condition to skip any numbers that are divisible by both 2 and 3.
num = 15
total = 0
for i in range(1, num+1):
if i % 2 == 0 and i % 3 == 0:
continue
elif ... | [
{
"role": "user",
"content": "Modify the code below to make it calculate the sum of all the prime numbers from 1 to n. The final sum should be stored in the variable \"total\". Also, add a condition to skip any numbers that are divisible by both 2 and 3.\nnum = 15\ntotal = 0\nfor i in range(1, num+1):\n if... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write a function to generate the nth Fibonacci number. The function should have a time complexity of O(log n) and use dynamic programming. Additionally, the function should only use a constant amount of space, without using any arrays or additional data structures. | [
{
"role": "user",
"content": "Write a function to generate the nth Fibonacci number. The function should have a time complexity of O(log n) and use dynamic programming. Additionally, the function should only use a constant amount of space, without using any arrays or additional data structures."
},
{
... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Sum up all the prime numbers in the array, excluding the number 3, using JavaScript. The array should have a minimum length of 15 and a maximum length of 25. | [
{
"role": "user",
"content": "Sum up all the prime numbers in the array, excluding the number 3, using JavaScript. The array should have a minimum length of 15 and a maximum length of 25."
},
{
"role": "assistant",
"content": "Here's a JavaScript function that sums all the **prime numbers** in a... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Please write a function in JavaScript to count the number of vowels in a given string. However, you are not allowed to use any built-in string methods or regular expressions. The input string may contain lowercase and/or uppercase alphabets, as well as special characters and numbers. The function should be case-insensi... | [
{
"role": "user",
"content": "Please write a function in JavaScript to count the number of vowels in a given string. However, you are not allowed to use any built-in string methods or regular expressions. The input string may contain lowercase and/or uppercase alphabets, as well as special characters and nu... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Sort the array in descending order without using any built-in sorting functions or libraries. The array may contain duplicate elements.
Constraints:
- The input array has a length of at most 10^6.
- The elements in the array are integers between -10^9 and 10^9.
arr = [3, 2, 1, 5, 4] | [
{
"role": "user",
"content": "Sort the array in descending order without using any built-in sorting functions or libraries. The array may contain duplicate elements.\n\nConstraints:\n- The input array has a length of at most 10^6.\n- The elements in the array are integers between -10^9 and 10^9.\n\narr = [3... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Edit the Python code so that it prints out the total number of odd elements in the list. Additionally, you need to modify the code to handle a potential error scenario. If the list contains any non-integer elements, the program should raise a ValueError exception with a descriptive error message. The program should als... | [
{
"role": "user",
"content": "Edit the Python code so that it prints out the total number of odd elements in the list. Additionally, you need to modify the code to handle a potential error scenario. If the list contains any non-integer elements, the program should raise a ValueError exception with a descrip... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Create a program that can calculate the distance between two points in three-dimensional space. However, you are not allowed to use the standard distance formula (sqrt((x2-x1)^2 + (y2-y1)^2 + (z2-z1)^2)). Additionally, your solution should have a time complexity of O(1) and should not use any mathematical functions or ... | [
{
"role": "user",
"content": "Create a program that can calculate the distance between two points in three-dimensional space. However, you are not allowed to use the standard distance formula (sqrt((x2-x1)^2 + (y2-y1)^2 + (z2-z1)^2)). Additionally, your solution should have a time complexity of O(1) and sho... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write a JavaScript code snippet to print the numbers from 1 to 100 in a pattern where each number is repeated a number of times equal to its value. For example, the number 1 should be printed once, the number 2 should be printed twice, the number 3 should be printed three times, and so on. The pattern should continue u... | [
{
"role": "user",
"content": "Write a JavaScript code snippet to print the numbers from 1 to 100 in a pattern where each number is repeated a number of times equal to its value. For example, the number 1 should be printed once, the number 2 should be printed twice, the number 3 should be printed three times... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Using the given function, create a loop that counts from 0 to 9. Additionally, display the square of each number within the loop. However, you are not allowed to use the multiplication operator (*) to calculate the square. You must come up with an alternative method to calculate the square. Please ensure that your code... | [
{
"role": "user",
"content": "Using the given function, create a loop that counts from 0 to 9. Additionally, display the square of each number within the loop. However, you are not allowed to use the multiplication operator (*) to calculate the square. You must come up with an alternative method to calculat... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write a function that takes a string and reverses the words in it, while also maintaining the original order of punctuation marks and special characters. The function should only reverse the words and not alter the position or order of any non-alphabetic characters. Additionally, the function should not use any built-i... | [
{
"role": "user",
"content": "Write a function that takes a string and reverses the words in it, while also maintaining the original order of punctuation marks and special characters. The function should only reverse the words and not alter the position or order of any non-alphabetic characters. Additionall... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write a Python program to split a string on a given character separator. However, if the separator is not found in the string, raise a custom exception called "SeparatorNotFoundError". Additionally, handle any potential errors that may occur during the program execution.
mystring = "Hello, World!"
separator = "#"
# I... | [
{
"role": "user",
"content": "Write a Python program to split a string on a given character separator. However, if the separator is not found in the string, raise a custom exception called \"SeparatorNotFoundError\". Additionally, handle any potential errors that may occur during the program execution.\n\nm... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write a C program to find the sum of all the even digits of a given number, where the number must be positive, less than 1000, and can be of any data type (int, long, or double).
#Erroneous Code#
```
#include<stdio.h>
int main()
{
int num, digit, sum = 0;
printf("Enter a number: ");
scanf("%d", &num);
... | [
{
"role": "user",
"content": "Write a C program to find the sum of all the even digits of a given number, where the number must be positive, less than 1000, and can be of any data type (int, long, or double).\n\n#Erroneous Code#\n```\n#include<stdio.h>\nint main()\n{\n int num, digit, sum = 0;\n print... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Generate a dictionary of 1000 key-value pairs, where the key is a randomly generated string of length 10 and the values are random numbers from 1 to 1000. Additionally, ensure that none of the keys are repeated in the dictionary. The dictionary should be sorted in descending order based on the values.
The program shou... | [
{
"role": "user",
"content": "Generate a dictionary of 1000 key-value pairs, where the key is a randomly generated string of length 10 and the values are random numbers from 1 to 1000. Additionally, ensure that none of the keys are repeated in the dictionary. The dictionary should be sorted in descending or... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Create a function in JavaScript that takes an array of integers and returns the second largest number. However, you are not allowed to use any built-in sorting methods or loops like for, while, or forEach. You need to come up with an alternative solution that uses only logical steps and conditional statements to determ... | [
{
"role": "user",
"content": "Create a function in JavaScript that takes an array of integers and returns the second largest number. However, you are not allowed to use any built-in sorting methods or loops like for, while, or forEach. You need to come up with an alternative solution that uses only logical ... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write a SQL query to find the total number of orders placed between two given dates, group the results by the month in which the orders were placed, and include only orders with a total cost greater than $100. start_date = '2020-01-01' end_date = '2020-02-01'.
Reference: Unfortunately, there is an error in the given c... | [
{
"role": "user",
"content": "Write a SQL query to find the total number of orders placed between two given dates, group the results by the month in which the orders were placed, and include only orders with a total cost greater than $100. start_date = '2020-01-01' end_date = '2020-02-01'.\n\nReference: Unf... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Create a new folder called 'data' within the current working directory only if it doesn't already exist. If the folder already exists, check if it contains any files. If it does, display an error message and terminate the program. If it doesn't contain any files, proceed to create the folder. Additionally, the program ... | [
{
"role": "user",
"content": "Create a new folder called 'data' within the current working directory only if it doesn't already exist. If the folder already exists, check if it contains any files. If it does, display an error message and terminate the program. If it doesn't contain any files, proceed to cre... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write a function to print all prime numbers between two given numbers, excluding any prime numbers that contain the digit 5. Additionally, ensure that the function is optimized to handle larger inputs efficiently. The time complexity of the solution should be O(n log log n) where n is the difference between the two giv... | [
{
"role": "user",
"content": "Write a function to print all prime numbers between two given numbers, excluding any prime numbers that contain the digit 5. Additionally, ensure that the function is optimized to handle larger inputs efficiently. The time complexity of the solution should be O(n log log n) whe... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write a Python code to calculate the median of a given array, but without using any built-in functions or libraries for sorting or calculating the length of the array. Your solution should have a time complexity of O(nlogn) or better.
#Hint#
To find the median, you need to first sort the array in ascending order. Then... | [
{
"role": "user",
"content": "Write a Python code to calculate the median of a given array, but without using any built-in functions or libraries for sorting or calculating the length of the array. Your solution should have a time complexity of O(nlogn) or better.\n\n#Hint#\nTo find the median, you need to ... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write a function to find the maximum difference between two prime numbers in a given array. The array can contain positive and negative integers, and can be unsorted. Additionally, the function should handle arrays of any length. The function should return the maximum difference as an absolute value. For example, for t... | [
{
"role": "user",
"content": "Write a function to find the maximum difference between two prime numbers in a given array. The array can contain positive and negative integers, and can be unsorted. Additionally, the function should handle arrays of any length. The function should return the maximum differenc... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write a function that checks if a given number is prime or not. The function should return "Prime" if the number is prime, and "Not Prime" if the number is not prime.
Note: A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself.
Additional Requirements:
1. The time com... | [
{
"role": "user",
"content": "Write a function that checks if a given number is prime or not. The function should return \"Prime\" if the number is prime, and \"Not Prime\" if the number is not prime.\n\nNote: A prime number is a natural number greater than 1 that has no positive divisors other than 1 and i... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Read the JSON string below and convert it into a dictionary. After converting the JSON string into a dictionary, iterate through each key-value pair in the dictionary and perform the following operations:
1. If the key is 'name', check if the value is a string. If it is not a string, raise an exception with an appropri... | [
{
"role": "user",
"content": "Read the JSON string below and convert it into a dictionary. After converting the JSON string into a dictionary, iterate through each key-value pair in the dictionary and perform the following operations:\n1. If the key is 'name', check if the value is a string. If it is not a ... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write an SQL query to calculate the average order price for each product category in the "orders" table. Additionally, calculate the total number of orders, the total revenue generated, the total quantity sold, and the total profit for each category.
To do this, you will need to join the "orders" table with the "produ... | [
{
"role": "user",
"content": "Write an SQL query to calculate the average order price for each product category in the \"orders\" table. Additionally, calculate the total number of orders, the total revenue generated, the total quantity sold, and the total profit for each category.\n\nTo do this, you will n... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Create a dictionary for counting the occurrence of each lowercase letter in the given string. However, exclude any whitespace characters, punctuation marks, and numbers from being counted. Additionally, the solution should have a time complexity of O(n) and a space complexity of O(1), where n is the length of the strin... | [
{
"role": "user",
"content": "Create a dictionary for counting the occurrence of each lowercase letter in the given string. However, exclude any whitespace characters, punctuation marks, and numbers from being counted. Additionally, the solution should have a time complexity of O(n) and a space complexity o... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write a program that extracts all the email addresses from a given string. The program should handle various formats of email addresses, including those with different domains and subdomains.
Additionally, the program should be able to handle email addresses that are embedded within other text, such as "Contact me at ... | [
{
"role": "user",
"content": "Write a program that extracts all the email addresses from a given string. The program should handle various formats of email addresses, including those with different domains and subdomains.\n\nAdditionally, the program should be able to handle email addresses that are embedde... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write a Python program to generate the first n Fibonacci numbers and display them in reverse order. Additionally, the program should only use recursion to calculate the Fibonacci sequence and should not use any loops or built-in functions for calculating the Fibonacci numbers. Furthermore, the program should optimize t... | [
{
"role": "user",
"content": "Write a Python program to generate the first n Fibonacci numbers and display them in reverse order. Additionally, the program should only use recursion to calculate the Fibonacci sequence and should not use any loops or built-in functions for calculating the Fibonacci numbers. ... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Create a function that takes in two numbers as arguments and returns the product of the two. However, you are not allowed to use the multiplication operator or any built-in functions or methods that directly calculate the product of two numbers. Additionally, your solution should have a time complexity of O(log n), whe... | [
{
"role": "user",
"content": "Create a function that takes in two numbers as arguments and returns the product of the two. However, you are not allowed to use the multiplication operator or any built-in functions or methods that directly calculate the product of two numbers. Additionally, your solution shou... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write an SQL query to select the number of employees in each department, along with their average salary and the name of the highest-paid employee in each department. Additionally, include the department ID, department name, and the total salary of all employees in each department. Only include departments that have mo... | [
{
"role": "user",
"content": "Write an SQL query to select the number of employees in each department, along with their average salary and the name of the highest-paid employee in each department. Additionally, include the department ID, department name, and the total salary of all employees in each departm... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Generate a random integer between 100 and 500 (inclusively), ensuring that the generated number is divisible by 2, not divisible by 3, and is also a prime number. Additionally, the solution should have a time complexity of O(log n) and a space complexity of O(1). | [
{
"role": "user",
"content": "Generate a random integer between 100 and 500 (inclusively), ensuring that the generated number is divisible by 2, not divisible by 3, and is also a prime number. Additionally, the solution should have a time complexity of O(log n) and a space complexity of O(1)."
},
{
... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Create a function that takes in a list of temperatures and returns the average temperature, rounded to the nearest whole number. The temperature values can be positive or negative.
Example:
```python
list_of_temperatures = [20, 24, -5, -10, 26, 18]
print(average_temperature(list_of_temperatures))
```
Expected outp... | [
{
"role": "user",
"content": "Create a function that takes in a list of temperatures and returns the average temperature, rounded to the nearest whole number. The temperature values can be positive or negative. \n\nExample: \n\n```python\nlist_of_temperatures = [20, 24, -5, -10, 26, 18]\nprint(average_tempe... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write a MySQL query to print the column names, data types, maximum length, and number of distinct values for all columns in a table named 'employees'. | [
{
"role": "user",
"content": "Write a MySQL query to print the column names, data types, maximum length, and number of distinct values for all columns in a table named 'employees'."
},
{
"role": "assistant",
"content": "To retrieve the column names, data types, maximum length, and number of dist... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Generate a random number between 0 and 10 (inclusively) using only bitwise operations. The generated number should have exactly 4 bits set to 1. Additionally, provide a piece of erroneous code as a reference to increase misdirection. | [
{
"role": "user",
"content": "Generate a random number between 0 and 10 (inclusively) using only bitwise operations. The generated number should have exactly 4 bits set to 1. Additionally, provide a piece of erroneous code as a reference to increase misdirection."
},
{
"role": "assistant",
"cont... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write a shell script to print the top 5 most frequently used commands, excluding any commands that start with a vowel or contain any uppercase letters. Additionally, ensure that the script handles errors gracefully by displaying an appropriate error message if the command history file cannot be accessed. | [
{
"role": "user",
"content": "Write a shell script to print the top 5 most frequently used commands, excluding any commands that start with a vowel or contain any uppercase letters. Additionally, ensure that the script handles errors gracefully by displaying an appropriate error message if the command histo... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write a program to find all prime numbers between 2 and 100. The program should prompt the user to enter a number and check whether it is prime or not. If the number is prime, it should add it to a list. The program should continue prompting the user for input until an invalid number is entered. Finally, the program sh... | [
{
"role": "user",
"content": "Write a program to find all prime numbers between 2 and 100. The program should prompt the user to enter a number and check whether it is prime or not. If the number is prime, it should add it to a list. The program should continue prompting the user for input until an invalid ... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write a Java program to generate a random number between 1 and 1000, inclusive, and determine if it is a strong prime number. A strong prime number is defined as a prime number that satisfies the additional condition that the sum of its digits is also a prime number. Your program should have a time complexity of O(sqrt... | [
{
"role": "user",
"content": "Write a Java program to generate a random number between 1 and 1000, inclusive, and determine if it is a strong prime number. A strong prime number is defined as a prime number that satisfies the additional condition that the sum of its digits is also a prime number. Your progr... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write a C++ function to generate a random prime number between 1000 and 10000 that is also a palindrome. | [
{
"role": "user",
"content": "Write a C++ function to generate a random prime number between 1000 and 10000 that is also a palindrome."
},
{
"role": "assistant",
"content": "Certainly! Below is a C++ function that generates a **random prime number between 1000 and 10000** that is also a **palind... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write an SQL query to calculate the median salary of all employees in a table, rounded to the nearest integer. Additionally, exclude any employees who have been with the company for less than 1 year from the calculation. Furthermore, exclude any employees whose job title is "Manager" from the calculation. | [
{
"role": "user",
"content": "Write an SQL query to calculate the median salary of all employees in a table, rounded to the nearest integer. Additionally, exclude any employees who have been with the company for less than 1 year from the calculation. Furthermore, exclude any employees whose job title is \"M... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write a C++ code to find the average of an array of integers. The code should also check if the array contains negative integers and if so, it should not include them in the average calculation. Additionally, the code should also exclude any zero values from the average calculation.
Please make sure to handle the case... | [
{
"role": "user",
"content": "Write a C++ code to find the average of an array of integers. The code should also check if the array contains negative integers and if so, it should not include them in the average calculation. Additionally, the code should also exclude any zero values from the average calcula... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write a code to print the current date and time in ISO format, including the time zone offset and the day of the week. Additionally, implement a function that calculates the number of days between two given dates and display the result. The program should also handle leap years and validate the input to ensure the date... | [
{
"role": "user",
"content": "Write a code to print the current date and time in ISO format, including the time zone offset and the day of the week. Additionally, implement a function that calculates the number of days between two given dates and display the result. The program should also handle leap years... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Using the following code, clean up the bugs and make sure the output functions correctly. Additionally, implement a sorting algorithm to sort the elements in the list in descending order.
The input list will contain both integers and strings. The output should only contain the integers in the list, with each integer i... | [
{
"role": "user",
"content": "Using the following code, clean up the bugs and make sure the output functions correctly. Additionally, implement a sorting algorithm to sort the elements in the list in descending order.\n\nThe input list will contain both integers and strings. The output should only contain t... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write a function to find the number of distinct states in a given matrix. Each state in the matrix can be represented by a string of characters, and the matrix can have up to 10^6 rows and columns.
The time complexity of your solution should be O(N), where N is the total number of characters in the matrix.
Provide a ... | [
{
"role": "user",
"content": "Write a function to find the number of distinct states in a given matrix. Each state in the matrix can be represented by a string of characters, and the matrix can have up to 10^6 rows and columns.\n\nThe time complexity of your solution should be O(N), where N is the total num... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Design a program that finds the longest element in a given list, which should include at least 100 elements. The program should also handle negative numbers, floating-point numbers, and alphanumeric characters as elements. Additionally, it should return the longest element, its index in the list, and the total number o... | [
{
"role": "user",
"content": "Design a program that finds the longest element in a given list, which should include at least 100 elements. The program should also handle negative numbers, floating-point numbers, and alphanumeric characters as elements. Additionally, it should return the longest element, its... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Given a doubly linked list, implement a function to access the nth element from the end of the linked list, without using any built-in methods or functions for accessing the elements of the linked list.
Note:
- The linked list is guaranteed to have at least n elements.
- You cannot modify the structure of the linked l... | [
{
"role": "user",
"content": "Given a doubly linked list, implement a function to access the nth element from the end of the linked list, without using any built-in methods or functions for accessing the elements of the linked list.\n\nNote:\n- The linked list is guaranteed to have at least n elements.\n- Y... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Find the second smallest odd prime number greater than 100 in an integer array of size n. The array will only contain positive numbers. Additionally, the array must contain at least one prime number greater than 100. | [
{
"role": "user",
"content": "Find the second smallest odd prime number greater than 100 in an integer array of size n. The array will only contain positive numbers. Additionally, the array must contain at least one prime number greater than 100."
},
{
"role": "assistant",
"content": "To solve t... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Create a Ruby code that prints out the median of a given array of numbers, while also handling arrays with repeated numbers. The code should have a time complexity of O(nlogn) and a space complexity of O(1).
Provide a piece of erroneous code as a reference to increase misdirection.
nums = [5, 3, 7, 2, 5, 3, 7]
**Err... | [
{
"role": "user",
"content": "Create a Ruby code that prints out the median of a given array of numbers, while also handling arrays with repeated numbers. The code should have a time complexity of O(nlogn) and a space complexity of O(1).\n\nProvide a piece of erroneous code as a reference to increase misdir... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Implement a function that takes in two vectors of size n and returns the element-wise product of the two vectors. The input vectors may contain negative integers, duplicate elements, floating-point numbers, and may be empty (n = 0). The implementation should have a time complexity of O(n) or better. | [
{
"role": "user",
"content": "Implement a function that takes in two vectors of size n and returns the element-wise product of the two vectors. The input vectors may contain negative integers, duplicate elements, floating-point numbers, and may be empty (n = 0). The implementation should have a time complex... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Please increase the difficulty of the given programming test question:
Remove the boilerplate code from the program for printing 10 random numbers. Instead, write a function that generates a sequence of n random numbers, where n is the input to the function. The function should return the sequence of random numbers.
... | [
{
"role": "user",
"content": "Please increase the difficulty of the given programming test question:\n\nRemove the boilerplate code from the program for printing 10 random numbers. Instead, write a function that generates a sequence of n random numbers, where n is the input to the function. The function sho... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Create a list comprehension to generate a list of all prime numbers from 1000 to 2000, but with the following additional requirements:
1. Implement a separate function to check if a number is prime. This function should take in a parameter and return a boolean value indicating whether the number is prime or not.
2. I... | [
{
"role": "user",
"content": "Create a list comprehension to generate a list of all prime numbers from 1000 to 2000, but with the following additional requirements:\n\n1. Implement a separate function to check if a number is prime. This function should take in a parameter and return a boolean value indicati... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write a script to check if a given number is a palindrome or not. The number must be positive, have at least 5 digits, consist of unique digits, and be divisible by 7. Additionally, the script should handle both decimal and hexadecimal numbers, and should also check for palindromic substrings within the number. | [
{
"role": "user",
"content": "Write a script to check if a given number is a palindrome or not. The number must be positive, have at least 5 digits, consist of unique digits, and be divisible by 7. Additionally, the script should handle both decimal and hexadecimal numbers, and should also check for palindr... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Create a JavaScript function which takes a string as a parameter and returns the most frequent character in the string. The function should handle uppercase and lowercase characters as the same. The string can contain special characters, spaces, and numbers. If there are multiple characters with the same highest freque... | [
{
"role": "user",
"content": "Create a JavaScript function which takes a string as a parameter and returns the most frequent character in the string. The function should handle uppercase and lowercase characters as the same. The string can contain special characters, spaces, and numbers. If there are multip... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Create a list comprehension that takes all the elements of list_one and creates a new list where all the elements are tripled, but only if they are prime numbers. If an element is not a prime number, it should be replaced with the sum of the first 10 prime numbers instead of being tripled.
list_one = [1, 2, 3, 4, 5] | [
{
"role": "user",
"content": "Create a list comprehension that takes all the elements of list_one and creates a new list where all the elements are tripled, but only if they are prime numbers. If an element is not a prime number, it should be replaced with the sum of the first 10 prime numbers instead of be... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write a MySQL query to display the name, job, and salary of the top 10% highest paid employees, excluding any employees with a job title starting with "Manager" and whose last name starts with a vowel. | [
{
"role": "user",
"content": "Write a MySQL query to display the name, job, and salary of the top 10% highest paid employees, excluding any employees with a job title starting with \"Manager\" and whose last name starts with a vowel."
},
{
"role": "assistant",
"content": "To write a MySQL query ... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Construct a while loop that increments a counter every time a number is divisible by 3 and 5. Print out the value of the counter after each iteration. | [
{
"role": "user",
"content": "Construct a while loop that increments a counter every time a number is divisible by 3 and 5. Print out the value of the counter after each iteration."
},
{
"role": "assistant",
"content": "Sure! Here's a Python example of a `while` loop that increments a counter ev... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Increase the difficulty of the given programming test question:
Rewrite the given C++ code using only pointer references instead of array subscripts. Additionally, you are not allowed to use any built-in functions or operators to access or manipulate array elements. You must use pointer arithmetic and manual memory al... | [
{
"role": "user",
"content": "Increase the difficulty of the given programming test question:\n\nRewrite the given C++ code using only pointer references instead of array subscripts. Additionally, you are not allowed to use any built-in functions or operators to access or manipulate array elements. You must... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Implement a function called `matrix_multiply` that takes in two parameters: two matrices represented as lists of lists called `matrix1` and `matrix2`. The function should return the result of multiplying `matrix1` by `matrix2`.
For example, given the following input:
matrix1 = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
matrix2... | [
{
"role": "user",
"content": "Implement a function called `matrix_multiply` that takes in two parameters: two matrices represented as lists of lists called `matrix1` and `matrix2`. The function should return the result of multiplying `matrix1` by `matrix2`.\n\nFor example, given the following input:\nmatrix... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
How to reverse a singly linked list in C++ using only recursion and without using any additional data structures, while also maintaining constant space complexity? | [
{
"role": "user",
"content": "How to reverse a singly linked list in C++ using only recursion and without using any additional data structures, while also maintaining constant space complexity?"
},
{
"role": "assistant",
"content": "To reverse a **singly linked list in C++ using only recursion a... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write code to find the sum of all prime numbers between 1 million and 2 million, excluding prime numbers that contain the digit 7. | [
{
"role": "user",
"content": "Write code to find the sum of all prime numbers between 1 million and 2 million, excluding prime numbers that contain the digit 7."
},
{
"role": "assistant",
"content": "To solve the problem of finding the **sum of all prime numbers between 1 million and 2 million**... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write a code to get the time difference between two date-time objects, where each date-time object can be in any timezone.
date1: 2022-10-01 15:30:00 (BST)
date2: 2022-09-30 23:45:00 (PST)
The code should take into consideration the different timezones and calculate the accurate time difference between the two date-t... | [
{
"role": "user",
"content": "Write a code to get the time difference between two date-time objects, where each date-time object can be in any timezone.\n\ndate1: 2022-10-01 15:30:00 (BST)\ndate2: 2022-09-30 23:45:00 (PST)\n\nThe code should take into consideration the different timezones and calculate the ... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write a SQL query to select the name, address, and salary from a given table, where the salary is greater than $50,000, the employee has been with the company for at least 5 years, and their job title is 'Manager'. Table: Employee. | [
{
"role": "user",
"content": "Write a SQL query to select the name, address, and salary from a given table, where the salary is greater than $50,000, the employee has been with the company for at least 5 years, and their job title is 'Manager'. Table: Employee."
},
{
"role": "assistant",
"conten... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Write an algorithm to find the second largest prime number in an array of positive integers.
#Constraints#
- The array will contain at least two elements.
- The array may contain duplicates.
- The array elements will be positive integers.
#Example#
Input: [8, 11, 12, 5, 3]
Output: 5 | [
{
"role": "user",
"content": "Write an algorithm to find the second largest prime number in an array of positive integers.\n\n#Constraints#\n- The array will contain at least two elements.\n- The array may contain duplicates.\n- The array elements will be positive integers.\n\n#Example#\nInput: [8, 11, 12, ... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Given a list of numbers, find and print the difference between the largest and smallest prime numbers in the list. Additionally, the program should sort the list in descending order before finding the difference.
list_of_numbers = [10, 7, 5, 12, 4]
# Expected Output:
# Difference between the largest and smallest prim... | [
{
"role": "user",
"content": "Given a list of numbers, find and print the difference between the largest and smallest prime numbers in the list. Additionally, the program should sort the list in descending order before finding the difference.\n\nlist_of_numbers = [10, 7, 5, 12, 4]\n\n# Expected Output:\n# D... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Create a program that can filter out words of a string that contain a specific character and have a length greater than 3. Additionally, if the character is a vowel, the program should replace it with the next vowel in the vowel sequence. The program should then output the modified string, while maintaining the origina... | [
{
"role": "user",
"content": "Create a program that can filter out words of a string that contain a specific character and have a length greater than 3. Additionally, if the character is a vowel, the program should replace it with the next vowel in the vowel sequence. The program should then output the modi... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Create a recursive function in Java for computing the factorial of a positive integer number, where the input number must be less than or equal to 15. Additionally, the function should handle negative numbers gracefully by throwing a custom exception with an appropriate error message.
Provide a piece of erroneous code... | [
{
"role": "user",
"content": "Create a recursive function in Java for computing the factorial of a positive integer number, where the input number must be less than or equal to 15. Additionally, the function should handle negative numbers gracefully by throwing a custom exception with an appropriate error m... | Qwen/Qwen3-4B | off | Qwen/Qwen3-4B | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.