source stringclasses 6
values | conversations listlengths 2 2 |
|---|---|
magicoder | [
{
"from": "human",
"value": "You are tasked with creating a function that generates a list of choices for a user to select from based on a given set of channels. Each choice will display information about the channel, such as its ID, local balance, remote balance, and a graphical representation. The user mu... |
sharegpt | [
{
"from": "human",
"value": "Is there a way to create a regular expression that can match a Spanish mobile phone number?"
},
{
"from": "gpt",
"value": "<think>\nOkay, so I need to create a regular expression that can match a Spanish mobile phone number. Let me start by recalling what Spanish mob... |
evolcodegolf | [
{
"from": "human",
"value": "Inputs \nA collection (array) of numerical values or strings representing numbers, with the understanding that there will always be a minimum of two elements present, and every element will be a natural number (an integer greater than zero). \nOutputs \nA singular numeric val... |
evolcodegolf | [
{
"from": "human",
"value": "Goal \nThe objective of this intricate challenge is to process a string input by eliminating duplicate pairs of letters, specifically when the second letter in the pair exhibits opposite capitalization (i.e., transforming uppercase to lowercase and vice versa). Furthermore, you... |
dolphin | [
{
"from": "human",
"value": "convert this code to Object Pascal:\n```R\nlast_passenger_time <- function(buses, passengers, capacity) {\n buses <- sort(buses)\n passengers <- sort(passengers)\n \n last_index <- 0\n for (bus in buses) {\n cnt <- 0\n while (last_index < length(passengers) && passeng... |
codefeedback | [
{
"from": "human",
"value": "Here's a challenge for you. Can you create a modified version of the Python `Person` class that requires some puzzle solving to use? Your task is to incorporate some math puzzles and language puzzles into the attribute names and methods.\nFirst, let's start with the basic attrib... |
evolcodegolf | [
{
"from": "human",
"value": "Story, or why we are doing this. \nNone. This exercise is completely pointless ... unless you are Stephen Hawking. \nThe Challenge \nGiven a list of angles, find the average of those angles while ensuring that the computed average remains consistent even if the input angles w... |
sharegpt | [
{
"from": "human",
"value": "Write a Mongoose query to remove all documents that have an 'isActive' field set to true and a 'dateModified' field that falls within the range of January to March of 2021. In addition, create a log of all deleted items, complete with a timestamp of the deletion and the reason a... |
glaive | [
{
"from": "human",
"value": "You are tasked with creating a program that estimates the spectral density of a stationary process using the parameters of a previously estimated parametric model. The program should work after arfima, arima, and ucm. The program should also offer options to estimate the power s... |
codefeedback | [
{
"from": "human",
"value": "Write a Python function that, given a non-unique list of elements which can include integers and strings, consistently dismisses the least frequent elements until the list size is reduced to a maximum of 5 unique elements. Design your function to handle erroneous data, ensuring ... |
magicoder | [
{
"from": "human",
"value": "You are tasked with implementing a function to orthonormalize a set of input vectors. Orthonormalization is a process that takes a set of vectors and transforms them into a new set of vectors that are all orthogonal to each other and have a magnitude of 1. \n\nYou are given a Py... |
magicoder | [
{
"from": "human",
"value": "You are tasked with creating a Python function that processes a given file path and returns the local template path. The local template path is obtained by extracting the filename from the given file path.\n\nWrite a function called `extract_local_template_path` that takes a str... |
codefeedback | [
{
"from": "human",
"value": "Write a Haskell code to convert military (24-hour) time format to 12-hour time format, handling AM and PM."
},
{
"from": "gpt",
"value": "<think>\nOkay, I need to write a Haskell function that converts military time (24-hour format) to the 12-hour format with AM and ... |
glaive | [
{
"from": "human",
"value": "I am trying to create a programming problem related to composite bases in a Hilbert space. I want to test the ability to create a new basis by combining existing bases and perform operations on them. The problem involves creating a new type of basis called `MyBasis` and implemen... |
glaive | [
{
"from": "human",
"value": "I'm trying to create a procedure in MySQL to generate a random text of generic names. Here is the code I have so far:\n\n```sql\nSELECT CONCAT( CHAR( FLOOR(65 + (RAND() * 25))));\n```\n\nThis code generates a random character. I want to use this code in a procedure that generate... |
glaive | [
{
"from": "human",
"value": "You are tasked with implementing a parser for a set of parameters received from a server response. The parameters are in the form of a struct named Parameters, containing various pieces of information in string format. The goal is to create a function that takes the server respo... |
sharegpt | [
{
"from": "human",
"value": "What is the code for finding the minimum value in a given list of numbers?"
},
{
"from": "gpt",
"value": "<think>\nOkay, so I need to figure out how to write code that finds the minimum value in a list of numbers. Let's see... Hmm, where do I start? Well, I know that... |
evolcodegolf | [
{
"from": "human",
"value": "Given (by any means) two different natural numbers (of any reasonable size) and an additional integer that specifies the number of repetitions for each row in the output, output (by any means) the square of their sum as in the examples below:\nGiven 4 and 3 with a repetition cou... |
magicoder | [
{
"from": "human",
"value": "You are tasked with creating a Python function that takes a list of file paths and checks if each file exists in a specified directory. If a file does not exist, the function should return a list of the missing files. You should use the `os.path` module to perform the file exist... |
glaive | [
{
"from": "human",
"value": "You are tasked with creating a build system for a software project. The project includes C and C++ source files, some of which are located in a template directory and others in an overridden directory. Your task is to implement a solution that will properly include the C and C++... |
magicoder | [
{
"from": "human",
"value": "You are tasked with simulating a simple programming language that includes the ability to execute instructions and handle control flow using GOTO and GOSUB commands. The language operates on a set of instructions and maintains a stack of line numbers for GOTO and GOSUB commands.... |
magicoder | [
{
"from": "human",
"value": "You are working on a medical imaging software project and need to implement a function to print a bucket map to a volume. The provided code snippet includes a function `printbucket` that takes three parameters: `bck` (bucket map), `vol` (volume), and `value`. Additionally, there... |
evolcodegolf | [
{
"from": "human",
"value": "Credit: Marco Verch CC BY 2.0 \nA dual-cube date display mechanism, as depicted in the accompanying visual, utilizes a pair of cubes featuring numeric digits painted on their surfaces to showcase the calendar date. When representing dates within the single-digit range of 1-9, a... |
magicoder | [
{
"from": "human",
"value": "You are working on a web application that provides statistics related to an anime store. The application has several API endpoints for retrieving different statistics. One of the endpoints is responsible for providing the count of active users in the anime store. The code snippe... |
dolphin | [
{
"from": "human",
"value": "convert this code from java to Clojure:\n```java\nimport java.util.HashMap;\n\npublic String shortestCompletingWord(String licensePlate, String[] words) {\n HashMap<Character, Integer> target = new HashMap<>();\n for (char c : licensePlate.toCharArray()) {\n if (Cha... |
sharegpt | [
{
"from": "human",
"value": "How can I generate code in a Julia Jupyter Notebook to call an API, request data, and print the data in a tabular format?"
},
{
"from": "gpt",
"value": "<think>\nOkay, the user wants to generate code in a Julia Jupyter Notebook to call an API, get data, and display i... |
evolcodegolf | [
{
"from": "human",
"value": "The process of engaging with a literary work is straightforward, yet the intricacies of producing a printed booklet can present challenges. Specifically, when configuring the printing sequence for a booklet, the printer must meticulously arrange the pages to facilitate reading f... |
codefeedback | [
{
"from": "human",
"value": "Update the given code to add an extra element to the array, but ensure that the array remains sorted in ascending order after the addition. However, the array can contain duplicate elements.\narray = [1,2,3]\n\n#Additional Requirements#\n1. The time complexity of the solution sh... |
glaive | [
{
"from": "human",
"value": "I need to watch and wait until a POD is deleted in my program. The reason for this is that I want to start a second pod with the same name immediately after the first one is deleted. Here is the code I'm using:\n\n```go\nfunc (k *k8sClient) waitPodDeleted(ctx context.Context, re... |
sharegpt | [
{
"from": "human",
"value": "How can I generate a Python program to fit a linear model that focuses on predicting x2 from the given data?"
},
{
"from": "gpt",
"value": "<think>\nOkay, the user wants to generate a Python program to fit a linear model that predicts x2 from their data. Let me think... |
codefeedback | [
{
"from": "human",
"value": "Convert the subsequent directive into a while loop structure:\nCreate and print the results of cubing the consecutive integer values within the range of 1 to 10, inclusive, using JavaScript."
},
{
"from": "gpt",
"value": "<think>\nOkay, so I need to convert a for loo... |
evolcodegolf | [
{
"from": "human",
"value": "Input: \nWe will provide three inputs:\n\nA delimiter character D to split on \nA character I which signifies a section to ignore the delimiter character D \nA string S \n\nOutput: \nA list/array containing the substrings derived from the split, while preserving the integri... |
codefeedback | [
{
"from": "human",
"value": "Given a list of non-negative integers and a target, write an algorithm to determine if the list contains a subset that sums up to the target. The list may contain duplicate numbers.\n\nYou should aim to solve this problem with a time complexity of O(2^n) and a space complexity o... |
glaive | [
{
"from": "human",
"value": "How can I write a Java program that pads a given string so that it becomes a specific length?"
},
{
"from": "gpt",
"value": "<think>\nOkay, so I need to write a Java program that pads a string to a specific length. Let me think about how to approach this. First, I sh... |
dolphin | [
{
"from": "human",
"value": "convert this code from python to Ruby:\n```python\nclass NestedInteger:\n def __init__(self, value=None):\n pass\n\n def add(self, ni):\n pass\n\ndef deserialize(s: str) -> NestedInteger:\n if s[0] != '[':\n return NestedInteger(int(s))\n\n stack... |
codefeedback | [
{
"from": "human",
"value": "Design a function based on the specifications below:\n\ndef polynomial_occur(arr):\n '''\n You are given a non-empty list of positive integers. The task is to return the integer which occurs exactly at a polynomial frequency (e.g., 2^x, x^2) in the list. If multiple number... |
codefeedback | [
{
"from": "human",
"value": "Write a HTML structure with a form that includes ``name`` and ``email`` fields."
},
{
"from": "gpt",
"value": "<think>\nOkay, I need to create an HTML structure with a form that includes name and email fields. Let's start by recalling the basic HTML template. The doc... |
codefeedback | [
{
"from": "human",
"value": "You are tasked with creating a web application that manages user sessions and authentication. Your task is to implement a PHP class that handles user sessions and provides methods for user authentication and logout.\n\nYou are provided with a code snippet from a web page that di... |
glaive | [
{
"from": "human",
"value": "You are tasked with simulating a series of perception and causation problems in Lisp using OSCAR_3.31. Your task is to create a program that can process a set of simulation problems and their respective inputs, reasons, premises, and interests. Each problem includes a message, r... |
glaive | [
{
"from": "human",
"value": "You are tasked with creating a web page that displays a grid of image boxes. Each image box should have a fixed width and height, with a background color and a shadow effect. When a user hovers over an image box, the image inside the box should fade out, and a content box should... |
dolphin | [
{
"from": "human",
"value": "convert this code to Dart:\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"sort\"\n)\n\nfunc magneticForce(position []int, m int) int {\n\tsort.Ints(position)\n\tleft := 1\n\tright := position[len(position)-1] - position[0]\n\tvar result int\n\tfor left <= right {\n\t\tmid := (... |
codefeedback | [
{
"from": "human",
"value": "Construct a SQL query to retrieve the total number of employees whose age is the same as the oldest employee named 'Richard', but unlike Richard, they have been with the company for less than 5 years and their salary exceeds the average salary of all employees."
},
{
"fr... |
glaive | [
{
"from": "human",
"value": "You are tasked with creating a module in Morphir.SDK to handle flows in a financial system. The module should include a type alias for BusinessDate, ReportingEntity, and Flow. The Flow type alias should consist of various fields such as amount, assetType, businessDate, collatera... |
sharegpt | [
{
"from": "human",
"value": "I just installed Passenger 3.0.11 and nginx and got this error:\n\n```\nStarting nginx: /opt/nginx/sbin/nginx: error while loading shared libraries: libpcre.so.0: cannot open shared object file: No such file or directory\n```\n\nWhat does this error mean and how can I fix it?"
... |
glaive | [
{
"from": "human",
"value": "How can I create a square object filled with numbers in spiral order using a 2D array of integers in Python?"
},
{
"from": "gpt",
"value": "<think>\nOkay, so I need to create a square matrix filled with numbers in a spiral order using a 2D array in Python. Hmm, let's... |
codefeedback | [
{
"from": "human",
"value": "You are tasked with implementing a job queue system for a distributed computing environment. The system consists of a `Client` class and a `JobQueue` class. The `Client` class is responsible for submitting jobs to the job queue, while the `JobQueue` class manages the queue and d... |
evolcodegolf | [
{
"from": "human",
"value": "The task of effectively shuffling a deck of cards can pose significant challenges for children, necessitating the exploration of methods that yield a well-randomized deck with minimal complexity. One effective approach to achieve this outcome is as follows:\n\n1. Remove the top ... |
codefeedback | [
{
"from": "human",
"value": "Design a PostgreSQL query to compute the interquartile range (IQR) for the duration of inactive periods experienced by users on your mobile application, grouped by user location and device type. Tracks these inactive periods in multiple time zones, normalized to UTC."
},
{
... |
codefeedback | [
{
"from": "human",
"value": "Write SQL query to calculate total rental fees for customers who have rented a movie in the past 30 days, grouping the results by month and customer. Additionally, exclude any customers who have rented less than 3 movies in the past 30 days. \n\nTable Name: \"Rentals\"\nColumns:... |
sharegpt | [
{
"from": "human",
"value": "What is the issue in the following code?\n\n```go\npackage main\n\nimport \"fmt\"\n\nfunc main() {\n\n myArray := [...]int{12, 14, 26} \n fmt.Println(myArray)\n\n myArray := [...]int{11, 12, 14} //error pointing on this line \n\n fmt.Println(myArray)\n}\n```\n\nT... |
magicoder | [
{
"from": "human",
"value": "You are tasked with creating a custom exception class in Python for a media processing application called \"Unmanic.\" The application encounters various errors during its operation, and it needs specific exception classes to handle these errors. Your task is to create a new cus... |
magicoder | [
{
"from": "human",
"value": "You are tasked with implementing a function that rounds a given floating-point number to the nearest integer using a specific rounding method. The rounding method involves adding 0.5 to the number and then truncating the decimal part to obtain the nearest integer. You need to wr... |
codefeedback | [
{
"from": "human",
"value": "Craft a Python script to fabricate a sequential enumeration including even integers. This sequence must start at 0 and terminate just before 20, with the addition of integers satisfying the Fibonacci series."
},
{
"from": "gpt",
"value": "<think>\nOkay, so I need to ... |
magicoder | [
{
"from": "human",
"value": "You are tasked with implementing a message repository class in PHP. The class should have methods to create, retrieve, update, and delete messages. Your task is to complete the implementation of the MessageRepository class by adding the remaining methods and ensuring that they f... |
magicoder | [
{
"from": "human",
"value": "You are tasked with implementing a custom view in Swift that displays a numeric code input interface. The view should allow users to input a numeric code by tapping on individual digit buttons. Once the code is fully entered, the view should trigger a callback with the entered c... |
evolcodegolf | [
{
"from": "human",
"value": "Credit to Geobits in TNB for the intriguing concept presented herein. \n\nAn insufficiently detailed post recently introduced a captivating game scenario: \nTwo children find themselves seated before an extensive array of candy, each piece distinctly numbered from 1 to x, where ... |
evolcodegolf | [
{
"from": "human",
"value": "Your objective is to construct a mapping of a given textual input to a sine curve defined by the mathematical expression:\na sin ( mx - b )\nwhere both a and m are non-zero rational numbers, b remains a rational number, and all calculations are to be performed in radians. The po... |
codefeedback | [
{
"from": "human",
"value": "Write a web application that includes a form with multiple input fields for the user to enter their personal information, such as name, email address, phone number, and date of birth. When the submit button is clicked, the application should validate all the input fields entered... |
glaive | [
{
"from": "human",
"value": "I'm trying to pass parameters with an SQL query in Pandas using an SQLAlchemy engine to connect to a PostgreSQL database. I found an example that works using a list of parameters, but I also read that params can be passed as a dict. However, I can't seem to get the dict syntax t... |
magicoder | [
{
"from": "human",
"value": "You are tasked with implementing a custom thread pool for executing tasks in a Java application. The thread pool should be capable of handling asynchronous tasks and logging the execution of each task using the Log4j framework. Additionally, the thread pool should be able to ser... |
glaive | [
{
"from": "human",
"value": "I'm not sure what is the correct way to pass a 2d array between C++ and Java. Can someone guide me along? \n\nHere is the code I have in C++:\n\n```cpp\nint main(){\n JavaVMOption options[1];\n JNIEnv *env;\n JavaVM *jvm;\n JavaVMInitArgs vm_args;\n long status;\n... |
magicoder | [
{
"from": "human",
"value": "You are tasked with creating a word cloud generator using Python. A word cloud is a visual representation of text data, where the size of each word indicates its frequency or importance within the text. Your task is to implement a function that takes a string of text as input an... |
glaive | [
{
"from": "human",
"value": "You are tasked with implementing a minimal implementation of BL31 capable of booting mainline U-Boot and Linux for the Amlogic Meson S905X2 (G12A) SoC. The implementation should include the following features:\n- SCPI support\n- Basic PSCI support (CPU_ON, CPU_OFF, SYSTEM_RESET,... |
sharegpt | [
{
"from": "human",
"value": "What is the code to calculate the volume of a cube when the side length is given?"
},
{
"from": "gpt",
"value": "<think>\nOkay, so I need to figure out the code to calculate the volume of a cube when the side length is given. Let me think. First, what's the formula f... |
glaive | [
{
"from": "human",
"value": "You are tasked with creating a program to calculate the probability amplitudes for a quantum system and then visualize the results. The program should include functions to calculate the amplitude and probability for a given set of variables, as well as to find the maximum probab... |
magicoder | [
{
"from": "human",
"value": "You are given a Python class `VersionChecker` with a method `check_version` that takes a version number as input. The method should return `True` if the input version number is greater than or equal to 2, and `False` otherwise.\n\nThe `VersionChecker` class is defined as follows... |
evolcodegolf | [
{
"from": "human",
"value": "The Fibonacci sequence F(n), defined over the domain of positive integers, is characterized by the following axioms: \n1. F(1) = 1 \n2. F(2) = 1 \n3. F(n) = F(n-1) + F(n-2), where n represents a positive integer greater than 2. \n\nIn addition, the Fibonacci-orial of a given... |
sharegpt | [
{
"from": "human",
"value": "I have a view in my database that returns a constant value using the following code:\n\n```\nSELECT Name, 'Unpaid' AS Status FROM table;\n```\n\nHowever, the collation for the constant value is always set to `utf8mb4_unicode_ci` by default. I need to change the collation for thi... |
codefeedback | [
{
"from": "human",
"value": "Could you elucidate the step-by-step methodology requisite for integrating Google BigQuery into my corporation's advanced data analytics infrastructure, and probe into the specific elements that demand scrupulous scrutiny during this process to assure peak performance and rigoro... |
sharegpt | [
{
"from": "human",
"value": "How can I check if two scipy.sparse.csr_matrix are equal? When I try to use the '__eq__' method, I get a ValueError with the message \"The truth value of an array with more than one element is ambiguous. Use a.any() or a.all().\". However, using a list comprehension with an asse... |
dolphin | [
{
"from": "human",
"value": "translate this code to Rust:\n```erlang\n-module(my_calendar_two).\n-export([new/0, book/3]).\n\nnew() ->\n {[], []}.\n\nbook(Start, End, {Singles, Doubles}) ->\n case check_double_bookings(Start, End, Doubles) of\n true ->\n Doubles1 = Doubles ++ [{max(S... |
glaive | [
{
"from": "human",
"value": "I am trying to design an algorithm for a more complex version of the game - Rock-paper-scissors-lizard-Spock-octopus-alien. This version includes seven elements, where each one of them wins against three other elements and loses against the remaining three. In addition to determ... |
codefeedback | [
{
"from": "human",
"value": "Elaborate the subsequent Go code fragment:\nThis code takes advantage of importing the \"sort\" package.\n\nThe objective of this Go function, termed GetOddCollatz, is to take in any positive integer 'n' as an input, carry out specific calculations as laid out in the Collatz con... |
glaive | [
{
"from": "human",
"value": "You are tasked with creating a Cypress command to compare screenshots for visual regression testing. The compareSnapshot command should take a screenshot and compare it to a baseline image, throwing an error if the image difference percentage exceeds a specified threshold. The c... |
magicoder | [
{
"from": "human",
"value": "You are tasked with creating a program that processes save files for a game called \"Satisfactory.\" The save files are in a custom binary format and need to be parsed and analyzed. The save file format is represented by the `SaveFile` struct provided by the `satisfactory_save_f... |
evolcodegolf | [
{
"from": "human",
"value": "Challenge \nPremise \nImagine a garden plot represented as a grid of \\$m \\times n\\$ squares, with \\$p\\$ different types of flowers identified by unique integers. Example (\\$3\\times5\\$, three types): \n1 2 1 3 2 \n3 1 2 2 1 \n2 3 1 1 3 \n\nIn the center of this gard... |
glaive | [
{
"from": "human",
"value": "You have been tasked with creating a Makefile for a project, but you want to automate the process as much as possible. Your project has two source files, ultraviolento.c and LCD.c, and you want to compile them into object files and then link them to create the final executable. ... |
sharegpt | [
{
"from": "human",
"value": "I encountered the following error message while working on my project and I couldn't find any helpful information online. Can someone please assist me?\n\nError message:\nfeatures/manage_hand_evaluator.feature: Parse error at features/manage_hand_evaluator.feature:21. Found exam... |
evolcodegolf | [
{
"from": "human",
"value": "Your superior successfully deciphered the concealed message, leading to an unexpected outcome where instead of termination, you were reassigned as a secretary, with explicit instructions against writing traditional code. However, as a programmer at heart, you feel an urgent need... |
evolcodegolf | [
{
"from": "human",
"value": "Given a space-separated string, transform it by cycling the last character of each word to the front of that word while preserving the original order of the words. A \"word\" is defined as a sequence of printable ASCII characters excluding spaces, newlines, and tabs. \n\nFor exa... |
glaive | [
{
"from": "human",
"value": "You are tasked with creating a gameplay screen for a rhythm game using Lua. The gameplay screen should include various elements based on certain conditions. The conditions are as follows:\n- If the player is not in replay mode, not customizing the gameplay, and not in practice m... |
magicoder | [
{
"from": "human",
"value": "You are tasked with creating a Python program that simulates a simplified file system. The program should allow users to navigate through directories, list the contents of a directory, and change the current working directory. To achieve this, you need to implement a class calle... |
codefeedback | [
{
"from": "human",
"value": "You are working on a software application that deals with geometric shapes and their representations. The application uses a `Geometry` class to manage the formats in which the shapes are displayed. The class has an enumeration `Format` with the following values: `FormatKeep`, `... |
evolcodegolf | [
{
"from": "human",
"value": "Devise a program that outputs \"Hi, Hello!\" in k bytes. By modifying n bytes, the code must display all odd integers within the range 5 <= x <= 25. Furthermore, upon changing an additional m bytes, it should generate the following ASCII-art frame:\n```\n+-+\n| |\n+-+\n```\nIn a... |
codefeedback | [
{
"from": "human",
"value": "You are tasked with implementing a function that simulates a simple packing algorithm for a rectangular canvas. The canvas is represented as a 2D grid of cells, where each cell can be either empty or occupied. The packing algorithm should place a given set of rectangular objects... |
dolphin | [
{
"from": "human",
"value": "port this code from Scala to Swift:\n```scala\ndef findComplement(n: Int): Int = {\n val binary = n.toBinaryString\n val complement = binary.map(c => if(c == '0') '1' else '0')\n Integer.parseInt(complement, 2)\n}\n```"
},
{
"from": "gpt",
"value": "<think>\... |
codefeedback | [
{
"from": "human",
"value": "You are tasked with implementing a window extractor class that extracts a window of a specified size from a 2D grid. The window is defined by its top-left and bottom-right corners, and the padding type to be applied. The window extractor is initialized with the following paramet... |
evolcodegolf | [
{
"from": "human",
"value": "Design an innovative one-instruction set computer (OISC) that operates on a unique conceptual framework beyond conventional computation:\n\nYour mission is to define an OISC that utilizes a single, unconventional instruction derived from a non-traditional mathematical operation,... |
glaive | [
{
"from": "human",
"value": "I am trying to cross-compile my C++ project for a different architecture (aarch64) on a Linux system. I have already set the CMAKE_SYSTEM_NAME and CMAKE_SYSTEM_PROCESSOR to Linux and aarch64 respectively. I have also specified the cross compiler using CMAKE_C_COMPILER and CMAKE_... |
magicoder | [
{
"from": "human",
"value": "You are given a Python script that processes data from multiple files. The script reads data from a file `fd1` and then iterates through a list of file descriptors `fds2` to close each file. Within the script, there is a nested loop that iterates through a dictionary `data2` and... |
dolphin | [
{
"from": "human",
"value": "port this code from ANSI C to C#:\n```c\n#include <stdio.h>\n#include <stdlib.h>\n\nint count_pairs_with_same_value_and_divisible_by_k(int* nums, int n, int k) {\n int* freq = (int*)calloc(k, sizeof(int));\n for (int i = 0; i < n; i++) {\n freq[nums[i] % k]++;\n ... |
glaive | [
{
"from": "human",
"value": "You are tasked with implementing the CUDA x-drop seed-and-extend alignment algorithm for DNA sequence alignment. The goal is to create a program that can efficiently align DNA sequences using parallel processing on a GPU. The algorithm involves using a seed-and-extend approach t... |
codefeedback | [
{
"from": "human",
"value": "Construct a function that can compute the aggregate of two integer quantities, explicitly circumventing the use of the '+' operator during the computation. The integers to be used for this task are x = 10 and y = 20."
},
{
"from": "gpt",
"value": "<think>\nOkay, so I... |
codefeedback | [
{
"from": "human",
"value": "Implement a dynamic programming solution to find the maximum sum of a subarray in a given array of integers."
},
{
"from": "gpt",
"value": "<think>\nOkay, I need to implement a dynamic programming solution to find the maximum sum of a subarray in a given array of int... |
sharegpt | [
{
"from": "human",
"value": "Write an encryption function using Caesar Cipher that can handle both uppercase and lowercase letters. Additionally, the function should also be able to handle punctuation and spaces without altering them. The function should also support multiple encryption keys, where each key... |
glaive | [
{
"from": "human",
"value": "You are tasked with creating a protocol buffer message in a file with the syntax \"proto3\". The message should include the following fields:\n- An instance name (string)\n- A VRF name (string)\n- An address family name (string)\n- A route distinguisher (string)\n- A network add... |
glaive | [
{
"from": "human",
"value": "You are working on a project that involves writing workflows in **Lemon**, using both **C++** and **Python**. As part of this project, you need to utilize several compile-time constants from the **Lemon** framework. These constants are located in the **C++** namespace *lemon* an... |
sharegpt | [
{
"from": "human",
"value": "Write a code to construct a balanced BST with the elements 11, 18, 14, 6, 7, 4, 23, 15, 8, 10. The resulting tree should be height balanced and have the minimum possible height.\n\nNote: You are not allowed to use any built-in data structures or libraries for implementing the BS... |
magicoder | [
{
"from": "human",
"value": "You are tasked with implementing a string matching algorithm to find the first occurrence of a given pattern (needle) within a larger string (haystack). The algorithm should return the index of the first character of the first occurrence of the pattern in the haystack. If the pa... |
dolphin | [
{
"from": "human",
"value": "Please explain the following problem in detail and provide code in Fortran:\nGiven the `root` of a binary tree, return _the sum of values of nodes with an **even-valued grandparent**_. If there are no nodes with an **even-valued grandparent**, return `0`.\n\nA **grandparent** of... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.