asparius/qwen38-opus55-sft-lora
Updated
dataset stringclasses 1
value | domain stringclasses 8
values | prompt_index int64 0 26.7k | sample_index int64 0 0 | provider stringclasses 1
value | model stringclasses 1
value | split stringclasses 1
value | prompt listlengths 1 5 | text stringlengths 1 42.6k | finish_reason stringclasses 3
values | usage dict | reasoning null |
|---|---|---|---|---|---|---|---|---|---|---|---|
allenai/Dolci-Instruct-SFT | Coding | 140 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Write a program that reads an integer from standard input and prints \"True\" if the integer is even, or \"False\" otherwise.\n\nInput\nA single integer n on a line.\n\nOutput\nPrint \"True\" if n is even, otherwise print \"False\"."
}
] | ```python
n = int(input().strip())
print("True" if n % 2 == 0 else "False")
```
The program reads the line, removes surrounding whitespace, and converts it to an integer. If `n % 2` is 0, the number is even and it prints `True`; otherwise it prints `False`.
Negative numbers are handled correctly too: in Python, `-4 %... | end_turn | {
"input_tokens": 79,
"output_tokens": 169
} | null |
allenai/Dolci-Instruct-SFT | Coding | 54 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Please rectify the code snippet written in Java provided below by appendding a crucial missing element: a semicolon.\npublic static void main(String[] args) {\nSystem.out.println(\"Hello World\")"
}
] | Here's the corrected code with the missing semicolon added:
```java
public static void main(String[] args) {
System.out.println("Hello World");
}
```
**Changes made:**
1. **Added the semicolon (`;`)** at the end of the `System.out.println("Hello World")` statement. In Java, every statement must end with a semicol... | end_turn | {
"input_tokens": 67,
"output_tokens": 251
} | null |
allenai/Dolci-Instruct-SFT | Coding | 101 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Write an SQL query to retrieve all records from a table named \"customers\" where the \"country\" column equals \"USA\", and order them by the \"last_purchase_date\" column in descending order. Exclude records with null or empty \"email_address\" fields."
}
] | ```sql
SELECT *
FROM customers
WHERE country = 'USA'
AND email_address IS NOT NULL
AND email_address <> ''
ORDER BY last_purchase_date DESC;
```
**How it works:**
- **`SELECT *`** retrieves all columns.
- **`WHERE country = 'USA'`** keeps only US customers.
- **`email_address IS NOT NULL`** excludes rows with no ... | end_turn | {
"input_tokens": 80,
"output_tokens": 499
} | null |
allenai/Dolci-Instruct-SFT | Coding | 233 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "You are to write a program that determines the winner of a rock-paper-scissors game between two players.\n\nInput:\nThe program will take two characters as input, separated by a newline:\n- The first line contains the character representing the first player's choice: 'R' for Ro... | ## Solution
Each choice beats exactly one other choice: Rock beats Scissors, Paper beats Rock, and Scissors beats Paper. If the first player's choice beats the second player's choice, the first player wins. Otherwise the second player wins, because the problem says there are no ties.
```python
import sys
def main():... | end_turn | {
"input_tokens": 219,
"output_tokens": 477
} | null |
allenai/Dolci-Instruct-SFT | Coding | 283 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Given a string s, generate and print all unique permutations of the given string, one per line, in any order.\n\nInput\nA single line containing the string s (1 ≤ |s| ≤ 8, consisting of lowercase English letters).\n\nOutput\nPrint all unique permutations of the string, each on ... | The approach is to sort the characters and use backtracking that skips duplicate choices, so each distinct permutation is produced exactly once.
1. Sort the characters so identical letters sit next to each other.
2. Build each permutation position by position, keeping track of which original indices are already used.
... | end_turn | {
"input_tokens": 101,
"output_tokens": 552
} | null |
allenai/Dolci-Instruct-SFT | Coding | 120 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Write a program that reads a single line of input, which is a string. Determine if the string is a palindrome, ignoring spaces, punctuation, and capitalization. Output True if the string is a palindrome, otherwise output False.\n\nYou must not use any built-in string reversing ... | The approach uses two pointers that move inward from both ends of the string. Any character that isn't a letter or digit is skipped, and the remaining characters are compared case-insensitively. No reversing is done.
```python
def is_palindrome(s):
left = 0
right = len(s) - 1
while left < right:
#... | end_turn | {
"input_tokens": 180,
"output_tokens": 608
} | null |
allenai/Dolci-Instruct-SFT | Coding | 40 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Write a python function to help me organize the metadata of my documentary films. Each documentary is described by a dictionary with the following keys: `title`, `year`, and `duration` (in minutes). I want to be able to filter these documentaries based on a minimum duration. Th... | ```python
def filter_documentaries_by_duration(documentaries, min_duration):
"""
Return the titles of documentaries whose duration meets or exceeds min_duration.
Args:
documentaries (list[dict]): Each dict has the keys 'title', 'year',
and 'duration' (in minutes).
min_duration (... | end_turn | {
"input_tokens": 312,
"output_tokens": 661
} | null |
allenai/Dolci-Instruct-SFT | Coding | 10 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "You are tasked with creating a Python function that extracts the source files and programming language from a given configuration dictionary. The configuration dictionary contains two keys: 'sources', which is a list of source file paths, and 'language', which is a string indic... | ## Approach
Read the language once, then pair it with each source path in order.
```python
from typing import List, Tuple
def extract_source_files(config: dict) -> List[Tuple[str, str]]:
"""
Extract source files and their programming language from a configuration dict.
Args:
config: A dictionar... | end_turn | {
"input_tokens": 205,
"output_tokens": 619
} | null |
allenai/Dolci-Instruct-SFT | Coding | 231 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Write a program that reads a single line of input containing a string. The program should:\n- Convert the string into a list of words,\n- Remove any duplicate words (case-insensitive),\n- Handle punctuation correctly (all punctuation should be ignored when considering words),\n... | The program deletes punctuation, lowercases the text, splits it into words, removes duplicates with a set, and prints the words in sorted order.
```python
import string
import sys
def main():
line = sys.stdin.readline()
# Remove all punctuation characters
cleaned = line.translate(str.maketrans('', '', st... | end_turn | {
"input_tokens": 255,
"output_tokens": 661
} | null |
allenai/Dolci-Instruct-SFT | Coding | 0 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "You are given an array of integers. Your task is to find the maximum subarray sum, which is the largest sum of a contiguous subarray (of at least one element) within the given array.\n\nInput:\n- The first line contains a single integer n, the number of elements in the array (1... | Use Kadane's algorithm, which runs in O(n) time and O(1) extra space.
**Idea:** Scan the array left to right and keep two values:
- `cur`: the best sum of a subarray that ends exactly at the current element.
- `best`: the best sum seen so far.
At each element `x`, the best subarray ending here either extends the prev... | end_turn | {
"input_tokens": 203,
"output_tokens": 800
} | null |
allenai/Dolci-Instruct-SFT | Coding | 193 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "You are given a string that contains only lowercase letters. Your task is to implement a function that returns the first non-repeating character in the string. If there are no non-repeating characters, return an empty string. For example, given the string 'leetcode', the first ... | ## Approach
Make two passes over the string:
1. **Count** how many times each character occurs.
2. **Scan** the string again in its original order and return the first character whose count is `1`.
The second pass goes through the string itself, not the counts, so the original order is kept and the *first* unique ch... | end_turn | {
"input_tokens": 167,
"output_tokens": 715
} | null |
allenai/Dolci-Instruct-SFT | Coding | 278 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "You are tasked with implementing a function to manage the title of an HTML document. Write a function `set_html_title` that takes a single parameter `title`. The function should set the title of the HTML document to the provided string if it is valid. If the title is not a stri... | ## Implementation
The current title is kept in a module-level variable. `set_html_title` validates the input before storing it, and a small getter is included so the stored value can be read back.
```python
# Module-level storage for the current HTML document title
_current_html_title = None
def set_html_title(titl... | end_turn | {
"input_tokens": 203,
"output_tokens": 663
} | null |
allenai/Dolci-Instruct-SFT | Coding | 42 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Write a Python program that reads a single line of text from standard input, and extracts all email addresses from the text using regular expressions. The program should print a list of all matched email addresses (in Python list format).\n\nInput:\nA single line of text that m... | This program reads one line, finds every email address with a regular expression, and prints the matches as a Python list.
```python
import re
import sys
def extract_emails(text):
# Pattern explanation:
# [A-Za-z0-9._%+-]+ -> local part (letters, digits, and . _ % + -)
# @ -> the @... | end_turn | {
"input_tokens": 207,
"output_tokens": 810
} | null |
allenai/Dolci-Instruct-SFT | Coding | 2 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Write a python function to serialize and deserialize a simple data structure using JSON. The data structure is a dictionary that contains only string keys and integer values. Your task is to:\n\n1. Serialize the dictionary into a JSON string.\n2. Deserialize the JSON string bac... | ```python
import json
from typing import Dict, Tuple
def serialize_and_deserialize(data: Dict[str, int]) -> Tuple[str, Dict[str, int]]:
"""
Serialize a dictionary (string keys -> integer values) to a JSON string,
then deserialize that string back into a dictionary.
Args:
data: A dictionary wi... | end_turn | {
"input_tokens": 343,
"output_tokens": 888
} | null |
allenai/Dolci-Instruct-SFT | Coding | 25 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Given an array A of N integers (1 ≤ N ≤ 10^7), output the majority element of the array. An element is called the majority element if it appears strictly more than N/2 times.\n\nStandard Input\nThe first line contains the integer N.\nThe second line contains N space-separated i... | ## Approach
The values are small (0 ≤ A[i] ≤ 10^6), so we can count them directly instead of storing the array.
1. Keep a frequency table of size 10^6 + 1 (about 4 MB of `int`).
2. Read the numbers one at a time and increment their counts.
3. As soon as some value's count goes above N/2, it must be the majority eleme... | end_turn | {
"input_tokens": 211,
"output_tokens": 895
} | null |
allenai/Dolci-Instruct-SFT | Coding | 29 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Given a list of integers and a target number, find and print the two numbers in the list whose sum equals the specified target. Each input will have exactly one solution, and you may not use any element twice. If no such pair exists, print an empty list ([]). The program should... | ## Approach
Use a single pass with a hash set:
- For each number, compute its **complement** (`target - num`).
- If the complement has already been seen, we've found the pair. The complement appeared earlier in the list, so print it first: `[complement, num]`.
- Otherwise, record the current number as seen and contin... | end_turn | {
"input_tokens": 209,
"output_tokens": 831
} | null |
allenai/Dolci-Instruct-SFT | Coding | 168 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Write a Python program that reads a single string from standard input and prints the longest palindromic substring in that string to standard output.\n\nInput:\nA single line containing a string s (1 ≤ |s| ≤ 1000), consisting of lowercase letters only.\n\nOutput:\nOutput a sing... | The program uses the expand-around-center approach. Every palindrome is symmetric around its middle, so we try each possible center and grow outward while the characters on both sides match.
There are two kinds of centers:
- a single character, for odd-length palindromes like `racecar`
- the gap between two neighbouri... | end_turn | {
"input_tokens": 148,
"output_tokens": 746
} | null |
allenai/Dolci-Instruct-SFT | Coding | 53 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Given an HTML document through standard input, write a Python program that extracts all hyperlinks (the href attribute values) from <a> tags. Assume the HTML document is well-formed.\n\nInput:\nA string representing the entire HTML document provided via standard input. The inpu... | This uses Python's built-in `html.parser` module, which handles quoting, attribute order and case for you:
```python
import sys
from html.parser import HTMLParser
class LinkExtractor(HTMLParser):
def __init__(self):
super().__init__(convert_charrefs=True)
self.links = []
def handle_starttag(... | end_turn | {
"input_tokens": 238,
"output_tokens": 701
} | null |
allenai/Dolci-Instruct-SFT | Coding | 270 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "You are tasked with creating a Python function that compares two software version strings following the semantic versioning format. Each version string consists of three non-negative integers separated by periods (e.g., \"1.2.3\"). Your function should determine which version i... | ```python
def compare_versions(version1: str, version2: str) -> int:
"""
Compare two semantic version strings of the form "MAJOR.MINOR.PATCH".
Returns:
1 if version1 > version2
-1 if version1 < version2
0 if version1 == version2
"""
# Convert each component to an integer s... | end_turn | {
"input_tokens": 204,
"output_tokens": 921
} | null |
allenai/Dolci-Instruct-SFT | Coding | 108 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Write a Python program that performs basic arithmetic operations (addition, subtraction, multiplication, division) on two numbers using object-oriented programming principles.\n\nInput:\nThe first line contains two numbers a and b separated by space.\nThe second line contains t... | ```python
import sys
class Calculator:
"""A simple calculator that performs basic arithmetic on two numbers."""
def __init__(self, a, b):
self.a = a
self.b = b
def add(self):
return self.a + self.b
def subtract(self):
return self.a - self.b
def multiply(self):
... | end_turn | {
"input_tokens": 174,
"output_tokens": 1102
} | null |
allenai/Dolci-Instruct-SFT | Coding | 119 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Implement a function `process_user_activity(event: Dict[str, Any]) -> Dict[str, Any]` that takes a dictionary representing user activity from a music streaming application and processes it. The function should transform the input by ensuring that the user ID is in uppercase, an... | ## Implementation
```python
from typing import Any, Dict
def process_user_activity(event: Dict[str, Any]) -> Dict[str, Any]:
"""
Process a user-activity event from a music streaming application.
Transformations:
* 'user_id' is normalized: surrounding whitespace removed and
converted to upp... | end_turn | {
"input_tokens": 183,
"output_tokens": 1257
} | null |
allenai/Dolci-Instruct-SFT | Coding | 230 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "You are given a list of forms and a case. Each form is represented as a dictionary with various attributes, including 'action' and 'type'. Your task is to implement a function that retrieves the first form from the list that meets two criteria: it must pass an action filter and... | # Solution
```python
from typing import Any, Callable, Dict, List, Optional
def get_first_valid_form(
forms: List[Dict[str, Any]],
action_filter: Callable[[str], bool],
type_filter: Callable[[str], bool],
) -> Optional[Dict[str, Any]]:
"""
Return the first form whose 'action' passes `action_filte... | end_turn | {
"input_tokens": 239,
"output_tokens": 945
} | null |
allenai/Dolci-Instruct-SFT | Coding | 67 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Write a python function to help me manage a list of magical creatures for my children's book. I have a list of creatures, each represented by a dictionary with the keys \"name\", \"type\", and \"power_level\". I want a function that takes this list as input and returns a new li... | Here's a clean, efficient solution using Python's built-in `sorted()` with a composite key:
```python
def sort_creatures_by_power(creatures):
"""
Return creature names sorted by power_level (descending),
then by name (ascending) for ties.
Args:
creatures (list[dict]): Each dict has keys "name"... | end_turn | {
"input_tokens": 421,
"output_tokens": 852
} | null |
allenai/Dolci-Instruct-SFT | Coding | 37 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Write a python function to convert a given integer into its binary representation without using the built-in `bin()` function. The function should take an integer as input and return a string that represents the binary equivalent of the number. The binary string should not incl... | ```python
def to_binary(n: int) -> str:
"""
Convert an integer to its binary representation without using bin().
Args:
n: An integer (positive, negative, or zero).
Returns:
A string with the binary form of n, without the '0b' prefix.
Negative numbers are prefixed with '-'.
... | end_turn | {
"input_tokens": 245,
"output_tokens": 1133
} | null |
allenai/Dolci-Instruct-SFT | Coding | 78 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Write a program that reads a single line containing a URL from standard input. The program should output True if the URL is valid and uses an IPv6 address for the domain part, and False otherwise.\n\nInput Format:\nA single line containing a URL string.\n\nOutput Format:\nPrint... | The program checks the URL's structure with a regular expression, then uses Python's `ipaddress` module to confirm that the bracketed host is a real IPv6 address.
```python
import re
import sys
import ipaddress
def is_valid_ipv6_url(url: str) -> bool:
url = url.strip()
if not url or any(c.isspace() for c in ... | end_turn | {
"input_tokens": 163,
"output_tokens": 1304
} | null |
allenai/Dolci-Instruct-SFT | Coding | 361 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Write a Python program that reads a single line containing a JSON string from standard input, parses it into a Python dictionary or list, and prints the resulting Python object. The program must handle nested JSON objects and arrays, converting them into nested Python dictionar... | ```python
import sys
import json
class InvalidJSONError(Exception):
"""Raised when the input string is not valid JSON."""
pass
def parse_json(json_string):
"""
Parse a JSON string into the corresponding Python object.
Nested JSON objects become nested dicts and nested arrays become nested lists.... | end_turn | {
"input_tokens": 202,
"output_tokens": 870
} | null |
allenai/Dolci-Instruct-SFT | Coding | 396 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Write a program that reads a single line string from standard input and outputs a string where all uppercase letters are converted to lowercase, and all lowercase letters are converted to uppercase. All other characters remain unchanged.\n\nInput\nA single line containing the s... | This reads one line and flips the case of each English letter one character at a time. Digits, spaces and punctuation are left as they are.
```python
import sys
def main():
s = sys.stdin.readline()
# Remove only the trailing newline so that leading and trailing spaces are kept
if s.endswith('\n'):
... | end_turn | {
"input_tokens": 160,
"output_tokens": 590
} | null |
allenai/Dolci-Instruct-SFT | Coding | 322 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "You are tasked with implementing a Python function that simulates attribute access on nested dictionaries. The function should take a dictionary and a string representing a chain of keys separated by dots. It should then return the value of the final key in the chain, or None i... | ## Approach
Split the key chain on dots and walk down the dictionary one key at a time. If we hit a missing key, or a value that isn't a dictionary while there are still keys left, return `None`.
## Implementation
```python
def nested_key_access(dict_obj, key_chain):
"""
Simulate attribute-style access on ne... | end_turn | {
"input_tokens": 339,
"output_tokens": 810
} | null |
allenai/Dolci-Instruct-SFT | Coding | 136 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Beroffice text editor flags a word as containing a typo if inside the word there is a block of three or more consecutive consonants that is made up of at least two different letters. (The vowels are exactly the five letters a, e, i, o and u; every other letter is a consonant.)\... | **Approach:** a single greedy left-to-right pass.
1. Walk through the word and keep the length of the current run of consecutive consonants in the current part.
2. A vowel resets the run to 0.
3. Suppose the next letter is a consonant and the run already has at least 2 consonants. Adding it is only safe if it equals t... | end_turn | {
"input_tokens": 348,
"output_tokens": 1026
} | null |
allenai/Dolci-Instruct-SFT | Coding | 94 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "You are given a string `s` consisting of lowercase English letters. Your task is to write a function to determine the frequency of each letter in the string and return the result as a dictionary where the keys are the letters and the values are their respective frequencies. The... | ## Solution
```python
def letter_frequency(s):
"""
Count how often each lowercase English letter (a-z) appears in s.
Any other character (digits, punctuation, whitespace, uppercase letters,
non-ASCII letters, etc.) is ignored.
Args:
s (str): The input string.
Returns:
dict: M... | end_turn | {
"input_tokens": 208,
"output_tokens": 797
} | null |
allenai/Dolci-Instruct-SFT | Coding | 189 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "You are given a list of integers representing the heights of a series of buildings aligned in a row. Your task is to implement a function that calculates the maximum area of a rectangle that can be formed under the histogram defined by the heights of these buildings. The rectan... | ## Approach: Monotonic Stack (O(n))
The largest rectangle must use some bar as its **shortest** bar. For each bar, we want to know how far it can extend left and right before hitting a shorter bar. A stack of indices with increasing heights gives us both boundaries in one pass:
- While the current bar is **shorter** ... | end_turn | {
"input_tokens": 253,
"output_tokens": 1296
} | null |
allenai/Dolci-Instruct-SFT | Coding | 372 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Write a program that reads two non-zero vectors from standard input, each represented as a list of integers separated by spaces, and calculates the cosine similarity between them. The program should output a single floating-point value representing the cosine similarity.\n\nInp... | Cosine similarity is the dot product of the two vectors divided by the product of their lengths (magnitudes):
cos(θ) = (A · B) / (‖A‖ · ‖B‖)
```python
import math
import sys
def main():
lines = sys.stdin.read().strip().splitlines()
a = list(map(int, lines[0].split()))
b = list(map(int, lines[1].split()))... | end_turn | {
"input_tokens": 210,
"output_tokens": 751
} | null |
allenai/Dolci-Instruct-SFT | Coding | 30 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Given a CSV file with a header row, write a Python program that does the following:\n\n- Reads the CSV data from standard input.\n- The first line of standard input will contain five values separated by commas: SUM_COLUMN, FILTER_COLUMN, THRESHOLD, IDENTIFIER_COLUMN, ROW_COUNT.... | The spec doesn't say what happens when a row's identifier first appears in a row that fails the filter. I assumed rows are filtered first and duplicates are checked only among rows that pass. So if a filtered-out row and a later passing row share an ID, the later row still counts.
```python
import sys
import csv
def ... | end_turn | {
"input_tokens": 579,
"output_tokens": 1359
} | null |
allenai/Dolci-Instruct-SFT | Coding | 229 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Given an array of integers and a target integer, write a program that finds the index of the target integer in the array using a recursive approach (without any loops). The function should be tail-recursive for optimization. If the target integer is not in the array, return -1.... | ## Approach
We check one index per call:
- If `index == n`, we have passed the end of the array without finding the target, so we return `-1`.
- If `arr[index] == target`, we return `index`.
- Otherwise we return the result of searching from `index + 1`.
The recursive call is the **last operation** in the function. ... | end_turn | {
"input_tokens": 200,
"output_tokens": 1404
} | null |
allenai/Dolci-Instruct-SFT | Coding | 483 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Given an array of integers, implement a function `calculate_bitwise_or(arr)` that returns the bitwise OR of all the integers in the array. If the array is empty, return None."
}
] | ```python
from functools import reduce
from operator import or_
def calculate_bitwise_or(arr):
"""
Return the bitwise OR of all integers in `arr`.
If `arr` is empty, return None.
Examples:
>>> calculate_bitwise_or([1, 2, 4])
7
>>> calculate_bitwise_or([5, 3])
7
... | end_turn | {
"input_tokens": 65,
"output_tokens": 482
} | null |
allenai/Dolci-Instruct-SFT | Coding | 134 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "You are to write a program which evaluates a single mathematical expression provided as a string. The expression will contain the operators +, -, *, /, and parentheses (). The numbers in the expression are all non-negative integers. Your program should parse the expression from... | This program evaluates the expression with a recursive descent parser. It follows Python's own number rules: integers stay exact integers, and `/` produces a float. A whole-number result is printed without decimals.
```python
import sys
def tokenize(s):
tokens = []
i = 0
n = len(s)
while i < n:
... | end_turn | {
"input_tokens": 265,
"output_tokens": 1711
} | null |
allenai/Dolci-Instruct-SFT | Coding | 407 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "You are given a binary search tree (BST). Your task is to perform a level order (breadth-first) traversal of the BST and print the values of all nodes in this traversal order, separated by spaces, on a single line.\n\nInput:\nFirst, a single integer n, the number of nodes in th... | ## Approach
1. Build the BST by inserting each value in the given order: smaller values go left, larger values go right.
2. Do a breadth-first traversal with a queue, recording values level by level.
Insertion is iterative rather than recursive. If the input is already sorted, the tree becomes a long chain, and recur... | end_turn | {
"input_tokens": 233,
"output_tokens": 865
} | null |
allenai/Dolci-Instruct-SFT | Coding | 490 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Write a program that reads a non-negative integer n from standard input, and prints the Fibonacci sequence from index 0 up to n (inclusive) as a list (Python list format) on a single line.\n\nThe Fibonacci numbers are defined as follows:\n- Fibonacci(0) = 0\n- Fibonacci(1) = 1\... | This solution uses a recursive function with a dictionary as a memo, so each Fibonacci number is computed only once.
```python
import sys
def main():
data = sys.stdin.read().split()
if not data:
return
n = int(data[0])
memo = {0: 0, 1: 1}
def fib(i):
if i in memo:
ret... | end_turn | {
"input_tokens": 294,
"output_tokens": 446
} | null |
allenai/Dolci-Instruct-SFT | Coding | 127 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Implement a function `find_ip_addresses(string: str) -> List[str]` that takes a string as input and returns a list of valid IP addresses found within the string. An IP address is considered valid if it consists of four decimal numbers separated by periods, where each number is ... | ## Approach
1. **Find candidates with a regex.** A candidate is four groups of 1–3 digits joined by periods.
2. **Anchor the match with lookarounds.** This keeps the regex from matching *part* of a longer number. Without them, `256.100.50.25` would yield the false match `56.100.50.25`, and `1.2.3.4.5` would yield `1.2... | end_turn | {
"input_tokens": 167,
"output_tokens": 1676
} | null |
allenai/Dolci-Instruct-SFT | Coding | 246 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "You are tasked with extracting the SHA1 checksum value from a given string. The checksum is expected to be in the format 'SHA1:<length>:<value>', where <length> is the length of the checksum value and <value> is the actual checksum value consisting of 40 hexadecimal characters.... | ## Approach
A valid input must meet all of these conditions:
1. It has exactly three parts separated by `:`.
2. The first part is the literal tag `SHA1`.
3. The second part is a decimal integer equal to the length of the value. Since a SHA1 value is always 40 characters, this must be `40`.
4. The third part is exactl... | end_turn | {
"input_tokens": 252,
"output_tokens": 2017
} | null |
allenai/Dolci-Instruct-SFT | Coding | 363 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Generate a function to reorganize a list of strings so that all strings that begin with a lower-case letter appear before those that begin with an upper-case letter.\nsample_list = [\"This\", \"is\", \"a\", \"Test\", \"list\"]"
}
] | ## Python Solution
```python
def reorganize_strings(strings):
"""
Reorganize a list of strings so that strings beginning with a lowercase
letter come before those beginning with an uppercase letter.
The original relative order within each group is preserved (stable).
Strings that are empty or star... | end_turn | {
"input_tokens": 79,
"output_tokens": 937
} | null |
allenai/Dolci-Instruct-SFT | Coding | 504 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Write a python function to identify and count bird species from a list of bird sightings. Each sighting is represented as a string containing the bird's name and the sighting location, separated by a comma. Your function should return a dictionary where the keys are bird specie... | Here's a function that counts sightings for each bird species:
```python
def count_bird_sightings(sightings):
"""
Count how many times each bird species was sighted.
Args:
sightings (list[str]): Strings formatted as "bird_name,location".
Returns:
dict: Bird species as keys, number of ... | end_turn | {
"input_tokens": 316,
"output_tokens": 759
} | null |
allenai/Dolci-Instruct-SFT | Coding | 421 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Design a program that simulates a simple bank account using standard input and output.\n\nThe program should support the following commands, each entered on a separate line:\n- DEPOSIT X: Deposit integer amount X (>0) to the account. Print: 'Deposited $X. New balance is $Y.' (w... | # Simple Bank Account Simulator
The program keeps the account logic in a `BankAccount` class and handles input parsing in a separate command loop. This makes the account easy to test or reuse.
```python
import sys
class BankAccount:
"""A simple bank account holding an integer balance."""
def __init__(self)... | end_turn | {
"input_tokens": 382,
"output_tokens": 1281
} | null |
allenai/Dolci-Instruct-SFT | Coding | 541 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Write a program that reads a list of integers from standard input (all on a single line, separated by spaces). The program should find and output the most frequent element(s) in the list. If there are ties, output all the most frequent elements in increasing order, separated by... | ```python
import sys
from collections import Counter
def main():
data = sys.stdin.read().split()
nums = [int(x) for x in data]
if not nums:
print()
return
counts = Counter(nums)
max_freq = max(counts.values())
most_frequent = sorted(num for num, freq in counts.items() if freq ... | end_turn | {
"input_tokens": 194,
"output_tokens": 634
} | null |
allenai/Dolci-Instruct-SFT | Coding | 487 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Write a python function to calculate the average defect rate for a series of products based on their monthly defect counts and production volumes. The function should take two lists as input: one list with the number of defects recorded each month and another list with the corr... | ## Approach
The defect rate is computed as **total defects ÷ total production × 100**. This weights each month by its production volume, so a month that produced 10 units doesn't count as much as a month that produced 10,000. In the example, both this method and a simple average of the monthly rates give 0.50, but the... | end_turn | {
"input_tokens": 260,
"output_tokens": 983
} | null |
allenai/Dolci-Instruct-SFT | Coding | 369 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Write a python function to help me categorize costumes based on their thematic elements. I have a list of costume names, each associated with a specific theme or mythology. For instance, \"Athena's Armor\" belongs to \"Greek Mythology\", and \"Dragon's Scales\" belongs to \"Fan... | Here's a function that does this categorization. It uses case-insensitive matching, lets a costume belong to more than one theme, and always includes every theme in the result, even ones with no matches.
```python
def categorize_costumes(costumes, themes):
"""
Categorize costumes by theme based on keywords fou... | end_turn | {
"input_tokens": 532,
"output_tokens": 1119
} | null |
allenai/Dolci-Instruct-SFT | Coding | 571 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Write a program that reads a single line of text from standard input, and prints a dictionary containing the frequency of each character in the string, excluding spaces. The dictionary should be sorted first by the frequency in descending order, and then by character in ascendi... | Here's a Python program that counts the characters (ignoring spaces) and orders them by frequency, then alphabetically:
```python
import sys
from collections import Counter
def main():
line = sys.stdin.readline()
# Remove the trailing newline (and carriage return, if present)
line = line.rstrip('\n').rstr... | end_turn | {
"input_tokens": 240,
"output_tokens": 511
} | null |
allenai/Dolci-Instruct-SFT | Coding | 501 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Given a tree where each node can have any number of children (including zero), compute the maximum depth of the tree. The tree is represented by a series of lines according to the following input format:\n\nInput:\n- The first line contains an integer n (1 ≤ n ≤ 1000), the numb... | ## Approach
The tree is given as a parent array, so a node's depth is one more than its parent's depth. The root has depth 1. In the example, the root (node 0) is at depth 1, nodes 1 and 2 are at depth 2, and nodes 3 and 4 are at depth 3. So the answer is 3.
The input does not guarantee that a parent appears before i... | end_turn | {
"input_tokens": 280,
"output_tokens": 783
} | null |
allenai/Dolci-Instruct-SFT | Coding | 353 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Write a python function to parse a string containing weather data for a flight and extract important information such as temperature, wind speed, and visibility. The input will be a string formatted as follows: \"Temp: XX°C, Wind: YY km/h, Visibility: ZZ km\". The function shou... | # Parsing Flight Weather Data
Here's a solution that uses regular expressions. It tolerates extra whitespace and negative temperatures, and it raises a clear error when the input doesn't match the expected format.
```python
import re
def parse_weather_data(weather_string):
"""
Parse a weather data string and... | end_turn | {
"input_tokens": 289,
"output_tokens": 1300
} | null |
allenai/Dolci-Instruct-SFT | Coding | 357 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Write a program that defines a function to add two values according to these rules:\n\n- If both inputs are numbers (integers or floats), return their sum.\n- If both are lists or tuples, return a new list containing their element-wise sums. If the lists or tuples are of unequa... | This program reads two Python literals, adds them using the rules below, and prints the result or the error message.
```python
import sys
import ast
def is_number(v):
"""Return True for ints and floats (bools are excluded)."""
return isinstance(v, (int, float)) and not isinstance(v, bool)
def is_sequence(v... | end_turn | {
"input_tokens": 439,
"output_tokens": 1552
} | null |
allenai/Dolci-Instruct-SFT | Coding | 417 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Write a python function to calculate the average weight of newborns from a list of birth weights in grams. Each entry in the list represents the weight of a newborn. The function should return the average weight rounded to two decimal places.\n\nInput:\n- A list of integers, `b... | ```python
def calculate_average_weight(birth_weights):
"""
Calculate the average weight of newborns.
Args:
birth_weights (list of int): Birth weights in grams.
Returns:
float: The average weight, rounded to two decimal places.
Raises:
TypeError: If birth_weights is not a l... | end_turn | {
"input_tokens": 238,
"output_tokens": 929
} | null |
allenai/Dolci-Instruct-SFT | Coding | 594 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Write a Python program that reads two matrices of the same size from standard input, adds them, and prints the resulting matrix.\n\nInput:\n- The first line contains two integers n and m, separated by a space, representing the number of rows and columns in the matrices.\n- The ... | ```python
import sys
def main():
data = sys.stdin.read().split()
if not data:
return
n, m = int(data[0]), int(data[1])
values = list(map(int, data[2:2 + 2 * n * m]))
# Split the flat list of values into the two matrices
a = values[:n * m]
b = values[n * m:2 * n * m]
out_lines... | end_turn | {
"input_tokens": 214,
"output_tokens": 463
} | null |
allenai/Dolci-Instruct-SFT | Coding | 585 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "You are given a list of residues and a corresponding list of numbers. Your task is to implement a function that takes an integer n and returns the corresponding number from the list if n exists in the residues list. If n does not exist in the residues list, your function should... | ```python
from typing import List
def get_number(n: int, residues: List[int], numbers: List[int]) -> int:
"""
Return the number that corresponds to `n` in the `residues` list.
Parameters
----------
n : int
The residue to look up.
residues : List[int]
List of residues.
numb... | end_turn | {
"input_tokens": 214,
"output_tokens": 493
} | null |
allenai/Dolci-Instruct-SFT | Coding | 293 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Design a regular expression pattern with precision that will distinctly identify the accurate string \"hello people\". The pattern should not identify any adjacent, leading or trailing characters apart from this exact string."
}
] | # Regex for Exactly "hello people"
## The Pattern
```regex
^hello people$
```
| Component | Meaning |
|-----------|---------|
| `^` | Anchors the match to the **start** of the string, so nothing can come before it |
| `hello people` | Matches these literal characters, including the single space |
| `$` | Anchors the... | end_turn | {
"input_tokens": 69,
"output_tokens": 1206
} | null |
allenai/Dolci-Instruct-SFT | Coding | 311 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Write a python function to calculate the total weekly earnings of a working student who has a part-time job with varying daily hours. The function should take two inputs:\n\n1. A list of integers representing the number of hours worked each day from Monday to Sunday.\n2. An int... | # Weekly Earnings Calculator
```python
def calculate_weekly_earnings(hours_per_day, hourly_wage):
"""
Calculate the total weekly earnings of a part-time working student.
Args:
hours_per_day (list[int]): Hours worked each day, Monday to Sunday.
May contain up to 7... | end_turn | {
"input_tokens": 224,
"output_tokens": 1548
} | null |
allenai/Dolci-Instruct-SFT | Coding | 607 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Write a python function to evaluate the safety risks associated with a list of extracurricular activities for children. The function should take a list of activities as input, where each activity is represented as a string. It should return a dictionary where the keys are the a... | ```python
def evaluate_activity_risks(activities):
"""
Evaluate the safety risk level of a list of extracurricular activities.
Parameters:
activities (list of str): Activity names, e.g. ["Soccer", "Chess", "Dance"]
Returns:
dict: Maps each activity to its risk level ("Low", "Medium", "... | end_turn | {
"input_tokens": 311,
"output_tokens": 629
} | null |
allenai/Dolci-Instruct-SFT | Coding | 475 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "You are given a binary search tree (BST), represented by its node values and structure, and a list of queries. For each query, determine if the specified value exists in the tree using a preorder traversal approach. You must implement this without using recursion or built-in st... | ## Approach
The program reads the tree, then answers each query with an iterative preorder traversal.
**Stack without built-in stack operations.** The stack is a list allocated once with size `N`. A manual `top` index tracks its size. `append` and `pop` are never called. Pushing writes to `stack[top]` and increments ... | end_turn | {
"input_tokens": 348,
"output_tokens": 1031
} | null |
allenai/Dolci-Instruct-SFT | Coding | 383 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Write a python function to calculate the total carbon footprint of various types of seafood sold in a sustainable seafood market. The function should take a list of dictionaries as input, where each dictionary represents a seafood item with the following keys:\n\n- 'name': a st... | # Seafood Carbon Footprint Calculator
```python
def calculate_carbon_footprint(seafood_items):
"""
Calculate the total carbon footprint for each seafood item.
Args:
seafood_items (list[dict]): Each dict must contain:
- 'name' (str): name of the seafood item
- 'quantity' (in... | end_turn | {
"input_tokens": 476,
"output_tokens": 1771
} | null |
allenai/Dolci-Instruct-SFT | Coding | 197 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Develop a brief Python code that emits a Morse code sound pattern corresponding to the phrase \"Love to Program!\""
}
] | # Morse Code Sound Player: "Love to Program!"
This script uses only Python's standard library, so there is nothing to install. It converts the phrase to Morse code and synthesizes the beeps into a WAV file. It then plays the file on Windows, macOS, or Linux.
```python
import math, struct, wave, sys, subprocess, tempf... | end_turn | {
"input_tokens": 47,
"output_tokens": 2036
} | null |
allenai/Dolci-Instruct-SFT | Coding | 598 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "Incorporate the numpy, pandas, and matplotlib.pyplot libraries into your Python environment. Generate an array 'y' of 10 random numbers, each multiplied by 2, and an array 'x' of integers from 0 to 9. Now, your task is to ensure that all the ticks on the axes of the plot are in... | ## Solution
```python
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.ticker import MaxNLocator
# Generate the data
y = np.random.rand(10) * 2 # 10 random numbers in [0, 2)
x = np.arange(10) # integers 0 through 9
# Create the plot
fig, ax = plt.subplots()
ax.plot(... | end_turn | {
"input_tokens": 125,
"output_tokens": 774
} | null |
allenai/Dolci-Instruct-SFT | Coding | 575 | 0 | anthropic | claude-opus-5-5 | train | [
{
"role": "user",
"content": "You are given a list of integers, which can include both positive and negative numbers, and a single integer scalar value. Your task is to create a program that reads the list of integers and the scalar value from standard input, then outputs a new list where each number in the... | ## Approach
Multiplying every element by a scalar `k` multiplies the sum by `k` as well:
```
sum(result) = k * sum(original)
```
So the condition `sum(result) == sum(original)` becomes:
```
k * S = S ⟺ S * (k - 1) = 0
```
This holds in exactly two cases:
1. **`k == 1`**: the list is unchanged, so the sums mat... | end_turn | {
"input_tokens": 224,
"output_tokens": 936
} | null |
Teacher completions for distilling claude-opus-5-5 into Qwen/Qwen3.8-27B.
claude-opus-5-5 was sampled on the exact same 10,000 instruction prompts used for the
earlier Opus 4.7 run (asparius/dolci-instruct-sft-opus4.7),
so the teacher swap is controlled: identical prompts, only the teacher model changes.
One JSON object per line:
| field | meaning |
|---|---|
dataset, domain, prompt_index, sample_index, split |
prompt provenance (match the Opus 4.7 set) |
provider, model |
anthropic, claude-opus-5-5 |
prompt |
the chat messages list given to the teacher |
text |
the teacher's answer (what the student is trained on) |
reasoning |
discarded under the answer-only recipe (empty) |
finish_reason, usage |
generation metadata |
SFT distillation study of whether reward-hacking propensity transfers from a frontier teacher to a smaller student. Not a general-purpose instruction dataset.