Dataset Viewer
prob_zh
stringlengths 355
2.71k
| prob_en
stringlengths 657
4.4k
| prob_level
stringclasses 6
values | algorithm_tag_zh
stringlengths 2
19
| algorithm_tag_en
stringlengths 2
45
| canonical_solution
stringlengths 361
6.29k
| test_case
listlengths 2
140
| pseudo_code
stringlengths 260
3.19k
| buggy_code
stringlengths 361
6.26k
| corrupted_code
stringlengths 427
6.74k
| id
stringlengths 3
3
|
---|---|---|---|---|---|---|---|---|---|---|
"### 【题目描述】\n\n在江南织造府的百年传承中,汇聚了 $n$ 件参赛绣品。(...TRUNCATED) | "### [Problem Description]\n\nGiven a complete graph with $n$ nodes, there is only one bidirectional(...TRUNCATED) | div2 | 树状数组 | Tree DP, Greedy | "#include<iostream>\n#include<vector>\nconst int maxn = 200001;\nstd::vector<int> G[maxn];\nlong lon(...TRUNCATED) | [{"input":"12 5 9\n12 9\n2 3\n4 3\n3 5\n1 2\n11 9\n7 8\n7 2\n7 10\n9 2\n1 6","output":"67"},{"input"(...TRUNCATED) | "```\n\n\n\n\n\n\nfunction main():\n read n, a, b\n build adjacency list for the tree from n-1(...TRUNCATED) | "#include<iostream>\n#include<vector>\nconst int maxn = 200001;\nstd::vector<int> G[maxn];\nlong lon(...TRUNCATED) | "#include<iostream>\n#include<vector>\nconst int maxn = 200001;\nstd::vector<int> G[maxn];\nlong lon(...TRUNCATED) | 000 |
"### 【题目描述】\n\n由于英文单词长短不一,对一篇文章进行排版的时候,(...TRUNCATED) | "### [Problem Description]\n\nSince English words vary in length, when typesetting an article, how t(...TRUNCATED) | div2 | DP,斜率优化 | DP, Convex Hull Optimization | "#include<iostream>\nconst int maxn = 2000005;\nlong long s[maxn];\nlong long f[maxn];\nlong long x[(...TRUNCATED) | [{"input":"11 574\n49 37 90 12 24 35 86 39 20 27 86","output":"4761"},{"input":"21 607\n61 70 47 54 (...TRUNCATED) | "```\n\n\n\n\n\n\nfunction main:\n read n, a\n read list of integers w_1 to w_n\n compute p(...TRUNCATED) | "#include<iostream>\nconst int maxn = 2000005;\nlong long s[maxn];\nlong long f[maxn];\nlong long x[(...TRUNCATED) | "#include<iostream>\n//There is one line of the code missing. \nlong long s[maxn];\nlong long f[max(...TRUNCATED) | 001 |
"### 【题目描述】\n\n小爱不断地以 $1/2$ 的概率随机生成 `0` 或 `1`,直到生成(...TRUNCATED) | "### [Problem Description]\n\nRoman continuous to generate `0` or `1` randomly with a probability of(...TRUNCATED) | div1 | 字符串,同余 | String, Congruence | "#include<iostream>\n#include<string>\nusing namespace std;\nconst int maxn = 500001;\nint s[maxn], (...TRUNCATED) | [{"input":"20\n00001010110101000010","output":"1048642"},{"input":"20\n10111011010111011101","output(...TRUNCATED) | "```\n\n\n\n\n\n\nfunction main:\n n = input integer\n p = input string\n s = array where e(...TRUNCATED) | "#include<iostream>\n#include<string>\nusing namespace std;\nconst int maxn = 500001;\nint s[maxn], (...TRUNCATED) | "#include<iostream>\n#include<string>\nusing namespace std;\nconst int maxn = 500001;\n//There is on(...TRUNCATED) | 002 |
"### 【题目描述】\n\n现有由 $n$ 块小积木拼成的一个长条积木,从左到右的(...TRUNCATED) | "### [Problem Description]\n\nThere is a long block made up of $n$ small blocks. The blocks are numb(...TRUNCATED) | div2 | 莫队 | Mo's Algorithm | "#include <stdio.h>\n#include <string.h>\n\n#include <algorithm>\n\n#define LOG(FMT...) fprintf(stde(...TRUNCATED) | [{"input":"100 23\n9 3 7 7 9 2 8 6 6 3 7 1 5 2 5 10 7 1 8 8 10 7 4 9 4 9 6 4 10 6 8 3 5 10 1 8 8 3 2(...TRUNCATED) | "```\n\n\n\n\n\n\nfunction main:\n n, q = read integers\n a = read list of n integers\n com(...TRUNCATED) | "#include <stdio.h>\n#include <string.h>\n\n#include <algorithm>\n\n#define LOG(FMT...) fprintf(stde(...TRUNCATED) | "#include <stdio.h>\n#include <string.h>\n#include <algorithm>\n#define LOG(FMT...) fprintf(stderr, (...TRUNCATED) | 003 |
"### 【题目描述】\n\n小爱是一位粉刷匠,她现在需要粉刷一块包含 $n\\times m$(...TRUNCATED) | "### [Problem Description]\n\nRoman is a painter who needs to paint a wall containing $n\\times m$ s(...TRUNCATED) | div1 | 综合 | Comprehensive | "#include<bits/stdc++.h>\n#define N 3005\nusing namespace std;\nint a[N][N],A[N],B[N],b[N][N],v[2][N(...TRUNCATED) | [{"input":"1 3\nBBB","output":"1"},{"input":"2 2\nRB\nRB","output":"2"},{"input":"4 4\nBRRB\nRBBR\nR(...TRUNCATED) | "```\n\n\n\n\n\n\nfunction check():\n for each row i in 1..n:\n A[i] = sum of (1 if a[i][j(...TRUNCATED) | "#include<bits/stdc++.h>\n#define N 3005\nusing namespace std;\nint a[N][N],A[N],B[N],b[N][N],v[2][N(...TRUNCATED) | "#include<bits/stdc++.h>\n#define N 3005\n//There is one line of the code missing. \nint a[N][N],A[(...TRUNCATED) | 004 |
"###\n\n### 【题目描述】\n\n设 $A=\\{1,2,\\cdots,n\\}$,给定 $m$ 个非空集合 $S_1, S_2(...TRUNCATED) | "### [Problem Description] \n\nLet $A=\\{1,2,\\cdots,n\\}$. Given $m$ non-empty sets $S_1, S_2, \\cd(...TRUNCATED) | div2 | DP | DP | "#include<iostream>\n\nconst int maxn = 22;\nint f[1 << maxn]; // sos-dp input\nint g[maxn+1][1<<max(...TRUNCATED) | [{"input":"6 437\n3\n2 4 5\n1\n1\n4\n2 3 4 6\n3\n1 3 5\n6\n1 2 3 4 5 6\n2\n5 6\n1\n1\n6\n1 2 3 4 5 6(...TRUNCATED) | "```\n\n\n\n\n\n\nfunction main:\n read n, m\n f = array of size 2^n initialized to 0\n\n f(...TRUNCATED) | "#include<iostream>\n\nconst int maxn = 22;\nint f[1 << maxn]; // sos-dp input\nint g[maxn+1][1<<max(...TRUNCATED) | "#include<iostream>\nconst int maxn = 22;\nint f[1 << maxn]; \n//There is one line of the code missi(...TRUNCATED) | 005 |
"### 【题目描述】\n\n有一个 $n$ 行、$m$ 列 的方格,每个格子上可以写 $0$ 或 (...TRUNCATED) | "### [Problem Description]\n\nThere is a grid with $n$ rows and $m$ columns, where each cell can con(...TRUNCATED) | div2 | 线段树 | Segment Tree | "#include<bits/stdc++.h>\nusing namespace std;\ntypedef long long ll;\nstruct XY{\n int x, y1, y2(...TRUNCATED) | [{"input":"3525017 2779118 100000\n418214 2219681 2970360 2624851\n431017 1253973 884795 1519178\n95(...TRUNCATED) | "```\n\n\n\n\n\nplaintext\nfunction main:\n read n, m, k\n events = empty list\n setys = {1(...TRUNCATED) | "#include<bits/stdc++.h>\nusing namespace std;\ntypedef long long ll;\nstruct XY{\n int x, y1, y2(...TRUNCATED) | "#include<bits/stdc++.h>\nusing namespace std;\ntypedef long long ll;\nstruct XY{\n int x, y1, y2(...TRUNCATED) | 006 |
"### 【题目描述】\n\n在一条大街上,开了 $n$ 家商店,我们需要从这些商店(...TRUNCATED) | "### [Problem Description]\n\nThere are $n$ shops on a street. We need to select some shops to insta(...TRUNCATED) | div1 | DP,优化 | DP, Optimization | "#include<bits/stdc++.h>\nusing namespace std;\nlong long f[5000+5][5000+5],c[5000+5],q[5000+5][5000(...TRUNCATED) | [{"input":"13 4\n7 18 11 14 16 20 12 2 15 18 19 12 16","output":"69"},{"input":"12 3\n20 14 5 13 20 (...TRUNCATED) | "```\n\n\n\n\n\nplaintext\nfunction main:\n read n, k\n read c as list (1-based)\n initiali(...TRUNCATED) | "#include<bits/stdc++.h>\nusing namespace std;\nlong long f[5000+5][5000+5],c[5000+5],q[5000+5][5000(...TRUNCATED) | "#include<bits/stdc++.h>\nusing namespace std;\n//There is one line of the code missing. \nint main(...TRUNCATED) | 007 |
"### 【题目描述】\n\n所谓随机游走,是指从一个指定的起点出发,随机地((...TRUNCATED) | "### [Problem Description]\n\nRandom walk refers to a process of starting from a specified point and(...TRUNCATED) | div2 | 期望,逆元 | Expectation, Inverse | "#include<iostream>\nlong long exgcd(int a, int b, long long &x)\n{\n if (b == 0) {\n x = 1;\n (...TRUNCATED) | [{"input":"200\n1 1 2 3 5 3 6 1 8 10 7 8 3 6 12 6 13 16 10 5 5 9 1 12 16 17 6 15 11 24 31 25 10 1 26(...TRUNCATED) | "```\n\n\n\n\n\npython\nfunction main()\n n = read integer\n p = list of (n-1) integers (paren(...TRUNCATED) | "#include<iostream>\nint main()\n{\n int n;\n std::cin >> n;\n const int maxn = 100000;\n int p[(...TRUNCATED) | "#include<iostream>\nlong long exgcd(int a, int b, long long &x)\n//There is one line of the code mi(...TRUNCATED) | 008 |
"### 【题目描述】\n\n有一间房间的地板可以分成 $n\\times m$ 个方块,需要使(...TRUNCATED) | "### [Problem Description]\n\nThere is a room whose floor can be divided into $n\\times m$ squares. (...TRUNCATED) | div1 | 轮廓线 | Contour Line | "#include<iostream>\nusing namespace std;\nconst int mod = 1e9 + 7;\nconst int maxn = 20;\nint f[2][(...TRUNCATED) | [{"input":"2 6","output":"53"},{"input":"4 6","output":"15171"},{"input":"6 6","output":"5350806"},{(...TRUNCATED) | "```\n\n\n\n\n\n\nfunction main():\n read n and m\n mod = 1e9 + 7\n full = 1 << (m + 1)\n (...TRUNCATED) | "#include<iostream>\nusing namespace std;\nconst int mod = 1e9 + 7;\nconst int maxn = 20;\nint f[2][(...TRUNCATED) | "#include<iostream>\nusing namespace std;\nconst int mod = 1e9 + 7;\nconst int maxn = 20;\n//There i(...TRUNCATED) | 009 |
End of preview. Expand
in Data Studio
OIBench Dataset
Dataset Overview
The OIBench Dataset contains algorithm problem statements, solutions, and associated metadata such as test cases, pseudo code, and difficulty levels. The dataset has been processed and stored in Parquet format for efficient access and analysis.
Dataset Structure
The dataset includes the following fields:
id
: Problem ID (e.g.,000
,001
, ...,249
)prob_zh
: Problem description in Chineseprob_en
: Problem description in Englishalgorithm_tag_zh
: Algorithm tags in Chinesealgorithm_tag_en
: Algorithm tags in Englishlevel_zh
: Problem difficulty in Chineselevel_en
: Problem difficulty in Englishcanonical_solution
: Official solution code in C++test_case
: List of test cases, each containinginput
andoutput
.- Each test case is structured as a list of objects containing:
input
: The input for the test caseoutput
: The output for the test case
- Each test case is structured as a list of objects containing:
pseudo_code
: Pseudo code for the algorithmbuggy_code
: Buggy code for the problemcorrupted_code
: Incomplete code for the problem
Usage
You can load the dataset in your Python code using the following example:
from datasets import load_dataset
dataset = load_dataset("your-username/your-dataset-name")
print(dataset)
- Downloads last month
- 4