source stringclasses 4
values | task_type stringclasses 1
value | in_source_id stringlengths 0 138 | instruction_seed stringlengths 216 14.3k | gold_standard_solution stringlengths 0 289k ⌀ | verification_info stringlengths 88 74M | metadata stringlengths 19 221 | problem_id stringlengths 5 10 | _source stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|
code_contests | verifiable_code | 1096_D. Easy Problem | Solve the following coding problem using the programming language python:
Vasya is preparing a contest, and now he has written a statement for an easy problem. The statement is a string of length n consisting of lowercase Latin latters. Vasya thinks that the statement can be considered hard if it contains a subsequenc... | ```python
_ = input()
s = input()
a = list(map(int, input().split()))
hard = "hard"
dp = [0]*4
for i in range(len(s)):
if s[i] == hard[0]:
dp[0] += a[i]
for j in range(1, 4):
if s[i] == hard[j]:
# If same letter, either leave as-is (extend prefix) or remove it
dp[j] = m... | {'test_cases': [{'type': 'stdin_stdout', 'input': '6\nhhaarr\n1 2 3 4 5 6\n', 'output': '0\n'}, {'type': 'stdin_stdout', 'input': '6\nhhardh\n3 2 9 11 7 1\n', 'output': '5\n'}, {'type': 'stdin_stdout', 'input': '8\nhhzarwde\n3 2 6 9 4 8 7 1\n', 'output': '4\n'}, {'type': 'stdin_stdout', 'input': '13\nahrhzhdrrhrra\n129... | {'difficulty': 10, 'time_limit': {'seconds': 2, 'nanos': 0}, 'memory_limit_bytes': 256000000} | vfc_45073 | PrimeIntellect/verifiable-coding-problems |
code_contests | verifiable_code | 725_E. Too Much Money | Solve the following coding problem using the programming language python:
Alfred wants to buy a toy moose that costs c dollars. The store doesn’t give change, so he must give the store exactly c dollars, no more and no less. He has n coins. To make c dollars from his coins, he follows the following algorithm: let S be... | ```python
#!/usr/bin/env python
import sys
alf_goal = int(sys.stdin.readline().strip())
num_coins = int(sys.stdin.readline().strip())
alf_coins = []
for i in range(num_coins):
alf_coins.append(int(sys.stdin.readline().strip()))
cnt = [0]*(alf_goal+1) # this is just the count of the coins you have.
pre = [0]*(alf_... | {'test_cases': [{'type': 'stdin_stdout', 'input': '12\n3\n5\n3\n4\n', 'output': '5'}, {'type': 'stdin_stdout', 'input': '50\n8\n1\n2\n4\n8\n16\n37\n37\n37\n', 'output': 'Greed is good'}, {'type': 'stdin_stdout', 'input': '200000\n10\n31506\n28490\n134366\n5638\n19457\n2007\n14856\n103670\n24455\n68460\n', 'output': '28... | {'difficulty': 11, 'time_limit': {'seconds': 2, 'nanos': 0}, 'memory_limit_bytes': 256000000} | vfc_66485 | PrimeIntellect/verifiable-coding-problems |
code_contests | verifiable_code | 1370_E. Binary Subsequence Rotation | Solve the following coding problem using the programming language cpp:
Naman has two binary strings s and t of length n (a binary string is a string which only consists of the characters "0" and "1"). He wants to convert s into t using the following operation as few times as possible.
In one operation, he can choose ... | ```cpp
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 7;
string s[2];
int a[maxn];
int n;
int main() {
cin >> n;
cin >> s[0] >> s[1];
for (int i = 1; i <= n; ++i) {
a[i] = a[i - 1];
if (s[0][i - 1] == '1' && s[1][i - 1] == '0') a[i]++;
if (s[0][i - 1] == '0' && s[1][i - 1] == '1'... | {'test_cases': [{'type': 'stdin_stdout', 'input': '10\n1111100000\n1111100001\n', 'output': '-1\n'}, {'type': 'stdin_stdout', 'input': '6\n010000\n000001\n', 'output': '1\n'}, {'type': 'stdin_stdout', 'input': '10\n1111100000\n0000011111\n', 'output': '5\n'}, {'type': 'stdin_stdout', 'input': '8\n10101010\n01010101\n',... | {'difficulty': 11, 'time_limit': {'seconds': 2, 'nanos': 0}, 'memory_limit_bytes': 256000000} | vfc_81348 | PrimeIntellect/verifiable-coding-problems |
taco | verifiable_code | https://codeforces.com/problemset/problem/598/C | Solve the following coding problem using the programming language python:
You are given the set of vectors on the plane, each of them starting at the origin. Your task is to find a pair of vectors with the minimal non-oriented angle between them.
Non-oriented angle is non-negative value, minimal between clockwise and... | ```python
from collections import namedtuple
from math import sqrt
from functools import cmp_to_key
Vec = namedtuple('Vec', 'x y index')
Fraction = namedtuple('Fraction', 'num denom')
def fraction_comp(a, b):
return a.num * b.denom > b.num * a.denom
def angle_comp(v):
result = v.x / sqrt(v.x * v.x + v.y * v.y)
if ... | {'test_cases': [{'type': 'stdin_stdout', 'input': '4\n-1 0\n0 -1\n1 0\n1 1\n', 'output': '3 4\n'}, {'type': 'stdin_stdout', 'input': '6\n-1 0\n0 -1\n1 0\n1 1\n-4 -5\n-4 -6\n', 'output': '5 6\n'}, {'type': 'stdin_stdout', 'input': '10\n8 6\n-7 -3\n9 8\n7 10\n-3 -8\n3 7\n6 -8\n-9 8\n9 2\n6 7\n', 'output': '1 3\n'}, {'typ... | {'difficulty': 'HARD', 'problem_url': 'https://codeforces.com/problemset/problem/598/C', 'time_limit': None, 'memory_limit': None} | vfc_109958 | PrimeIntellect/verifiable-coding-problems |
taco | verifiable_code | https://codeforces.com/problemset/problem/219/D | Solve the following coding problem using the programming language python:
The country Treeland consists of n cities, some pairs of them are connected with unidirectional roads. Overall there are n - 1 roads in the country. We know that if we don't take the direction of the roads into consideration, we can get from any... | ```python
import sys
from collections import defaultdict
from typing import NamedTuple
class EdgeNode(NamedTuple):
vertex: int
weight: int
class Graph:
def __init__(self, n):
self.graph = d = {i: [] for i in range(n + 1)}
self.distance = [0] * (n + 1)
self.distance[0] = sys.maxsize
self.min_dist = sys.max... | {'test_cases': [{'type': 'stdin_stdout', 'input': '15\n15 6\n2 15\n14 15\n15 12\n1 2\n10 15\n7 4\n13 7\n11 2\n5 2\n7 2\n3 2\n7 8\n9 15\n', 'output': '7\n13\n'}, {'type': 'stdin_stdout', 'input': '2\n1 2\n', 'output': '0\n1\n'}, {'type': 'stdin_stdout', 'input': '12\n10 7\n6 10\n8 10\n4 12\n10 4\n3 12\n1 2\n2 7\n4 5\n11... | {'difficulty': 'MEDIUM_HARD', 'problem_url': 'https://codeforces.com/problemset/problem/219/D', 'time_limit': '3.0 seconds', 'memory_limit': '256.0 megabytes'} | vfc_90520 | PrimeIntellect/verifiable-coding-problems |
apps | verifiable_code | 891 | Solve the following coding problem using the programming language javascript:
There are $n$ chips arranged in a circle, numbered from $1$ to $n$.
Initially each chip has black or white color. Then $k$ iterations occur. During each iteration the chips change their colors according to the following rules. For each chi... | null | {'test_cases': [{'type': 'stdin_stdout', 'input': '6 1\nBWBBWW\n', 'output': 'WBBBWW\n'}, {'type': 'stdin_stdout', 'input': '7 3\nWBWBWBW\n', 'output': 'WWWWWWW\n'}, {'type': 'stdin_stdout', 'input': '6 4\nBWBWBW\n', 'output': 'BWBWBW\n'}, {'type': 'stdin_stdout', 'input': '4 5\nBWBB\n', 'output': 'BBBB\n'}, {'type': '... | {'difficulty': 'interview', 'problem_url': 'https://codeforces.com/problemset/problem/1244/F'} | vfc_13319 | PrimeIntellect/verifiable-coding-problems |
code_contests | verifiable_code | 330_D. Biridian Forest | Solve the following coding problem using the programming language rust:
You're a mikemon breeder currently in the middle of your journey to become a mikemon master. Your current obstacle is go through the infamous Biridian Forest.
The forest
The Biridian Forest is a two-dimensional grid consisting of r rows and c co... | {'test_cases': [{'type': 'stdin_stdout', 'input': '1 4\nSE23\n', 'output': '2'}, {'type': 'stdin_stdout', 'input': '5 7\n000E0T3\nT0TT0T0\n010T0T0\n2T0T0T0\n0T0S000\n', 'output': '3'}, {'type': 'stdin_stdout', 'input': '3 3\n000\nS0E\n000\n', 'output': '0'}, {'type': 'stdin_stdout', 'input': '5 5\nS9999\nTTTT9\n99999\n... | {'difficulty': 10, 'time_limit': {'seconds': 2, 'nanos': 0}, 'memory_limit_bytes': 256000000} | vfc_75999 | PrimeIntellect/verifiable-coding-problems | |
taco | verifiable_code | https://www.codechef.com/problems/COUPON | Solve the following coding problem using the programming language python:
Alice likes to shop online. The main reason is that she gets a lot of discounts! There are M online shops from where she purchases her items. The prices of the same item vary in both the shops. She needs to buy N items in all. And each she can b... | ```python
for i in range(int(input())):
(N, M) = list(map(int, input().split(' ')))
C = [list(map(int, input().split(' '))) for _ in range(N)]
D = [list(map(int, input().split(' '))) for _ in range(N)]
dp = [[0] * M for _ in range(N)]
for j in range(M):
dp[0][j] = C[0][j]
min_value = min(dp[0])
for i in range(... | {'test_cases': [{'type': 'stdin_stdout', 'input': '2\n2 2\n3 4\n1 2\n1 0\n0 1\n2 4\n1 2 3 4\n4 3 2 1\n2 3 2 1\n1 2 1 1', 'output': '3\n2'}], 'language': 'python'} | {'difficulty': 'HARD', 'problem_url': 'https://www.codechef.com/problems/COUPON', 'time_limit': '1 seconds', 'memory_limit': '50000 bytes'} | vfc_87775 | PrimeIntellect/verifiable-coding-problems |
code_contests | verifiable_code | 722_D. Generating Sets | Solve the following coding problem using the programming language javascript:
You are given a set Y of n distinct positive integers y1, y2, ..., yn.
Set X of n distinct positive integers x1, x2, ..., xn is said to generate set Y if one can transform X to Y by applying some number of the following two operation to int... | {'test_cases': [{'type': 'stdin_stdout', 'input': '6\n9 7 13 17 5 11\n', 'output': '1 2 3 4 5 6 \n'}, {'type': 'stdin_stdout', 'input': '5\n1 2 3 4 5\n', 'output': '1 2 3 4 5 \n'}, {'type': 'stdin_stdout', 'input': '6\n15 14 3 13 1 12\n', 'output': '1 3 7 12 13 14 \n'}, {'type': 'stdin_stdout', 'input': '100\n41 173 40... | {'difficulty': 10, 'time_limit': {'seconds': 2, 'nanos': 0}, 'memory_limit_bytes': 256000000} | vfc_49414 | PrimeIntellect/verifiable-coding-problems | |
taco | verifiable_code | https://codeforces.com/problemset/problem/592/B | Solve the following coding problem using the programming language javascript:
Ari the monster always wakes up very early with the first ray of the sun and the first thing she does is feeding her squirrel.
Ari draws a regular convex polygon on the floor and numbers it's vertices 1, 2, ..., n in clockwise order. Then s... | {'test_cases': [{'type': 'stdin_stdout', 'input': '5\n', 'output': '9\n'}, {'type': 'stdin_stdout', 'input': '3\n', 'output': '1\n'}, {'type': 'stdin_stdout', 'input': '54321\n', 'output': '2950553761\n'}, {'type': 'stdin_stdout', 'input': '4\n', 'output': '4\n'}, {'type': 'stdin_stdout', 'input': '6\n', 'output': '16\... | {'difficulty': 'EASY', 'problem_url': 'https://codeforces.com/problemset/problem/592/B', 'time_limit': None, 'memory_limit': None} | vfc_90629 | PrimeIntellect/verifiable-coding-problems | |
apps | verifiable_code | 2579 | Solve the following coding problem using the programming language rust:
Kirill plays a new computer game. He came to the potion store where he can buy any potion. Each potion is characterized by two integers — amount of experience and cost. The efficiency of a potion is the ratio of the amount of experience to the cos... | null | {'test_cases': [{'type': 'stdin_stdout', 'input': '1 10 1 10 1', 'output': 'YES'}, {'type': 'stdin_stdout', 'input': '1 5 6 10 1', 'output': 'NO'}], 'language': 'rust'} | {'difficulty': 'interview', 'problem_url': 'https://codeforces.com/problemset/problem/842/A'} | vfc_20051 | PrimeIntellect/verifiable-coding-problems |
taco | verifiable_code | https://codeforces.com/problemset/problem/483/D | Solve the following coding problem using the programming language cpp:
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≤ li ≤ ri ≤ n) meaning that value <image> should be equal to qi.
Y... | {'test_cases': [{'type': 'stdin_stdout', 'input': '1 2\n1 1 1\n1 1 3\n', 'output': 'NO\n'}, {'type': 'stdin_stdout', 'input': '1 1\n1 1 10\n', 'output': 'YES\n10\n'}, {'type': 'stdin_stdout', 'input': '1 2\n1 1 10\n1 1 5\n', 'output': 'NO\n'}, {'type': 'stdin_stdout', 'input': '3 2\n1 2 536870912\n2 3 536870911\n', 'ou... | {'difficulty': 'MEDIUM_HARD', 'problem_url': 'https://codeforces.com/problemset/problem/483/D', 'time_limit': '1.0 seconds', 'memory_limit': '256.0 megabytes'} | vfc_138525 | PrimeIntellect/verifiable-coding-problems | |
code_contests | verifiable_code | neuronb4 | Solve the following coding problem using the programming language javascript:
Working from left-to-right if no digit is exceeded by the digit to its left it is called an increasing number; for example, 22344. Similarly if no digit is exceeded by the digit to its right it is called a decreasing number; for example, 774... | {'test_cases': [{'type': 'stdin_stdout', 'input': '7\n1\n2\n3\n4\n5\n6\n150', 'output': 'valid\nvalid\nvalid\nvalid\nvalid\nvalid\ninvalid'}, {'type': 'stdin_stdout', 'input': '7\n1\n2\n6\n4\n5\n6\n150', 'output': 'valid\nvalid\nvalid\nvalid\nvalid\nvalid\ninvalid\n'}, {'type': 'stdin_stdout', 'input': '7\n0\n3\n1\n4\n... | {'difficulty': 6, 'time_limit': None, 'memory_limit_bytes': 0} | vfc_75026 | PrimeIntellect/verifiable-coding-problems |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 9