source stringclasses 6
values | conversations listlengths 2 2 |
|---|---|
magicoder | [
{
"from": "human",
"value": "You are tasked with creating a program to simulate a traffic light system. The traffic light should cycle through the following states: green, yellow, and red, with specific durations for each state. Your program should use a loop to iterate through the states and simulate the a... |
magicoder | [
{
"from": "human",
"value": "You are tasked with implementing a ticket management system for a transportation company. The system should handle various types of tickets, such as bus tickets, train tickets, and flight tickets. To ensure the integrity of the system, you need to create a custom exception class... |
codefeedback | [
{
"from": "human",
"value": "You are working on a project that involves calculating routes between pairs of geographic points. To achieve this, you need to make use of a routing service that provides transit routes between two given points. The code snippet provided is a part of a larger program that intera... |
magicoder | [
{
"from": "human",
"value": "You are tasked with implementing a class for controlling a motor in a robotic system. The class should provide methods for checking if the motor is ready and for retrieving the target position of the motor. Below is the skeleton of the motor control class:\n\n```java\npublic cla... |
sharegpt | [
{
"from": "human",
"value": "I want to create a Python program that can reverse the sequence of characters in a given string using advanced string handling techniques. Can someone provide me with a code example?"
},
{
"from": "gpt",
"value": "<think>\nOkay, the user wants to reverse a string in ... |
evolcodegolf | [
{
"from": "human",
"value": "Design an algorithm that identifies whether an input sequence is 'fuzzy.' What constitutes a fuzzy sequence? A fuzzy sequence is derived from a base alphanumeric string through a unique transformation process.\n\nConsider a base alphanumeric string like \"abc123.\" To create a f... |
evolcodegolf | [
{
"from": "human",
"value": "In the context of an engaging lab session during our AP Computer Science class, my friend and I undertook the challenge of code golfing one of our programming problems after completing our primary tasks with ample time remaining. The problem statement is as follows:\n\nGiven a p... |
evolcodegolf | [
{
"from": "human",
"value": "In a recent broadcast of the intellectually stimulating quiz show QI, the first five multiples of the repeating decimal 142857 were intriguingly characterized as anagrams of the base number itself. Naturally, those with a deeper understanding of the mathematical properties of th... |
sharegpt | [
{
"from": "human",
"value": "I want to replicate the \"-e\" option in ncat to redirect stdio in Rust to a remote ncat listener. I have successfully done it over TcpStream by using dup2 and then executing the \"/bin/sh\" command in Rust. However, I am now trying to do it over TLS and I'm having trouble becau... |
sharegpt | [
{
"from": "human",
"value": "Can you provide a Java program that prints the numbers from 1 to 25 in the same row without using a loop?"
},
{
"from": "gpt",
"value": "<think>\nOkay, the user wants a Java program that prints numbers from 1 to 25 in the same row without using any loops. Let me thin... |
magicoder | [
{
"from": "human",
"value": "You are tasked with designing a module system for a financial management software. The software needs to handle various aspects of financial transactions, including bills, deposits, withdrawals, money nodes, organizations, persons, products, statements of accounts, transaction e... |
codefeedback | [
{
"from": "human",
"value": "Generate an HTML table with 5 columns for Name, Email, Phone Number, Address, and Age. Each cell in the Name column should have a maximum character limit of 50 characters. The Email column should have a maximum character limit of 100 characters. The Phone Number column should ha... |
glaive | [
{
"from": "human",
"value": "You are tasked with creating a mobile app feature that allows users to manage a list of nodes. Each node has a name, address, and status (activated or deactivated). The app should display the list of nodes and allow users to activate/deactivate nodes, as well as add new nodes to... |
codefeedback | [
{
"from": "human",
"value": "Create a Java method to interpret a given string into an integer, but without using any built-in parsing or conversion functions. The method should handle positive and negative integers and should return 0 if the string cannot be interpreted as an integer. Additionally, the meth... |
evolcodegolf | [
{
"from": "human",
"value": "Develop a program or function that accepts the parameters <width>, <height>, <color1>, and <color2> as input and produces an output where the initial row consists of alternating pixels of color <color1> and <color2> with a periodicity defined by <height>. For every subsequent ro... |
sharegpt | [
{
"from": "human",
"value": "In a language of your choice, develop a decision tree algorithm from scratch. The algorithm should be capable of distinguishing and categorizing a fruit as either a mango or an apple by evaluating its distinct hue and surface's tactile characteristics.\n\nFor an added layer of c... |
dolphin | [
{
"from": "human",
"value": "convert this code to Haskell:\n```lisp\n(defun find-disappeared-numbers (nums)\n (let ((result '())\n (n (length nums)))\n (loop for num in nums do\n (let ((index (abs num -1)))\n (setf (nth index nums) (abs (nth index nums) -1))))\n (loop for i... |
codefeedback | [
{
"from": "human",
"value": "Write a query to display the average age of the students who have a grade higher than 80, sorted in descending order of their age.\nTable Name: Students"
},
{
"from": "gpt",
"value": "<think>\nOkay, so I need to write a SQL query that shows the average age of student... |
codefeedback | [
{
"from": "human",
"value": "Rewrite:\nIn Python, a dictionary key is not directly iterable. However, you can make it iterable by using the built-in `keys()` function. Please write a Python function that takes a dictionary as input and returns a list containing all the keys in the dictionary, but with each ... |
dolphin | [
{
"from": "human",
"value": "port this code to Clojure:\n```java\nclass Solution {\n public int minimizeTheDifference(int[][] mat, int target) {\n int m = mat.length, n = mat[0].length;\n int[] dp = new int[4901], new_dp = new int[4901];\n dp[0] = 1;\n for (int i = 0; i < m; +... |
sharegpt | [
{
"from": "human",
"value": "How can I improve the time complexity for a merge sort algorithm?"
},
{
"from": "gpt",
"value": "<think>\nOkay, so I need to figure out how to improve the time complexity of a merge sort algorithm. Let me start by recalling how merge sort works. Merge sort is a divid... |
sharegpt | [
{
"from": "human",
"value": "How can I automatically load controllers from specified package(s) for a given app in my Python program?"
},
{
"from": "gpt",
"value": "<think>\nOkay, so I need to figure out how to automatically load controllers from specific packages in my Python app. Let me start ... |
glaive | [
{
"from": "human",
"value": "You are tasked with creating a Room Database for an Android application to store pass data. The database should have a single table called \"PassData\" and should be version 1. You should also implement a Data Access Object (DAO) to interact with the PassData table. Additionally... |
evolcodegolf | [
{
"from": "human",
"value": "Consider the string of brackets ]][][[. When you perform a rightward rotation once, it transforms into []][][. A subsequent rotation yields [[]][]. The given string maintains a balanced configuration of brackets. \n\nThe objective is to develop a program (or function) that accep... |
magicoder | [
{
"from": "human",
"value": "You are tasked with implementing a simplified version of an asynchronous queue in Python. The queue should support adding data to the queue and retrieving data from the queue in an asynchronous manner. Your task is to complete the implementation of the `AsyncQueue` class by addi... |
magicoder | [
{
"from": "human",
"value": "You are tasked with implementing a function that parses a given JSON object and extracts specific information from it. The JSON object represents weather data for the next 1 hour and contains a nested structure with various properties. Your task is to extract the `symbol_code` f... |
glaive | [
{
"from": "human",
"value": "You are tasked with writing a program that checks a condition and prints a specific value based on the result. Your program should include an if statement to check the condition and print a value if the condition is true, or another value if the condition is false. Make sure to ... |
dolphin | [
{
"from": "human",
"value": "convert this code from PHP to F#:\n```php\nfunction findSmallestReachableSet($n, $edges) {\n $inDegrees = array_fill(0, $n, 0);\n foreach ($edges as $edge) {\n $toNode = $edge[1];\n $inDegrees[$toNode]++;\n }\n \n $queue = new SplQueue();\n for ($... |
glaive | [
{
"from": "human",
"value": "How can I convert a given string to all lowercase letters using Python?"
},
{
"from": "gpt",
"value": "<think>\nOkay, the user wants to know how to convert a string to all lowercase letters in Python. Let me think. I remember that Python strings have some built-in me... |
evolcodegolf | [
{
"from": "human",
"value": "(yes, that title was intentional) \nYour task is to correct common grammatical mistakes while also identifying and rephrasing any awkward or unclear phrases. You must:\n\nCapitalise the first letter of each sentence, ie the first non-whitespace letter after any of .!? and, addi... |
magicoder | [
{
"from": "human",
"value": "You are tasked with implementing a command-line tool for managing solvers and their versions. The tool should support various commands, including listing supported solvers and their versions. Your task is to create a class structure and implement the functionality for the \"list... |
glaive | [
{
"from": "human",
"value": "You are tasked with creating a Java program that defines a class to hold system constants. The class should have a static string variable named LOCAL_HOST with the value \"127.0.0.1\" and a static integer variable named DEFINE_PORT with the value 9009. Your program should be abl... |
sharegpt | [
{
"from": "human",
"value": "Proceed with concluding the subsequent Java code:\nimport java.util.*;\nimport java.lang.*;\n\nclass Solution {\n /**\n Furnish a boolean output that indicates if each single integer in the curated collection defined as 'l' is inferior to a particular, pre-established boun... |
codefeedback | [
{
"from": "human",
"value": "Given an integer n, write a program to print out the prime numbers up to n. Additionally, implement a function that checks whether a given number is a prime number or not.\n\nThe program should have a time complexity of O(n log(log n)) for generating the prime numbers up to n an... |
sharegpt | [
{
"from": "human",
"value": "Can you help me rewrite this C++ code into C language?"
},
{
"from": "gpt",
"value": "<think>\nOkay, I need to convert this C++ code into C. Let me start by looking at the original code to see what C++ features are being used. The user hasn't provided the code yet, b... |
glaive | [
{
"from": "human",
"value": "You are tasked with creating a Makefile to facilitate mono builds for a project. The Makefile should include the following features:\n- A DEBUG flag that can be toggled on or off\n- A list of source files to be compiled\n- A list of resources to be included in the compiled outpu... |
glaive | [
{
"from": "human",
"value": "I am trying to implement a class in C# using the STU framework that includes two fields, \"m_priority\" and \"m_00D49978\". The \"m_priority\" field should be of type STUConfigVar and have a field attribute of 0xBB16810A, while the \"m_00D49978\" field should also be of type STU... |
magicoder | [
{
"from": "human",
"value": "You are tasked with implementing a Python function that processes a list of partitions and deletes objects from an Amazon S3 bucket based on certain criteria. The function should take in a dictionary containing partition information and utilize regular expressions to extract the... |
evolcodegolf | [
{
"from": "human",
"value": "This jubilant character is celebrated in various mythologies as the Easter Bunny.\n\n**Colours** \nIt is formulated using four specific hues:\n\n- Pastel pink\n- Deep rose\n- Pure white\n- Jet black\n\n(I welcome approximations of these hues in your response, as exact precision... |
glaive | [
{
"from": "human",
"value": "You are tasked with creating a utility function in C++ to calculate the available memory on a CUDA-enabled device. The function should take no input parameters and return the total amount of device memory in bytes, rounded down to the nearest gigabyte (GB). You should use the CU... |
codefeedback | [
{
"from": "human",
"value": "How can you count the number of unique elements in an array in Java, without using any built-in functions or libraries, and ensuring a time complexity of O(n)? Additionally, the array may contain both positive and negative integers, and you need to handle duplicates within the a... |
glaive | [
{
"from": "human",
"value": "You are tasked with creating a view in a MySQL database that retrieves specific data from a table called `events_statements_summary_by_digest`. The view should select the `DIGEST_TEXT`, `SCHEMA_NAME`, `COUNT_STAR`, `SUM_TIMER_WAIT`, `SUM_NO_INDEX_USED`, `SUM_NO_GOOD_INDEX_USED`,... |
glaive | [
{
"from": "human",
"value": "You are tasked with creating an Element parser in JavaScript. The parser should be able to open and close HTML elements, parse attributes from a string, and determine if an element is self-closing. The parser should also be able to handle different types of elements, such as tho... |
sharegpt | [
{
"from": "human",
"value": "How can I write a C program that finds the nearest prime number to a given number, which is taken as input from the user?"
},
{
"from": "gpt",
"value": "<think>\nOkay, so I need to write a C program that finds the nearest prime number to a given input number. Hmm, wh... |
magicoder | [
{
"from": "human",
"value": "You are tasked with creating a unit test for a view controller in a messaging app. The view controller, `messagesViewController`, is part of a navigation stack managed by `navigationController`. The app uses an `apiClientFake` to simulate network responses. The `testViewDidLoad`... |
magicoder | [
{
"from": "human",
"value": "You are tasked with implementing a file handling system in a programming language of your choice. Your goal is to create a class `FileHandler` that provides methods for handling files. The `FileHandler` class should have a method `WhenNotExists` that takes an action to perform w... |
evolcodegolf | [
{
"from": "human",
"value": "Upon decompressing this archive, you will obtain an executable file comprising exactly 65024 bytes. While it might seem entertaining to extract and reveal the specifics of that file's content, such a task is not necessary. Instead, your objective is to generate a binary sequence... |
glaive | [
{
"from": "human",
"value": "In Python, can I create a list with named indices similar to how I can create an array in PHP with named indices? For instance, in PHP I can create an array like this:\n\n```php\n$shows = Array(0 => Array('id' => 1, 'name' => 'Sesame Street'), \n 1 => Array('id' =>... |
magicoder | [
{
"from": "human",
"value": "You are tasked with implementing a function to aggregate markers and perform specific actions based on the aggregated data. The function takes in a list of previously processed markers and returns a dictionary of the markers to be aggregated, the updated list of processed marker... |
glaive | [
{
"from": "human",
"value": "What is a possible solution for designing a JavaScript class to represent a circle?"
},
{
"from": "gpt",
"value": "<think>\nOkay, I need to design a JavaScript class to represent a circle. Let me think about what a circle typically has. Well, a circle has a radius, r... |
codefeedback | [
{
"from": "human",
"value": "Edit the following code to generate a list of all the vowels in a given string. If a vowel appears consecutively, it should only be included once in the list. The function should also ignore any vowels that appear after a consonant."
},
{
"from": "gpt",
"value": "<th... |
sharegpt | [
{
"from": "human",
"value": "I want to replace all the vowels in a given string with the letter 'X'. How can I achieve this using an algorithm? Can you provide a code example?"
},
{
"from": "gpt",
"value": "<think>\nOkay, I need to replace all the vowels in a string with 'X'. Let's see. First, w... |
glaive | [
{
"from": "human",
"value": "You are tasked with creating a script to read a token from a file and use it to deploy database rules using the Firebase CLI. The token is stored in a file named token.key located in the project root directory. The script should read the token from the file and use it as an auth... |
glaive | [
{
"from": "human",
"value": "You are tasked with creating an Android app that displays a list of torrents from a remote server using Retrofit for network requests and Gson for JSON parsing. The app should have the ability to load more torrents as the user scrolls through the list. You need to implement the ... |
glaive | [
{
"from": "human",
"value": "You are required to implement a CUDA kernel that performs vector addition with the following specifications:\n- The kernel should be named `vectorAdd` and must be called from the CPU and run on the GPU.\n- It should take in two input arrays `a` and `b` of type `int`, and an outp... |
dolphin | [
{
"from": "human",
"value": "translate this code to Dart:\n```java\nimport java.util.Arrays;\n\npublic int giftsRemaining(int[] gifts, int k) {\n for (int i = 0; i < k; i++) {\n Arrays.sort(gifts);\n int maxIndex = gifts.length - 1;\n gifts[maxIndex] -= (int) Math.sqrt(gifts[maxIndex... |
sharegpt | [
{
"from": "human",
"value": "How can I create a mobile application using React Native and Expo that allows users to search and browse a list of books?"
},
{
"from": "gpt",
"value": "<think>\nOkay, the user wants to create a mobile app using React Native and Expo that lets users search and browse... |
evolcodegolf | [
{
"from": "human",
"value": "A quote from MO.SE answer:\n\nAlthough it is well known that Conway was able to quickly calculate the day of the week of any given date, it is less well known that one part of the algorithm is easy to remember and useful in practice: In any given year, the following dates all fa... |
magicoder | [
{
"from": "human",
"value": "You are tasked with implementing a dice-rolling bot for a role-playing game. The bot should be able to handle both regular dice rolls and modified rolls, where a modifier is added to the result. The bot should also log the results and any applied modifiers for debugging purposes... |
codefeedback | [
{
"from": "human",
"value": "Could you architect an intricate programming schema utilizing Ruby on Rails, that demonstrates the assembly of a RESTful API-driven web application, mandating the advanced integration of a Blockchain-oriented cryptographic technique, thereby fortifying the framework with a super... |
glaive | [
{
"from": "human",
"value": "I am using the DosBox emulator in my university to work with .asm files built with MASM. However, I find it tedious to manually build the .asm file every time by using masm, then pressing enter four times, entering link .obj, and pressing enter four more times. I have heard that... |
magicoder | [
{
"from": "human",
"value": "You are tasked with implementing a function that processes a dataset and calculates the rate of occurrence of a specific event. Additionally, the function should flip the data such that the original data is reversed. The function signature is as follows:\n\n```python\ndef proces... |
codefeedback | [
{
"from": "human",
"value": "Suggest an optimized solution to the following problem: Write a program that sorts a list of strings in alphabetical order using a divide-and-conquer approach. The program should handle a large number of strings (up to 10^6) efficiently. Implement your solution in Python. The in... |
magicoder | [
{
"from": "human",
"value": "You are tasked with implementing a file change notifier class in C++. The class should monitor file changes and prevent excessive recompilations due to rapid file changes. You are provided with a partial implementation of the `FileChangeNotifier` class, which includes an `Update... |
sharegpt | [
{
"from": "human",
"value": "I have a Pandas DataFrame that looks like this:\n\n```python\n A B \n0: some value [[L1, L2]]\n```\n\nI want to convert each list in column 'B' into individual rows, while keeping the corresponding value in column 'A' the same. The desired output would look li... |
glaive | [
{
"from": "human",
"value": "You are tasked with writing a script to check the existence of a specific file and verify its contents. You are required to create a new file object in a directory called \"target/site/apidocs/mjavadoc427\" and check if a file named \"App.html\" exists within that directory. If ... |
magicoder | [
{
"from": "human",
"value": "You are tasked with implementing a function to reverse a given string in C. Your task is to complete the implementation of the `str_reverse` function, which takes a pointer to a character array (string) as input and reverses the string in place.\n\nThe provided code snippet init... |
evolcodegolf | [
{
"from": "human",
"value": "The Scenario \nYou are provided with a foundational web page featuring 11 distinct elements: \n\n10 input elements designated with IDs ranging from i1 to i10, sequentially ordered \none output element assigned the ID out \n\nThe value attributes for these input elements are ... |
glaive | [
{
"from": "human",
"value": "Write a program that defines a function DLANGT that takes in the following arguments:\n- NORM (character*1): Specifies the value to be returned in DLANGT as described below.\n- N (integer): The order of the matrix A. N >= 0. When N = 0, DLANGT is set to zero.\n- DL (double preci... |
sharegpt | [
{
"from": "human",
"value": "How can I write code that finds common elements in two lists?"
},
{
"from": "gpt",
"value": "<think>\nOkay, I need to figure out how to write code that finds common elements in two lists. Let me start by thinking about what the problem is asking. So, given two lists,... |
dolphin | [
{
"from": "human",
"value": "convert this code to Haskell:\n```clojure\n(defn generate-number [s]\n (cond\n (or (empty? s) (and (= (first s) \\0) (= (last s) \\0))) '()\n (and (= (count s) 1) (= (first s) \\0)) [(str \"0.\" (subs s 1))]\n (= (last s) \\0) [s]\n :else (reduce #(conj %1 (str (sub... |
glaive | [
{
"from": "human",
"value": "Does the Python Enhancement Proposal (PEP) 8 style guide require whitespace around operators such as +, -, *, /, etc., in a function's arguments? For example, I have the following code:\n\n```python\nsome_list = range(a, b+1)\n```\n\nWhen I checked my coding style using the PEP8... |
sharegpt | [
{
"from": "human",
"value": "I am working on a project where I need to create a machine learning model for predicting the price of a house based on its square footage and number of bedrooms. Can anyone help me with the code to accomplish this in Python?"
},
{
"from": "gpt",
"value": "<think>\nOk... |
sharegpt | [
{
"from": "human",
"value": "How can I convert a Ruby time to JavaScript time and vice versa?\n\nRuby on Rails:\n```\nTime.now\n```\n\nJavaScript:\n```\nnew Date()\n```"
},
{
"from": "gpt",
"value": "<think>\nOkay, I need to figure out how to convert a Ruby Time object to a JavaScript Date and v... |
dolphin | [
{
"from": "human",
"value": "translate this code from c++ to PHP:\n```cpp\n#include <vector>\n#include <stack>\n\nclass Node {\npublic:\n int val;\n std::vector<Node*> children;\n\n Node() {}\n Node(int _val) {val = _val;}\n Node(int _val, std::vector<Node*> _children) {val = _val; children =... |
evolcodegolf | [
{
"from": "human",
"value": "Devise a program or function that accepts a positive integer as input (obtained through stdin, command line, or function argument) and generates a string that visually represents a sequence of small triangles, arranged in a tiled pattern that alternates their orientation. The ou... |
magicoder | [
{
"from": "human",
"value": "You are tasked with implementing a Python class for a sensor device. The class should have the following functionality:\n\n1. The class should be named `Sensor` and should inherit from the `Device` class.\n2. The `Sensor` class should have an `__init__` method that takes in thre... |
magicoder | [
{
"from": "human",
"value": "You are tasked with implementing a function that processes a given tree structure and modifies the attributes of its nodes based on certain criteria. The tree is represented as a collection of nodes, each having custom attributes such as position attributes, labels, and font siz... |
magicoder | [
{
"from": "human",
"value": "You are tasked with creating a script to automate the process of building and deploying a documentation website for a project. The project uses npm for package management and Git for version control. The provided code snippet demonstrates a part of the build and deployment proce... |
codefeedback | [
{
"from": "human",
"value": "Design an efficient algorithm for sorting a large array of integers in ascending order using the selection sort technique, ensuring that the time complexity is less than O(n^2) and the space complexity is less than O(n).\n\nAdditionally, modify the algorithm to handle arrays con... |
sharegpt | [
{
"from": "human",
"value": "How can I use R to calculate various descriptive statistics of a given data set?"
},
{
"from": "gpt",
"value": "<think>\nOkay, so I need to figure out how to use R to calculate descriptive statistics for a dataset. Let me start by recalling what descriptive statistic... |
codefeedback | [
{
"from": "human",
"value": "I am working on a clustering project on a dataset that has some numerical variables, and one categorical variable with very high cardinality (~200 values). I was thinking if it is possible to create an embedding for that feature exclusively, after one-hot encoding (ohe) it. I wa... |
glaive | [
{
"from": "human",
"value": "You are tasked with creating a Phoenix socket module for a contact application. The socket module should include the following functionalities:\n1. Define and use a Phoenix Socket\n2. Define a connect function that takes in socket parameters and verifies/authenticates a user\n3.... |
sharegpt | [
{
"from": "human",
"value": "How can I implement a scatter diagram rendering function using the matplotlib library in Python? I need the function to generate a graphical representation for a dataset of 1000 randomly generated data points. The scatter plot should use 'x' symbols as marker style and the color... |
glaive | [
{
"from": "human",
"value": "You are working on a project that involves a lot of git commands, and you find it time-consuming to type out the full commands every time. You want to create some custom aliases for your most frequently used git commands to save time and improve efficiency. Write a bash script t... |
evolcodegolf | [
{
"from": "human",
"value": "Examine a positive integer M represented in base b. Begin by identifying the smallest non-zero digit e in the representation of M, then express M in base e-1 and continue this process, generating a sequence until the base cannot be reduced further. For instance, the sequence pro... |
magicoder | [
{
"from": "human",
"value": "You are tasked with creating a Python decorator that logs the details of a Flask route function, including the HTTP method, route path, and function name. The decorator should also measure the execution time of the route function and log it. Your task is to implement the `pfms_d... |
magicoder | [
{
"from": "human",
"value": "You are tasked with creating a Python decorator that logs the execution time of a test method in a test suite. You will need to implement the decorator and apply it to a sample test method. The decorator should log the start and end time of the test method execution, along with ... |
glaive | [
{
"from": "human",
"value": "You are tasked with implementing a `Missions` constructor in Rust. The constructor should create multiple `Mission` objects and store them in a vector. Each `Mission` object represents different instructions used mainly in the `scanner::scan()` function. The constructor should a... |
codefeedback | [
{
"from": "human",
"value": "Develop a CSS selector to display all divs with the class \"container\" that are direct children of a parent div with the class \"wrapper\". Additionally, exclude any divs with the class \"exclude\" from the selection."
},
{
"from": "gpt",
"value": "<think>\nOkay, le... |
dolphin | [
{
"from": "human",
"value": "translate this code from java to Kotlin:\n```java\npublic int get_index_with_min_max_distance(int[] edges, int node1, int node2) {\n int[] dist1 = new int[edges.length];\n int[] dist2 = new int[edges.length];\n \n Arrays.fill(dist1, -1);\n Arrays.fill(dist2, -1);\... |
glaive | [
{
"from": "human",
"value": "You are tasked with creating a set of macros in assembly language for x86-64 architecture to handle interrupt handlers. You need to define two macros, PUSH_REG and POP_REG, that will be used to push and pop general purpose registers onto the stack, respectively. The PUSH_REG mac... |
evolcodegolf | [
{
"from": "human",
"value": "Generate and output the precise coordinates of the vertices of a three-dimensional geometric figure, specifically a cube. Following this, create and provide a comprehensive list of twelve triangular facets that will entirely encompass the cube, ensuring each triangle is represen... |
codefeedback | [
{
"from": "human",
"value": "How can you find the maximum element in an array using the reduce() method while ensuring that the array contains at least 10 elements and that the maximum element is greater than or equal to 100?"
},
{
"from": "gpt",
"value": "<think>\nOkay, so I need to find the ma... |
magicoder | [
{
"from": "human",
"value": "You are tasked with creating a script that retrieves the latest release version of a given GitHub repository. Your script should utilize the `curl` command to fetch the release information from the GitHub API and then extract the latest release version using `grep` and `sed`. Ad... |
magicoder | [
{
"from": "human",
"value": "You are tasked with creating a program to manage hardware inventory for a computer rig. The program should allow users to add, remove, and list hardware parts, as well as their types. Each hardware part has a unique ID, a description, and belongs to a specific hardware type. The... |
codefeedback | [
{
"from": "human",
"value": "You are working on a program to analyze clusters of data. The program uses a data structure called `ClusterCounts` to store the counts of different cluster sizes and a data structure called `PValues` to store the p-values associated with the clusters. The code snippet provided i... |
sharegpt | [
{
"from": "human",
"value": "How can I write a Python program that takes an input date in the format \"yyyy-mm-dd\" and prints out the corresponding day number of the week (1-7)?"
},
{
"from": "gpt",
"value": "<think>\nOkay, I need to write a Python program that takes a date in the format \"yyyy... |
evolcodegolf | [
{
"from": "human",
"value": "Given a polynomial in one variable with rational coefficients, output an equivalent expression containing only 1, variables, and definite integrals, while ensuring that each integral is of the form ∫[lower limit][upper limit] f(x) dx. For example, -x^2 can be expressed as ∫x∫111... |
dolphin | [
{
"from": "human",
"value": "Please explain the reasoning behind the following solution and provide code in javascript:\nGiven a string s, return _all the palindromic permutations (without duplicates) of it_.\n\nYou may return the answer in **any order**. If `s` has no palindromic permutation, return an emp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.