Dataset Viewer
Auto-converted to Parquet Duplicate
inst_id
stringclasses
1k values
prog_id
int64
0
5.97k
⌀
idx
int64
0
460
code
stringlengths
72
101k
is_reference
stringclasses
2 values
exec
dict
ontology_label
dict
1000_A
null
10
#include <bits/stdc++.h> using namespace std; char buf[25]; const int maxn = 110; string a[maxn], b[maxn]; int n, ans; int read() { int x = 0, f = 0; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = 1; ch = getchar(); } while (ch >= '0' && ch <= '9') { x = (x << 1) + (x << 3)...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 53.4212589263916, "time_ms_p95": 67.73724555969238, "memory_mb_max": 1.47265625 }
{ "paradigm": [ "greedy" ], "technique": [ "two_pointers" ], "data_structures": [ "vector" ], "notes": "The solution sorts both lists and uses two pointers to find the maximum number of matching T-shirts, then subtracts this from n to find the minimum changes." }
1000_A
31
11
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; long long int n; cin >> n; string s; map<string, int> mp; mp["M"] = 0; mp["L"] = 0; mp["S"] = 0; mp["XS"] = 0; mp["XXS"] = 0; mp["XXXS"] = 0; mp["XL"] = 0; mp["XXL"] = 0; ...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 66.53881072998047, "time_ms_p95": 76.7587661743164, "memory_mb_max": 1.546875 }
{ "paradigm": [ "greedy" ], "technique": [], "data_structures": [ "map" ], "notes": "The solution counts the frequency of each T-shirt size and greedily sums the positive differences between the target and source counts." }
1000_A
53
19
#include <bits/stdc++.h> using namespace std; int main() { map<string, int> mp; int n; cin >> n; for (int i = 0; i < n; ++i) { string buf; cin >> buf; mp[buf]++; } int ans = 0; for (int i = 0; i < n; ++i) { string buf; cin >> buf; if (mp[buf]) { mp[buf]--; } else an...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 70.00064849853516, "time_ms_p95": 81.0211181640625, "memory_mb_max": 1.48828125 }
{ "paradigm": [ "greedy" ], "technique": [], "data_structures": [ "map", "vector" ], "notes": "The solution uses a greedy approach by matching identical strings first and counting the remaining mismatches." }
1000_A
null
21
#include <bits/stdc++.h> using namespace std; vector<string> g, g1; bool used[1000]; int main() { int n, kol = 0; cin >> n; for (int i = 0; i < n; i++) { string s; cin >> s; g.push_back(s); } for (int i = 0; i < n; i++) { string s; cin >> s; g1.push_back(s); } for (int i = 0; i < g...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 52.41894721984863, "time_ms_p95": 63.339376449584954, "memory_mb_max": 1.26953125 }
{ "paradigm": [ "greedy" ], "technique": [], "data_structures": [ "vector" ], "notes": "The solution greedily matches identical strings first, then matches remaining strings of the same length to calculate the minimum edit distance." }
1000_A
null
46
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long int t, n, q, i, j, k, x = 0, y, z; map<string, long long int> m; map<string, long long int>::iterator it; cin >> n; string st; for (i = 0; i < n; i++) { cin >> st; m[st]+...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 51.88131332397461, "time_ms_p95": 59.0695858001709, "memory_mb_max": 1.41015625 }
{ "paradigm": [ "greedy" ], "technique": [], "data_structures": [ "map" ], "notes": "The solution counts the net difference in string frequencies using a map, which is sufficient because the problem guarantees a valid transformation exists." }
1000_A
152
47
#include <bits/stdc++.h> using namespace std; int main() { long long int n; cin >> n; vector<string> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } int ans = 0; for (int i = 0; i < n; i++) { string p; int fl = 0; cin >> p; for (int j = 0; j < n; j++) { int b = 0; for (i...
a
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 70.15490531921387, "time_ms_p95": 80.56161403656006, "memory_mb_max": 1.484375 }
null
1000_A
167
51
#include <bits/stdc++.h> using namespace std; const int inf = INT_MAX; const long long int infl = LLONG_MAX; int main() { int n, i; cin >> n; std::vector<string> a, b; string s; std::map<string, int> m1; std::map<string, int> m2; std::map<string, int>::iterator it; std::map<string, int>::iterator itr; ...
b
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 78.32479476928711, "time_ms_p95": 84.02574062347412, "memory_mb_max": 1.48828125 }
null
1000_A
199
58
#include <bits/stdc++.h> using namespace std; map<string, int> ma; int main() { int n; cin >> n; for (int d = -1; d <= 1; d += 2) { for (int i = 0; i < n; ++i) { string s; cin >> s; ma[s] += d; } } int ans = 0; for (auto e : ma) ans += abs(e.second); printf("%d\n", ans / 2); }
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 77.28242874145508, "time_ms_p95": 80.39729595184326, "memory_mb_max": 0.71875 }
{ "paradigm": [ "greedy" ], "technique": [], "data_structures": [ "map" ], "notes": "The solution uses a frequency map to count net differences between the two lists and sums the absolute values to find the minimum changes." }
1000_A
null
70
#include <bits/stdc++.h> using namespace std; using ll = int64_t; using ld = long double; using ul = uint64_t; using vi = vector<int>; using vl = vector<ll>; using vvi = vector<vi>; using vvl = vector<vl>; using pi = pair<int, int>; using pl = pair<ll, ll>; using vpi = vector<pi>; static constexpr int inf = (int)1e9 + ...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 54.56113815307617, "time_ms_p95": 61.347198486328125, "memory_mb_max": 1.26953125 }
{ "paradigm": [ "greedy" ], "technique": [], "data_structures": [ "vector", "map" ], "notes": "The solution sorts the lists by length and greedily matches strings, calculating the edit distance based on size differences and character mismatches." }
1000_A
null
83
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; map<string, int> a, b; for (int i = 0; i < n; ++i) { string tmp; cin >> tmp; ++a[tmp]; } for (int i = 0; i < n; ++i) { string tmp; cin >> tmp; ++b[tmp]; } int cs; cs = max(abs(a["S"] - b["S"]), abs(a["M...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 59.28635597229004, "time_ms_p95": 61.767578125, "memory_mb_max": 1.6015625 }
{ "paradigm": [ "greedy" ], "technique": [], "data_structures": [ "map" ], "notes": "The solution uses a greedy approach by counting occurrences of each T-shirt size and calculating the minimum changes required for each size category." }
1000_A
299
86
#include <bits/stdc++.h> using namespace std; int getCount(string a, string b) { int c = 0; for (int i = 0; i < a.size(); i++) if (a[i] != b[i]) c++; return c; } int Ans(vector<string>& a, vector<string>& b) { int ans = 0; map<string, int> mp; for (int i = 0; i < a.size(); i++) mp[a[i]]++; vector<stri...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 75.87456703186035, "time_ms_p95": 82.57884979248047, "memory_mb_max": 1.48828125 }
{ "paradigm": [ "greedy" ], "technique": [], "data_structures": [ "vector", "map" ], "notes": "The solution uses a greedy approach to match remaining strings by minimizing the character difference count for strings of equal length." }
1000_A
311
89
#include <bits/stdc++.h> int main() { int n, l, temp, step, c = 0, c1 = 0, c2 = 0, c3 = 0, c4 = 0, c5 = 0, c6 = 0, c7 = 0, c8 = 0, c9 = 0, c10 = 0, c11 = 0, c12 = 0, c13 = 0, c14 = 0, c15 = 0, c16 = 0, c17 = 0, c18 = 0; scanf("%d", &n); int a[n], b[n], i, j, p = 0, ...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 75.18863677978516, "time_ms_p95": 78.59482765197754, "memory_mb_max": 1.484375 }
{ "paradigm": [ "greedy" ], "technique": [], "data_structures": [ "array" ], "notes": "The solution counts occurrences of each T-shirt size and greedily calculates the difference for each type to find the minimum changes required." }
1000_A
null
97
#include <bits/stdc++.h> using namespace std; bool compare(string a, string b) { if (a.size() == b.size()) { return a < b; } return a.size() < b.size(); } int main() { int n; cin >> n; vector<string> prev(n); for (int i = 0; i < n; i++) { cin >> prev[i]; } vector<string> cur(n); for (int i =...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 53.25794219970703, "time_ms_p95": 61.28883361816406, "memory_mb_max": 0.73828125 }
{ "paradigm": [ "greedy" ], "technique": [], "data_structures": [ "vector" ], "notes": "The solution greedily matches identical strings and then sorts the remaining strings by length and lexicographical order to count the necessary character replacements." }
1000_A
368
98
#include <bits/stdc++.h> using namespace std; map<string, int> mapi; string s; int main() { std::ios::sync_with_stdio(false); int n; cin >> n; int i; for (i = 0; i < n; i++) { cin >> s; mapi[s]++; } for (i = 0; i < n; i++) { cin >> s; mapi[s]--; } map<string, int>::iterator it; int a...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 67.98601150512695, "time_ms_p95": 74.64146614074707, "memory_mb_max": 1.546875 }
{ "paradigm": [ "greedy" ], "technique": [], "data_structures": [ "map" ], "notes": "The problem asks for the minimum changes to transform one multiset of strings into another, which is solved by counting the net surplus of strings in the first list." }
1000_A
427
114
#include <bits/stdc++.h> using namespace std; int c(char *a) { int i, count; count = 0; for (i = 0; a[i] != '\0'; i++) { if (a[i] == 'X') count++; else break; } return count; } int main() { int n; cin >> n; char a[5]; int f1[4][3], f2[4][3], i; for (i = 0; i < 4; i++) f1[i][0] = ...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 51.804542541503906, "time_ms_p95": 61.541199684143066, "memory_mb_max": 0.9609375 }
{ "paradigm": [ "greedy" ], "technique": [], "data_structures": [ "matrix_2d" ], "notes": "The solution counts occurrences of each T-shirt size category and greedily matches identical sizes, leaving the remainder to be transformed." }
1000_A
474
124
#include <bits/stdc++.h> using namespace std; int vis[101]; string a[101], b[101]; int main() { int n; while (cin >> n) { memset(vis, 0, sizeof(vis)); for (int i = 0; i < n; ++i) { cin >> a[i]; } for (int i = 0; i < n; ++i) { cin >> b[i]; } int ans = 0; for (int i = 0; i < n;...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 79.32615280151367, "time_ms_p95": 130.79402446746826, "memory_mb_max": 0.76953125 }
{ "paradigm": [ "greedy" ], "technique": [], "data_structures": [ "array" ], "notes": "The solution greedily matches identical strings to minimize changes, then calculates the remaining unmatched count." }
1000_A
476
126
#include <bits/stdc++.h> using namespace std; long long junger = 0, mid = 0, top = 0, bot = 0, result = 0, sum = 0, s = 0, t = 0, d = 0, l = 0, sp = 0, k = 0, x, y, n, m, test, r; bool kt = false, t1 = false, t2 = false; string s1, s2; long long a[200050]; int main() { std::ios::sync_with_stdio(false); wh...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 133.0106258392334, "time_ms_p95": 151.07173919677734, "memory_mb_max": 1.546875 }
{ "paradigm": [ "greedy" ], "technique": [], "data_structures": [ "matrix_2d" ], "notes": "The solution counts occurrences of each T-shirt type and greedily calculates the minimum changes needed by summing absolute differences." }
1000_A
null
133
#include <bits/stdc++.h> using namespace std; bool compare(const string &a, const string &b) { if (a.length() != b.length()) { return a.length() < b.length(); } else { return a < b; } } int getsum(string &a, string &b) { int ans = 0; for (int i = 0; i < a.size(); ++i) { if (a[i] != b[i]) ++ans; ...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 52.549123764038086, "time_ms_p95": 63.79497051239013, "memory_mb_max": 1.28125 }
{ "paradigm": [ "greedy" ], "technique": [], "data_structures": [ "map" ], "notes": "The solution uses a greedy approach with a frequency map to match identical strings and count the remaining mismatches." }
1000_A
539
143
#include <bits/stdc++.h> using namespace std; int main() { int n, i, j, k, a = 0, b; cin >> n; map<string, int> m1, m2; string s; for (i = 0; i < n; i++) { cin >> s; m1[s]++; } for (i = 0; i < n; i++) { cin >> s; m2[s]++; } map<string, int>::iterator it, it1; for (it1 = m2.begin(); i...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 80.49845695495605, "time_ms_p95": 108.18171501159668, "memory_mb_max": 1.55078125 }
{ "paradigm": [ "greedy" ], "technique": [], "data_structures": [ "map" ], "notes": "The solution uses a greedy approach by counting frequency differences in maps to determine the minimum number of replacements needed." }
1000_A
554
146
#include <bits/stdc++.h> using namespace std; int main() { long long int N, i, j, ans; string str; vector<string> v11, v12, v13, v14, v21, v22, v23, v24; cin >> N; for (i = 0; i < N; i++) { cin >> str; if (str.length() == 1) { v11.push_back(str); } else if (str.length() == 2) { v12.pus...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 71.45333290100098, "time_ms_p95": 78.46314907073975, "memory_mb_max": 1.55078125 }
{ "paradigm": [ "greedy" ], "technique": [], "data_structures": [ "vector" ], "notes": "The solution greedily matches identical strings of the same length and counts the remaining differences as required transformations." }
1000_A
585
158
#include <bits/stdc++.h> using namespace std; int main() { int n, m = 0, l = 0, s3 = 0, l1 = 0, l2 = 0, l3 = 0, l4 = 0, l5 = 0, l6 = 0; cin >> n; string s; for (int i = 0; i < n; i++) { cin >> s; if (s.length() == 1) { if (s[0] == 'M') m++; else if (s[0] == 'L') l++; el...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 51.75161361694336, "time_ms_p95": 60.875487327575684, "memory_mb_max": 1.28125 }
{ "paradigm": [ "greedy" ], "technique": [], "data_structures": [ "vector" ], "notes": "The solution counts occurrences of each T-shirt size and calculates the total differences, dividing by two because each change affects two counts." }
1000_A
596
161
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1.0); const int INF = 0x3f3f3f3f; const int MOD = 1e9 + 7; const double EPS = 1e-9; map<string, int> mmp1, mmp2; set<string> ss; int n; int main() { scanf("%d", &n); for (int i = 1; i <= n; ++i) { string s; cin >> s; ++mmp1[s]; ss...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 66.35189056396484, "time_ms_p95": 79.57921028137207, "memory_mb_max": 1.48828125 }
{ "paradigm": [ "greedy" ], "technique": [], "data_structures": [ "map", "set" ], "notes": "The solution uses a greedy approach by counting frequency differences of T-shirt sizes between the two lists." }
1000_A
606
165
#include <bits/stdc++.h> using namespace std; inline long long int modadd(long long int n, long long int m, long long int p = 1000000007) { return ((n + m) % p + p) % p; } inline long long int modsub(long long int n, long long int m, long long int p = 1000000007...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 73.86159896850586, "time_ms_p95": 80.08747100830078, "memory_mb_max": 1.546875 }
{ "paradigm": [ "greedy" ], "technique": [], "data_structures": [ "array" ], "notes": "The solution uses a greedy approach by matching identical strings first and counting the remaining differences." }
1000_A
632
169
#include <bits/stdc++.h> using namespace std; const int N = 101; int pen[N][N]; int n; char a[N][N], b[N][N]; int cal(int x, int y) { int n = strlen(b[x] + 1), m = strlen(a[y] + 1); if (n != m) return 1000000007; int res = 0; for (int i = (1); i <= (n); i++) res += (b[x][i] != a[y][i]); return res; } void sol...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 75.9274959564209, "time_ms_p95": 81.47435188293457, "memory_mb_max": 1.55078125 }
{ "paradigm": [ "greedy" ], "technique": [], "data_structures": [ "array", "set" ], "notes": "The solution uses a greedy approach to match strings by minimizing the edit distance between pairs, though it incorrectly assumes a simple greedy strategy is optimal for the assignment problem." }
1000_A
660
180
#include <bits/stdc++.h> long int a[10] = {0}; long int b[10] = {0}; char s[100]; int main() { long int i, j, k, l, t, n, x, y, count, flag, m; scanf("%ld", &n); for (i = 0; i < n; i++) { scanf("%s", s); j = strlen(s); if (j == 1) { if (s[0] == 'S') a[3]++; else if (s[0] == 'M') ...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 69.7476863861084, "time_ms_p95": 80.20553588867188, "memory_mb_max": 0.7734375 }
{ "paradigm": [ "greedy", "simulation" ], "technique": [], "data_structures": [ "array" ], "notes": "The solution maps each T-shirt size to a unique integer index and calculates the total difference in counts, dividing by two to account for paired replacements." }
1000_A
687
186
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; const int mod = 2e9 + 7; char str[6]; int n; struct node { int cntm, cnts, cntl, cntxs, cntxl, cntxxs, cntxxl, cntxxxs, cntxxxl; } a, b; void work() { scanf("%d", &n); getchar(); for (int i = 0; i < n; i++) { scanf("%s", str); if (...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 69.17786598205566, "time_ms_p95": 75.87440013885498, "memory_mb_max": 1.48828125 }
{ "paradigm": [ "greedy" ], "technique": [], "data_structures": [ "array" ], "notes": "The solution counts occurrences of each T-shirt size and greedily calculates the difference, as the problem guarantees a valid transformation exists." }
1000_B
null
11
#include <bits/stdc++.h> using namespace std; int main() { int n, m; scanf("%d %d", &n, &m); int a[n]; for (int i = 0; i < n; i++) scanf("%d", &a[i]); int left[n], right[n], rightlit[n], rightoff[n]; for (int i = 0; i < n; i++) { if (i == 0) { left[i] = a[i]; } else if (i % 2 == 0 && i != 0) {...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 55.67598342895508, "time_ms_p95": 67.66855716705322, "memory_mb_max": 1.28125 }
{ "paradigm": [ "greedy" ], "technique": [ "prefix_sum" ], "data_structures": [ "array" ], "notes": "The solution uses prefix sums to calculate the total lit time and evaluates all possible insertion points to maximize the result." }
1000_B
29
13
#include <bits/stdc++.h> using namespace std; vector<int> divisors; long long arr[100005], sumlon[100005], b[100005], sumloff[100005], sumron[100005], sumroff[100005]; int main() { int n; long long m; cin >> n >> m; int flag = 1; arr[0] = 0; b[0] = flag; for (int i = 1; i <= n; i++) { cin >> arr[i...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 51.24545097351074, "time_ms_p95": 73.85370731353754, "memory_mb_max": 4.71875 }
{ "paradigm": [ "greedy" ], "technique": [ "prefix_sum" ], "data_structures": [ "array", "vector" ], "notes": "The solution uses prefix sums to calculate the total lit time for segments before and after an insertion point, then greedily checks all possible insertion gaps." }
1000_B
36
15
#include <bits/stdc++.h> namespace IO { char ch = '\n'; template <class T> inline T ReadInt() { T x(0); bool f(1); while (ch < '0' || '9' < ch) { if (ch == '-') { f = 0; } ch = getchar(); } while ('0' <= ch && ch <= '9') { x = (x << 1) + (x << 3) + (ch ^ 48); ch = getchar(); } re...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 75.22273063659668, "time_ms_p95": 79.97829914093018, "memory_mb_max": 0.7734375 }
{ "paradigm": [ "greedy" ], "technique": [ "prefix_sum" ], "data_structures": [ "array", "matrix_2d" ], "notes": "The solution uses precomputed prefix sums of alternating intervals to evaluate the impact of inserting a new switching point in O(1) time." }
1000_B
47
21
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); long long n, m; cin >> n >> m; long long a[n + 1]; a[n] = m; for (int i = 0; i < n; ++i) cin >> a[i]; long long o[n], of[n]; of[n - 1] = 0; o[n - 1] = m - a[n - 1]; for (int i = n - 2; i >= 0; --i) { o[i...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 70.71256637573242, "time_ms_p95": 79.32603359222412, "memory_mb_max": 1.546875 }
{ "paradigm": [ "greedy" ], "technique": [ "prefix_sum" ], "data_structures": [ "array" ], "notes": "The solution uses precomputed suffix sums to evaluate the impact of inserting a new switching moment at each possible interval." }
1000_B
82
36
#include <bits/stdc++.h> using namespace std; int main() { long long int arr[100005], arr1[100005], i, j, k, l, n, m, l_sum = 0, d_sum = 0, l_sum1 = 0, d_sum1 = 0, a1 = 0; cin >> n >> m; for (i = 0; i < n; i++) { cin >> arr[i]; if (i == 0) { l_sum += arr[i]; } else { if ((i % 2) == 0...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 73.93980026245117, "time_ms_p95": 94.44181919097896, "memory_mb_max": 4.3359375 }
{ "paradigm": [ "greedy" ], "technique": [ "prefix_sum" ], "data_structures": [ "array" ], "notes": "The solution calculates the total lit time and evaluates the impact of inserting a new switch point in every possible gap using prefix sums." }
1000_B
85
38
#include <bits/stdc++.h> using namespace std; struct change { int x = 0; int before_state = -1; int svetlelo = 0; int ns() { return x - svetlelo; } }; change a[100013]; int f(int a) { return (a + 1) / 2; } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cerr.tie(nullptr); cout.tie(nullp...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 51.250457763671875, "time_ms_p95": 65.24806022644043, "memory_mb_max": 1.59375 }
{ "paradigm": [ "greedy" ], "technique": [ "prefix_sum" ], "data_structures": [ "array" ], "notes": "The solution uses prefix sums to calculate the total lit time and evaluates potential insertions by checking the impact on the lit duration locally." }
1000_B
139
53
#include <bits/stdc++.h> using namespace std; int main() { long long N, L; cin >> N >> L; vector<long long> Hash(N + 7, 0), E(N + 2); E[0] = 0; for (int i = 1; i <= N; i++) cin >> E[i]; E[N + 1] = L; int i = N + 1; while (i > 0) { Hash[i] = E[i] - E[i - 1] + Hash[i + 2]; i--; } vector<long l...
a
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 75.80924034118652, "time_ms_p95": 86.4096164703369, "memory_mb_max": 4.46484375 }
null
1000_B
143
56
#include <bits/stdc++.h> using namespace std; int read() { int q = 0; char ch = ' '; while (ch < '0' || ch > '9') ch = getchar(); while (ch >= '0' && ch <= '9') q = q * 10 + ch - '0', ch = getchar(); return q; } const int N = 100005; int a[N], b[N], x[N], n, m, ans = 0; int main() { n = read(), m = read(); ...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 68.2058334350586, "time_ms_p95": 96.59988880157464, "memory_mb_max": 1.55078125 }
{ "paradigm": [ "greedy" ], "technique": [ "prefix_sum" ], "data_structures": [ "array" ], "notes": "The solution uses suffix sums to calculate the impact of inserting an element at any valid position in O(n) time." }
1000_B
null
60
#include <bits/stdc++.h> using namespace std; const int MAXN = 100005; const int INF = 1 << 30; const int mod = 1000000009; int lowbit(int x) { return x & (-x); } int fast_power(int a, int b) { int x; for (x = 1; b; b >>= 1) { if (b & 1) x = 1ll * x * a % mod; a = 1ll * a * a % mod; } return x % mod; } ...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 51.38087272644043, "time_ms_p95": 64.81623649597167, "memory_mb_max": 1.265625 }
{ "paradigm": [ "greedy" ], "technique": [ "prefix_sum" ], "data_structures": [ "array" ], "notes": "The solution uses precomputed suffix sums of alternating intervals to evaluate the impact of inserting a new switching point in O(1) time." }
1000_B
null
63
#include <bits/stdc++.h> using namespace std; int main() { int n, m, flag; cin >> n >> m; int a[n + 1], off[n], on[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } a[n] = m; if (n % 2 == 0) { on[n - 1] = m - a[n - 1]; off[n - 1] = 0; flag = 0; } if (n % 2 == 1) { off[n - 1] = m - a...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 51.162004470825195, "time_ms_p95": 80.74212074279781, "memory_mb_max": 4.37890625 }
{ "paradigm": [ "greedy" ], "technique": [ "prefix_sum" ], "data_structures": [ "array" ], "notes": "The solution uses prefix sums to calculate the impact of inserting a new switching point into the existing program." }
1000_B
162
64
#include <bits/stdc++.h> using namespace std; int main() { long long int n, m; cin >> n >> m; vector<long long int> A(n + 2); A[0] = 0; A[n + 1] = m; for (int i = 1; i <= n; i++) { cin >> A[i]; } vector<long long int> diff(n + 2); for (int i = 1; i <= n + 1; i++) { diff[i] = A[i] - A[i - 1]; ...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 73.60291481018066, "time_ms_p95": 78.67019176483154, "memory_mb_max": 0.72265625 }
{ "paradigm": [ "greedy" ], "technique": [ "prefix_sum" ], "data_structures": [ "vector" ], "notes": "The solution uses prefix sums of odd and even intervals to calculate the impact of inserting a new switching point in O(n) time." }
1000_B
179
72
#include <bits/stdc++.h> using namespace std; int n, m; const int MAXN = 100005; long long a[MAXN], prel[MAXN], pren[MAXN]; int main() { ios::sync_with_stdio(0); cin >> n >> m; a[n + 1] = m; for (int i = 1; i <= n + 1; i++) { if (i <= n) cin >> a[i]; prel[i] = prel[i - 1]; pren[i] = pren[i - 1]; ...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 67.18611717224121, "time_ms_p95": 80.44934272766113, "memory_mb_max": 1.55078125 }
{ "paradigm": [ "greedy" ], "technique": [ "prefix_sum" ], "data_structures": [ "array" ], "notes": "The solution uses prefix sums to calculate the total lit time and iterates through possible insertion points to maximize the result." }
1000_B
196
80
#include <bits/stdc++.h> using namespace std; long long a[100005], dif1[100005], dif2[100005], m, n; int main() { long long mx, p, s; cin >> n >> m; n++; for (int i = 2; i <= n; i++) cin >> a[i]; a[1] = 0; n++; a[n] = m; p = 0; for (int i = 2; i <= n; i += 2) { dif1[i] = p + (a[i] - a[i - 1]); ...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 79.53858375549316, "time_ms_p95": 101.53241157531734, "memory_mb_max": 3.609375 }
{ "paradigm": [ "greedy" ], "technique": [ "prefix_sum" ], "data_structures": [ "array" ], "notes": "The solution uses prefix sums of alternating segments to calculate the total lit time and evaluates the impact of inserting a new switch point in O(n) time." }
1000_B
231
92
#include <bits/stdc++.h> using namespace std; int main() { int n, m, x; cin >> n >> m; n += 2; vector<pair<int, int> > a(n); a[0].first = 0; a[0].second = true; for (int i = 1; i < n; i++) { cin >> a[i].first; a[i].second = (i - 1) % 2; } a[n - 1].first = m; a[n - 1].second = false; vector...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 98.12498092651367, "time_ms_p95": 130.89125156402588, "memory_mb_max": 1.484375 }
{ "paradigm": [ "greedy" ], "technique": [ "prefix_sum" ], "data_structures": [ "vector" ], "notes": "The solution uses prefix sums to calculate the total lit time and evaluates the impact of inserting a new switch point by considering the state of the lamp at each interval." }
1000_B
235
93
#include <bits/stdc++.h> int operations[100005]{0}; int lit_time[100006]{0}; int main() { int operation_count, time_length; scanf("%d%d", &operation_count, &time_length); bool lit = true; for (int i = 1; i <= operation_count; ++i) { scanf("%d", &operations[i]); lit_time[i] += lit_time[i - 1] + lit * (op...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 67.61980056762695, "time_ms_p95": 77.87387371063232, "memory_mb_max": 1.546875 }
{ "paradigm": [ "greedy" ], "technique": [ "prefix_sum" ], "data_structures": [ "array" ], "notes": "The solution uses prefix sums to calculate the total lit time and greedily evaluates the impact of inserting a new switch point between existing intervals." }
1000_B
270
113
#include <bits/stdc++.h> using namespace std; int N, M, i, j, X; int v[100005], ANS; int A[100005], B[100005]; int main() { cin >> N >> M; for (i = 1; i <= N; i++) cin >> v[i]; v[++N] = M; for (i = 1; i <= N; i++) { A[i] = A[i - 1]; if (i % 2 == 1) A[i] += v[i] - v[i - 1]; } for (i = N - 1; i >= 0; ...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 79.15472984313965, "time_ms_p95": 134.63826179504395, "memory_mb_max": 1.484375 }
{ "paradigm": [ "greedy" ], "technique": [ "prefix_sum" ], "data_structures": [ "array" ], "notes": "The solution uses prefix sums to calculate the total lit time and evaluates the impact of inserting a new switch point between every existing interval." }
1000_B
274
114
#include <bits/stdc++.h> using namespace std; template <class T> void test(T t) { cout << t << endl; } template <class T, class T2> void test(T t, T2 t2) { cout << t << " " << t2 << endl; } template <class T, class T2, class T3> void test(T t, T2 t2, T3 t3) { cout << t << " " << t2 << " " << t3 << endl; } const i...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 87.19277381896973, "time_ms_p95": 111.64815425872801, "memory_mb_max": 1.48828125 }
{ "paradigm": [ "greedy" ], "technique": [ "prefix_sum" ], "data_structures": [ "array" ], "notes": "The solution uses prefix and suffix sums to calculate the total lit time efficiently after inserting an element at any valid position." }
1000_B
null
119
#include <bits/stdc++.h> const int mx = 1e6 + 5; const int inf = 0x3f3f3f3f; using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, m, st = 1, af1 = 0, af0 = 0; scanf("%d%d", &n, &m); vector<int> v(n + 1, 0); for (int i = 0; i < n; ++i) scanf("%d", &v[i + 1]); v.push_back(m); vect...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 51.83672904968262, "time_ms_p95": 61.9373083114624, "memory_mb_max": 1.109375 }
{ "paradigm": [ "greedy" ], "technique": [ "prefix_sum" ], "data_structures": [ "vector" ], "notes": "The solution calculates the total lit time by tracking prefix sums of lit and unlit segments, then greedily evaluates the impact of inserting a new switch point in each interval." }
1000_B
290
123
#include <bits/stdc++.h> using namespace std; void ins(long long int a[], long long int n, long long int i = 0) { for (long long int i = 0; i < n; i++) a[i] = i; } template <typename t> void ins(t a[], long long int n, t b = 0) { for (long long int i = 0; i < n; i++) a[i] = b; } void print(long long int a[], long l...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 72.81279563903809, "time_ms_p95": 84.93533134460448, "memory_mb_max": 1.48828125 }
{ "paradigm": [ "greedy" ], "technique": [ "prefix_sum" ], "data_structures": [ "vector" ], "notes": "The solution calculates the total lit time and evaluates the impact of inserting a new switch point by precomputing prefix sums of lit and unlit segments." }
1000_B
296
125
#include <bits/stdc++.h> using namespace std; long long int power(long long int x, long long int y) { if (y == 0) return 1; else if (y % 2 == 0) return power((x * x) % (long long int)1000000007, y / 2); else return (x * power((x * x) % (long long int)1000000007, (y - 1) / 2)) % (long long i...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 70.88112831115723, "time_ms_p95": 79.48322296142578, "memory_mb_max": 1.546875 }
{ "paradigm": [ "greedy" ], "technique": [ "prefix_sum" ], "data_structures": [ "vector" ], "notes": "The solution uses prefix sums to calculate the total lit time and evaluates potential insertions by checking gaps between existing program points." }
1000_B
311
130
#include <bits/stdc++.h> using namespace std; long long s[100002], d[100002], a[100002]; int main() { std::ios_base::sync_with_stdio(false); int n, m; cin >> n >> m; for (int i = 0; i < n; ++i) cin >> a[i]; s[0] = a[0]; s[1] = s[0]; for (int i = 2; i < n; i += 2) { s[i - 1] = s[i - 2]; s[i] += s[i...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 78.22227478027344, "time_ms_p95": 80.94561100006104, "memory_mb_max": 1.55078125 }
{ "paradigm": [ "greedy" ], "technique": [ "prefix_sum" ], "data_structures": [ "array" ], "notes": "The solution uses prefix and suffix sums to calculate the total lit time efficiently after inserting an element at any valid position." }
1000_B
340
137
#include <bits/stdc++.h> using namespace std; template <typename X, typename Y> struct Pair { X x; Y y; template <typename X1, typename Y1> Pair(const X1 &x, const Y1 &y) : x(x), y(y) {} Pair() {} template <typename X1> Pair(const X1 &x) : x(x) {} template <typename X1, typename Y1> Pair<X, Y> operato...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 72.75390625, "time_ms_p95": 228.1429767608642, "memory_mb_max": 35.4453125 }
{ "paradigm": [ "constructive" ], "technique": [ "prefix_sum" ], "data_structures": [ "vector", "map", "set" ], "notes": "The solution calculates the total lit time by precomputing prefix and suffix sums of lit intervals and checking the effect of inserting a new switch point." }
1000_B
355
143
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000007; const int MOD2 = 998244353; const int BASE = 29; const long long int LLINF = 1ll << 60; const char en = '\n'; void yes() { cout << "YES" << en; exit(0); } void no() { cout << "NO" << en; exit(0); } long long int raand() { return rand() * ...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 71.60425186157227, "time_ms_p95": 97.6575374603271, "memory_mb_max": 1.484375 }
{ "paradigm": [ "greedy" ], "technique": [ "prefix_sum" ], "data_structures": [ "vector", "map", "array" ], "notes": "The solution uses prefix sums to calculate the total lit time and greedily checks potential insertion points to maximize the result." }
1000_B
388
157
#include <bits/stdc++.h> #pragma GCC optimize(1) #pragma G++ optimize(1) #pragma GCC optimize(2) #pragma G++ optimize(2) #pragma GCC optimize(3) #pragma G++ optimize(3) #pragma GCC optimize(4) #pragma G++ optimize(4) #pragma GCC optimize(5) #pragma G++ optimize(5) #pragma GCC optimize(6) #pragma G++ optimize(6) #pragma...
b
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 73.54497909545898, "time_ms_p95": 78.16348075866699, "memory_mb_max": 1.48828125 }
null
1000_B
417
165
#include <bits/stdc++.h> using namespace std; int n, m, a[100005]; long long sum[100005], maxc, ans; int main() { cin >> n >> m; for (int i = 1; i <= n; i++) cin >> a[i]; a[n + 1] = m; sum[1] = a[1]; maxc = sum[1]; for (int i = 3; i <= n + 1; i += 2) sum[i] = sum[i - 2] + a[i] - a[i - 1], maxc = max(max...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 72.80564308166504, "time_ms_p95": 82.38208293914794, "memory_mb_max": 0.765625 }
{ "paradigm": [ "greedy" ], "technique": [ "prefix_sum" ], "data_structures": [ "array" ], "notes": "The solution uses prefix sums to calculate the total lit time and greedily evaluates the impact of inserting an element into each possible interval." }
1000_C
null
3
#include <bits/stdc++.h> using namespace std; long long mod = 1000000007; long long INF = 1e18; int32_t main() { ios::sync_with_stdio(false); cin.tie(nullptr); long long n; cin >> n; vector<pair<long long, long long> > v(n); set<pair<long long, long long> > s; set<long long> nums; long long maxi = 0; ...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 52.29687690734863, "time_ms_p95": 58.60180854797363, "memory_mb_max": 1.28125 }
{ "paradigm": [ "simulation" ], "technique": [ "sweep_line", "coordinate_compression" ], "data_structures": [ "vector", "set" ], "notes": "The solution uses a sweep-line approach over coordinate-compressed points to count segment coverage intervals." }
1000_C
null
4
#include <bits/stdc++.h> using namespace std; const long long MAX = 2e5 + 7; long long t = 1, n, m, l, k, tc, r; long long arr[MAX]; signed main() { while (t--) { cin >> n; map<long long, long long> mp; for (long long i = 1; i <= n; i++) cin >> l >> r, mp[l]++, mp[r + 1]--; long long idx = 0, prv = 0;...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 52.173614501953125, "time_ms_p95": 62.70158290863037, "memory_mb_max": 1.59765625 }
{ "paradigm": [ "greedy" ], "technique": [ "difference_array", "sweep_line" ], "data_structures": [ "map", "vector" ], "notes": "The solution uses a difference array approach via a map to perform a sweep-line over the segment endpoints to count coverage." }
1000_C
null
5
#include <bits/stdc++.h> using namespace std; set<long long> st; vector<long long> vt; long long ans[500005]; long long cnt[500005]; long long co[500005][2]; int main() { long long n, k, i, j, l, c = 0, q, x, y, u, v, t; cin >> n; for (i = 0; i < n; i = i + 1) cin >> x >> y, st.insert(x), st.insert(y + 1), co...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 54.476261138916016, "time_ms_p95": 66.66867733001709, "memory_mb_max": 1.4765625 }
{ "paradigm": [ "two_phase" ], "technique": [ "coordinate_compression", "difference_array" ], "data_structures": [ "vector", "set", "array" ], "notes": "The solution uses coordinate compression on segment endpoints and a difference array to count coverage, then aggregates the lengt...
1000_C
null
6
#include <bits/stdc++.h> using namespace std; const int N = 2 * 1000 * 100 + 10; pair<long long, int> p[N << 1]; long long sum[N], n, pos[N << 1], neg[N << 1]; int main() { ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); cin >> n; for (int i = 1; i <= n; i++) { long long l, r; cin >> l >> r; p[i...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 49.64494705200195, "time_ms_p95": 61.07637882232666, "memory_mb_max": 1.11328125 }
{ "paradigm": [ "two_phase" ], "technique": [ "sweep_line" ], "data_structures": [ "array" ], "notes": "The solution uses a sweep-line approach to count points covered by k segments by processing interval endpoints and handling gaps and points separately." }
1000_C
9
7
#include <bits/stdc++.h> using namespace std; const int maxn = 2e6 + 5; long long l[maxn], r[maxn], ans[maxn]; int tl[maxn], tr[maxn], s[maxn]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<long long> ds; for (int i = 0; i < n; ++i) { cin >> l[i] >> r[i]; ds.push...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 75.18339157104492, "time_ms_p95": 78.32581996917725, "memory_mb_max": 0.72265625 }
null
1000_C
null
9
#include <bits/stdc++.h> using namespace std; const int maxn = 2e6 + 5; long long l[maxn], r[maxn], ans[maxn]; int tl[maxn], tr[maxn], s[maxn]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<long long> ds; for (int i = 0; i < n; ++i) { cin >> l[i] >> r[i]; ds.push...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 54.261207580566406, "time_ms_p95": 61.66491508483887, "memory_mb_max": 1.53515625 }
null
1000_C
16
13
#include <bits/stdc++.h> using namespace std; signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long n; cin >> n; long long p, q; vector<pair<long long, long long> > a; long long m = n; for (long long i = 0; i < n; i++) { cin >> p >> q; a.push_back({p, 0}); a....
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 67.47794151306152, "time_ms_p95": 78.74515056610107, "memory_mb_max": 1.546875 }
{ "paradigm": [], "technique": [ "sweep_line" ], "data_structures": [ "vector", "map", "stack" ], "notes": "The solution uses a sweep-line approach to process segment endpoints and count coverage frequencies." }
1000_C
36
24
#include <bits/stdc++.h> using namespace std; vector<long long> v; map<long long, long long> mp; struct dat { long long lef, righ; } a[500005]; long long val[500005], smen[500005], fr[500005]; int main() { long long n, i, vf, act; cin >> n; for (i = 1; i <= n; i++) { cin >> a[i].lef >> a[i].righ; v.push...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 73.86612892150879, "time_ms_p95": 79.80995178222656, "memory_mb_max": 0.73046875 }
null
1000_C
52
32
#include <bits/stdc++.h> using namespace std; const int MAX = 5e5 + 1; long long t, n, cnt; long long ans[MAX], X[MAX], Y[MAX], a[MAX], sum[MAX], dis[MAX]; long long IIDD(long long x) { long long t = lower_bound(a + 1, a + n + 1, x) - a; return t; } int main() { cin >> t; for (int i = 1; i <= t; ++i) cin >>...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 53.24912071228027, "time_ms_p95": 63.09287548065185, "memory_mb_max": 1.5234375 }
{ "paradigm": [ "two_phase" ], "technique": [ "coordinate_compression", "difference_array", "prefix_sum" ], "data_structures": [ "array" ], "notes": "The solution uses coordinate compression to handle large coordinates and a difference array to count segment overlaps over intervals." }
1000_C
null
36
#include <bits/stdc++.h> using namespace std; vector<long long> v; map<long long, long long> mp; struct dat { long long lef, righ; } a[500005]; long long val[500005], smen[500005], fr[500005]; int main() { long long n, i, vf, act; cin >> n; for (i = 1; i <= n; i++) { cin >> a[i].lef >> a[i].righ; v.push...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 52.26922035217285, "time_ms_p95": 61.96866035461425, "memory_mb_max": 1.10546875 }
null
1000_C
null
37
#include <bits/stdc++.h> using namespace std; set<pair<long long, int> > st; int n; long long l, r; long long ans[2 * 100000 + 10]; int main() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); cin >> n; for (int i = 1; i <= n; i++) { cin >> l >> r; st.insert({l, i}); st.insert({r + 1, -i}); }...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 52.45471000671387, "time_ms_p95": 60.59856414794922, "memory_mb_max": 1.01953125 }
{ "paradigm": [], "technique": [ "sweep_line" ], "data_structures": [ "set", "vector" ], "notes": "The solution uses a sweep-line approach by processing segment endpoints as events in a sorted set to track the number of active segments over intervals." }
1000_C
null
46
#include <bits/stdc++.h> using namespace std; int amount; pair<long long, long long> segments[200005]; long long nester[3 * 200005]; int nest_mem = 0; void nest() { for (int i = 1; i <= amount; i++) { nester[++nest_mem] = segments[i].first; nester[++nest_mem] = segments[i].second; nester[++nest_mem] = seg...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 52.24132537841797, "time_ms_p95": 59.93063449859619, "memory_mb_max": 1.53125 }
null
1000_C
null
49
#include <bits/stdc++.h> using namespace std; pair<long long, int> a[400005]; long long ans[200005]; int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) { long long x, y; scanf("%lld%lld", &x, &y); a[i].first = x; a[i].second = 0; a[i + n].first = y; a[i + n].second = 1; } ...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 52.44112014770508, "time_ms_p95": 59.69266891479492, "memory_mb_max": 1.53515625 }
{ "paradigm": [], "technique": [ "sweep_line" ], "data_structures": [ "array" ], "notes": "The solution uses a sweep-line approach by sorting segment endpoints and processing intervals between them to count coverage." }
1000_C
96
52
#include <bits/stdc++.h> using namespace std; const int len = 2e5 + 5; const long long inf = 1e18 + 5; long long cnt[len]; vector<pair<long long, int> > vec; int main() { int n, cur = 0; scanf("%d", &n); for (int i = 0; i < n; i++) { long long l, r; scanf("%lld %lld", &l, &r); vec.push_back(make_pair(...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 70.37687301635742, "time_ms_p95": 80.05833625793457, "memory_mb_max": 1.484375 }
{ "paradigm": [ "greedy" ], "technique": [ "sweep_line" ], "data_structures": [ "vector" ], "notes": "The solution uses a sweep-line approach to count how many segments cover each interval between consecutive coordinate endpoints." }
1000_C
null
53
#include <bits/stdc++.h> using namespace std; int main() { std::ios_base::sync_with_stdio(false); int n; cin >> n; long long b, e; vector<pair<long long, long long> > act(2 * n); vector<long long> count(n + 1); map<long long, int> ptat; for (int i = 0; i < n; i++) { cin >> b >> e; act[2 * i] = p...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 52.20746994018555, "time_ms_p95": 61.52989864349365, "memory_mb_max": 1.28125 }
{ "paradigm": [], "technique": [ "sweep_line" ], "data_structures": [ "vector", "map" ], "notes": "The solution uses a sweep-line approach to process segment endpoints and calculate the number of points covered by exactly k segments." }
1000_C
104
56
#include <bits/stdc++.h> using namespace std; int xd[] = {1, 0, -1, 0, 1, 1, -1, -1}; int yd[] = {0, -1, 0, 1, 1, -1, 1, -1}; long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); } long long lcm(long long a, long long b) { return a * (b / gcd(a, b)); } inline bool isEqual(double x, double y) { ...
a
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 74.79643821716309, "time_ms_p95": 83.83033275604248, "memory_mb_max": 3.15625 }
null
1000_C
115
63
#include <bits/stdc++.h> using namespace std; const long long N = 200005; long long n, ans[N], tot = 0; struct node { long long po, w; } a[N * 2]; inline bool cmp(node a, node b) { return a.po != b.po ? a.po < b.po : a.w > b.w; } signed main() { long long i, x, y, s = 0; scanf("%lld", &n); for (i = 1; i <= n;...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 70.03021240234375, "time_ms_p95": 82.29734897613525, "memory_mb_max": 1.484375 }
{ "paradigm": [ "two_phase" ], "technique": [ "sweep_line", "difference_array" ], "data_structures": [ "array" ], "notes": "The solution uses a sweep-line approach with a difference array to count segment coverage over intervals defined by coordinate endpoints." }
1000_C
null
70
#include <bits/stdc++.h> using namespace std; const int maxn = 8e5 + 1000; long long re[maxn]; vector<long long> v; int sum[maxn]; struct node { long long l, r; } a[maxn]; long long ans[maxn]; int getid(long long x) { return lower_bound(v.begin(), v.end(), x) - v.begin() + 1; } int main() { int n; cin >> n; f...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 52.34050750732422, "time_ms_p95": 61.28344535827637, "memory_mb_max": 1.47265625 }
{ "paradigm": [ "two_phase" ], "technique": [ "difference_array", "coordinate_compression" ], "data_structures": [ "vector", "array" ], "notes": "The solution uses coordinate compression on segment endpoints and a difference array to count coverage frequencies over intervals." }
1000_C
137
75
#include <bits/stdc++.h> using namespace std; struct str2 { unsigned long long l; unsigned long long r; str2() : l(), r(){}; str2(unsigned long long aa, unsigned long long bb) : l(aa), r(bb){}; }; const size_t SIZE = 400005; int n, amount; str2 segm[SIZE]; unsigned long long cur[SIZE]; unsigned long long ans[SI...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 72.4642276763916, "time_ms_p95": 77.55546569824219, "memory_mb_max": 1.484375 }
null
1000_C
null
81
#include <bits/stdc++.h> using namespace std; int n; pair<long long, long long> seg[200005]; int idx = 0; map<long long, int> ini; long long ev[400005]; long long balik[400005]; long long val[400005]; long long cetak[400005]; int main() { cin >> n; for (int i = 1; i <= n; i++) { long long x, y; cin >> x >> ...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 52.55556106567383, "time_ms_p95": 61.56418323516846, "memory_mb_max": 1.66015625 }
{ "paradigm": [ "two_phase" ], "technique": [ "difference_array", "coordinate_compression" ], "data_structures": [ "map", "array" ], "notes": "The solution uses coordinate compression on segment endpoints and a difference array to count coverage levels across intervals." }
1000_C
173
99
#include <bits/stdc++.h> using namespace std; map<long long, long long> m; long long f[400005]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; long long l, r; for (int i = 0; i < n; i++) { cin >> l >> r; m[l] += 1; m[r + 1] -= 1; } map<long long, long long>::i...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 53.21335792541504, "time_ms_p95": 61.93165779113769, "memory_mb_max": 1.29296875 }
null
1000_C
188
105
#include <bits/stdc++.h> using namespace std; struct Node { long long pos; int l; } node[400011]; long long ans[200011]; bool cmp(Node a, Node b) { if (a.pos == b.pos) return a.l > b.l; return a.pos < b.pos; } int main() { int n; cin >> n; int i; memset(ans, 0, sizeof(ans)); for (i = 1; i <= 2 * n; i+...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 72.82638549804688, "time_ms_p95": 82.45043754577635, "memory_mb_max": 1.48828125 }
{ "paradigm": [ "two_phase" ], "technique": [ "sweep_line", "difference_array" ], "data_structures": [ "array" ], "notes": "The solution uses a sweep-line approach by treating segment endpoints as events to calculate coverage counts over intervals." }
1000_C
200
111
#include <bits/stdc++.h> using namespace std; long long n, l[1000001], r[1000001], an[1000001], ans[1000001]; map<long long, long long> mp1, mp2; vector<long long> v; int main() { cin >> n; for (int i = 1; i <= n; i++) { cin >> l[i] >> r[i]; if (mp1[l[i]] == 0 && mp2[l[i]] == 0) v.push_back(l[i]); mp1[l...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 51.523685455322266, "time_ms_p95": 60.87119579315185, "memory_mb_max": 1.29296875 }
{ "paradigm": [ "constructive" ], "technique": [ "sweep_line", "coordinate_compression" ], "data_structures": [ "vector", "map" ], "notes": "The solution uses a sweep-line approach on coordinate-compressed points to count segment coverage intervals." }
1000_C
null
113
#include <bits/stdc++.h> using namespace std; const long long int inf = 1e9 + 7; const long long int mod = 1e9 + 7; long long int mini(long long int a, long long int b) { if (a >= b) return b; return a; } long long int maxi(long long int a, long long int b) { if (a >= b) return a; return b; } int main() { ios...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 54.8403263092041, "time_ms_p95": 61.43162250518799, "memory_mb_max": 1.21875 }
{ "paradigm": [ "constructive" ], "technique": [ "difference_array", "coordinate_compression" ], "data_structures": [ "map", "set" ], "notes": "The solution uses a difference array approach on coordinate-compressed points to count how many segments cover each interval." }
1000_C
213
117
#include <bits/stdc++.h> using namespace std; struct ev { long long x; bool type; bool operator<(const ev &obj) const { if (x != obj.x) return x < obj.x; if (type == 0 && obj.type == 1) return 1; return 0; } }; const long long nmax = 200005; long long n, ans[nmax]; map<long long, long long> mp, leav...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 50.73285102844238, "time_ms_p95": 59.6461296081543, "memory_mb_max": 1.109375 }
{ "paradigm": [ "greedy" ], "technique": [ "sweep_line" ], "data_structures": [ "map", "array" ], "notes": "The solution uses a sweep-line approach to track the number of active segments over coordinate intervals." }
1000_C
241
122
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cout.precision(20); long long int n; cin >> n; vector<pair<long long int, long long int> > v(2 * n); for (long long int i = 0; i < 2 * n; i++) { if (i % 2) v[i].second = ...
b
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 116.16039276123047, "time_ms_p95": 133.13250541687012, "memory_mb_max": 1.48828125 }
null
1000_C
null
124
#include <bits/stdc++.h> using namespace std; int main() { size_t n; scanf("%zu", &n); vector<int64_t> events; for (size_t i = 0; i < n; i++) { int64_t a, b; scanf("%lld%lld", &a, &b); events.push_back(a); events.push_back(-(b + 1)); } sort(begin(events), end(events), [&](const int64_...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 51.84793472290039, "time_ms_p95": 59.43143367767334, "memory_mb_max": 1.33203125 }
null
1000_C
null
133
#include <bits/stdc++.h> using namespace std; const int MAXN = 200000; int cur; long long ans[MAXN + 5]; map<long long, int> event; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int N; cin >> N; for (int i = 0; i < N; i++) { long long l, r; cin >> l >> r; event[l]++; event[r + 1]--; ...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 51.55205726623535, "time_ms_p95": 62.91229724884033, "memory_mb_max": 1.4140625 }
{ "paradigm": [ "two_phase" ], "technique": [ "sweep_line", "difference_array" ], "data_structures": [ "map" ], "notes": "The solution uses a sweep-line approach with a difference array stored in a map to track segment coverage counts over coordinate intervals." }
1000_C
265
134
#include <bits/stdc++.h> struct aaa { long long x, t = 0; } aa[500002]; bool cmp(aaa A, aaa B) { if (A.x == B.x) return A.t > B.t; return A.x < B.x; } long long a[200002], b[200002], c[200002], d[200002]; int main() { long long n, t = 0, v = 0; std::cin >> n; for (long long i = 1; i <= n; i++) { long lo...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 69.20194625854492, "time_ms_p95": 85.91101169586182, "memory_mb_max": 5.0703125 }
{ "paradigm": [], "technique": [ "sweep_line" ], "data_structures": [ "array" ], "notes": "The solution uses a sweep-line approach to track the number of active segments over coordinate intervals." }
1000_C
null
137
#include <bits/stdc++.h> using namespace std; struct str2 { unsigned long long l; unsigned long long r; str2() : l(), r(){}; str2(unsigned long long aa, unsigned long long bb) : l(aa), r(bb){}; }; const size_t SIZE = 400005; int n, amount; str2 segm[SIZE]; unsigned long long cur[SIZE]; unsigned long long ans[SI...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 52.483320236206055, "time_ms_p95": 61.76769733428955, "memory_mb_max": 1.2734375 }
null
1000_C
317
157
#include <bits/stdc++.h> using namespace std; long long n, i, j, a, b, k, t[2000005]; pair<long long, long long> p[2000005]; int main() { cin >> n; i = 1; j = 1; while (j <= n) { cin >> a >> b; p[i].first = a; p[i].second = -i; i++; p[i].first = b; p[i].second = i; i++; j++; } ...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 51.05733871459961, "time_ms_p95": 53.74717712402344, "memory_mb_max": 1.64453125 }
{ "paradigm": [ "two_phase" ], "technique": [ "sweep_line" ], "data_structures": [ "array", "vector" ], "notes": "The solution uses a sweep-line approach by sorting segment endpoints and processing intervals between them to count coverage." }
1000_C
329
161
#include <bits/stdc++.h> using namespace std; const int MAX = 200005; const int MAX2 = 400010; vector<pair<long long, long long> > vi; vector<long long> ve; long long ans[MAX] = {0LL}; int cnt[MAX2] = {0}; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; long long l, r; for (in...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 72.15762138366699, "time_ms_p95": 81.1258316040039, "memory_mb_max": 1.55078125 }
{ "paradigm": [ "constructive" ], "technique": [ "difference_array", "coordinate_compression" ], "data_structures": [ "vector", "array" ], "notes": "The solution uses a difference array on coordinate-compressed intervals to count how many segments cover each range." }
1000_C
null
173
#include <bits/stdc++.h> using namespace std; map<long long, long long> m; long long f[400005]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; long long l, r; for (int i = 0; i < n; i++) { cin >> l >> r; m[l] += 1; m[r + 1] -= 1; } map<long long, long long>::i...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 50.284385681152344, "time_ms_p95": 56.86640739440917, "memory_mb_max": 1.22265625 }
null
1000_C
null
183
#include <bits/stdc++.h> using namespace std; struct Node { long long int val; char type; }; Node getNode(long long int v, char t) { Node n; n.val = v; n.type = t; return n; } class Compare { public: bool operator()(Node a, Node b) { if (a.val < b.val) { return false; } else if (b.val < a.v...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 53.35569381713867, "time_ms_p95": 61.50639057159423, "memory_mb_max": 1.4140625 }
{ "paradigm": [ "simulation" ], "technique": [ "sweep_line" ], "data_structures": [ "priority_queue", "map" ], "notes": "The solution uses a sweep-line approach with a priority queue to process segment endpoints and count coverage intervals." }
1000_D
null
1
#include <bits/stdc++.h> #pragma GCC optimize("O2") using namespace std; long long n; long long v[1002]; long long dp[1002]; long long combi[1002][1002]; void pascal() { combi[0][0] = combi[1][0] = combi[1][1] = 1; for (int i = 2; i <= 1000; ++i) { combi[i][0] = 1; for (int j = 1; j <= i; ++j) combi[i...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 51.494598388671875, "time_ms_p95": 61.43145561218261, "memory_mb_max": 1.5390625 }
{ "paradigm": [ "dynamic_programming" ], "technique": [ "dp_1d", "combinatorics" ], "data_structures": [ "array", "matrix_2d" ], "notes": "The solution uses DP to count valid subsequences by precomputing combinations and iterating through possible good array lengths." }
1000_D
null
5
#include <bits/stdc++.h> long long mod = 998244353; long long Pow(long long x, long long y) { long long ans = 1; for (long long i = 1; y; i <<= 1, x = x * x % mod) if (y & i) { ans = ans * x % mod; y ^= i; } return ans; } long long prod[1100] = {0}; long long Comb(long long x, long long y) { ...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 54.09359931945801, "time_ms_p95": 351.13625526428206, "memory_mb_max": 3.5078125 }
{ "paradigm": [ "dynamic_programming" ], "technique": [ "dp_1d", "combinatorics", "modular_arithmetic" ], "data_structures": [ "array" ], "notes": "The solution uses DP to count valid subsequences by iterating backwards and using combinations to choose elements for each good array." }
1000_D
14
9
#include <bits/stdc++.h> using namespace std; const long long N = 1e3 + 5; const long long inf = -1e18; const long long mod = 998244353; long long fact[N], invfact[N]; long long dp[N], pref[N]; long long binpow(long long b, long long p) { long long res = 1; while (p) { if (p & 1) res = (res * b) % mod; b = ...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 76.26962661743164, "time_ms_p95": 79.07214164733887, "memory_mb_max": 1.546875 }
{ "paradigm": [ "dynamic_programming" ], "technique": [ "dp_1d", "combinatorics", "modular_arithmetic" ], "data_structures": [ "array" ], "notes": "The solution uses DP to count valid subsequences by choosing elements to form good arrays, utilizing combinations to account for the numbe...
1000_D
15
10
#include <bits/stdc++.h> using namespace std; int main() { long long n, a[1000], f[1001] = {}, m = 998244353, c[1001][1001] = {}, fc[1001] = {}; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i <= 1000; i++) for (int j = 0; j <= 1000; j++) { if (j > i) ...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 52.63352394104004, "time_ms_p95": 60.46741008758545, "memory_mb_max": 1.53515625 }
null
1000_D
null
15
#include <bits/stdc++.h> using namespace std; int main() { long long n, a[1000], f[1001] = {}, m = 998244353, c[1001][1001] = {}, fc[1001] = {}; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i <= 1000; i++) for (int j = 0; j <= 1000; j++) { if (j > i) ...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 50.01354217529297, "time_ms_p95": 60.91561317443848, "memory_mb_max": 1.4765625 }
{ "paradigm": [ "dynamic_programming" ], "technique": [ "dp_1d", "combinatorics" ], "data_structures": [ "array", "matrix_2d" ], "notes": "The solution uses DP to count valid subsequences by precomputing combinations and iterating backwards through the array." }
1000_D
30
21
#include <bits/stdc++.h> using namespace std; const long long int Maxn3 = 1e3 + 10; const long long int Maxn4 = 1e4 + 10; const long long int Maxn5 = 1e5 + 10; const long long int Maxn6 = 1e6 + 10; const long long int Maxn7 = 1e7 + 10; const long long int Maxn8 = 1e8 + 10; const long long int Maxn9 = 1e9 + 10; const lo...
a
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 51.01776123046875, "time_ms_p95": 60.625672340393066, "memory_mb_max": 1.28125 }
null
1000_D
null
32
#include <bits/stdc++.h> using namespace std; const long long int mod = 998244353; const long long int inf = 1e18; const long long int N = 1e3 + 5; long long int n; long long int a[N]; long long int dp[N][N]; long long int solve(long long int idx, long long int cnt) { if (idx == n + 1) { return cnt == 0; } lo...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 51.699161529541016, "time_ms_p95": 58.75101089477539, "memory_mb_max": 1.0234375 }
null
1000_D
57
35
#include <bits/stdc++.h> using namespace std; template <typename t> t in(t q) { cin >> q; return q; } template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) { os << "["; for (int i = 0; i < ((int)size(v)); ++i) { os << v[i]; if (i != ((int)size(v)) - 1) os << ","; } os << "]"; ...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 67.77167320251465, "time_ms_p95": 81.52174949645996, "memory_mb_max": 0.7734375 }
{ "paradigm": [ "dynamic_programming" ], "technique": [ "dp_1d", "combinatorics" ], "data_structures": [ "array", "matrix_2d" ], "notes": "The solution uses DP to count valid subsequences by precomputing combinations and iterating through possible start positions of good arrays." }
1000_D
null
37
#include <bits/stdc++.h> template <typename T> T max(T x, T y) { return (x > y) ? x : y; } template <typename T> T min(T x, T y) { return (x < y) ? x : y; } template <typename T> bool chkmax(T &x, T y) { return (x >= y) ? 0 : (x = y, 1); } template <typename T> bool chkmin(T &x, T y) { return (x <= y) ? 0 : (x ...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 50.68516731262207, "time_ms_p95": 59.087181091308594, "memory_mb_max": 1.01171875 }
{ "paradigm": [ "dynamic_programming" ], "technique": [ "dp_2d" ], "data_structures": [ "matrix_2d" ], "notes": "The solution uses 2D DP to count subsequences by tracking the number of elements needed to complete the current good array." }
1000_D
72
43
#include <bits/stdc++.h> using namespace std; template <typename T, typename U> std::istream& operator>>(std::istream& i, pair<T, U>& p) { i >> p.first >> p.second; return i; } template <typename T> std::istream& operator>>(std::istream& i, vector<T>& t) { for (auto& v : t) { i >> v; } return i; } templat...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 69.58150863647461, "time_ms_p95": 82.31320381164551, "memory_mb_max": 0.7265625 }
{ "paradigm": [ "dynamic_programming" ], "technique": [ "dp_2d" ], "data_structures": [ "matrix_2d" ], "notes": "The solution uses 2D DP to count valid subsequences by tracking the current index and the remaining length required for the current good array." }
1000_D
100
62
#include <bits/stdc++.h> using namespace std; int a[1005]; long long dp[1005], c[1005][1005]; long long ans; int mod = 998244353; int main() { int n; cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = 1; i <= 1000; i++) { for (int j = 1; j <= 1000; j++) { if (j == 1) c[i][j] = i;...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 54.56733703613281, "time_ms_p95": 69.89564895629881, "memory_mb_max": 1.2734375 }
{ "paradigm": [ "dynamic_programming" ], "technique": [ "dp_1d", "combinatorics" ], "data_structures": [ "array", "matrix_2d" ], "notes": "The solution uses DP to count valid subsequences by precomputing combinations and iterating backwards through the array." }
1000_D
107
66
#include <bits/stdc++.h> using namespace std; const int maxn = 1 * 1e3 + 17; const long long MOD = 7LL * 17LL * (1LL << 23) + 1LL; int N; int arr[maxn]; long long DP[maxn][maxn]; long long solve(int i, int rem) { if (i >= N) return !rem; if (DP[i][rem] != -1LL) return DP[i][rem]; long long skip = solve(i + 1, rem...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 67.20280647277832, "time_ms_p95": 78.8994312286377, "memory_mb_max": 3.91015625 }
null
1000_D
110
68
#include <bits/stdc++.h> using namespace std; const long long INF = 1e15; const long long MAX = 2e6 + 7; const long long MOD = 998244353; const long double PI = 3.141592653589793238463; vector<string> vec_splitter(string s) { for (char& c : s) c = c == ',' ? ' ' : c; stringstream ss; ss << s; vector<string> res...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 99.63655471801758, "time_ms_p95": 128.1062126159668, "memory_mb_max": 42.31640625 }
null
1000_D
120
74
#include <bits/stdc++.h> FILE *in = stdin; FILE *out = stdout; long long d[1004][1004]; long long d2[1004][1004]; long long d3[1004][1004]; long long Com[1004][1004]; int board[1004]; int n; int main() { int i, j, k, l; fscanf(in, "%d", &n); for (i = 0; i < n; i++) { fscanf(in, "%d", &board[i]); } Com[0][...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 52.28710174560547, "time_ms_p95": 253.92949581146226, "memory_mb_max": 30.34375 }
{ "paradigm": [ "dynamic_programming" ], "technique": [ "dp_2d", "combinatorics" ], "data_structures": [ "matrix_2d" ], "notes": "The solution uses 2D DP to count valid subsequences by combining good arrays using combinatorial precomputations." }
1000_D
125
77
#include <bits/stdc++.h> #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") using namespace std; long long gcd(long long a, long long b) { return (a == 0) ? b : gcd(b % a, a); } long long cnt1(long long x) { long long cnt = 0; while (x > 0) ...
null
{ "compile_ok": true, "n_completed": 15, "n_passed": 15, "n_testcases_used": null, "n_timeout": 0, "n_runtime_err": 0, "pass_rate": 1, "time_ms_median": 76.42793655395508, "time_ms_p95": 81.91306591033936, "memory_mb_max": 0.7265625 }
{ "paradigm": [ "dynamic_programming" ], "technique": [ "dp_1d", "combinatorics" ], "data_structures": [ "vector", "matrix_2d" ], "notes": "The solution uses DP to count valid subsequences by precomputing combinations and iterating backwards through the array." }
End of preview. Expand in Data Studio

DivAlgo human pools

The accepted human C++ solutions behind the human reference numbers in the DivAlgo paper: 26,145 solutions over the 1,000 test problems (median 25 per problem), every one passing all sampled test cases. These pools give the human diversity ceilings, the Vendi-versus-k curves, the popularity measurements and, through their labels, the human coverage figures.

Paper: DivAlgo: A systematic evaluation of algorithmic diversity for code generation models. Code: https://github.com/anubhav-jangra/divalgo. Main dataset: jangraanubhav/DivAlgo.

Record

field description
inst_id, prog_id, idx problem id, submission id (null when unavailable), candidate index
code the verbatim C++ submission
is_reference "a" / "b" if this is one of the problem's two DivAlgo reference solutions, else null
exec test-case record: compile_ok, n_passed, n_testcases_used, timings, memory
ontology_label paradigm, technique, data_structures, notes, or null

Labels cover up to 25 non-reference members per problem on the 920 test problems whose reference pair differs at some ontology layer (19,939 members). Diversity ceilings use all members, references included; coverage uses the labelled non-reference members.

Licence

CC BY 4.0. Solutions originate from Code-Contests-Plus (CC BY 4.0).

@article{jangra2026divalgo,
  title   = {DivAlgo: A systematic evaluation of algorithmic diversity for code generation models},
  author  = {Jangra, Anubhav and Muresan, Smaranda},
  journal = {arXiv preprint arXiv:2610.19157},
  year    = {2026}
}
Downloads last month
5

Paper for jangraanubhav/DivAlgo-human-pools