instruction_seed stringlengths 17 40.5k | source stringclasses 10
values |
|---|---|
How can I write a regular expression to find all email addresses with the domain ending in ".com"? | glaive |
Code a function in C that takes an integer array and its size as two arguments and returns the median of these numbers. Additionally, provide a piece of erroneous code as a reference to increase misdirection.
array = [1,2,3,4,5]
size = 5 | codefeedback |
Two neon signs are turned on at the same time. Both signs blink as they are turned on. One sign blinks every 9 seconds. The other sign blinks every few seconds. They will blink together again in 45 seconds. How often does the second sign blink? | tiger_math |
You are tasked with creating a function that reads a file, filters out lines starting with #, and returns a random line from the remaining lines. The function should take the file path as an argument and return the randomly chosen line. You should also create a function that takes a list of items and returns a random i... | glaive |
convert this code from Dart to Object Pascal:
```dart
List<int> intervalFinding(List<List<int>> intervals, List<int> queries) {
intervals.sort((a, b) => a[0].compareTo(b[0]));
List<int> ans = [];
for (int q in queries) {
int minSize = double.infinity.toInt();
for (List<int> interval in intervals) {
... | dolphin |
A and B’s salaries together amount to Rs. 2,000. A spends 95% of his salary and B spends 85% of his. If now their savings are the same, what is A’s salary?
Answer Choices: (A) 1888 (B) 2676 (C) 1297 (D) 1500 (E) 1678 | tiger_lab_math |
The treasurer of a football team must buy equipment for the sixteen players of his team. Each piece of equipment consists of a $25 jersey, a certain amount for a pair of shorts, and a pair of socks at $6.80. The total cost of all the equipment for all the players on the team is $752. How much does each pair of shorts c... | tiger_math |
Given a set of seven concentric circles, such that the radius of the smallest circle is 1, and the radius of each subsequent circle is 2 more than the previous one. Three parallel lines are drawn, such that the length of their segments within the seven circles are 3, 4, and 5 units long, respectively. Find the perimete... | nvidia_math |
If a regular polygon has interior angles measuring 120 degrees, how many sides does the polygon have? | tiger_math |
Input:
1
X
X
X
X XX XXXXXX X X X
X XX XXXXXX X X X
XXX X XX XXXXXX X X X
XXX X XX XXXXXX X X X
Output:
X. ... | evolcodegolf |
You are tasked with creating a Python script that automates the process of organizing files in a directory. Your script should categorize files based on their extensions and move them into separate subdirectories. For example, all ".txt" files should be moved to a "txt_files" subdirectory, all ".jpg" files to a "jpg_fi... | magicoder |
You are tasked with writing a bash script to create a build directory, configure it using CMake with specific options, and then build and install the application.
Write a bash script that performs the following tasks:
1. Create a directory called "build".
2. Change into the "build" directory.
3. Use CMake to configure... | glaive |
What is the SHA-256 hash value of the message "math is awesome!"? | tiger_lab_math |
You need to generate an SQL query that will return records from a table called "users" where the name matches the given parameter. However, the parameter can be in uppercase or lowercase, and the query should be case-insensitive. Additionally, the name parameter can contain wildcards, such as '%' to match any number of... | codefeedback |
You are tasked with creating a Python program that simulates a simple UDP server for receiving and processing data packets. The program should prompt the user for an IP address, create a UDP socket, bind it to a specific port, and then continuously receive and process incoming data packets.
Your task is to complete th... | codefeedback |
Let \( X \) be a random variable with mean \( \mathbb{E}[X] \) and variance \( \text{Var}(X) \). Define the hyper skewness of \( X \) as the fifth standardized moment given by
\[
H(X) = \frac{E[(X - \mathbb{E}[X])^5]}{\text{Var}(X)^{5/2}}.
\]
Assuming that \( X \) follows a uniform distribution on the interval \( [0... | automath |
Design a computational model that generates a sequence of fractal patterns based on user-defined parameters. The generated sequence should include an algorithm that modifies the existing patterns through a specific transformation, and then create another algorithm that, when given the output of the transformation, reco... | evolcodegolf |
Please focus on the algorithm of this problem and provide code in ANSI C:
You are given a 2D integer array `logs` where each `logs[i] = [birthi, deathi]` indicates the birth and death years of the `ith` person.
The **population** of some year `x` is the number of people alive during that year. The `ith` person is coun... | dolphin |
Develop a convolutional neural network (CNN) for image classification using a deep learning framework. The CNN should have at least 5 convolutional layers and 2 fully connected layers. Each convolutional layer should have a different number of filters and kernel sizes. Implement a suitable activation function for each ... | codefeedback |
You are tasked with implementing a memory aliasing and control dependence system in MLRISC. You need to create a signature that specifies the MLRISC annotations for describing memory aliasing and control dependence. The signature should include the definition of regions, mutability types (READONLY, IMMUTABLE, MUTABLE),... | glaive |
Given the data points \((2, 1), (5, 2), (7, 3), (8, 3)\), find the least-squares line \(y = \beta_0 + \beta_1 x^*\) in mean deviation form where \(x^* = x - 5.5\). Compute the coefficients \(\beta_0\) and \(\beta_1\) and provide the final equation of the least-squares line. | automath |
Summary
A teacher has been assigned the task of devising word problems for her students based on a provided set of mathematical equations. However, due to her lackadaisical nature, she refrains from employing much imagination in her work and opts for a straightforward and literal transcription of the equations. For i... | evolcodegolf |
Please focus on the efficiency of this problem and provide code in Fortran:
Given a `matrix` and a `target`, return the number of non-empty submatrices that sum to target.
A submatrix `x1, y1, x2, y2` is the set of all cells `matrix[x][y]` with `x1 <= x <= x2` and `y1 <= y <= y2`.
Two submatrices `(x1, y1, x2, y2)` a... | dolphin |
Design a method which takes in two sorted arrays of integers, `arr1` and `arr2`, of size `n` and `m` respectively. The method should return a new sorted array of size `n + m`.
The method should handle the following cases:
1. If either `arr1` or `arr2` is empty, the method should return the non-empty array as the resu... | codefeedback |
You are tasked with implementing a function that processes a dictionary of widgets and their respective quantities. The function should calculate the total cost of the widgets based on their unit prices and quantities. Each widget is represented by a unique identifier (string) and has an associated unit price (float) a... | magicoder |
If $y$ is a negative number and $y^2 = 1681$, what is the value of $y$? | tiger_math |
You are tasked with implementing a logging system for a software application. The logging system should support different levels of logging, flags, and colors for the log messages. You need to create a class `ToolLogger` with a method `log` that takes in the level of the log message, a flag, a color, the log message da... | magicoder |
Craft a CSS-based animation mechanism capable of instigating a three-dimensional, longitudinal rotation of a web component through a full 360 degrees, ensuring the feature remains anchored at the midpoint of the web page throughout the animation process. | codefeedback |
You are tasked with creating a Python program that organizes files in a directory and extracts the filenames without their extensions. Your program should perform the following tasks:
1. Create a new directory named `dir` using the `os` module.
2. Extract the filenames of all the files in the directory `mlresume` witho... | magicoder |
Two positive real numbers have a geometric mean of $\sqrt{3}$ and a harmonic mean of $\frac{3}{2}$. Find the sum of the two numbers. | tiger_math |
A $5 \times 8$ rectangle can be rolled to form two different cylinders with different maximum volumes. What is the ratio of the larger volume to the smaller volume? Express your answer as a common fraction. | nvidia_math |
You are working on a Django web application that manages information about passengers and drivers. The code snippet provided includes two Django model classes: `Passenger` and `Driver`. Each class has a method `get_absolute_url` that returns the URL for the detail view of the respective object.
Your task is to impleme... | magicoder |
A regular pentagon has each of its sides measuring 25 cm. What is the distance from the center of this pentagon to any of its vertices? Write a Python function to solve this. If the input is not a number, the function should raise a ValueError. | sharegpt |
I need to include a custom file, specifically ("/com/app/log4.properties"), in the final JAR file. Currently, my JAR file only contains class files. I am using the following command: "mvn assembly:assembly". How can I add this file to my JAR when using the "jar-with-dependencies" option? Below is my pom.xml configurati... | sharegpt |
Classify each word in this sentence into its specific part of speech, while also considering the tense and form of verbs, degrees of adjectives and adverbs, and distinguishing between common and proper nouns. Proper nouns must be capitalized. Additionally, implement a feature to detect and classify compound words as a ... | codefeedback |
You are tasked with creating a Scala project that includes dependencies for date/time, testing, JSON processing, HTTP client and server, and SFTP client. Your project also needs to include build information and a reference to another project. Write the build.sbt file and necessary code to fulfill these requirements. | glaive |
You are tasked with implementing a service in the java lizard.api.TLZ namespace using the BinaryRDF.thrift library. The service, TLZ_Index, is responsible for managing various indexing operations. Specifically, you need to implement the following methods:
1. idxAdd: Adds a single tuple to the specified shard index.
2. ... | glaive |
How can I create a program that counts the number of occurrences of a specific element in a given array? | sharegpt |
Given a erroneous algorithm, correctly rectify and implement a function in Python to calculate the sum of the given array of numbers, including the nested arrays (if any exists).
Array: [2, 3, [8, 9], 5]
Wrong Algorithm:
```python
def calc_sum(arr):
total = 0
for num in arr:
total *= num
return t... | sharegpt |
Solve the equation:
z^2 - (3 - 4i)z + 13i = 0
where z is a complex number. | tiger_lab_math |
Jordan wants to divide his $\frac{48}{5}$ pounds of chocolate into $4$ piles of equal weight. If he gives one of these piles to his friend Shaina, how many pounds of chocolate will Shaina get? | tiger_math |
I am trying to perform GPU convolution using the overlap-and-save method. I want to calculate the convolution of a given input signal with a set of filters using the custom Fast Fourier Transform (FFT) implemented on the GPU. The input signal and the filters are in the time domain, and I need to perform the convolution... | glaive |
Find one-third of 9 times 7. | nvidia_math |
You are tasked with creating a Python program to send an email using the `smtplib` library. Your program should prompt the user to input their email address, password, the recipient's email address, and the email message. The program should then send the email using the provided credentials and message.
Your program s... | magicoder |
Out of 8 persons working on a project, 4 are graduates. If 3 are selected, what is the probability that there is at least one graduate among them?
Answer Choices: (A) A) 5/7 (B) B) 5/4 (C) C) 5/14 (D) D) 5/6 (E) E) 9/14 | tiger_lab_math |
240 students are divided into 12 classrooms. How many students will be in 8 classrooms? | nvidia_math |
Given the survey results from a private university and a public university, determine if the difference in the proportions of alumni who attended at least one class reunion is statistically significant at the 0.05 significance level. The private university has a sample of 1048 alumni, with 647 attending at least one re... | automath |
Consider the following graph:
```
1 - 2
/ \
3 4
/ \ / \
5 6 7 8
```
Find the minimum vertex cover of the given graph. | tiger_lab_math |
Connie saved up some money. She wants to buy a watch that costs $55. Connie needs $16 more to buy the watch. How much money did Connie save up? | tiger_math |
Create a JavaScript program that takes an array of numbers and returns an object with three properties: "positiveSum", "negativeSum", and "zeroSum".
The "positiveSum" property should represent the sum of the squares of all the unique positive numbers in the array. Duplicate positive numbers should be excluded from th... | codefeedback |
You are tasked with creating a Python program that simulates a simple color dictionary. The dictionary will store color names as keys and their corresponding RGB values as tuples. Your program should provide functionality to add new colors, update existing colors, retrieve RGB values for given color names, and remove c... | magicoder |
There is a playground that is surrounded by a square fence that has a side length of 27 yards. There is a 12 yard by 9 yard garden that has fencing around it. How many yards of fencing do the playground and garden have together? Let's write a Python program. | tiger_lab_math |
You are tasked with creating a Python function that processes a list of module names and returns a new list containing only the module names that can be successfully imported. If a module cannot be imported, it should be excluded from the resulting list. You should handle any potential import errors gracefully.
Your t... | magicoder |
Please focus on the algorithm of this problem and provide code in python:
You are given an elevation map represents as an integer array `heights` where `heights[i]` representing the height of the terrain at index `i`. The width at each index is `1`. You are also given two integers `volume` and `k`. `volume` units of wa... | dolphin |
Can you provide a function that takes any number of arguments and returns the smallest number among them? | glaive |
How can I replace all occurrences of a given character in a string with asterisks using an AI? | glaive |
How can I implement a web socket server in Node.js that displays message history to connected users? | sharegpt |
You are tasked with implementing a program that uses the C language to define a set of compiler flags and object files for a specific microcontroller. The program should include the necessary header files and define the stack size for a fiber. | glaive |
My profiler has identified the following function profiling as the hotspot.
```cpp
typedef unsigned short ushort;
bool isInteriorTo( const std::vector<ushort>& point , const ushort* coord , const ushort dim )
{
for( unsigned i = 0; i < dim; ++i )
{
if( point[i + 1] >= coord[i] ) return false;
}
... | sharegpt |
A function or program that accepts inputs and produces outputs can be characterized as having a cycle if invoking the function using its own output repeatedly ultimately returns to the original value. For example, consider the following function:
Input: n 1 2 3 4 5 6
Output: f(n) 5 7 1 3 4 9
Starting with n=... | evolcodegolf |
Rhea buys 2 trays of eggs every week for her family. Her son and daughter eat 2 eggs every morning, and Rhea and her husband eat 4 eggs every night. If each tray has 24 eggs, how many eggs are not being eaten every week? | tiger_lab_math |
I have a dataset and I need to generate an appropriate XML schema for it. Can someone help me with this? | glaive |
I take variable $b$, double it, and add four. I subtract $4b$ from this new expression, and divide the resulting difference by two. What is my final expression in simplest form? | nvidia_math |
Scores
This section will be filled in as submissions are entered.
Normal
1. bopjesvla Perl 54
2. edc65 Javascript (ES6) 91
3. name language score
4. name language score
5. name language score
Bonus Round
1. name language score
2. ... | evolcodegolf |
You are tasked with implementing a simple syntax checker for a custom programming language. The language uses curly braces for defining code blocks, and your task is to identify and report any missing or mismatched braces in the code.
You are given a snippet of code as a string. The code may contain any combination of... | magicoder |
You are tasked with creating a Python program that sets up a simple HTTP server using the `SocketServer` and `SimpleHTTPServer` modules. Your program should prompt the user to input a hostname and a port number. Then, it should use the `socket.gethostbyname` function to resolve the hostname to an IP address and create ... | magicoder |
A box contains 5 different kinds of fruit: apples, bananas, oranges, pears, and peaches. There are 6 apples, 4 bananas, 3 oranges, 2 pears, and 2 peaches. In how many ways can you choose 3 pieces of fruit so that you get exactly one fruit of each of 3 different kinds? | nvidia_math |
According to RollingStone, below are the 26 greatest singers of all time:
Aretha Franklin Al Green
Ray Charles Robert Plant
Elvis Presley Mick Jagger
Sam Cooke Tina Turner
John Lennon Freddie Mercury
Marvin Gaye Bob Marley
Bob Dylan ... | evolcodegolf |
You are tasked with creating a Python class that manages channel aliases for different user types in a messaging system. The system has a predefined key, help category, and user controller. Your task is to create a class that inherits from the `AbstractChannelAdminCommand` and implements the necessary functionality for... | magicoder |
Maria has a peach tree in her garden. 7 peaches are hanging on the branches, and 12 have fallen to the ground. If Maria's rabbit eats 4 of the peaches off of the ground, how many peaches are left? | nvidia_math |
I have two tables, `youtubevideo` and `views`, with the following structure:
```
youtubevideo
id - int
allViews - relational
views
id - int
youtubevideo_id - int
viewCount - int
firstFetch - date
```
The `youtubevideo` table has a one-to-many relationship with the `views` table in a Symfony entity.
Now, I have two ... | sharegpt |
I want to create a program that can solve mathematical expressions. How can I write an AI code that takes a given expression and returns the result? | sharegpt |
On Rudolph's car trip across town, he traveled 2 more than 5 miles and encountered 3 less than x stop signs. Rudolph encountered 2 stop signs per mile on his trip across town. What is the value of unknown variable x? What is the value of unknown variable x? | tiger_math |
You have been tasked with creating a program that involves defining multiple nested structs and populating them with data. The program should then perform a series of tests to ensure that the data is correctly stored and accessible within the nested structs. Additionally, the program should include a process for saniti... | glaive |
A librarian had $150 to purchase three different types of books. A fiction novel costs $10. A biography costs 1.5 times the price as the fiction novel, while a reference book costs twice the price as the biography. How much change did she receive after buying those three different types of books? | nvidia_math |
You are tasked with implementing a Users API for a secured application. This API should allow for the creation, retrieval, updating, and deletion of user accounts, as well as the ability to mark users as administrators and activate or deactivate accounts.
Your task is to design and implement the following endpoints fo... | glaive |
Two trains running in opposite directions cross a man standing on the platform in 25 seconds and 18 seconds respectively and they cross each other in 20 seconds. The ratio of their speeds is:
Answer Choices: (A) 3 : 1 (B) 3 : 2 (C) 3 : 8 (D) 2 : 5 (E) 3 : 4 | tiger_lab_math |
I am working on a Python program and I want to optimize its running time using memoization. Can anyone help me with this? | sharegpt |
You are tasked with creating a program that can accept a visitor and then visit a field declaration. Your program should be able to handle different types of field declarations and perform the appropriate actions based on the visitor's behavior. | glaive |
You are tasked with creating a Python script that manages dependencies for a package. The script should read a configuration file, create a directory for dependencies if it does not exist, and handle command-line arguments to determine whether it is being run as a standalone script or as a submodule.
Your task is to i... | magicoder |
How can I write a Python program that encodes a string into Base64 representation? | glaive |
Please explain the following problem in detail and provide code in c++:
Given a **0-indexed** integer array `nums` of length `n` and an integer `k`, return _the **number of pairs**_ `(i, j)` _where_ `0 <= i < j < n`, _such that_ `nums[i] == nums[j]` _and_ `(i * j)` _is divisible by_ `k`.
**Example 1:**
**Input:** num... | dolphin |
Suggest a code segment to render a greeting message in a terminal window using Python. However, the message should be displayed in a different color than the default color of the terminal. | codefeedback |
Given a surface charge density \(\sigma\) distributed on a surface \(S\), how would you express the associated volumetric charge density \(\rho(\vec{r})\) in terms of \(\sigma\) using the Dirac delta function? Specifically, what is the form of \(\rho(\vec{r})\) and how does it relate to \(\sigma\) when integrating over... | automath |
convert this code to Visual Basic .NET:
```javascript
function ipToCIDR(ip, n) {
const [a, b, c, d] = ip.split('.').map(Number);
let start = (a << 24) + (b << 16) + (c << 8) + d;
const end = start + n - 1;
const ans = [];
while (start <= end) {
let samePrefixBits = Math.clz32(~(start & ... | dolphin |
Your objective involves developing a program (or function) that requires no input and generates an output formatted as follows:
## *name*, *length* bytes
*code*
In this format, *name* should indicate the programming language utilized, *length* represents the byte count of your code, and *code* is the source code o... | evolcodegolf |
port this code from Scheme to Erlang:
```scheme
(define (get-next n)
(define (sum-of-squares digit)
(* digit digit))
(define (sum-of-digits n)
(if (zero? n)
0
(+ (sum-of-squares (remainder n 10))
(sum-of-digits (quotient n 10)))))
(sum-of-digits n))
(define (is-happy n)
(de... | dolphin |
Please explain the following problem in detail and provide code in Dart:
You are given an `m x n` binary matrix `grid`.
A **move** consists of choosing any row or column and toggling each value in that row or column (i.e., changing all `0`'s to `1`'s, and all `1`'s to `0`'s).
Every row of the matrix is interpreted as... | dolphin |
Can you provide a JavaScript function that can evaluate a postfix expression? | sharegpt |
Devise a mapping function g that transforms sequences of hexadecimal digits into sequences of hexadecimal digits, ensuring that applying g twice on any input sequence h results in a cycle that rotates the characters of h by three positions to the right. By "rotate," I mean that the last three characters of the string w... | evolcodegolf |
A certain telescope increases the visual range at a particular location from 90 kilometers to 150 kilometers. By what percent is the visual range increased by using the telescope ?
Answer Choices: (A) 30% (B) 33 1/2% (C) 40% (D) 60% (E) 66 2/3% Let's write a Python program. | tiger_lab_math |
Is there a way to convert the given code to use built-in type functions instead of importing the math module? | sharegpt |
How can I modify the code to print "happy" when the input is "happening"? | sharegpt |
In how many distinct ways can the letters of the word "LETTER" be arranged in a grid of 5 rows and 11 boxes, ensuring that no row is empty and each box contains at most one letter, considering that the letters L and E are identical? | automath |
In which complete metric spaces does closed and bounded imply sequential compactness, apart from finite-dimensional normed spaces? Are there infinite-dimensional examples of such spaces? | automath |
Given the following dataset for a linear regression problem:
```
x = [6.1101, 5.5277, 8.5186, 7.0032, 5.8598, ...] # (representing 'x' values)
y = [17.592, 9.1302, 13.662, 11.854, 6.8233, ...] # (representing 'y' values)
```
If we define the cost function for linear regression using the matrix \( X \) (with a colum... | automath |
You are tasked with creating a Node.js function that takes in a file and converts it to a specified output format. The function should be able to handle different input file types (e.g., pdf) and output formats (e.g., jpg, png) and also allow for custom conversion settings (e.g., density, quality, etc.).
Create a func... | glaive |
Consider a function defined by \( f(x, y) = x^2 + y^2 \).
1. If we evaluate this function at the point \( (3, 4) \), what is the value of \( f(3, 4) \)?
2. Additionally, if we define a new function \( g(x, y) = f(x, y) + 10 \), what is the value of \( g(3, 4) \)? | automath |
In triangle ABC, let AD and BE be the altitudes from vertices A and B to sides BC and AC, respectively. Given that AC = 10, BC = 18, and the length of altitude AD = 5, what is the length of altitude BE? | automath |
Can someone help me write a program that generates a list of all the unique numbers between 101 and 1000? | sharegpt |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.