id large_stringlengths 3 7 | incorrect_codes large listlengths 1 223 | correct_code large_stringlengths 145 21.3k | description large_stringlengths 383 5.06k | checker large_stringlengths 484 11.5k | test_cases large listlengths 9 117 | hack_url large_stringlengths 92 96 | validator large_stringlengths 187 3.31k | time_limit int64 500 9k | memory_limit int64 64 1.02k |
|---|---|---|---|---|---|---|---|---|---|
629_C | [
"#include <bits/stdc++.h>\nusing namespace std;\nint m, n, k, bag, q;\nlong long dp[2100][2100];\nchar s[200000];\nconst int p = 1000000007;\nint main() {\n cin >> m >> n;\n k = m - n;\n cin >> s;\n bag = q = 0;\n for (int i = 0; i < n; i++) {\n if (s[i] == '(')\n bag++;\n else\n bag--;\n if... | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 6.66;
const int MAX = 2000 + 200 + 20 + 2;
const long long mod = 1e9 + 7;
long long fact[MAXN];
long long ifact[MAXN];
long long inverse[MAXN];
long long dp[MAX][2 * MAX];
long long bpow(long long base, long long exp) {
long long ans = 1;
for (; e... | As Famil Door’s birthday is coming, some of his friends (like Gabi) decided to buy a present for him. His friends are going to buy a string consisted of round brackets since Famil Door loves string of brackets of length n more than any other strings!
The sequence of round brackets is called valid if and only if:
1... | #include "testlib.h"
using namespace std;
int main(int argc, char *argv[]) {
setName("compare ordered sequences of signed int%d numbers", 8 * int(sizeof(long long)));
registerTestlibCmd(argc, argv);
int n = 0;
string firstElems;
while (!ans.seekEof() && !ouf.seekEof()) {
n+... | [
{
"input": "2 2\n()\n",
"output": "1"
},
{
"input": "2 2\n)(\n",
"output": "0"
},
{
"input": "1000 1000\n(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((... | https://codeforces.com/contest/629/hacks?verdictName=CHALLENGE_SUCCESSFUL&chosenProblemIndex=C | #include "testlib.h"
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char* argv[]) {
registerValidation(argc, argv);
int n = inf.readInt(1, 100000, "n");
inf.readSpace();
int m = inf.readInt(1, n, "m");
inf.readEoln();
ensuref(n - m <= 2000, "n - m must be ≤ 2000, but n=%d, ... | 2,000 | 256 |
39_H | [
"#include <bits/stdc++.h>\nusing namespace std;\nconst int N = 105;\nint k;\nvoid out(int n, int k) {\n if (n == 0) return;\n out(n / k, k);\n cout << n % k;\n}\nint main() {\n cin >> k;\n for (int i = 1; i < k; i++) {\n for (int j = 1; j < k; j++) {\n int num = i * j;\n out(num, k);\n cout <... | #include <bits/stdc++.h>
using namespace std;
void bas(int number, int base) {
int final[99];
double remainder;
int i = 0;
while (number != 0) {
remainder = (number % base);
final[i] = remainder;
i++;
number = number / base;
}
for (i--; i > -1; i--) {
if (final[i] < 10)
cout << fin... | Petya studies positional notations. He has already learned to add and subtract numbers in the systems of notations with different radices and has moved on to a more complicated action — multiplication. To multiply large numbers one has to learn the multiplication table. Unfortunately, in the second grade students learn... | #include "testlib.h"
using namespace std;
int main(int argc, char *argv[]) {
setName("compare sequences of tokens");
registerTestlibCmd(argc, argv);
int n = 0;
string j, p;
while (!ans.seekEof() && !ouf.seekEof()) {
n++;
ans.readWordTo(j);
ouf.readWordTo(p... | [
{
"input": "2\n",
"output": "1\n"
},
{
"input": "3\n",
"output": "1 2\n2 11\n"
},
{
"input": "5\n",
"output": "1 2 3 4\n2 4 11 13\n3 11 14 22\n4 13 22 31\n"
},
{
"input": "7\n",
"output": "1 2 3 4 5 6\n2 4 6 11 13 15\n3 6 12 15 21 24\n4 11 15 22 26 33\n5 13 21 26 34 42\n6... | https://codeforces.com/contest/39/hacks?verdictName=CHALLENGE_SUCCESSFUL&chosenProblemIndex=H | #include "testlib.h"
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char* argv[]) {
registerValidation(argc, argv);
int k = inf.readInt(2, 10, "k");
inf.readEoln();
inf.readEof();
return 0;
}
| 2,000 | 64 |
560_C | [
"#include <bits/stdc++.h>\nusing namespace std;\nint main() {\n int ans = 0;\n int a[10], i, j;\n for (i = 1; i <= 6; i++) scanf(\"%d\", &a[i]);\n int ceng = a[2] + a[3];\n int t = a[1], d = a[1] + 1;\n for (i = 1; i <= ceng; i++) {\n ans += t;\n ans += d;\n if (i < a[2]) {\n if (i < a[6]) {\n ... | #include <bits/stdc++.h>
using namespace std;
int main() {
int a1, a2, a3, a4, a5, a6;
scanf("%d %d %d %d %d %d", &a1, &a2, &a3, &a4, &a5, &a6);
int ans = 0;
int len = a2 + a3;
int shang = a1;
int xia;
for (int i = 1; i <= len; i++) {
if (i <= a6 && i <= a2) {
xia = shang + 1;
ans += shang... | Gerald got a very curious hexagon for his birthday. The boy found out that all the angles of the hexagon are equal to <image>. Then he measured the length of its sides, and found that each of them is equal to an integer number of centimeters. There the properties of the hexagon ended and Gerald decided to draw on it.
... | #include "testlib.h"
using namespace std;
int main(int argc, char *argv[]) {
setName("compare ordered sequences of signed int%d numbers", 8 * int(sizeof(long long)));
registerTestlibCmd(argc, argv);
int n = 0;
string firstElems;
while (!ans.seekEof() && !ouf.seekEof()) {
n+... | [
{
"input": "1 1 1 1 1 1\n",
"output": "6\n"
},
{
"input": "2 2 2 2 2 2\n",
"output": "24\n"
},
{
"input": "2 1 2 1 2 1\n",
"output": "13\n"
},
{
"input": "100 100 100 100 100 100\n",
"output": "60000\n"
},
{
"input": "100 1 100 1 100 1\n",
"output": "10401\n"
... | https://codeforces.com/contest/560/hacks?verdictName=CHALLENGE_SUCCESSFUL&chosenProblemIndex=C | #include "testlib.h"
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char* argv[]) {
registerValidation(argc, argv);
vector<int> a = inf.readInts(6, 1, 1000);
inf.readEoln();
inf.readEof();
int a1 = a[0], a2 = a[1], a3 = a[2], a4 = a[3], a5 = a[4], a6 = a[5];
ensuref(2 * a1 + a2... | 2,000 | 256 |
630_A | [
"#include <bits/stdc++.h>\nusing namespace std;\ntemplate <class c>\nstruct rge {\n c b, e;\n};\ntemplate <class c>\nrge<c> range(c i, c j) {\n return rge<c>{i, j};\n}\ntemplate <class c>\nauto dud(c* x) -> decltype(cerr << *x, 0);\ntemplate <class c>\nchar dud(...);\nstruct debug {\n ~debug() { cerr << endl; }\... | #include <bits/stdc++.h>
void fast();
void file();
void error();
using namespace std;
int main() {
fast();
file();
long long int n;
cin >> n;
cout << 25 << endl;
error();
return 0;
}
void fast() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
void file() {}
void error() {
cerr... | The HR manager was disappointed again. The last applicant failed the interview the same way as 24 previous ones. "Do I give such a hard task?" — the HR manager thought. "Just raise number 5 to the power of n and get last two digits of the number. Yes, of course, n can be rather big, and one cannot find the power using ... | #include "testlib.h"
using namespace std;
int main(int argc, char *argv[]) {
setName("compare ordered sequences of signed int%d numbers", 8 * int(sizeof(long long)));
registerTestlibCmd(argc, argv);
int n = 0;
string firstElems;
while (!ans.seekEof() && !ouf.seekEof()) {
n+... | [
{
"input": "383553517077296575\n",
"output": "25\n"
},
{
"input": "2\n",
"output": "25\n"
},
{
"input": "2000000000000000000\n",
"output": "25\n"
},
{
"input": "3\n",
"output": "25\n"
},
{
"input": "5\n",
"output": "25\n"
},
{
"input": "10\n",
"out... | https://codeforces.com/contest/630/hacks?verdictName=CHALLENGE_SUCCESSFUL&chosenProblemIndex=A | #include "testlib.h"
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char* argv[]) {
registerValidation(argc, argv);
long long n = inf.readLong(2LL, 2000000000000000000LL, "n");
inf.readEoln();
inf.readEof();
return 0;
}
| 500 | 64 |
1419_B | [
"#include <bits/stdc++.h>\nusing namespace std;\nint32_t main() {\n long long t;\n cin >> t;\n while (t--) {\n long long n;\n cin >> n;\n long long ans = 1;\n set<long long> s;\n while (pow(2, ans) * (pow(2, ans) - 1) <= 2 * n) {\n n -= (pow(2, ans) * (pow(2, ans) - 1)) / 2;\n ans++;\n ... | #include <bits/stdc++.h>
using namespace std;
long long min(long long a, long long b) {
if (a < b)
return a;
else
return b;
}
long long max(long long a, long long b) {
if (a < b)
return b;
else
return a;
}
long long min3(long long a, long long b, long long c) {
return min(a, min(b, c));
}
long... | Jett is tired after destroying the town and she wants to have a rest. She likes high places, that's why for having a rest she wants to get high and she decided to craft staircases.
A staircase is a squared figure that consists of square cells. Each staircase consists of an arbitrary number of stairs. If a staircase ha... | #include "testlib.h"
using namespace std;
int main(int argc, char *argv[]) {
setName("compare ordered sequences of signed int%d numbers", 8 * int(sizeof(long long)));
registerTestlibCmd(argc, argv);
int n = 0;
string firstElems;
while (!ans.seekEof() && !ouf.seekEof()) {
n+... | [
{
"input": "1\n77\n",
"output": "3\n"
},
{
"input": "1\n1000000000000000000\n",
"output": "30\n"
},
{
"input": "1\n1\n",
"output": "1\n"
},
{
"input": "1\n383553517077296574\n",
"output": "29\n"
},
{
"input": "1\n2\n",
"output": "1\n"
},
{
"input": "1\... | https://codeforces.com/contest/1419/hacks?verdictName=CHALLENGE_SUCCESSFUL&chosenProblemIndex=B | #include "testlib.h"
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char* argv[]) {
registerValidation(argc, argv);
int t = inf.readInt(1, 1000, "t");
inf.readEoln();
for (int i = 0; i < t; ++i) {
long long x = inf.readLong(1LL, 1000000000000000000LL, "x");
inf.readEoln... | 1,000 | 256 |
1284_C | [
"#include <bits/stdc++.h>\nusing namespace std;\nconst int maxn = 250000;\nint dp[maxn];\nint main() {\n long long n, m;\n scanf(\"%lld %lld\", &n, &m);\n dp[0] = dp[1] = 1;\n for (long long i = 2; i <= n; i++) {\n dp[i] = ((dp[i - 1] % m) * (i % m)) % m;\n }\n long long sum = 0;\n for (long long i = 1; i... | #include <bits/stdc++.h>
using namespace std;
long long mod = 1000000000 + 7;
long long exp(long long x, long long y) {
x %= mod;
long long res = 1;
while (y) {
if (y & 1) res = res * x % mod;
x = x * x % mod;
y >>= 1;
}
return res;
}
long long gcd(long long a, long long b) {
if (b == 0) return ... | Recall that the permutation is an array consisting of n distinct integers from 1 to n in arbitrary order. For example, [2,3,1,5,4] is a permutation, but [1,2,2] is not a permutation (2 appears twice in the array) and [1,3,4] is also not a permutation (n=3 but there is 4 in the array).
A sequence a is a subsegment of a... | #include "testlib.h"
using namespace std;
int main(int argc, char *argv[]) {
setName("compare ordered sequences of signed int%d numbers", 8 * int(sizeof(long long)));
registerTestlibCmd(argc, argv);
int n = 0;
string firstElems;
while (!ans.seekEof() && !ouf.seekEof()) {
n+... | [
{
"input": "1 993244853\n",
"output": "1\n"
},
{
"input": "2 993244853\n",
"output": "6\n"
},
{
"input": "3 993244853\n",
"output": "32\n"
},
{
"input": "5 993244853\n",
"output": "1116\n"
},
{
"input": "10 993244853\n",
"output": "52842240\n"
},
{
"in... | https://codeforces.com/contest/1284/hacks?verdictName=CHALLENGE_SUCCESSFUL&chosenProblemIndex=C | #include "testlib.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
// Modular multiplication
ll mulmod(ll a, ll b, ll mod) {
return (a * b) % mod;
}
// Modular exponentiation
ll powmod(ll a, ll b, ll mod) {
ll res = 1;
a %= mod;
while(b > 0) {
if (b & 1)
res =... | 1,000 | 1,024 |
1220_B | ["#include <bits/stdc++.h>\nusing namespace std;\nint n, a[1010][1010], g, ans[1010], x = 1, b[1010](...TRUNCATED) | "#include <bits/stdc++.h>\n#pragma comment(linker, \"/STACK:2000000\")\n#pragma comment(linker, \"/H(...TRUNCATED) | "Sasha grew up and went to first grade. To celebrate this event her mother bought her a multiplicati(...TRUNCATED) | "#include \"testlib.h\"\n#include <bits/stdc++.h>\nusing namespace std;\n\nint main(int argc, char* (...TRUNCATED) | [{"input":"3\n0 1 1\n1 0 1\n1 1 0\n","output":"1 1 1\n"},{"input":"3\n0 57300 8460\n57300 0 134655\n(...TRUNCATED) | https://codeforces.com/contest/1220/hacks?verdictName=CHALLENGE_SUCCESSFUL&chosenProblemIndex=B | "#include \"testlib.h\"\n#include <bits/stdc++.h>\nusing namespace std;\n\nint main(int argc, char* (...TRUNCATED) | 2,000 | 256 |
233_C | ["#include <bits/stdc++.h>\nusing namespace std;\nint n;\nint mp[110][110];\nint cal(int m) {\n int(...TRUNCATED) | "#include <bits/stdc++.h>\nusing namespace std;\nconst int inf = (1 << 30);\nconst int N = 100005;\n(...TRUNCATED) | "John Doe started thinking about graphs. After some thought he decided that he wants to paint an und(...TRUNCATED) | "#include \"testlib.h\"\n#include <bits/stdc++.h>\nusing namespace std;\n\nint main(int argc, char *(...TRUNCATED) | [{"input":"1\n","output":"100\n011111111111111111111111111111111111111111111111111111111111111111111(...TRUNCATED) | https://codeforces.com/contest/233/hacks?verdictName=CHALLENGE_SUCCESSFUL&chosenProblemIndex=C | "#include \"testlib.h\"\n#include <bits/stdc++.h>\nusing namespace std;\nint main(int argc, char* ar(...TRUNCATED) | 1,000 | 256 |
450_E | ["#include <bits/stdc++.h>\nint n, tot, ans[50010][2], ta, a[100000], totp, p[100010];\nbool bo[1000(...TRUNCATED) | "#include <bits/stdc++.h>\nint n, tot, ans[50010][2], totp, p[100010], tmp[100010];\nbool bo[100010](...TRUNCATED) | "Jzzhu has picked n apples from his big apple tree. All the apples are numbered from 1 to n. Now he (...TRUNCATED) | "#include \"testlib.h\"\n#include <bits/stdc++.h>\nusing namespace std;\n\nstatic long long gcdLL(lo(...TRUNCATED) | [{"input":"1\n","output":"0\n"},{"input":"2\n","output":"0\n"},{"input":"3\n","output":"0\n"},{"inpu(...TRUNCATED) | https://codeforces.com/contest/450/hacks?verdictName=CHALLENGE_SUCCESSFUL&chosenProblemIndex=E | "#include \"testlib.h\"\n#include <bits/stdc++.h>\nusing namespace std;\nint main(int argc, char* ar(...TRUNCATED) | 1,000 | 256 |
44_C | ["#include <bits/stdc++.h>\nint a[110], b[110];\nusing namespace std;\nint main() {\n int n, m;\n (...TRUNCATED) | "#include <bits/stdc++.h>\nclass BIT {\n private:\n int n;\n int *t;\n inline int lowbit(int);\n\(...TRUNCATED) | "School holidays come in Berland. The holidays are going to continue for n days. The students of sch(...TRUNCATED) | "#include \"testlib.h\"\r\n\r\nusing namespace std;\r\n\r\nint main(int argc, char *argv[]) {\r\n (...TRUNCATED) | [{"input":"10 5\n1 2\n3 4\n5 6\n7 8\n9 10\n","output":"OK\n"},{"input":"10 5\n1 2\n3 4\n5 6\n8 8\n9 (...TRUNCATED) | https://codeforces.com/contest/44/hacks?verdictName=CHALLENGE_SUCCESSFUL&chosenProblemIndex=C | "#include \"testlib.h\"\n#include <bits/stdc++.h>\nusing namespace std;\n\nint main(int argc, char* (...TRUNCATED) | 2,000 | 256 |
End of preview. Expand in Data Studio
No dataset card yet
- Downloads last month
- 17