instruction_seed stringlengths 29 40.5k | source stringclasses 6
values |
|---|---|
Develop a comprehensive solution for a Sentiment Analysis task using Huggingface Transformers. Your solution must consist of functions to preprocess and clean data from a TXT file, which includes data structured as 'review' and 'sentiment'. Additionally, implement a methodology to deal with any missing data or outliers... | codefeedback |
Create a method to solve the problem of finding the maximum sum of exactly k cells in an NxN grid, where N is a minimum of 2, making sure to remain within the grid's limits. Each cell in the grid has a unique value in the range of 1 to N*N. Begin from any cell and proceed to adjacent cells that share an edge. Provide a... | codefeedback |
Update the following SQL query to return all the values in the `students` table, ordered by the students' GPA in descending order. Only include students who have completed at least 60 credits and are majoring in either Computer Science or Engineering. Additionally, exclude any students whose GPA is below 3.5 and have n... | codefeedback |
You are tasked with implementing a data structure and its associated methods for managing operations and their bindings. The data structure, named `OperationManager`, should support adding operations, specifying provided bindings, and determining if a given binding is within the provided set for a specific operation.
... | codefeedback |
Change the following Python code to convert the list to a dictionary of key-value pairs. Each key should be the corresponding element in the list, and each value should be a list containing the index of the element in the original list, the square of the element, the cube of the element, and the factorial of the elemen... | codefeedback |
You are tasked with creating a program to manage the emailing of PDF reports to users based on certain conditions. The program should interact with a database of users and their AWS keys, and use a template to generate the email content. The following requirements should be met:
1. The program should use a template na... | codefeedback |
Write a PowerShell script to list all the installed applications on a Windows machine, excluding any applications that start with the letter "A". Additionally, exclude any applications that have a file size larger than 1GB. The script should also display the installation date of each application and sort the list in de... | codefeedback |
You are tasked with creating a Python class that handles the compression and manipulation of zip files. Your class should have the following functionalities:
1. `add_file(filename, content)`: A method that takes a filename and its content as input and adds it to the zip file.
2. `set_file_permissions()`: A method that... | codefeedback |
Write a program that checks if a given input number is a prime number within a given range, using the Miller-Rabin primality test algorithm. | codefeedback |
Create a Python function named "Transpile" that takes in four arguments: "src_dir", "dst_dir", "model_filename", and "params_filename". Inside the function, create a CPUPlace object and an Executor object using Paddle Fluid. Then, create a Scope object using fluid.core.Scope(). Load the inference program, feed target n... | codefeedback |
Create an interactive website for a hypothetical online store. The website should have features for listing products, adding products to a cart, and allowing customers to make purchases. | codefeedback |
Design a Python-built robust password validation program that verifies the security of a provided password. The password should meet more strict security criteria mentioned below. These criteria must be satisfied utilizing regular expressions and string methods, if possible:
1. The password must contain a minimum of 1... | codefeedback |
Parse and extract the title of this HTML page.
<html><head><title>This is the Page Title</title></head></html> | codefeedback |
What is the importance of writing unit tests? Provide a specific example of a bug that could have been caught by a well-written unit test and explain how the test would have helped in identifying and fixing the bug. | codefeedback |
You are tasked with creating a program that analyzes HTML code to extract and count the occurrences of specific style attributes within the `<div>` and `<table>` tags. The program should be able to identify and tally the occurrences of the following style attributes: `border`, `padding`, `margin-top`, and `margin-botto... | codefeedback |
Create a CSS rule to set the font-size of all paragraph elements inside a div with the class "container" to 10px, but exclude any paragraph element with the class "exclude". | codefeedback |
Intensify the complexity of the programming evaluation query in the following manner:
You are tasked to program two disparate recursive functions: `is_palindrome` and `make_palindrome`. The `is_palindrome` function must yield a boolean entity, thus indicating if the input string constitutes a palindrome or not, ensuri... | codefeedback |
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 | codefeedback |
Construct a recursive algorithm to identify the smallest integer within a provided array, also determining its position within the array. Your solution must refrain from utilizing any pre-existing or library functions. Be aware that the array could potentially contain repeated integers. | codefeedback |
I have this deep neural network model with an integer label to predict. The label is heavily skewed so we cap the labels at some value (let's say 90 %ile).
Now when we build and run the model, it performs well in general. But in online experiment shows degradation in business metrics for a fraction of users that have h... | codefeedback |
Increase the difficulty of the given programming test question by adding additional requirements and constraints.
Implement a decision tree as a class in Python.
You are given a dataset containing information about patients and whether they have a certain disease or not. The dataset consists of the following columns:... | codefeedback |
You are given a code snippet that contains escape sequences and color codes. Your task is to write a program that can parse these escape sequences and extract the color codes from the snippet.
The escape sequences are represented as `^[]` followed by a number and a semicolon, and the color codes are represented as hex... | codefeedback |
You are given a string "hello". Write a function to print out all the possible subsets of that string. | codefeedback |
You are tasked with implementing a Python class that manages a two-dimensional grid of cells. The class should provide methods for initializing the grid, accessing and modifying individual cells, and performing operations on the entire grid.
You are given a code snippet from the `__init__` method of the class:
```pyt... | codefeedback |
Expand the Python script that determines the physical location (latitude and longitude) of a given IP address to also find the ISP(Internet Service Provider) for that IP address and calculate the distance between that location and a provided secondary location (latitude and longitude).
The script should also handle er... | codefeedback |
Outline the best machine learning model to analyze a recursive data structure and capture binary-encoded audio data. | codefeedback |
Write a regular expression to match the valid hex color code. | codefeedback |
Create a Java program that prints the Fibonacci sequence up to a certain number entered by the user and also handles possible errors by adding exception handling. Also, provide a piece of code as a reference that has a minor error. The candidate needs to identify and fix this before proceeding to write their method. Th... | codefeedback |
Compose a basic blockchain system in Python. | codefeedback |
You are tasked with creating a custom templating engine for a web framework. Your templating engine should be able to process and render template files containing directives and include statements.
A directive is a special instruction enclosed within `@` symbols, and it can be used to perform various operations such ... | codefeedback |
You are given a list of strings, each representing a word, along with their corresponding hexadecimal values. Your task is to write a function to convert the hexadecimal values back to their original words and return the resulting list of words.
You should write a function `hex_to_words(hex_list: List[str]) -> List[st... | codefeedback |
Since different brokers and data providers might apply their own additional offsets to the spreads of the same instruments, what are some concerns that might rise if we merge their data to create a longer historical data to backtest on.
i.e concatenating tick data of one period from data provider 1 to the tick data fro... | codefeedback |
Implement a function that creates a dictionary from two lists which contain the keys and values, respectively. The function should handle cases where the keys list may contain duplicate values and the values list may contain different data types. Additionally, the function should ignore any keys that are empty strings ... | codefeedback |
You are tasked with implementing a string replacement function that will replace placeholders in a given body of text with corresponding strings. The placeholders are in the format "{@code}" where "code" is a unique identifier for each placeholder. Additionally, certain strings may need to be modified based on specific... | codefeedback |
Can you provide me with a comprehensive example of a Python dataclass that showcases the best practices for working with dataclasses, particularly in terms of inheritance and polymorphism? Additionally, the example must ensure that attributes maintain a specific order and uniqueness, and the class should also have a va... | codefeedback |
Modify the code to make an HTTP request to a given URL.
request = {
type: "GET"
} | codefeedback |
Develop a Java code to build a class 'Planet' that includes three attributes - 'name', 'radius', and 'orbitPeriod'. In addition, incorporate methods that calculate and return the planet's volume and orbital speed considering it as a sphere. Be sure to provide error handling. | codefeedback |
Function won't work and will raise error pointing out to the adehabitatMA dependency. My arguments are correct i.e., a 'bathy' object, a 2-col dataframe and radius in decimal degrees. | codefeedback |
Design an algorithm in Python for reversing a doubly linked list. Keep in mind that a doubly linked list has references to both the next node in line and the previous one. Additionally, to increase the difficulty of the task, consider the following inefficient and erroneous piece of code as a reference. Your goal is to... | codefeedback |
I have the following optimisation problem which I want to solve using linear optimisation.
[](https://i.stack.imgur.com/hlUZp.png)
Is there a way to represent the second constraint in a linear form in order to be able to use linear optimisation ? | codefeedback |
Create a responsive webpage using HTML, CSS, and JavaScript that has a navigation bar with a logo, five links to different webpages, and a footer. Implement a dropdown menu in the navigation bar when viewed on smaller screens. Use media queries to ensure that the webpage layout adjusts accordingly on different screen s... | codefeedback |
You are given a code snippet that defines a data structure for mapping superkey positions to subkey positions and vice versa. The code snippet includes declarations for `key_to_subkey`, `subkey_to_key`, and `removed_positions`. Your task is to implement a function that efficiently updates these data structures based on... | codefeedback |
Develop a Python function that curtails a provided string to only exhibit the initial 4 distinct characters in the lexicographical sequence and yields the unique character set. If the string possesses fewer than four distinct characters, only the unique characters should be displayed.
The function should also incorpor... | codefeedback |
Create a JavaScript function for sorting a two-dimensional array of numbers in ascending order. Each sub-array should be sorted first, followed by the whole array itself. Do not use JavaScript’s built-in sort() function. Instead, use a sorting algorithm you can implement manually such as bubble sort, selection sort, in... | codefeedback |
Implement the Gnome sort algorithm in Python.
Note: You are not allowed to use any built-in sorting functions or libraries for this implementation. Additionally, you must implement the algorithm using a recursive approach. | codefeedback |
Create an algorithm that uses a hash table to detect if an element is a duplicate. The algorithm should also return the frequency of each duplicate element in the array. Additionally, the algorithm should handle cases where the array contains negative numbers and floating-point numbers. The input array can have a maxim... | codefeedback |
I have this problem : Arranging Coins with Constraints
Description are as below: You have a total of n coins that you want to form in a staircase shape, where every k-th row must have exactly k coins. Additionally, every 3rd row must have an extra coin.
Given n, find the total number of full staircase rows that can be... | codefeedback |
Can you rewrite this function in Java?
from google.cloud import bigtable
from google.cloud.bigtable import column_family
from google.cloud.bigtable import row_filters
def main():
# The Google Cloud project ID
project_id = 'YOUR_PROJECT_ID'
# The ID of the Cloud Bigtable instance
instance_id = 'YOUR_INS... | codefeedback |
You are tasked with implementing a simple banking system using Python. The system should support the creation of bank accounts, deposits, withdrawals, and transfers between accounts. Each bank account should have a unique account number, and the system should be able to handle multiple accounts.
Your task is to implem... | codefeedback |
Please enhance the difficulty of given programming test question:
Enhanced Prompt:
Write and troubleshoot a Python function named `intersperse` that accepts a list of integers `numbers` and an integer `delimeter`. The function should return a new list where a `delimeter` is placed between every pair of consecutive el... | codefeedback |
You are given a list of characters representing individuals standing in a line. Each individual is either a police officer ('P') or a thief ('L'). The objective is to find the maximum number of thieves that can be caught given a specific capture distance.
Write a function `max_thieves_captured` that takes in two para... | codefeedback |
Develop a program that optimizes SVG files for faster loading on the web. The program should not only minimize the file size but also ensure that the quality of the SVG is not compromised. Additionally, the program should be able to handle batch processing of multiple SVG files.
To increase the difficulty, the progra... | codefeedback |
You are tasked with implementing the `Equatable` protocol for the `EthereumAddress` type in Swift. An Ethereum address is a 20-byte (40-character) hexadecimal address used to identify an Ethereum account. The `EthereumAddress` type is represented as a string in Swift. Your task is to define the `static func ==` method ... | codefeedback |
Given an array of strings, can you create a function that calculates the maximum contiguous sum of the lengths of a subarray such that no two strings in the subarray have any common characters? Additionally, can you explain how the function utilizes a hash table to keep track of the characters in each string and the ti... | codefeedback |
Write a Python function that takes two lists of equal length and creates a dictionary of the elements in each list that have the same index. The function should also handle cases where the input lists are not of equal length and provide appropriate error handling. Additionally, the function should handle cases where th... | codefeedback |
Help me translate to C++
import psycopg2
import pandas as pd
from psycopg2 import OperationalError
# Replace database information accordingly
database_configurations = [
{"dbname": "database1", "user": "user1", "password": "password1", "host": "localhost"},
{"dbname": "database2", "user": "user2", "password": ... | codefeedback |
Write a Python program that uses recursion to implement the Fibonacci sequence, but do it in such a way that doesn't utilize any form of loop or inbuilt Python recursion mechanisms. Furthermore, optimize your code to ensure the program can efficiently calculate and return the 50th number in the Fibonacci sequence. Addi... | codefeedback |
Create a function that takes in a list of integers and returns a new list where each element is the product of the previous and next elements in the original list. The first and last elements in the original list should be treated as if they have a previous or next element of 1. The function should have a time complexi... | codefeedback |
Compose a loop in PHP language that conducts a mathematical computation to find the accumulative total of each individual integer element encompassed within this predetermined array: [2, 3, 8, 9]. | codefeedback |
Use the following movie review dataset https://raw.githubusercontent.com/tensorflow/tensorflow/master/tensorflow/lite/java/demo/app/src/main/assets/reviews.txt and perform Sentiment Analysis. Instead of using MBart, use a lesser common model, XLM-RoBERTa in Hugging face. Additionally, do not just identify the sentiment... | codefeedback |
What are the two basic components of a computer system, and how do they interact with each other to perform tasks efficiently? Explain how this interaction is affected by the use of multithreading and how it can be optimized for parallel processing. | codefeedback |
Given a string of text, convert all uppercase letters to lowercase and remove all vowels from the string. Additionally, reverse the order of the remaining letters in the string. | codefeedback |
Find the prime factorization of the given number.
153 | codefeedback |
How can I write a Python function to rank a list of cities based on their population, with the most populous city listed first? For example, if I have the list ['Tokyo', 'Beijing', 'Manila'], and their corresponding populations as variables (tokyo_pop, beijing_pop, manila_pop), how can I rank them in descending order? ... | codefeedback |
You are tasked with creating a web application that manages a list of projects for a portfolio. The application should have functionality to add, view, update, and delete projects. You are given a Laravel controller snippet for the portfolio section of the application:
```php
class PortfolioController extends Controll... | codefeedback |
Write a C++ program to print a pyramid of asterisks with a given height and width.
The width of each row should be equal to the height multiplied by 2 minus 1.
For example, if the height is 5, the width of each row should be 9.
Print spaces before each row to align the pyramid in the center.
Ensure that the program run... | codefeedback |
You have been given a list containing both words and numbers. You need to write a code to generate a new list containing only words in the original list and to calculate the average length of the words. If the average length is an integer, you need to round it up to the nearest integer.
mixed_list = ['cat', 1, 'dog', ... | codefeedback |
Create an algorithm for counting the occurrences of a specific character in a string while maintaining a constant space complexity of O(1).
String: "GPT Learning"
Character: "t" | codefeedback |
You are tasked with creating a program that simulates a simple text-based drawing tool. The program should be able to handle a set of basic commands to manipulate an "canvas" and draw on it.
The canvas is represented as a 2D grid of characters, where each cell is initially filled with a space character. The program sh... | codefeedback |
Create a C# program which takes two strings as parameters, and returns true if the two strings are anagrams of each other. Additionally, the program should also count and return the number of unique characters used in the anagrams. If the two strings are not anagrams, the program should return a detailed error message.... | codefeedback |
Create a series of nested for loops in Java to print the numbers from 1 to 10 in descending order on separate lines. Additionally, modify the code to skip printing the number 5. | codefeedback |
You are tasked with implementing a function that performs a join operation on two arrays of objects based on specified key mappings. The function should take in two arrays of objects and an object specifying the key mappings for the join operation. The key mappings object will have two properties: `from` and `to`, repr... | codefeedback |
You have a task: Design a Search Suggestions System with Fuzzy Matching
The details are as follows: Given an array of strings `products` and a string `searchWord`. We want to design a system that suggests at most three product names from `products` after each character of `searchWord` is typed. Suggested products shoul... | codefeedback |
Create a class in Java that encapsulates a student's name, grade point average (GPA), and a list of courses they have taken.
The class should have the following methods:
1. `addCourse(String courseName, int creditHours, double grade)` - adds a course to the student's list of courses, where `courseName` is the name of ... | codefeedback |
Design a Python function that not only verifies if a list of numerical values follows an ascending sequence, but also meticulously checks if the list maintains a strictly ascending order (i.e., no two consecutive numbers are the same). This function should also be capable of managing exceptions for inputs that are non-... | codefeedback |
You are tasked with implementing a learning algorithm for a cognitive modeling framework. The framework provides an interface, `CognitiveModuleFactoryLearner`, which defines the functionality of an object that can learn a `CognitiveModuleFactory` from a collection of input data. Your goal is to create a class that impl... | codefeedback |
Write an Object-Oriented approach in JavaScript to create a customizable timer. The timer should be able to:
1. Get the initial time in minutes as an input upon creation.
2. Automatically start upon creation.
3. Be paused and resumed.
4. Reset to its initial time.
5. Alert the user once the time has ended.
Create uni... | codefeedback |
Write a query to select all artworks whose titles contain the word 'Abstract' and have a year of creation between 2010 and 20 | codefeedback |
I've been studying Thompson Sampling and one of the bottleneck is that when recommending 100 items to users, each item has `beta distribution` thus need to select random value from 100 different distribution which is very computationally heavy.
From "Mastering RL with Python by Enes Bilgin" it says that computation bur... | codefeedback |
You are tasked with creating a function that parses a GraphQL query string and extracts the names of all the fields present in the query. The GraphQL query string will be provided as input to your function. You need to implement a function `extractFields` that takes a GraphQL query string as input and returns a list of... | codefeedback |
In Python, write code to identify whether a given string contains only numeric values in scientific notation with an exponent. Additionally, the code should also check if the exponent is a prime number. The input string can contain multiple numbers separated by whitespace. Your code should return True if all numbers in... | codefeedback |
I have received an invitation to participate in a game show where the amount I could potentially win depends on how well I perform. The game requires me to find diamonds hidden in 30 vases that are spread across two rooms, each with 15 vases.
One vase in Room A contains a diamond worth one unit, and another vase in Roo... | codefeedback |
You are tasked with implementing a function that simulates a simple version control system. The function will take in a series of work functions, each representing a change to be committed. The function should return an object representing the state of the system after all the changes have been applied.
The function s... | codefeedback |
You are given a list of integers `qs` representing queries, and two lists of strings `mot` and `sat` representing words. Additionally, you are given an integer `k`. Your task is to generate a list `res` such that each element at index `i` in `res` is the concatenation of the `mot` and `sat` strings at indices `i` and `... | codefeedback |
Modify this code to make it a function which takes a list of positive numbers and returns their average, rounded to two decimal places. The function should also handle empty lists by returning 0. Additionally, the function should check if the list contains any non-numeric values and raise a ValueError if it does. The l... | codefeedback |
Embark on a comprehensive journey through the cosmos of quantum superposition, accentuating its critical function in the swiftly progressing sphere of quantum computation. Could you intricately construct a multi-faceted narrative that probes into the genesis, evolution, and practical application of theoretical principl... | codefeedback |
Given a piece of erroneous code, identify what is wrong, correct it, then modify the function to calculate the product of all Fibonacci numbers within a given range. It should handle negative as well as large integer input.
Erroneous Code:
```python
def product_fibonacci(n):
if n <= 0:
return "Input shou... | codefeedback |
You are tasked with implementing a class to parse and extract data from a BLE (Bluetooth Low Energy) Blood Pressure Service. The service exposes blood pressure and other related data from a blood pressure monitoring device. The data is transmitted in a specific format defined by the Bluetooth SIG (Special Interest Grou... | codefeedback |
Augment the code given below:
/* Provided a string of words, create a list of words separated by a space or a colon. If neither spaces nor colons can be found, bifurcate them using commas. Absent these, output the count of lower-case alphabets located at an odd order, with 'a' as 0, 'b' as 1... and 'z' as 25. Also, e... | codefeedback |
Given a list of positive integers, find the largest prime number that is a palindrome.
test_list = [2, 5, 10, 15, 17, 23, 131, 151] | codefeedback |
Given a matrix of size NxM, make a code that prints the transpose of the matrix. The matrix can contain integers, decimals, or characters.
Additional Constraints:
- The code should have a time complexity of O(N*M).
- The code should not use any built-in functions or libraries for transposing the matrix.
- The code sho... | codefeedback |
You are tasked with creating a Python program to simulate a simple board game. The game involves moving a player token on a board based on a series of instructions. The board is represented as a grid, and the instructions dictate the movement of the player token within the grid.
You are provided with the following cod... | codefeedback |
Implement the insertion sort algorithm to sort the given array of integers in descending order.
Input: [5, 1, 4, 2, 8]
Output: [8, 5, 4, 2, 1] | codefeedback |
You are tasked with implementing a script to train a machine learning model using a command-line interface. The script takes various parameters and options, and it is essential to understand and manipulate these settings for optimal model training.
The provided code snippet is a part of the command used to launch the ... | codefeedback |
Update the strings stored in a dictionary, so that all strings have the same length. The length of the strings should be equal to the length of the longest string in the dictionary. Additionally, you should also remove any leading or trailing whitespace from the strings. Your solution should have a time complexity of O... | codefeedback |
You are tasked with implementing a route matching system for a web application framework. The framework uses the given code snippet to define routes for an admin panel. Each route is associated with a specific controller method and has a unique name.
Your task is to create a function that takes a URI and matches it to... | codefeedback |
Problem:
Given a similarity matrix, with correlation between various research papers :
paper1 paper2 paper3
paper1 0 0.7 0.6
paper2 0.7 0 0.3
paper3 0.6 0.3 0
I need to perform K-means clustering on this data (into 3 clusters), wher... | codefeedback |
Is it plausible that the performance of a 1-NN classifier could be enhanced by employing unweighted Euclidean distance in a transformed feature space Q, which is mapped via a radial basis kernel function, in contrast to its original space, notwithstanding the absence of any definitive assurance? Furthermore, can we aff... | codefeedback |
Design an ultra-specialized Microservice, employing either Rust or Kotlin, that is solely responsible for the procurement and metamorphosis of data derived from the Advanced Message Queuing Protocol (AMQP). This data must subsequently be integrated into a Graph database. The microservice should be structured using a la... | codefeedback |
Help me turn this into Go code:
def partition(l, low, high, pivot_index, cmp_func):
pivot_value = l[pivot_index]
l[high], l[pivot_index] = l[pivot_index], l[high]
store_index = low
for i in range(low, high):
if cmp_func(l[i], pivot_value):
l[store_index], l[i] = l[i], l[store_index]
... | codefeedback |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.