instruction_seed
stringlengths
0
26.4k
source
stringclasses
4 values
You are working for a water supply company that is responsible for maintaining a network of pipes. Your task is to create a program that simulates the process of fitting pipes to ensure a smooth water flow. Each pipe has a start and finish point, and it needs to be connected to the existing network in a way that minimi...
codefeedback
You are working on a file management system, and you need to create a function to simulate the behavior of the Unix command `rm -rf`. The function should take a directory path as input and recursively delete all files and subdirectories within that directory. Write a function `recursiveDelete(directoryPath)` that take...
codefeedback
You are tasked with implementing a timer utility in a programming language of your choice. The timer utility should support starting, stopping, and resetting the timer. Additionally, it should allow for registering callback functions to be executed when the timer reaches certain intervals. Your task is to implement th...
codefeedback
You are working on a medical diagnostic system that utilizes various classes and modules to analyze patient data and provide risk assessments. The code snippet provided includes imports from different modules related to risk factors, symptoms, explanations, parsing results, rationale, and red flags. Your task is to cr...
codefeedback
You are tasked with creating a web application that allows users to select a "chantier" (construction site) from a dropdown menu. The dropdown menu is populated with "chantiers" fetched from a backend server. Each "chantier" has an ID and a corresponding name. Your task is to implement the backend functionality to fet...
codefeedback
You are given a custom implementation of a doubly linked list in Python. The `DoublyLinkedList` class has a method `shift()` which removes the first node from the list and returns its value. Your task is to implement the `DoublyLinkedList` class and its `shift()` method. The `DoublyLinkedList` class should have the fo...
codefeedback
You are tasked with implementing a simplified order matching system for a stock exchange. The system should match buy orders with sell orders based on their price and time of submission. Each order is represented by a unique identifier, a timestamp, a price, and a quantity. You are given a class `Order` with the foll...
codefeedback
You are tasked with optimizing a sieve algorithm for finding prime numbers. The sieve algorithm works by iteratively marking the multiples of each prime number starting from 2, and the unmarked numbers are prime. The cost of the sieve algorithm is determined by the time it takes to run and the resources it consumes. Yo...
codefeedback
You are tasked with implementing a unique identifier generator for a block-based system. Each block in the system needs to have a unique identifier associated with it. The unique identifier should be generated based on the block's properties and should be immutable once set. The identifier should be a combination of th...
codefeedback
You are tasked with creating a Python class that extends a base module class and implements specific functionality for a post-exploitation framework. The provided code snippet is the beginning of the Python class, and you need to complete the implementation by adding required methods and attributes. Your task is to im...
codefeedback
You are tasked with creating a Python package for a simple text processing utility. The package should include a function that counts the frequency of each word in a given text file and returns a dictionary with the word frequencies. Additionally, the package should have a command-line interface (CLI) that allows users...
codefeedback
You are tasked with writing a script to manage environment variables for different EDA (Electronic Design Automation) tools used in a semiconductor design environment. The script should handle the setting of environment variables for specific tool versions and ensure that the necessary paths are included in the system'...
codefeedback
You are tasked with implementing a font manager class in Swift that can generate UIFont objects based on a given font name and size. The font manager should support the following functionalities: 1. Return a system font of a specified size if the font name is "system". 2. Return a custom font with a specified name and ...
codefeedback
You are tasked with implementing a module resolution algorithm for a simple JavaScript module system. The system uses the `export` statement to make components available for import in other modules. When a module imports another module, the module resolution algorithm should determine the location of the imported modul...
codefeedback
You are tasked with creating a program to process a video and add text to each frame. The program should read a video file, add a specified text to each frame, and then save the modified video to a new file. The text should be placed at a specific location on each frame and should be easily readable. You are given a co...
codefeedback
You are tasked with creating a Python class that simulates a simple search engine using Biopython's Entrez module to search the Sequence Read Archive (SRA) database. Your class should have a method that, when supplied with a valid search string, calls the correct Biopython's Entrez methods to perform the search. Your ...
codefeedback
You are tasked with implementing a function that retrieves the primary storage and host information from a resource management system. The code snippet provided is a part of a larger system and contains a few errors. Your task is to identify and correct the errors in the code snippet and then implement the function to ...
codefeedback
You are tasked with creating a program that determines the type of triangle based on the lengths of its sides. The program should take three input values representing the lengths of the sides of a triangle and then determine whether the triangle is valid and, if so, what type of triangle it is. The types of triangles t...
codefeedback
You are tasked with implementing a Python class that manages zone numbers for a transportation system. The zone numbers are represented as integers and have a maximum internal value of 6000. Additionally, the zone numbers are stored in a colon-separated format. Your task is to create a class that enforces these constra...
codefeedback
You are tasked with creating a command-line tool to automate the process of launching a React Native application on an iOS simulator. Your tool should accept command-line arguments to specify the configuration and the target simulator for the launch. Write a Node.js script that takes in command-line arguments and uses...
codefeedback
You are tasked with creating a TypeScript module that manages various types of storage for a web application. The module should export different storage-related functionalities and a storage module itself. Your task is to implement the module and export the necessary components as specified in the code snippet below. ...
codefeedback
You are tasked with creating a custom linting tool for a programming language that enforces specific naming conventions for functions. The linting tool should identify and report functions that violate the naming conventions. The naming convention requires that all function names must be in snake_case, and they should ...
codefeedback
You are tasked with implementing a function that processes time-series data using the pandas library in Python. The function is expected to handle various operations on the input data, such as converting the index to datetime, sorting the data, and calculating the rolling minimum. Your task is to implement the `proces...
codefeedback
You are tasked with implementing a simple HTML rendering system for a to-do list application. The code snippet provided includes a basic structure for rendering to-do items and a to-do list using Python functions and HTML templates. Your goal is to complete the implementation by writing the necessary functions and HTML...
codefeedback
You are tasked with implementing a data augmentation pipeline for image processing. The given code snippet is a part of a Python class that applies a random augmentation to input data with a certain probability. The `RandomApply` class takes an augmentation function and a probability as input and applies the augmentati...
codefeedback
You are tasked with implementing a Python class to manage fixed deposit forms for a banking application. The `AddFixedDepositForm` class is intended to be used with Flask web framework for creating and validating fixed deposit forms. However, the code snippet provided contains several issues and incomplete functionalit...
codefeedback
You are working for a data analysis company that specializes in extracting and processing data from various sources. Your task is to write a Python program to read a JSON file and display information about the data using the pandas library. You are given a JSON file named "eio.jl" located at "D:\eiaScrapper\eio.jl". T...
codefeedback
You are tasked with creating a program that converts input text into phonemes, which are the smallest units of sound in a language. The program should first check if the input text is in English. If it is, the program should convert the text to its corresponding International Phonetic Alphabet (IPA) representation. If ...
codefeedback
You are given an array of integers representing the heights of a series of buildings. Your task is to find the maximum area of a rectangle that can be formed by selecting a contiguous sequence of buildings. The width of the rectangle is the number of buildings selected, and the height of the rectangle is the minimum he...
codefeedback
You are tasked with implementing a class for parsing HWP (Hangul Word Processor) documents. The HWPScanner class is responsible for parsing the given HWP file and extracting relevant information. Your task is to complete the implementation of the HWPScanner class by adding the necessary methods and attributes. Your im...
codefeedback
You are tasked with creating a program that processes HTML table data to extract and display specific information. The HTML code snippet provided represents a table with an id of "myTablereg" and a class of "table table-bordered table-striped table-hover datatable datatable-CrecRegDoc". Your task is to write a program ...
codefeedback
You are tasked with implementing a custom future type in Rust that can be used with asynchronous programming. Your goal is to create a future that resolves to a tuple containing a reference to a data structure and a reference to an interrupt handler. The interrupt handler is a trait object that represents an interrupt ...
codefeedback
You are working for a retail company that wants to analyze its sales data using Python. The company has provided you with a CSV file containing sales data for different products. Your task is to write a Python program that reads the CSV file into a pandas DataFrame and performs some data analysis tasks. The CSV file "...
codefeedback
You are tasked with implementing a modified version of the merge sort algorithm to sort an array of integers. The modification involves using a sentinel value to handle the merging process. The sentinel value should be set to 10^12. Your task is to complete the implementation of the merge sort algorithm with the given ...
codefeedback
You are tasked with creating a C++ program to manage metadata and window settings for a software application. The program should allow users to input and manipulate metadata and window settings using appropriate data structures and functions. Your task is to implement the following functionalities: 1. Create a functio...
codefeedback
You are tasked with implementing a custom autograd function in PyTorch for a 2.5D matrix addition with bias. The function should take two input matrices A and b, and compute the element-wise addition of A and b. The input matrix A is of shape (M, N, P), and the bias matrix b is of shape (N, P). The output matrix C shou...
codefeedback
You are tasked with implementing a command processor for a messaging system. The command processor will be responsible for handling and executing various commands within the system. Each command will have a unique identifier and will be processed by the command processor based on its type. Your task is to create a C# ...
codefeedback
You are tasked with implementing a neural network training algorithm using the provided code snippet as a starting point. The code snippet includes constants and a struct for transferring neural network instances. Your task is to create a function that trains a neural network using a genetic algorithm approach. You ar...
codefeedback
You are tasked with creating a program that simulates a simple database migration system similar to Laravel's migration feature. In Laravel, migrations are used to create and modify database tables using PHP code. The provided code snippet is a simplified representation of a migration file in Laravel. Your task is to ...
codefeedback
You are tasked with creating a program that simulates a simple banking system. The system should allow users to create accounts, deposit and withdraw funds, and check their balance. Each account should have a unique account number, and the system should be able to handle multiple accounts. Your program should include ...
codefeedback
You are tasked with implementing a signal flattening function in Swift. The function should take a sequence of signals and return a new signal that combines the events from all the input signals into a single sequence of events. The function signature is as follows: ```swift func flattenSignals<T>(_ signals: [Signal<T...
codefeedback
You are tasked with creating a Django model for tracking service request history. The model should store information about service requests, including the contact details of the requester and the operator handling the request. Your task is to extend the given code snippet to include additional fields and constraints. ...
codefeedback
You are tasked with implementing a simple filtering system for a music streaming service. The system should support different types of filters such as low-pass, high-pass, and band-pass filters. The code snippet provided is a partial import statement for a filter module, which contains the necessary components for impl...
codefeedback
You are tasked with creating a Python function that processes a 3D mesh object and performs a specific operation on it. The mesh object is represented using the `Mesh` class from the `compas` library, and the function will utilize the `compas_rhino` module to visualize the mesh in Rhino 3D software. Your task is to imp...
codefeedback
You are tasked with implementing a class that creates triggers for entries in the SmartDashboard NetworkTable when they are updated. The SmartDashboard NetworkTable is a data structure used in robotics programming to exchange data between the robot and the driver station. Your task is to create a Trigger class that all...
codefeedback
You are given a binary tree represented by the `TreeNode` class as shown in the code snippet below. Each node in the tree has an integer value and may have a left and/or right child node. Your task is to implement a function `maxDepth` to find the maximum depth of the binary tree. The maximum depth is defined as the nu...
codefeedback
You are tasked with implementing a 3D graphics application that involves manipulating vertices in a 3D space. The given code snippet is part of a function that sets the positions of vertices and then projects them onto a 2D plane. The `mVertices` array contains pairs of 3D vertex positions and their corresponding proje...
codefeedback
You are tasked with implementing a function to find alternate spellings for names. The function should recursively find alternate spellings of alternate spellings. The function will take a name as input and return a list of all the alternate spellings found. The function will iterate through each group of alternate sp...
codefeedback
You are tasked with implementing a class that represents a student's grade in a course. The class should have the following properties: - `Id`: an integer representing the unique identifier of the grade. - `Value`: an integer representing the numerical value of the grade (e.g., 85 for a B). - `Comment`: a string repres...
codefeedback
You are tasked with creating a Python function that processes template files in a given directory. The function should identify all the template files within the directory and its subdirectories, and then return a list of these template file names. You are provided with a code snippet that iterates through template lo...
codefeedback
You are tasked with creating a cross-platform clipboard utility that can retrieve and store text from the clipboard. The code snippet provided contains a partial implementation using conditional compilation for different target architectures. Your task is to complete the implementation of the clipboard utility by writi...
codefeedback
You are tasked with creating a function that parses a given HTML-like code snippet and extracts specific information from it. The code snippet represents a blog post template and contains placeholders for the post title, author's name, and an avatar image. Your function should extract the post title, author's name, and...
codefeedback
You are tasked with implementing a custom class for generating random pet names. The class, `RandomPet`, should have the following functionalities: - Initialize with a name and an optional prefix. - Generate a random pet name by combining the prefix (if provided) and a randomly selected name from a predefined list. - A...
codefeedback
You are tasked with implementing a class that represents a documentation member in a software development environment. The class should provide functionality to compute and retrieve the hash code of the member based on its properties. You need to implement the GetHashCode method to compute the hash code based on the me...
codefeedback
You are tasked with creating a script to manage SSL/TLS certificate generation and signing for multiple clients using the certstrap tool. The script should automate the process of requesting, signing, and managing client certificates for a given set of clients. You are provided with a code snippet that demonstrates th...
codefeedback
You are tasked with creating a Python package that provides a custom implementation of a popular sorting algorithm. Your package should be able to sort a list of integers in ascending order using the custom sorting algorithm. The custom sorting algorithm should be a variation of the quicksort algorithm, with a specific...
codefeedback
You are tasked with creating a Python function that manipulates time series data using the Pandas library. Your function should shift the time index of a given DataFrame and perform assertions to ensure the correctness of the shifting operation. Write a function called `validate_time_shift` that takes a DataFrame `inp...
codefeedback
You are tasked with implementing a function that performs in-place scaling on a given array of floating-point numbers. The function should take the array, the minimum value (vmin), and the maximum value (vmax) as input, and then scale the array in-place based on the given minimum and maximum values. The function shoul...
codefeedback
You are tasked with implementing a Python class that simulates a simple shopping cart. The class should allow users to add items to the cart, remove items from the cart, calculate the total cost of the items in the cart, and display the items in the cart. Your task is to create a `ShoppingCart` class with the followin...
codefeedback
You are given a list of boolean values, some of which are missing. The missing values are represented by `None` in the list. Your task is to fill in the missing boolean values based on the following rules: - If there are two adjacent boolean values, the missing values between them should be filled with the same boolea...
codefeedback
You are tasked with implementing a function that processes a mathematical expression and returns specific information about the expression. The expression is represented using a custom data structure called `Term`, which consists of a symbol and a list of subterms. Each subterm is also a `Term` object, allowing for nes...
codefeedback
You are tasked with implementing a C# method that takes an array of integers and returns the sum of all the even numbers in the array. However, there is a catch - you are not allowed to use any built-in iteration constructs such as loops or LINQ. Instead, you must utilize recursion to achieve this. You are provided wi...
codefeedback
You are tasked with implementing a Python function that calculates the loss for a given prediction and ground truth using the soft dice loss function. The soft dice loss is a metric commonly used in image segmentation tasks to measure the dissimilarity between the predicted segmentation and the ground truth. The functi...
codefeedback
You are tasked with implementing a simplified version of a Texas Hold'em poker game. In this game, each player is dealt two private cards, and then five community cards are dealt face-up in three stages. The stages consist of a series of three cards ("the flop"), then an additional single card ("the turn" or "fourth st...
codefeedback
You are tasked with creating a program that analyzes the frequency of words in a given text. Your program should take a string of text as input and output the frequency of each word in the text. For the purpose of this problem, a word is defined as a sequence of characters separated by spaces. Punctuation marks should ...
codefeedback
You are tasked with creating a command-line tool for managing software installations and uninstallations. The tool should support installing and uninstalling various software packages and provide a way to test the uninstall functionality. Your task is to implement the `QS:uninstall` command, which will be used to unin...
codefeedback
You are tasked with creating a program that analyzes HTML code to identify and count the occurrences of specific HTML elements within the code. Your program should take an HTML string and a target HTML element tag as input, and then return the count of occurrences of the target element within the HTML string. For exam...
codefeedback
You are given a list of integers representing the distances between cities. Your task is to find the minimum distance that can be traveled by visiting all the cities exactly once and returning to the starting city. You need to implement a function `min_total_distance(distances: List[int]) -> int` that takes in a list...
codefeedback
You are given a grid representing a maze, where each cell can be either empty or blocked. The objective is to find the number of times a specific condition is met while exploring the maze. You need to implement a function `explore_maze(grid)` that takes in a 2D list `grid` representing the maze. The function should re...
codefeedback
You are tasked with implementing a function that checks if a given string is a palindrome. A palindrome is a word, phrase, number, or other sequence of characters that reads the same forward and backward, disregarding spaces, punctuation, and capitalization. You are given the following code snippet as a starting point...
codefeedback
You are tasked with designing a Python class that manages the execution of an application framework. The class should handle various components such as event loops, logging, database management, environment settings, integrations, and lifecycle management. Your goal is to implement the `run` method of this class, ensur...
codefeedback
You are tasked with implementing a custom video gallery application in Android. The provided code snippet is from the `onCreate` method of the main activity. The activity uses a `VideoCursorAdapter` to display a vertical grid of videos and sets a custom `VideoCursorMapper` to map the data from the cursor to the UI elem...
codefeedback
You are tasked with implementing a Python class for solving optimization problems using the Multi-Start Reconverging algorithm. The algorithm aims to find the global minimum of a given objective function by performing multiple trials with different initial conditions and reconverging towards the best solution found so ...
codefeedback
You are working on a project that involves concurrent programming using Software Transactional Memory (STM) in a functional programming language. You are given a code snippet that represents a function in STM monad. Your task is to understand the code and create a problem based on it. The code snippet represents a fun...
codefeedback
You are tasked with implementing a class for an evolutionary algorithm. The class contains a method that updates the algorithm's parameters based on certain calculations. Your task is to complete the implementation of the method by filling in the missing parts. The method is part of the evolutionary algorithm class an...
codefeedback
You are tasked with creating a program that processes a list of TODO items and organizes them based on their categories. Each TODO item is a string that starts with "# TODO:" followed by a description of the task. The categories are "Integration", "Functions", "Manifest", "Constants", "Locale", "Optimization", "CLI", "...
codefeedback
You are tasked with creating a function that retrieves a URL for a Docker tutorial. The function should be implemented in TypeScript and should utilize asynchronous programming. You are given a type definition `TFunc` for the function signature. Your task is to complete the implementation of the `getUrlDockerTutorial`...
codefeedback
You are tasked with creating a Python program that counts the number of even and odd numbers entered by the user until the number 0 is input. The program should prompt the user to input a series of integers and then count and display the total number of even and odd numbers entered. The program should terminate when th...
codefeedback
You are working on a deployment automation script for a Kubernetes cluster using Vagrant and K3s. The script is responsible for extracting the server IP from a configuration file, modifying a Kubernetes configuration file, and saving the modified configuration to a new file. Your task is to implement a function that ac...
codefeedback
You are given a function `rotate(num)` that takes an integer `num` as input. The function is intended to rotate the digits of the input number and store the unique rotated numbers in a set called `rot`. However, the code snippet provided is incomplete and lacks the necessary logic to complete the rotation and store the...
codefeedback
You are tasked with creating a program that manages a collection of MIME types. A MIME type is a label used to identify the type of data in a given file, typically used to determine how the file should be processed. In this problem, you will create a data structure to store MIME types and implement functions to perform...
codefeedback
You are tasked with creating a Python program that simulates a simple messaging system using the MQTT (Message Queuing Telemetry Transport) protocol. MQTT is a lightweight messaging protocol commonly used for IoT (Internet of Things) devices to communicate with each other. In this scenario, you will implement a basic M...
codefeedback
You are tasked with simulating a simplified message passing system using Python. The system consists of a backend and a frontend, which communicate using ZeroMQ sockets. The backend receives messages and forwards them to the frontend for further processing. Your task is to implement a Python function that simulates th...
codefeedback
You are tasked with creating a Python function that processes a bank account file and updates the corresponding records in the You Need A Budget (YNAB) software. The bank account file is in CSV format and contains transaction records, while the YNAB software is represented by the `ynab` parameter, which is an instance ...
codefeedback
You are tasked with implementing a pattern recognition system that can detect and respond to specific patterns in a stream of data. The system is designed to call a method `OnStopPattern` whenever a particular pattern is identified. Your task is to design a class that can manage this pattern recognition system and hand...
codefeedback
You are working on a digital image processing application and need to implement a circular shift operation to reposition the Point Spread Function (PSF) so that its center is at the coordinate (0,0). The PSF is represented as a 2D array, and the circular shift operation involves shifting the elements of the array in a ...
codefeedback
You are tasked with implementing a Python function that calculates the average of a list of numbers. However, the catch is that you are not allowed to use any built-in Python functions or libraries for mathematical operations. You must implement the average calculation from scratch using only basic arithmetic operation...
codefeedback
You are tasked with implementing a module resolution system for a JavaScript project. The system should be able to resolve and import modules based on the provided import statements. The import statements follow the ES6 module syntax. Given the following code snippet: ``` export { default as FilledQueryBuilder } from ...
codefeedback
You are tasked with implementing a simple task scheduler for a mobile application. The scheduler should allow users to schedule tasks to be executed at specific times. Each task is represented by a unique identifier, a description, and a scheduled execution time. Your task is to implement the `TaskScheduler` class, whi...
codefeedback
You are tasked with implementing a lazy loading mechanism in a shell script. Lazy loading is a design pattern where resources are loaded only when they are needed, rather than loading everything at once. In this problem, you will need to create a script that defines aliases for functions, and when those aliases are cal...
codefeedback
You are tasked with creating a Python class to handle the parsing and manipulation of Variant Call Format (VCF) files commonly used in bioinformatics. The VCF format is a standard way of storing gene sequence variations and associated metadata. Your class should provide methods to read a VCF file, extract relevant info...
codefeedback
You are tasked with implementing a function to simulate a changepoint process for a time series dataset. The function should accept the following parameters: - `data`: A 1D array representing the time series data. - `num_changepoints`: An integer specifying the number of changepoints to simulate. - `nu`: A float repres...
codefeedback
You are tasked with implementing a CSRF (Cross-Site Request Forgery) detection filter for a web application. The provided code snippet outlines the interface `CsrfDetectionFilter`, which extends the `Filter` interface and declares a method `hasCsrf(HttpServletRequest request)` to check for CSRF attacks. Your task is t...
codefeedback
You are tasked with implementing a simple metadata editing feature for a media management application. The application uses an object-oriented approach, and the code snippet provided is a part of the metadata editing functionality. The `TEditMetadata` class is a custom form component in the application, responsible fo...
codefeedback
You are tasked with implementing a custom exception handling mechanism for a file processing application. The application processes various types of files, such as text, image, and audio files. Your goal is to create a custom exception hierarchy to handle different types of file processing errors. You need to define a...
codefeedback
You are tasked with creating a Django REST Framework (DRF) API for managing tasks. The provided code snippet is a part of the URL configuration for the API. The `tasks` endpoint is registered using a DefaultRouter, and the TaskViewSet from the `task_views` module is associated with this endpoint. Your task is to compl...
codefeedback
You are tasked with creating a script to automate the submission of multiple jobs to a high-performance computing (HPC) cluster using the Slurm workload manager. The script should generate a series of job submission commands based on a given set of parameters and job configurations. The script should take the followin...
codefeedback
You are given a code snippet that contains a Rust macro invocation. Your task is to implement a custom macro that performs a specific transformation on the input code. Your custom macro should take an input expression and wrap it with a timing functionality. The macro should measure the time taken to execute the expre...
codefeedback
You are tasked with implementing a JavaScript SIMD (Single Instruction, Multiple Data) operation for 8-bit unsigned integers. The given code snippet is part of a JavaScript engine's implementation for SIMD operations. The `JavascriptSIMDUint8x16` class provides methods for creating new instances, obtaining the full bui...
codefeedback
You are tasked with extending a React component to support additional features. The existing component, `Feature`, is used to display various features on a website. The component currently supports displaying text and images, but now it needs to be extended to support displaying icons using `FontAwesomeIcon` from the `...
codefeedback