Dataset Viewer
Auto-converted to Parquet Duplicate
problem_id
stringlengths
32
32
name
stringlengths
2
112
problem
stringlengths
200
14k
test_cases
stringlengths
33
79.2M
difficulty
stringclasses
31 values
language
sequencelengths
1
1
source
stringclasses
15 values
num_solutions
int64
1
1.12M
starter_code
stringlengths
0
1.47k
subset
stringclasses
4 values
claude_thinking_trajectory
stringlengths
849
55.4k
claude_attempt
stringlengths
52
24k
domain
stringclasses
1 value
327dbb40ce764338d44efe10a6b74c17
none
Appleman has a tree with *n* vertices. Some of the vertices (at least one) are colored black and other vertices are colored white. Consider a set consisting of *k* (0<=≤<=*k*<=&lt;<=*n*) edges of Appleman's tree. If Appleman deletes these edges from the tree, then it will split into (*k*<=+<=1) parts. Note, that each ...
{"inputs": ["3\n0 0\n0 1 1", "6\n0 1 1 0 4\n1 1 0 0 1 0", "10\n0 1 2 1 4 4 4 0 8\n0 0 0 1 0 1 1 0 0 1", "5\n0 1 1 3\n0 0 0 1 1", "10\n0 1 1 2 4 3 3 3 2\n1 0 1 1 1 0 0 1 1 0", "100\n0 0 2 2 0 3 5 0 6 2 0 4 0 2 3 7 8 3 15 19 13 8 18 19 3 14 23 9 6 3 6 17 26 24 20 6 4 27 8 5 14 5 35 31 27 3 41 25 20 14 25 31 49 40 0 1 10 ...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
6
MatrixStudio/Codeforces-Python-Submissions
Let me understand the problem: 1. We have a tree with n vertices. 2. Some vertices (at least one) are colored black, and the rest are white. 3. Appleman can delete a set of edges (between 0 and k edges, where k <= n), which will split the tree into k+1 parts. Each part is a subtree with some vertices. 4. Appleman want...
```python def count_ways_to_split_tree(n, parents, colors): # Build the adjacency list representation of the tree tree = [[] for _ in range(n)] for i in range(1, n): tree[parents[i-1]].append(i) tree[i].append(parents[i-1]) # Count the number of black vertices in each subtree su...
code
f6752849cc4f9a7ea143dacb83d43a9d
UNKNOWN
You have a digit sequence S of length 4. You are wondering which of the following formats S is in: - YYMM format: the last two digits of the year and the two-digit representation of the month (example: 01 for January), concatenated in this order - MMYY format: the two-digit representation of the month and the last tw...
{"inputs": ["1905\n", "0112\n", "1700\n", "0101\n", "1312\n", "0348\n", "9999\n", "0001\n", "0000\n", "0100\n"], "outputs": ["YYMM\n", "AMBIGUOUS\n", "NA\n", "AMBIGUOUS\n", "YYMM\n", "MMYY\n", "NA\n", "YYMM\n", "NA\n", "MMYY\n"]}
INTRODUCTORY
[ "PYTHON3" ]
ATCODER.JP
30,485
codeparrot/apps
Let's break down the problem: 1. I'm given a 4-digit sequence S. 2. I need to determine if S follows YYMM format, MMYY format, both, or neither. 3. YYMM format: last two digits of the year followed by two-digit representation of the month. 4. MMYY format: two-digit representation of the month followed by the last two ...
```python def determine_date_format(s): # Check YYMM format month_yymm = int(s[2:]) is_valid_yymm = 1 <= month_yymm <= 12 # Check MMYY format month_mmyy = int(s[:2]) is_valid_mmyy = 1 <= month_mmyy <= 12 if is_valid_yymm and is_valid_mmyy: return "AMBIGUOUS" elif is_val...
code
3a21948de11a6c029b2327d087639bfc
1219_H. Function Composition
We are definitely not going to bother you with another generic story when Alice finds about an array or when Alice and Bob play some stupid game. This time you'll get a simple, plain text. First, let us define several things. We define function F on the array A such that F(i, 1) = A[i] and F(i, m) = A[F(i, m - 1)] for...
{"inputs": ["10\n2 3 1 5 6 4 2 10 7 7\n5\n10 1\n5 7\n10 6\n1 1\n10 8\n", "10\n2 3 1 5 6 4 2 10 7 7\n5\n10 1\n5 7\n19 6\n1 1\n10 8\n", "10\n2 3 1 5 6 4 1 10 7 7\n5\n10 1\n5 7\n19 6\n1 1\n10 8\n", "10\n2 3 1 5 6 4 2 10 7 7\n5\n10 1\n5 7\n10 6\n1 2\n10 8\n", "10\n1 3 1 5 6 4 1 10 7 7\n5\n10 1\n5 7\n19 6\n1 1\n10 8\n", "10...
14
[ "PYTHON3" ]
2
2
deepmind/code_contests
Alright, let me break down the problem: 1. We have an array A of non-negative integers. 2. We're given a function F such that F(i, 1) = A[i] and F(i, m) = A[F(i, m - 1)] for m > 1. 3. We have Q queries, each with values m and y. 4. For each query, we need to count how many values of x exist such that F(x, m) = y. Bef...
```python def solve_queries(): N = int(input()) A = list(map(int, input().split())) Q = int(input()) # Precompute F(x, 2^j) for all x and j using binary lifting # dp[x][j] = F(x, 2^j) dp = [[0] * 61 for _ in range(N + 1)] # Base case: F(x, 2^0 = 1) for x in range(1, N + 1): ...
code
e81bb21f59b3824a893281eef5c96d56
UNKNOWN
Given are three positive integers A, B, and C. Compute the following value modulo 998244353: \sum_{a=1}^{A} \sum_{b=1}^{B} \sum_{c=1}^{C} abc -----Constraints----- - 1 \leq A, B, C \leq 10^9 -----Input----- Input is given from standard input in the following format: A B C -----Output----- Print the value modulo 998...
{"inputs": ["1 2 3\n", "1000000000 987654321 123456789\n", "192279221 156648747 154396385\n", "264704198 120999147 136987925\n", "682152024 451794315 2028038\n", "693 299 737\n", "198 235 277\n", "88 395 518\n"], "outputs": ["18\n", "951633476\n", "152138957\n", "24444247\n", "579633067\n", "373149185\n", "518269127\n"...
INTERVIEW
[ "PYTHON3" ]
ATCODER.JP
19,463
codeparrot/apps
Alright, let's understand this problem: We're asked to compute: \sum_{a=1}^{A} \sum_{b=1}^{B} \sum_{c=1}^{C} abc This is a triple summation where we're summing the product abc for a ranging from 1 to A, b ranging from 1 to B, and c ranging from 1 to C. Then, we're asked to compute this value modulo 998244353. Let's ...
```python def sum_abc(): A, B, C = map(int, input().split()) mod = 998244353 # Calculate A(A+1)/2, B(B+1)/2, and C(C+1)/2 with modular arithmetic a_term = (A % mod) * ((A + 1) % mod) % mod b_term = (B % mod) * ((B + 1) % mod) % mod c_term = (C % mod) * ((C + 1) % mod) % mod # Calcu...
code
df4270a084d723930aeb97b4ceadbb5e
UNKNOWN
Due to the rise of covid-19 cases in India, this year BCCI decided to organize knock-out matches in IPL rather than a league. Today is matchday 1 and it is between previous year winners Mumbai Indians and the city of Joy - Kolkata Knight Riders. Eoin Morgan the new captain of the team KKR, thinks that death overs are ...
{"inputs": ["A = (3, 2)\r\nB = (3, 4)\r\nc = (2, 2)"], "outputs": ["2.000000 0.000000"]}
MEDIUM
[ "PYTHON3" ]
PRACTICE.GEEKSFORGEEKS.ORG
1,383
#User function Template for python3 class Solution: def findPoint(self, A, B, C): # code here
BAAI/TACO
Alright, let's break down this problem: 1. We have three 2D points: A, B, and C. 2. We need to find the fourth point D such that ABCD forms a parallelogram. 3. If there are multiple possible D, we choose the lexicographically smallest one. A parallelogram has opposite sides parallel and equal. So, if A, B, C are thre...
```python class Solution: def findPoint(self, A, B, C): # Calculate potential fourth points for different arrangements # If A and B are adjacent, and C is diagonally opposite to D D1 = [A[0] + B[0] - C[0], A[1] + B[1] - C[1]] # If A and C are adjacent, and B is diagonally op...
code
6d991d91b9a0f0d855afa3b07325e28d
UNKNOWN
Given a set of numbers from 1 to N, each number is exactly present twice so there are N pairs. In the worst-case scenario, how many numbers X should be picked and removed from the set until we find a matching pair? Example 1: Input: N = 1 Output: 2 Explanation: When N=1 Then there is one pair and a matching pair can ...
{"inputs": ["N = 1", "N = 2"], "outputs": ["2", "3"]}
EASY
[ "PYTHON3" ]
PRACTICE.GEEKSFORGEEKS.ORG
1,095
class Solution: def find (self, N): # code here
BAAI/TACO
Let's analyze this problem. We have a set of numbers from 1 to N, and each number is present exactly twice. We want to find how many numbers we need to draw to ensure that we find a matching pair in the worst-case scenario. Let's think about this step by step: 1. In the worst-case scenario, we would pick as many dist...
# Python Function to Find Matching Pairs ```python def find(N): """ Function to find the minimum number of elements that must be picked in the worst case to guarantee finding a matching pair. Args: N: The number of distinct values, each present exactly twice in the set Returns...
code
40b1cc500e15e52e889b59f7c4f3f901
p01081 Char Swap
"Problem\n\nGiven a string S of even length.\nYou can swap two adjacent characters in the string S a(...TRUNCATED)
"{\"inputs\": [\"acca\", \"acpcacpc\", \"aizu\", \"acccacpp\", \"bizu\", \"acpcaccp\", \"ffxx\", \"a(...TRUNCATED)
0
[ "PYTHON3" ]
6
2
deepmind/code_contests
"Let's think through this problem:\n\n1. We have a string S of even length.\n2. We can swap adjacent(...TRUNCATED)
"```python\ndef min_swaps_to_palindrome(s):\n # Convert the string to a list to make it mutable\n(...TRUNCATED)
code
19e71731c9c9c5d3ae60181f82637952
UNKNOWN
"Given a number `n` we will define its scORe to be `0 | 1 | 2 | 3 | ... | n`, where `|` is the [bitw(...TRUNCATED)
"{\"fn_name\": \"score\", \"inputs\": [[0], [1], [49], [1000000], [10000000], [1000000000000000000]](...TRUNCATED)
INTRODUCTORY
[ "PYTHON3" ]
CODEWARS
744
def score(n):
codeparrot/apps
"The problem is asking me to implement a function that calculates the \"scORe\" of a number `n`. The(...TRUNCATED)
"Looking at this problem, I need to calculate the bitwise OR (|) of all integers from 0 to n inclusi(...TRUNCATED)
code
97f69f6137f46480c6d6cc2922964b27
UNKNOWN
"You are given an array $a$ consisting of $n$ positive integers. You have to choose a positive integ(...TRUNCATED)
"{\"inputs\": [\"5\\n5\\n1 2 3 4 5\\n3\\n10 5 15\\n3\\n100 10 200\\n10\\n9 8 2 6 6 2 8 6 5 4\\n2\\n1(...TRUNCATED)
EASY
[ "PYTHON3" ]
CODEFORCES
136,375
BAAI/TACO
"Let's think about this problem step by step.\n\nWe have an array of integers $a$, and we need to fi(...TRUNCATED)
"Looking at the problem, I need to find a value of `d` that creates a beautiful coloring where no ad(...TRUNCATED)
code
37dd0169be86cbd46d6b0f42ab3d65d6
1097_C. Yuhao and a Parenthesis
"One day, Yuhao came across a problem about checking if some bracket sequences are correct bracket s(...TRUNCATED)
"{\"inputs\": [\"7\\n)())\\n)\\n((\\n((\\n(\\n)\\n)\\n\", \"2\\n(())\\n()\\n\", \"4\\n(\\n((\\n(((\\(...TRUNCATED)
9
[ "PYTHON3" ]
2
2
deepmind/code_contests
"Let's understand the problem better:\n\n1. We have n bracket sequences.\n2. We need to form as many(...TRUNCATED)
"Looking at this problem, I need to:\n1. Find the maximum number of ordered pairs of bracket sequenc(...TRUNCATED)
code
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
31