text stringlengths 10 22.5k | status stringclasses 2
values | name stringlengths 9 26 |
|---|---|---|
#include <bits/stdc++.h>
// #define int long long
using namespace std;
// void db() {
// int n, m;
// cin >> n >> m;
// for (int i = 0; i <= n * m; i++) {
// for (int j = 0; j <= n * m; j++) {
// std::cout << i * j % (n * m) << "\t";
// }
// std::cout << "\n";
// }
/... | failed | 80_2_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
struct node {
string s;
char str;
} s[1010];
bool cmp(node a, node b) { return a.str < b.str; }
int main() {
int t;
cin >> t;
for (int i = 0; i < t; i++) {
getchar();
getline(cin, s[i].s);
}
for (int i = 0; i < t; i++) {
for (int j = 0; j < s[i]... | failed | 57_2_wrong.cpp |
#include <algorithm>
#include <iostream>
#include <vector>
constexpr int N = 2e5 + 50;
int L, B;
int C[N], index[N];
std::vector<std::vector<int>> button;
std::vector<int> val, fin;
int main() {
std::ios::sync_with_stdio(0), std::cin.tie(0), std::cout.tie(0);
std::cin >> L >> B;
button.resize(L + 1);
val.res... | failed | 116_3_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
#define int __int128
const int p = 998244353;
int po(int a, int b) {
if (b == 0)
return 1;
if (b == 1)
return a;
if (b % 2 == 0) {
int u = po(a, b / 2);
return (u * 1LL * u) % p;
} else {
int u = po(a, b - 1);
return (a * 1LL * u) % p;
}
}... | failed | 14_1_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
struct node {
string s;
char str;
} s[1010];
bool cmp(node a, node b) { return a.str < b.str; }
int main() {
int t;
cin >> t;
for (int i = 0; i < t; i++) {
getchar();
getline(cin, s[i].s);
}
for (int i = 0; i < t; i++) {
for (int j = 0; j < s[i]... | failed | 57_1_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define all(x) (x).begin(), (x).end()
typedef long long i64;
typedef pair<int, int> pii;
const int N = 1e6 + 10;
i64 nxt[N][26], cnt[N], score[N], ans, sz;
vector<i64> son[N];
void insert(string &s) {
int j = 0;
for (auto ch : s) {
int t = ch - '... | failed | 40_2_wrong.cpp |
#include <bits/stdc++.h>
#define ing long long
using namespace std;
using LL = __int128;
int n, m, k;
struct node {
int ter, val;
};
struct arr {
int x;
LL y;
};
struct shop {
LL d;
long double p;
};
int cmp(shop x, shop y) { return x.d < y.d; }
bool operator<(const arr &x, const arr &y) { return x.y > y.y; }... | failed | 65_3_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define pb push_back
const ld pi = 3.14159265358979323846;
const int mod = (int)1e9 + 7;
const ll INF = 1e18;
template <typename T> T chmax(T a, T b) { return a > b ? a : b; }
template <typename T> T chmin(T a, T b) { return... | failed | 66_1_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 2e5 + 5, inf = 1e18;
int n, m, p[N], qz[N];
double f[15][N];
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n >> m;
for (int i = 1; i <= n; i++) {
cin >> p[i];
}
sort(p + 1, p + n + 1);
for (i... | failed | 5_2_wrong.cpp |
#include <algorithm>
#include <cstdio>
using namespace std;
const int max1 = 2e5 + 2;
const int mod = 998244353;
int power[max1 + 5], fac[max1 + 5], inv[max1 + 5], ifac[max1 + 5];
int T, n, m, a[max1 + 5];
int cnt[max1 + 5];
int C(int n, int m) {
if (n < 0 || m < 0 || n < m)
return 0;
return 1LL * fac[n] ... | failed | 54_2_wrong.cpp |
#include <algorithm>
#include <array>
#include <iostream>
#include <numeric>
#include <vector>
using namespace std;
constexpr int N = 5e5;
int cnt[N * 2];
bool ans[N], bad[N * 2];
struct Graph {
int ofs[N + 2], nei[N * 2], tin[N], tout[N], ntin[N * 2], ct, rt;
void calct(int v, int p) {
tin[v] = ct++;
... | failed | 43_2_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
using ll = long long;
using db = double;
int n, m;
const db eps = 1e-10;
const int maxn = 1e5 + 10;
int a[maxn], b[maxn];
int ct, c[maxn * 6];
int al[maxn * 6], ar[maxn * 6];
int bl[maxn * 6], br[maxn * 6];
db cross(pair<db, db> p, pair<d... | failed | 112_1_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pii pair<int, int>
const int N = 1e6 + 10;
const int mod = 998244353;
void solve() {
int n, k;
cin >> n >> k;
vector<int> a(n);
priority_queue<int> q;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
q.push(x);
}
int res... | failed | 74_3_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define int ll
constexpr int N = 200100, M = 200;
ll sum[N * M], tag[N * M];
int ls[N * M], rs[N * M], tot;
void init() { tot = 0; }
void modify(int &k, int o, int l, int r, int L, int R) {
k = o;
if (R < L)
return;
k = ++tot;
sum[k] = ... | failed | 28_1_wrong.cpp |
#include <bits/stdc++.h>
using i64 = long long;
using u64 = unsigned long long;
using u32 = unsigned;
using u128 = unsigned __int128;
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
constexpr int N = 5;
int x[N], y[N]{};
for (int i = 0; i < N; i++) {
std::cin >> x[i] >> y[i];
}... | failed | 59_3_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
const int N = 3010, M = 1e6 + 10;
const double eps = 1e-8;
int n, sum[M];
double w;
struct Line {
double x, u, d;
int uid, did;
Line() {}
Line(double x, double u, double d, int uid, int did)
: x(x), u(u), d(d), uid(uid), did(did) {}
} l[N];
struct Node {
... | failed | 108_3_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define PII pair<int, int>
#define ai4 array<int, 4>
#define ai3 array<int, 3>
const int N = 50010, mod = 1e9 + 7, inf = 1e9;
bool cmp(PII a, PII b) {
if (a.second == b.second)
return a.first < b.first;
return a.second > b.second;
}
void solv... | failed | 11_1_wrong.cpp |
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define f first
#define s second
#define sz(x) (int)(x).size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define ios \
ios_base::sync_with_stdio(false); ... | failed | 34_3_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
const int MOD = 998244353;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int x, n, m;
cin >> x >> n >> m;
vector<int> people, houses;
for (int i = 0; i < n + m; ++i) {
int p;
char t;
cin >> p >> t;
if (t == 'P') {
peo... | failed | 103_3_wrong.cpp |
#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
// const ll mod = 1e9 + 7;
// #include <brawlstars>
// FOR PAIN OR FOR GLORYYY ELLL PRIMOOOOOO
const ll N = 2e5 + 1;
ll a[N], nxt[N], deg[N], dst[N], pos[N], vis[N], merg[N], ans[N];
signed m... | failed | 47_2_wrong.cpp |
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
bool isLexSmaller(const vector<int> &a, const vector<int> &b) {
int n = a.size(), m = b.size();
int len = min(n, m);
for (int i = 0; i < len; i++) {
if (a[i] != b[i])
return a[i] < b[i];
}
return n <= m; // Changed to ... | failed | 27_3_wrong.cpp |
#include <bits/stdc++.h>
#define N 300005
using namespace std;
int n, m, t[N], r[N][2], f[N][2], ans = 1e9;
queue<pair<int, int>> q;
vector<int> vec[N][2];
void jb(int u, int v) {
vec[v][t[u]].push_back(u);
r[u][t[v]]++;
}
int main() {
scanf("%d%d", &n, &m);
for (int i = 1; i <= n; i++)
scanf("%d", &t[i]);
... | failed | 58_3_wrong.cpp |
// This is a wrong code file
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int p = 998244353;
int po(int a, int b) {
if (b == 0)
return 1;
if (b == 1)
return a;
if (b % 2 == 0) {
int u = po(a, b / 2);
return (u * 1LL * u) % p;
} else {
int u = po(a, b - 1);
r... | failed | 17_2_wrong.cpp |
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 5010;
const int mod = 998244353;
int n, f[N][N], g[N], fac[N], inv[N];
int sz[N], prod[N], iprod[N];
vector<int> e[N];
int qpow(int a, int b) {
int ans = 1;
while (b) {
if (b & 1)
ans = 1ll * ans * a % mod;
a = 1ll * a ... | failed | 49_2_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5e5 + 5;
vector<int> T1[MAXN], T[MAXN];
int parent_T[MAXN];
bool valid[MAXN];
int in_time[MAXN], out_time[MAXN];
int dfs_time;
int n;
void build_parents(int u, const vector<int> tree[], int parent[]) {
fill(parent, parent + n + 1, -1);
queue<int> q;
... | failed | 43_3_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pil pair<int, ll>
#define x first
#define y second
inline int read() {
int x = 0, f = 0;
char ch = getchar();
while (!isdigit(ch))
f = ch == '-', ch = getchar();
while (isdigit(ch))
x = (x << 3) + (x << 1) + (ch ^ 48), ch = ge... | failed | 39_2_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double __float128
const double eps = 1e-12;
struct ss {
double x, y;
double len() { return sqrtl(x * x + y * y); }
double operator*(const ss ot) const { return x * ot.x + y * ot.y; }
ss operator-(const ss ot) const { return (ss){x - ot.... | failed | 113_2_wrong.cpp |
#include <iostream>
#include <string>
#include <vector>
using namespace std;
const int MAXN = 1024;
int n;
vector<string> best_solution;
int max_pieces = 0;
// Axial coordinates for hexagonal grid
struct Hex {
int q, r;
Hex(int q = 0, int r = 0) : q(q), r(r) {}
};
// V-piece orientations (axial coordinates)
con... | failed | 73_2_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
void solve() {
int n, k, m;
cin >> n >> k >> m;
vector<bool> ban(n);
for (int i = 0; i < m; i++) {
char c;
cin >> c;
if (c - '0' <= 9) {
ban[c - '0'] = 1;
} else {
ban[c - 'A' + 10] = 1;
}
}
int base = n - m;
vector<int> mp(ba... | failed | 90_2_wrong.cpp |
#include <bits/stdc++.h>
using i64 = long long;
constexpr int p = 998244353;
void sol() {
int n;
std::string s;
std::cin >> n >> s;
int cnt = 0;
int l = 0, r = 0;
for (int i = 0; i < n; i++) {
if (s[i] == '1') {
int cnt1 = 1, cnt0 = 0;
l = i;
r = l + 1;
while (r < n) {
... | failed | 69_1_wrong.cpp |
#pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#define db std::cout << "debug\n"
#define ll long long
ll m;
std::string S;
struct Pree {
bool isaccept;
int acctime, trynum;
Pree(bool a, int b, int c) : isaccept(a), acctime(b), trynum(c) {}
void disp() {
if (isaccept)
std::cout <<... | failed | 16_1_wrong.cpp |
#include <iostream>
#include <string>
#include <vector>
using namespace std;
const int MAXN = 10005;
const int MAXW = 53;
const int INF = 1000000000;
int n, w;
string best_schedule[MAXW];
string curr_schedule[MAXW];
int best_isolation;
// Function to find when two people meet
void findMeetings(int team1, int member1... | failed | 111_3_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 998244353;
vector<ll> primes;
void factorize(ll n) {
primes.clear();
for (ll i = 2; i * i <= n; i++) {
if (n % i == 0) {
primes.push_back(i);
while (n % i == 0)
n /= i;
}
}
if (n > 1)
primes.pu... | failed | 42_1_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
#define int long long
using pii = pair<int,int>;
#define F first
#define S second
#define rep(i,a,b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
using ll = long long;
typedef vector<int> vi;
#define pb push_back
#define vt ve... | failed | 95_2_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
namespace wzhqwq {
namespace sam {
map<char, int> trans[400000];
int fail[400000], len[400000], pre[400000], nodetot;
void init() { nodetot = 0, fail[0] = -1, len[0] = 0, trans[0].clear(); }
int append(int p, char c) {
int cur = ++nodetot;
for (len[cur] = len[p] + 1, pr... | failed | 53_1_wrong.cpp |
// Problem: D. Decrease and Swap
// Contest: Universal Cup - The 3rd Universal Cup. Stage 29: Metropolis
// URL: https://contest.ucup.ac/contest/1913/problem/9040
// Memory Limit: 1024 MB
// Time Limit: 1000 ms
//
// Powered by CP Editor (https://cpeditor.org)
#include <bits/stdc++.h>
#define ll long long
#define pb ... | failed | 69_3_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pii pair<int, int>
const int N = 200010;
int prime[N], cnt;
int v[N], d[N], num[N];
int n, q;
int val[N];
int a[N];
void euler() {
int n = 200000;
d[1] = 1;
for (int i = 2; i <= n; i++) {
if (!v[i]) {
v[i] = 1;
prime[++cnt... | failed | 8_1_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
typedef pair<ll, ll> pll;
const ll INF = 1e15;
const ll MO9 = 998244353;
const ll MO1 = 1e9 + 7;
const ll MO = MO9;
const int N = 1e6 + 5;
const ll M = ~0ULL;
const ll LAZ = -1;
ll n,... | failed | 25_2_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
typedef long long LL;
constexpr int N = 20205, mod = 998244353;
constexpr LL INFLL = 0x3f3f3f3f3f3f3f3fll;
int n, m, K;
int a[N], b[N], c[N];
LL f[N], res1;
int g[N], res2;
void upd(LL &fy, int &gy, LL fx, int gx) {
if (fx < fy) {
fy = fx;
gy... | failed | 35_2_wrong.cpp |
#include <bits/stdc++.h>
#define int int64_t
using pii = std::pair<int, int>;
const int kMaxN = 4e5 + 5;
struct Node {
int t, id, op;
Node(int _t = 0, int _id = 0, int _op = 0) : t(_t), id(_id), op(_op) {}
friend bool operator<(const Node &n1, const Node &n2) {
if (n1.t != n2.t)
return n1.t < n2.t;
... | failed | 88_1_wrong.cpp |
#line 1 "/home/maspy/compro/library/my_template.hpp"
#if defined(LOCAL)
#include <my_template_compiled.hpp>
#else
// https://codeforces.com/blog/entry/96344
#pragma GCC optimize("Ofast,unroll-loops")
// いまの CF だとこれ入れると動かない?
// #pragma GCC target("avx2,popcnt")
#include <bits/stdc++.h>
using namespace std;
using ll ... | failed | 50_2_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define rep(i, n) for (int i = 0; i < (n); i += 1)
#define len(a) ((int)(a).size())
mt19937 rnd(234);
const ll inf = 1e18;
int gn;
int gm;
vector<vector<... | failed | 46_3_wrong.cpp |
#include <bits/stdc++.h>
using i64 = long long;
using u64 = unsigned long long;
using u32 = unsigned;
using u128 = unsigned __int128;
using F = __float128;
std::istream &operator>>(std::istream &is, F &a) {
int x;
is >> x;
a = x;
return is;
}
template <class T> struct Point {
T x;
T y;
Point(const T &x... | failed | 12_3_wrong.cpp |
#include <iostream>
#include <set>
#include <unordered_set>
#include <vector>
using namespace std;
void solve() {
int n, m, k;
cin >> n >> m >> k;
unordered_set<int> friends;
for (int i = 0; i < n; i++) {
int f;
cin >> f;
friends.insert(f);
}
// Store all comments
vector<pair<int, int>> co... | failed | 55_3_wrong.cpp |
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pdd pair<double, double>
#define F first
#define S second
#define all(x) x.begin(), x.end()
using namespace std;
pdd operator+(pdd a, pdd b) { return pdd(a.F + b.F, a.S + b.S); }
pdd operator-(pdd a) { return pdd(... | failed | 113_3_wrong.cpp |
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
namespace uvu {
#define LOCAL ____________DONT_DEFINE_ME____________
// #define ll long long
// #define inf 0x3f3f3f3f
#define int long long
... | failed | 103_1_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int mod = 998244353;
void solve() {
int n, k;
cin >> n >> k;
int res = -1;
vector<int> a(n + 1);
for (int i = 1; i <= n; i++)
cin >> a[i];
sort(a.begin() + 1, a.end(), greater<int>());
priority_queue<int> q;
for (int i = 1; ... | failed | 74_1_wrong.cpp |
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <time.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <iostream>
using namespace __... | failed | 56_2_wrong.cpp |
#include <bits/stdc++.h>
using i64 = long long;
void solve() {
std::string a, b, c;
std::cin >> a >> b >> c;
if (a.size() != b.size()) {
std::cout << "NO\n";
return;
}
if (a.size() != c.size()) {
std::cout << "YES\n";
return;
}
bool bad = 1;
for (int i = 0; i < a.size(); i++) {
b... | failed | 24_1_wrong.cpp |
#include <bits/stdc++.h>
#define int long long
const int P = 998244353; // 如果wa有可能需要换mod数
class Polynomial : public std::vector<int> {
static int multip(int a, int b) { return a * b % P; }
// static int multip(int a, int b)
// {
// int res = a * b - (int)(1.L * a * b / P) * P;
// res %= P;
// ... | failed | 54_3_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
void exgcd(int A, int B, LL &x, LL &y) {
if (!B)
return x = 1, y = 0, void();
exgcd(B, A % B, y, x);
y = y - A / B * x;
}
unordered_map<long long, bool> used;
int main() {
cin.tie(0)->sync_with_stdio(0);
int T;
cin >> T;
while (T--) {... | failed | 18_3_wrong.cpp |
#include <bits/stdc++.h>
#include <cmath>
#include <numbers>
#include <ranges>
#include <type_traits>
#ifdef LOCAL
#include "dd/debug.h"
#else
#define dbg(...) 42
#define dbg_proj(...) 420
#define dbg_rproj(...) 420420
void nline() {}
void bar() {}
void start_clock() {}
void end_clock() {}
#endif
namespace rs = std::... | failed | 5_3_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = array<int, 2>;
using pll = array<ll, 2>;
struct segtr {
int n;
vector<pll> data, delay;
segtr(int n) : n(n), data(4 * n, {0, -1}), delay(4 * n, {-1, -1}) {}
pll f(pll a, pll b) {
if (a[0] == b[0]) {
... | failed | 90_3_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define y1 y11
const int N = 500050;
vector<int> E[N], roots;
int x1[N], x2[N], y1[N], y2[N];
namespace Tree {
const int M = 2 * N;
int root, ls[M], rs[M], tsz;
bool done[N];
vector<pair<int, int>> pts[M];
void Build(int &c, int s... | failed | 75_1_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
#define int long long
using pii = pair<int, int>;
#define fi first
#define se second
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
using ll = long long;
typedef vector<int> vi;
#define pb push_back
signed... | failed | 44_1_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
int n, m;
const db eps = 1e-10;
const int maxn = 1e5 + 10;
int a[maxn], b[maxn];
int ct, c[maxn * 6];
int al[maxn * 6], ar[maxn * 6];
int bl[maxn * 6], br[maxn * 6];
db cross(pair<db, db> p, pair<db, db> q) {
return p.first * q.se... | failed | 112_2_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 500005;
int T, N, M, L[maxn], R[maxn], B[maxn << 1], Len, tree[maxn << 1], F[maxn << 1];
struct node {
int x, y;
bool operator<(const node &B) const {
return x < B.x || (x == B.x && y > B.y);
}
} A[maxn << 1];
void add(int x, int y) {
for (; x <... | failed | 19_2_wrong.cpp |
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;
const ll N = 5e4 + 4;
ll a[N], b[N];
ll mi[4 * N];
ll sm, n;
vector<int> u;
ll gcd(ll x, ll y) {
while (x * y > 0) {
if (x > y)
x %= y;
else
y %= x;
}
return x + y;
}
void mbuild(ll... | failed | 33_2_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 10;
int n, q, fa[N][20], on[N], dfn[N], sz[N], dep[N], dfsOrder;
vector<int> g[N];
struct node {
int x1, x2, y, tp, no;
friend bool operator<(const node &a, const node &b) { return a.y < b.y; }
};
struct BIT {
vector<int> tr;
BIT(int n) : tr(n + ... | failed | 75_3_wrong.cpp |
#include <bits/stdc++.h>
using i64 = long long;
using u64 = unsigned long long;
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
#include <initializer_list>
namespace nachia {
bool IsPrime(unsigned long long x) noexcept {
if (x <= 1)
return false;
if (x % 2 == 0)
return x == 2;
us... | failed | 42_2_wrong.cpp |
#include <bits/stdc++.h>
using i64 = long long;
using u64 = unsigned long long;
using u32 = unsigned;
using u128 = unsigned __int128;
struct BlockCutTree {
int n;
std::vector<std::vector<int>> adj;
std::vector<int> dfn, low, stk;
int cnt, cur;
std::vector<std::pair<int, int>> edges;
BlockCutTree() {}
Blo... | failed | 63_1_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
template <class T> int sgn(T x) { return (x > 0) - (x < 0); }
template <class T> struct Point {
typedef Point P;
T x, y;
explicit Point(T x = 0, T y = 0) : x(x), y(y) {}
bool operator<(P p) const { return tie(x, y) < tie(p.x, p.y); }
bool operator==(P p) const { ... | failed | 96_1_wrong.cpp |
#include "bits/stdc++.h"
using namespace std;
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define int long long
namespace static_rmq2 {
const int K = 20;
const int mxn = 1e6 + 5;
int N, a[mxn], st[K + 1][mxn];
inline void build() {
iota(st[0], st[0] + N, 0);
for (int i = 1; i <= K; i++)
for (... | failed | 4_3_wrong.cpp |
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 998244353;
inline int add(int x, int y) {
int ret = x + y;
if (ret >= mod)
ret -= mod;
return ret;
}
inline int sub(int x, int y) {
int ret... | failed | 18_2_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int add(int x, int y) {
x += y;
return x >= mod ? x - mod : x;
}
int mul(int x, int y) { return 1ll * x * y % mod; }
int qpow(int a, int b) {
int ans = 1;
while (b) {
if (b & 1) {
ans = mul(ans, a);
}
a = mul(a, a);
b... | failed | 30_1_wrong.cpp |
#ifdef local
#pragma GCC optimize(1)
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#endif
// #pragma comment(linker, "/STACK:102400000,102400000")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#in... | failed | 118_3_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
struct OpInfo {
int precedence;
bool is_left_assoc;
bool is_binary;
};
map<string, OpInfo> op_info = {
{"!", {4, false, false}},
{"=", {3, true, true}},
{"&", {2, true, true}},
{"|", {1, true, true}},
{"^", {0, true, true}},
};
vector<stri... | failed | 101_2_wrong.cpp |
#define NDEBUG
using namespace std;
// intrinstic
#include <immintrin.h>
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cfenv>
#include <cfloat>
#include <chrono>
#include <cinttypes>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdarg>
#in... | failed | 50_1_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr int mod = 998244353;
using COST_T = long long;
struct mfmc_edge {
int from, to;
long long mx;
long long cost; // for 1 flow
};
void max_flow_min_cost(vector<vector<pair<int, pair<ll, COST_T>>>> g_main,
int s, in... | failed | 76_2_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
const int M = 20;
bool con[M][M];
int col[M];
int cnt[2];
bool cyc;
void DFS(int u, const vector<int> &nodes) {
cnt[col[u]]++;
for (int v : nodes) {
if (con[u][v]) {
if (col[v] == -1) {
col[v] = col[u] ^ 1;
... | failed | 30_3_wrong.cpp |
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#incl... | failed | 58_1_wrong.cpp |
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2005, mod = 998244353;
char buf[1 << 24], *S, *T;
char gc() {
return S == T && (T = (S = buf) + fread(buf, 1, 1 << 24, stdin)) == buf
? 0
: *S++;
}
int read() {
char ch;
while ((ch = getchar()) <... | failed | 79_1_wrong.cpp |
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
using ldb = long double;
struct pt {
ldb x, y;
pt operator+(const pt &o) const { return {x + o.x, y + o.y}; };
pt operator-(const pt &o) const { return {x - o.x, y - o.y}; };
pt operator*(const ldb o) const { retur... | failed | 12_1_wrong.cpp |
#include <bits/stdc++.h>
using i64 = long long;
void sol() {
int n, m;
std::cin >> n >> m;
std::vector<int> a(n);
std::vector<int> b(m);
bool ok = false;;
if (n == 1 && m == 1) {
std::cout << "Yes\n";
std::cout << "1\n";
return;
}
if (n < m) {
std::iota... | failed | 87_1_wrong.cpp |
#include <bits/stdc++.h>
template <class T>
inline int qlog(T a) {
double x = a;
return ((*(long long*) & x) >> 52 & 2047) - 1023;
}
#define fopen LilyWhite
void fopen(const char *s) {
static char filename[32];
sprintf(filename, "%s.in", s);
freopen(filename, "r", stdin);
sprintf(filename, "%s.out",... | failed | 81_2_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
vector<int> g[maxn], vec;
int col[maxn];
void dfs(int u, int fu) {
for (int v : g[u])
if (v != fu)
col[v] = col[u] ^ 1, dfs(v, u);
}
void work() {
int n;
cin >> n;
for (int i = 1; i <= (n << 1); i++)
col[i] = 0, g[i].clear... | failed | 20_3_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
constexpr int LOG = 20;
using ll = long long;
constexpr ll INF = 1e10;
struct node {
int l{-1};
int r{-1};
int sz{1};
array<array<ll, 2>, 2> val;
};
void chmin(auto &x, auto y) { x = min(x, y); }
array<array<ll, 2>, 2> merge(const array<array<ll, 2>, 2> &lhs,
... | failed | 37_1_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
#define _rep(i_, a_, b_) for (int i_ = (a_); i_ <= (b_); ++i_)
#define mid ((L + R) >> 1)
#define multiCase() \
int testCnt = in(); \
_rep(curCase, 1, tes... | failed | 56_3_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
#define ll long double
#define pll pair<ll, ll>
#define x first
#define y second
const int N = 4e5 + 10;
int n;
pll p[N], v[N];
ll sumx, sumy, S;
ll ans;
ll cross(pll a, pll b) { return a.x * b.y - a.y * b.x; }
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; ... | failed | 67_1_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &a) {
#define gc getchar()
char c;
a = 0;
int f = 1;
while (!isdigit(c = gc))
if (c == '-')
f = -1;
do
a = a * 10 + c - '0';
while (isdigit(c = gc));
a *= f;
}
template <typename T> void write(T a) {
if (a < 0)... | failed | 116_1_wrong.cpp |
#include <bitset>
#include <cstdio>
#define ll long long
using namespace std;
const int B = 5000;
const int _N = 5e5 + B + 9;
const int D = _N / B + 1;
int N, M;
int Read() {
int x = 0;
char c = getchar();
while (c < '0' || c > '9')
c = getchar();
while (c >= '0' && c <= '9')
x = (x << 1) + (x << 3) +... | failed | 23_2_wrong.cpp |
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define endl '\n'
#define int l... | failed | 82_2_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
signed main() {
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
int r, c, p;
cin >> r >> c >> p;
vector<vector<double>> f(r, vector<double>(c));
for (int i = r - 1; i >= 0; i--) {
for (int j = c - 1; j >= 0; j--) {
double a =... | failed | 105_3_wrong.cpp |
// Start coding: 16:15
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
const ld EPS = 1e-5;
ld sq(ld x) { return x * x; }
bool eq(ld x, ld y) { return fabs(x - y) < EPS; }
bool addeq(ld x, ld y, ld z) { return eq(sq(sqrt(x) + sqrt(y)), z); }
ld S... | failed | 109_1_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
#define forn(i, n) for (int i = 0; i < (n); i++)
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define f first
#define s second
#define rand(i, j) uniform_int_distribution<ll>((ll)(i), (ll)(j))(rng)
mt19937 rng(std::chrono::steady_clock::now().time_since... | failed | 90_1_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MP make_pair
mt19937 rnd(time(0));
const int MAXN = 5e5 + 5;
const ll inf = 1e18;
int n, m, c, stk[MAXN], hd, tl;
ll a[MAXN], b[MAXN], f[MAXN];
inline ll F(ll x) { return upper_bound(b, b + m + 1, x) - b - 1; }
inline int w(int l, int r) { retur... | failed | 32_1_wrong.cpp |
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
int N, M, X, Y;
cin >> N >> M >> X >> Y;
vector<int> shelves(N), books(M);
for (int i = 0; i < N; i++) {
cin >> shelves[i];
}
for (int i = 0; i < M; i++) {
cin >> books[i];
}
sort(shelves.begin(), shelves.end());... | failed | 66_3_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int mod = 998244353;
int mul(int a, int b) { return (ll)a * b % mod; }
int main() {
int t;
scanf("%i", &t);
while (t--) {
int n, k;
scanf("%i %i", &n, &k);
vector<int> a(n);
for (int &i : a)
scanf("%i", &i);
sort(... | failed | 74_2_wrong.cpp |
#include <bits/stdc++.h>
#define forr(i, l, r) for (int i = l; i <= r; i++)
#define int long long
#define endl '\n'
using namespace std;
void solve() {
int n;
cin >> n;
vector<int> a(n + 1);
int maxn = 0, maxp;
forr(i, 1, n) {
cin >> a[i];
if (a[i] > maxn) {
maxn = a[i];
maxp = i;
}
... | failed | 36_3_wrong.cpp |
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define int ll
#define all(x) x.begin(), x.end()
// int h[4]={1,-1,0,0},z[4]={0,0,1,-1};
// const i... | failed | 99_3_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
#define int long long
int n, m, x, y;
int a[N], b[N];
int available[N];
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n >> m >> x >> y;
for (int i = 1; i <= n; ++i)
cin >> a[i];
for (int i = 1; i <= m; ... | failed | 66_2_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
#define int long long
using pii = pair<int, int>;
#define fi first
#define se second
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
using ll = long long;
typedef vector<int> vi;
#define pb push_back
vector... | failed | 104_3_wrong.cpp |
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <random>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace s... | failed | 78_3_wrong.cpp |
#include <bits/stdc++.h>
#define pii pair<int, int>
#define int long long
#define rep(i, s, e) for (int i = s; i <= e; i++)
using namespace std;
const int N = 4e5 + 10;
int n, k, a[N], b[N], p[N], d[N], belong[N], line[N], t, stp[N], vis[N], dis[N];
pii nxt[N];
vector<int> w[N], v[N];
deque<int> hull[N];
inline double ... | failed | 52_3_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
template <class F, class S>
ostream &operator<<(ostream &s, const pair<F, S> &v) {
s << "(" << v.first << ", " << v.second << ")";
return s;
}
template <ranges::range T>
requires(!is_convertible_v<T, string_view>)
istream &operator>>(istream &s, T &&v) {
for (auto... | failed | 6_2_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
vector<int> times;
vector<vector<ll>> dp;
int n, c;
// Returns maximum time among selected people
ll getMaxTime(int mask) {
ll maxTime = 0;
for (int i = 0; i < n; i++) {
if (mask & (1 << i)) {
maxTime = max(maxTime,... | failed | 117_3_wrong.cpp |
#include <algorithm>
#include <cstdio>
#include <vector>
constexpr int MAXN = 500000 + 2;
std::vector<int> G[MAXN], attack[MAXN];
int dep[MAXN], pa[MAXN];
void DFS(int u, int fa) {
dep[u] = dep[fa] + 1;
pa[u] = fa;
for (int v : G[u]) {
if (v != fa) {
DFS(v, u);
}
}
}
void update(int x, int y... | failed | 37_2_wrong.cpp |
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define pb push_back
#define int long long
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, q;
cin >> n >> q;
stack<int> s;
vector<int> a(n);
vector<int> c(n);
cin >> a[0];
c[0] = a[0];
s.push(0);
vector<int> nxt(n + ... | failed | 62_1_wrong.cpp |
#include <bits/stdc++.h>
#define int long long
using namespace std;
void solve() {
int n;
cin >> n;
vector<int> a(n + 1), tr(n + 1);
for (int i = 1; i <= n; i++) {
int x;
cin >> x;
a[x] = i;
}
int num = n * (n - 1) / 2;
for (int i = 1; i <= n; i++) {
int x;
cin >> x;
for (int j =... | failed | 82_1_wrong.cpp |
// In the name of God
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
const int maxn = 1e6 + 100;
const int lg = 31;
const int mod = 1e9 + 7;
const int inf = 3e8 + 100;
const ll INF = 1e18;
#defi... | failed | 32_3_wrong.cpp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.