text stringlengths 86 413k | category stringclasses 17
values | source stringclasses 13
values | difficulty stringclasses 35
values | complexity dict | _original_code stringlengths 11 71k ⌀ | code stringlengths 12 117k ⌀ | _autofix_applied listlengths 1 6 ⌀ | _post_fix_label stringclasses 4
values | _post_fix_error stringclasses 408
values | validated bool 1
class | validation_method stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
<|im_start|>user
It's your birthday today, right? If it is, then we wish you Happy Birthday and good luck in the contest. But, even if it is not, you have to be ready to give candies to your friend when this day comes!
You have N candies to distribute and you decide to give them to anyone who shows up. Because this is... | func_gen | platinum_v1 | unknown | {
"ast_nodes": 1391,
"max_depth": 4,
"func_count": 16,
"line_count": 200,
"imports": 10,
"branching": 50,
"difficulty": 8
} | null | null | null | null | null | null | null |
<|im_start|>user
Here's an interview question I've seen on a few sites. People claim that an O(n) solution is possible, but I've been racking my brain these last 2 days and I couldn't come up with a solution, nor find one anywhere on the web.
Given an array of integers, find two disjoint, contiguous subarrays such that... | func_gen | platinum_v1 | unknown | {
"ast_nodes": 946,
"max_depth": 3,
"func_count": 2,
"line_count": 102,
"imports": 0,
"branching": 12,
"difficulty": 6
} | null | null | null | null | null | null | null |
<|im_start|>user
You are a helpful and harmless assistant. You should think step-by-step before responding to the instruction below.
Please use python programming language only.
You must use ```python for just the final solution code block with the following format:
```python
# Your code here
```
There is a square g... | func_gen | platinum_v1 | unknown | {
"ast_nodes": 1129,
"max_depth": 5,
"func_count": 7,
"line_count": 125,
"imports": 2,
"branching": 27,
"difficulty": 8
} | null | null | null | null | null | null | null |
<|im_start|>user
def f(lst):return [x for x in lst if x%2]<|im_end|>
<|im_start|>assistant
Filter odds.<|im_end|> | func_gen | platinum_v1 | unknown | {
"ast_nodes": 0,
"max_depth": 0,
"func_count": 0,
"line_count": 1,
"imports": 0,
"branching": 0,
"difficulty": 0.004
} | null | null | null | null | null | null | null |
<|im_start|>user
You are tasked with creating a script that sets up a virtual environment in Python, similar to the given code snippet. The script should be able to activate the virtual environment, deactivate it, and set the appropriate environment variables.
Your goal is to create a Python script that can be used to... | func_gen | platinum_v1 | unknown | {
"ast_nodes": 198,
"max_depth": 3,
"func_count": 6,
"line_count": 26,
"imports": 1,
"branching": 2,
"difficulty": 4
} | null | null | null | null | null | null | null |
<|im_start|>user
You are a helpful and harmless assistant. You should think step-by-step before responding to the instruction below.
Please use python programming language only.
You must use ```python for just the final solution code block with the following format:
```python
# Your code here
```
Your friend has a h... | func_gen | platinum_v1 | unknown | {
"ast_nodes": 1283,
"max_depth": 6,
"func_count": 4,
"line_count": 150,
"imports": 1,
"branching": 38,
"difficulty": 8
} | null | null | null | null | null | null | null |
<|im_start|>user
You are a helpful and harmless assistant. You should think step-by-step before responding to the instruction below.
Please use python programming language only.
You must use ```python for just the final solution code block with the following format:
```python
# Your code here
```
There is an infinit... | func_gen | platinum_v1 | unknown | {
"ast_nodes": 686,
"max_depth": 5,
"func_count": 2,
"line_count": 82,
"imports": 3,
"branching": 20,
"difficulty": 6
} | null | null | null | null | null | null | null |
<|im_start|>user
You are a helpful and harmless assistant. You should think step-by-step before responding to the instruction below.
Please use python programming language only.
You must use ```python for just the final solution code block with the following format:
```python
# Your code here
```
The only difference... | func_gen | platinum_v1 | unknown | {
"ast_nodes": 1312,
"max_depth": 5,
"func_count": 5,
"line_count": 125,
"imports": 1,
"branching": 25,
"difficulty": 8
} | null | null | null | null | null | null | null |
<|im_start|>user
def f(lst):return [x for x in lst if x%2==0 and x%5==0]<|im_end|>
<|im_start|>assistant
Multiples of 10.<|im_end|> | func_gen | platinum_v1 | unknown | {
"ast_nodes": 0,
"max_depth": 0,
"func_count": 0,
"line_count": 1,
"imports": 0,
"branching": 0,
"difficulty": 0.004
} | null | null | null | null | null | null | null |
<|im_start|>user
You are a helpful and harmless assistant. You should think step-by-step before responding to the instruction below.
Please use python programming language only.
You must use ```python for just the final solution code block with the following format:
```python
# Your code here
```
Turtle just receive... | func_gen | platinum_v1 | null | {
"ast_nodes": 1043,
"max_depth": 5,
"func_count": 10,
"line_count": 125,
"imports": 1,
"branching": 19,
"difficulty": 8
} | import sys
# ---------- Fenwick Tree with kth selection ----------
class BIT:
def __init__(self, n):
self.n = n
self.tree = [0] * (n + 1)
def add(self, idx, delta):
while idx <= self.n:
self.tree[idx] += delta
idx += idx & -idx
def sum(self, idx):
s... | import sys
# ---------- Fenwick Tree with kth selection ----------
class BIT:
def __init__(self, n):
self.n = n
self.tree = [0] * (n + 1)
def add(self, idx, delta):
while idx <= self.n:
self.tree[idx] += delta
idx += idx & -idx
def sum(self, idx):
... | [
"autopep8"
] | N_runtime | StopIteration | true | docker_repl |
<|im_start|>user
You are a helpful and harmless assistant. You should think step-by-step before responding to the instruction below.
Please use python programming language only.
You must use ```python for just the final solution code block with the following format:
```python
# Your code here
```
Monocarp plays a co... | func_gen | platinum_v1 | unknown | {
"ast_nodes": 1372,
"max_depth": 6,
"func_count": 4,
"line_count": 151,
"imports": 2,
"branching": 36,
"difficulty": 8.004
} | null | null | null | null | null | null | null |
<|im_start|>user
def f(lst):return [int(x) for x in lst if str(x).isdigit()]<|im_end|>
<|im_start|>assistant
Convert digit strings to ints.<|im_end|> | func_gen | platinum_v1 | unknown | {
"ast_nodes": 0,
"max_depth": 0,
"func_count": 0,
"line_count": 1,
"imports": 0,
"branching": 0,
"difficulty": 0.004
} | null | null | null | null | null | null | null |
<|im_start|>user
Input
A bound m <= 4294967295.
Output
Consider values sampled uniformly at random from integers in the range 0 to m, inclusive.
Your output should be the expected (average) number of trailing zeros in the binary representation of the sampled value. Your answer should be exact, for example given as a fr... | func_gen | platinum_v1 | unknown | {
"ast_nodes": 116,
"max_depth": 2,
"func_count": 2,
"line_count": 17,
"imports": 1,
"branching": 1,
"difficulty": 2
} | null | null | null | null | null | null | null |
<|im_start|>user
You are a helpful and harmless assistant. You should think step-by-step before responding to the instruction below.
Please use python programming language only.
You must use ```python for just the final solution code block with the following format:
```python
# Your code here
```
You are given an ar... | func_gen | platinum_v1 | unknown | {
"ast_nodes": 726,
"max_depth": 6,
"func_count": 1,
"line_count": 87,
"imports": 2,
"branching": 22,
"difficulty": 6
} | null | null | null | null | null | null | null |
<|im_start|>user
You are a helpful and harmless assistant. You should think step-by-step before responding to the instruction below.
Please use python programming language only.
You must use ```python for just the final solution code block with the following format:
```python
# Your code here
```
Read problems state... | func_gen | platinum_v1 | unknown | {
"ast_nodes": 1699,
"max_depth": 6,
"func_count": 4,
"line_count": 151,
"imports": 2,
"branching": 27,
"difficulty": 8.004
} | null | null | null | null | null | null | null |
<|im_start|>user
Recent improvements in information and communication technology have made it possible to provide municipal service to a wider area more quickly and with less costs. Stimulated by this, and probably for saving their not sufficient funds, mayors of many cities started to discuss on mergers of their citie... | func_gen | platinum_v1 | unknown | {
"ast_nodes": 496,
"max_depth": 8,
"func_count": 2,
"line_count": 52,
"imports": 1,
"branching": 19,
"difficulty": 6
} | null | null | null | null | null | null | null |
<|im_start|>user
You are a helpful and harmless assistant. You should think step-by-step before responding to the instruction below.
Please use python programming language only.
You must use ```python for just the final solution code block with the following format:
```python
# Your code here
```
Nastya is a competi... | func_gen | platinum_v1 | null | {
"ast_nodes": 1740,
"max_depth": 4,
"func_count": 14,
"line_count": 201,
"imports": 2,
"branching": 31,
"difficulty": 8.004
} | import sys
import random
sys.setrecursionlimit(1 << 25)
MOD = 1_000_000_007
BASE = 91138233 # any large odd number
# ---------- persistent implicit treap ----------
class TreapNode:
__slots__ = ('val', 'prio', 'left', 'right', 'size', 'hash')
def __init__(self, val):
self.val = val
self.prio... | import random
import sys
sys.setrecursionlimit(1 << 25)
MOD = 1_000_000_007
BASE = 91138233 # any large odd number
# ---------- persistent implicit treap ----------
class TreapNode:
__slots__ = ('hash', 'left', 'prio', 'right', 'size', 'val')
def __init__(self, val):
self.val = val
self.p... | [
"autopep8",
"ruff"
] | N_runtime | StopIteration | true | docker_repl |
<|im_start|>user
Create a function in Python to check if a given string contains two of the same characters next to each other<|im_end|>
<|im_start|>assistant
def check_for_two_same_chars(string):
for i in range(len(string)-1):
if string[i] == string[i+1]:
return True
return False<|im_end|> | func_gen | platinum_v1 | unknown | {
"ast_nodes": 40,
"max_depth": 3,
"func_count": 1,
"line_count": 5,
"imports": 0,
"branching": 2,
"difficulty": 2
} | null | null | null | null | null | null | null |
<|im_start|>user
Solve the following coding problem using the programming language python:
Gildong has a square board consisting of n rows and n columns of square cells, each consisting of a single digit (from 0 to 9). The cell at the j-th column of the i-th row can be represented as (i, j), and the length of the side... | func_gen | valkrov_rl_python | 9 | {
"ast_nodes": 714,
"max_depth": 5,
"func_count": 2,
"line_count": 68,
"imports": 1,
"branching": 18,
"difficulty": 6
} | null | null | null | null | null | null | null |
<|im_start|>user
Solve the following coding problem using the programming language python:
In Ann's favorite book shop are as many as n books on math and economics. Books are numbered from 1 to n. Each of them contains non-negative number of problems.
Today there is a sale: any subsegment of a segment from l to r can... | func_gen | valkrov_rl_python | 12 | {
"ast_nodes": 1327,
"max_depth": 5,
"func_count": 11,
"line_count": 126,
"imports": 4,
"branching": 27,
"difficulty": 8.004
} | null | null | null | null | null | null | null |
<|im_start|>user
Given a function, create a program to identify whether the output is equal to 1, 0 or -1.
def func(x):
if x < 0:
return -1
elif x == 0:
return 0
else:
return 1<|im_end|>
<|im_start|>assistant
def func_val(x):
result = func(x)
if result == -1:
return -... | func_gen | platinum_v1 | unknown | {
"ast_nodes": 34,
"max_depth": 3,
"func_count": 1,
"line_count": 8,
"imports": 0,
"branching": 2,
"difficulty": 2
} | null | null | null | null | null | null | null |
<|im_start|>user
Your task is to, given an image, compress it to 100000 bytes or less, while following all of the below rules:
No cheating/loopholes.
Your code must not be optimized to work best only on the test set of images, but rather produce a good output in general.
Colours that do not exist in the original input... | func_gen | platinum_v1 | unknown | {
"ast_nodes": 1622,
"max_depth": 4,
"func_count": 6,
"line_count": 202,
"imports": 11,
"branching": 21,
"difficulty": 8.008
} | null | null | null | null | null | null | null |
<|im_start|>user
You are a helpful and harmless assistant. You should think step-by-step before responding to the instruction below.
Please use python programming language only.
You must use ```python for just the final solution code block with the following format:
```python
# Your code here
```
There is an infinit... | func_gen | platinum_v1 | null | {
"ast_nodes": 686,
"max_depth": 5,
"func_count": 2,
"line_count": 82,
"imports": 3,
"branching": 20,
"difficulty": 6
} | import sys
from bisect import bisect_left, bisect_right
import heapq
def solve() -> None:
data = sys.stdin.read().split()
it = iter(data)
n = int(next(it))
q = int(next(it))
s = int(next(it)) - 1 # zero‑based
d = int(next(it))
a = [int(next(it)) for _ in range(n)]
queries = [... | import heapq
import sys
from bisect import bisect_left, bisect_right
def solve() -> None:
data = sys.stdin.read().split()
it = iter(data)
n = int(next(it))
q = int(next(it))
s = int(next(it)) - 1 # zero‑based
d = int(next(it))
a = [int(next(it)) for _ in range(n)]
queries = ... | [
"autopep8",
"ruff"
] | N_runtime | StopIteration | true | docker_repl |
<|im_start|>user
You are a helpful and harmless assistant. You should think step-by-step before responding to the instruction below.
Please use python programming language only.
You must use ```python for just the final solution code block with the following format:
```python
# Your code here
```
На плоскости распол... | func_gen | platinum_v1 | null | {
"ast_nodes": 1269,
"max_depth": 5,
"func_count": 7,
"line_count": 127,
"imports": 1,
"branching": 24,
"difficulty": 8.008
} | import sys
import math
def main():
data = list(map(int, sys.stdin.read().split()))
it = iter(data)
Px = next(it); Py = next(it)
n = next(it)
A = [(next(it), next(it)) for _ in range(n)]
Qx = next(it); Qy = next(it)
m = next(it)
B = [(next(it), next(it)) for _ in range(m)]
# shift p... | import sys
def main():
data = list(map(int, sys.stdin.read().split()))
it = iter(data)
Px = next(it)
Py = next(it)
n = next(it)
A = [(next(it), next(it)) for _ in range(n)]
Qx = next(it)
Qy = next(it)
m = next(it)
B = [(next(it), next(it)) for _ in range(m)]
# shift polygo... | [
"autopep8",
"ruff"
] | N_runtime | StopIteration | true | docker_repl |
<|im_start|>user
def f(lst):return [x*3 for x in lst if x%3==0]<|im_end|>
<|im_start|>assistant
Triple multiples of 3.<|im_end|> | func_gen | platinum_v1 | unknown | {
"ast_nodes": 0,
"max_depth": 0,
"func_count": 0,
"line_count": 1,
"imports": 0,
"branching": 0,
"difficulty": 0.004
} | null | null | null | null | null | null | null |
<|im_start|>user
You are a helpful and harmless assistant. You should think step-by-step before responding to the instruction below.
Please use python programming language only.
You must use ```python for just the final solution code block with the following format:
```python
# Your code here
```
Serega and Fedor pl... | func_gen | platinum_v1 | null | {
"ast_nodes": 1044,
"max_depth": 5,
"func_count": 9,
"line_count": 127,
"imports": 2,
"branching": 21,
"difficulty": 8.008
} | import sys
import bisect
def main():
data = sys.stdin.read().strip().split()
it = iter(data)
n = int(next(it))
a = [0] + [int(next(it)) for _ in range(n)]
# prefix sums
P = [0] * (n + 1)
for i in range(1, n + 1):
P[i] = P[i - 1] + a[i]
# constants const[i] = a[i]*(i-1) - P[i-... | import bisect
import sys
def main():
data = sys.stdin.read().strip().split()
it = iter(data)
n = int(next(it))
a = [0] + [int(next(it)) for _ in range(n)]
# prefix sums
P = [0] * (n + 1)
for i in range(1, n + 1):
P[i] = P[i - 1] + a[i]
# constants const[i] = a[i]*(i-1) - P[i... | [
"autopep8",
"ruff"
] | N_runtime | StopIteration | true | docker_repl |
End of preview. Expand in Data Studio
No dataset card yet
- Downloads last month
- 7