Dataset Viewer
Auto-converted to Parquet Duplicate
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
0
47.3k
finish_reason
stringclasses
3 values
usage
dict
error
null
allenai/Dolci-Instruct-SFT
Coding
140
0
anthropic
claude-opus-4-7
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()) print(n % 2 == 0) ```
end_turn
{ "input_tokens": 82, "output_tokens": 28 }
null
allenai/Dolci-Instruct-SFT
Coding
10
0
anthropic
claude-opus-4-7
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...
```python from typing import List, Tuple def extract_source_files(config: dict) -> List[Tuple[str, str]]: language = config['language'] return [(source, language) for source in config['sources']] ```
end_turn
{ "input_tokens": 208, "output_tokens": 75 }
null
allenai/Dolci-Instruct-SFT
Coding
40
0
anthropic
claude-opus-4-7
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(documentaries, min_duration): return [doc["title"] for doc in documentaries if doc["duration"] >= min_duration] ```
end_turn
{ "input_tokens": 315, "output_tokens": 62 }
null
allenai/Dolci-Instruct-SFT
Coding
42
0
anthropic
claude-opus-4-7
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...
import re text = input() emails = re.findall(r'[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}', text) print(emails)
end_turn
{ "input_tokens": 210, "output_tokens": 79 }
null
allenai/Dolci-Instruct-SFT
Coding
29
0
anthropic
claude-opus-4-7
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...
```python def main(): nums = list(map(int, input().split())) target = int(input()) seen = {} for n in nums: c = target - n if c in seen: print([c, n]) return seen[n] = True print([]) main() ```
end_turn
{ "input_tokens": 212, "output_tokens": 95 }
null
allenai/Dolci-Instruct-SFT
Coding
53
0
anthropic
claude-opus-4-7
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...
```python import sys from html.parser import HTMLParser class LinkParser(HTMLParser): def handle_starttag(self, tag, attrs): if tag == 'a': for name, value in attrs: if name == 'href' and value is not None: print(value) parser = LinkParser() parser.feed(sys....
end_turn
{ "input_tokens": 241, "output_tokens": 129 }
null
allenai/Dolci-Instruct-SFT
Coding
119
0
anthropic
claude-opus-4-7
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...
```python from typing import Any, Dict def process_user_activity(event: Dict[str, Any]) -> Dict[str, Any]: user_id = event.get('user_id') if not user_id or not isinstance(user_id, str): return {} processed = dict(event) processed['user_id'] = user_id.upper() processed['activity_status...
end_turn
{ "input_tokens": 186, "output_tokens": 144 }
null
allenai/Dolci-Instruct-SFT
Coding
120
0
anthropic
claude-opus-4-7
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 ...
```python s = input() cleaned = [] for ch in s: if ('a' <= ch <= 'z') or ('A' <= ch <= 'Z') or ('0' <= ch <= '9'): if 'A' <= ch <= 'Z': ch = chr(ord(ch) + 32) cleaned.append(ch) n = len(cleaned) is_pal = True for i in range(n // 2): if cleaned[i] != cleaned[n - 1 - i]: is_pa...
end_turn
{ "input_tokens": 183, "output_tokens": 196 }
null
allenai/Dolci-Instruct-SFT
Coding
193
0
anthropic
claude-opus-4-7
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 ...
```python from collections import Counter def first_non_repeating_char(s: str) -> str: counts = Counter(s) for ch in s: if counts[ch] == 1: return ch return "" ```
end_turn
{ "input_tokens": 170, "output_tokens": 79 }
null
allenai/Dolci-Instruct-SFT
Coding
25
0
anthropic
claude-opus-4-7
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...
```python import sys def main(): data = sys.stdin.buffer.read().split() if not data: return n = int(data[0]) a = data[1:1+n] # Boyer-Moore candidate = None count = 0 for x in a: if count == 0: candidate = x count = 1 elif x == candida...
end_turn
{ "input_tokens": 214, "output_tokens": 300 }
null
allenai/Dolci-Instruct-SFT
Coding
78
0
anthropic
claude-opus-4-7
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...
```python import sys from urllib.parse import urlparse import ipaddress def main(): url = sys.stdin.readline().strip() try: parsed = urlparse(url) if not parsed.scheme or not parsed.netloc: print(False) return host = parsed.hostname if host is None: ...
end_turn
{ "input_tokens": 166, "output_tokens": 296 }
null
allenai/Dolci-Instruct-SFT
Coding
0
0
anthropic
claude-opus-4-7
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...
```python def main(): n = int(input()) a = list(map(int, input().split())) best = cur = a[0] for x in a[1:]: cur = max(x, cur + x) best = max(best, cur) print(best) main() ```
end_turn
{ "input_tokens": 206, "output_tokens": 92 }
null
allenai/Dolci-Instruct-SFT
Coding
37
0
anthropic
claude-opus-4-7
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 int_to_binary(n): if n == 0: return '0' negative = n < 0 n = abs(n) binary = '' while n > 0: binary = str(n % 2) + binary n //= 2 return '-' + binary if negative else binary ```
end_turn
{ "input_tokens": 248, "output_tokens": 110 }
null
allenai/Dolci-Instruct-SFT
Coding
189
0
anthropic
claude-opus-4-7
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...
```python from typing import List def max_histogram_area(heights: List[int]) -> int: stack = [] max_area = 0 for i, h in enumerate(heights): start = i while stack and stack[-1][1] > h: idx, height = stack.pop() max_area = max(max_area, height * (i - idx)) ...
end_turn
{ "input_tokens": 256, "output_tokens": 184 }
null
allenai/Dolci-Instruct-SFT
Coding
168
0
anthropic
claude-opus-4-7
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...
def longest_palindrome(s): if not s: return "" start, end = 0, 0 for i in range(len(s)): for a, b in ((i, i), (i, i+1)): while a >= 0 and b < len(s) and s[a] == s[b]: a -= 1 b += 1 if b - a - 1 > end - start: start, end ...
end_turn
{ "input_tokens": 151, "output_tokens": 168 }
null
allenai/Dolci-Instruct-SFT
Coding
30
0
anthropic
claude-opus-4-7
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....
```python import sys import csv def main(): lines = sys.stdin.read().splitlines() params = lines[0].split(',') sum_col = params[0] filter_col = params[1] threshold = float(params[2]) id_col = params[3] row_count = int(params[4]) reader = csv.DictReader(lines[1:1+1+row_count]) s...
end_turn
{ "input_tokens": 582, "output_tokens": 298 }
null
allenai/Dolci-Instruct-SFT
Coding
231
0
anthropic
claude-opus-4-7
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...
import re s = input() words = re.findall(r"[a-zA-Z]+", s) unique = sorted(set(w.lower() for w in words)) print(unique)
end_turn
{ "input_tokens": 258, "output_tokens": 60 }
null
allenai/Dolci-Instruct-SFT
Coding
230
0
anthropic
claude-opus-4-7
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...
```python from typing import List, Dict, Any, Callable, 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]]: for form in forms: if action_filter(form.get('action')) and type_filter(form.get('typ...
end_turn
{ "input_tokens": 242, "output_tokens": 148 }
null
allenai/Dolci-Instruct-SFT
Coding
270
0
anthropic
claude-opus-4-7
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: v1 = [int(x) for x in version1.split('.')] v2 = [int(x) for x in version2.split('.')] if v1 > v2: return 1 elif v1 < v2: return -1 return 0 ```
end_turn
{ "input_tokens": 207, "output_tokens": 111 }
null
allenai/Dolci-Instruct-SFT
Coding
54
0
anthropic
claude-opus-4-7
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 Java code with the missing semicolon added: ```java public static void main(String[] args) { System.out.println("Hello World"); } ``` ### What was fixed: The original code was missing a **semicolon (`;`)** at the end of the `System.out.println("Hello World")` statement. I also added the clos...
end_turn
{ "input_tokens": 70, "output_tokens": 294 }
null
allenai/Dolci-Instruct-SFT
Coding
233
0
anthropic
claude-opus-4-7
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...
```python a = input().strip() b = input().strip() beats = {'R': 'S', 'P': 'R', 'S': 'P'} print(a if beats[a] == b else b) ```
end_turn
{ "input_tokens": 222, "output_tokens": 69 }
null
allenai/Dolci-Instruct-SFT
Coding
283
0
anthropic
claude-opus-4-7
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 ...
```python from itertools import permutations s = input().strip() for p in sorted(set(permutations(s))): print(''.join(p)) ``` **Explanation:** - `permutations(s)` generates all possible orderings of the characters (including duplicates when characters repeat). - Wrapping it in `set(...)` removes duplicate permuta...
end_turn
{ "input_tokens": 104, "output_tokens": 240 }
null
allenai/Dolci-Instruct-SFT
Coding
180
0
anthropic
claude-opus-4-7
train
[ { "role": "user", "content": "Write a Python program that reads a single line from standard input, which is intended to be a binary number (a string of up to 1,000,000 digits). Your program should convert this binary number to its decimal equivalent and print the result. If the input contains any characters...
```python def main(): try: s = input() except EOFError: s = "" error_msg = "Error: Input string must only contain '0' and '1'.'" if not s or any(c not in '01' for c in s): print(error_msg) return print(int(s, 2)) main() ```
end_turn
{ "input_tokens": 313, "output_tokens": 179 }
null
allenai/Dolci-Instruct-SFT
Coding
278
0
anthropic
claude-opus-4-7
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...
```python _current_title = None def set_html_title(title): global _current_title if not isinstance(title, str): raise ValueError("A title has to be a string.") _current_title = title ```
end_turn
{ "input_tokens": 206, "output_tokens": 72 }
null
allenai/Dolci-Instruct-SFT
Coding
108
0
anthropic
claude-opus-4-7
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 class Calculator: 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): return self.a * self.b def divide(self): if self.b == 0...
end_turn
{ "input_tokens": 177, "output_tokens": 655 }
null
allenai/Dolci-Instruct-SFT
Coding
322
0
anthropic
claude-opus-4-7
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...
```python def nested_key_access(dict_obj, key_chain): keys = key_chain.split('.') current = dict_obj for key in keys: if isinstance(current, dict) and key in current: current = current[key] else: return None return current ```
end_turn
{ "input_tokens": 342, "output_tokens": 98 }
null
allenai/Dolci-Instruct-SFT
Coding
361
0
anthropic
claude-opus-4-7
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 json import sys def main(): line = sys.stdin.readline() try: obj = json.loads(line) print(obj) except (json.JSONDecodeError, ValueError): print('Invalid JSON string') if __name__ == '__main__': main() ```
end_turn
{ "input_tokens": 205, "output_tokens": 159 }
null
allenai/Dolci-Instruct-SFT
Coding
372
0
anthropic
claude-opus-4-7
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...
import math v1 = list(map(int, input().split())) v2 = list(map(int, input().split())) dot = sum(a*b for a, b in zip(v1, v2)) n1 = math.sqrt(sum(a*a for a in v1)) n2 = math.sqrt(sum(b*b for b in v2)) print(dot / (n1 * n2))
end_turn
{ "input_tokens": 213, "output_tokens": 124 }
null
allenai/Dolci-Instruct-SFT
Coding
229
0
anthropic
claude-opus-4-7
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....
```python import sys sys.setrecursionlimit(10**7) def find_index(arr, target, i=0): if i >= len(arr): return -1 if arr[i] == target: return i return find_index(arr, target, i + 1) def main(): data = sys.stdin.read().split() n, x = int(data[0]), int(data[1]) arr = list(map(int, ...
end_turn
{ "input_tokens": 203, "output_tokens": 552 }
null
allenai/Dolci-Instruct-SFT
Coding
396
0
anthropic
claude-opus-4-7
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...
```python print(input().swapcase()) ```
end_turn
{ "input_tokens": 163, "output_tokens": 19 }
null
allenai/Dolci-Instruct-SFT
Coding
2
0
anthropic
claude-opus-4-7
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 def serialize_and_deserialize(input_dict): """ Serialize a dictionary with string keys and integer values into a JSON string, then deserialize it back into a dictionary. Args: input_dict (dict): A dictionary with string keys and integer values. Returns: ...
end_turn
{ "input_tokens": 346, "output_tokens": 405 }
null
allenai/Dolci-Instruct-SFT
Coding
101
0
anthropic
claude-opus-4-7
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; ``` ### Explanation | Clause | Purpose | |--------|---------| | `SELECT *` | Returns **all columns** for each matching record. | | `FROM customers` | Specifies the source ta...
end_turn
{ "input_tokens": 83, "output_tokens": 460 }
null
allenai/Dolci-Instruct-SFT
Coding
246
0
anthropic
claude-opus-4-7
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....
```python import re def extract_sha1_checksum(input_string): """ Extract the SHA1 checksum value from a string in the format 'SHA1:<length>:<value>'. Args: input_string (str): The string to parse. Returns: str or None: The 40-character hexadecimal SHA1 checksum value if ...
end_turn
{ "input_tokens": 255, "output_tokens": 786 }
null
allenai/Dolci-Instruct-SFT
Coding
67
0
anthropic
claude-opus-4-7
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...
```python def sort_creatures(creatures): sorted_creatures = sorted(creatures, key=lambda c: (-c["power_level"], c["name"])) return [c["name"] for c in sorted_creatures] ``` This function works by: 1. **Sorting with a composite key**: Using `sorted()` with a lambda that returns a tuple `(-power_level, name)`. ...
end_turn
{ "input_tokens": 424, "output_tokens": 525 }
null
allenai/Dolci-Instruct-SFT
Coding
134
0
anthropic
claude-opus-4-7
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...
```python def evaluate(s): s = s.replace(' ', '') pos = [0] def parse_expr(): val = parse_term() while pos[0] < len(s) and s[pos[0]] in '+-': op = s[pos[0]] pos[0] += 1 r = parse_term() val = val + r if op == '+' else val - r return va...
end_turn
{ "input_tokens": 268, "output_tokens": 1012 }
null
allenai/Dolci-Instruct-SFT
Coding
94
0
anthropic
claude-opus-4-7
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...
```python def letter_frequency(s): """ Determine the frequency of each lowercase English letter in the string. Non-lowercase alphabetic characters are ignored. Args: s (str): The input string. Returns: dict: A dictionary mapping each lowercase letter to its frequency. ...
end_turn
{ "input_tokens": 211, "output_tokens": 573 }
null
allenai/Dolci-Instruct-SFT
Coding
421
0
anthropic
claude-opus-4-7
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...
```python def main(): balance = 0 while True: try: line = input() except EOFError: break line = line.strip() if not line: continue parts = line.split() cmd = parts[0] if cmd == "END": break elif cmd =...
end_turn
{ "input_tokens": 385, "output_tokens": 295 }
null
allenai/Dolci-Instruct-SFT
Coding
407
0
anthropic
claude-opus-4-7
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...
```python import sys from collections import deque def main(): data = sys.stdin.read().split() if not data: print() return n = int(data[0]) values = list(map(int, data[1:1+n])) if n == 0: print() return # Build BST class Node: __slots__ = ('...
end_turn
{ "input_tokens": 236, "output_tokens": 433 }
null
allenai/Dolci-Instruct-SFT
Coding
357
0
anthropic
claude-opus-4-7
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...
```python import ast def add(x, y): num_types = (int, float) seq_types = (list, tuple) if isinstance(x, bool) or isinstance(y, bool): raise TypeError("Unsupported types for addition.") if isinstance(x, num_types) and isinstance(y, num_types): return x + y if isinstance(x, seq_types)...
end_turn
{ "input_tokens": 442, "output_tokens": 544 }
null
allenai/Dolci-Instruct-SFT
Coding
483
0
anthropic
claude-opus-4-7
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 def calculate_bitwise_or(arr): if not arr: return None result = 0 for num in arr: result |= num return result ```
end_turn
{ "input_tokens": 68, "output_tokens": 60 }
null
allenai/Dolci-Instruct-SFT
Coding
311
0
anthropic
claude-opus-4-7
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...
```python def calculate_weekly_earnings(hours_per_day, hourly_wage): """ Calculate total weekly earnings for a working student. Parameters: - hours_per_day: list of integers representing hours worked each day (Mon-Sun) - hourly_wage: integer representing the hourly wage Returns: - ...
end_turn
{ "input_tokens": 227, "output_tokens": 472 }
null
allenai/Dolci-Instruct-SFT
Coding
136
0
anthropic
claude-opus-4-7
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.)\...
Looking at this problem, I'll use a greedy approach: scan through the word maintaining the current run of consonants. If adding the next consonant would create a run of 3+ with at least 2 different letters, insert a space before it and start a new run. ```python word = input().strip() vowels = set('aeiou') result = []...
end_turn
{ "input_tokens": 351, "output_tokens": 1201 }
null
allenai/Dolci-Instruct-SFT
Coding
479
0
anthropic
claude-opus-4-7
train
[ { "role": "user", "content": "Write a python function to analyze a list of film reviews and determine which words are most frequently used. The function should take a list of strings as input, where each string represents a review. The output should be a dictionary where the keys are words and the values ar...
```python import string from collections import Counter def analyze_reviews(reviews): counter = Counter() translator = str.maketrans('', '', string.punctuation) for review in reviews: cleaned = review.lower().translate(translator) counter.update(cleaned.split()) return dict(counter) ```
end_turn
{ "input_tokens": 337, "output_tokens": 115 }
null
allenai/Dolci-Instruct-SFT
Coding
127
0
anthropic
claude-opus-4-7
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 ...
```python import re from typing import List def find_ip_addresses(string: str) -> List[str]: """ Find all valid IPv4 addresses in the given string. A valid IP address consists of four decimal numbers (0-255) separated by periods. """ # Match sequences of digits-dot-digits-dot-digits-dot-digit...
end_turn
{ "input_tokens": 170, "output_tokens": 955 }
null
allenai/Dolci-Instruct-SFT
Coding
490
0
anthropic
claude-opus-4-7
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\...
```python import sys sys.setrecursionlimit(10000) memo = {0: 0, 1: 1} def fib(i): if i not in memo: memo[i] = fib(i-1) + fib(i-2) return memo[i] n = int(input()) print([fib(i) for i in range(n+1)]) ```
end_turn
{ "input_tokens": 297, "output_tokens": 117 }
null
allenai/Dolci-Instruct-SFT
Coding
487
0
anthropic
claude-opus-4-7
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...
```python def average_defect_rate(defects, production): """ Calculate the average defect rate as a percentage. Parameters: - defects (list of int): Number of defects recorded each month. - production (list of int): Number of products produced each month. Returns: - float: Average defect ra...
end_turn
{ "input_tokens": 263, "output_tokens": 417 }
null
allenai/Dolci-Instruct-SFT
Coding
197
0
anthropic
claude-opus-4-7
train
[ { "role": "user", "content": "Develop a brief Python code that emits a Morse code sound pattern corresponding to the phrase \"Love to Program!\"" } ]
```python import numpy as np import sounddevice as sd # Morse code dictionary MORSE = { 'A':'.-','B':'-...','C':'-.-.','D':'-..','E':'.','F':'..-.', 'G':'--.','H':'....','I':'..','J':'.---','K':'-.-','L':'.-..', 'M':'--','N':'-.','O':'---','P':'.--.','Q':'--.-','R':'.-.', 'S':'...','T':'-','U':'..-','V...
end_turn
{ "input_tokens": 50, "output_tokens": 880 }
null
allenai/Dolci-Instruct-SFT
Coding
504
0
anthropic
claude-opus-4-7
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...
```python def count_bird_species(sightings): counts = {} for sighting in sightings: bird = sighting.split(",")[0].strip() counts[bird] = counts.get(bird, 0) + 1 return counts ```
end_turn
{ "input_tokens": 319, "output_tokens": 87 }
null
allenai/Dolci-Instruct-SFT
Coding
369
0
anthropic
claude-opus-4-7
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...
```python def categorize_costumes(costumes, themes): result = {theme: [] for theme in themes} for costume in costumes: for theme, keywords in themes.items(): if any(keyword.lower() in costume.lower() for keyword in keywords): result[theme].append(costume) return result ``...
end_turn
{ "input_tokens": 535, "output_tokens": 688 }
null
allenai/Dolci-Instruct-SFT
Coding
353
0
anthropic
claude-opus-4-7
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...
```python import re def parse_weather_data(weather_string): """ Parse a weather data string and extract temperature, wind speed, and visibility. Args: weather_string (str): A string formatted as "Temp: XX°C, Wind: YY km/h, Visibility: ZZ km" Returns: ...
end_turn
{ "input_tokens": 292, "output_tokens": 806 }
null
allenai/Dolci-Instruct-SFT
Coding
293
0
anthropic
claude-opus-4-7
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." } ]
# Regular Expression for Exact String Match: "hello people" ## The Pattern ```regex ^hello people$ ``` ## Breakdown of the Pattern | Component | Meaning | |-----------|---------| | `^` | **Start anchor** — asserts position at the beginning of the string | | `hello people` | The **literal text** to match (including ...
end_turn
{ "input_tokens": 72, "output_tokens": 824 }
null
allenai/Dolci-Instruct-SFT
Coding
571
0
anthropic
claude-opus-4-7
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...
```python from collections import Counter s = input().replace(" ", "") c = Counter(s) result = dict(sorted(c.items(), key=lambda x: (-x[1], x[0]))) print(result) ```
end_turn
{ "input_tokens": 243, "output_tokens": 99 }
null
allenai/Dolci-Instruct-SFT
Coding
541
0
anthropic
claude-opus-4-7
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 from collections import Counter data = input().split() if not data: print() else: nums = [int(x) for x in data] counts = Counter(nums) max_count = max(counts.values()) result = sorted(n for n, c in counts.items() if c == max_count) print(' '.join(map(str, result))) ```
end_turn
{ "input_tokens": 197, "output_tokens": 143 }
null
allenai/Dolci-Instruct-SFT
Coding
363
0
anthropic
claude-opus-4-7
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\"]" } ]
# Reorganizing Strings by Case Here's a function that reorganizes a list so lowercase-starting strings appear before uppercase-starting strings: ## Solution 1: Using `sorted()` with a key function ```python def reorganize_list(strings): """ Reorganize list so strings starting with lowercase letters appe...
end_turn
{ "input_tokens": 82, "output_tokens": 933 }
null
allenai/Dolci-Instruct-SFT
Coding
417
0
anthropic
claude-opus-4-7
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 from a list of birth weights. Parameters: - birth_weights (list of int): List of newborn weights in grams. Returns: - float: Average weight rounded to two decimal places. Raises...
end_turn
{ "input_tokens": 241, "output_tokens": 627 }
null
allenai/Dolci-Instruct-SFT
Coding
383
0
anthropic
claude-opus-4-7
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...
```python def calculate_carbon_footprint(seafood_items): """ Calculate the total carbon footprint for each seafood item. Parameters: seafood_items (list): A list of dictionaries, each containing: - 'name' (str): Name of the seafood item. - 'quantity' (int): Quantity sold...
end_turn
{ "input_tokens": 479, "output_tokens": 1094 }
null
allenai/Dolci-Instruct-SFT
Coding
501
0
anthropic
claude-opus-4-7
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...
Looking at this problem: - Root has depth 1 - Each child's depth = parent's depth + 1 - Find maximum For the example: node 0 (root) depth=1, nodes 1,2 depth=2, nodes 3,4 depth=3 → max=3 ✓ ```python n = int(input()) parent = [0]*n for i in range(n): p, v = map(int, input().split()) parent[i] = p depth = [0]*n...
end_turn
{ "input_tokens": 283, "output_tokens": 360 }
null
allenai/Dolci-Instruct-SFT
Coding
475
0
anthropic
claude-opus-4-7
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...
```python def main(): import sys input_data = sys.stdin.read().split() idx = 0 n = int(input_data[idx]); idx += 1 nodes = [] for i in range(n): v = int(input_data[idx]); idx += 1 l = int(input_data[idx]); idx += 1 r = int(input_data[idx]); idx += 1 nodes.append((v...
end_turn
{ "input_tokens": 351, "output_tokens": 416 }
null
allenai/Dolci-Instruct-SFT
Coding
585
0
anthropic
claude-opus-4-7
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: if n not in residues: raise ValueError('n is not in a list of residues!') return numbers[residues.index(n)] ```
end_turn
{ "input_tokens": 218, "output_tokens": 89 }
null
allenai/Dolci-Instruct-SFT
Coding
594
0
anthropic
claude-opus-4-7
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 n, m = map(int, input().split()) a = [list(map(int, input().split())) for _ in range(n)] b = [list(map(int, input().split())) for _ in range(n)] for i in range(n): print(' '.join(str(a[i][j] + b[i][j]) for j in range(m))) ```
end_turn
{ "input_tokens": 217, "output_tokens": 111 }
null
allenai/Dolci-Instruct-SFT
Coding
607
0
anthropic
claude-opus-4-7
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): risk_map = { "Soccer": "Medium", "Basketball": "Medium", "Swimming": "High", "Gymnastics": "High", "Chess": "Low", "Art": "Low", } return {activity: risk_map.get(activity, "Unknown") for activity in activities...
end_turn
{ "input_tokens": 314, "output_tokens": 137 }
null
allenai/Dolci-Instruct-SFT
Coding
137
0
anthropic
claude-opus-4-7
train
[ { "role": "user", "content": "Construct a SQL query to find the number of employees with the same 'state' value in the employees table. Additionally, sort the output by the count of employees in descending order and include only those states that have more than 50 employees. Implement error handling measure...
# SQL Query: Count Employees by State ```sql SELECT COALESCE(state, 'Unknown') AS state, COUNT(*) AS employee_count FROM employees WHERE state IS NOT NULL AND TRIM(state) <> '' GROUP BY state HAVING COUNT(*) > 50 ORDER BY employee_count DESC; ``` ## Explanation ### Key Componen...
end_turn
{ "input_tokens": 97, "output_tokens": 1365 }
null
allenai/Dolci-Instruct-SFT
Coding
598
0
anthropic
claude-opus-4-7
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...
```python import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib.ticker import MaxNLocator y = np.random.rand(10) * 2 x = np.arange(0, 10) fig, ax = plt.subplots() ax.plot(x, y) ax.xaxis.set_major_locator(MaxNLocator(integer=True)) ax.yaxis.set_major_locator(MaxNLocator(integer=True))...
end_turn
{ "input_tokens": 128, "output_tokens": 175 }
null
allenai/Dolci-Instruct-SFT
Coding
575
0
anthropic
claude-opus-4-7
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...
```python def main(): line = input().strip() nums = list(map(int, line.split())) if line else [] scalar = int(input().strip()) s = sum(nums) if scalar == 1 or s == 0: result = [x * scalar for x in nums] print(" ".join(map(str, result))) else: print() main() ``` **E...
end_turn
{ "input_tokens": 227, "output_tokens": 399 }
null
allenai/Dolci-Instruct-SFT
Coding
399
0
anthropic
claude-opus-4-7
train
[ { "role": "user", "content": "You are tasked with creating a function that simulates the conversion of a MongoDB document represented as a dictionary into a simplified data model. Your function should handle the extraction of an '_id' field from the input dictionary and return a new dictionary with the key ...
Looking at this problem, I need to: 1. Rename `_id` → `id` 2. Optionally exclude `None` values based on `exclude_unset` 3. Optionally apply field aliases based on `by_alias` (assuming aliases are provided via a special `_aliases` key in the input) ```python def convert_mongo_document(data: dict, exclude_unset: bool, b...
end_turn
{ "input_tokens": 349, "output_tokens": 1194 }
null
allenai/Dolci-Instruct-SFT
Coding
175
0
anthropic
claude-opus-4-7
train
[ { "role": "user", "content": "Construct a programming function that is capable of pinpointing numerical values within a predetermined range, extending from startnum to endnum. The function should be designed to recognize those numbers that are both perfect squares and whose digit sum also constitutes a perf...
# Perfect Square with Perfect Square Digit Sum Finder ```python import math def is_perfect_square(n): """Check if a non-negative number is a perfect square.""" if n < 0: return False root = math.isqrt(n) return root * root == n def digit_sum(n): """Calculate the sum of digits of a number ...
end_turn
{ "input_tokens": 119, "output_tokens": 1381 }
null
allenai/Dolci-Instruct-SFT
Coding
605
0
anthropic
claude-opus-4-7
train
[ { "role": "user", "content": "You are tasked with implementing a function that calculates the shortest distance between two points in a 2D space. The function should take two tuples, each representing the coordinates of a point (x, y). If one or both of the input points are None, the function should return ...
```python import math def calculate_shortest_distance(point1, point2): if point1 is None or point2 is None: return None x1, y1 = point1 x2, y2 = point2 return math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2) ```
end_turn
{ "input_tokens": 148, "output_tokens": 108 }
null
allenai/Dolci-Instruct-SFT
Coding
526
0
anthropic
claude-opus-4-7
train
[ { "role": "user", "content": "Define a function named 'diffList' that accepts a list of integers 'numList' and a boolean 'absolute_difference' (default to False). The function should return a new list that contains the difference of each pair of consecutive numbers from 'numList'. If 'absolute_difference' i...
```python def diffList(numList, absolute_difference=False): if absolute_difference: return [abs(numList[i+1] - numList[i]) for i in range(len(numList)-1)] return [numList[i+1] - numList[i] for i in range(len(numList)-1)] ```
end_turn
{ "input_tokens": 119, "output_tokens": 103 }
null
allenai/Dolci-Instruct-SFT
Coding
647
0
anthropic
claude-opus-4-7
train
[ { "role": "user", "content": "You are tasked with implementing a function that processes a list of tests based on a specified action. The function should accept the following parameters: a string 'action' which can either be 'whitelist' or 'blacklist', an integer 'num_tests' representing the number of tests...
```python def process_test_list(action, num_tests, test_list): if action == 'whitelist': return test_list elif action == 'blacklist': return [] else: raise ValueError("action must be 'whitelist' or 'blacklist'") ```
end_turn
{ "input_tokens": 239, "output_tokens": 95 }
null
allenai/Dolci-Instruct-SFT
Coding
291
0
anthropic
claude-opus-4-7
train
[ { "role": "user", "content": "Design an HTML form that embraces two distinct data entry fields: one specifically tailored for receiving unique personal identifiers such as 'Name', and another dedicated to inputting electronic mail or 'Email' addresses. The form should also feature a command button for submi...
# HTML Form with Name and Email Fields Here's a clean, well-structured HTML form that includes the requested fields: ```html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>User Information Form</title> <style...
end_turn
{ "input_tokens": 99, "output_tokens": 1375 }
null
allenai/Dolci-Instruct-SFT
Coding
275
0
anthropic
claude-opus-4-7
train
[ { "role": "user", "content": "You are to implement a program that maintains a binary tree with the following features:\n\n- You can insert integer values into the tree.\n- The tree supports an in-order traversal, printing the values in order. Each value should be printed as many times as its count (i.e., if...
```python import sys class Node: def __init__(self, val): self.val = val self.count = 1 self.left = None self.right = None class BST: def __init__(self): self.root = None def insert(self, val): self.root = self._insert(self.root, val) def _insert(self,...
end_turn
{ "input_tokens": 437, "output_tokens": 1034 }
null
allenai/Dolci-Instruct-SFT
Coding
266
0
anthropic
claude-opus-4-7
train
[ { "role": "user", "content": "Provided an associative array, also known as a dictionary data structure in Python, construct a function which can traverse the given dictionary of dictionaries, and calculate the total quantity of all elements in it. The dictionary can have an arbitrary level of nesting. Consi...
# Counting Elements in a Nested Dictionary Here's a solution that recursively traverses a dictionary of arbitrary nesting depth and counts all key-value pairs: ```python def count_elements(dictionary): """ Recursively traverse a nested dictionary and count all key-value pairs. Each key-value pair counts a...
end_turn
{ "input_tokens": 181, "output_tokens": 854 }
null
allenai/Dolci-Instruct-SFT
Coding
348
0
anthropic
claude-opus-4-7
train
[ { "role": "user", "content": "I’m trying to price a call option on EUR/GBP exchange rate and it expires in 1 year. Should I use GBP Libor as foreign risk free rate in order to apply BS formula? The pricing date is 02/21/2023 but in this date there is no 12m GBP Libor [https://www.global-rates.com/it/tassi...
# Pricing a EUR/GBP Call Option with Black-Scholes ## Which rate is "domestic" vs "foreign"? First, clarify the quoting convention. EUR/GBP typically means **"how many GBP per 1 EUR"** (GBP is the price/quote currency, EUR is the base currency). In the Garman-Kohlhagen (FX Black-Scholes) formula: - **Domestic rate**...
end_turn
{ "input_tokens": 202, "output_tokens": 1148 }
null
allenai/Dolci-Instruct-SFT
Coding
385
0
anthropic
claude-opus-4-7
train
[ { "role": "user", "content": "Please thoroughly analyze and rectify potential errors in the provided piece of code that attempts to implement Bubble Sort, an algorithm for array sorting. To accomplish this, you must delve into the logic, iterate over the code lines, observe its existing structure carefully ...
# Bubble Sort Code Analysis ## Verdict: The Code is Actually Correct! ✅ After carefully analyzing the provided code line-by-line, I can confirm that this is a **valid and correct implementation of Bubble Sort**. Let me walk through why it works properly. ## Line-by-Line Analysis ```python def bubbleSort(arr): n...
end_turn
{ "input_tokens": 214, "output_tokens": 1248 }
null
allenai/Dolci-Instruct-SFT
Coding
534
0
anthropic
claude-opus-4-7
train
[ { "role": "user", "content": "Write a python function to analyze the frequency of keywords related to grassroots movements in a given list of news articles. The function should take as input a list of strings, where each string represents a news article. It should also take a list of keywords to search for....
```python import re def analyze_keyword_frequency(articles, keywords): """ Count the number of articles that mention each keyword at least once. Matching is case-insensitive and uses whole-word boundaries. """ result = {} for keyword in keywords: pattern = re.compile(r'\b' + re.escape(k...
end_turn
{ "input_tokens": 380, "output_tokens": 917 }
null
allenai/Dolci-Instruct-SFT
Coding
625
0
anthropic
claude-opus-4-7
train
[ { "role": "user", "content": "You are tasked with managing a collection of data points represented as tuples. Each tuple contains multiple attributes, and you need to implement a function that can handle the following tasks: 1. Add a new data point (a tuple) to the collection. 2. Calculate the average of a ...
```python def data_manager_operations(operations): data_points = [] results = [] for op in operations: action = op[0] if action == 'add': data_points.append(op[1]) elif action == 'average': idx = op[1] if data_points: avg = sum...
end_turn
{ "input_tokens": 300, "output_tokens": 245 }
null
allenai/Dolci-Instruct-SFT
Coding
656
0
anthropic
claude-opus-4-7
train
[ { "role": "user", "content": "You are tasked with creating a Python function that takes a string as input and returns a dictionary containing the positions of all the unique alphabets present in the input string. The position of an alphabet is determined by its position in the English alphabet, where 'a' co...
```python def alphabet_positions(input_string): result = {} for char in input_string: lower = char.lower() if lower.isalpha() and lower not in result: result[lower] = ord(lower) - ord('a') + 1 return result ```
end_turn
{ "input_tokens": 228, "output_tokens": 93 }
null
allenai/Dolci-Instruct-SFT
Coding
714
0
anthropic
claude-opus-4-7
train
[ { "role": "user", "content": "You are tasked with creating a function that updates the description of a project. The project is represented by a dictionary containing the keys: 'name', 'creator_id', 'project_id', and 'description'. The 'description' can be an empty string if not provided. Your function shou...
```python def update_project_description(project: dict, new_description: str) -> None: if new_description != "": project['description'] = new_description ```
end_turn
{ "input_tokens": 211, "output_tokens": 52 }
null
allenai/Dolci-Instruct-SFT
Coding
640
0
anthropic
claude-opus-4-7
train
[ { "role": "user", "content": "You are given a positive integer n, an array nums of n positive integers and an integer s (s>0).\n\nTask\nFind the minimal length of a contiguous sub-array of nums whose elements sum to at least s. If no such sub-array exists, output 0.\n\nInput\nThe input is provided through s...
```python import sys def main(): data = sys.stdin.read().split() if not data: return n = int(data[0]) s = int(data[1]) nums = list(map(int, data[2:2+n])) min_len = 0 left = 0 cur_sum = 0 for right in range(n): cur_sum += nums[right] while cur_sum >= s: ...
end_turn
{ "input_tokens": 294, "output_tokens": 230 }
null
allenai/Dolci-Instruct-SFT
Coding
637
0
anthropic
claude-opus-4-7
train
[ { "role": "user", "content": "Write a python function to help me determine the most popular clothing item from customer orders data. I have a list of dictionaries where each dictionary represents a customer's order and contains the item names as keys and the quantity ordered as values. For example:\n\n```py...
```python from collections import Counter def most_popular_item(orders): totals = Counter() for order in orders: totals.update(order) return totals.most_common(1)[0][0] if totals else None ```
end_turn
{ "input_tokens": 299, "output_tokens": 77 }
null
allenai/Dolci-Instruct-SFT
Coding
289
0
anthropic
claude-opus-4-7
train
[ { "role": "user", "content": "You are required to program a function that calculates not only the dot product of two arrays, but also the cross product. Afterwards, the function should compute the angle between the two vectors represented by these arrays, in degrees. \n\nFor simplicity, you can assume all i...
```python import math def sanitize(vec): """Convert non-numeric values in vector to 0.""" clean = [] for v in vec: if isinstance(v, bool): # bool is subclass of int, treat as non-numeric? keep as number clean.append(int(v)) elif isinstance(v, (int, float)): clean.ap...
end_turn
{ "input_tokens": 183, "output_tokens": 1213 }
null
allenai/Dolci-Instruct-SFT
Coding
742
0
anthropic
claude-opus-4-7
train
[ { "role": "user", "content": "Given two lists of integers, `T1` and `Vvvov`, where `T1` represents the coefficients for a linear transformation and `Vvvov` represents the interaction values between different variables, write a function `calculate_expression(T1: List[int], Vvvov: List[int]) -> str` that comp...
```python from typing import List def calculate_expression(T1: List[int], Vvvov: List[int]) -> str: if len(T1) != len(Vvvov): return 'Error: Lists must be of the same length.' return '-1/2 * t^{o0}_{v2} * v^{o1,v2}_{v0,v1}' ```
end_turn
{ "input_tokens": 266, "output_tokens": 157 }
null
allenai/Dolci-Instruct-SFT
Coding
761
0
anthropic
claude-opus-4-7
train
[ { "role": "user", "content": "Write a program that reads an integer from standard input and prints 'True' if the number is a perfect square, and 'False' otherwise.\n\nInput:\nA single line containing an integer n.\n\nOutput:\nPrint 'True' if n is a perfect square, and 'False' otherwise.\n\nExample:\nInput\n...
```python import math n = int(input()) if n < 0: print('False') else: r = math.isqrt(n) print('True' if r * r == n else 'False') ```
end_turn
{ "input_tokens": 121, "output_tokens": 65 }
null
allenai/Dolci-Instruct-SFT
Coding
757
0
anthropic
claude-opus-4-7
train
[ { "role": "user", "content": "Wave Sorting\n\nAn array of integers is said to be in wave order if its elements satisfy the following pattern\n a0 ≥ a1 ≤ a2 ≥ a3 ≤ a4 …\nIn other words, every element at an even index (0-based) is not smaller than its neighbours, while every element at an odd index is not gr...
```python def main(): import sys data = sys.stdin.read().split() n = int(data[0]) a = list(map(int, data[1:1+n])) a.sort() for i in range(0, n-1, 2): a[i], a[i+1] = a[i+1], a[i] print(' '.join(map(str, a))) main() ```
end_turn
{ "input_tokens": 312, "output_tokens": 155 }
null
allenai/Dolci-Instruct-SFT
Coding
679
0
anthropic
claude-opus-4-7
train
[ { "role": "user", "content": "Write a function `convert_initials(text: str) -> str` that takes a string `text` as input and returns a new string where the initial two characters of each word in the input string are converted to uppercase. A word is defined as a sequence of characters separated by spaces. If...
```python def convert_initials(text: str) -> str: def transform(word: str) -> str: if len(word) < 2: return word.upper() return word[:2].upper() + word[2:] # Split on single spaces to preserve multiple spaces as empty strings parts = text.split(' ') return ' '.join(trans...
end_turn
{ "input_tokens": 135, "output_tokens": 637 }
null
allenai/Dolci-Instruct-SFT
Coding
386
0
anthropic
claude-opus-4-7
train
[ { "role": "user", "content": "I'm looking for a .NET regular expression extract all the URLs from a webpage but haven't found one to be comprehensive enough to cover all the different ways you can specify a link. \n\nAnd a side question:\n\nIs there ? Or am I better off using a series of less complicated re...
# Extracting URLs from HTML with .NET Regex ## Short Answer **Don't use a single regex for this.** HTML parsing with regex is notoriously fragile. Use the **HTML Agility Pack** instead — it's the de facto standard for parsing HTML in .NET. ## The Recommended Approach: HTML Agility Pack ```csharp using HtmlAgilityPa...
end_turn
{ "input_tokens": 129, "output_tokens": 1057 }
null
allenai/Dolci-Instruct-SFT
Coding
457
0
anthropic
claude-opus-4-7
train
[ { "role": "user", "content": "When calculating correlations in `R` e.g. via `cor` is it better to treat missing data as NAs or as `Zeros`?\nThe latter would be regarded as numerical valid values so I'd guess `NA` would be better?" } ]
You're right — in almost all cases, **NA is the correct choice**, not zero. ## Why NA is better **Zero is a meaningful numeric value.** If you replace missing data with 0, you're telling `cor()` that the observation *actually was* zero. This: - Shifts the mean of the variable - Shrinks the variance artificially (or ...
end_turn
{ "input_tokens": 83, "output_tokens": 595 }
null
allenai/Dolci-Instruct-SFT
Coding
437
0
anthropic
claude-opus-4-7
train
[ { "role": "user", "content": "If unit-test names can become outdated over time and if you consider that the test itself is the most important thing, then is it important to choose wise test names?\n\nie \n\n\n[Test]\npublic void ShouldValidateUserNameIsLessThan100Characters() {}\n\n\n\nverse \n\n\n[Test]\np...
# Yes, test names matter — a lot Even if names can become outdated, choosing good test names is still important. Here's why: ## Test names are documentation When a test fails in your CI output, you often see just the name first: ``` FAILED: ShouldValidateUserNameIsLessThan100Characters FAILED: UserNameTestValidatio...
end_turn
{ "input_tokens": 114, "output_tokens": 681 }
null
allenai/Dolci-Instruct-SFT
Coding
763
0
anthropic
claude-opus-4-7
train
[ { "role": "user", "content": "You are given the implementation of a Box class in Python. Add a method named `volume` that calculates and returns the volume of the box. The method must check if any dimension (width, height, or depth) is non-positive (less than or equal to zero), and if so, raise a `ValueErro...
```python class Box: def __init__(self, width, height, depth): self.width = width self.height = height self.depth = depth def surface_area(self): w, h, d = self.width, self.height, self.depth return 2 * (w * h + w * d + h * d) def volume(self): if self.width...
end_turn
{ "input_tokens": 411, "output_tokens": 305 }
null
allenai/Dolci-Instruct-SFT
Coding
36
0
anthropic
claude-opus-4-7
train
[ { "role": "user", "content": "Generate a CSS style sheet to create a basic layout for a website." } ]
# Basic Website Layout CSS Stylesheet Here's a complete CSS stylesheet for a basic responsive website layout: ```css /* ===== CSS Reset & Base Styles ===== */ * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; line-height: 1.6...
end_turn
{ "input_tokens": 33, "output_tokens": 2329 }
null
allenai/Dolci-Instruct-SFT
Coding
547
0
anthropic
claude-opus-4-7
train
[ { "role": "user", "content": "Write a program that reads one line of text from standard input and classifies it as 'spam' or 'not spam' based on the following criteria:\n\n- The line is considered spam if it contains any of these words: \"buy\", \"win\", or \"free\" (case-insensitive).\n- In addition, if th...
```python import re line = input() low = line.lower() spam = False if re.search(r'\b(buy|win|free)\b', low): spam = True if not spam: for m in re.finditer(r'([$€£¥])\s*(\d+(?:\.\d+)?)', line): value = float(m.group(2)) if value > 500: prefix = line[:m.start()].rstrip().lower() ...
end_turn
{ "input_tokens": 329, "output_tokens": 645 }
null
allenai/Dolci-Instruct-SFT
Coding
599
0
anthropic
claude-opus-4-7
train
[ { "role": "user", "content": "You are given a string representation of a GYP (Generate Your Projects) file snippet, which defines build targets and their dependencies. Your task is to implement a function that extracts the target names and their corresponding dependencies from this GYP file snippet. The fun...
```python import re def extract_targets_and_dependencies(gyp_file_snippet: str) -> dict: result = {} # Find all target blocks - match balanced braces # Simpler: find each 'target_name' occurrence and look for nearby 'dependencies' # Split by target_name occurrences targets = [] length = le...
end_turn
{ "input_tokens": 242, "output_tokens": 594 }
null
allenai/Dolci-Instruct-SFT
Coding
778
0
anthropic
claude-opus-4-7
train
[ { "role": "user", "content": "You are given two sorted singly linked lists in ascending order. Each linked list is specified as a sequence of integers separated by spaces, representing the node values in order. The two lists are provided on two lines:\n\nInput Format:\nThe first line contains the values of ...
```python import sys def main(): lines = sys.stdin.read().split('\n') l1 = list(map(int, lines[0].split())) if len(lines) > 0 and lines[0].strip() else [] l2 = list(map(int, lines[1].split())) if len(lines) > 1 and lines[1].strip() else [] merged = [] i = j = 0 while i < len(l1) and j < le...
end_turn
{ "input_tokens": 220, "output_tokens": 289 }
null
allenai/Dolci-Instruct-SFT
Coding
635
0
anthropic
claude-opus-4-7
train
[ { "role": "user", "content": "Write a python function to compare the rendering performance of two different graphics libraries by calculating the average frame rendering time over a set of frames. Assume you are given two lists of rendering times in milliseconds, where each list corresponds to a different g...
```python def compare_rendering_performance(render_times_A, render_times_B): """ Compare rendering performance of two graphics libraries. Args: render_times_A: List of rendering times (ms) for library A. render_times_B: List of rendering times (ms) for library B. Returns: ...
end_turn
{ "input_tokens": 378, "output_tokens": 645 }
null
End of preview. Expand in Data Studio

Dolci-Instruct-SFT · Opus 4.7 completions (extended thinking)

10,000 completions sampled from allenai/Dolci-Instruct-SFT prompts with claude-opus-4-7 and extended thinking enabled (adaptive), one completion per prompt, produced with the dist-align sampler. Same prompt set as asparius/dolci-instruct-sft-opus4.7 (the pure-mode / no-thinking counterpart), re-sampled from the recorded prompts.

Sampling

  • claude-opus-4-7, thinking: {type: "adaptive"}, max_tokens=64000, default sampling.
  • Domain-stratified: equal prompts from Coding, Reasoning, Chat, Math, Science, Multilingual, Precise IF, Other (1,250 each).

Thinking note (important)

Opus 4.7 returns encrypted thinking: the thinking content block carries a signature but no plaintext reasoning, so the saved text is the final answer only (the hidden reasoning is not recoverable). Adaptive thinking fired on 47.5% of prompts (hidden reasoning tokens, billed as output). Compared to the 4096-capped pure-mode set, answers here are longer (median 658 output tokens, p90 ~2.8k, p99 ~11.6k, max = 64k cap) and were produced after the model reasoned.

Fields

dataset, domain, prompt_index, sample_index, provider, model, split, prompt (list of {role, content}), text (final answer), finish_reason, usage (input_tokens/output_tokens; output includes hidden thinking tokens), error (null; the 10K are all clean).

For SFT

Drop max_tokens-truncated completions (11) and refusals (17) if desired. There are no error rows. text is answer-only; no <think> traces to strip.

Downloads last month
19