Datasets:
id stringlengths 24 24 | source stringclasses 7
values | task_type stringclasses 4
values | language stringclasses 231
values | translation_style stringclasses 4
values | verification_status stringclasses 2
values | license stringclasses 13
values | instruction_en stringlengths 29 26.1k | response_en stringlengths 1 13.5k | instruction_roman_urdu stringlengths 30 26.5k | response_roman_urdu stringlengths 1 13.5k |
|---|---|---|---|---|---|---|---|---|---|---|
e68a1b0dd5c4e3ece4056bd3 | magicoder_oss | general_instruction | python | code_mixed_professional | no_issue | MIT | You are tasked with creating a Python script that automates the process of generating a setup file for a Python package. The setup file should include the package's metadata and dependencies. Your script should take input from the user for the package name, version, author, and dependencies, and then generate the setup... | ```python
from distutils.core import setup
def generate_setup_file():
package_name = input("Enter the package name: ")
package_version = input("Enter the package version: ")
author_name = input("Enter the author's name: ")
author_email = input("Enter the author's email: ")
dependencies = input("Ent... | Aap ko ek aisa Python script banane ka task diya gaya hai jo Python package ke liye setup file generate karne ke process ko automate kare. Setup file mein package ki metadata aur dependencies shamil honi chahiye. Aapka script package name, version, author, aur dependencies ke liye user se input le, aur phir us ke mutab... | ```python
from distutils.core import setup
def generate_setup_file():
package_name = input("Enter the package name: ")
package_version = input("Enter the package version: ")
author_name = input("Enter the author's name: ")
author_email = input("Enter the author's email: ")
dependencies = input("Ent... |
a452634aea141299ff4af92c | glaive_v3 | general_instruction | unknown | casual_noisy | no_issue | Apache-2.0 | You are tasked with creating an XSLT stylesheet to transform XML data into a FITS format. The XML data contains metadata for images and needs to be converted into a specific structure to conform to the FITS standard. The input XML contains various image metadata such as compression scheme, image dimensions, color space... | <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Your XSLT code goes here -->
<xsl:template match="/">
<fits xmlns="http://hul.harvard.edu/ois/xml/ns/fits/fits_output">
<!-- Your transformation logic goes here to con... | tumhe aik XSLT stylesheet banani hai jo XML data ko FITS format me transform kare. is XML data me images ka metadata hai aur usko aik specific structure me convert karna hai taake wo FITS standard ke mutabiq ho jaye. input XML me kafi image metadata hai jese compression scheme, image dimensions, color space, resolution... | <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Your XSLT code goes here -->
<xsl:template match="/">
<fits xmlns="http://hul.harvard.edu/ois/xml/ns/fits/fits_output">
<!-- Your transformation logic goes here to con... |
eee28377192d4bba82f6b0f1 | acecode_87k | verified_problem | python | professional | no_issue | MIT | Implement a function `create_password(num_chars: int, prev_password: Optional[str] = None) -> str` that generates a strong password. The password must consist of a mix of symbols, numbers, uppercase letters, and lowercase letters. If a previous password is provided, the new password should have a length that is increas... | import string
import random
def create_password(num_chars, prev_password=None):
"""
Generates a strong password that consists of a mix of symbols, numbers, uppercase letters, and lowercase letters.
Args:
num_chars (int): The number of characters in the password.
prev_password (Optional... | Aik function `create_password(num_chars: int, prev_password: Optional[str] = None) -> str` implement karein jo aik strong password generate karta ho. Password symbols, numbers, uppercase letters, aur lowercase letters ke mix par mushtamil hona chahiye. Agar koi pichla password provide kiya gaya ho, toh naye password ki... | import string
import random
def create_password(num_chars, prev_password=None):
"""
Generates a strong password that consists of a mix of symbols, numbers, uppercase letters, and lowercase letters.
Args:
num_chars (int): The number of characters in the password.
prev_password (Optional... |
0cd266e4cf5387fc95bedaa2 | codefeedback | general_instruction | lisp | casual_noisy | no_issue | Apache-2.0 | Generate a Lisp program to calculate Fibonacci numbers for a given number n.
9 | Below is a simple recursive definition of Fibonacci sequence in Lisp.
```lisp
(defun fibonacci (n)
(cond ((= n 0) 0)
((= n 1) 1)
(t (+ (fibonacci (- n 2) ) (fibonacci (- n 1))))))
```
In this definition, we initially check if the entered number n is 0 or 1, and if it is, we return the number itself.... | Kisi diye gaye number n k liye Fibonacci numbers calculate krne wala Lisp program banao.
9 | Neeche Lisp me Fibonacci sequence ki aik simple recursive definition di hui hai.
```lisp
(defun fibonacci (n)
(cond ((= n 0) 0)
((= n 1) 1)
(t (+ (fibonacci (- n 2) ) (fibonacci (- n 1))))))
```
Is definition me hum shuru me check krte hain k jo number n enter kia hai wo 0 ya 1 hai k nhi aur agar ha... |
640b8ab24841de90d48fef69 | magicoder_evol | general_instruction | python | code_mixed_professional | no_issue | Apache-2.0 | Develop a method labeled as reverse which is competent enough to manipulate the content of an array by inverting its order, ensuring that the last element becomes the initial one and vice versa. Operate this function on a specified array, namely, [1, 2, 3, 4, 5]. | Sure, I will define this problem in Python as below:
```python
def reverse(input_array):
return input_array[::-1]
# Test the function
array = [1, 2, 3, 4, 5]
print(reverse(array))
```
In this solution, I use Python's list slicing to reverse the list. The "::" operation is used to copy the entire list, where -1 ... | Ek method develop karein jiska label 'reverse' ho, jo array ke content ka order invert karke usay manipulate karne ki salahiyat rakhta ho, taake aakhri element pehla ban jaye aur isi tarah baqi bhi reverse ho jayein. Is function ko diye gaye array, yaani [1, 2, 3, 4, 5] par operate karein. | Bilkul, main is problem ko Python mein neeche diye gaye tareeqay se define karunga:
```python
def reverse(input_array):
return input_array[::-1]
# Test the function
array = [1, 2, 3, 4, 5]
print(reverse(array))
```
Is solution mein, main list ko reverse karne ke liye Python ki list slicing ka istemal karta hoon.... |
214a8a91c46dfb9839e05673 | codefeedback | general_instruction | python | casual_noisy | corrected | Apache-2.0 | Write a function that checks if a given string contains a valid date and if it is, return it in YYYY-MM-DD format. The function should also handle leap years correctly. Your code should specifically handle and validate inputs for day, month and year separately. Invalid dates such as 30th of February or 31st of November... | Here is a Python solution using the datetime module, which takes care of checking the validity of a date, including leap years. The solution is based on trying multiple input formats and seeing if any of them work. This is done because checking for the format manually would be too tedious and error-prone.
```python
fr... | ek aisa function likhde jo check kare k string m valid date hai k nahi aur agar hai toh YYYY-MM-DD format m return karde. function leap years ko b sahi se handle kare. tera code khas tor pe day, month aur year ki inputs ko alag alag validate kare. 30th feb ya 31st nov jaisi invalid dates ko invalid return krna chahiye.... | ye le python ka solution datetime module use krte hue, ye leap years samet date ki validity khud hi check kr leta hy. ye solution basically kafi sare input formats try krta hy k dekhen koi chalta hy k ni. ye islye kia hy q k manually format check krna bht ziada thaka dene wala aur ghaltion wala kam hota.
```python
fro... |
a53c8e3d8ac4692c1a7da150 | starcoder2_self_oss_exec | execution_validated_instruction | python | professional | no_issue | ODC-By-1.0 | Write a Python function to convert a string into a camelCase string, where each word (separated by a space) is converted to camel case, and the first letter of the first word is lowercase. For example, the input "Convert this into camel case" should output "convertThisIntoCamelCase". | Here is the implementation of the function using the described strategy:
```python
def convertToCamelCase(text: str) -> str:
words = text.strip().split()
transformed_words = []
for i, word in enumerate(words):
if i == 0:
transformed_words.append(word.lower())
else:
... | Ek string ko camelCase string mein convert karne ke liye Python function likhein, jahan har word (jo space se alag ho) camel case mein convert ho jaye, aur pehle word ka pehla letter lowercase ho. Misaal ke taur par, input "Convert this into camel case" ka output "convertThisIntoCamelCase" hona chahiye. | Bayan ki gayi strategy ka istemal karte hue function ki implementation yeh rahi:
```python
def convertToCamelCase(text: str) -> str:
words = text.strip().split()
transformed_words = []
for i, word in enumerate(words):
if i == 0:
transformed_words.append(word.lower())
else:
... |
34b0357d812343e573fcfd01 | glaive_v3 | general_instruction | kotlin | casual_noisy | no_issue | Apache-2.0 | You are tasked with creating a key-value store of preferences in Kotlin. You need to define an interface for a key and a default value, which will prevent duplication or accidental variation in default values since the key and default value are defined together just once. The interface should support different types su... | ```kotlin
package com.nighthawkapps.wallet.android.preference.model
interface DefaultValue<T> {
val key: String
}
class BooleanDefaultValue(override val key: String) : DefaultValue<Boolean>
```
In the solution, we define the interface DefaultValue with the generic type T and a property key of type String. We then... | tumhe Kotlin me preferences ka key-value store banana hai. ek interface define karna hai key aur default value k liye, jisse duplication na ho ya galti se default values alag na hojayein kyun k key aur default value ek sath sirf ek dafa define hongi. interface ko mukhtalif types support karni chahiye jese Boolean wager... | ```kotlin
package com.nighthawkapps.wallet.android.preference.model
interface DefaultValue<T> {
val key: String
}
class BooleanDefaultValue(override val key: String) : DefaultValue<Boolean>
```
is solution me hum DefaultValue interface define krte hain generic type T aur String type ki key property k sath. phr hu... |
de2812fc461412135074f650 | commitpackft | code_modification | yaml | code_mixed_casual | no_issue | MIT | Apply the following change to the existing file.
Change request:
Test using Ruby v2.6.9, v2.7.5, v3.0.3
File: .github/workflows/testing.yml
Existing code:
```yaml
name: Testing
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-late... | name: Testing
on:
push:
branches: [master]
pull_request:
branches: [master]
workflow_dispatch:
jobs:
test:
name: Ruby v${{ matrix.ruby_version}}
runs-on: ubuntu-latest
strategy:
matrix:
ruby_version: [2.6.9, 2.7.5, 3.0.3]
steps:
- uses: actions/checkout@v2
- n... | Existing file mein yeh change apply karein.
Change request:
Ruby v2.6.9, v2.7.5, v3.0.3 use karte hue test karein
File: .github/workflows/testing.yml
Existing code:
```yaml
name: Testing
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
test:
runs-on: u... | name: Testing
on:
push:
branches: [master]
pull_request:
branches: [master]
workflow_dispatch:
jobs:
test:
name: Ruby v${{ matrix.ruby_version}}
runs-on: ubuntu-latest
strategy:
matrix:
ruby_version: [2.6.9, 2.7.5, 3.0.3]
steps:
- uses: actions/checkout@v2
- n... |
5a49b06bdc98f33255da737f | magicoder_evol | general_instruction | python | code_mixed_professional | no_issue | Apache-2.0 | Background:
You are a Product Manager, named Alice, your goal is Efficiently create a successful product, and the constraint is .
Question:
# Context
## Original Requirements
[BOSS: Design a CRM website which helps me handle all the startup my VC has invested]
## Search Information
### Search Results
### Search Su... | ## Original Requirements
The boss wants a CRM website designed to handle all the startups his VC has invested in.
## Product Goals
```python
[
"Create a user-friendly CRM website to manage startups",
"Ensure efficient tracking and management of VC investments",
"Provide comprehensive reports and analytics ... | Background:
Aap ek Product Manager hain, jinka naam Alice hai, aapka maqsad Efficiently aik successful product create karna hai, aur constraint yeh hai.
Sawaal:
# Context
## Original Requirements
[BOSS: Aik aisi CRM website design karein jo meri VC ki invest ki hui tamam startups ko manage karne mein madad kare]
## S... | ## Original Requirements
Boss aik aisi CRM website design karwana chahte hain jo unki VC ki janib se invest kiye gaye tamam startups ko handle karne ke liye banai gayi ho.
## Product Goals
```python
[
"Create a user-friendly CRM website to manage startups",
"Ensure efficient tracking and management of VC inves... |
b14dd6359bf3a5489f3f51a9 | starcoder2_self_oss_exec | execution_validated_instruction | python | professional | no_issue | ODC-By-1.0 | Write a Python function that takes a datetime object as input and prints the datetime formatted as `YYYY-MM-DDTHH:MM:SS.mmmmmmZ`, where the `mmmmmm` part represents the full microseconds (6 digits).
Your code should pass the following test case:
```python
dt = datetime(2023, 6, 15, 12, 30, 5, 123456)
expected_formatte... | To format a datetime object as the specified format, you need to use the appropriate format string in the `strftime()` method.
Here is an example function that achieves this:
```python
from datetime import datetime
def datetime_formatted(dt):
return dt.strftime('%Y-%m-%dT%H:%M:%S.%fZ')
``` | Ek Python function likhein jo input ke taur par ek datetime object leta hai aur datetime ko `YYYY-MM-DDTHH:MM:SS.mmmmmmZ` ke roop mein format karke print karta hai, jahan `mmmmmm` hissa pooray microseconds (6 digits) ko represent karta hai.
Aap ka code mandarja zail test case ko pass kare:
```python
dt = datetime(2023... | Datetime object ko bataye gaye format mein format karne ke liye, aap ko `strftime()` method mein munasib format string use karne ki zaroorat hai.
Yahan ek example function diya gaya hai jo yeh kaam karta hai:
```python
from datetime import datetime
def datetime_formatted(dt):
return dt.strftime('%Y-%m-%dT%H:%M:%... |
975a92071b76bd2028152a29 | glaive_v3 | general_instruction | lua | casual_noisy | no_issue | Apache-2.0 | You are tasked with creating a Lua script that manages a list of players in a game environment. The script should allow for the customization of various settings for each player, such as resolver, autowall, friend status, safe points, maximum misses, and hitscan overrides. The script should also provide a user interfac... | ```lua
local playerslist = {}
local names = { 'none' }
local safepoints = { [0] = 'none', 'default', 'prefer', 'force' }
local hitscan = { 'head', 'chest', 'pelvis', 'stomach', 'legs', 'foot' }
local function update()
local players = entitylist.get_players(0)
for i = 1, #players do
local player = pla... | tumhe aik Lua script bnani hai jo game environment me players ki list ko manage kre. script aisi ho k har player k lye diff settings customize krne de jese resolver, autowall, dost ka status, safe points, max misses, aur hitscan overrides wagera. is k ilawa script me user interface bhi hona chahiye jahan se har player ... | ```lua
local playerslist = {}
local names = { 'none' }
local safepoints = { [0] = 'none', 'default', 'prefer', 'force' }
local hitscan = { 'head', 'chest', 'pelvis', 'stomach', 'legs', 'foot' }
local function update()
local players = entitylist.get_players(0)
for i = 1, #players do
local player = pla... |
9ef4392188a6251a81c75f3a | codefeedback | general_instruction | python | casual_noisy | no_issue | Apache-2.0 | You are tasked with implementing a parallelized Monte Carlo simulation to estimate the value of π using the provided code snippet as a starting point. The code snippet imports necessary libraries, initializes variables, and creates a multiprocessing pool for parallel computation.
Your task is to complete the implement... | ```python
import multiprocessing
import numpy as np
import time
def monte_carlo_simulation(total_points):
points_inside_circle = 0
for _ in range(total_points):
x, y = np.random.rand(2)
if x**2 + y**2 <= 1:
points_inside_circle += 1
return points_inside_circle
if __name__ == "_... | aap ne provide kiye gye code snippet ko use kr k pi ki value estimate krne k liye parallelized Monte Carlo simulation implement krna he. snippet zaroori libraries import krta hai variables initialize krta hai aur parallel computation k liye multiprocessing pool bnata he
ap ka kaam ye he k Monte Carlo simulation ko par... | ```python
import multiprocessing
import numpy as np
import time
def monte_carlo_simulation(total_points):
points_inside_circle = 0
for _ in range(total_points):
x, y = np.random.rand(2)
if x**2 + y**2 <= 1:
points_inside_circle += 1
return points_inside_circle
if __name__ == "_... |
0272d0e61c5567888db268e5 | starcoder2_self_oss_exec | execution_validated_instruction | python | professional | no_issue | ODC-By-1.0 | Create a Python function to return a string that is the concatenation of two strings, where the second string is inserted at the beginning of the first string. If the second string is empty, it should return the first string as-is.
Your code should pass the following test case:
```python
string1 = 'Hello'
string2 = 'W... | You can create a Python function that concatenates two strings by inserting the second string at the beginning of the first string. If the second string is empty, the function should simply return the first string.
Here's how you could do it:
```python
def insert_at_beginning(string1, string2):
if string2 == '':
... | Ek Python function banayein jo do strings ko concatenate karke ek string return kare, jahan doosri string pehli string ke shuru mein insert hoti ho. Agar doosri string khali (empty) ho, toh yeh pehli string ko jaisa hai waisa hi return kare.
Aapka code mazeed zail test case ko pass kare:
```python
string1 = 'Hello'
st... | Aap ek Python function bana sakte hain jo do strings ko pehli string ke shuru mein doosri string insert karke concatenate karta hai. Agar doosri string khali ho, toh function bas pehli string ko return kar dega.
Aap isey is tarah kar sakte hain:
```python
def insert_at_beginning(string1, string2):
if string2 == '... |
453aea613d4e1c98fa91411a | codefeedback | general_instruction | cpp | professional | no_issue | Apache-2.0 | Create a function in C++ that generates a random prime number between 10000 and 100000. The generated prime number should have at least 3 distinct prime factors.
Provide a piece of erroneous code as a reference to increase misdirection:
```c++
#include <iostream>
#include <random>
#include <cmath>
bool isPrime(int n... | Here's an updated version of the code that generates a random prime number between 10000 and 100000, ensuring that it has at least 3 distinct prime factors:
```c++
#include <iostream>
#include <random>
#include <vector>
#include <cmath>
bool isPrime(int n) {
if (n <= 1) {
return false;
}
if (n ==... | C++ mein aik function banayein jo 10000 aur 100000 ke darmiyan aik random prime number generate kare. Generate kiye gaye prime number ke kam az kam 3 alag (distinct) prime factors hone chahiye.
Misdirection barhane ke liye reference ke tor par aik ghalat code ka hissa provide karein:
```c++
#include <iostream>
#inclu... | Yeh code ka aik updated version hai jo 10000 aur 100000 ke darmiyan aik random prime number generate karta hai, aur yeh ensure karta hai ke iske kam az kam 3 distinct prime factors hon:
```c++
#include <iostream>
#include <random>
#include <vector>
#include <cmath>
bool isPrime(int n) {
if (n <= 1) {
retu... |
3716339fced161c517682834 | commitpackft | code_modification | javascript | code_mixed_casual | no_issue | MIT | Apply the following change to the existing file.
Change request:
refactor(settings): Remove extra withTheme hoc on styled components.
File: src/components/Settings/Name.js
Existing code:
```javascript
/* @flow */
import React from 'react'
import styled, { withTheme } from 'styled-components'
import Label from 'compo... | /* @flow */
import React from 'react'
import styled from 'styled-components'
import Label from 'components/Label'
import Input from 'components/Input'
import editable from 'hoc/editable'
type Props = {
name: string,
onChange: Function
}
const Editable = editable(
styled.div`
position: relative;
line-hei... | Mojooda file mein ye change apply kar do.
Change request:
refactor(settings): Styled components se extra withTheme hoc hata do.
File: src/components/Settings/Name.js
Pehle ka code:
```javascript
/* @flow */
import React from 'react'
import styled, { withTheme } from 'styled-components'
import Label from 'components/... | /* @flow */
import React from 'react'
import styled from 'styled-components'
import Label from 'components/Label'
import Input from 'components/Input'
import editable from 'hoc/editable'
type Props = {
name: string,
onChange: Function
}
const Editable = editable(
styled.div`
position: relative;
line-hei... |
6de83f3827cde11e66fe6cc7 | magicoder_evol | general_instruction | unknown | code_mixed_professional | corrected | Apache-2.0 | In most mean-variance frameworks I have seen, once we clear markets in the model, it determines asset prices (and returns). However, all of these frameworks assume that the correlation matrix of the underlying assets is given exogenously. Is there any mean-variance type model with an endogenous correlation matrix? I.e.... | To my knowledge, there is no mean-variance framework that accounts for endogenous asset correlation. In general, correlation matrices are assumed to be exogenous since they pertain to asset characteristics that are typically viewed as invariant to investor behavior. The correlation between assets primarily arises from ... | Ziyadatar mean-variance frameworks jo maine dekhe hain, un mein jab hum model mein markets clear karte hain, to ye asset prices (aur returns) determine karta hai. Taham, ye tamam frameworks ye assume karte hain ke underlying assets ki correlation matrix exogenously di gayi hai. Kya koi aisa mean-variance type model mau... | Meri maloomat ke mutabiq, aisa koi mean-variance framework nahi hai jo endogenous asset correlation ko consider karta ho. Aam taur par, correlation matrices ko exogenous assume kiya jata hai kyunke ye un asset characteristics se talluq rakhti hain jinhein investor behavior se invariant samjha jata hai. Assets ke darmiy... |
4c8ad7a452098b69f8cd614b | codefeedback | general_instruction | python | professional | no_issue | Apache-2.0 | Design a technique using Python programming language that can convert an input string into its corresponding camel case format.
String for conversion: this is the string to be transformed | You can use Python's built-in functions such as `split()`, `capitalize()`, and `join()` to solve this problem. Here's how you can do it:
Code:
```python
# function to convert a string to camel case
def convert_to_camel_case(s):
# split the input string into words
words = s.split(' ')
# capitalize each wor... | Python programming language ka istemal karte hue ek aisi technique design karein jo kisi input string ko uske mutabiqa camel case format mein convert kar sake.
Conversion ke liye string: this is the string to be transformed | Aap is maslay ko hal karne ke liye Python ke built-in functions jaise ke `split()`, `capitalize()`, aur `join()` ka istemal kar sakte hain. Aap ise is tarah kar sakte hain:
Code:
```python
# function to convert a string to camel case
def convert_to_camel_case(s):
# split the input string into words
words = s.... |
c6e628c70d78be852e3346ec | starcoder2_self_oss_exec | execution_validated_instruction | python | professional | no_issue | ODC-By-1.0 | Write a Python function `my_getattr(obj, attribute, default=None)` that behaves like the built-in `getattr` function, but supports a default value for the attribute instead of raising an exception when the attribute is missing. Your function should support attributes at any depth by using `getattr` recursively.
Additi... | To implement a custom version of `getattr` that supports a default value and supports attributes at any depth, we can use a recursive approach to traverse the attribute path and handle the default value when the attribute is missing.
Here is the implementation of the `my_getattr` function:
```python
def my_getattr(ob... | Ek Python function `my_getattr(obj, attribute, default=None)` likhein jo built-in `getattr` function ki tarah kaam kare, lekin attribute missing hone par exception raise karne ke bajaye attribute ke liye default value ko support kare. Aapka function `getattr` ko recursively use karte hue kisi bhi depth par attributes k... | `getattr` ka ek custom version implement karne ke liye jo default value aur kisi bhi depth par attributes ko support kare, hum attribute path traverse karne aur attribute missing hone par default value handle karne ke liye ek recursive approach use kar sakte hain.
Yeh rahi `my_getattr` function ki implementation:
```... |
c0f96d0f6e230ecad6c2d4e7 | commitpackft | code_modification | python | code_mixed_casual | no_issue | MIT | Create the following file according to the change request.
Change request:
Add initial unit tests for parameter.py (List)
File: spotpy/unittests/test_parameter.py | import unittest
try:
import spotpy
except ImportError:
import sys
sys.path.append(".")
import spotpy
from spotpy import parameter
import numpy as np
#https://docs.python.org/3/library/unittest.html
class TestListParameterDistribution(unittest.TestCase):
def setUp(self):
self.values = [1, ... | Change request ke mutabiq yeh file create karein.
Change request:
parameter.py (List) ke liye initial unit tests add karein
File: spotpy/unittests/test_parameter.py | import unittest
try:
import spotpy
except ImportError:
import sys
sys.path.append(".")
import spotpy
from spotpy import parameter
import numpy as np
#https://docs.python.org/3/library/unittest.html
class TestListParameterDistribution(unittest.TestCase):
def setUp(self):
self.values = [1, ... |
f802f12ebc1a095d0948f64a | acecode_87k | verified_problem | python | code_mixed_casual | no_issue | MIT | You are tasked with implementing a function that simulates the reading and processing of a BEDPE (Browser Extensible Data Paired-End) formatted string. The BEDPE format is used to represent paired-end genomic alignments and structural variations. Your function should take a string input that contains multiple lines of ... | import re
def parse_bedpe(bedpe_str):
"""Parse a BEDPE formatted string into a list of tuples.
Args:
bedpe_str (str): A string containing BEDPE formatted data.
Returns:
list: A list of tuples, where each tuple contains the chromosome names, start and end positions for each end of the paired... | Aap ne ek function implement karna hai jo BEDPE (Browser Extensible Data Paired-End) formatted string ki reading aur processing ko simulate kare. BEDPE format paired-end genomic alignments aur structural variations ko represent karne ke liye use hota hai. Aap ke function ko aik string input leni chahiye jis mein multip... | import re
def parse_bedpe(bedpe_str):
"""Parse a BEDPE formatted string into a list of tuples.
Args:
bedpe_str (str): A string containing BEDPE formatted data.
Returns:
list: A list of tuples, where each tuple contains the chromosome names, start and end positions for each end of the paired... |
80c5edc4ea473fe310412362 | magicoder_oss | general_instruction | cpp | code_mixed_professional | no_issue | MIT | You are tasked with implementing a simple alert management system for a user interface. The system should handle the display and dismissal of alerts, as well as a ticker mechanism for tracking time. The provided code snippet is a part of the implementation for this system. The `Ui::instance.alertManager.dismiss()` func... | ```java
public class AlertManager {
private int ticker;
public void dismiss() {
Ui.instance.alertManager.dismiss();
}
public void incrementTicker() {
ticker++;
}
}
```
In this solution, we create a class `AlertManager` with an instance variable `ticker` to track time. The `dismiss`... | Aap ko user interface ke liye aik simple alert management system implement karne ka task diya gaya hai. System ko alerts ki display aur dismissal ke sath sath time track karne ke liye aik ticker mechanism ko bhi handle karna chahiye. Diya gaya code snippet is system ki implementation ka aik hissa hai. `Ui::instance.ale... | ```java
public class AlertManager {
private int ticker;
public void dismiss() {
Ui.instance.alertManager.dismiss();
}
public void incrementTicker() {
ticker++;
}
}
```
Is solution mein, hum time track karne ke liye aik instance variable `ticker` ke sath aik class `AlertManager` ban... |
2625a941ee58ff35a4fec789 | magicoder_oss | general_instruction | csharp | code_mixed_professional | no_issue | MIT | You are tasked with implementing a function to convert a given dictionary into a JSON string. The function should handle nested dictionaries and should exclude any empty dictionaries from the output. The provided code snippet is part of a larger function that constructs a JSON string from a dictionary. The `result` var... | ```python
def ConvertDictionaryToJSON(dictionary):
def ConvertToJSONString(value):
if isinstance(value, dict):
return ConvertDictionaryToJSON(value)
else:
return json.dumps(value)
result = []
for key, value in dictionary.items():
if isinstance(value, dict):
... | Aap ko ek function implement karne ka task diya gaya hai jo diye gaye dictionary ko JSON string mein convert kare. Is function ko nested dictionaries ko handle karna chahiye aur output se kisi bhi empty dictionary ko exclude karna chahiye. Diya gaya code snippet ek bare function ka hissa hai jo dictionary se JSON strin... | ```python
def ConvertDictionaryToJSON(dictionary):
def ConvertToJSONString(value):
if isinstance(value, dict):
return ConvertDictionaryToJSON(value)
else:
return json.dumps(value)
result = []
for key, value in dictionary.items():
if isinstance(value, dict):
... |
765de5cd332fadf6076fe095 | magicoder_evol | general_instruction | csharp | code_mixed_professional | corrected | Apache-2.0 | I'm looking for a c# snippet which I can insert in a Windows service. The code must empty the recycle bin for all users on the computer.
I have previously tried using `SHEmptyRecycleBin` (ref [http://www.codeproject.com/KB/cs/Empty_Recycle_Bin.aspx](http://www.codeproject.com/KB/cs/Empty_Recycle_Bin.aspx)) however the... | Using the `SHEmptyRecycleBin` function can be problematic when running from a Windows Service, particularly due to the different session and privilege model services use compared to regular user processes. A different approach is to utilize the `FileSystem.Delete` method instead. This does require knowing where the Rec... | Mujhe aik C# snippet ki zaroorat hai jise main Windows service mein shamil kar sakoon. Code ko computer par mojood tamam users ke liye recycle bin empty karna chahiye.
Main ne pehle `SHEmptyRecycleBin` istemal karne ki koshish ki thi (ref [http://www.codeproject.com/KB/cs/Empty_Recycle_Bin.aspx](http://www.codeproject... | Windows Service se run karte waqt `SHEmptyRecycleBin` function ka istemal masla paida kar sakta hai, khaas tor par is session aur privilege model ke farq ki wajah se jo services aam user processes ke muqablay mein istemal karti hain. Aik mukhtalif approach yeh hai ke is ke bajaye `FileSystem.Delete` method use kiya jay... |
79242e29a3a4f33aee9c164f | starcoder2_self_oss_exec | execution_validated_instruction | python | professional | no_issue | ODC-By-1.0 | Given a two-dimensional array of integers, remove duplicated rows and return a new array only with unique rows. The order should be maintained, and the rows should be compared by row element values. For example:
```python
[
[1, 2, 3, 4],
[5, 6, 7, 8],
[1, 2, 3, 4],
[5, 6, 7, 8],
[9, 10, 11, 12]
]
`... | To remove duplicated rows from a two-dimensional array, we can use a set to store the unique rows. The idea is to iterate over each row in the array and check if it has already been seen before. If it has not, we add it to the set and the result array. If it has been seen before, we skip it and move on to the next row.... | Integers ka ek two-dimensional array diya gaya hai, duplicated rows ko remove karein aur sirf unique rows ke sath ek naya array return karein. Rows ki order maintain honi chahiye, aur rows ka comparison unke row element values ke mutabiq hona chahiye. Misaal ke tor par:
```python
[
[1, 2, 3, 4],
[5, 6, 7, 8],
... | Two-dimensional array se duplicated rows ko remove karne ke liye, hum unique rows ko store karne ke liye ek set use kar sakte hain. Idea yeh hai ke array ki har row par iterate karein aur check karein ke kya yeh pehle dekhi ja chuki hai. Agar yeh pehle nahi dekhi gayi, to hum ise set aur result array dono mein add kar ... |
b62ccb294f2a1d6249a2d79a | magicoder_oss | general_instruction | python | code_mixed_professional | corrected | MIT | You are given a DNA sequence represented as a string of nucleotides (A, C, G, T). Your task is to implement a function that modifies the sequence based on the following rules:
1. If the index `i` is such that `i % 3 == 2`, then the function should replace the nucleotide at index `i-2` and `i-1` with a new nucleotide `... | ```python
def modify_sequence(seq, i, nuc):
if i % 3 == 2:
modified_seq = seq[:i-2] + nuc + seq[i-1] + seq[i]
elif i % 3 == 1:
modified_seq = seq[:i-1] + nuc + seq[i] + seq[i+1]
return modified_seq
``` | Aapko nucleotides (A, C, G, T) ki string ke tor par ek DNA sequence di gayi hai. Aapka kaam ek aisa function implement karna hai jo mandarja zail rules ki buniyaad par sequence ko modify kare:
1. Agar index `i` aisa hai ke `i % 3 == 2`, to function ko index `i-2` aur `i-1` par mojood nucleotides ko ek naye nucleotide ... | ```python
def modify_sequence(seq, i, nuc):
if i % 3 == 2:
modified_seq = seq[:i-2] + nuc + seq[i-1] + seq[i]
elif i % 3 == 1:
modified_seq = seq[:i-1] + nuc + seq[i] + seq[i+1]
return modified_seq
``` |
46ce18217df94d5f95e8cf09 | codefeedback | general_instruction | python | casual_noisy | no_issue | Apache-2.0 | How would you construct a nested loop to print out the contents of a 2D array, but only print the odd numbers in reverse order, and only if they are divisible by 3? Additionally, implement the loop using a recursive function instead of a for loop.
arr=[[3,5,9,15],[21,27,32,36],[45,51,54,60]]
Please note that the abov... | To print out the contents of a 2D array, but only print the odd numbers in reverse order, and only if they are divisible by 3, you can construct a nested loop. Here's an example of how to do it using a recursive function:
```python
def print_odd_reverse(arr, row, col):
if row < 0:
return
if col < 0:
... | ek nested loop kese banao ge jo 2D array ke contents print kare, lekin sirf odd numbers reverse order mein aur wo bhi tab jab wo 3 se divide ho sakein? aur haan loop ki jagah recursive function use karna hai.
arr=[[3,5,9,15],[21,27,32,36],[45,51,54,60]]
ye baat dhyan mein rakho ke in changes se mushkil barh gayi hai ... | 2D array ke contents print karne ke liye, lekin sirf odd numbers jo 3 pe divide hon aur wo bhi ulte order mein, aap nested loop bana sakte hain. recursion use karke ye karne ka ek tareeqa ye hai:
```python
def print_odd_reverse(arr, row, col):
if row < 0:
return
if col < 0:
print_odd_reverse(a... |
9d25c9d18f754e0002475778 | acecode_87k | verified_problem | python | professional | no_issue | MIT | You are tasked with implementing a function called `calculate_property_value` that simulates a simple property management system. This function accepts a list of property details, where each property is represented as a dictionary containing 'address', 'type', and 'price'. The function should return the total value of ... | def calculate_property_value(property_list):
"""
Calculate the total value of all properties in the input list.
If the input list is empty, the function should return 0.
"""
total_value = 0
for property in property_list:
total_value += property['price']
return total_value | Aap ko `calculate_property_value` naam ka ek function implement karne ka kaam diya gaya hai jo ek simple property management system ko simulate karta hai. Yeh function property details ki ek list accept karta hai, jahan har property ko ek dictionary ke tor par represent kiya gaya hai jismein 'address', 'type', aur 'pri... | def calculate_property_value(property_list):
"""
Calculate the total value of all properties in the input list.
If the input list is empty, the function should return 0.
"""
total_value = 0
for property in property_list:
total_value += property['price']
return total_value |
3fabe2697ba03b6e14c14f80 | glaive_v3 | general_instruction | unknown | casual_noisy | no_issue | Apache-2.0 | You are tasked with implementing a CUDA kernel function that calculates the dot product of two arrays and then performs decimation. The function should be able to handle both real and complex numbers.
Your task is to create a CUDA kernel function that takes two input arrays of type T, where T can be int8_t, int16_t, i... | To solve this problem, you need to create a CUDA kernel function that takes two input arrays of type T and calculates their dot product. After calculating the dot product, the function should perform decimation by adding up all the elements except the first one and setting the rest to zero.
You can use the given code ... | tumhe aik CUDA kernel function banana he jo 2 arrays ka dot product nikale aur phir decimation kare. function real aur complex dono qisam k numbers handle kar sake.
tumhara kaam ye he k aik CUDA kernel function banao jo type T k do input arrays le, jahan T int8_t, int16_t, int32_t, int64_t, float, double, std::complex... | is masle ko solve karne k liye tumhe aik CUDA kernel function likhna hoga jo type T k do input arrays le aur unka dot product calculate kare. dot product k baad function ko decimation karni he pehle element k ilawa baqi sab elements ko jama kar k aur baki sab ko zero bana k.
tum diye gaye code snippet ko reference k t... |
e7d8b3ef17a81f8960bcde1d | acecode_87k | verified_problem | python | code_mixed_casual | no_issue | MIT | Given a list of integers, write a function that transforms the list into a string representation of an XML format. Each integer should be wrapped in a `<number>` tag. The function should return the resulting XML string. For example, given the input list [1, 2, 3], the output should be '<numbers><number>1</number><numbe... | """
XML Representation of a List of Integers
Given a list of integers, this function transforms the list into a string representation of an XML format.
Each integer is wrapped in a `<number>` tag.
Example:
- Input: [1, 2, 3]
- Output: '<numbers><number>1</number><number>2</number><number>3</number></numbers>'... | Integers ki aik list di gayi hai, aik function likhein jo is list ko XML format ki string representation mein transform kar de. Har integer aik `<number>` tag ke andar wrapped hona chahiye. Function ko resulting XML string return karni chahiye. For example, agar input list [1, 2, 3] ho, toh output '<numbers><number>1</... | """
XML Representation of a List of Integers
Given a list of integers, this function transforms the list into a string representation of an XML format.
Each integer is wrapped in a `<number>` tag.
Example:
- Input: [1, 2, 3]
- Output: '<numbers><number>1</number><number>2</number><number>3</number></numbers>'... |
fdc3a6309d695363cdab0684 | acecode_87k | verified_problem | python | professional | no_issue | MIT | Implement a function `sort_by_binary_length(arr)` that takes an array of non-negative integers and sorts it based on the length of their binary representations in ascending order. If two integers have the same binary length, they should be sorted by their decimal value in ascending order. The function should return the... | def sort_by_binary_length(arr):
"""
Sorts an array of non-negative integers based on the length of their binary representations in ascending order.
If two integers have the same binary length, they should be sorted by their decimal value in ascending order.
The function should return the sorted array.... | Aik function `sort_by_binary_length(arr)` implement karein jo non-negative integers ki aik array leta hai aur usay unki binary representations ki length ki bunyaad par ascending order mein sort karta hai. Agar do integers ki binary length barabar ho, to unhein unki decimal value ke mutabiq ascending order mein sort kiy... | def sort_by_binary_length(arr):
"""
Sorts an array of non-negative integers based on the length of their binary representations in ascending order.
If two integers have the same binary length, they should be sorted by their decimal value in ascending order.
The function should return the sorted array.... |
af339eaeeb03ee8dab3e195b | commitpackft | code_modification | yaml | code_mixed_casual | corrected | MIT | Create the following file according to the change request.
Change request:
Update from Forestry.io - Updated Forestry configuration
File: .forestry/front_matter/templates/webinar-template.yml | ---
label: Webinar Template
hide_body: false
fields:
- type: text
name: layout
label: layout
- type: text
name: title
label: title
- type: file
name: img-url
label: img-url
- type: datetime
name: date
label: date
- type: boolean
name: enable-header
label: enable-header
- type: text
name: event-typ... | Change request ke mutabiq following file create karein.
Change request:
Forestry.io se update - Updated Forestry configuration
File: .forestry/front_matter/templates/webinar-template.yml | ---
label: Webinar Template
hide_body: false
fields:
- type: text
name: layout
label: layout
- type: text
name: title
label: title
- type: file
name: img-url
label: img-url
- type: datetime
name: date
label: date
- type: boolean
name: enable-header
label: enable-header
- type: text
name: event-typ... |
3dd4ec1d03dffd8c55be3163 | magicoder_evol | general_instruction | javascript | code_mixed_professional | corrected | Apache-2.0 | Create a basic React application for a search engine. The application should include a search bar and a button. Whenever the button is clicked, the search bar should perform a search with the entered query. | Sure, here's a basic example of a React application implementing a search bar. No real search functionality is implemented, but you get the idea.
```jsx
import React from 'react';
class SearchEngine extends React.Component {
constructor(props) {
super(props);
this.state = { query: '' };
this.search = ... | Aik basic React application banayein jo aik search engine ka kaam kare. Is application mein aik search bar aur aik button hona chahiye. Jab bhi button par click kiya jaye, toh search bar ko entered query ke mutabiq search perform karni chahiye. | Bilkul, yeh React application ka aik basic example hai jo search bar implement karta hai. Is mein koi real search functionality implement nahi ki gayi, lekin aapko is ka concept samajh aa jayega.
```jsx
import React from 'react';
class SearchEngine extends React.Component {
constructor(props) {
super(props);
... |
f76b783889550154b445b64a | acecode_87k | verified_problem | python | professional | no_issue | MIT | Given a non-negative integer n, implement a function that calculates the factorial of n, denoted as n!. The factorial is the product of all positive integers less than or equal to n. For instance, 5! = 5 × 4 × 3 × 2 × 1 = 120. Your implementation should raise a ValueError if a negative integer is provided as input. Def... | def factorial(n):
"""
Calculates the factorial of n, denoted as n!.
Raises a ValueError if a negative integer is provided as input.
"""
if n < 0:
raise ValueError("Negative input not allowed")
result = 1
for i in range(1, n+1):
result *= i
return result | Aik non-negative integer n diya gaya hai, aik aisa function implement karen jo n ka factorial calculate kare, jisay n! se zahir kiya jata hai. Factorial n ya us se chotay tamam positive integers ka product hota hai. Maslan, 5! = 5 x 4 x 3 x 2 x 1 = 120. Agar input mein negative integer diya jaye to aap ki implementatio... | def factorial(n):
"""
Calculates the factorial of n, denoted as n!.
Raises a ValueError if a negative integer is provided as input.
"""
if n < 0:
raise ValueError("Negative input not allowed")
result = 1
for i in range(1, n+1):
result *= i
return result |
d0c9298301d8bc01afc8032d | codefeedback | general_instruction | java | casual_noisy | corrected | Apache-2.0 | Implement a custom stack class in Java including common methods such as push, pop, peek, and isEmpty. Additionally, provide an implementation for a method that returns the minimum element in the stack in constant time. Make sure your stack implementation is generic and thread-safe, and optimizes memory usage as much as... | Here is a simple yet effective Java implementation that creates a custom thread-safe stack. It includes methods such as push, pop, peek, isEmpty, and getMin to obtain the minimum element. This stack implementation is generic and uses a separate minStack for constant time retrieval of minimum element. It uses synchronis... | Java me ek custom stack class bnao jis m push, pop, peek, aur isEmpty jese common methods hon. Sath hi ek aisa method b dalna jo constant time me stack ka min element return kre. Stack ko generic aur thread-safe rkhna, aur jitna ho ske memory b chaho k optimize ho. | Ye lo ek simple pr fit kism ki Java implementation jo custom thread-safe stack bnati h. Isme push, pop, peek, isEmpty, aur getMin jese methods hn taake minimum element mil ske. Ye stack generic h aur min element ko constant time me nikalne k liye alag minStack use krti h. Thread-safety k liye synchronized block aur beh... |
d45a25dcb1ef1ac30b99405f | acecode_87k | verified_problem | python | code_mixed_casual | no_issue | MIT | You are tasked with simulating a login response for a fictitious platform. Write a function `simulate_login_response(username: str, password: str, sid: str) -> Tuple[int, Optional[str], Optional[str], str, Optional[str], Optional[int]]` that takes a username, password, and session id as input and returns a tuple contai... | #!/usr/bin/env python3
from typing import Tuple, Optional
def simulate_login_response(username: str, password: str, sid: str) -> Tuple[int, Optional[str], Optional[str], str, Optional[str], Optional[int]]:
"""
Simulates a login response for a fictitious platform.
Takes a username, password, and session id ... | Aap ko aik fictitious platform ke liye login response simulate karne ka task mila hai. Aik function `simulate_login_response(username: str, password: str, sid: str) -> Tuple[int, Optional[str], Optional[str], str, Optional[str], Optional[int]]` likhein jo username, password, aur session id as input leta ho aur aik tupl... | #!/usr/bin/env python3
from typing import Tuple, Optional
def simulate_login_response(username: str, password: str, sid: str) -> Tuple[int, Optional[str], Optional[str], str, Optional[str], Optional[int]]:
"""
Simulates a login response for a fictitious platform.
Takes a username, password, and session id ... |
0cee80294eb26dfb67cc812a | commitpackft | code_modification | html | code_mixed_casual | no_issue | bsd-3-clause | Apply the following change to the existing file.
Change request:
Fix 'Create Badge' markdown closing-bracket typos
The 'Create Badge' function was introduced with
https://github.com/scalacenter/scaladex/pull/670, but unfortunately a
small typo was introduced with https://github.com/scalacenter/scaladex/pull/705,
remo... | @import scaladex.core.model.Artifact
@import scaladex.core.model.Env
@(artifact: Artifact, env: Env)
<div class="box badge-showcase">
<h4>Markdown Badge</h4>
<div style="overflow: hidden">
<a href="#badge-markdown">
<img src="@artifact.badgeUrl(env)" />
</a>
</div>
<div id="badge-markdown" class="overl... | Existing file mein yeh change apply karein.
Change request:
'Create Badge' markdown closing-bracket typos fix karein
'Create Badge' function https://github.com/scalacenter/scaladex/pull/670, ke sath introduce hua tha lekin unfortunately https://github.com/scalacenter/scaladex/pull/705, ke sath ek chhota sa typo intro... | @import scaladex.core.model.Artifact
@import scaladex.core.model.Env
@(artifact: Artifact, env: Env)
<div class="box badge-showcase">
<h4>Markdown Badge</h4>
<div style="overflow: hidden">
<a href="#badge-markdown">
<img src="@artifact.badgeUrl(env)" />
</a>
</div>
<div id="badge-markdown" class="overl... |
1ca74a99ed0c74c1f5b6d8c8 | glaive_v3 | general_instruction | java | casual_noisy | no_issue | Apache-2.0 | You are tasked with creating a Spring ApplicationContext that will be used to manage and configure the beans in a Java application. You need to write a class that will configure the ApplicationContext and then retrieve a specific bean from it.
Write a class called "ApplicationContextConfig" with a method called "crea... | ```java
package org.example.springframework.contextaware;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@... | tumhe aik Spring ApplicationContext bnana he jo Java app k beans manage aur configure krne k kaam aye ga. Tum ne aik aisi class likhni h jo ApplicationContext configure kre aur phr us me se ek specific bean nikal k laye.
"ApplicationContextConfig" k naam se class bnao js me "createApplicationContext" method ho jo Appl... | ```java
package org.example.springframework.contextaware;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@... |
e526ae1e90a02dcb06cae00b | acecode_87k | verified_problem | python | code_mixed_casual | no_issue | MIT | Given a configuration dictionary that represents repositories, write a function `get_repo_paths` that takes a dictionary as input and returns a list of repository paths. The input dictionary has the following structure: it contains a key 'repos' which maps to another dictionary. Each key in this inner dictionary repres... | def get_repo_paths(config: dict) -> list:
"""
Given a configuration dictionary that represents repositories, write a function `get_repo_paths` that takes a dictionary as input and returns a list of repository paths. The input dictionary has the following structure: it contains a key 'repos' which maps to anothe... | Aik configuration dictionary di gayi hai jo repositories ko represent karti hai. Aik function `get_repo_paths` likhen jo input mein dictionary le aur repository paths ki list return kare. Input dictionary ka structure kuch aisa hai: is mein aik key 'repos' hai jo aik aur dictionary se map hoti hai. Is inner dictionary ... | def get_repo_paths(config: dict) -> list:
"""
Given a configuration dictionary that represents repositories, write a function `get_repo_paths` that takes a dictionary as input and returns a list of repository paths. The input dictionary has the following structure: it contains a key 'repos' which maps to anothe... |
f6b9a7e7be79e2da72da58f7 | magicoder_oss | general_instruction | python | code_mixed_professional | no_issue | MIT | You are tasked with creating a program that processes student grades and calculates the average grade for a given set of students. The program should prompt the user to input the grades for each student and then calculate and display the average grade for the entire class.
The program should follow these specification... | ```python
def calculate_average_grade():
num_students = int(input("Enter the number of students: "))
total_grade = 0
for i in range(num_students):
grade = float(input(f"Enter the grade for student {i+1}: "))
total_grade += grade
average_grade = total_grade / num_students
print(f"Th... | Aap ko aik aisa program banane ka task diya gaya hai jo student grades ko process kare aur diye gaye students ke group ke liye average grade calculate kare. Program ko user se har student ke grades input karne ka prompt dena chahiye aur phir poori class ke liye average grade calculate aur display karna chahiye.
Progra... | ```python
def calculate_average_grade():
num_students = int(input("Enter the number of students: "))
total_grade = 0
for i in range(num_students):
grade = float(input(f"Enter the grade for student {i+1}: "))
total_grade += grade
average_grade = total_grade / num_students
print(f"Th... |
62b23f3ca477a2aa980d40c7 | magicoder_oss | general_instruction | swift | code_mixed_professional | no_issue | MIT | You are tasked with creating a search functionality for a mobile app using SwiftUI. The app should allow users to input a search query and display search results based on that query. You need to implement the search functionality using the provided code snippet as a starting point.
Given the provided code snippet:
```... | ```swift
import SwiftUI
struct SearchView: View {
@State var searchText = ""
@State var isSearching = false
@State var searchResults: [String] = []
private func performSearch() {
// Simulate an asynchronous search operation
isSearching = true
DispatchQueue.main.asyncAfter(deadl... | Aap ko SwiftUI ka istemal karte hue ek mobile app ke liye search functionality create karne ka task diya gaya hai. App ko users ko search query input karne ki ijazat deni chahiye aur us query ki bunyad par search results display karne chahiye. Aap ko provide kiye gaye code snippet ko starting point ke tor par use karte... | ```swift
import SwiftUI
struct SearchView: View {
@State var searchText = ""
@State var isSearching = false
@State var searchResults: [String] = []
private func performSearch() {
// Simulate an asynchronous search operation
isSearching = true
DispatchQueue.main.asyncAfter(deadl... |
cea64c3238fc7f551e0443c4 | acecode_87k | verified_problem | python | professional | no_issue | MIT | Implement a function `valid_pin(pin: str) -> bool` that verifies the validity of a customer's confidential pin. The pin is considered valid if it satisfies the following conditions: it must have an uneven number of digits, consist of at least two distinct non-consecutive digits, and must not contain any recognized nume... | def valid_pin(pin: str) -> bool:
"""
Implements a function that verifies the validity of a customer's confidential pin.
"""
# Check if pin has an uneven number of digits
if len(pin) % 2 == 0:
return False
# Check if pin has at least two distinct non-consecutive digits
if len(set(pin... | Aik function `valid_pin(pin: str) -> bool` implement karein jo kisi customer ke confidential pin ki validity check kare. Pin us waqt valid mana jaye ga agar yeh conditions poori hon: is mein digits ki tadad uneven (odd) honi chahiye, is mein kam az kam do mukhtalif non-consecutive digits hone chahiye, aur is mein koi b... | def valid_pin(pin: str) -> bool:
"""
Implements a function that verifies the validity of a customer's confidential pin.
"""
# Check if pin has an uneven number of digits
if len(pin) % 2 == 0:
return False
# Check if pin has at least two distinct non-consecutive digits
if len(set(pin... |
195dd47d2fb85be8625f125a | magicoder_evol | general_instruction | python | code_mixed_professional | no_issue | Apache-2.0 | Enhance the original code by inserting more conditions and demand a multi-layered solution:
Complete the provided code to compute and return the modular inverse of a and p. However, if a and p are both squares of a prime number, you should return None.
def modInv(a: int, p: int):
"""
Compute the modular inver... | Here is the python solution:
```python
import math
def is_square(n):
return n == math.isqrt(n) ** 2
def is_prime(n):
if n <= 1 or (n % 2 == 0 and n > 2):
return False
return all(n % i for i in range(3, int(math.sqrt(n)) + 1, 2))
def is_square_of_prime(n):
root = math.isqrt(n)
return is_... | Mazeed conditions shamil kar ke original code ko behtar banayein aur aik multi-layered solution provide karein:
a aur p ka modular inverse compute aur return karne ke liye faraham kardah code ko mukammal karein. Taham, agar a aur p dono kisi prime number ke squares hon, toh aapko None return karna chahiye.
def modInv... | Python solution yeh hai:
```python
import math
def is_square(n):
return n == math.isqrt(n) ** 2
def is_prime(n):
if n <= 1 or (n % 2 == 0 and n > 2):
return False
return all(n % i for i in range(3, int(math.sqrt(n)) + 1, 2))
def is_square_of_prime(n):
root = math.isqrt(n)
return is_squa... |
880399de3e638cc2a2b6676b | commitpackft | code_modification | ruby | code_mixed_casual | no_issue | MIT | Apply the following change to the existing file.
Change request:
Test :command for exec in rbenv::rehash.
File: spec/defines/rbenv__rehash_spec.rb
Existing code:
```ruby
require 'spec_helper'
describe 'rbenv::rehash' do
let(:facts) {{
:osfamily => 'Debian',
}}
context 'Version 1.2.3-p456' do
let(:tit... | require 'spec_helper'
describe 'rbenv::rehash' do
let(:facts) {{
:osfamily => 'Debian',
}}
context 'Version 1.2.3-p456' do
let(:title) { '1.2.3-p456' }
it {
should contain_exec('rbenv rehash for 1.2.3-p456').with(
:command => '/usr/bin/rbenv rehash',
:environment => [
... | Mawjooda file mein yeh change apply karein.
Change request:
rbenv::rehash mein exec ke liye :command ko test karein.
File: spec/defines/rbenv__rehash_spec.rb
Mawjooda code:
```ruby
require 'spec_helper'
describe 'rbenv::rehash' do
let(:facts) {{
:osfamily => 'Debian',
}}
context 'Version 1.2.3-p456' do
... | require 'spec_helper'
describe 'rbenv::rehash' do
let(:facts) {{
:osfamily => 'Debian',
}}
context 'Version 1.2.3-p456' do
let(:title) { '1.2.3-p456' }
it {
should contain_exec('rbenv rehash for 1.2.3-p456').with(
:command => '/usr/bin/rbenv rehash',
:environment => [
... |
53a9b8a5be28535802dcf910 | acecode_87k | verified_problem | python | code_mixed_casual | no_issue | MIT | You are tasked with calculating the financial difference between total debits and total credits for a financial account. Write a function `calculate_financial_difference(debits: List[float], credits: List[float]) -> float` that takes in two lists of floats: `debits` and `credits`. The function should return the differe... | def calculate_financial_difference(debits, credits):
return sum(debits) - sum(credits) | Yaar, tumne aik financial account ke total debits aur total credits ke darmiyan difference calculate karna hai. Aik function `calculate_financial_difference(debits: List[float], credits: List[float]) -> float` likho jo floats ki do lists, `debits` aur `credits`, input le. Function ko debits ke total sum aur credits ke ... | def calculate_financial_difference(debits, credits):
return sum(debits) - sum(credits) |
0055dda3c458c68a97b44670 | magicoder_evol | general_instruction | python | code_mixed_professional | no_issue | Apache-2.0 | Design two Python functions. The first function should accept a list of dictionaries and returns a list of dictionaries with distinct values based on a provided key. The second function should accept a list of dictionaries, a specific key, and a value. It should return a new list of dictionaries from the input list tha... | The first function has a logical error in the `if` statements. It appends item to the `return_data` when the item's key is not in `unique_values`. But it doesn't add the item's key to `unique_values` which it should do. It currently does that in the `else` case which will almost never execute as each item is a new entr... | Do Python functions design karen. Pehla function dictionaries ki ek list accept kare aur provided key ki bunyad par distinct values wali dictionaries ki list return kare. Doosra function dictionaries ki ek list, ek specific key, aur ek value accept kare. Yeh input list mein se dictionaries ki ek nayi list return kare j... | Pehle function ke `if` statements mein ek logical error hai. Jab item ki key `unique_values` mein nahi hoti, toh yeh item ko `return_data` mein append kar deta hai. Lekin yeh item ki key ko `unique_values` mein add nahi karta jo ke ise karna chahiye. Yeh filhal yeh kaam `else` case mein kar raha hai jo takriban kabhi e... |
241418ca2e6a09f6de3d28d5 | acecode_87k | verified_problem | python | professional | no_issue | MIT | You are tasked with implementing a simplified web crawler that adheres to the rules specified in a robots.txt file. The robots.txt file specifies which URLs can be accessed by web crawlers. Your task is to implement a function `process_url(url: str, current_url: str, current_depth: int, visited_urls: dict, site_graph: ... | from collections import defaultdict
class MockRobots:
def can_fetch(self, url: str) -> bool:
# Implement the logic to check if the URL can be fetched according to the robots.txt rules
# For this example, we'll return True for simplicity
return True
def process_url(url: str, current_url: st... | Aap ko ek simplified web crawler implement karne ka kaam diya gaya hai jo robots.txt file mein di gayi rules par amal karta hai. Robots.txt file yeh specify karti hai ke web crawlers konsi URLs ko access kar sakte hain. Aap ka kaam ek function `process_url(url: str, current_url: str, current_depth: int, visited_urls: d... | from collections import defaultdict
class MockRobots:
def can_fetch(self, url: str) -> bool:
# Implement the logic to check if the URL can be fetched according to the robots.txt rules
# For this example, we'll return True for simplicity
return True
def process_url(url: str, current_url: st... |
RUBIC-58K
Roman Urdu Benchmark for Instructional Code
RUBIC stands for Roman Urdu Benchmark for Instructional Code—a name inspired by the Rubik's Cube and its connection to problem-solving and algorithmic thinking.
The first large-scale Roman Urdu coding instruction dataset: 57,899 bilingual programming problems and answers in English and Pakistani Roman Urdu.
Roman Urdu is how millions of Pakistanis naturally communicate online, but high-quality programming data in this register has been largely absent. RUBIC-58K brings together seven established coding sources in a consistent bilingual format while preserving the code that makes each example useful.
To the best of our knowledge at the time of release, this is the world's first large-scale dataset built specifically for coding instruction and answer tasks in Roman Urdu.
Created and curated by Talha Bin Omar.
Dataset at a glance
| Property | Value |
|---|---|
| Total examples | 57,899 |
| Training split | 50,000 |
| Test split | 7,899 |
| Upstream coding sources | 7 |
| Roman Urdu writing styles | 4 |
| Languages | English + Pakistani Roman Urdu |
| Primary tasks | Instruction tuning, code assistance, bilingual evaluation |
Highlights
- Balanced by design: the 50K training split is balanced across all seven sources and all four writing styles.
- Bilingual pairs: every row contains the original English instruction/answer and its Roman Urdu counterpart.
- Code-safe processing: fenced code, inline code, comments, formulas, URLs, identifiers, and literals are preserved.
- Multi-stage quality control: every published row passed semantic, structural, formatting, and code-integrity checks.
- Clean evaluation split: exact deduplication and zero ID/content overlap between train and test.
- Traceable provenance: source and license metadata are retained on every row.
Quick start
from datasets import load_dataset
dataset = load_dataset("TBOGamer22/RUBIC-58K")
print(dataset)
print(dataset["train"][0])
For supervised fine-tuning, use instruction_roman_urdu as the prompt and response_roman_urdu as the target.
def to_messages(example):
return {
"messages": [
{"role": "user", "content": example["instruction_roman_urdu"]},
{"role": "assistant", "content": example["response_roman_urdu"]},
]
}
chat_dataset = dataset["train"].map(to_messages)
Splits
| Split | Rows | Policy |
|---|---|---|
train |
50,000 | Deterministic, exactly source/style balanced |
test |
7,899 | Every remaining clean, deduplicated row |
| Total | 57,899 |
Training sources
| Source | Rows |
|---|---|
acecode_87k |
7,143 |
codefeedback |
7,143 |
commitpackft |
7,143 |
glaive_v3 |
7,143 |
magicoder_oss |
7,143 |
starcoder2_self_oss_exec |
7,143 |
magicoder_evol |
7,142 |
Training styles
| Style | Rows |
|---|---|
casual_noisy |
12,500 |
code_mixed_casual |
12,500 |
code_mixed_professional |
12,500 |
professional |
12,500 |
Schema
| Field | Description |
|---|---|
id |
Stable source-derived identifier |
source |
Normalized upstream dataset key |
task_type |
General, verified, execution-validated, or code-modification task |
language |
Primary programming/markup language |
translation_style |
Assigned Roman Urdu register |
verification_status |
no_issue or corrected; both contain final reviewed text |
license |
Upstream/per-sample license identifier |
instruction_en, response_en |
Original English pair |
instruction_roman_urdu, response_roman_urdu |
Final reviewed Roman Urdu pair |
Roman Urdu styles
casual_noisy: informal Pakistani chat spelling with natural variation.professional: polished Pakistani Roman Urdu.code_mixed_casual: informal Roman Urdu with English developer terminology.code_mixed_professional: professional Roman Urdu/English technical code-mixing.
Curation and quality control
- Coding examples were selected and normalized from seven established datasets.
- Natural-language instructions, explanations, and solution prose were translated into one of four Roman Urdu registers without changing their meaning.
- Code-like content was isolated and restored unchanged.
- A separate verification pass checked semantic fidelity, Roman Urdu style, formatting, and code preservation; detected issues were corrected before publication.
- Release preparation removed conversational wrappers and malformed records, excluded rows without a usable license, and deduplicated exact content.
- A deterministic allocation produced an exactly balanced 50K training split; every remaining eligible row became part of the held-out test split.
Upstream sources and licenses
| Key | Dataset | License |
|---|---|---|
glaive_v3 |
Glaive Code Assistant v3 | Apache-2.0 |
codefeedback |
CodeFeedback Filtered Instruction | Apache-2.0 |
starcoder2_self_oss_exec |
StarCoder2 Self OSS Instruct Exec | ODC-By-1.0 |
acecode_87k |
AceCode-87K | MIT |
commitpackft |
CommitPackFT | Per-row license; see the license column |
magicoder_oss |
Magicoder OSS Instruct | MIT |
magicoder_evol |
Magicoder Evol Instruct | Apache-2.0 |
This is a mixed-license collection, so Hub metadata uses license: other. The per-row license field is authoritative. Review LICENSES.md before redistribution or commercial use.
Curation summary
- Input rows: 58,083
- Published rows: 57,899
- Excluded during final quality checks: 184
- Rows refined during verification: 8,141
- Exact train/test ID overlap: 0
- Exact train/test content overlap: 0
Intended uses
- Fine-tuning/evaluating coding assistants for Pakistani Roman Urdu.
- Bilingual coding retrieval and translation.
- Studying code-switching and informal spelling.
- Evaluating preservation of code embedded in translated prose.
Limitations and responsible use
- Roman Urdu has no standardized spelling; variants are intentional but uneven.
- Quality-control checks can still miss semantic errors, awkward phrasing, contamination, or subtle code changes.
- Upstream data may contain incorrect, insecure, outdated, duplicated-in-spirit, or non-coding content.
- The release was not exhaustively screened for personal information, secrets, unsafe code, or benchmark contamination.
- English code comments remain English because code/comments were deliberately protected.
- Do not treat
testas contamination-free without task-specific decontamination. - Users are responsible for each row's upstream license.
Reproducibility
- Preparation seed:
20261026 - Input SHA-256:
0ca8348f72adc550af26c39eb03badcaa8a6aa6ac75ede5008971c150bdc175f - Statistics and hashes:
reports/preparation_report.json - Builder:
prepare_hf_dataset.py
Citation
@misc{binomar2026rubic,
title = {RUBIC-58K: Roman Urdu Benchmark for Instructional Code},
author = {Talha Bin Omar},
year = {2026},
howpublished = {Hugging Face},
url = {https://huggingface.co/datasets/TBOGamer22/RUBIC-58K}
}
Contact
Questions, feedback, and collaboration proposals are welcome through the Hugging Face profile of Talha Bin Omar.
- Downloads last month
- 27