Datasets:

problem_id
stringlengths
6
6
buggy_code
stringlengths
8
526k
fixed_code
stringlengths
12
526k
labels
listlengths
0
15
buggy_submission_id
int64
1
1.54M
fixed_submission_id
int64
2
1.54M
user_id
stringlengths
10
10
language
stringclasses
9 values
p02975
#include <iostream> #include <map> #include <string> #include <vector> using namespace std; int main() { long long int n; cin >> n; map<long long int, long long int> cnt; for (int i = 0; i < n; i++) { long long int a; cin >> a; cnt[a]++; } auto itr = cnt.begin(); auto itr1 = cnt.begin(); itr1++; auto itr2 = cnt.begin(); itr2++; itr2++; string ans; if (cnt.size() == 1) ans = (itr->first == 0) ? "Yes" : "No"; else if (cnt.size() == 2) { if (itr->first == 0) ans = (itr->second * 2 == itr1->second) ? "Yes" : "No"; // else if(itr1->first==0) ans=((itr->second)==itr1->second*2) ? "Yes":"No"; else ans = "No"; } else if (cnt.size() == 3) { if (itr->second == itr1->second && itr1->second == itr2->second) { ans = (itr->first ^ itr1->first == itr2->first) ? "Yes" : "No"; } else ans = "No"; } else ans = "No"; cout << ans << endl; return 0; }
#include <iostream> #include <map> #include <string> #include <vector> using namespace std; int main() { long long int n; cin >> n; map<long long int, long long int> cnt; for (int i = 0; i < n; i++) { long long int a; cin >> a; cnt[a]++; } auto itr = cnt.begin(); auto itr1 = cnt.begin(); itr1++; auto itr2 = cnt.begin(); itr2++; itr2++; string ans; if (cnt.size() == 1) ans = (itr->first == 0) ? "Yes" : "No"; else if (cnt.size() == 2) { if (itr->first == 0) ans = (itr->second * 2 == itr1->second) ? "Yes" : "No"; // else if(itr1->first==0) ans=((itr->second)==itr1->second*2) ? "Yes":"No"; else ans = "No"; } else if (cnt.size() == 3) { if (itr->second == itr1->second && itr1->second == itr2->second) { ans = ((itr->first ^ itr1->first) == itr2->first) ? "Yes" : "No"; } else ans = "No"; } else ans = "No"; cout << ans << endl; return 0; }
[ "control_flow.branch.if.condition.change" ]
781,607
781,608
u858670323
cpp
p02975
#include <iostream> #include <map> #include <string> #include <vector> using namespace std; int main() { int n; cin >> n; map<long long int, int> cnt; for (int i = 0; i < n; i++) { long long int a; cin >> a; cnt[a]++; } auto itr = cnt.begin(); auto itr1 = cnt.begin(); itr1++; auto itr2 = cnt.begin(); itr2++; itr2++; string ans; if (cnt.size() == 1) ans = (itr->first == 0) ? "Yes" : "No"; else if (cnt.size() == 2) { if (itr->first == 0) ans = (itr->second * 2 == itr1->second) ? "Yes" : "No"; // else if(itr1->first==0) ans=((itr->second)==itr1->second*2) ? "Yes":"No"; else ans = "No"; } else if (cnt.size() == 3) { if (itr->second == itr1->second && itr1->second == itr2->second) { ans = (itr->first ^ itr1->first == itr2->first) ? "Yes" : "No"; } else ans = "No"; } else ans = "No"; cout << ans << endl; return 0; }
#include <iostream> #include <map> #include <string> #include <vector> using namespace std; int main() { long long int n; cin >> n; map<long long int, long long int> cnt; for (int i = 0; i < n; i++) { long long int a; cin >> a; cnt[a]++; } auto itr = cnt.begin(); auto itr1 = cnt.begin(); itr1++; auto itr2 = cnt.begin(); itr2++; itr2++; string ans; if (cnt.size() == 1) ans = (itr->first == 0) ? "Yes" : "No"; else if (cnt.size() == 2) { if (itr->first == 0) ans = (itr->second * 2 == itr1->second) ? "Yes" : "No"; // else if(itr1->first==0) ans=((itr->second)==itr1->second*2) ? "Yes":"No"; else ans = "No"; } else if (cnt.size() == 3) { if (itr->second == itr1->second && itr1->second == itr2->second) { ans = ((itr->first ^ itr1->first) == itr2->first) ? "Yes" : "No"; } else ans = "No"; } else ans = "No"; cout << ans << endl; return 0; }
[ "control_flow.branch.if.condition.change" ]
781,609
781,608
u858670323
cpp
p02975
// include //------------------------------------------ #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <functional> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <utility> #include <vector> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iomanip> #include <iostream> #include <sstream> #include <string> #include <stdexcept> using namespace std; // type alias using ll = long long; using ull = unsigned long long; using comp = complex<double>; const ll MOD = 1000000007LL; const double PI = 3.14159265358979323846; // conversion //------------------------------------------ inline int toint(string s) { int v; istringstream sin(s); sin >> v; return v; } template <class t> inline string tostring(t x) { ostringstream sout; sout << x; return sout.str(); } // debug #define DUMP(x) cerr << #x << " = " << (x) << endl #define DEBUG(x) \ cerr << #x << " = " << (x) << " (l" << __line__ << ")" \ << " " << __file__ << endl // main function int main() { cin.tie(0); ios::sync_with_stdio(false); ll N; cin >> N; map<ll, ll> as; as[0] = 0; ll a; for (ll i = 0; i < N; ++i) { cin >> a; if (as.count(a)) { as[a] = 0; } ++as[a]; } if (as[0] == N) { cout << "Yes" << endl; } else { if (N % 3 != 0) { cout << "No" << endl; } else { if (as[0] == (N / 3)) { bool can_wear = false; for (auto iter = as.begin(); iter != as.end(); ++iter) { if (iter->first != 0 && iter->second == (N / 3) * 2) { can_wear = true; break; } } cout << (can_wear ? "Yes" : "No") << endl; } else if (as[0] == 0) { vector<ll> count_to_wear; for (auto iter = as.begin(); iter != as.end(); ++iter) { if (iter->first != 0 && iter->second == (N / 3)) { count_to_wear.emplace_back(iter->first); } } if (count_to_wear.size() == 3 && (count_to_wear[0] ^ count_to_wear[1]) == count_to_wear[2]) { cout << "Yes" << endl; } else { cout << "No" << endl; } } else { cout << "No" << endl; } } } return 0; }
// include //------------------------------------------ #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <functional> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <utility> #include <vector> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iomanip> #include <iostream> #include <sstream> #include <string> #include <stdexcept> using namespace std; // type alias using ll = long long; using ull = unsigned long long; using comp = complex<double>; const ll MOD = 1000000007LL; const double PI = 3.14159265358979323846; // conversion //------------------------------------------ inline int toint(string s) { int v; istringstream sin(s); sin >> v; return v; } template <class t> inline string tostring(t x) { ostringstream sout; sout << x; return sout.str(); } // debug #define DUMP(x) cerr << #x << " = " << (x) << endl #define DEBUG(x) \ cerr << #x << " = " << (x) << " (l" << __line__ << ")" \ << " " << __file__ << endl // main function int main() { cin.tie(0); ios::sync_with_stdio(false); ll N; cin >> N; map<ll, ll> as; as[0] = 0; ll a; for (ll i = 0; i < N; ++i) { cin >> a; if (as.count(a) == 0) { as[a] = 0; } ++as[a]; } if (as[0] == N) { cout << "Yes" << endl; } else { if (N % 3 != 0) { cout << "No" << endl; } else { if (as[0] == (N / 3)) { bool can_wear = false; for (auto iter = as.begin(); iter != as.end(); ++iter) { if (iter->first != 0 && iter->second == (N / 3) * 2) { can_wear = true; break; } } cout << (can_wear ? "Yes" : "No") << endl; } else if (as[0] == 0) { vector<ll> count_to_wear; for (auto iter = as.begin(); iter != as.end(); ++iter) { if (iter->first != 0 && iter->second == (N / 3)) { count_to_wear.emplace_back(iter->first); } } if (count_to_wear.size() == 3 && (count_to_wear[0] ^ count_to_wear[1]) == count_to_wear[2]) { cout << "Yes" << endl; } else { cout << "No" << endl; } } else { cout << "No" << endl; } } } return 0; }
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change" ]
781,610
781,611
u592290074
cpp
p02975
#include <bits/stdc++.h> using namespace std; #define _overload3(_1, _2, _3, name, ...) name #define _rep(i, n) repi(i, 0, n) #define repi(i, a, b) for (int i = int(a); i < int(b); ++i) #define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__) typedef long long ll; typedef pair<ll, ll> P; const ll INF = 1LL << 60; ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } ll modpow(ll a, ll n, ll mod) { ll res = 1; while (n > 0) { if (n & 1) res = res * a % mod; a = a * a % mod; n >>= 1; } return res; } int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; vector<ll> a(n); bool all_0 = true; rep(i, n) { cin >> a[i]; if (a[i] != 0) { all_0 = false; } } if (all_0) { cout << "Yes" << endl; } else { if (n % 3 != 0) { cout << "No" << endl; return 0; } map<ll, int> mp; rep(i, n) { mp[a[i]]++; } if (mp.size() == 3) { vector<ll> b; bool ok = true; for (auto p : mp) { b.push_back(p.first); if (p.second != n / 3) { ok = false; } } if ((b[0] ^ b[1] ^ b[2] == 0LL) && ok) { cout << "Yes" << endl; } else { cout << "No" << endl; } } else if (mp.size() == 2) { if (mp[0] == n / 3) { cout << "Yes" << endl; } else { cout << "No" << endl; } } else { cout << "No" << endl; } } return 0; }
#include <bits/stdc++.h> using namespace std; #define _overload3(_1, _2, _3, name, ...) name #define _rep(i, n) repi(i, 0, n) #define repi(i, a, b) for (int i = int(a); i < int(b); ++i) #define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__) typedef long long ll; typedef pair<ll, ll> P; const ll INF = 1LL << 60; ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } ll modpow(ll a, ll n, ll mod) { ll res = 1; while (n > 0) { if (n & 1) res = res * a % mod; a = a * a % mod; n >>= 1; } return res; } int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; vector<ll> a(n); bool all_0 = true; rep(i, n) { cin >> a[i]; if (a[i] != 0) { all_0 = false; } } if (all_0) { cout << "Yes" << endl; } else { if (n % 3 != 0) { cout << "No" << endl; return 0; } map<ll, int> mp; rep(i, n) { mp[a[i]]++; } if (mp.size() == 3) { vector<ll> b; bool ok = true; for (auto p : mp) { b.push_back(p.first); if (p.second != n / 3) { ok = false; } } if (((b[0] ^ (b[1] ^ b[2])) == 0LL) && ok) { cout << "Yes" << endl; } else { cout << "No" << endl; } } else if (mp.size() == 2) { if (mp[0] == n / 3) { cout << "Yes" << endl; } else { cout << "No" << endl; } } else { cout << "No" << endl; } } return 0; }
[ "control_flow.branch.if.condition.change" ]
781,619
781,620
u187878098
cpp
p02975
#include <algorithm> #include <iostream> #include <set> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> a(n); set<int> b; for (int i = 0; i < n; i++) { cin >> a[i]; b.insert(a[i]); } sort(a.begin(), a.end()); if (b.size() > 3) { cout << "No" << endl; } else if (b.size() == 3) { if (n % 3 != 0) { cout << "No" << endl; } else { vector<pair<int, int>> v; v.emplace_back(make_pair(a[0], 1)); for (int i = 1; i < n; i++) { if (a[i - 1] == a[i]) { v[v.size() - 1].second++; } else { v.emplace_back(make_pair(a[i], 1)); } } if ((v[0].first ^ v[1].first) == v[2].first && v[0].second * 3 == n && v[1].second * 3 == n) { cout << "Yes" << endl; } else { cout << "No" << endl; } } } else if (b.size() == 2) { if (n % 3 != 0) { cout << "No" << endl; } else { vector<pair<int, int>> v; v.emplace_back(make_pair(a[0], 1)); for (int i = 1; i < n; i++) { if (a[i - 1] == a[i]) { v[v.size() - 1].second++; } else { v.emplace_back(make_pair(a[i], 1)); } } if (v[0].first == 0 && v[1].second * 3 == n) { cout << "Yes" << endl; } else { cout << "No" << endl; } } } else { if (a[0] == 0) { cout << "Yes" << endl; } else { cout << "No" << endl; } } return 0; }
#include <algorithm> #include <iostream> #include <set> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> a(n); set<int> b; for (int i = 0; i < n; i++) { cin >> a[i]; b.insert(a[i]); } sort(a.begin(), a.end()); if (b.size() > 3) { cout << "No" << endl; } else if (b.size() == 3) { if (n % 3 != 0) { cout << "No" << endl; } else { vector<pair<int, int>> v; v.emplace_back(make_pair(a[0], 1)); for (int i = 1; i < n; i++) { if (a[i - 1] == a[i]) { v[v.size() - 1].second++; } else { v.emplace_back(make_pair(a[i], 1)); } } if ((v[0].first ^ v[1].first) == v[2].first && v[0].second * 3 == n && v[1].second * 3 == n) { cout << "Yes" << endl; } else { cout << "No" << endl; } } } else if (b.size() == 2) { if (n % 3 != 0) { cout << "No" << endl; } else { vector<pair<int, int>> v; v.emplace_back(make_pair(a[0], 1)); for (int i = 1; i < n; i++) { if (a[i - 1] == a[i]) { v[v.size() - 1].second++; } else { v.emplace_back(make_pair(a[i], 1)); } } if (v[0].first == 0 && v[0].second * 3 == n) { cout << "Yes" << endl; } else { cout << "No" << endl; } } } else { if (a[0] == 0) { cout << "Yes" << endl; } else { cout << "No" << endl; } } return 0; }
[ "control_flow.branch.if.condition.change" ]
781,623
781,624
u955202970
cpp
p02975
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define fi first #define se second #define pb push_back #define eb emplace_back #define sz(x) (int)(x).size() using namespace std; using ll = long long; using P = pair<int, int>; using vi = vector<int>; using vc = vector<char>; using vb = vector<bool>; using vs = vector<string>; using vll = vector<long long>; using vp = vector<pair<int, int>>; using vvi = vector<vector<int>>; using vvc = vector<vector<char>>; using vvll = vector<vector<long long>>; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (b < a) { a = b; return 1; } return 0; } int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vi a(n); rep(i, n) cin >> a[i]; map<int, int> mp; rep(i, n) mp[a[i]]++; bool ans = false; if (sz(mp) == 0 && a[0] == 0) { ans = true; } else if (n % 3 == 0 && sz(mp) == 2) { for (auto p : mp) if (p.fi == 0 && p.se == 1 * n / 3) ans = true; } else if (n % 3 == 0 && sz(mp) == 3) { vp x; for (auto p : mp) x.eb(p.fi, p.se); if ((x[0].fi ^ x[1].fi ^ x[2].fi) == 0 && x[0].se == n / 3 && x[1].se == n / 3) ans = true; } cout << (ans ? "Yes" : "No") << endl; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define fi first #define se second #define pb push_back #define eb emplace_back #define sz(x) (int)(x).size() using namespace std; using ll = long long; using P = pair<int, int>; using vi = vector<int>; using vc = vector<char>; using vb = vector<bool>; using vs = vector<string>; using vll = vector<long long>; using vp = vector<pair<int, int>>; using vvi = vector<vector<int>>; using vvc = vector<vector<char>>; using vvll = vector<vector<long long>>; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (b < a) { a = b; return 1; } return 0; } int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vi a(n); rep(i, n) cin >> a[i]; map<int, int> mp; rep(i, n) mp[a[i]]++; bool ans = false; if (sz(mp) == 1 && a[0] == 0) { ans = true; } else if (n % 3 == 0 && sz(mp) == 2) { for (auto p : mp) if (p.fi == 0 && p.se == n / 3) ans = true; } else if (n % 3 == 0 && sz(mp) == 3) { vp x; for (auto p : mp) x.eb(p.fi, p.se); if ((x[0].fi ^ x[1].fi ^ x[2].fi) == 0 && x[0].se == n / 3 && x[1].se == n / 3) ans = true; } cout << (ans ? "Yes" : "No") << endl; }
[ "literal.number.change", "control_flow.branch.if.condition.change", "expression.operation.binary.remove" ]
781,627
781,628
u009414205
cpp
p02975
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define fi first #define se second #define pb push_back #define eb emplace_back #define sz(x) (int)(x).size() using namespace std; using ll = long long; using P = pair<int, int>; using vi = vector<int>; using vc = vector<char>; using vb = vector<bool>; using vs = vector<string>; using vll = vector<long long>; using vp = vector<pair<int, int>>; using vvi = vector<vector<int>>; using vvc = vector<vector<char>>; using vvll = vector<vector<long long>>; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (b < a) { a = b; return 1; } return 0; } int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vi a(n); rep(i, n) cin >> a[i]; map<int, int> mp; rep(i, n) mp[a[i]]++; bool ans = false; if (sz(mp) == 1 && a[0] == 0) { ans = true; } else if (n % 3 == 0 && sz(mp) == 2) { for (auto p : mp) if (p.fi == 0 && p.se == 2 * n / 3) ans = true; } else if (n % 3 == 0 && sz(mp) == 3) { vp x; for (auto p : mp) x.eb(p.fi, p.se); if ((x[0].fi ^ x[1].fi ^ x[2].fi) == 0 && x[0].se == n / 3 && x[1].se == n / 3) ans = true; } cout << (ans ? "Yes" : "No") << endl; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define fi first #define se second #define pb push_back #define eb emplace_back #define sz(x) (int)(x).size() using namespace std; using ll = long long; using P = pair<int, int>; using vi = vector<int>; using vc = vector<char>; using vb = vector<bool>; using vs = vector<string>; using vll = vector<long long>; using vp = vector<pair<int, int>>; using vvi = vector<vector<int>>; using vvc = vector<vector<char>>; using vvll = vector<vector<long long>>; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (b < a) { a = b; return 1; } return 0; } int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vi a(n); rep(i, n) cin >> a[i]; map<int, int> mp; rep(i, n) mp[a[i]]++; bool ans = false; if (sz(mp) == 1 && a[0] == 0) { ans = true; } else if (n % 3 == 0 && sz(mp) == 2) { for (auto p : mp) if (p.fi == 0 && p.se == n / 3) ans = true; } else if (n % 3 == 0 && sz(mp) == 3) { vp x; for (auto p : mp) x.eb(p.fi, p.se); if ((x[0].fi ^ x[1].fi ^ x[2].fi) == 0 && x[0].se == n / 3 && x[1].se == n / 3) ans = true; } cout << (ans ? "Yes" : "No") << endl; }
[ "expression.operation.binary.remove" ]
781,629
781,628
u009414205
cpp
p02975
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> a(N); for (int i = 0; i < N; i++) cin >> a[i]; int S = a[0]; for (int i = 0; i < N; i++) S = S ^ a[i]; if (S == 0) cout << "Yes" << endl; else cout << "No" << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> a(N); for (int i = 0; i < N; i++) cin >> a[i]; int S = a[0]; for (int i = 1; i < N; i++) S = S ^ a[i]; if (S == 0) cout << "Yes" << endl; else cout << "No" << endl; return 0; }
[ "literal.number.change", "variable_declaration.value.change", "control_flow.loop.for.initializer.change", "expression.off_by_one", "control_flow.return.add", "control_flow.return.0.add" ]
781,638
781,639
u265359795
cpp
p02975
#pragma GCC optimize(2) #include <bits/stdc++.h> #define ll long long #define maxn 1000005 #define inf 1e9 #define eps 1e-10 using namespace std; inline int read() { int x = 0, w = 1; char c = getchar(); while (c < '0' || c > '9') { if (c == '-') w = -1; c = getchar(); } while (c <= '9' && c >= '0') { x = (x << 1) + (x << 3) + c - '0'; c = getchar(); } return w == 1 ? x : -x; } int n, b[5], cnt; set<int> s; map<int, int> mp; int main() { n = read(); for (int i = 1; i <= n; i++) { int x = read(); s.insert(x); mp[x]++; } if (s.size() == 1) { if (*s.begin() == 0) puts("Yes"); else puts("No"); } else if (s.size() == 2) { if (*s.begin() != 0 || n % 3 != 0 || mp[*s.begin()] != n / 3) puts("No"); else puts("Yes"); } else if (s.size() == 3) { if (*s.begin() == 0 || n % 3 != 0) puts("No"); else { int f = 0; for (set<int>::iterator it = s.begin(); it != s.end(); it++) { b[++cnt] = *it; if (mp[*it] != n / 3) f = 1; } if (f == 0 && b[1] == b[2] ^ b[3]) puts("Yes"); else puts("No"); } } else puts("No"); return 0; }
#pragma GCC optimize(2) #include <bits/stdc++.h> #define ll long long #define maxn 1000005 #define inf 1e9 #define eps 1e-10 using namespace std; inline int read() { int x = 0, w = 1; char c = getchar(); while (c < '0' || c > '9') { if (c == '-') w = -1; c = getchar(); } while (c <= '9' && c >= '0') { x = (x << 1) + (x << 3) + c - '0'; c = getchar(); } return w == 1 ? x : -x; } int n, b[5], cnt; set<int> s; map<int, int> mp; int main() { n = read(); for (int i = 1; i <= n; i++) { int x = read(); s.insert(x); mp[x]++; } if (s.size() == 1) { if (*s.begin() == 0) puts("Yes"); else puts("No"); } else if (s.size() == 2) { if (*s.begin() != 0 || n % 3 != 0 || mp[*s.begin()] != n / 3) puts("No"); else puts("Yes"); } else if (s.size() == 3) { if (*s.begin() == 0 || n % 3 != 0) puts("No"); else { int f = 0; for (set<int>::iterator it = s.begin(); it != s.end(); it++) { b[++cnt] = *it; if (mp[*it] != n / 3) f = 1; } if (f == 0 && b[1] == (b[2] ^ b[3])) puts("Yes"); else puts("No"); } } else puts("No"); return 0; }
[ "control_flow.branch.if.condition.change" ]
781,640
781,641
u766349042
cpp
p02975
#define _USE_MATH_DEFINES #include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <clocale> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #include <queue> #include <regex> #include <set> #include <sstream> #include <stack> #include <string> #include <tuple> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using namespace std; #define IOS \ ios::sync_with_stdio(false); \ cin.tie(0); #define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i) #define FORS(i, s, n) for (int i = (s), i##_len = (n); i <= i##_len; ++i) #define VFOR(i, s, n) for (int i = (s); i < (n); ++i) #define VFORS(i, s, n) for (int i = (s); i <= (n); ++i) #define REP(i, n) FOR(i, 0, n) #define REPS(i, n) FORS(i, 0, n) #define VREP(i, n) VFOR(i, 0, n) #define VREPS(i, n) VFORS(i, 0, n) #define RFOR(i, s, n) for (int i = (s), i##_len = (n); i >= i##_len; --i) #define RFORS(i, s, n) for (int i = (s), i##_len = (n); i > i##_len; --i) #define RREP(i, n) RFOR(i, n, 0) #define RREPS(i, n) RFORS(i, n, 0) #define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); ++i) #define IRREP(i, v) for (auto i = (v).rbegin(); i != (v).rend(); ++i) #define ALL(v) (v).begin(), (v).end() #define SORT(v) sort(ALL(v)) #define RSORT(v) sort(ALL(v), greater<decltype(v[0])>()) #define SZ(x) ((int)(x).size()) #define REV(x) reverse(ALL(x)) #define PB push_back #define EB emplace_back #define MP make_pair #define MT make_tuple #define BIT(n) (1LL << (n)) #define UNIQUE(v) v.erase(unique(ALL(v)), v.end()) using ld = long double; using ll = long long; using ui = unsigned int; using ull = unsigned long long; using Pi_i = pair<int, int>; using Pll_ll = pair<ll, ll>; using VB = vector<bool>; using VC = vector<char>; using VD = vector<double>; using VI = vector<int>; using VLL = vector<ll>; using VS = vector<string>; using VSH = vector<short>; using VULL = vector<ull>; const int MOD = 1000000007; const int INF = 1000000000; const int NIL = -1; const double EPS = 1E-10; template <class T, class S> bool chmax(T &a, const S &b) { if (a < b) { a = b; return true; } return false; } template <class T, class S> bool chmin(T &a, const S &b) { if (b < a) { a = b; return true; } return false; } int main() { int N; cin >> N; map<int, int> mp; VI a(N); REP(i, N) { int a; cin >> a; ++mp[a]; } if (mp.size() == 1) { cout << (mp[0] ? "Yes" : "No") << endl; return 0; } if (N % 3) { cout << "No" << endl; return 0; } if (mp.size() == 2) { int a((mp.begin())->first); if (a) { cout << "No" << endl; return 0; } cout << (((mp.begin())->second == N / 3 * 2) ? "Yes" : "No") << endl; return 0; } if (mp.size() == 3) { int i(0); VI a(3); IREP(itr, mp) { if (itr->second != N / 3) { cout << "No" << endl; return 0; } a[i] = itr->first; ++i; } cout << ((a[0] ^ a[1] ^ a[2]) ? "No" : "Yes") << endl; return 0; } cout << "No" << endl; return 0; }
#define _USE_MATH_DEFINES #include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <clocale> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #include <queue> #include <regex> #include <set> #include <sstream> #include <stack> #include <string> #include <tuple> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using namespace std; #define IOS \ ios::sync_with_stdio(false); \ cin.tie(0); #define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i) #define FORS(i, s, n) for (int i = (s), i##_len = (n); i <= i##_len; ++i) #define VFOR(i, s, n) for (int i = (s); i < (n); ++i) #define VFORS(i, s, n) for (int i = (s); i <= (n); ++i) #define REP(i, n) FOR(i, 0, n) #define REPS(i, n) FORS(i, 0, n) #define VREP(i, n) VFOR(i, 0, n) #define VREPS(i, n) VFORS(i, 0, n) #define RFOR(i, s, n) for (int i = (s), i##_len = (n); i >= i##_len; --i) #define RFORS(i, s, n) for (int i = (s), i##_len = (n); i > i##_len; --i) #define RREP(i, n) RFOR(i, n, 0) #define RREPS(i, n) RFORS(i, n, 0) #define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); ++i) #define IRREP(i, v) for (auto i = (v).rbegin(); i != (v).rend(); ++i) #define ALL(v) (v).begin(), (v).end() #define SORT(v) sort(ALL(v)) #define RSORT(v) sort(ALL(v), greater<decltype(v[0])>()) #define SZ(x) ((int)(x).size()) #define REV(x) reverse(ALL(x)) #define PB push_back #define EB emplace_back #define MP make_pair #define MT make_tuple #define BIT(n) (1LL << (n)) #define UNIQUE(v) v.erase(unique(ALL(v)), v.end()) using ld = long double; using ll = long long; using ui = unsigned int; using ull = unsigned long long; using Pi_i = pair<int, int>; using Pll_ll = pair<ll, ll>; using VB = vector<bool>; using VC = vector<char>; using VD = vector<double>; using VI = vector<int>; using VLL = vector<ll>; using VS = vector<string>; using VSH = vector<short>; using VULL = vector<ull>; const int MOD = 1000000007; const int INF = 1000000000; const int NIL = -1; const double EPS = 1E-10; template <class T, class S> bool chmax(T &a, const S &b) { if (a < b) { a = b; return true; } return false; } template <class T, class S> bool chmin(T &a, const S &b) { if (b < a) { a = b; return true; } return false; } int main() { int N; cin >> N; map<int, int> mp; VI a(N); REP(i, N) { int a; cin >> a; ++mp[a]; } if (mp.size() == 1) { cout << (mp[0] ? "Yes" : "No") << endl; return 0; } if (N % 3) { cout << "No" << endl; return 0; } if (mp.size() == 2) { int a((mp.begin())->first); if (a) { cout << "No" << endl; return 0; } cout << (((mp.begin())->second == N / 3) ? "Yes" : "No") << endl; return 0; } if (mp.size() == 3) { int i(0); VI a(3); IREP(itr, mp) { if (itr->second != N / 3) { cout << "No" << endl; return 0; } a[i] = itr->first; ++i; } cout << ((a[0] ^ a[1] ^ a[2]) ? "No" : "Yes") << endl; return 0; } cout << "No" << endl; return 0; }
[ "expression.operation.binary.remove" ]
781,644
781,645
u803893892
cpp
p02975
#include <bits/stdc++.h> using namespace std; #define debug(x) \ cout << "DEBUG" \ << " " << #x << ":" << x << '\n' // n回繰り返し #define rep(i, n) for (int i = 0; i < ((int)(n)); i++) // 0-indexed昇順 #define rep1(i, n) for (int i = 1; i <= ((int)(n)); i++) // 1-indexed昇順 #define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--) // 0-indexed降順 #define rrep1(i, n) for (int i = ((int)(n)); i >= 1; i--) // 1-indexed降順 #define all(x) (x).begin(), (x).end() typedef long long ll; typedef long double ld; typedef vector<int> vi; typedef vector<vi> vii; // 2次元配列 typedef vector<ll> vll; typedef vector<double> vd; typedef pair<int, int> PII; template <typename T> using vec = vector<T>; template <class T> using maxheap = std::priority_queue<T>; template <class T> using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>; template <class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return 1; } return 0; } template <class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return 1; } return 0; } const ld Pi = std::acos(-1.0L); const ll infll = (1LL << 62) - 1; const int inf = (1 << 30) - 1; const int mod = 1000000007; // const int mod = 998244353; /*FUNCs=================================================*/ /*MAIN==================================================*/ signed main() { int _StartTime_ = clock(); cin.tie(nullptr); ios::sync_with_stdio(false); // cin cout 高速化 // cout << fixed << setprecision(15); int n, p; cin >> n; map<int, int> a; rep(i, n) { cin >> p; ++a[p]; } if (a.size() == 1 && a.begin()->first == 0 && a.begin()->second == n) { cout << "Yes" << '\n'; return 0; } // Debug // for(auto p : a) { // debug(p.first); // debug(p.second); // } // debug(a.size()); // debug(a.begin()->second); // debug((++a.begin())->second); // debug(a.end()->second); if (n % 3 == 0 && a.size() == 2 && a.begin()->first == 0 && a.begin()->second == n / 3 && (++a.begin())->second == 2 * n / 3) { cout << "Yes" << '\n'; } else if (n % 3 == 0 && a.size() == 3 && a.begin()->second == n / 3 && (++a.begin())->second == n / 3 && (--a.end())->second == n / 3 && a.begin()->first ^ (++a.begin())->first ^ (--a.end())->first == 0) { cout << "No" << '\n'; } else cout << "No" << '\n'; // printf("ExecutionTime: %d // /ms\n",1000*(int)((clock()-_StartTime_)/CLOCKS_PER_SEC)); }
#include <bits/stdc++.h> using namespace std; #define debug(x) \ cout << "DEBUG" \ << " " << #x << ":" << x << '\n' // n回繰り返し #define rep(i, n) for (int i = 0; i < ((int)(n)); i++) // 0-indexed昇順 #define rep1(i, n) for (int i = 1; i <= ((int)(n)); i++) // 1-indexed昇順 #define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--) // 0-indexed降順 #define rrep1(i, n) for (int i = ((int)(n)); i >= 1; i--) // 1-indexed降順 #define all(x) (x).begin(), (x).end() typedef long long ll; typedef long double ld; typedef vector<int> vi; typedef vector<vi> vii; // 2次元配列 typedef vector<ll> vll; typedef vector<double> vd; typedef pair<int, int> PII; template <typename T> using vec = vector<T>; template <class T> using maxheap = std::priority_queue<T>; template <class T> using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>; template <class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return 1; } return 0; } template <class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return 1; } return 0; } const ld Pi = std::acos(-1.0L); const ll infll = (1LL << 62) - 1; const int inf = (1 << 30) - 1; const int mod = 1000000007; // const int mod = 998244353; /*FUNCs=================================================*/ /*MAIN==================================================*/ signed main() { int _StartTime_ = clock(); cin.tie(nullptr); ios::sync_with_stdio(false); // cin cout 高速化 // cout << fixed << setprecision(15); int n, p; cin >> n; map<int, int> a; rep(i, n) { cin >> p; ++a[p]; } if (a.size() == 1 && a.begin()->first == 0 && a.begin()->second == n) { cout << "Yes" << '\n'; return 0; } // Debug // for(auto p : a) { // debug(p.first); // debug(p.second); // } // debug(a.size()); // debug(a.begin()->second); // debug((++a.begin())->second); // debug(a.end()->second); if (n % 3 == 0 && a.size() == 2 && a.begin()->first == 0 && a.begin()->second == n / 3 && (++a.begin())->second == 2 * n / 3) { cout << "Yes" << '\n'; } else if (n % 3 == 0 && a.size() == 3 && a.begin()->second == n / 3 && (++a.begin())->second == n / 3 && (--a.end())->second == n / 3 && (a.begin()->first ^ (++a.begin())->first ^ (--a.end())->first) == 0) { cout << "Yes" << '\n'; } else cout << "No" << '\n'; // printf("ExecutionTime: %d // /ms\n",1000*(int)((clock()-_StartTime_)/CLOCKS_PER_SEC)); }
[ "control_flow.branch.if.condition.change", "literal.string.change", "io.output.change" ]
781,646
781,647
u457985479
cpp
p02975
#include <bits/stdc++.h> using namespace std; #define debug(x) \ cout << "DEBUG" \ << " " << #x << ":" << x << '\n' // n回繰り返し #define rep(i, n) for (int i = 0; i < ((int)(n)); i++) // 0-indexed昇順 #define rep1(i, n) for (int i = 1; i <= ((int)(n)); i++) // 1-indexed昇順 #define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--) // 0-indexed降順 #define rrep1(i, n) for (int i = ((int)(n)); i >= 1; i--) // 1-indexed降順 #define all(x) (x).begin(), (x).end() typedef long long ll; typedef long double ld; typedef vector<int> vi; typedef vector<vi> vii; // 2次元配列 typedef vector<ll> vll; typedef vector<double> vd; typedef pair<int, int> PII; template <typename T> using vec = vector<T>; template <class T> using maxheap = std::priority_queue<T>; template <class T> using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>; template <class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return 1; } return 0; } template <class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return 1; } return 0; } const ld Pi = std::acos(-1.0L); const ll infll = (1LL << 62) - 1; const int inf = (1 << 30) - 1; const int mod = 1000000007; // const int mod = 998244353; /*FUNCs=================================================*/ /*MAIN==================================================*/ signed main() { int _StartTime_ = clock(); cin.tie(nullptr); ios::sync_with_stdio(false); // cin cout 高速化 // cout << fixed << setprecision(15); int n, p; cin >> n; map<int, int> a; rep(i, n) { cin >> p; ++a[p]; } if (a.size() == 1 && a.begin()->first == 0 && a.begin()->second == n) { cout << "Yes" << '\n'; return 0; } // Debug // for(auto p : a) { // debug(p.first); // debug(p.second); // } // debug(a.size()); // debug(a.begin()->second); // debug((++a.begin())->second); // debug(a.end()->second); if (n % 3 == 0 && a.size() == 2 && a.begin()->first == 0 && a.begin()->second == n / 3 && (++a.begin())->second == 2 * n / 3) { cout << "Yes" << '\n'; } else if (n % 3 == 0 && a.size() == 3 && a.begin()->second == n / 3 && (++a.begin())->second == n / 3 && (--a.end())->second == n / 3 && a.begin()->first ^ (++a.begin())->first ^ (a.end())->first == 0) { cout << "No" << '\n'; } else cout << "No" << '\n'; // printf("ExecutionTime: %d // /ms\n",1000*(int)((clock()-_StartTime_)/CLOCKS_PER_SEC)); }
#include <bits/stdc++.h> using namespace std; #define debug(x) \ cout << "DEBUG" \ << " " << #x << ":" << x << '\n' // n回繰り返し #define rep(i, n) for (int i = 0; i < ((int)(n)); i++) // 0-indexed昇順 #define rep1(i, n) for (int i = 1; i <= ((int)(n)); i++) // 1-indexed昇順 #define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--) // 0-indexed降順 #define rrep1(i, n) for (int i = ((int)(n)); i >= 1; i--) // 1-indexed降順 #define all(x) (x).begin(), (x).end() typedef long long ll; typedef long double ld; typedef vector<int> vi; typedef vector<vi> vii; // 2次元配列 typedef vector<ll> vll; typedef vector<double> vd; typedef pair<int, int> PII; template <typename T> using vec = vector<T>; template <class T> using maxheap = std::priority_queue<T>; template <class T> using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>; template <class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return 1; } return 0; } template <class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return 1; } return 0; } const ld Pi = std::acos(-1.0L); const ll infll = (1LL << 62) - 1; const int inf = (1 << 30) - 1; const int mod = 1000000007; // const int mod = 998244353; /*FUNCs=================================================*/ /*MAIN==================================================*/ signed main() { int _StartTime_ = clock(); cin.tie(nullptr); ios::sync_with_stdio(false); // cin cout 高速化 // cout << fixed << setprecision(15); int n, p; cin >> n; map<int, int> a; rep(i, n) { cin >> p; ++a[p]; } if (a.size() == 1 && a.begin()->first == 0 && a.begin()->second == n) { cout << "Yes" << '\n'; return 0; } // Debug // for(auto p : a) { // debug(p.first); // debug(p.second); // } // debug(a.size()); // debug(a.begin()->second); // debug((++a.begin())->second); // debug(a.end()->second); if (n % 3 == 0 && a.size() == 2 && a.begin()->first == 0 && a.begin()->second == n / 3 && (++a.begin())->second == 2 * n / 3) { cout << "Yes" << '\n'; } else if (n % 3 == 0 && a.size() == 3 && a.begin()->second == n / 3 && (++a.begin())->second == n / 3 && (--a.end())->second == n / 3 && (a.begin()->first ^ (++a.begin())->first ^ (--a.end())->first) == 0) { cout << "Yes" << '\n'; } else cout << "No" << '\n'; // printf("ExecutionTime: %d // /ms\n",1000*(int)((clock()-_StartTime_)/CLOCKS_PER_SEC)); }
[ "control_flow.branch.if.condition.change", "literal.string.change", "io.output.change" ]
781,648
781,647
u457985479
cpp
p02975
#include <bits/stdc++.h> using namespace std; #define debug(x) \ cout << "DEBUG" \ << " " << #x << ":" << x << '\n' // n回繰り返し #define rep(i, n) for (int i = 0; i < ((int)(n)); i++) // 0-indexed昇順 #define rep1(i, n) for (int i = 1; i <= ((int)(n)); i++) // 1-indexed昇順 #define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--) // 0-indexed降順 #define rrep1(i, n) for (int i = ((int)(n)); i >= 1; i--) // 1-indexed降順 #define all(x) (x).begin(), (x).end() typedef long long ll; typedef long double ld; typedef vector<int> vi; typedef vector<vi> vii; // 2次元配列 typedef vector<ll> vll; typedef vector<double> vd; typedef pair<int, int> PII; template <typename T> using vec = vector<T>; template <class T> using maxheap = std::priority_queue<T>; template <class T> using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>; template <class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return 1; } return 0; } template <class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return 1; } return 0; } const ld Pi = std::acos(-1.0L); const ll infll = (1LL << 62) - 1; const int inf = (1 << 30) - 1; const int mod = 1000000007; // const int mod = 998244353; /*FUNCs=================================================*/ /*MAIN==================================================*/ signed main() { int _StartTime_ = clock(); cin.tie(nullptr); ios::sync_with_stdio(false); // cin cout 高速化 // cout << fixed << setprecision(15); int n, p; cin >> n; map<int, int> a; rep(i, n) { cin >> p; ++a[p]; } if (a.size() == 1 && a.begin()->first == 0 && a.begin()->second == n) { cout << "Yes" << '\n'; return 0; } // Debug // for(auto p : a) { // debug(p.first); // debug(p.second); // } // debug(a.size()); // debug(a.begin()->second); // debug((++a.begin())->second); // debug(a.end()->second); if (n % 3 == 0 && a.size() == 2 && a.begin()->first == 0 && a.begin()->second == n / 3 && (++a.begin())->second == 2 * n / 3) { cout << "Yes" << '\n'; } else if (n % 3 == 0 && a.size() == 3 && a.begin()->second == n / 3 && (++a.begin())->second == n / 3 && (--a.end())->second == n / 3 && a.begin()->first ^ (++a.begin())->first ^ (--a.end())->first == 0) { cout << "Yes" << '\n'; } else cout << "No" << '\n'; // printf("ExecutionTime: %d // /ms\n",1000*(int)((clock()-_StartTime_)/CLOCKS_PER_SEC)); }
#include <bits/stdc++.h> using namespace std; #define debug(x) \ cout << "DEBUG" \ << " " << #x << ":" << x << '\n' // n回繰り返し #define rep(i, n) for (int i = 0; i < ((int)(n)); i++) // 0-indexed昇順 #define rep1(i, n) for (int i = 1; i <= ((int)(n)); i++) // 1-indexed昇順 #define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--) // 0-indexed降順 #define rrep1(i, n) for (int i = ((int)(n)); i >= 1; i--) // 1-indexed降順 #define all(x) (x).begin(), (x).end() typedef long long ll; typedef long double ld; typedef vector<int> vi; typedef vector<vi> vii; // 2次元配列 typedef vector<ll> vll; typedef vector<double> vd; typedef pair<int, int> PII; template <typename T> using vec = vector<T>; template <class T> using maxheap = std::priority_queue<T>; template <class T> using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>; template <class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return 1; } return 0; } template <class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return 1; } return 0; } const ld Pi = std::acos(-1.0L); const ll infll = (1LL << 62) - 1; const int inf = (1 << 30) - 1; const int mod = 1000000007; // const int mod = 998244353; /*FUNCs=================================================*/ /*MAIN==================================================*/ signed main() { int _StartTime_ = clock(); cin.tie(nullptr); ios::sync_with_stdio(false); // cin cout 高速化 // cout << fixed << setprecision(15); int n, p; cin >> n; map<int, int> a; rep(i, n) { cin >> p; ++a[p]; } if (a.size() == 1 && a.begin()->first == 0 && a.begin()->second == n) { cout << "Yes" << '\n'; return 0; } // Debug // for(auto p : a) { // debug(p.first); // debug(p.second); // } // debug(a.size()); // debug(a.begin()->second); // debug((++a.begin())->second); // debug(a.end()->second); if (n % 3 == 0 && a.size() == 2 && a.begin()->first == 0 && a.begin()->second == n / 3 && (++a.begin())->second == 2 * n / 3) { cout << "Yes" << '\n'; } else if (n % 3 == 0 && a.size() == 3 && a.begin()->second == n / 3 && (++a.begin())->second == n / 3 && (--a.end())->second == n / 3 && (a.begin()->first ^ (++a.begin())->first ^ (--a.end())->first) == 0) { cout << "Yes" << '\n'; } else cout << "No" << '\n'; // printf("ExecutionTime: %d // /ms\n",1000*(int)((clock()-_StartTime_)/CLOCKS_PER_SEC)); }
[ "control_flow.branch.if.condition.change" ]
781,649
781,647
u457985479
cpp
p02975
#include <bits/stdc++.h> #define ll long long int #define MOD 1000000007 #define INF 1e18 using namespace std; int main(void) { ll n; cin >> n; vector<ll> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } if (n % 3 != 1) { int ok = 1; for (int i = 0; i < n; i++) { if (a[i] != 0) ok = 0; } if (ok) cout << "Yes" << endl; else cout << "No" << endl; } else { ll t = 0; for (int i = 0; i < n; i++) { t ^= a[i]; } if (t == 0) cout << "Yes" << endl; else cout << "No" << endl; } return 0; }
#include <bits/stdc++.h> #define ll long long int #define MOD 1000000007 #define INF 1e18 using namespace std; int main(void) { ll n; cin >> n; vector<ll> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } if (n % 3 != 0) { int ok = 1; for (int i = 0; i < n; i++) { if (a[i] != 0) ok = 0; } if (ok) cout << "Yes" << endl; else cout << "No" << endl; } else { ll t = 0; for (int i = 0; i < n; i++) { t ^= a[i]; } if (t == 0) cout << "Yes" << endl; else cout << "No" << endl; } return 0; }
[ "literal.number.change", "control_flow.branch.if.condition.change" ]
781,652
781,653
u755121033
cpp
p02975
#pragma GCC optimize("O3") #include <bits/stdc++.h> #define ll long long #define rep2(i, a, b) for (ll i = a; i <= b; ++i) #define rep(i, n) for (ll i = 0; i < n; i++) #define rep3(i, a, b) for (ll i = a; i >= b; i--) #define pii pair<int, int> #define pll pair<ll, ll> #define pq priority_queue #define pb push_back #define eb emplace_back #define veci vector<int> #define vecll vector<ll> #define vecpii vector<pii> #define vec2(a, b) vector<vec>(a, vec(b)) #define vec2ll(a, b) vector<vec>(a, vecll(b)) #define vec3(a, b, c) vector<vector<vec>>(a, vec2(b, c)) #define vec3ll(a, b, c) vector<vector<vecll>>(a, vec2ll(b, c)) #define fi first #define se second #define all(c) begin(c), end(c) #define ios ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); #define lb(c, x) distance(c.begin(), lower_bound(all(c), x)) #define ub(c, x) distance(c.begin(), upper_bound(all(c), x)) using namespace std; int in() { int x; cin >> x; return x; } ll lin() { ll x; cin >> x; return x; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } template <class T> inline void print(pair<T, T> p) { cout << "(" << p.first << "," << p.second << ") "; } // template<class T> inline void print(vector<pair<T,T>> v){for(auto // e:v)print(e); cout<<endl;} template<class T> inline void print(T v){for(auto // e:v)cout<<e<<" ";cout<<endl;} template <typename T> istream &operator>>(istream &is, vector<T> &vec) { for (T &x : vec) is >> x; return is; } const ll INF = 1e9 + 7; int main() { ll n; cin >> n; vector<ll> a(n); set<ll> s; map<ll, ll> m; rep(i, n) { cin >> a[i]; s.insert(a[i]); m[a[i]]++; } if (s.size() == 1) { if (a[0] == 0) { cout << "Yes" << endl; return 0; } else { cout << "No" << endl; return 0; } } if (n % 3 != 0) { cout << "No" << endl; return 0; } if (s.size() == 2) { if (m[0] == n / 3) { cout << "Yes" << endl; return 0; } else { cout << "No" << endl; return 0; } } if (s.size() == 3) { vector<ll> b(3); ll i = 0; for (auto x : s) { b[i] = x; i++; } ll p = n / 3; if (m[b[0]] == p && m[b[1]] == p && m[b[2]] == p && b[0] ^ b[1] ^ b[2] == 0) { cout << "Yes" << endl; return 0; } else { cout << "No" << endl; return 0; } } cout << "No" << endl; return 0; }
#pragma GCC optimize("O3") #include <bits/stdc++.h> #define ll long long #define rep2(i, a, b) for (ll i = a; i <= b; ++i) #define rep(i, n) for (ll i = 0; i < n; i++) #define rep3(i, a, b) for (ll i = a; i >= b; i--) #define pii pair<int, int> #define pll pair<ll, ll> #define pq priority_queue #define pb push_back #define eb emplace_back #define veci vector<int> #define vecll vector<ll> #define vecpii vector<pii> #define vec2(a, b) vector<vec>(a, vec(b)) #define vec2ll(a, b) vector<vec>(a, vecll(b)) #define vec3(a, b, c) vector<vector<vec>>(a, vec2(b, c)) #define vec3ll(a, b, c) vector<vector<vecll>>(a, vec2ll(b, c)) #define fi first #define se second #define all(c) begin(c), end(c) #define ios ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); #define lb(c, x) distance(c.begin(), lower_bound(all(c), x)) #define ub(c, x) distance(c.begin(), upper_bound(all(c), x)) using namespace std; int in() { int x; cin >> x; return x; } ll lin() { ll x; cin >> x; return x; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } template <class T> inline void print(pair<T, T> p) { cout << "(" << p.first << "," << p.second << ") "; } // template<class T> inline void print(vector<pair<T,T>> v){for(auto // e:v)print(e); cout<<endl;} template<class T> inline void print(T v){for(auto // e:v)cout<<e<<" ";cout<<endl;} template <typename T> istream &operator>>(istream &is, vector<T> &vec) { for (T &x : vec) is >> x; return is; } const ll INF = 1e9 + 7; int main() { ll n; cin >> n; vector<ll> a(n); set<ll> s; map<ll, ll> m; rep(i, n) { cin >> a[i]; s.insert(a[i]); m[a[i]]++; } if (s.size() == 1) { if (a[0] == 0) { cout << "Yes" << endl; return 0; } else { cout << "No" << endl; return 0; } } if (n % 3 != 0) { cout << "No" << endl; return 0; } if (s.size() == 2) { if (m[0] == n / 3) { cout << "Yes" << endl; return 0; } else { cout << "No" << endl; return 0; } } if (s.size() == 3) { vector<ll> b(3); ll i = 0; for (auto x : s) { b[i] = x; i++; } ll p = n / 3; if (m[b[0]] == p && m[b[1]] == p && m[b[2]] == p && (b[0] ^ b[1] ^ b[2]) == 0) { cout << "Yes" << endl; return 0; } else { cout << "No" << endl; return 0; } } cout << "No" << endl; return 0; }
[ "control_flow.branch.if.condition.change" ]
781,654
781,655
u882039496
cpp
p02974
#include <bits/stdc++.h> using namespace std; using PP = pair<long, long>; const int INF = 1e9; template <class T> T Next() { T buf; cin >> buf; return buf; } const int MOD = 1000000007; int n, m; int dp[51][51][626]; void add(int &a, int b) { a += b; if (a >= MOD) a -= MOD; } int main() { cin >> n >> m; if (m % 2 == 1 || m * 2 > n * n) { cout << 0 << endl; return 0; } dp[0][0][0] = 1; for (int i = 0; i < n; ++i) { for (int k = 0; k <= i; ++k) { for (int p = 0; p <= i * (i - 1) / 2; ++p) { long v = dp[i][k][p]; add(dp[i + 1][k + 1][p + k], v); add(dp[i + 1][k][p + k], (2 * k + 1) * v % MOD); if (k > 0) { add(dp[i + 1][k - 1][p + k], k * k * v % MOD); } } } } cout << dp[n][0][m / 2] << endl; return 0; }
#include <bits/stdc++.h> using namespace std; using PP = pair<long, long>; const int INF = 1e9; template <class T> T Next() { T buf; cin >> buf; return buf; } const int MOD = 1000000007; int n, m; int dp[51][51][1301]; void add(int &a, int b) { a += b; if (a >= MOD) a -= MOD; } int main() { cin >> n >> m; if (m % 2 == 1 || m * 2 > n * n) { cout << 0 << endl; return 0; } dp[0][0][0] = 1; for (int i = 0; i < n; ++i) { for (int k = 0; k <= i; ++k) { for (int p = 0; p <= i * (i + 1) / 2; ++p) { long v = dp[i][k][p]; add(dp[i + 1][k + 1][p + k], v); add(dp[i + 1][k][p + k], (2 * k + 1) * v % MOD); if (k > 0) { add(dp[i + 1][k - 1][p + k], k * k * v % MOD); } } } } cout << dp[n][0][m / 2] << endl; return 0; }
[ "literal.number.change", "variable_declaration.array_dimensions.change", "misc.opposites", "expression.operator.arithmetic.change", "control_flow.loop.for.condition.change", "expression.operation.binary.change" ]
781,662
781,663
u993619636
cpp
p02974
#include <bits/stdc++.h> #define ALL(x) x.begin(), x.end() #define mset(a, b) memset(a, b, sizeof a) #define rep(i, a, b) for (int i(a), i##_END_(b); i <= i##_END_; i++) #define drep(i, a, b) for (int i(a), i##_END_(b); i >= i##_END_; i--) using namespace std; template <class T> inline bool tomax(T &a, T b) { return a < b ? a = b, 1 : 0; } template <class T> inline bool tomin(T &a, T b) { return b < a ? a = b, 1 : 0; } typedef long long ll; typedef double db; const int MOD = 1e9 + 7, N = 55; int dp[N][N * N][N]; int main() { // freopen("data.in", "r", stdin); int n, k; scanf("%d%d", &n, &k); dp[1][0][1] = 1; dp[1][0][0] = 1; rep(i, 1, n - 1) rep(j, 0, k) rep(x, 0, i) { (dp[i + 1][j + 2 * x][x] += dp[i][j][x]) %= MOD; (dp[i + 1][j + 2 * x][x + 1] += dp[i][j][x]) %= MOD; if (x > 0) { (dp[i + 1][j + 2 * x][x] += (ll)2 * x * dp[i][j][x]) %= MOD; (dp[i + 1][j + 2 * x][x - 1] += (ll)x * x * dp[i][j][x]) %= MOD; } } printf("%d\n", dp[n][k][0]); return 0; }
#include <bits/stdc++.h> #define ALL(x) x.begin(), x.end() #define mset(a, b) memset(a, b, sizeof a) #define rep(i, a, b) for (int i(a), i##_END_(b); i <= i##_END_; i++) #define drep(i, a, b) for (int i(a), i##_END_(b); i >= i##_END_; i--) using namespace std; template <class T> inline bool tomax(T &a, T b) { return a < b ? a = b, 1 : 0; } template <class T> inline bool tomin(T &a, T b) { return b < a ? a = b, 1 : 0; } typedef long long ll; typedef double db; const int MOD = 1e9 + 7, N = 55; int dp[N][N * N][N]; int main() { // freopen("data.in", "r", stdin); int n, k; scanf("%d%d", &n, &k); dp[1][0][1] = 1; dp[1][0][0] = 1; rep(i, 1, n - 1) rep(j, 0, k) rep(x, 0, i) { (dp[i + 1][j + 2 * x][x] += dp[i][j][x]) %= MOD; (dp[i + 1][j + 2 * x][x + 1] += dp[i][j][x]) %= MOD; if (x > 0) { (dp[i + 1][j + 2 * x][x] += (ll)2 * x * dp[i][j][x] % MOD) %= MOD; (dp[i + 1][j + 2 * x][x - 1] += (ll)x * x * dp[i][j][x] % MOD) %= MOD; } } printf("%d\n", dp[n][k][0]); return 0; }
[ "assignment.change" ]
781,668
781,669
u226153407
cpp
p02975
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using ll = long long; using namespace std; int main() { int N; cin >> N; int a[N]; rep(i, N) cin >> a[i]; set<int> b(a, a + N); if (b.size() > 3) { cout << "No" << endl; return 0; } vector<int> cnt(b.size()); int k = 0; for (int i : b) { rep(j, N) { if (a[j] == i) cnt[k]++; } k++; } if (b.size() == 1) { if (*b.begin() == 0) cout << "Yes" << endl; else cout << "No" << endl; } else if (b.size() == 2) { if (*b.begin() == 0) { if (cnt[0] == cnt[1]) cout << "Yes" << endl; else cout << "No" << endl; } else cout << "No" << endl; } else if (b.size() == 3) { ll tot = 0; for (ll i : b) tot ^= i; if (tot == 0) { if (cnt[0] == cnt[1] && cnt[1] == cnt[2]) cout << "Yes" << endl; else cout << "No" << endl; } else cout << "No" << endl; } return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using ll = long long; using namespace std; int main() { int N; cin >> N; int a[N]; rep(i, N) cin >> a[i]; set<int> b(a, a + N); if (b.size() > 3) { cout << "No" << endl; return 0; } vector<int> cnt(b.size()); int k = 0; for (int i : b) { rep(j, N) { if (a[j] == i) cnt[k]++; } k++; } if (b.size() == 1) { if (*b.begin() == 0) cout << "Yes" << endl; else cout << "No" << endl; } else if (b.size() == 2) { if (*b.begin() == 0) { if (2 * cnt[0] == cnt[1]) cout << "Yes" << endl; else cout << "No" << endl; } else cout << "No" << endl; } else if (b.size() == 3) { int tot = 0; for (int i : b) tot ^= i; if (tot == 0) { if (cnt[0] == cnt[1] && cnt[1] == cnt[2]) cout << "Yes" << endl; else cout << "No" << endl; } else cout << "No" << endl; } return 0; }
[ "control_flow.branch.if.condition.change", "variable_declaration.type.change" ]
781,680
781,681
u499062271
cpp
p02975
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using ll = long long; using namespace std; int main() { int N; cin >> N; int a[N]; rep(i, N) cin >> a[i]; set<int> b(a, a + N); if (b.size() > 3) { cout << "No" << endl; return 0; } vector<int> cnt(b.size()); int k = 0; for (int i : b) { rep(j, N) { if (a[j] == i) cnt[k]++; } k++; } if (b.size() == 1) { if (*b.begin() == 0) cout << "Yes" << endl; else cout << "No" << endl; } else if (b.size() == 2) { if (*b.begin() == 0) { if (cnt[0] == cnt[1]) cout << "Yes" << endl; else cout << "No" << endl; } else cout << "No" << endl; } else if (b.size() == 3) { int tot = 0; for (int i : b) tot ^= i; if (tot == 0) { if (cnt[0] == cnt[1] && cnt[1] == cnt[2]) cout << "Yes" << endl; else cout << "No" << endl; } else cout << "No" << endl; } return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using ll = long long; using namespace std; int main() { int N; cin >> N; int a[N]; rep(i, N) cin >> a[i]; set<int> b(a, a + N); if (b.size() > 3) { cout << "No" << endl; return 0; } vector<int> cnt(b.size()); int k = 0; for (int i : b) { rep(j, N) { if (a[j] == i) cnt[k]++; } k++; } if (b.size() == 1) { if (*b.begin() == 0) cout << "Yes" << endl; else cout << "No" << endl; } else if (b.size() == 2) { if (*b.begin() == 0) { if (2 * cnt[0] == cnt[1]) cout << "Yes" << endl; else cout << "No" << endl; } else cout << "No" << endl; } else if (b.size() == 3) { int tot = 0; for (int i : b) tot ^= i; if (tot == 0) { if (cnt[0] == cnt[1] && cnt[1] == cnt[2]) cout << "Yes" << endl; else cout << "No" << endl; } else cout << "No" << endl; } return 0; }
[ "control_flow.branch.if.condition.change" ]
781,682
781,681
u499062271
cpp
p02975
#include <bits/stdc++.h> #define For(i, x, y) for (register int i = (x); i <= (y); i++) #define FOR(i, x, y) for (register int i = (x); i < (y); i++) #define Dow(i, x, y) for (register int i = (x); i >= (y); i--) #define Debug(v) \ for (auto i : v) \ printf("%lld ", i); \ puts("") #define mp make_pair #define fi first #define se second #define pb push_back #define ep emplace_back #define siz(x) ((int)(x).size()) #define all(x) (x).begin(), (x).end() #define fil(a, b) memset((a), (b), sizeof(a)) using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> pa; typedef pair<ll, ll> PA; typedef vector<int> poly; inline ll read() { ll x = 0, f = 1; char c = getchar(); while ((c < '0' || c > '9') && (c != '-')) c = getchar(); if (c == '-') f = -1, c = getchar(); while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar(); return x * f; } const int N = 1e5 + 10; int n, a[N], tot, q[4]; pa p[N]; map<int, int> cnt; int main() { n = read(); For(i, 1, n) cnt[a[i] = read()]++; for (auto i : cnt) p[++tot] = i; sort(p + 1, p + 1 + tot, [](pa a, pa b) { return a.se > b.se; }); if (tot == 1) { if (p[1].fi == 0) puts("Yes"); else puts("No"); return 0; } if (n % 3) return puts("No"), 0; if (tot == 2) { if (p[2].se != n / 3) return puts("No"), 0; if (p[1].fi != 0) return puts("No"), 0; return puts("Yes"), 0; } if (tot != 3) return puts("No"), 0; For(i, 1, tot) if (p[i].se != n / 3) return puts("No"), 0; For(i, 1, 3) q[i] = i; do { bool flag = 1; For(i, 1, 3) { int l = i == 1 ? 3 : i - 1, r = i == 3 ? 1 : i + 1; if ((p[q[l]].fi ^ p[q[r]].fi) != p[q[i]].fi) { flag = 0; break; } } if (flag) return puts("Yes"), 0; } while (next_permutation(q + 1, q + 1 + tot)); puts("No"); }
#include <bits/stdc++.h> #define For(i, x, y) for (register int i = (x); i <= (y); i++) #define FOR(i, x, y) for (register int i = (x); i < (y); i++) #define Dow(i, x, y) for (register int i = (x); i >= (y); i--) #define Debug(v) \ for (auto i : v) \ printf("%lld ", i); \ puts("") #define mp make_pair #define fi first #define se second #define pb push_back #define ep emplace_back #define siz(x) ((int)(x).size()) #define all(x) (x).begin(), (x).end() #define fil(a, b) memset((a), (b), sizeof(a)) using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> pa; typedef pair<ll, ll> PA; typedef vector<int> poly; inline ll read() { ll x = 0, f = 1; char c = getchar(); while ((c < '0' || c > '9') && (c != '-')) c = getchar(); if (c == '-') f = -1, c = getchar(); while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar(); return x * f; } const int N = 1e5 + 10; int n, a[N], tot, q[4]; pa p[N]; map<int, int> cnt; int main() { n = read(); For(i, 1, n) cnt[a[i] = read()]++; for (auto i : cnt) p[++tot] = i; sort(p + 1, p + 1 + tot, [](pa a, pa b) { return a.se > b.se; }); if (tot == 1) { if (p[1].fi == 0) puts("Yes"); else puts("No"); return 0; } if (n % 3) return puts("No"), 0; if (tot == 2) { if (p[2].se != n / 3) return puts("No"), 0; if (p[2].fi != 0) return puts("No"), 0; return puts("Yes"), 0; } if (tot != 3) return puts("No"), 0; For(i, 1, tot) if (p[i].se != n / 3) return puts("No"), 0; For(i, 1, 3) q[i] = i; do { bool flag = 1; For(i, 1, 3) { int l = i == 1 ? 3 : i - 1, r = i == 3 ? 1 : i + 1; if ((p[q[l]].fi ^ p[q[r]].fi) != p[q[i]].fi) { flag = 0; break; } } if (flag) return puts("Yes"), 0; } while (next_permutation(q + 1, q + 1 + tot)); puts("No"); }
[ "literal.number.change", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change" ]
781,687
781,688
u026342954
cpp
p02975
#include <algorithm> #include <bitset> #include <cmath> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define FOR(i, x, n) for (int i = x; i < (n); i++) #define vint(a, n) \ vint a(n); \ rep(i, n) cin >> a[i]; #define vll(a, n) \ vll a(n); \ rep(i, n) cin >> a[i]; #define ALL(n) begin(n), end(n) #define RALL(n) rbegin(n), rend(n) #define MOD (1000000007) // #define MOD (998244353) #define INF (2e9) #define INFL (2e18) typedef long long ll; typedef unsigned int ui; typedef unsigned long long ull; using vint = vector<int>; using vll = vector<ll>; using vbool = vector<bool>; template <class T> using arr = vector<vector<T>>; template <class T> int popcount(T &a) { int c = 0; rep(i, 8 * (int)sizeof(a)) { if ((a >> i) & 1) c++; } return c; } template <class T> void pr(T x) { cout << x << endl; } template <class T> void prvec(vector<T> &a) { rep(i, a.size() - 1) { cout << a[i] << " "; } pr(a[a.size() - 1]); } template <class T> void prarr(arr<T> &a) { rep(i, a.size()) if (a[i].empty()) pr(""); else prvec(a[i]); } template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } int main() { int n; cin >> n; int z = 0; map<int, int> m; vint a(n); rep(i, n) { cin >> a[i]; if (a[i] == 0) z++; m[a[i]]++; } if (z == n) { pr("Yes"); return 0; } if (n % 3 != 0) { pr("No"); return 0; } if (z > 0) { if (m.size() > 2) pr("No"); else { if (m.size() == 2 && n % 3 == 0 && z == n / 3) pr("Yes"); else pr("No"); } return 0; } if (m.size() != 3) { pr("No"); return 0; } vint b, c; for (auto p : m) { c.push_back(p.second); b.push_back(p.first); } // prvec(b); if (c[0] != c[1] || c[1] != c[2]) { pr("No"); return 0; } if (((b[0] ^ b[1]) ^ b[2]) == 0) { pr(1); pr("Yes"); } else pr("No"); // pr(1^3^5); return 0; }
#include <algorithm> #include <bitset> #include <cmath> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define FOR(i, x, n) for (int i = x; i < (n); i++) #define vint(a, n) \ vint a(n); \ rep(i, n) cin >> a[i]; #define vll(a, n) \ vll a(n); \ rep(i, n) cin >> a[i]; #define ALL(n) begin(n), end(n) #define RALL(n) rbegin(n), rend(n) #define MOD (1000000007) // #define MOD (998244353) #define INF (2e9) #define INFL (2e18) typedef long long ll; typedef unsigned int ui; typedef unsigned long long ull; using vint = vector<int>; using vll = vector<ll>; using vbool = vector<bool>; template <class T> using arr = vector<vector<T>>; template <class T> int popcount(T &a) { int c = 0; rep(i, 8 * (int)sizeof(a)) { if ((a >> i) & 1) c++; } return c; } template <class T> void pr(T x) { cout << x << endl; } template <class T> void prvec(vector<T> &a) { rep(i, a.size() - 1) { cout << a[i] << " "; } pr(a[a.size() - 1]); } template <class T> void prarr(arr<T> &a) { rep(i, a.size()) if (a[i].empty()) pr(""); else prvec(a[i]); } template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } int main() { int n; cin >> n; int z = 0; map<int, int> m; vint a(n); rep(i, n) { cin >> a[i]; if (a[i] == 0) z++; m[a[i]]++; } if (z == n) { pr("Yes"); return 0; } if (n % 3 != 0) { pr("No"); return 0; } if (z > 0) { if (m.size() > 2) pr("No"); else { if (m.size() == 2 && n % 3 == 0 && z == n / 3) pr("Yes"); else pr("No"); } return 0; } if (m.size() != 3) { pr("No"); return 0; } vint b, c; for (auto p : m) { c.push_back(p.second); b.push_back(p.first); } // prvec(b); if (c[0] != c[1] || c[1] != c[2]) { pr("No"); return 0; } if (((b[0] ^ b[1]) ^ b[2]) == 0) { pr("Yes"); } else pr("No"); // pr(1^3^5); return 0; }
[ "call.remove" ]
781,689
781,690
u370785250
cpp
p02975
#include <algorithm> #include <bitset> #include <cmath> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define FOR(i, x, n) for (int i = x; i < (n); i++) #define vint(a, n) \ vint a(n); \ rep(i, n) cin >> a[i]; #define vll(a, n) \ vll a(n); \ rep(i, n) cin >> a[i]; #define ALL(n) begin(n), end(n) #define RALL(n) rbegin(n), rend(n) #define MOD (1000000007) // #define MOD (998244353) #define INF (2e9) #define INFL (2e18) typedef long long ll; typedef unsigned int ui; typedef unsigned long long ull; using vint = vector<int>; using vll = vector<ll>; using vbool = vector<bool>; template <class T> using arr = vector<vector<T>>; template <class T> int popcount(T &a) { int c = 0; rep(i, 8 * (int)sizeof(a)) { if ((a >> i) & 1) c++; } return c; } template <class T> void pr(T x) { cout << x << endl; } template <class T> void prvec(vector<T> &a) { rep(i, a.size() - 1) { cout << a[i] << " "; } pr(a[a.size() - 1]); } template <class T> void prarr(arr<T> &a) { rep(i, a.size()) if (a[i].empty()) pr(""); else prvec(a[i]); } template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } int main() { int n; cin >> n; int z = 0; map<int, int> m; vint a(n); rep(i, n) { cin >> a[i]; if (a[i] == 0) z++; m[a[i]]++; } if (z == n) { pr("Yes"); return 0; } if (n % 3 != 0) { pr("No"); return 0; } if (z > 0) { if (m.size() > 2) pr("No"); else { if (m.size() == 2 && n % 3 == 0 && z == n / 3) pr("Yes"); else pr("No"); } return 0; } if (m.size() != 3) { pr("No"); return 0; } vint b, c; for (auto p : m) { c.push_back(p.second); b.push_back(p.first); } if (c[0] != c[1] || c[1] != c[2]) { pr("No"); return 0; } if (b[0] ^ b[1] ^ b[2] == 0) pr("Yes"); else pr("No"); return 0; }
#include <algorithm> #include <bitset> #include <cmath> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define FOR(i, x, n) for (int i = x; i < (n); i++) #define vint(a, n) \ vint a(n); \ rep(i, n) cin >> a[i]; #define vll(a, n) \ vll a(n); \ rep(i, n) cin >> a[i]; #define ALL(n) begin(n), end(n) #define RALL(n) rbegin(n), rend(n) #define MOD (1000000007) // #define MOD (998244353) #define INF (2e9) #define INFL (2e18) typedef long long ll; typedef unsigned int ui; typedef unsigned long long ull; using vint = vector<int>; using vll = vector<ll>; using vbool = vector<bool>; template <class T> using arr = vector<vector<T>>; template <class T> int popcount(T &a) { int c = 0; rep(i, 8 * (int)sizeof(a)) { if ((a >> i) & 1) c++; } return c; } template <class T> void pr(T x) { cout << x << endl; } template <class T> void prvec(vector<T> &a) { rep(i, a.size() - 1) { cout << a[i] << " "; } pr(a[a.size() - 1]); } template <class T> void prarr(arr<T> &a) { rep(i, a.size()) if (a[i].empty()) pr(""); else prvec(a[i]); } template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } int main() { int n; cin >> n; int z = 0; map<int, int> m; vint a(n); rep(i, n) { cin >> a[i]; if (a[i] == 0) z++; m[a[i]]++; } if (z == n) { pr("Yes"); return 0; } if (n % 3 != 0) { pr("No"); return 0; } if (z > 0) { if (m.size() > 2) pr("No"); else { if (m.size() == 2 && n % 3 == 0 && z == n / 3) pr("Yes"); else pr("No"); } return 0; } if (m.size() != 3) { pr("No"); return 0; } vint b, c; for (auto p : m) { c.push_back(p.second); b.push_back(p.first); } // prvec(b); if (c[0] != c[1] || c[1] != c[2]) { pr("No"); return 0; } if (((b[0] ^ b[1]) ^ b[2]) == 0) { pr("Yes"); } else pr("No"); // pr(1^3^5); return 0; }
[ "control_flow.branch.if.condition.change" ]
781,691
781,690
u370785250
cpp
p02975
#include <algorithm> #include <bitset> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <memory> #include <queue> #include <regex> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> Pii; typedef pair<int, ll> Pil; typedef pair<ll, ll> Pll; typedef pair<int, ld> Pid; typedef pair<int, string> Pis; #define rep(i, n) for (int i = 0; i < n; i++) #define repm(i, s, n) for (int i = s; i < n; i++) #define all(a) (a).begin(), (a).end() const int INF = 1 << 30; const ll INF_L = 1LL << 58; const int MOD = 1e9 + 7; // 998244353; void coi(ll i) { cout << i << endl; } void cois(ll i) { cout << i << " "; } void cod(ld d) { cout << fixed << setprecision(16); cout << d << endl; } void cods(ld d) { cout << fixed << setprecision(16); cout << d << " "; } void coc(char c) { cout << c << endl; } void cocs(char c) { cout << c << " "; } void cos(string s) { cout << s << endl; } void coss(string s) { cout << s << " "; } void coynl(bool b) { cos(b ? "Yes" : "No"); } void coynu(bool b) { cos(b ? "YES" : "NO"); } // ---------------------------------------------------------------- // String Functions // ---------------------------------------------------------------- int ctoi(char c) { if (isdigit(c)) return c - '0'; else if (islower(c)) return c - 'a'; else if (isupper(c)) return c - 'A'; else return -1; } char itocd(int i) { char c = i + '0'; if (isdigit(c)) return c; else return 0x00; } char itocl(int i) { char c = i + 'a'; if (islower(c)) return c; else return 0x00; } char itocu(int i) { char c = i + 'A'; if (isupper(c)) return c; else return 0x00; } // ---------------------------------------------------------------- // ---------------------------------------------------------------- // Dynamical Programming // ---------------------------------------------------------------- template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } // ---------------------------------------------------------------- // ---------------------------------------------------------------- // Graph Theory // ---------------------------------------------------------------- struct edge { ll to, cost; }; struct GraphList { ll V; vector<vector<edge>> graph; vector<ll> dist; GraphList(ll N) { init(N); } void init(ll N) { V = N; graph.resize(V); dist.resize(V); for (int i = 0; i < V; i++) { dist[i] = INF_L; } } void add_edge(ll from, ll to, ll cost) { edge e; e.to = to; e.cost = cost; graph[from].push_back(e); } void dijkstra(ll s) { for (int i = 0; i < V; i++) { dist[i] = INF_L; } dist[s] = 0; priority_queue<Pll, vector<Pll>, greater<Pll>> que; que.push(Pll(0, s)); while (!que.empty()) { Pll p = que.top(); que.pop(); ll v = p.second; if (dist[v] < p.first) continue; for (auto e : graph[v]) { if (dist[e.to] > dist[v] + e.cost) { dist[e.to] = dist[v] + e.cost; que.push(Pll(dist[e.to], e.to)); } } } } void bellman_ford(ll s) { for (int i = 0; i < V; i++) { dist[i] = INF_L; } dist[s] = 0; /* Under construction */ } }; struct GraphMatrix { ll vertex; vector<vector<edge>> graph; vector<ll> dist; GraphMatrix(ll N) { init(N); } void init(ll N) { vertex = N; graph.resize(vertex); dist.resize(vertex); for (int i = 0; i < vertex; i++) { dist[i] = INF; } } void add_edge(ll s, ll t, ll cost) { edge e; e.to = t; e.cost = cost; graph[s].push_back(e); } void warshall_floyd(ll s) { for (int i = 0; i < vertex; i++) { dist[i] = INF; } dist[s] = 0; /* Under construction */ } }; // ---------------------------------------------------------------- // ---------------------------------------------------------------- // Mathematical Functions // ---------------------------------------------------------------- ll gcd(ll A, ll B) { if (A % B == 0) { return (B); } else { return (gcd(B, A % B)); } } ll lcm(ll A, ll B) { return A < B ? A * (B / gcd(A, B)) : (A / gcd(A, B)) * B; } ll getDigit(ll N) { return (ll)(to_string(N).length()); } ll getDigitForBase(ll N, ll B) { if (B < 2) { return -1; } else if (B == 10) { return getDigit(N); } else { ll r = 0; while (N != 0) { N /= B; r++; } return r; } } ll getDigitSum(ll N) { ll r = 0; string Ns = to_string(N); for (int i = 0; i < getDigit(N); i++) { r += ctoi(Ns[i]); } return r; } ll getDivTimes(ll N, ll D) { ll r = 0; while (N % D == 0) { N /= D; r++; } return r; } ll powMod(ll B, ll P) { if (P == 0) return 1; if (P % 2 == 0) { ll t = powMod(B, P / 2); return t * t % MOD; } return B * powMod(B, P - 1) % MOD; } ll invMod(ll N) { return powMod(N, MOD - 2); } /* ---------------------------------- Factorial, Permutation, Combination ---------------------------------- */ const ll FPC_INIT_SIZE_MAX = 1e6; struct FPCMod { ll size; vector<ll> inv, fac, finv; FPCMod(ll N) { init(N); } void init(ll N) { size = (N > 1 && N < FPC_INIT_SIZE_MAX) ? N + 9 : FPC_INIT_SIZE_MAX; inv.resize(size); fac.resize(size); finv.resize(size); fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (int i = 2; i < size; i++) { fac[i] = fac[i - 1] * i % MOD; inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD; finv[i] = finv[i - 1] * inv[i] % MOD; } } ll inverseMod(ll N) { return inv[N] % MOD; } ll factrialMod(ll N) { return fac[N] % MOD; } ll factrialInverseMod(ll N) { return finv[N] % MOD; } ll permutationMod(ll N, ll K) { if (N < 0 || K < 0 || N < K) return 0; else return factrialMod(N) * factrialInverseMod(N - K) % MOD; } ll combinationMod(ll N, ll K) { if (N < 0 || K < 0 || N < K) return 0; else if (N < size) { return factrialMod(N) * (factrialInverseMod(K) * factrialInverseMod(N - K) % MOD) % MOD; } else { ll ans = 1; ll Ks = K < N - K ? K : N - K; for (ll i = N; i > N - Ks; i--) { ans *= i; ans %= MOD; } return ans * factrialInverseMod(Ks) % MOD; } } }; /* ---------------------------------- Sieve Theory ---------------------------------- */ const ll SIEVE_SIZE_MAX = 1e9; struct SieveEratosthenes { private: ll N_max; ll ssize, ssize_sqrt; vector<bool> sieve; bool sieve_fg; vector<ll> sievingp; bool sievingp_fg; vector<ll> primes; bool primes_fg; vector<int> skipPrimes = {2, 3, 5}; vector<int> standReminders = {1, 7, 11, 13, 17, 19, 23, 29}; vector<int> invidxStandReminders = {-1, 0, -1, -1, -1, -1, -1, 1, -1, -1, -1, 2, -1, 3, -1, -1, -1, 4, -1, 5, -1, -1, -1, 6, -1, -1, -1, -1, -1, 7}; const int SP_prod = 2 * 3 * 5; int SR_size = 8; public: SieveEratosthenes(ll N) { sieve_fg = true; sievingp_fg = true; init(N); } SieveEratosthenes(ll N, int c) { switch (c) { case 1: sieve_fg = true; sievingp_fg = true; break; default: sieve_fg = true; sievingp_fg = false; break; } init(N); } ll size() { return N_max; } bool isPrime(ll N) { if (!sieve_fg) return false; if (N < 2 || N >= N_max) return false; for (auto p : skipPrimes) { if (N == p) return true; if (N % p == 0) return false; } return sieve[numtoidx(N)]; } ll getSievingPrime(ll N) { if (!sievingp_fg) return -1; if (N < 2 || N >= N_max) return -1; for (auto p : skipPrimes) { if (N % p == 0) return p; } if (isPrime(N)) return N; return sievingp[numtoidx(N)]; } private: void init(ll N) { N_max = (N > 1 && N < SIEVE_SIZE_MAX) ? N + 100 : SIEVE_SIZE_MAX; ssize = (N_max / SP_prod + 1) * SR_size; ssize_sqrt = ((ll)sqrt(N_max) / SP_prod + 1) * SR_size; sieve = vector<bool>(ssize, true); sievingp = vector<ll>(ssize, 0); primes.clear(); sieveInit(); } void sieveInit() { for (ll i = 1; i < ssize_sqrt; i++) { if (!sieve[i]) continue; ll num_i = idxtonum(i); for (ll j = num_i * num_i; j < N_max; j += num_i) { ll idx_j = numtoidx(j); if (idx_j > 0) { sieve[idx_j] = false; sievingp[idx_j] = num_i; } } } } ll idxtonum(ll idx) { return (idx / SR_size) * SP_prod + standReminders[idx % SR_size]; } ll numtoidx(ll num) { int iiSR = invidxStandReminders[num % SP_prod]; return iiSR < 0 ? -1 : (num / SP_prod) * SR_size + iiSR; } }; struct SieveAtkinBernstein { private: ll N_max; ll ssize, ssize_sqrt; vector<bool> sieve; public: SieveAtkinBernstein(ll N) { init(N); } ll size() { return N_max; } bool isPrime(ll N) { if (N < 0 || N >= N_max) return false; return sieve[N]; } private: void init(ll N) { N_max = (N > 1 && N < SIEVE_SIZE_MAX) ? N : SIEVE_SIZE_MAX; ssize = N_max; ssize_sqrt = (ll)sqrt(ssize + 0.1); sieve.resize(ssize); sieveInit(); } void sieveInit() { sieve[2] = sieve[3] = true; int n = 0; for (int z = 1; z <= 5; z += 4) { for (int y = z; y <= ssize_sqrt; y += 6) { for (int x = 1; x <= ssize_sqrt && (n = 4 * x * x + y * y) < ssize; x++) sieve[n] = !sieve[n]; for (int x = y + 1; x <= ssize_sqrt && (n = 3 * x * x - y * y) < ssize; x += 2) sieve[n] = !sieve[n]; } } for (int z = 2; z <= 4; z += 2) { for (int y = z; y <= ssize_sqrt; y += 6) { for (int x = 1; x <= ssize_sqrt && (n = 3 * x * x + y * y) < ssize; x += 2) sieve[n] = !sieve[n]; for (int x = y + 1; x <= ssize_sqrt && (n = 3 * x * x - y * y) < ssize; x += 2) sieve[n] = !sieve[n]; } } for (int z = 1; z <= 2; z++) { for (int y = 3; y <= ssize_sqrt; y += 6) { for (int x = z; x <= ssize_sqrt && (n = 4 * x * x + y * y) < ssize; x += 3) sieve[n] = !sieve[n]; } } for (int k = 5; k <= ssize_sqrt; k++) if (sieve[k]) for (int n = k * k; n < ssize; n += k * k) sieve[n] = false; } }; /* ---------------------------------- Prime Factorization ---------------------------------- */ const ll PRIME_FACTORIZATION_SIZE_MAX = 1e12; struct primeFactrization { private: map<ll, ll> idxVec, idxMap; vector<vector<ll>> primeFactorVec; vector<map<ll, ll>> primeFactorMap; public: primeFactrization() { init(); } void calc_primeFactrization_vec(ll N) { if (N < 2 || N > PRIME_FACTORIZATION_SIZE_MAX) return; primeFactorVec.push_back(vector<ll>()); ll idx = (int)primeFactorVec.size() - 1; idxVec[N] = idx; add_vec(N, idx); sort(primeFactorVec[idx].begin(), primeFactorVec[idx].end()); } void calc_primeFactrization_map(ll N) { if (N < 2 || N > PRIME_FACTORIZATION_SIZE_MAX) return; primeFactorMap.push_back(map<ll, ll>()); ll idx = (int)primeFactorMap.size() - 1; idxMap[N] = idx; add_map_withoutSieve(N, idx); } void calc_primeFactrization_map_withSieve(ll N, SieveEratosthenes sieve) { if (N < 2 || N > PRIME_FACTORIZATION_SIZE_MAX) return; if (N > sieve.size()) return; primeFactorMap.push_back(map<ll, ll>()); ll idx = (int)primeFactorMap.size() - 1; idxMap[N] = idx; add_map_withSieve(N, idx, sieve); } vector<ll> getPrimeFactorizeVec(ll N) { if (idxVec[N] == 0) return vector<ll>(); return primeFactorVec[idxVec[N]]; } map<ll, ll> getPrimeFactorizeMap(ll N) { if (idxMap[N] == 0) return map<ll, ll>(); return primeFactorMap[idxMap[N]]; } private: void init() { idxVec.clear(); primeFactorVec.clear(); primeFactorVec.push_back(vector<ll>()); idxMap.clear(); primeFactorMap.clear(); primeFactorMap.push_back(map<ll, ll>()); } void add_vec(ll N, ll idx) { primeFactorVec[idx].push_back(1); primeFactorVec[idx].push_back(N); for (ll div = 2; div <= (ll)sqrt(N + 0.1); div++) { if (N % div == 0) { if (div < N / div) { primeFactorVec[idx].push_back(div); primeFactorVec[idx].push_back(N / div); } if (div == N / div) { primeFactorVec[idx].push_back(div); } } } } void add_map_withoutSieve(ll N, ll idx) { ll Nc = N; while (Nc > 1) { for (ll div = 2; div <= (ll)sqrt(N + 0.1); div++) { while (Nc % div == 0) { primeFactorMap[idx][div]++; Nc /= div; } if (Nc == 1) break; } if (Nc > 1) { primeFactorMap[idx][Nc]++; Nc /= Nc; } } } void add_map_withSieve(ll N, ll idx, SieveEratosthenes sieve) { ll Nc = N; while (Nc > 1) { ll div = sieve.getSievingPrime(Nc); primeFactorMap[idx][div]++; Nc /= div; } } }; // ---------------------------------------------------------------- //* **************** GLOBAL VARIABLES **************** *// //* **************************************************** *// void input() {} void solve() { int N; cin >> N; map<ll, ll> mp; mp[0] = 0; rep(i, N) { ll A; cin >> A; mp[A]++; } bool fg = false; if (mp[0] == N) fg = true; if (N % 3 == 0 && 3 * mp[0] == N && mp.size() == 2) fg = true; if (N % 3 == 0 && mp.size() == 4) { ll num[3], cnt = 0; for (auto a : mp) { if (a.first != 0) { num[cnt] = a.first; cnt++; } } if (mp[num[1]] == mp[num[2]] && mp[num[2]] == mp[num[0]] && mp[num[0]] == mp[num[1]] && num[1] ^ num[2] ^ num[0] == 0ll) fg = true; } coynl(fg); } int main() { std::ifstream in("input.txt"); std::cin.rdbuf(in.rdbuf()); cin.tie(0); ios::sync_with_stdio(false); input(); solve(); return 0; }
#include <algorithm> #include <bitset> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <memory> #include <queue> #include <regex> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> Pii; typedef pair<int, ll> Pil; typedef pair<ll, ll> Pll; typedef pair<int, ld> Pid; typedef pair<int, string> Pis; #define rep(i, n) for (int i = 0; i < n; i++) #define repm(i, s, n) for (int i = s; i < n; i++) #define all(a) (a).begin(), (a).end() const int INF = 1 << 30; const ll INF_L = 1LL << 58; const int MOD = 1e9 + 7; // 998244353; void coi(ll i) { cout << i << endl; } void cois(ll i) { cout << i << " "; } void cod(ld d) { cout << fixed << setprecision(16); cout << d << endl; } void cods(ld d) { cout << fixed << setprecision(16); cout << d << " "; } void coc(char c) { cout << c << endl; } void cocs(char c) { cout << c << " "; } void cos(string s) { cout << s << endl; } void coss(string s) { cout << s << " "; } void coynl(bool b) { cos(b ? "Yes" : "No"); } void coynu(bool b) { cos(b ? "YES" : "NO"); } // ---------------------------------------------------------------- // String Functions // ---------------------------------------------------------------- int ctoi(char c) { if (isdigit(c)) return c - '0'; else if (islower(c)) return c - 'a'; else if (isupper(c)) return c - 'A'; else return -1; } char itocd(int i) { char c = i + '0'; if (isdigit(c)) return c; else return 0x00; } char itocl(int i) { char c = i + 'a'; if (islower(c)) return c; else return 0x00; } char itocu(int i) { char c = i + 'A'; if (isupper(c)) return c; else return 0x00; } // ---------------------------------------------------------------- // ---------------------------------------------------------------- // Dynamical Programming // ---------------------------------------------------------------- template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } // ---------------------------------------------------------------- // ---------------------------------------------------------------- // Graph Theory // ---------------------------------------------------------------- struct edge { ll to, cost; }; struct GraphList { ll V; vector<vector<edge>> graph; vector<ll> dist; GraphList(ll N) { init(N); } void init(ll N) { V = N; graph.resize(V); dist.resize(V); for (int i = 0; i < V; i++) { dist[i] = INF_L; } } void add_edge(ll from, ll to, ll cost) { edge e; e.to = to; e.cost = cost; graph[from].push_back(e); } void dijkstra(ll s) { for (int i = 0; i < V; i++) { dist[i] = INF_L; } dist[s] = 0; priority_queue<Pll, vector<Pll>, greater<Pll>> que; que.push(Pll(0, s)); while (!que.empty()) { Pll p = que.top(); que.pop(); ll v = p.second; if (dist[v] < p.first) continue; for (auto e : graph[v]) { if (dist[e.to] > dist[v] + e.cost) { dist[e.to] = dist[v] + e.cost; que.push(Pll(dist[e.to], e.to)); } } } } void bellman_ford(ll s) { for (int i = 0; i < V; i++) { dist[i] = INF_L; } dist[s] = 0; /* Under construction */ } }; struct GraphMatrix { ll vertex; vector<vector<edge>> graph; vector<ll> dist; GraphMatrix(ll N) { init(N); } void init(ll N) { vertex = N; graph.resize(vertex); dist.resize(vertex); for (int i = 0; i < vertex; i++) { dist[i] = INF; } } void add_edge(ll s, ll t, ll cost) { edge e; e.to = t; e.cost = cost; graph[s].push_back(e); } void warshall_floyd(ll s) { for (int i = 0; i < vertex; i++) { dist[i] = INF; } dist[s] = 0; /* Under construction */ } }; // ---------------------------------------------------------------- // ---------------------------------------------------------------- // Mathematical Functions // ---------------------------------------------------------------- ll gcd(ll A, ll B) { if (A % B == 0) { return (B); } else { return (gcd(B, A % B)); } } ll lcm(ll A, ll B) { return A < B ? A * (B / gcd(A, B)) : (A / gcd(A, B)) * B; } ll getDigit(ll N) { return (ll)(to_string(N).length()); } ll getDigitForBase(ll N, ll B) { if (B < 2) { return -1; } else if (B == 10) { return getDigit(N); } else { ll r = 0; while (N != 0) { N /= B; r++; } return r; } } ll getDigitSum(ll N) { ll r = 0; string Ns = to_string(N); for (int i = 0; i < getDigit(N); i++) { r += ctoi(Ns[i]); } return r; } ll getDivTimes(ll N, ll D) { ll r = 0; while (N % D == 0) { N /= D; r++; } return r; } ll powMod(ll B, ll P) { if (P == 0) return 1; if (P % 2 == 0) { ll t = powMod(B, P / 2); return t * t % MOD; } return B * powMod(B, P - 1) % MOD; } ll invMod(ll N) { return powMod(N, MOD - 2); } /* ---------------------------------- Factorial, Permutation, Combination ---------------------------------- */ const ll FPC_INIT_SIZE_MAX = 1e6; struct FPCMod { ll size; vector<ll> inv, fac, finv; FPCMod(ll N) { init(N); } void init(ll N) { size = (N > 1 && N < FPC_INIT_SIZE_MAX) ? N + 9 : FPC_INIT_SIZE_MAX; inv.resize(size); fac.resize(size); finv.resize(size); fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (int i = 2; i < size; i++) { fac[i] = fac[i - 1] * i % MOD; inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD; finv[i] = finv[i - 1] * inv[i] % MOD; } } ll inverseMod(ll N) { return inv[N] % MOD; } ll factrialMod(ll N) { return fac[N] % MOD; } ll factrialInverseMod(ll N) { return finv[N] % MOD; } ll permutationMod(ll N, ll K) { if (N < 0 || K < 0 || N < K) return 0; else return factrialMod(N) * factrialInverseMod(N - K) % MOD; } ll combinationMod(ll N, ll K) { if (N < 0 || K < 0 || N < K) return 0; else if (N < size) { return factrialMod(N) * (factrialInverseMod(K) * factrialInverseMod(N - K) % MOD) % MOD; } else { ll ans = 1; ll Ks = K < N - K ? K : N - K; for (ll i = N; i > N - Ks; i--) { ans *= i; ans %= MOD; } return ans * factrialInverseMod(Ks) % MOD; } } }; /* ---------------------------------- Sieve Theory ---------------------------------- */ const ll SIEVE_SIZE_MAX = 1e9; struct SieveEratosthenes { private: ll N_max; ll ssize, ssize_sqrt; vector<bool> sieve; bool sieve_fg; vector<ll> sievingp; bool sievingp_fg; vector<ll> primes; bool primes_fg; vector<int> skipPrimes = {2, 3, 5}; vector<int> standReminders = {1, 7, 11, 13, 17, 19, 23, 29}; vector<int> invidxStandReminders = {-1, 0, -1, -1, -1, -1, -1, 1, -1, -1, -1, 2, -1, 3, -1, -1, -1, 4, -1, 5, -1, -1, -1, 6, -1, -1, -1, -1, -1, 7}; const int SP_prod = 2 * 3 * 5; int SR_size = 8; public: SieveEratosthenes(ll N) { sieve_fg = true; sievingp_fg = true; init(N); } SieveEratosthenes(ll N, int c) { switch (c) { case 1: sieve_fg = true; sievingp_fg = true; break; default: sieve_fg = true; sievingp_fg = false; break; } init(N); } ll size() { return N_max; } bool isPrime(ll N) { if (!sieve_fg) return false; if (N < 2 || N >= N_max) return false; for (auto p : skipPrimes) { if (N == p) return true; if (N % p == 0) return false; } return sieve[numtoidx(N)]; } ll getSievingPrime(ll N) { if (!sievingp_fg) return -1; if (N < 2 || N >= N_max) return -1; for (auto p : skipPrimes) { if (N % p == 0) return p; } if (isPrime(N)) return N; return sievingp[numtoidx(N)]; } private: void init(ll N) { N_max = (N > 1 && N < SIEVE_SIZE_MAX) ? N + 100 : SIEVE_SIZE_MAX; ssize = (N_max / SP_prod + 1) * SR_size; ssize_sqrt = ((ll)sqrt(N_max) / SP_prod + 1) * SR_size; sieve = vector<bool>(ssize, true); sievingp = vector<ll>(ssize, 0); primes.clear(); sieveInit(); } void sieveInit() { for (ll i = 1; i < ssize_sqrt; i++) { if (!sieve[i]) continue; ll num_i = idxtonum(i); for (ll j = num_i * num_i; j < N_max; j += num_i) { ll idx_j = numtoidx(j); if (idx_j > 0) { sieve[idx_j] = false; sievingp[idx_j] = num_i; } } } } ll idxtonum(ll idx) { return (idx / SR_size) * SP_prod + standReminders[idx % SR_size]; } ll numtoidx(ll num) { int iiSR = invidxStandReminders[num % SP_prod]; return iiSR < 0 ? -1 : (num / SP_prod) * SR_size + iiSR; } }; struct SieveAtkinBernstein { private: ll N_max; ll ssize, ssize_sqrt; vector<bool> sieve; public: SieveAtkinBernstein(ll N) { init(N); } ll size() { return N_max; } bool isPrime(ll N) { if (N < 0 || N >= N_max) return false; return sieve[N]; } private: void init(ll N) { N_max = (N > 1 && N < SIEVE_SIZE_MAX) ? N : SIEVE_SIZE_MAX; ssize = N_max; ssize_sqrt = (ll)sqrt(ssize + 0.1); sieve.resize(ssize); sieveInit(); } void sieveInit() { sieve[2] = sieve[3] = true; int n = 0; for (int z = 1; z <= 5; z += 4) { for (int y = z; y <= ssize_sqrt; y += 6) { for (int x = 1; x <= ssize_sqrt && (n = 4 * x * x + y * y) < ssize; x++) sieve[n] = !sieve[n]; for (int x = y + 1; x <= ssize_sqrt && (n = 3 * x * x - y * y) < ssize; x += 2) sieve[n] = !sieve[n]; } } for (int z = 2; z <= 4; z += 2) { for (int y = z; y <= ssize_sqrt; y += 6) { for (int x = 1; x <= ssize_sqrt && (n = 3 * x * x + y * y) < ssize; x += 2) sieve[n] = !sieve[n]; for (int x = y + 1; x <= ssize_sqrt && (n = 3 * x * x - y * y) < ssize; x += 2) sieve[n] = !sieve[n]; } } for (int z = 1; z <= 2; z++) { for (int y = 3; y <= ssize_sqrt; y += 6) { for (int x = z; x <= ssize_sqrt && (n = 4 * x * x + y * y) < ssize; x += 3) sieve[n] = !sieve[n]; } } for (int k = 5; k <= ssize_sqrt; k++) if (sieve[k]) for (int n = k * k; n < ssize; n += k * k) sieve[n] = false; } }; /* ---------------------------------- Prime Factorization ---------------------------------- */ const ll PRIME_FACTORIZATION_SIZE_MAX = 1e12; struct primeFactrization { private: map<ll, ll> idxVec, idxMap; vector<vector<ll>> primeFactorVec; vector<map<ll, ll>> primeFactorMap; public: primeFactrization() { init(); } void calc_primeFactrization_vec(ll N) { if (N < 2 || N > PRIME_FACTORIZATION_SIZE_MAX) return; primeFactorVec.push_back(vector<ll>()); ll idx = (int)primeFactorVec.size() - 1; idxVec[N] = idx; add_vec(N, idx); sort(primeFactorVec[idx].begin(), primeFactorVec[idx].end()); } void calc_primeFactrization_map(ll N) { if (N < 2 || N > PRIME_FACTORIZATION_SIZE_MAX) return; primeFactorMap.push_back(map<ll, ll>()); ll idx = (int)primeFactorMap.size() - 1; idxMap[N] = idx; add_map_withoutSieve(N, idx); } void calc_primeFactrization_map_withSieve(ll N, SieveEratosthenes sieve) { if (N < 2 || N > PRIME_FACTORIZATION_SIZE_MAX) return; if (N > sieve.size()) return; primeFactorMap.push_back(map<ll, ll>()); ll idx = (int)primeFactorMap.size() - 1; idxMap[N] = idx; add_map_withSieve(N, idx, sieve); } vector<ll> getPrimeFactorizeVec(ll N) { if (idxVec[N] == 0) return vector<ll>(); return primeFactorVec[idxVec[N]]; } map<ll, ll> getPrimeFactorizeMap(ll N) { if (idxMap[N] == 0) return map<ll, ll>(); return primeFactorMap[idxMap[N]]; } private: void init() { idxVec.clear(); primeFactorVec.clear(); primeFactorVec.push_back(vector<ll>()); idxMap.clear(); primeFactorMap.clear(); primeFactorMap.push_back(map<ll, ll>()); } void add_vec(ll N, ll idx) { primeFactorVec[idx].push_back(1); primeFactorVec[idx].push_back(N); for (ll div = 2; div <= (ll)sqrt(N + 0.1); div++) { if (N % div == 0) { if (div < N / div) { primeFactorVec[idx].push_back(div); primeFactorVec[idx].push_back(N / div); } if (div == N / div) { primeFactorVec[idx].push_back(div); } } } } void add_map_withoutSieve(ll N, ll idx) { ll Nc = N; while (Nc > 1) { for (ll div = 2; div <= (ll)sqrt(N + 0.1); div++) { while (Nc % div == 0) { primeFactorMap[idx][div]++; Nc /= div; } if (Nc == 1) break; } if (Nc > 1) { primeFactorMap[idx][Nc]++; Nc /= Nc; } } } void add_map_withSieve(ll N, ll idx, SieveEratosthenes sieve) { ll Nc = N; while (Nc > 1) { ll div = sieve.getSievingPrime(Nc); primeFactorMap[idx][div]++; Nc /= div; } } }; // ---------------------------------------------------------------- //* **************** GLOBAL VARIABLES **************** *// //* **************************************************** *// void input() {} void solve() { int N; cin >> N; map<ll, ll> mp; mp[0] = 0; rep(i, N) { ll A; cin >> A; mp[A]++; } bool fg = false; if (mp[0] == N) fg = true; if (N % 3 == 0 && 3 * mp[0] == N && mp.size() == 2) fg = true; if (N % 3 == 0 && mp.size() == 4) { ll num[3], cnt = 0; for (auto a : mp) { if (a.first != 0) { num[cnt] = a.first; cnt++; } } if (mp[num[1]] == mp[num[2]] && mp[num[2]] == mp[num[0]] && mp[num[0]] == mp[num[1]] && (int)(num[1] ^ num[2] ^ num[0]) == 0) fg = true; } coynl(fg); } int main() { std::ifstream in("input.txt"); std::cin.rdbuf(in.rdbuf()); cin.tie(0); ios::sync_with_stdio(false); input(); solve(); return 0; }
[ "control_flow.branch.if.condition.change" ]
781,694
781,695
u947236878
cpp
p02975
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG #define rep(i, n) for (int i = 0; i < (n); ++i) #define repi(i, a, b) for (int i = int(a); i < int(b); ++i) #define all(x) (x).begin(), (x).end() #define PI 3.14159265358979323846264338327950L using namespace std; typedef long long ll; typedef long double ld; int main() { int n; cin >> n; map<int, int> mp; int a; rep(i, n) { cin >> a; mp[a]++; } int m = mp.size(); bool ans = false; if (mp[0] == n) ans = true; else if (m == 2 && mp[0] == n / 3 && n % 3 == 0) ans = true; else if (m == 3 && n % 3 == 0) { bool flag = true; ll s = 0; for (auto p : mp) { if (p.second && p.second != n / 3) flag = false; s ^= p.second; } if (flag && s == 0) ans = true; } if (ans) cout << "Yes"; else cout << "No"; }
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG #define rep(i, n) for (int i = 0; i < (n); ++i) #define repi(i, a, b) for (int i = int(a); i < int(b); ++i) #define all(x) (x).begin(), (x).end() #define PI 3.14159265358979323846264338327950L using namespace std; typedef long long ll; typedef long double ld; int main() { int n; cin >> n; map<int, int> mp; int a; rep(i, n) { cin >> a; mp[a]++; } int m = mp.size(); bool ans = false; if (mp[0] == n) ans = true; else if (m == 2 && mp[0] == n / 3 && n % 3 == 0) ans = true; else if (m == 3 && n % 3 == 0) { bool flag = true; ll s = 0; for (auto p : mp) { if (p.second && p.second != n / 3) flag = false; s ^= p.first; } if (flag && s == 0) ans = true; } if (ans) cout << "Yes"; else cout << "No"; }
[ "assignment.value.change" ]
781,700
781,701
u151236434
cpp
p02975
#include "bits/stdc++.h" #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i, n) for (int i = 1; i <= (int)(n); i++) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() using namespace std; using ll = long long; using pi = pair<int, int>; const ll INF = 1LL << 60; int main() { int n, a, ans = 0; cin >> n; map<int, int> mp; rep(i, n) { cin >> a; mp[a]++; } if (mp.size() == 1) { if (mp[0] == n) ans = true; } else if (mp.size() == 2) { if (n % 3 == 0) { if (mp[0] == n / 3) ans = true; } } else if (mp.size() == 3) { int x, y, z, tmp = 0; auto p = mp.begin(); x = (*p).first; p++; y = (*p).first; p++; z = (*p).first; tmp = x ^ y; tmp ^= z; if (tmp != 0 && mp[x] == mp[y] && mp[x] == mp[z] && mp[y] == mp[z]) ans = true; } if (ans) { cout << "Yes" << endl; } else { cout << "No" << endl; } return 0; }
#include "bits/stdc++.h" #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i, n) for (int i = 1; i <= (int)(n); i++) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() using namespace std; using ll = long long; using pi = pair<int, int>; const ll INF = 1LL << 60; int main() { int n, a, ans = 0; cin >> n; map<int, int> mp; rep(i, n) { cin >> a; mp[a]++; } if (mp.size() == 1) { if (mp[0] == n) ans = true; } else if (mp.size() == 2) { if (n % 3 == 0) { if (mp[0] == n / 3) ans = true; } } else if (mp.size() == 3) { int x, y, z, tmp = 0; auto p = mp.begin(); x = (*p).first; p++; y = (*p).first; p++; z = (*p).first; tmp = x ^ y; tmp ^= z; if (tmp == 0 && mp[x] == mp[y] && mp[x] == mp[z] && mp[y] == mp[z]) ans = true; } if (ans) { cout << "Yes" << endl; } else { cout << "No" << endl; } return 0; }
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
781,702
781,703
u730499268
cpp
p02975
#include <iostream> #include <map> #include <vector> using namespace std; using ll = long long; int main() { int n; cin >> n; map<int, int> m; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; m[a[i]]++; } int k = m.size(); bool ans = false; if (m[0] == n) { ans = true; } else if (n % 3 == 0 && m[0] == n / 3 && k == 2) { ans = true; } else if (n % 3 == 0 && k == 3) { ll s = 0; bool flag = true; for (auto p : m) { if (p.second != n / 3) flag = false; s ^= p.first; } if (flag && s == 0) ans = true; } if (ans) cout << "Yes" << endl; else cout << "No" << endl; }
#include <iostream> #include <map> #include <vector> using namespace std; using ll = long long; int main() { int n; cin >> n; map<int, int> m; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; m[a[i]]++; } int k = m.size(); bool ans = false; if (m[0] == n) { ans = true; } else if (n % 3 == 0 && m[0] == n / 3 && k == 2) { ans = true; } else if (n % 3 == 0 && k == 3) { ll s = 0; bool flag = true; for (auto p : m) { if (p.second && p.second != n / 3) flag = false; s ^= p.first; } if (flag && s == 0) ans = true; } if (ans) cout << "Yes" << endl; else cout << "No" << endl; }
[ "control_flow.branch.if.condition.change" ]
781,704
781,705
u936558609
cpp
p02975
#include <algorithm> #include <assert.h> #include <bitset> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define REP(i, m, n) for (int i = (int)(m); i < (int)(n); ++i) #define rep(i, n) REP(i, 0, n) using ll = long long; const int inf = 1e9 + 7; const ll longinf = 1LL << 60; const ll mod = 1e9 + 7; int main() { int N; cin >> N; map<ll, int> mp; bool zero = true; rep(i, N) { ll a; cin >> a; mp[a]++; if (a != 0) zero = false; } if (zero) { cout << "Yes" << endl; return 0; } if (mp.size() == 2) { for (auto t : mp) { if (t.first != 0) { if (t.second == 2 * mp[0]) { cout << "Yes" << endl; return 0; } } } } int cnt = 0; ll tmp[3]; if (N % 3 || mp.size() != 3) { cout << "No" << endl; return 0; } for (auto t : mp) { if (t.second != N / 3) { cout << "No" << endl; return 0; } tmp[cnt] = t.first; cnt++; } if (tmp[0] ^ tmp[1] != tmp[2]) { cout << "No" << endl; return 0; } cout << "Yes" << endl; }
#include <algorithm> #include <assert.h> #include <bitset> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define REP(i, m, n) for (int i = (int)(m); i < (int)(n); ++i) #define rep(i, n) REP(i, 0, n) using ll = long long; const int inf = 1e9 + 7; const ll longinf = 1LL << 60; const ll mod = 1e9 + 7; int main() { int N; cin >> N; map<ll, int> mp; bool zero = true; rep(i, N) { ll a; cin >> a; mp[a]++; if (a != 0) zero = false; } if (zero) { cout << "Yes" << endl; return 0; } if (mp.size() == 2) { for (auto t : mp) { if (t.first != 0) { if (t.second == 2 * mp[0]) { cout << "Yes" << endl; return 0; } } } } int cnt = 0; ll tmp[3]; if (N % 3 || mp.size() != 3) { cout << "No" << endl; return 0; } for (auto t : mp) { if (t.second != N / 3) { cout << "No" << endl; return 0; } tmp[cnt] = t.first; cnt++; } if ((tmp[0] ^ tmp[1]) != tmp[2]) { cout << "No" << endl; return 0; } cout << "Yes" << endl; }
[ "control_flow.branch.if.condition.change" ]
781,711
781,712
u841131859
cpp
p02975
#include <algorithm> #include <assert.h> #include <bitset> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define REP(i, m, n) for (int i = (int)(m); i < (int)(n); ++i) #define rep(i, n) REP(i, 0, n) using ll = long long; const int inf = 1e9 + 7; const ll longinf = 1LL << 60; const ll mod = 1e9 + 7; int main() { int N; cin >> N; map<ll, int> mp; bool zero = true; rep(i, N) { ll a; cin >> a; mp[a]++; if (a != 0) zero = false; } if (zero) { cout << "Yes" << endl; return 0; } if (mp.size() == 2) { for (auto t : mp) { if (t.first != 0) { if (t.second == 2 * mp[0]) { cout << "Yes" << endl; return 0; } } } } int cnt = 0; ll tmp[3]; if (N % 3 || mp.size() != 3) { cout << "No" << endl; return 0; } for (auto t : mp) { if (t.second != N / 3) { cout << "No" << endl; return 0; } tmp[cnt] = t.first; cnt++; } if (tmp[0] ^ tmp[1] != tmp[2]) { cout << "No" << endl; return 0; } cout << "Yes" << endl; }
#include <algorithm> #include <assert.h> #include <bitset> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define REP(i, m, n) for (int i = (int)(m); i < (int)(n); ++i) #define rep(i, n) REP(i, 0, n) using ll = long long; const int inf = 1e9 + 7; const ll longinf = 1LL << 60; const ll mod = 1e9 + 7; int main() { int N; cin >> N; map<ll, int> mp; bool zero = true; rep(i, N) { ll a; cin >> a; mp[a]++; if (a != 0) zero = false; } if (zero) { cout << "Yes" << endl; return 0; } if (mp.size() == 2) { for (auto t : mp) { if (t.first != 0) { if (t.second == 2 * mp[0]) { cout << "Yes" << endl; return 0; } } } } int cnt = 0; ll tmp[3]; if (N % 3 || mp.size() != 3) { cout << "No" << endl; return 0; } for (auto t : mp) { if (t.second != N / 3) { cout << "No" << endl; return 0; } tmp[cnt] = t.first; cnt++; } if ((tmp[0] ^ tmp[1]) != tmp[2]) { cout << "No" << endl; return 0; } cout << "Yes" << endl; }
[ "control_flow.branch.if.condition.change" ]
781,711
781,713
u841131859
cpp
p02975
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0; i < (int)(n); i++) typedef long long ll; typedef pair<int, int> P; const int INF = 1e9; int main() { ll N; cin >> N; vector<ll> A(N); map<ll, ll> mp{}; REP(i, N) cin >> A[i], mp[A[i]]++; if (mp.size() == 1) { if (mp[0] != 0) { cout << "Yes" << endl; return 0; } } if (mp.size() == 2 && N % 3 == 0) { ll tmp = 0; for (auto s : mp) { if (s.first != 0) tmp = s.second; } if (mp[0] * 3 == N && tmp * 3 / 2 == N) { cout << "Yes" << endl; return 0; } } if (mp.size() == 3 && N % 3 == 0) { vector<ll> a(0); for (auto s : mp) { a.push_back(s.first); if (s.second != N / 3) { cout << "No" << endl; return 0; } } if ((a[0] ^ a[1]) ^ a[2] == 0) { cout << "Yes" << endl; return 0; } } cout << "No" << endl; }
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0; i < (int)(n); i++) typedef long long ll; typedef pair<int, int> P; const int INF = 1e9; int main() { ll N; cin >> N; vector<ll> A(N); map<ll, ll> mp{}; REP(i, N) cin >> A[i], mp[A[i]]++; if (mp.size() == 1) { if (mp[0] != 0) { cout << "Yes" << endl; return 0; } } if (mp.size() == 2 && N % 3 == 0) { ll tmp = 0; for (auto s : mp) { if (s.first != 0) tmp = s.second; } if (mp[0] * 3 == N && tmp * 3 / 2 == N) { cout << "Yes" << endl; return 0; } } if (mp.size() == 3 && N % 3 == 0) { vector<ll> a(0); for (auto s : mp) { a.push_back(s.first); if (s.second != N / 3) { cout << "No" << endl; return 0; } } if (((a[0] ^ a[1]) ^ a[2]) == 0) { cout << "Yes" << endl; return 0; } } cout << "No" << endl; }
[ "control_flow.branch.if.condition.change" ]
781,726
781,727
u893239355
cpp
p02975
#include <bits/stdc++.h> using namespace std; #pragma region Macros #define ll long long #define ld long double #define FOR(i, l, r) for (ll i = (l); i < (r); ++i) #define REP(i, n) FOR(i, 0, n) #define REPS(i, n) FOR(i, 1, n + 1) #define RFOR(i, l, r) for (ll i = (l); i >= (r); --i) #define RREP(i, n) RFOR(i, n - 1, 0) #define RREPS(i, n) RFOR(i, n, 1) #define pb push_back #define eb emplace_back #define SZ(x) ((ll)(x).size()) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() template <class T = ll> using V = vector<T>; template <class T = ll> using VV = V<V<T>>; using P = pair<ll, ll>; #define VEC(type, name, size) \ V<type> name(size); \ IN(name) #define VVEC(type, name, h, w) \ VV<type> name(h, V<type>(w)); \ IN(name) #define INT(...) \ int __VA_ARGS__; \ IN(__VA_ARGS__) #define LL(...) \ ll __VA_ARGS__; \ IN(__VA_ARGS__) #define STR(...) \ string __VA_ARGS__; \ IN(__VA_ARGS__) #define CHAR(...) \ char __VA_ARGS__; \ IN(__VA_ARGS__) #define DOUBLE(...) \ DOUBLE __VA_ARGS__; \ IN(__VA_ARGS__) #define LD(...) \ LD __VA_ARGS__; \ IN(__VA_ARGS__) template <class T> void scan(T a) { cin >> a; } void scan(int &a) { cin >> a; } void scan(long long &a) { cin >> a; } void scan(char &a) { cin >> a; } void scan(double &a) { cin >> a; } void scan(long double &a) { cin >> a; } void scan(char a[]) { scanf("%s", a); } void scan(string &a) { cin >> a; } template <class T> void scan(V<T> &); template <class T, class L> void scan(pair<T, L> &); template <class T> void scan(V<T> &a) { for (auto &i : a) scan(i); } template <class T, class L> void scan(pair<T, L> &p) { scan(p.first); scan(p.second); } template <class T> void scan(T &a) { cin >> a; } void IN() {} template <class Head, class... Tail> void IN(Head &head, Tail &...tail) { scan(head); IN(tail...); } template <class T> inline void print(T x) { cout << x << '\n'; } struct inputoutputfaster { inputoutputfaster() { ios::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(15); } } inputoutputfaster_; template <class T> V<T> press(V<T> &x) { V<T> res = x; sort(all(res)); res.erase(unique(all(res)), res.end()); REP(i, SZ(x)) { x[i] = lower_bound(all(res), x[i]) - res.begin(); } return res; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } inline void Yes(bool b = true) { cout << (b ? "Yes" : "No") << '\n'; } inline void YES(bool b = true) { cout << (b ? "YES" : "NO") << '\n'; } inline void err(bool b = true) { if (b) { cout << -1 << '\n'; exit(0); } } template <class T> inline void fin(bool b = true, T e = 0) { if (b) { cout << e << '\n'; exit(0); } } template <class T> T divup(T x, T y) { return (x + (y - 1)) / y; } template <typename T> T pow(T a, long long n, T e = 1) { T ret = e; while (n) { if (n & 1) ret *= a; a *= a; n >>= 1; } return ret; } const ll INF = 1e18; #pragma endregion int main() { INT(n); VEC(int, a, n); bool allz = true; REP(i, n) if (a[i]) allz = false; fin(allz, "Yes"); fin(n % 3, "No"); sort(all(a)); fin(a[0] != a[n / 3 - 1] or a[n / 3] != a[n / 3 * 2 - 1] or a[n / 3 * 2] != a[n - 1], "No"); Yes((a[0] == 0 and a[n / 3] == a[n - 1]) or (a[0] ^ a[n / 3] ^ a[n - 1] == 0)); }
#include <bits/stdc++.h> using namespace std; #pragma region Macros #define ll long long #define ld long double #define FOR(i, l, r) for (ll i = (l); i < (r); ++i) #define REP(i, n) FOR(i, 0, n) #define REPS(i, n) FOR(i, 1, n + 1) #define RFOR(i, l, r) for (ll i = (l); i >= (r); --i) #define RREP(i, n) RFOR(i, n - 1, 0) #define RREPS(i, n) RFOR(i, n, 1) #define pb push_back #define eb emplace_back #define SZ(x) ((ll)(x).size()) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() template <class T = ll> using V = vector<T>; template <class T = ll> using VV = V<V<T>>; using P = pair<ll, ll>; #define VEC(type, name, size) \ V<type> name(size); \ IN(name) #define VVEC(type, name, h, w) \ VV<type> name(h, V<type>(w)); \ IN(name) #define INT(...) \ int __VA_ARGS__; \ IN(__VA_ARGS__) #define LL(...) \ ll __VA_ARGS__; \ IN(__VA_ARGS__) #define STR(...) \ string __VA_ARGS__; \ IN(__VA_ARGS__) #define CHAR(...) \ char __VA_ARGS__; \ IN(__VA_ARGS__) #define DOUBLE(...) \ DOUBLE __VA_ARGS__; \ IN(__VA_ARGS__) #define LD(...) \ LD __VA_ARGS__; \ IN(__VA_ARGS__) template <class T> void scan(T a) { cin >> a; } void scan(int &a) { cin >> a; } void scan(long long &a) { cin >> a; } void scan(char &a) { cin >> a; } void scan(double &a) { cin >> a; } void scan(long double &a) { cin >> a; } void scan(char a[]) { scanf("%s", a); } void scan(string &a) { cin >> a; } template <class T> void scan(V<T> &); template <class T, class L> void scan(pair<T, L> &); template <class T> void scan(V<T> &a) { for (auto &i : a) scan(i); } template <class T, class L> void scan(pair<T, L> &p) { scan(p.first); scan(p.second); } template <class T> void scan(T &a) { cin >> a; } void IN() {} template <class Head, class... Tail> void IN(Head &head, Tail &...tail) { scan(head); IN(tail...); } template <class T> inline void print(T x) { cout << x << '\n'; } struct inputoutputfaster { inputoutputfaster() { ios::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(15); } } inputoutputfaster_; template <class T> V<T> press(V<T> &x) { V<T> res = x; sort(all(res)); res.erase(unique(all(res)), res.end()); REP(i, SZ(x)) { x[i] = lower_bound(all(res), x[i]) - res.begin(); } return res; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } inline void Yes(bool b = true) { cout << (b ? "Yes" : "No") << '\n'; } inline void YES(bool b = true) { cout << (b ? "YES" : "NO") << '\n'; } inline void err(bool b = true) { if (b) { cout << -1 << '\n'; exit(0); } } template <class T> inline void fin(bool b = true, T e = 0) { if (b) { cout << e << '\n'; exit(0); } } template <class T> T divup(T x, T y) { return (x + (y - 1)) / y; } template <typename T> T pow(T a, long long n, T e = 1) { T ret = e; while (n) { if (n & 1) ret *= a; a *= a; n >>= 1; } return ret; } const ll INF = 1e18; #pragma endregion int main() { INT(n); VEC(int, a, n); bool allz = true; REP(i, n) if (a[i]) allz = false; fin(allz, "Yes"); fin(n % 3, "No"); sort(all(a)); fin(a[0] != a[n / 3 - 1] or a[n / 3] != a[n / 3 * 2 - 1] or a[n / 3 * 2] != a[n - 1], "No"); Yes((a[0] == 0 and a[n / 3] == a[n - 1]) or (((a[0] ^ a[n / 3]) ^ a[n - 1]) == 0)); }
[ "call.arguments.add", "call.arguments.change" ]
781,728
781,729
u342075214
cpp
p02975
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { int n; cin >> n; vector<int> a(n); rep(i, n) cin >> a[i]; map<int, int> mp; rep(i, n)++ mp[a[i]]; int cnt = 0; bool exist = false; for (auto itr = mp.begin(); itr != mp.end(); ++itr) ++cnt; if (cnt == 1 && mp[0] > 0) exist = true; if (cnt == 2 && 3 * mp[0] == n) exist = true; if (cnt == 3) { auto itr = mp.begin(); int a1 = itr->first; int n1 = (itr++)->second; int a2 = itr->first; int n2 = (itr++)->second; int a3 = itr->first; int n3 = (itr++)->second; if (a1 ^ a2 == a3 && n1 == n2 && n1 == n3) exist = true; } if (exist) cout << "Yes" << endl; else cout << "No" << endl; return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { int n; cin >> n; vector<int> a(n); rep(i, n) cin >> a[i]; map<int, int> mp; rep(i, n)++ mp[a[i]]; int cnt = 0; bool exist = false; for (auto itr = mp.begin(); itr != mp.end(); ++itr) ++cnt; if (cnt == 1 && mp[0] > 0) exist = true; if (cnt == 2 && 3 * mp[0] == n) exist = true; if (cnt == 3) { auto itr = mp.begin(); int a1 = itr->first; int n1 = (itr++)->second; int a2 = itr->first; int n2 = (itr++)->second; int a3 = itr->first; int n3 = (itr++)->second; if ((a1 ^ a2) == a3 && n1 == n2 && n1 == n3) exist = true; } if (exist) cout << "Yes" << endl; else cout << "No" << endl; return 0; }
[ "control_flow.branch.if.condition.change" ]
781,736
781,737
u714642046
cpp
p02975
#include <bits/stdc++.h> #include <cstdint> #include <vector> #define FOR(i, l, r) for (int i = (l); i < (r); ++i) #define RFOR(i, l, r) for (int i = (l); i >= (int)(r); i--) #define rep(i, n) FOR(i, 0, n) #define rrep(i, n) RFOR(i, n - 1, 0) #define int long long using namespace std; const int MX = 1e6; const int inf = 1e13; const int mod = 1e9 + 7; #define ll long long signed main() { int n; cin >> n; vector<int> a(n); rep(i, n) cin >> a[i]; set<int> s; rep(i, n) { s.insert(a[i]); } if (s.size() == 1) { for (auto m : s) { if (m == 0) { cout << "Yes" << endl; return 0; } else { cout << "No" << endl; return 0; } } } if (s.size() == 2) { bool f = false; for (auto m : s) { if (m == 0) f = true; } if (!f) cout << "No" << endl; else { int cnt = 0; rep(i, n) { if (a[i] == 0) cnt++; } if (n % 3 == 0 && cnt == n / 3) { cout << "Yes" << endl; } else cout << "No" << endl; } return 0; } if (n % 3 == 0 && s.size() == 3) { vector<int> b; for (auto m : s) { b.push_back(m); } vector<int> c(3); rep(i, n) { if (b[0] == a[i]) c[0]++; if (b[1] == a[i]) c[1]++; if (b[2] == a[i]) c[2]++; } if (b[0] ^ b[1] ^ b[2] == 0 && c[0] == n / 3 && c[1] == n / 3 && c[2] == n / 3) { cout << "Yes" << endl; return 0; } } cout << "No" << endl; return 0; }
#include <bits/stdc++.h> #include <cstdint> #include <vector> #define FOR(i, l, r) for (int i = (l); i < (r); ++i) #define RFOR(i, l, r) for (int i = (l); i >= (int)(r); i--) #define rep(i, n) FOR(i, 0, n) #define rrep(i, n) RFOR(i, n - 1, 0) #define int long long using namespace std; const int MX = 1e6; const int inf = 1e13; const int mod = 1e9 + 7; #define ll long long signed main() { int n; cin >> n; vector<int> a(n); rep(i, n) cin >> a[i]; set<int> s; rep(i, n) { s.insert(a[i]); } if (s.size() == 1) { for (auto m : s) { if (m == 0) { cout << "Yes" << endl; return 0; } else { cout << "No" << endl; return 0; } } } if (s.size() == 2) { bool f = false; for (auto m : s) { if (m == 0) f = true; } if (!f) cout << "No" << endl; else { int cnt = 0; rep(i, n) { if (a[i] == 0) cnt++; } if (n % 3 == 0 && cnt == n / 3) { cout << "Yes" << endl; } else cout << "No" << endl; } return 0; } if (n % 3 == 0 && s.size() == 3) { vector<int> b; for (auto m : s) { b.push_back(m); } vector<int> c(3, 0); rep(i, n) { if (b[0] == a[i]) c[0]++; if (b[1] == a[i]) c[1]++; if (b[2] == a[i]) c[2]++; } if ((b[0] ^ b[1] ^ b[2]) == 0 && c[0] == n / 3 && c[1] == n / 3 && c[2] == n / 3) { cout << "Yes" << endl; return 0; } } cout << "No" << endl; return 0; }
[ "call.arguments.add", "control_flow.branch.if.condition.change" ]
781,755
781,756
u762160119
cpp
p02975
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n); int z = 0; set<int> st; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) z++; st.insert(a[i]); } if (z == n) { cout << "Yes" << endl; return 0; } if (st.size() == 2 && n % 3 == 0) { if (z == n / 3) { cout << "Yes" << endl; return 0; } } if (st.size() == 3) { sort(a.begin(), a.end()); if (a[n / 3 - 1] != a[n / 3] && a[n / 3 * 2 - 1] != a[n / 3 * 2] && (a[0] ^ a[n / 3] == a[n - 1])) { cout << "Yes" << endl; return 0; } } cout << "No" << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n); int z = 0; set<int> st; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) z++; st.insert(a[i]); } if (z == n) { cout << "Yes" << endl; return 0; } if (st.size() == 2 && n % 3 == 0) { if (z == n / 3) { cout << "Yes" << endl; return 0; } } if (st.size() == 3) { sort(a.begin(), a.end()); if (a[n / 3 - 1] != a[n / 3] && a[n / 3 * 2 - 1] != a[n / 3 * 2] && ((a[0] ^ a[n / 3]) == a[n - 1])) { cout << "Yes" << endl; return 0; } } cout << "No" << endl; return 0; }
[ "control_flow.branch.if.condition.change" ]
781,757
781,758
u174509352
cpp
p02975
#include <bits/stdc++.h> #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define codefor \ int test; \ scanf("%d", &test); \ while (test--) #define yn(ans) \ if (ans) \ printf("Yes\n"); \ else \ printf("No\n") #define YN(ans) \ if (ans) \ printf("YES\n"); \ else \ printf("NO\n") #define umap unordered_map #define uset unordered_set using namespace std; using ll = long long; const int MOD = 1000000007; //入力系 void scan(int &a) { scanf("%d", &a); } void scan(long long &a) { scanf("%lld", &a); } template <class T> void scan(T &a) { cin >> a; } template <class T> void scan(vector<T> &vec) { for (auto &&it : vec) scan(it); } void in() {} template <class Head, class... Tail> void in(Head &head, Tail &...tail) { scan(head); in(tail...); } //出力系 void print(const int &a) { printf("%d", a); } void print(const long long &a) { printf("%lld", a); } void print(const double &a) { printf("%.15lf", a); } template <class T> void print(const T &a) { cout << a; } template <class T> void print(const vector<T> &vec) { if (vec.empty()) return; print(vec[0]); for (auto it = vec.begin(); ++it != vec.end();) { putchar(' '); print(*it); } } void out() { putchar('\n'); } template <class T> void out(const T &t) { print(t); putchar('\n'); } template <class Head, class... Tail> void out(const Head &head, const Tail &...tail) { print(head); putchar(' '); out(tail...); } //デバッグ系 template <class T> void dprint(const T &a) { cerr << a; } template <class T> void dprint(const vector<T> &vec) { if (vec.empty()) return; cerr << vec[0]; for (auto it = vec.begin(); ++it != vec.end();) { cerr << " " << *it; } } void debug() { cerr << endl; } template <class T> void debug(const T &t) { dprint(t); cerr << endl; } template <class Head, class... Tail> void debug(const Head &head, const Tail &...tail) { dprint(head); cerr << " "; debug(tail...); } int main() { int n; in(n); vector<int> vec(n); set<int> kind; map<int, int> memo; rep(i, n) { in(vec[i]); if (kind.count(vec[i])) { memo[vec[i]]++; } else { kind.insert(vec[i]); memo[vec[i]] = 1; } } if (kind.size() >= 4) { out("No"); } else if (kind.size() == 3) { vector<int> vec(3); int i = 0; for (auto value : kind) { vec[i] = value; i++; } bitset<32> abit(vec[0]), bbit(vec[1]), cbit(vec[2]); abit = (abit ^ bbit); abit = (abit ^ cbit); yn(abit.to_ullong() == 0 && memo[vec[0]] == memo[vec[1]] && memo[vec[1]] == memo[vec[2]]); } else if (kind.size() == 2) { vector<int> vec(2); int i = 0; for (auto value : kind) { vec[i] = value; i++; } sort(all(vec)); yn(vec[0] == 0 && memo[vec[0]] == 2 * memo[vec[1]]); } else { yn(*begin(kind) == 0); } }
#include <bits/stdc++.h> #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define codefor \ int test; \ scanf("%d", &test); \ while (test--) #define yn(ans) \ if (ans) \ printf("Yes\n"); \ else \ printf("No\n") #define YN(ans) \ if (ans) \ printf("YES\n"); \ else \ printf("NO\n") #define umap unordered_map #define uset unordered_set using namespace std; using ll = long long; const int MOD = 1000000007; //入力系 void scan(int &a) { scanf("%d", &a); } void scan(long long &a) { scanf("%lld", &a); } template <class T> void scan(T &a) { cin >> a; } template <class T> void scan(vector<T> &vec) { for (auto &&it : vec) scan(it); } void in() {} template <class Head, class... Tail> void in(Head &head, Tail &...tail) { scan(head); in(tail...); } //出力系 void print(const int &a) { printf("%d", a); } void print(const long long &a) { printf("%lld", a); } void print(const double &a) { printf("%.15lf", a); } template <class T> void print(const T &a) { cout << a; } template <class T> void print(const vector<T> &vec) { if (vec.empty()) return; print(vec[0]); for (auto it = vec.begin(); ++it != vec.end();) { putchar(' '); print(*it); } } void out() { putchar('\n'); } template <class T> void out(const T &t) { print(t); putchar('\n'); } template <class Head, class... Tail> void out(const Head &head, const Tail &...tail) { print(head); putchar(' '); out(tail...); } //デバッグ系 template <class T> void dprint(const T &a) { cerr << a; } template <class T> void dprint(const vector<T> &vec) { if (vec.empty()) return; cerr << vec[0]; for (auto it = vec.begin(); ++it != vec.end();) { cerr << " " << *it; } } void debug() { cerr << endl; } template <class T> void debug(const T &t) { dprint(t); cerr << endl; } template <class Head, class... Tail> void debug(const Head &head, const Tail &...tail) { dprint(head); cerr << " "; debug(tail...); } int main() { int n; in(n); vector<int> vec(n); uset<int> kind; umap<int, int> memo; rep(i, n) { in(vec[i]); if (kind.count(vec[i])) { memo[vec[i]]++; } else { kind.insert(vec[i]); memo[vec[i]] = 1; } } if (kind.size() >= 4) { out("No"); } else if (kind.size() == 3) { vector<int> vec(3); int i = 0; for (auto value : kind) { vec[i] = value; i++; } bitset<32> abit(vec[0]), bbit(vec[1]), cbit(vec[2]); abit = (abit ^ bbit); abit = (abit ^ cbit); yn(abit.to_ullong() == 0 && memo[vec[0]] == memo[vec[1]] && memo[vec[1]] == memo[vec[2]]); } else if (kind.size() == 2) { vector<int> vec(2); int i = 0; for (auto value : kind) { vec[i] = value; i++; } sort(all(vec)); yn(vec[0] == 0 && 2 * memo[vec[0]] == memo[vec[1]]); } else { yn(*begin(kind) == 0); } }
[ "variable_declaration.type.change", "expression.operation.binary.remove" ]
781,767
781,768
u225660136
cpp
p02975
#include <bits/stdc++.h> #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define codefor \ int test; \ scanf("%d", &test); \ while (test--) #define yn(ans) \ if (ans) \ printf("Yes\n"); \ else \ printf("No\n") #define YN(ans) \ if (ans) \ printf("YES\n"); \ else \ printf("NO\n") #define umap unordered_map #define uset unordered_set using namespace std; using ll = long long; const int MOD = 1000000007; //入力系 void scan(int &a) { scanf("%d", &a); } void scan(long long &a) { scanf("%lld", &a); } template <class T> void scan(T &a) { cin >> a; } template <class T> void scan(vector<T> &vec) { for (auto &&it : vec) scan(it); } void in() {} template <class Head, class... Tail> void in(Head &head, Tail &...tail) { scan(head); in(tail...); } //出力系 void print(const int &a) { printf("%d", a); } void print(const long long &a) { printf("%lld", a); } void print(const double &a) { printf("%.15lf", a); } template <class T> void print(const T &a) { cout << a; } template <class T> void print(const vector<T> &vec) { if (vec.empty()) return; print(vec[0]); for (auto it = vec.begin(); ++it != vec.end();) { putchar(' '); print(*it); } } void out() { putchar('\n'); } template <class T> void out(const T &t) { print(t); putchar('\n'); } template <class Head, class... Tail> void out(const Head &head, const Tail &...tail) { print(head); putchar(' '); out(tail...); } //デバッグ系 template <class T> void dprint(const T &a) { cerr << a; } template <class T> void dprint(const vector<T> &vec) { if (vec.empty()) return; cerr << vec[0]; for (auto it = vec.begin(); ++it != vec.end();) { cerr << " " << *it; } } void debug() { cerr << endl; } template <class T> void debug(const T &t) { dprint(t); cerr << endl; } template <class Head, class... Tail> void debug(const Head &head, const Tail &...tail) { dprint(head); cerr << " "; debug(tail...); } int main() { int n; in(n); vector<int> vec(n); set<int> kind; map<int, int> memo; rep(i, n) { in(vec[i]); if (kind.count(vec[i])) { memo[vec[i]]++; } else { kind.insert(vec[i]); memo[vec[i]] = 1; } } if (kind.size() >= 4) { out("No"); } else if (kind.size() == 3) { vector<int> vec(3); int i = 0; for (auto value : kind) { vec[i] = value; i++; } bitset<32> abit(vec[0]), bbit(vec[1]), cbit(vec[2]); abit = (abit ^ bbit); abit = (abit ^ cbit); yn(abit.to_ullong() == 0 && memo[vec[0]] == memo[vec[1]] && memo[vec[1]] == memo[vec[2]]); } else if (kind.size() == 2) { vector<int> vec(2); int i = 0; for (auto value : kind) { vec[i] = value; i++; } sort(all(vec)); yn(vec[0] == 0 && memo[vec[0]] == 2 * memo[vec[1]]); } else { yn(*begin(kind) == 0); } }
#include <bits/stdc++.h> #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define codefor \ int test; \ scanf("%d", &test); \ while (test--) #define yn(ans) \ if (ans) \ printf("Yes\n"); \ else \ printf("No\n") #define YN(ans) \ if (ans) \ printf("YES\n"); \ else \ printf("NO\n") #define umap unordered_map #define uset unordered_set using namespace std; using ll = long long; const int MOD = 1000000007; //入力系 void scan(int &a) { scanf("%d", &a); } void scan(long long &a) { scanf("%lld", &a); } template <class T> void scan(T &a) { cin >> a; } template <class T> void scan(vector<T> &vec) { for (auto &&it : vec) scan(it); } void in() {} template <class Head, class... Tail> void in(Head &head, Tail &...tail) { scan(head); in(tail...); } //出力系 void print(const int &a) { printf("%d", a); } void print(const long long &a) { printf("%lld", a); } void print(const double &a) { printf("%.15lf", a); } template <class T> void print(const T &a) { cout << a; } template <class T> void print(const vector<T> &vec) { if (vec.empty()) return; print(vec[0]); for (auto it = vec.begin(); ++it != vec.end();) { putchar(' '); print(*it); } } void out() { putchar('\n'); } template <class T> void out(const T &t) { print(t); putchar('\n'); } template <class Head, class... Tail> void out(const Head &head, const Tail &...tail) { print(head); putchar(' '); out(tail...); } //デバッグ系 template <class T> void dprint(const T &a) { cerr << a; } template <class T> void dprint(const vector<T> &vec) { if (vec.empty()) return; cerr << vec[0]; for (auto it = vec.begin(); ++it != vec.end();) { cerr << " " << *it; } } void debug() { cerr << endl; } template <class T> void debug(const T &t) { dprint(t); cerr << endl; } template <class Head, class... Tail> void debug(const Head &head, const Tail &...tail) { dprint(head); cerr << " "; debug(tail...); } int main() { int n; in(n); vector<int> vec(n); set<int> kind; map<int, int> memo; rep(i, n) { in(vec[i]); if (kind.count(vec[i])) { memo[vec[i]]++; } else { kind.insert(vec[i]); memo[vec[i]] = 1; } } if (kind.size() >= 4) { out("No"); } else if (kind.size() == 3) { vector<int> vec(3); int i = 0; for (auto value : kind) { vec[i] = value; i++; } bitset<32> abit(vec[0]), bbit(vec[1]), cbit(vec[2]); abit = (abit ^ bbit); abit = (abit ^ cbit); yn(abit.to_ullong() == 0 && memo[vec[0]] == memo[vec[1]] && memo[vec[1]] == memo[vec[2]]); } else if (kind.size() == 2) { vector<int> vec(2); int i = 0; for (auto value : kind) { vec[i] = value; i++; } sort(all(vec)); yn(vec[0] == 0 && 2 * memo[vec[0]] == memo[vec[1]]); } else { yn(*begin(kind) == 0); } }
[ "expression.operation.binary.remove" ]
781,767
781,769
u225660136
cpp
p02975
#include <iostream> //#include <iomanip> //#include <string> #include <vector> //#include <algorithm> //#include <utility> //#include <set> #include <map> //#include <queue> //#include <deque> //#include <bitset> //#include <math.h> using namespace std; using ll = long long; // using ld = long double ; using vll = vector<ll>; // using vvll = vector<vll> ; // using vc = vector<char> ; // using vvc = vector<vc> ; // using vb = vector<bool> ; // using vvb = vector<vb> ; // using pll = pair<ll,ll> ; ll mod = 1000000007; // long double pie = acos(-1) ; void yorn(bool a) { if (a) cout << "Yes"; else cout << "No"; cout << endl; } // string yorn(bool a){if(a) return"Yes" ; return "No" ;} // string YorN(bool a){if(a) return"YES" ; return "NO" ;} // ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;} // ll lcm(long long a,long long b){return a/gcd(a,b)*b ;} // ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;} // void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;} // void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;} int main() { ll n; cin >> n; map<ll, ll> s; vll num(0); for (int i = 0; i < n; i++) { ll a; cin >> a; if (s.count(a)) s[a]++; else { s[a] = 1; num.push_back(a); } } if (s.size() == 1) { yorn(num.at(0) == 0); return 0; } if (s.size() == 2) { yorn(n % 3 == 0 && s.count(0) && s[0] == n / 3); return 0; } if (s.size() == 3) { if (n % 3 != 0) yorn(0); else yorn(s[num.at(0)] == s[num.at(1)] && s[num.at(1)] == s[num.at(2)] && num.at(0) ^ num.at(1) ^ num.at(2) == 0); return 0; } yorn(0); }
#include <iostream> //#include <iomanip> //#include <string> #include <vector> //#include <algorithm> //#include <utility> //#include <set> #include <map> //#include <queue> //#include <deque> //#include <bitset> //#include <math.h> using namespace std; using ll = long long; // using ld = long double ; using vll = vector<ll>; // using vvll = vector<vll> ; // using vc = vector<char> ; // using vvc = vector<vc> ; // using vb = vector<bool> ; // using vvb = vector<vb> ; // using pll = pair<ll,ll> ; ll mod = 1000000007; // long double pie = acos(-1) ; void yorn(bool a) { if (a) cout << "Yes"; else cout << "No"; cout << endl; } // string yorn(bool a){if(a) return"Yes" ; return "No" ;} // string YorN(bool a){if(a) return"YES" ; return "NO" ;} // ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;} // ll lcm(long long a,long long b){return a/gcd(a,b)*b ;} // ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;} // void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;} // void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;} int main() { ll n; cin >> n; map<ll, ll> s; vll num(0); for (int i = 0; i < n; i++) { ll a; cin >> a; if (s.count(a)) s[a]++; else { s[a] = 1; num.push_back(a); } } if (s.size() == 1) { yorn(num.at(0) == 0); return 0; } if (s.size() == 2) { yorn(n % 3 == 0 && s.count(0) && s[0] == n / 3); return 0; } if (s.size() == 3) { if (n % 3 != 0) yorn(0); else yorn(s[num.at(0)] == s[num.at(1)] && s[num.at(1)] == s[num.at(2)] && (num.at(0) ^ num.at(1) ^ num.at(2)) == 0); return 0; } yorn(0); }
[ "call.arguments.change" ]
781,799
781,800
u993074316
cpp
p02975
#include <bits/stdc++.h> typedef long long ll; typedef long double ld; const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10; const ll LINF = 1e18; using namespace std; #define rep(i, n) for (int(i) = 0; (i) < (int)(n); (i)++) #define rrep(i, a, b) for (int i = (a); i < (b); i++) #define rrrep(i, a, b) for (int i = (a); i >= (b); i--) #define all(v) (v).begin(), (v).end() #define Size(n) (n).size() #define Cout(x) cout << (x) << endl #define doublecout(a) cout << fixed << setprecision(15) << a << endl; #define Cerr(x) cerr << (x) << endl #define fi first #define se second #define P pair<ll, ll> #define m_p make_pair #define V vector<ll> #define U_MAP unordered_map<ll, ll> ll n, cnt, ans, a[ohara], b, c, d, tmp, tmpp, m, h, w, x, y, sum, pos, k; ld doua; int dy[] = {1, 0, -1, 0}; int dx[] = {0, 1, 0, -1}; // int dy[]={-1,0,1,-1,1,-1,0,1}; // int dx[]={-1,-1,-1,0,0,1,1,1}; string alph("abcdefghijklmnopqrstuvwxyz"), s; bool fl; struct edge { int to, cost; }; //-------------------------↓↓↓↓↓↓------------------------ //------ 自分を天才だと信じる ------ int main(void) { cin.tie(0); cout.tie(0); ios::sync_with_stdio(false); cin >> n; rep(i, n) cin >> a[i]; ans = 0; rep(i, n) { ans = (ans xor a[i]); } Cout(ans); rep(i, n) { if ((ans xor a[i]) != a[i]) { Cout("No"); return 0; } } Cout("Yes"); return 0; }
#include <bits/stdc++.h> typedef long long ll; typedef long double ld; const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10; const ll LINF = 1e18; using namespace std; #define rep(i, n) for (int(i) = 0; (i) < (int)(n); (i)++) #define rrep(i, a, b) for (int i = (a); i < (b); i++) #define rrrep(i, a, b) for (int i = (a); i >= (b); i--) #define all(v) (v).begin(), (v).end() #define Size(n) (n).size() #define Cout(x) cout << (x) << endl #define doublecout(a) cout << fixed << setprecision(15) << a << endl; #define Cerr(x) cerr << (x) << endl #define fi first #define se second #define P pair<ll, ll> #define m_p make_pair #define V vector<ll> #define U_MAP unordered_map<ll, ll> ll n, cnt, ans, a[ohara], b, c, d, tmp, tmpp, m, h, w, x, y, sum, pos, k; ld doua; int dy[] = {1, 0, -1, 0}; int dx[] = {0, 1, 0, -1}; // int dy[]={-1,0,1,-1,1,-1,0,1}; // int dx[]={-1,-1,-1,0,0,1,1,1}; string alph("abcdefghijklmnopqrstuvwxyz"), s; bool fl; struct edge { int to, cost; }; //-------------------------↓↓↓↓↓↓------------------------ //------ 自分を天才だと信じる ------ int main(void) { cin.tie(0); cout.tie(0); ios::sync_with_stdio(false); cin >> n; rep(i, n) cin >> a[i]; ans = 0; rep(i, n) { ans = (ans xor a[i]); } rep(i, n) { if ((ans xor a[i]) != a[i]) { Cout("No"); return 0; } } Cout("Yes"); return 0; }
[ "call.remove" ]
781,802
781,803
u876335718
cpp
p02975
#include <iostream> #include <stdio.h> using namespace std; int main() { int x, i, y, j; int chk = 0; cin >> x; int *ar = (int *)malloc(x * sizeof(int)); for (i = 1; i <= x; i++) { cin >> y; ar[i - 1] = y; } for (j = 0; j < x; j++) { chk = chk ^ ar[j]; } if (chk == 0) { cout << "yes" << endl; } else { cout << "No" << endl; } }
#include <iostream> #include <stdio.h> using namespace std; int main() { int x, i, y, j; int chk = 0; cin >> x; int *ar = (int *)malloc(x * sizeof(int)); for (i = 1; i <= x; i++) { cin >> y; ar[i - 1] = y; } for (j = 0; j < x; j++) { chk = chk ^ ar[j]; } if (chk == 0) { cout << "Yes" << endl; } else { cout << "No" << endl; } }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
781,804
781,805
u018679195
cpp
p02975
#include <algorithm> #include <iostream> #include <vector> using namespace std; int a[112345]; int main() { int n, i; cin >> n; for (i = 0; i < n; ++i) cin >> a[i]; sort(a, a + n); vector<pair<int, int>> t; int cnt = 0; t.push_back({a[0], 1}); for (i = 1; i < n; ++i) { if (a[i] != a[i - 1]) { t.push_back({a[i], 1}); ++cnt; } else t[cnt].second++; if (cnt > 3) break; } if (cnt >= 3) cout << "No" << endl; else if (cnt == 0) { if (t[0].first == 0) cout << "Yes" << endl; else cout << "No" << endl; } else { if (n % 3) cout << "No" << endl; else { if (cnt == 1) { if (t[0].first == 1 && t[0].second == (n / 3)) cout << "Yes" << endl; else cout << "No" << endl; } else { if (t[0].second == t[1].second && t[1].second == t[2].second) { if ((t[0].first ^ t[1].first ^ t[2].first) == 0) cout << "Yes" << endl; else cout << "No" << endl; } else cout << "No" << endl; } } } }
#include <algorithm> #include <iostream> #include <vector> using namespace std; int a[112345]; int main() { int n, i; cin >> n; for (i = 0; i < n; ++i) cin >> a[i]; sort(a, a + n); vector<pair<int, int>> t; int cnt = 0; t.push_back({a[0], 1}); for (i = 1; i < n; ++i) { if (a[i] != a[i - 1]) { t.push_back({a[i], 1}); ++cnt; } else t[cnt].second++; if (cnt >= 3) break; } if (cnt >= 3) cout << "No" << endl; else if (cnt == 0) { if (t[0].first == 0) cout << "Yes" << endl; else cout << "No" << endl; } else { if (n % 3) cout << "No" << endl; else { if (cnt == 1) { if (t[0].first == 0 && t[0].second == (n / 3)) cout << "Yes" << endl; else cout << "No" << endl; } else { if (t[0].second == t[1].second && t[1].second == t[2].second) { if ((t[0].first ^ t[1].first ^ t[2].first) == 0) cout << "Yes" << endl; else cout << "No" << endl; } else cout << "No" << endl; } } } }
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change", "literal.number.change" ]
781,818
781,819
u505492660
cpp
p02975
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using V = vector<int>; using VV = vector<V>; using VVV = vector<VV>; using VL = vector<ll>; using VVL = vector<VL>; using VVVL = vector<VVL>; template <class T> using VE = vector<T>; template <class T> using P = pair<T, T>; #define rep(i, n) for (int i = 0; i < (n); i++) #define rep1(i, n) for (int i = 1; i <= (n); i++) #define REP(i, k, n) for (int i = (k); i < (n); i++) #define all(a) (a).begin(), (a).end() #define output(x, y) cout << fixed << setprecision(y) << x << endl; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } const ll MOD = 1e9 + 7; // const ll MOD = 998244353; ll upper = MOD + MOD; ll under = -upper; ll UPPER = MOD * MOD; ll UNDER = -UPPER; const long double pi = 3.141592653589793; int main() { // もっときれいにできなかったのか int n; cin >> n; V a(n); rep(i, n) { cin >> a[i]; } sort(all(a)); V b = a; b.erase(unique(all(b)), b.end()); if (b.size() >= 4) { cout << "No" << endl; return 0; } map<int, int> mp; rep(i, n) { mp[a[i]]++; } if (mp[0] == n) { cout << "Yes" << endl; return 0; } else { if (n % 3 != 0) { cout << "No" << endl; return 0; } else { if (mp.size() == 2) { int cnt = mp[0]; int cnt2 = mp[b[1]]; if (cnt2 == cnt * 2) cout << "Yes" << endl; else cout << "No" << endl; } else { if ((b[0] ^ b[1] == b[2])) { int cnt = mp[b[0]]; int cnt2 = mp[b[1]]; int cnt3 = mp[b[2]]; if (cnt == cnt2 && cnt2 == cnt3) cout << "Yes" << endl; else cout << "No" << endl; } else cout << "No" << endl; } } } return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using V = vector<int>; using VV = vector<V>; using VVV = vector<VV>; using VL = vector<ll>; using VVL = vector<VL>; using VVVL = vector<VVL>; template <class T> using VE = vector<T>; template <class T> using P = pair<T, T>; #define rep(i, n) for (int i = 0; i < (n); i++) #define rep1(i, n) for (int i = 1; i <= (n); i++) #define REP(i, k, n) for (int i = (k); i < (n); i++) #define all(a) (a).begin(), (a).end() #define output(x, y) cout << fixed << setprecision(y) << x << endl; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } const ll MOD = 1e9 + 7; // const ll MOD = 998244353; ll upper = MOD + MOD; ll under = -upper; ll UPPER = MOD * MOD; ll UNDER = -UPPER; const long double pi = 3.141592653589793; int main() { // もっときれいにできなかったのか int n; cin >> n; V a(n); rep(i, n) { cin >> a[i]; } sort(all(a)); V b = a; b.erase(unique(all(b)), b.end()); if (b.size() >= 4) { cout << "No" << endl; return 0; } map<int, int> mp; rep(i, n) { mp[a[i]]++; } if (mp[0] == n) { cout << "Yes" << endl; return 0; } else { if (n % 3 != 0) { cout << "No" << endl; return 0; } else { if (mp.size() == 2) { int cnt = mp[0]; int cnt2 = mp[b[1]]; if (cnt2 == cnt * 2) cout << "Yes" << endl; else cout << "No" << endl; } else { if ((b[0] ^ b[1]) == b[2]) { int cnt = mp[b[0]]; int cnt2 = mp[b[1]]; int cnt3 = mp[b[2]]; if (cnt == cnt2 && cnt2 == cnt3) cout << "Yes" << endl; else cout << "No" << endl; } else cout << "No" << endl; } } } return 0; }
[ "control_flow.branch.if.condition.change" ]
781,820
781,821
u836743234
cpp
p02975
#include <bits/stdc++.h> using namespace std; using ll = long long; constexpr long long MOD = 1000000007; constexpr long long INF = 1LL << 60; const long double PI = acosl(-1.0); constexpr long double EPS = 1e-11; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } int main() { ll n; cin >> n; map<ll, ll> mp; for (ll i = 0; i < n; i++) { ll t; cin >> t; mp[t]++; } if (mp.size() == 1 and mp.count(0)) cout << "Yes" << endl; else if (mp.size() == 2 and (n % 3) == 0 and mp.count(0)) { for (auto i : mp) { if (i.first == 0) continue; if (i.second == 2 * n / 3 and mp.at(0) == n / 3) { cout << "Yes" << endl; } else cout << "No" << endl; } } else if (mp.size() == 3 and (n % 3) == 0) { ll a = 0; for (auto i : mp) a ^= i.first; bool flag = true; for (auto i : mp) { if (i.second != (n / 3)) flag = false; } if (flag) cout << "Yes" << endl; else cout << "No" << endl; } else cout << "No" << endl; }
#include <bits/stdc++.h> using namespace std; using ll = long long; constexpr long long MOD = 1000000007; constexpr long long INF = 1LL << 60; const long double PI = acosl(-1.0); constexpr long double EPS = 1e-11; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } int main() { ll n; cin >> n; map<ll, ll> mp; for (ll i = 0; i < n; i++) { ll t; cin >> t; mp[t]++; } if (mp.size() == 1 and mp.count(0)) cout << "Yes" << endl; else if (mp.size() == 2 and (n % 3) == 0 and mp.count(0)) { for (auto i : mp) { if (i.first == 0) continue; if (i.second == 2 * n / 3 and mp.at(0) == n / 3) { cout << "Yes" << endl; } else cout << "No" << endl; } } else if (mp.size() == 3 and (n % 3) == 0) { ll a = 0; for (auto i : mp) a ^= i.first; bool flag = true; for (auto i : mp) { if (i.second != (n / 3)) flag = false; } if (flag and a == 0) cout << "Yes" << endl; else cout << "No" << endl; } else cout << "No" << endl; }
[ "control_flow.branch.if.condition.change", "variable_declaration.add" ]
781,822
781,823
u371051907
cpp
p02975
#include <bits/stdc++.h> using namespace std; #define int long long typedef pair<int, int> P; int INF = 1e9 + 7; int mod = 1e9 + 7; int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; signed main() { int N; cin >> N; vector<int> a(N); map<int, int> Mp; for (int i = 0; i < N; i++) { cin >> a[i]; Mp[a[i]]++; } if (Mp.size() == 1) { if (Mp[0] == N) { cout << "Yes" << endl; } else { cout << "No" << endl; } } else if (Mp.size() == 2) { // 5050 2020 303030 if (N % 2 == 0 && Mp[0] == N / 2) { cout << "Yes" << endl; } else { cout << "No" << endl; } } else if (Mp.size() == 3) { int ok = 0; for (P p : Mp) { ok ^= p.first; if (p.second != N / 3) { cout << "No" << endl; return 0; } } if (ok == 0) { cout << "Yes" << endl; } else { cout << "No" << endl; } } else { cout << "No" << endl; } }
#include <bits/stdc++.h> using namespace std; #define int long long typedef pair<int, int> P; int INF = 1e9 + 7; int mod = 1e9 + 7; int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; signed main() { int N; cin >> N; vector<int> a(N); map<int, int> Mp; for (int i = 0; i < N; i++) { cin >> a[i]; Mp[a[i]]++; } if (Mp.size() == 1) { if (Mp[0] == N) { cout << "Yes" << endl; } else { cout << "No" << endl; } } else if (Mp.size() == 2) { // 550550550 if (N % 3 == 0 && Mp[0] == N / 3) { cout << "Yes" << endl; } else { cout << "No" << endl; } } else if (Mp.size() == 3) { int ok = 0; for (P p : Mp) { ok ^= p.first; if (p.second != N / 3) { cout << "No" << endl; return 0; } } if (ok == 0) { cout << "Yes" << endl; } else { cout << "No" << endl; } } else { cout << "No" << endl; } }
[ "literal.number.change", "control_flow.branch.if.condition.change" ]
781,824
781,825
u237390401
cpp
p02975
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define sz(x) int(x.size()) #define show(x) \ { \ for (auto i : x) { \ cout << i << " "; \ } \ cout << endl; \ } using namespace std; using ll = long long; using P = pair<int, int>; int main() { // 全ての帽子の排他的論理和が0、3種類の数が1/3ずつか、2種類以下か int N; cin >> N; vector<int> A(N); map<int, int> cnt; rep(i, N) { cin >> A[i]; cnt[A[i]]++; } if (cnt[0] == N) { puts("Yes"); return 0; } if (N % 3 != 0) { puts("No"); return 0; } vector<int> all; for (auto &p : cnt) { for (int i = 0; i < p.second / (N / 3); i++) { all.push_back(p.first); } } // show(all); if (all.size() == 3 && all[0] ^ all[1] ^ all[2] == 0) puts("Yes"); else puts("No"); return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define sz(x) int(x.size()) #define show(x) \ { \ for (auto i : x) { \ cout << i << " "; \ } \ cout << endl; \ } using namespace std; using ll = long long; using P = pair<int, int>; int main() { // 全ての帽子の排他的論理和が0、3種類の数が1/3ずつか、2種類以下か int N; cin >> N; vector<int> A(N); map<int, int> cnt; rep(i, N) { cin >> A[i]; cnt[A[i]]++; } if (cnt[0] == N) { puts("Yes"); return 0; } if (N % 3 != 0) { puts("No"); return 0; } vector<int> all; for (auto p : cnt) { for (int i = 0; i < p.second / (N / 3); i++) { all.push_back(p.first); } } // show(all); if (all.size() == 3 && (all[0] ^ all[1] ^ all[2]) == 0) puts("Yes"); else puts("No"); return 0; }
[ "control_flow.branch.if.condition.change" ]
781,829
781,830
u600402037
cpp
p02975
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define sz(x) int(x.size()) #define show(x) \ { \ for (auto i : x) { \ cout << i << " "; \ } \ cout << endl; \ } using namespace std; using ll = long long; using P = pair<int, int>; int main() { // 全ての帽子の排他的論理和が0、3種類の数が1/3ずつか、2種類以下か int N; cin >> N; vector<int> A(N); map<int, int> cnt; rep(i, N) { cin >> A[i]; cnt[A[i]]++; } if (cnt[0] == N) { puts("Yes"); return 0; } if (N % 3 != 0) { puts("No"); return 0; } vector<int> all; for (auto p : cnt) { for (int i = 0; i < p.second / (N / 3); i++) { all.push_back(p.first); } } // show(all); if (all.size() == 3 && all[0] ^ all[1] ^ all[2] == 0) puts("Yes"); else puts("No"); return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define sz(x) int(x.size()) #define show(x) \ { \ for (auto i : x) { \ cout << i << " "; \ } \ cout << endl; \ } using namespace std; using ll = long long; using P = pair<int, int>; int main() { // 全ての帽子の排他的論理和が0、3種類の数が1/3ずつか、2種類以下か int N; cin >> N; vector<int> A(N); map<int, int> cnt; rep(i, N) { cin >> A[i]; cnt[A[i]]++; } if (cnt[0] == N) { puts("Yes"); return 0; } if (N % 3 != 0) { puts("No"); return 0; } vector<int> all; for (auto p : cnt) { for (int i = 0; i < p.second / (N / 3); i++) { all.push_back(p.first); } } // show(all); if (all.size() == 3 && (all[0] ^ all[1] ^ all[2]) == 0) puts("Yes"); else puts("No"); return 0; }
[ "control_flow.branch.if.condition.change" ]
781,831
781,830
u600402037
cpp
p02975
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define sz(x) int(x.size()) #define show(x) \ { \ for (auto i : x) { \ cout << i << " "; \ } \ cout << endl; \ } using namespace std; using ll = long long; using P = pair<int, int>; int main() { // 全ての帽子の排他的論理和が0、3種類の数が1/3ずつか、2種類以下か int N; cin >> N; vector<int> A(N); map<int, int> cnt; rep(i, N) { cin >> A[i]; cnt[A[i]]++; } if (cnt[0] == N) { puts("Yes"); return 0; } if (N % 3 != 0) { puts("No"); return 0; } vector<int> all; for (auto &p : cnt) { for (int i = 0; i < p.second / (N / 3); i++) { all.push_back(p.first); } } // show(all); if (all.size() == 3 && all[0] ^ all[1] ^ all[2] == 0) puts("Yes"); else puts("No"); return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define sz(x) int(x.size()) #define show(x) \ { \ for (auto i : x) { \ cout << i << " "; \ } \ cout << endl; \ } using namespace std; using ll = long long; using P = pair<int, int>; int main() { // 全ての帽子の排他的論理和が0、3種類の数が1/3ずつか、2種類以下か int N; cin >> N; vector<int> A(N); map<int, int> cnt; rep(i, N) { cin >> A[i]; cnt[A[i]]++; } if (cnt[0] == N) { puts("Yes"); return 0; } if (N % 3 != 0) { puts("No"); return 0; } vector<int> all; for (auto &p : cnt) { for (int i = 0; i < p.second / (N / 3); i++) { all.push_back(p.first); } } // show(all); if (all.size() == 3 && (all[0] ^ all[1] ^ all[2]) == 0) puts("Yes"); else puts("No"); return 0; }
[ "control_flow.branch.if.condition.change" ]
781,829
781,832
u600402037
cpp
p02975
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define sz(x) int(x.size()) #define show(x) \ { \ for (auto i : x) { \ cout << i << " "; \ } \ cout << endl; \ } using namespace std; using ll = long long; using P = pair<int, int>; int main() { // 全ての帽子の排他的論理和が0、3種類の数が1/3ずつか、2種類以下か int N; cin >> N; vector<int> A(N); map<int, int> cnt; rep(i, N) { cin >> A[i]; cnt[A[i]]++; } if (cnt[0] == N) { puts("Yes"); return 0; } if (N % 3 != 0) { puts("No"); return 0; } vector<int> all; for (auto p : cnt) { for (int i = 0; i < p.second / (N / 3); i++) { all.push_back(p.first); } } // show(all); if (all.size() == 3 && all[0] ^ all[1] ^ all[2] == 0) puts("Yes"); else puts("No"); return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define sz(x) int(x.size()) #define show(x) \ { \ for (auto i : x) { \ cout << i << " "; \ } \ cout << endl; \ } using namespace std; using ll = long long; using P = pair<int, int>; int main() { // 全ての帽子の排他的論理和が0、3種類の数が1/3ずつか、2種類以下か int N; cin >> N; vector<int> A(N); map<int, int> cnt; rep(i, N) { cin >> A[i]; cnt[A[i]]++; } if (cnt[0] == N) { puts("Yes"); return 0; } if (N % 3 != 0) { puts("No"); return 0; } vector<int> all; for (auto &p : cnt) { for (int i = 0; i < p.second / (N / 3); i++) { all.push_back(p.first); } } // show(all); if (all.size() == 3 && (all[0] ^ all[1] ^ all[2]) == 0) puts("Yes"); else puts("No"); return 0; }
[ "control_flow.branch.if.condition.change" ]
781,831
781,832
u600402037
cpp
p02975
#include <bits/stdc++.h> using namespace std; using ll = long long; using Graph = vector<vector<int>>; #define rep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i) #define rREP(i, m, n) for (int(i) = (n)-1; (i) >= (m); --(i)) #define all(x) (x).begin(), (x).end() #define out(y, x, h, w) (y) < 0 || (x) < 0 || (y) >= (h) || (x) >= (w) constexpr int INF = 1000000001; constexpr ll mod = 1000000007; constexpr double PI = 3.1415926535897932; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } int main() { init(); int N; cin >> N; map<int, int> mp; rep(i, 0, N) { int a; cin >> a; mp[a]++; } if (mp[0] == N) { puts("Yes"); return 0; } else if (N % 3) { puts("No"); return 0; } vector<int> vec; for (auto p : mp) { if (p.second % (N / 3)) { puts("No"); return 0; } rep(i, 0, p.second / (N / 3)) vec.push_back(p.first); } if (vec[0] ^ vec[1] ^ vec[2] == 0) puts("Yes"); else puts("No"); return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; using Graph = vector<vector<int>>; #define rep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i) #define rREP(i, m, n) for (int(i) = (n)-1; (i) >= (m); --(i)) #define all(x) (x).begin(), (x).end() #define out(y, x, h, w) (y) < 0 || (x) < 0 || (y) >= (h) || (x) >= (w) constexpr int INF = 1000000001; constexpr ll mod = 1000000007; constexpr double PI = 3.1415926535897932; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } int main() { init(); int N; cin >> N; map<int, int> mp; rep(i, 0, N) { int a; cin >> a; mp[a]++; } if (mp[0] == N) { puts("Yes"); return 0; } else if (N % 3) { puts("No"); return 0; } vector<int> vec; for (auto p : mp) { if (p.second % (N / 3)) { puts("No"); return 0; } rep(i, 0, p.second / (N / 3)) vec.push_back(p.first); } if ((vec[0] ^ vec[1] ^ vec[2]) == 0) puts("Yes"); else puts("No"); return 0; }
[ "control_flow.branch.if.condition.change" ]
781,835
781,836
u813559924
cpp
p02975
#include <bits/stdc++.h> using namespace std; // using ll = long long; #define int long long #define LOG(variable) cout << #variable ":\t" << (variable) << endl #define LOGCON(i, container) \ for (int(i) = 0; (i) < (container).size(); ++(i)) \ cout << (i) << ":\t" << (container)[(i)] << endl #define REP(i, n) for (int i = 0; i < (n); ++i) #define REPS(i, r, n) for (int i = (r); i < (n); ++i) #define REPR(i, n) for (int i = (n); i >= 0; --i) // from n to 0 #define REPRS(i, r, n) for (int i = (n); i >= (r); --i) // from n to r #define REPOBJ(itr, obj) \ for (auto itr = (obj).begin(); itr != (obj).end(); ++itr) #define REPROBJ(itr, obj) \ for (auto itr = (obj).rbegin(), e = (obj).rend(); itr != e; ++itr) #define COUTB(x) cout << (x) << "\n" #define COUTS(x) cout << (x) << " " #define PB push_back #define SORT(obj) sort((obj).begin(), (obj).end()) #define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>()) #define ALL(obj) (obj).begin(), (obj).end() #define MOD 1000000007 #define PI (acos(-1)) /***** MAIN *****/ signed main() { int n; cin >> n; map<int, int> mp; bool all_zero = true; REP(i, n) { int tmp; cin >> tmp; if (tmp) all_zero = false; ++mp[tmp]; } if (all_zero) { cout << "Yes" << endl; return 0; } int input_count = mp.size(); if (input_count > 3 || input_count < 2) { cout << "No" << endl; return 0; } if (input_count % 3) { cout << "No" << endl; return 0; } int third_n = n / 3; if (input_count == 2) { REPOBJ(itr, mp) { if (itr->first == 0) { if (itr->second != third_n) { cout << "No" << endl; return 0; } } else { if (itr->second != third_n * 2) { cout << "No" << endl; return 0; } } } } else { int should_be_zero = 0; REPOBJ(itr, mp) { should_be_zero ^= itr->first; if (itr->second != third_n) { cout << "No" << endl; return 0; } } if (should_be_zero) { cout << "No" << endl; return 0; } } cout << "Yes"; cout << "\n"; return 0; } /***** MAIN *****/
#include <bits/stdc++.h> using namespace std; // using ll = long long; #define int long long #define LOG(variable) cout << #variable ":\t" << (variable) << endl #define LOGCON(i, container) \ for (int(i) = 0; (i) < (container).size(); ++(i)) \ cout << (i) << ":\t" << (container)[(i)] << endl #define REP(i, n) for (int i = 0; i < (n); ++i) #define REPS(i, r, n) for (int i = (r); i < (n); ++i) #define REPR(i, n) for (int i = (n); i >= 0; --i) // from n to 0 #define REPRS(i, r, n) for (int i = (n); i >= (r); --i) // from n to r #define REPOBJ(itr, obj) \ for (auto itr = (obj).begin(); itr != (obj).end(); ++itr) #define REPROBJ(itr, obj) \ for (auto itr = (obj).rbegin(), e = (obj).rend(); itr != e; ++itr) #define COUTB(x) cout << (x) << "\n" #define COUTS(x) cout << (x) << " " #define PB push_back #define SORT(obj) sort((obj).begin(), (obj).end()) #define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>()) #define ALL(obj) (obj).begin(), (obj).end() #define MOD 1000000007 #define PI (acos(-1)) /***** MAIN *****/ signed main() { int n; cin >> n; map<int, int> mp; bool all_zero = true; REP(i, n) { int tmp; cin >> tmp; if (tmp) all_zero = false; ++mp[tmp]; } if (all_zero) { cout << "Yes" << endl; return 0; } int input_count = mp.size(); if (input_count > 3 || input_count < 2) { cout << "No" << endl; return 0; } if (n % 3) { cout << "No" << endl; return 0; } int third_n = n / 3; if (input_count == 2) { REPOBJ(itr, mp) { if (itr->first == 0) { if (itr->second != third_n) { cout << "No" << endl; return 0; } } else { if (itr->second != third_n * 2) { cout << "No" << endl; return 0; } } } } else { int should_be_zero = 0; REPOBJ(itr, mp) { should_be_zero ^= itr->first; if (itr->second != third_n) { cout << "No" << endl; return 0; } } if (should_be_zero) { cout << "No" << endl; return 0; } } cout << "Yes"; cout << "\n"; return 0; } /***** MAIN *****/
[ "identifier.change", "control_flow.branch.if.condition.change" ]
781,837
781,838
u323748756
cpp
p02975
/* _____________ _____________ _____________ _____________ _____________ ( ___________) | _________ ) (___________ ) (___________ ) ( ___________) ( ( | | | ) | ) ) ) ( ( ( (___________ | |_________| ) ___________| ) ___________) ) ( (___________ (___________ ) | ___________) | _________ ) ( ___________) ( _________ ) ) ) | | | | | ) ( ( ( ( ) ) ___________) ) | |___________ | |_________| ) ______ ( (___________ ( (_________) ) (_____________) |_____________) |_____________) (______) (_____________) (_____________) Name : Abdus Sahid Don't give up until the last second. Topcoder handle : sea_26 Codechef handle : sea_26 Practice makes a man perfect. */ #pragma GCC optimize("03") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; template <typename T> using Ordered_Set = tree<int, null_type, T, rb_tree_tag, tree_order_statistics_node_update>; using ll = long long; using ld = long double; typedef pair<int, int> PII; typedef pair<ll, int> PLI; typedef pair<int, ll> PIL; typedef pair<ll, ll> PLL; typedef pair<string, int> PSI; typedef map<int, int> MII; typedef map<ll, ll> MLL; typedef map<PII, int> MPIII; typedef map<string, int> MSI; const ll M = 1e9 + 7; const ll M2 = 998244353; const int Iinf = 0x3f3f3f3f; const ll Linf = 0x3f3f3f3f3f3f3f3f; const ld PI = acos(-1.0); // const double pi = atan2(0, -1); // const double PI = 4 * atan(1); // const double pi = 2*cos(0.0); #define mp make_pair #define eb emplace_back #define pf push_front #define pb push_back #define ppb pop_back() #define fbo(ind) find_by_order(ind) #define ook(val) order_of_key(val) #define f first #define s second #define sz size() #define bp(n) __builtin_popcount(n) #define bclz(n) __builtin_clz(n) #define bctz(n) __builtin_ctzll(n) #define bip(n) __builtin_parity(n) #define All(v) (v).begin(), (v).end() #define Rall(v) (v).rbegin(), (v).rend() #define rvs(v) sort(All(v), greater<int>()) #define mnv(v) *min_element(All(v)) #define mxv(v) *max_element(All(v)) #define acm(v, ini) accumulate(All(v), ini) #define smp(container, element) (container.find(element) != container.end()) #define vp(container, element) \ (find(All(container), element) != container.end()) #define ub(v, k) upper_bound(all(v), k) - v.begin() #define lb(v, k) lower_bound(all(v), k) - v.begin() #define msz(a) memset(a, 0, sizeof(a)) #define msm(a) memset(a, 0xff, sizeof(a)) #define fpre(n) fixed << setprecision(n) #define watch(x) cerr << (#x) << " is " << (x) << endl #define sea template <typename T #define tc \ int tt; \ cin >> tt; \ for (int t = 1; t <= tt; t++) #define Rep(i, n) for (__typeof(n) i = 0; i < n; i++) #define Per(i, n) for (__typeof(n) i = n - 1; i >= 0; i--) #define Lrep(i, p, q) for (__typeof(q) i = p; i <= q; i++) #define Perl(i, p, q) for (__typeof(p) i = p; i >= q; i--) #define IT(it, x) \ for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++) #define RIT(it, x) \ for (__typeof((x).rbegin()) it = (x).rbegin(); it != (x).rend(); it++) const int dx4[] = {+1, -1, +0, +0}; const int dy4[] = {+0, +0, +1, -1}; const int dx8[] = {+0, +0, +1, -1, -1, +1, -1, +1}; const int dy8[] = {-1, +1, +0, +0, +1, +1, -1, -1}; sea > using V = vector<T>; sea > using VV = vector<vector<T>>; sea > using MinHeap = priority_queue<T, vector<T>, greater<T>>; sea > inline bool Checkbit(T n, T Pos) { return n & (1 << Pos); } sea > inline int Resetbit(T n, T Pos) { return n | (1 << Pos); } sea > inline int Unsetbit(T n, T Pos) { return n & ~(1 << Pos); } sea > inline int Flipbit(T n, T Pos) { return n ^ (1 << Pos); } sea > inline T Max(T a, T b) { return a ^ ((a ^ b) & -(a < b)); } sea > inline T Min(T a, T b) { return b ^ ((a ^ b) & -(a < b)); } sea > inline void Swap(T &a, T &b) { a = ((a) ^= (b)), b = ((b) ^= (a)), a = ((a) ^= (b)); } sea > inline T Sqr(T x) { return (x) * (x); } sea > inline bool IsPoT(T x) { return (x != 0 and (x & (x - 1)) == 0); } sea > bool Chkmax(T &a, const T b) { if (a < b) { a = b; return true; } else return false; } sea > bool Chkmin(T &a, const T b) { if (a > b) { a = b; return true; } else return false; } sea > V<T> compress(V<T> A) { sort(all(A)); A.erase(unique(all(A)), A.end()); return A; } sea > T Gcd(T a, T b) { while (b) b ^= a ^= b ^= a %= b; return a; } sea > T Exgcd(T a, T b, T &x, T &y) { if (!b) { x = 1; y = 0; return a; } else { T g = Exgcd(b, a % b, y, x); y -= (a / b) * x; return g; } } sea > inline T Lcm(T a, T b) { return (a / Gcd(a, b)) * b; } sea > T Powmod(T n, T p, T M) { n %= M; T Res = 1; while (p > 0) { if (p & 1) Res = ((Res % M) * (n % M)) % M; n = ((n % M) * (n % M)) % M; p >>= 1; } return Res; } /// (n^p) % M sea > T ModInv(T a, T m) { return Powmod(a, m - 2, m); } sea > T Mulmod(T a, T b, T M) { T x = 0, y = a % M; while (b > 0) { if (b & 1) x = (x + y) % M; } y = (y << 1) % M; b >>= 1; } /// (a*b) % M static inline bool Is_digit(char c) { return static_cast<unsigned char>(c - '0') < 10; } static inline bool Is_upper(char c) { return static_cast<unsigned char>(c - 'A') < 26; } static inline bool Is_lower(char c) { return static_cast<unsigned char>(c - 'a') < 26; } namespace Input { sea > inline void read(T &x) { bool Negative = false; register int c; x = 0; c = getchar(); if (c == '-') { Negative = true; c = getchar(); } for (; (c > 47 and c < 58); c = getchar()) x = (x << 3) + (x << 1) + c - 48; if (Negative) x *= -1; } sea, class... Ts > void read(T &t, Ts &...ts) { read(t); read(ts...); } sea > istream &operator>>(istream &is, vector<T> &vec) { for (auto &v : vec) is >> v; return is; } } // namespace Input using namespace Input; inline void Add(int &a, int b) { a += b; if (a >= M) a -= M; } inline void Sub(int &a, int b) { a -= b; if (a < 0) a += M; } inline int Mul(int a, int b) { return (int)((long long)a * b % M); } void ReadInput(void) { // read(); } class AGC_035A { public: void Solve(istream &cin, ostream &cout) { ReadInput(); int n; cin >> n; ll Xor = 0; Rep(i, n) { int x; cin >> x; Xor ^= x; } cout << (Xor == 0 ? "YES" : "NO") << endl; } }; signed main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); #ifdef LOCAL_DEFINE auto start_time = clock(); #endif // LOCAL_DEFINE #ifdef LOCAL_DEFINE freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); #endif // LOCAL_DEFINE AGC_035A Problem; std::istream &in(std::cin); std::ostream &out(std::cout); Problem.Solve(in, out); #ifdef LOCAL_DEFINE auto end_time = clock(); cerr << "\nTime Elapsed: " << fpre(3) << 1.0 * (end_time - start_time) / CLOCKS_PER_SEC << " Sec" << endl; #endif // LOCAL_DEFINE return 0; }
/* _____________ _____________ _____________ _____________ _____________ ( ___________) | _________ ) (___________ ) (___________ ) ( ___________) ( ( | | | ) | ) ) ) ( ( ( (___________ | |_________| ) ___________| ) ___________) ) ( (___________ (___________ ) | ___________) | _________ ) ( ___________) ( _________ ) ) ) | | | | | ) ( ( ( ( ) ) ___________) ) | |___________ | |_________| ) ______ ( (___________ ( (_________) ) (_____________) |_____________) |_____________) (______) (_____________) (_____________) Name : Abdus Sahid Don't give up until the last second. Topcoder handle : sea_26 Codechef handle : sea_26 Practice makes a man perfect. */ #pragma GCC optimize("03") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; template <typename T> using Ordered_Set = tree<int, null_type, T, rb_tree_tag, tree_order_statistics_node_update>; using ll = long long; using ld = long double; typedef pair<int, int> PII; typedef pair<ll, int> PLI; typedef pair<int, ll> PIL; typedef pair<ll, ll> PLL; typedef pair<string, int> PSI; typedef map<int, int> MII; typedef map<ll, ll> MLL; typedef map<PII, int> MPIII; typedef map<string, int> MSI; const ll M = 1e9 + 7; const ll M2 = 998244353; const int Iinf = 0x3f3f3f3f; const ll Linf = 0x3f3f3f3f3f3f3f3f; const ld PI = acos(-1.0); // const double pi = atan2(0, -1); // const double PI = 4 * atan(1); // const double pi = 2*cos(0.0); #define mp make_pair #define eb emplace_back #define pf push_front #define pb push_back #define ppb pop_back() #define fbo(ind) find_by_order(ind) #define ook(val) order_of_key(val) #define f first #define s second #define sz size() #define bp(n) __builtin_popcount(n) #define bclz(n) __builtin_clz(n) #define bctz(n) __builtin_ctzll(n) #define bip(n) __builtin_parity(n) #define All(v) (v).begin(), (v).end() #define Rall(v) (v).rbegin(), (v).rend() #define rvs(v) sort(All(v), greater<int>()) #define mnv(v) *min_element(All(v)) #define mxv(v) *max_element(All(v)) #define acm(v, ini) accumulate(All(v), ini) #define smp(container, element) (container.find(element) != container.end()) #define vp(container, element) \ (find(All(container), element) != container.end()) #define ub(v, k) upper_bound(all(v), k) - v.begin() #define lb(v, k) lower_bound(all(v), k) - v.begin() #define msz(a) memset(a, 0, sizeof(a)) #define msm(a) memset(a, 0xff, sizeof(a)) #define fpre(n) fixed << setprecision(n) #define watch(x) cerr << (#x) << " is " << (x) << endl #define sea template <typename T #define tc \ int tt; \ cin >> tt; \ for (int t = 1; t <= tt; t++) #define Rep(i, n) for (__typeof(n) i = 0; i < n; i++) #define Per(i, n) for (__typeof(n) i = n - 1; i >= 0; i--) #define Lrep(i, p, q) for (__typeof(q) i = p; i <= q; i++) #define Perl(i, p, q) for (__typeof(p) i = p; i >= q; i--) #define IT(it, x) \ for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++) #define RIT(it, x) \ for (__typeof((x).rbegin()) it = (x).rbegin(); it != (x).rend(); it++) const int dx4[] = {+1, -1, +0, +0}; const int dy4[] = {+0, +0, +1, -1}; const int dx8[] = {+0, +0, +1, -1, -1, +1, -1, +1}; const int dy8[] = {-1, +1, +0, +0, +1, +1, -1, -1}; sea > using V = vector<T>; sea > using VV = vector<vector<T>>; sea > using MinHeap = priority_queue<T, vector<T>, greater<T>>; sea > inline bool Checkbit(T n, T Pos) { return n & (1 << Pos); } sea > inline int Resetbit(T n, T Pos) { return n | (1 << Pos); } sea > inline int Unsetbit(T n, T Pos) { return n & ~(1 << Pos); } sea > inline int Flipbit(T n, T Pos) { return n ^ (1 << Pos); } sea > inline T Max(T a, T b) { return a ^ ((a ^ b) & -(a < b)); } sea > inline T Min(T a, T b) { return b ^ ((a ^ b) & -(a < b)); } sea > inline void Swap(T &a, T &b) { a = ((a) ^= (b)), b = ((b) ^= (a)), a = ((a) ^= (b)); } sea > inline T Sqr(T x) { return (x) * (x); } sea > inline bool IsPoT(T x) { return (x != 0 and (x & (x - 1)) == 0); } sea > bool Chkmax(T &a, const T b) { if (a < b) { a = b; return true; } else return false; } sea > bool Chkmin(T &a, const T b) { if (a > b) { a = b; return true; } else return false; } sea > V<T> compress(V<T> A) { sort(all(A)); A.erase(unique(all(A)), A.end()); return A; } sea > T Gcd(T a, T b) { while (b) b ^= a ^= b ^= a %= b; return a; } sea > T Exgcd(T a, T b, T &x, T &y) { if (!b) { x = 1; y = 0; return a; } else { T g = Exgcd(b, a % b, y, x); y -= (a / b) * x; return g; } } sea > inline T Lcm(T a, T b) { return (a / Gcd(a, b)) * b; } sea > T Powmod(T n, T p, T M) { n %= M; T Res = 1; while (p > 0) { if (p & 1) Res = ((Res % M) * (n % M)) % M; n = ((n % M) * (n % M)) % M; p >>= 1; } return Res; } /// (n^p) % M sea > T ModInv(T a, T m) { return Powmod(a, m - 2, m); } sea > T Mulmod(T a, T b, T M) { T x = 0, y = a % M; while (b > 0) { if (b & 1) x = (x + y) % M; } y = (y << 1) % M; b >>= 1; } /// (a*b) % M static inline bool Is_digit(char c) { return static_cast<unsigned char>(c - '0') < 10; } static inline bool Is_upper(char c) { return static_cast<unsigned char>(c - 'A') < 26; } static inline bool Is_lower(char c) { return static_cast<unsigned char>(c - 'a') < 26; } namespace Input { sea > inline void read(T &x) { bool Negative = false; register int c; x = 0; c = getchar(); if (c == '-') { Negative = true; c = getchar(); } for (; (c > 47 and c < 58); c = getchar()) x = (x << 3) + (x << 1) + c - 48; if (Negative) x *= -1; } sea, class... Ts > void read(T &t, Ts &...ts) { read(t); read(ts...); } sea > istream &operator>>(istream &is, vector<T> &vec) { for (auto &v : vec) is >> v; return is; } } // namespace Input using namespace Input; inline void Add(int &a, int b) { a += b; if (a >= M) a -= M; } inline void Sub(int &a, int b) { a -= b; if (a < 0) a += M; } inline int Mul(int a, int b) { return (int)((long long)a * b % M); } void ReadInput(void) { // read(); } class AGC_035A { public: void Solve(istream &cin, ostream &cout) { ReadInput(); int n; cin >> n; ll Xor = 0; Rep(i, n) { int x; cin >> x; Xor ^= x; } cout << (Xor == 0 ? "Yes" : "No") << endl; } }; signed main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); #ifdef LOCAL_DEFINE auto start_time = clock(); #endif // LOCAL_DEFINE #ifdef LOCAL_DEFINE freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); #endif // LOCAL_DEFINE AGC_035A Problem; std::istream &in(std::cin); std::ostream &out(std::cout); Problem.Solve(in, out); #ifdef LOCAL_DEFINE auto end_time = clock(); cerr << "\nTime Elapsed: " << fpre(3) << 1.0 * (end_time - start_time) / CLOCKS_PER_SEC << " Sec" << endl; #endif // LOCAL_DEFINE return 0; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
781,841
781,842
u137653400
cpp
p02975
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } const ll INF = 1LL << 60; int main() { int n; cin >> n; vector<int> a(n); map<int, int> mp; rep(i, n) { cin >> a[i]; mp[a[i]]++; if (mp.size() > 3) { cout << "No" << endl; return 0; } } if (mp.size() == 1) { if (mp[0] == n) cout << "Yes" << endl; else cout << "No" << endl; return 0; } if (n % 3 != 0) { cout << "No" << endl; } else { if (mp.size() == 3) { vector<int> key; for (auto p : mp) { key.push_back(p.first); if (p.second != n / 3) { cout << "No" << endl; return 0; } } if (key[0] ^ key[1] != key[2]) { cout << "No" << endl; return 0; } cout << "Yes" << endl; } else if (mp.size() == 2) { for (auto p : mp) { if (p.first == 0 && p.second == n / 3) continue; else if (p.first > 0 && p.second == n * 2 / 3) continue; else { cout << "No" << endl; return 0; } } cout << "Yes" << endl; } } return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } const ll INF = 1LL << 60; int main() { int n; cin >> n; vector<int> a(n); map<int, int> mp; rep(i, n) { cin >> a[i]; mp[a[i]]++; if (mp.size() > 3) { cout << "No" << endl; return 0; } } if (mp.size() == 1) { if (mp[0] == n) cout << "Yes" << endl; else cout << "No" << endl; return 0; } if (n % 3 != 0) { cout << "No" << endl; } else { if (mp.size() == 3) { vector<int> key; for (auto p : mp) { key.push_back(p.first); if (p.second != n / 3) { cout << "No" << endl; return 0; } } if ((key[0] ^ key[1]) != key[2]) { cout << "No" << endl; return 0; } cout << "Yes" << endl; } else if (mp.size() == 2) { for (auto p : mp) { if (p.first == 0 && p.second == n / 3) continue; else if (p.first > 0 && p.second == n * 2 / 3) continue; else { cout << "No" << endl; return 0; } } cout << "Yes" << endl; } } return 0; }
[ "control_flow.branch.if.condition.change" ]
781,843
781,844
u344125947
cpp
p02975
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a.at(i); map<int, int> m; for (int i = 0; i < n; i++) m[a.at(i)]++; if (m[0] == n) { puts("Yes"); return 0; } else if (n % 3) { puts("No"); return 0; } vector<int> h; for (auto x : m) { if (x.second % (n / 3)) { puts("No"); return 0; } for (int i = 0; i < x.second / (n / 3); i++) { h.push_back(x.first); } } if (h.at(0) ^ h.at(1) ^ h.at(2) == 0) { puts("Yes"); } else { puts("No"); } }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a.at(i); map<int, int> m; for (int i = 0; i < n; i++) m[a.at(i)]++; if (m[0] == n) { puts("Yes"); return 0; } else if (n % 3) { puts("No"); return 0; } vector<int> h; for (auto x : m) { if (x.second % (n / 3)) { puts("No"); return 0; } for (int i = 0; i < x.second / (n / 3); i++) { h.push_back(x.first); } } if ((h.at(0) ^ h.at(1) ^ h.at(2)) == 0) { puts("Yes"); } else { puts("No"); } }
[ "control_flow.branch.if.condition.change" ]
781,845
781,846
u697658632
cpp
p02975
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define rep2(i, x, n) for (int i = x; i < (n); i++) #define all(n) begin(n), end(n) struct cww { cww() { ios::sync_with_stdio(false); cin.tie(0); } } star; const long long INF = numeric_limits<long long>::max(); typedef long long ll; typedef vector<int> vint; typedef vector<char> vchar; typedef vector<vector<int>> vvint; typedef vector<ll> vll; typedef vector<vector<ll>> vvll; typedef unsigned long long ull; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } template <typename T> vector<T> make_v(size_t a) { return vector<T>(a); } template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...)); } template <typename T, typename V> typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) { t = v; } template <typename T, typename V> typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) { for (auto &e : t) fill_v(e, v); } int main() { int N; cin >> N; vint a(N); map<int, int> cnt; set<int> s; rep(i, N) { cin >> a[i]; cnt[a[i]]++; s.insert(a[i]); } bool ok = false; switch (s.size()) { case 1: ok = a[0] == 0; break; case 2: ok = N % 3 == 0 and cnt[0] == N / 3; break; case 3: int x = *s.begin(), y = *(++s.begin()), z = *(++++s.begin()); ok = x xor y xor z == 0 and N % 3 == 0 and cnt[x] == N / 3 and cnt[y] == N / 3 and cnt[z] == N / 3; break; } ok ? cout << "Yes" : cout << "No"; return 0; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define rep2(i, x, n) for (int i = x; i < (n); i++) #define all(n) begin(n), end(n) struct cww { cww() { ios::sync_with_stdio(false); cin.tie(0); } } star; const long long INF = numeric_limits<long long>::max(); typedef long long ll; typedef vector<int> vint; typedef vector<char> vchar; typedef vector<vector<int>> vvint; typedef vector<ll> vll; typedef vector<vector<ll>> vvll; typedef unsigned long long ull; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } template <typename T> vector<T> make_v(size_t a) { return vector<T>(a); } template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...)); } template <typename T, typename V> typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) { t = v; } template <typename T, typename V> typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) { for (auto &e : t) fill_v(e, v); } int main() { int N; cin >> N; vint a(N); map<int, int> cnt; set<int> s; rep(i, N) { cin >> a[i]; cnt[a[i]]++; s.insert(a[i]); } bool ok = false; switch (s.size()) { case 1: ok = a[0] == 0; break; case 2: ok = N % 3 == 0 and cnt[0] == N / 3; break; case 3: int x = *s.begin(), y = *(++s.begin()), z = *(++++s.begin()); ok = (x xor y xor z) == 0 and N % 3 == 0 and cnt[x] == N / 3 and cnt[y] == N / 3 and cnt[z] == N / 3; break; } ok ? cout << "Yes" : cout << "No"; return 0; }
[]
781,847
781,848
u987913144
cpp
p02975
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { int N; cin >> N; map<int, int> M; rep(i, N) { int a; cin >> a; M[a]++; } if (M.size() == 1 && M.find(0) != M.end()) { cout << "Yes" << endl; return 0; } if (N / 3 != 0) { cout << "No" << endl; return 0; } if (M.size() == 2) { for (auto mp : M) { if (0 == mp.first && N / 3 == mp.second) { cout << "Yes" << endl; return 0; } } } if (M.size() == 3) { int tmp = 0; for (auto mp : M) { if (N / 3 == mp.second) { tmp ^= mp.first; } else { cout << "No" << endl; return 0; } } if (0 == tmp) { cout << "Yes" << endl; return 0; } } cout << "No" << endl; return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { int N; cin >> N; map<int, int> M; rep(i, N) { int a; cin >> a; M[a]++; } if (M.size() == 1 && M.find(0) != M.end()) { cout << "Yes" << endl; return 0; } if (N % 3 != 0) { cout << "No" << endl; return 0; } if (M.size() == 2) { for (auto mp : M) { if (0 == mp.first && N / 3 == mp.second) { cout << "Yes" << endl; return 0; } } } if (M.size() == 3) { int tmp = 0; for (auto mp : M) { if (N / 3 == mp.second) { tmp ^= mp.first; } else { cout << "No" << endl; return 0; } } if (0 == tmp) { cout << "Yes" << endl; return 0; } } cout << "No" << endl; return 0; }
[ "expression.operator.arithmetic.change", "control_flow.branch.if.condition.change" ]
781,849
781,850
u741815956
cpp
p02975
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(vec) vec.begin(), vec.end() typedef long long ll; typedef pair<ll, ll> pll; typedef pair<int, int> pii; const ll mod = 1e9 + 7; const int inf = 1 << 30; int main() { int n; cin >> n; vector<ll> a(n); rep(i, n) cin >> a[i]; bool f = 1; rep(i, n) { if (a[i] != 0) f = 0; } if (f) { cout << "Yes" << endl; return 0; } if (n % 3 != 0) { cout << "No" << endl; return 0; } map<ll, int> mp; rep(i, n) { mp[a[i]]++; } if (mp.size() == 3) { bool f = 1; vector<ll> v(0); for (auto c : mp) { v.push_back(c.first); if (c.second != n / 3) f = 0; } if (v[0] ^ v[1] ^ v[2] != 0) f = 0; if (f) { cout << "Yes" << endl; return 0; } } if (mp.size() == 2) { bool f = 0, f1 = 0, f2 = 0; for (auto c : mp) { if (c.first != 0 && c.second == 2 * n / 3) f1 = 1; if (c.first == 0 && c.second == n / 3) f2 = 1; } if (f1 && f2) f = 1; if (f) { cout << "Yes" << endl; return 0; } } cout << "No" << endl; }
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(vec) vec.begin(), vec.end() typedef long long ll; typedef pair<ll, ll> pll; typedef pair<int, int> pii; const ll mod = 1e9 + 7; const int inf = 1 << 30; int main() { int n; cin >> n; vector<ll> a(n); rep(i, n) cin >> a[i]; bool f = 1; rep(i, n) { if (a[i] != 0) f = 0; } if (f) { cout << "Yes" << endl; return 0; } if (n % 3 != 0) { cout << "No" << endl; return 0; } map<ll, int> mp; rep(i, n) { mp[a[i]]++; } if (mp.size() == 3) { bool f = 1; vector<ll> v(0); for (auto c : mp) { v.push_back(c.first); if (c.second != n / 3) f = 0; } if ((v[0] ^ v[1] ^ v[2]) != 0) f = 0; if (f) { cout << "Yes" << endl; return 0; } } if (mp.size() == 2) { bool f = 0, f1 = 0, f2 = 0; for (auto c : mp) { if (c.first != 0 && c.second == 2 * n / 3) f1 = 1; if (c.first == 0 && c.second == n / 3) f2 = 1; } if (f1 && f2) f = 1; if (f) { cout << "Yes" << endl; return 0; } } cout << "No" << endl; }
[ "control_flow.branch.if.condition.change" ]
781,851
781,852
u136342563
cpp
p02975
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(vec) vec.begin(), vec.end() typedef long long ll; typedef pair<ll, ll> pll; typedef pair<int, int> pii; const ll mod = 1e9 + 7; const int inf = 1 << 30; int main() { int n; cin >> n; vector<ll> a(n); rep(i, n) cin >> a[i]; bool f = 1; rep(i, n) { if (a[i] != 0) f = 0; } if (f) { cout << "Yes" << endl; return 0; } if (n % 3 != 0) { cout << "No" << endl; return 0; } map<ll, int> mp; rep(i, n) { mp[a[i]]++; } if (mp.size() == 3) { bool f = 1; vector<ll> v(0); for (auto c : mp) { v.push_back(c.first); if (c.second != n / 3) f = 0; } if (!(v[0] ^ v[1] ^ v[2] == 0)) f = 0; if (f) { cout << "Yes" << endl; return 0; } } if (mp.size() == 2) { bool f = 0, f1 = 0, f2 = 0; for (auto c : mp) { if (c.first != 0 && c.second == 2 * n / 3) f1 = 1; if (c.first == 0 && c.second == n / 3) f2 = 1; } if (f1 && f2) f = 1; if (f) { cout << "Yes" << endl; return 0; } } cout << "No" << endl; }
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(vec) vec.begin(), vec.end() typedef long long ll; typedef pair<ll, ll> pll; typedef pair<int, int> pii; const ll mod = 1e9 + 7; const int inf = 1 << 30; int main() { int n; cin >> n; vector<ll> a(n); rep(i, n) cin >> a[i]; bool f = 1; rep(i, n) { if (a[i] != 0) f = 0; } if (f) { cout << "Yes" << endl; return 0; } if (n % 3 != 0) { cout << "No" << endl; return 0; } map<ll, int> mp; rep(i, n) { mp[a[i]]++; } if (mp.size() == 3) { bool f = 1; vector<ll> v(0); for (auto c : mp) { v.push_back(c.first); if (c.second != n / 3) f = 0; } if ((v[0] ^ v[1] ^ v[2]) != 0) f = 0; if (f) { cout << "Yes" << endl; return 0; } } if (mp.size() == 2) { bool f = 0, f1 = 0, f2 = 0; for (auto c : mp) { if (c.first != 0 && c.second == 2 * n / 3) f1 = 1; if (c.first == 0 && c.second == n / 3) f2 = 1; } if (f1 && f2) f = 1; if (f) { cout << "Yes" << endl; return 0; } } cout << "No" << endl; }
[ "expression.operation.unary.logical.remove", "control_flow.branch.if.condition.change" ]
781,854
781,852
u136342563
cpp
p02975
#include <bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef vector<pair<int, int>> vpii; typedef pair<int, int> pii; typedef long long ll; typedef pair<ll, ll> pll; typedef pair<double, double> pdd; typedef vector<ll> vll; #define INF 0x3f3f3f3f #define MOD 998244353LL #define EPSILON 0.00001 #define f first #define s second #define pb push_back #define mp make_pair #define FOR(i, a, b) for (ll i = (a); i <= (signed)(b); i++) #define F0R(i, a) for (ll i = 0; i < (signed)(a); i++) #define RFOR(i, a, b) for (int i = (a); i >= b; i--) #define MN 100005 int n; map<ll, ll> ree; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n; F0R(i, n) { ll x; cin >> x; ree[x]++; } if (ree.size() > 3) { cout << "No\n"; } else if (ree.size() == 3) { pll a = *ree.begin(), b = *(++ree.begin()), c = *(++(++ree.begin())); if (a.s == b.s && a.s == c.s && a.f ^ b.f ^ c.f == 0) { cout << "Yes\n"; } else { cout << "No\n"; } } else if (ree.size() == 2) { pll a = *ree.begin(), b = *(++ree.begin()); if (a.f == 0 && b.s == 2 * a.s) { cout << "Yes\n"; } else { cout << "No\n"; } } else { if (ree.begin()->f == 0) { cout << "Yes\n"; } else { cout << "No\n"; } } return 0; }
#include <bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef vector<pair<int, int>> vpii; typedef pair<int, int> pii; typedef long long ll; typedef pair<ll, ll> pll; typedef pair<double, double> pdd; typedef vector<ll> vll; #define INF 0x3f3f3f3f #define MOD 998244353LL #define EPSILON 0.00001 #define f first #define s second #define pb push_back #define mp make_pair #define FOR(i, a, b) for (ll i = (a); i <= (signed)(b); i++) #define F0R(i, a) for (ll i = 0; i < (signed)(a); i++) #define RFOR(i, a, b) for (int i = (a); i >= b; i--) #define MN 100005 int n; map<ll, ll> ree; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n; F0R(i, n) { ll x; cin >> x; ree[x]++; } if (ree.size() > 3) { cout << "No\n"; } else if (ree.size() == 3) { pll a = *ree.begin(), b = *(++ree.begin()), c = *(++(++ree.begin())); // cout << a.f << " " << b.f << " " << c.f << "\n"; // cout << (a.f ^ b.f ^ c.f) << "\n"; if (a.s == b.s && a.s == c.s && (a.f ^ b.f ^ c.f) == 0) { cout << "Yes\n"; } else { cout << "No\n"; } } else if (ree.size() == 2) { pll a = *ree.begin(), b = *(++ree.begin()); if (a.f == 0 && b.s == 2 * a.s) { cout << "Yes\n"; } else { cout << "No\n"; } } else { if (ree.begin()->f == 0) { cout << "Yes\n"; } else { cout << "No\n"; } } return 0; }
[ "control_flow.branch.if.condition.change" ]
781,855
781,856
u396284099
cpp
p02975
#include <bits/stdc++.h> using namespace std; typedef long long ll; struct fast_ios { fast_ios() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_; #define _overload3(_1, _2, _3, name, ...) name #define _rep(i, n) repi(i, 0, n) #define repi(i, a, b) for (ll i = ll(a); i < ll(b); ++i) #define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__) #define inf (ll)2147483647 #define mod (ll)(1e9 + 7) #define d(x) cerr << #x << "=" << x << endl; #define p(x) cout << (x) << endl #define ps(x) cout << (x) #define pk(x) cout << (x) << " " #define pfix(d, x) cout << fixed << setprecision(d) << x << endl #define pb push_back #define sz(v) (v).size() #define all(v) (v).begin(), (v).end() #define minel(v) *min_element(all(v)) #define minind(v) distance((v).begin(), min_element(all(v))) #define maxel(v) *max_element(all(v)) #define maxind(v) distance((v).begin(), max_element(all(v))) #define p2d(v, n, m) \ rep(i, n) { \ rep(j, m) { pk(v[i][j]); } \ p(""); \ } #define fi first #define se second typedef map<ll, ll> imap; typedef pair<ll, ll> P; typedef vector<int> VI; typedef vector<ll> VL; typedef vector<pair<ll, ll>> VP; template <typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); } void pyn(bool ans) { p(ans ? "Yes" : "No"); } // Prime bool is_prime(ll n) { if (n == 1) return false; for (ll i = 2; i * i <= n; i++) { if (n % i == 0) return false; } return true; } vector<ll> divisor(ll n) { vector<ll> res; for (ll i = 1; i * i <= n; i++) { if (n % i == 0) { res.push_back(i); if (i != n / i) res.push_back(n / i); } } return res; } map<ll, int> prime_factor(ll n) { map<ll, int> res; for (ll i = 2; i * i <= n; i++) { while (n % i == 0) { res[i]++; n /= i; } } if (n != 1) res[n]++; return res; } vector<ll> prime_enum(int n) { vector<bool> is_prime(n + 1, true); is_prime[0] = is_prime[1] = false; vector<ll> res; for (int i = 2; i <= n; i++) { if (!is_prime[i]) continue; res.push_back(i); for (int j = 2 * i; j <= n; j += i) { is_prime[j] = false; } } return res; } // Mod // mod_tools #define MFACT_SIZE 1000001 ll fact[MFACT_SIZE]; ll mpow(ll x, ll y) { // d(x) if (y == 0) return 1; if (y % 2 == 0) { return mpow(x * x % mod, y / 2) % mod; } else { return x * mpow(x, y - 1) % mod; } } ll minv(ll x) { // only available for mod=10^9+7 return mpow(x, mod - 2); } ll ms(ll a, ll b) { return (a + b) % mod; } ll mm(ll a, ll b) { return (a * b) % mod; } void mfact() { // prepare fact-array fact[0] = 1; rep(i, 1, MFACT_SIZE) { fact[i] = fact[i - 1] * i % mod; } } ll mcombi(ll n, ll k) { return (fact[n] * minv(fact[k]) % mod) * minv(fact[n - k]) % mod; } ll llceil(ll a, ll b) { if (a >= 0) { return (a + b - 1) / b; } else { return a / b; } } ll llfloor(ll a, ll b) { if (a < 0) { return (a - b + 1) / b; } else { return a / b; } } struct UnionFind { VL data; UnionFind(int size) : data(size, -1) {} bool unite(int x, int y) { x = root(x); y = root(y); if (x != y) { if (data[y] < data[x]) swap(x, y); data[x] += data[y]; data[y] = x; } return x != y; } bool find(int x, int y) { return root(x) == root(y); } int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); } ll size(int x) { return -data[root(x)]; } ll num_root(ll size) { VL roots; rep(i, size) roots.pb(root(i)); sort(all(roots)); roots.erase(unique(all(roots)), roots.end()); return roots.size(); } }; struct graph { int V; vector<VP> v; graph(int V) : V(V), v(vector<VP>(V)) {} void add_diedge(int v1, int v2, ll w) { v[v1].pb({v2, w}); v[v2].pb({v1, w}); } void add_edge(int v1, int v2, ll w) { v[v1].pb({v2, w}); } VL dist = vector<ll>(V, -1); VI prever = vector<int>(V, -1); VL dijkstra(int start) { priority_queue<P, vector<P>, greater<P>> que; que.push(P(0, start)); while (!que.empty()) { P pa = que.top(); que.pop(); int u = pa.se; if (dist[u] >= 0 && dist[u] < pa.fi) continue; dist[u] = pa.fi; for (P e : v[u]) { if (dist[e.fi] < 0 || dist[e.fi] > dist[u] + e.se) { dist[e.fi] = dist[u] + e.se; prever[e.fi] = u; que.push(P(dist[e.fi], e.fi)); } } } return dist; } void dfs(ll now, ll prv, ll c) { dist[now] = c; for (auto nxt : v[now]) if (nxt.fi != prv) { if (nxt.se % 2) dfs(nxt.fi, now, !c); else dfs(nxt.fi, now, c); } } void gprint() { rep(i, V) { ps(i); ps(": "); for (P x : v[i]) { ps(x.fi); ps(","); ps(x.se); ps(" "); } p(""); } } }; struct SegmentTree { private: int n; VL node; public: // 元配列 v をセグメント木で表現する SegmentTree(VL v) { // 最下段のノード数は元配列のサイズ以上になる最小の 2 冪 -> これを n とおく // セグメント木全体で必要なノード数は 2n-1 個である int sz = v.size(); n = 1; while (n < sz) n *= 2; node.resize(2 * n - 1, inf); for (int i = 0; i < sz; i++) node[i + n - 1] = v[i]; for (int i = n - 2; i >= 0; i--) node[i] = min(node[2 * i + 1], node[2 * i + 2]); } void update(int x, int val) { x += (n - 1); node[x] = val; while (x > 0) { x = (x - 1) / 2; node[x] = min(node[2 * x + 1], node[2 * x + 2]); } } // 要求区間 [a, b) 中の要素の最小値を答える // // k := 自分がいるノードのインデックス // // 対象区間は [l, r) にあたる // get a,b+1で呼び出す int get(int a, int b, int k = 0, int l = 0, int r = -1) { if (r < 0) r = n; d(l) d(r) d(a) d(b) if (r <= a || b <= l) return inf; // 要求区間が対象区間を完全に被覆 -> 対象区間を答えの計算に使う if (a <= l && r <= b) return node[k]; // 要求区間が対象区間の一部を被覆 -> 子について探索を行う // 左側の子を vl ・ 右側の子を vr としている // 新しい対象区間は、現在の対象区間を半分に割ったもの int vl = get(a, b, 2 * k + 1, l, (l + r) / 2); int vr = get(a, b, 2 * k + 2, (l + r) / 2, r); return min(vl, vr); } }; ll a[100001], b[100001], c[100001], d, n, m, x, y, z, h, w, k, mi = inf, ma = -inf, ans, sum, cnt, s, t, l, r, res, tmp, itr, p, q; bool flag; int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1}; int dx8[8] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[8] = {0, 1, 1, 1, 0, -1, -1, -1}; char cha; string st; P pa; bool fl; int main(void) { cin >> n; imap M; rep(i, n) { cin >> tmp; M[tmp]++; } if (sz(M) == 1) { if (M[0] == n) pyn(0); else pyn(1); } else if (sz(M) >= 4 || n % 3 != 0) pyn(0); else if (sz(M) == 3) { tmp = 0; fl = 1; for (auto itr = M.begin(); itr != M.end(); ++itr) { tmp ^= itr->first; if (n % 3 == 0 && itr->second == n / 3) continue; else fl = 0; } if (tmp == 0 && fl) pyn(1); else pyn(0); } else if (sz(M) == 2) { fl = 1; for (auto itr = M.begin(); itr != M.end(); ++itr) { if (itr->first == 0 && itr->second == n / 3) continue; else if (itr->second == 2 * n / 3) continue; else fl = 0; } if (fl) pyn(1); else pyn(0); } return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; struct fast_ios { fast_ios() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_; #define _overload3(_1, _2, _3, name, ...) name #define _rep(i, n) repi(i, 0, n) #define repi(i, a, b) for (ll i = ll(a); i < ll(b); ++i) #define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__) #define inf (ll)2147483647 #define mod (ll)(1e9 + 7) #define d(x) cerr << #x << "=" << x << endl; #define p(x) cout << (x) << endl #define ps(x) cout << (x) #define pk(x) cout << (x) << " " #define pfix(d, x) cout << fixed << setprecision(d) << x << endl #define pb push_back #define sz(v) (v).size() #define all(v) (v).begin(), (v).end() #define minel(v) *min_element(all(v)) #define minind(v) distance((v).begin(), min_element(all(v))) #define maxel(v) *max_element(all(v)) #define maxind(v) distance((v).begin(), max_element(all(v))) #define p2d(v, n, m) \ rep(i, n) { \ rep(j, m) { pk(v[i][j]); } \ p(""); \ } #define fi first #define se second typedef map<ll, ll> imap; typedef pair<ll, ll> P; typedef vector<int> VI; typedef vector<ll> VL; typedef vector<pair<ll, ll>> VP; template <typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); } void pyn(bool ans) { p(ans ? "Yes" : "No"); } // Prime bool is_prime(ll n) { if (n == 1) return false; for (ll i = 2; i * i <= n; i++) { if (n % i == 0) return false; } return true; } vector<ll> divisor(ll n) { vector<ll> res; for (ll i = 1; i * i <= n; i++) { if (n % i == 0) { res.push_back(i); if (i != n / i) res.push_back(n / i); } } return res; } map<ll, int> prime_factor(ll n) { map<ll, int> res; for (ll i = 2; i * i <= n; i++) { while (n % i == 0) { res[i]++; n /= i; } } if (n != 1) res[n]++; return res; } vector<ll> prime_enum(int n) { vector<bool> is_prime(n + 1, true); is_prime[0] = is_prime[1] = false; vector<ll> res; for (int i = 2; i <= n; i++) { if (!is_prime[i]) continue; res.push_back(i); for (int j = 2 * i; j <= n; j += i) { is_prime[j] = false; } } return res; } // Mod // mod_tools #define MFACT_SIZE 1000001 ll fact[MFACT_SIZE]; ll mpow(ll x, ll y) { // d(x) if (y == 0) return 1; if (y % 2 == 0) { return mpow(x * x % mod, y / 2) % mod; } else { return x * mpow(x, y - 1) % mod; } } ll minv(ll x) { // only available for mod=10^9+7 return mpow(x, mod - 2); } ll ms(ll a, ll b) { return (a + b) % mod; } ll mm(ll a, ll b) { return (a * b) % mod; } void mfact() { // prepare fact-array fact[0] = 1; rep(i, 1, MFACT_SIZE) { fact[i] = fact[i - 1] * i % mod; } } ll mcombi(ll n, ll k) { return (fact[n] * minv(fact[k]) % mod) * minv(fact[n - k]) % mod; } ll llceil(ll a, ll b) { if (a >= 0) { return (a + b - 1) / b; } else { return a / b; } } ll llfloor(ll a, ll b) { if (a < 0) { return (a - b + 1) / b; } else { return a / b; } } struct UnionFind { VL data; UnionFind(int size) : data(size, -1) {} bool unite(int x, int y) { x = root(x); y = root(y); if (x != y) { if (data[y] < data[x]) swap(x, y); data[x] += data[y]; data[y] = x; } return x != y; } bool find(int x, int y) { return root(x) == root(y); } int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); } ll size(int x) { return -data[root(x)]; } ll num_root(ll size) { VL roots; rep(i, size) roots.pb(root(i)); sort(all(roots)); roots.erase(unique(all(roots)), roots.end()); return roots.size(); } }; struct graph { int V; vector<VP> v; graph(int V) : V(V), v(vector<VP>(V)) {} void add_diedge(int v1, int v2, ll w) { v[v1].pb({v2, w}); v[v2].pb({v1, w}); } void add_edge(int v1, int v2, ll w) { v[v1].pb({v2, w}); } VL dist = vector<ll>(V, -1); VI prever = vector<int>(V, -1); VL dijkstra(int start) { priority_queue<P, vector<P>, greater<P>> que; que.push(P(0, start)); while (!que.empty()) { P pa = que.top(); que.pop(); int u = pa.se; if (dist[u] >= 0 && dist[u] < pa.fi) continue; dist[u] = pa.fi; for (P e : v[u]) { if (dist[e.fi] < 0 || dist[e.fi] > dist[u] + e.se) { dist[e.fi] = dist[u] + e.se; prever[e.fi] = u; que.push(P(dist[e.fi], e.fi)); } } } return dist; } void dfs(ll now, ll prv, ll c) { dist[now] = c; for (auto nxt : v[now]) if (nxt.fi != prv) { if (nxt.se % 2) dfs(nxt.fi, now, !c); else dfs(nxt.fi, now, c); } } void gprint() { rep(i, V) { ps(i); ps(": "); for (P x : v[i]) { ps(x.fi); ps(","); ps(x.se); ps(" "); } p(""); } } }; struct SegmentTree { private: int n; VL node; public: // 元配列 v をセグメント木で表現する SegmentTree(VL v) { // 最下段のノード数は元配列のサイズ以上になる最小の 2 冪 -> これを n とおく // セグメント木全体で必要なノード数は 2n-1 個である int sz = v.size(); n = 1; while (n < sz) n *= 2; node.resize(2 * n - 1, inf); for (int i = 0; i < sz; i++) node[i + n - 1] = v[i]; for (int i = n - 2; i >= 0; i--) node[i] = min(node[2 * i + 1], node[2 * i + 2]); } void update(int x, int val) { x += (n - 1); node[x] = val; while (x > 0) { x = (x - 1) / 2; node[x] = min(node[2 * x + 1], node[2 * x + 2]); } } // 要求区間 [a, b) 中の要素の最小値を答える // // k := 自分がいるノードのインデックス // // 対象区間は [l, r) にあたる // get a,b+1で呼び出す int get(int a, int b, int k = 0, int l = 0, int r = -1) { if (r < 0) r = n; d(l) d(r) d(a) d(b) if (r <= a || b <= l) return inf; // 要求区間が対象区間を完全に被覆 -> 対象区間を答えの計算に使う if (a <= l && r <= b) return node[k]; // 要求区間が対象区間の一部を被覆 -> 子について探索を行う // 左側の子を vl ・ 右側の子を vr としている // 新しい対象区間は、現在の対象区間を半分に割ったもの int vl = get(a, b, 2 * k + 1, l, (l + r) / 2); int vr = get(a, b, 2 * k + 2, (l + r) / 2, r); return min(vl, vr); } }; ll a[100001], b[100001], c[100001], d, n, m, x, y, z, h, w, k, mi = inf, ma = -inf, ans, sum, cnt, s, t, l, r, res, tmp, itr, p, q; bool flag; int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1}; int dx8[8] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[8] = {0, 1, 1, 1, 0, -1, -1, -1}; char cha; string st; P pa; bool fl; int main(void) { cin >> n; imap M; rep(i, n) { cin >> tmp; M[tmp]++; } if (sz(M) == 1) { if (M[0] == n) pyn(1); else pyn(0); } else if (sz(M) >= 4 || n % 3 != 0) pyn(0); else if (sz(M) == 3) { tmp = 0; fl = 1; for (auto itr = M.begin(); itr != M.end(); ++itr) { tmp ^= itr->first; if (n % 3 == 0 && itr->second == n / 3) continue; else fl = 0; } if (tmp == 0 && fl) pyn(1); else pyn(0); } else if (sz(M) == 2) { fl = 1; for (auto itr = M.begin(); itr != M.end(); ++itr) { if (itr->first == 0 && itr->second == n / 3) continue; else if (itr->second == 2 * n / 3) continue; else fl = 0; } if (fl) pyn(1); else pyn(0); } return 0; }
[ "call.remove", "control_flow.branch.else.remove", "control_flow.branch.else_if.replace.remove", "control_flow.branch.if.replace.add", "call.add" ]
781,857
781,858
u001566280
cpp
p02975
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll INF = (ll)1e10; int main() { ll n = 0; auto a = vector<ll>(n, 0); for (auto &i : a) cin >> i; auto ans = 0; for (auto &i : a) ans ^= i; cout << (ans == 0 ? "Yes" : "No"); return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll INF = (ll)1e10; int main() { ll n = 0; cin >> n; auto a = vector<ll>(n, 0); for (auto &i : a) cin >> i; auto ans = 0; for (auto &i : a) ans ^= i; cout << (ans == 0 ? "Yes" : "No"); return 0; }
[]
781,872
781,873
u533749093
cpp
p02975
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll MOD = 1000000007; int main() { int N; cin >> N; int a[N]; for (int i = 0; i < N; i++) { cin >> a[i]; } sort(a, a + N); int cnt[4] = {0}; int tmp[4] = {0}; int pos = 0; tmp[0] = a[0]; cnt[pos]++; for (int i = 1; i < N && pos < 3; i++) { if (a[i] != a[i - 1]) { pos++; tmp[pos] = a[i]; } cnt[pos]++; } if (pos < 3 && cnt[0] == cnt[1] && cnt[1] == cnt[2] && (tmp[0] ^ tmp[1]) == tmp[2]) cout << "Yes" << "\n"; else if (pos < 2 && cnt[0] == 2 * cnt[1] && tmp[0] == 0) cout << "Yes" << "\n"; else if (pos < 1 && tmp[0] == 0) cout << "Yes" << "\n"; else cout << "No" << "\n"; return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll MOD = 1000000007; int main() { int N; cin >> N; int a[N]; for (int i = 0; i < N; i++) { cin >> a[i]; } sort(a, a + N); int cnt[4] = {0}; int tmp[4] = {0}; int pos = 0; tmp[0] = a[0]; cnt[pos]++; for (int i = 1; i < N && pos < 3; i++) { if (a[i] != a[i - 1]) { pos++; tmp[pos] = a[i]; } cnt[pos]++; } if (pos < 3 && cnt[0] == cnt[1] && cnt[1] == cnt[2] && (tmp[0] ^ tmp[1]) == tmp[2]) cout << "Yes" << "\n"; else if (pos < 2 && 2 * cnt[0] == cnt[1] && tmp[0] == 0) cout << "Yes" << "\n"; else if (pos < 1 && tmp[0] == 0) cout << "Yes" << "\n"; else cout << "No" << "\n"; return 0; }
[ "control_flow.branch.if.condition.change", "expression.operation.binary.remove" ]
781,874
781,875
u872581897
cpp
p02975
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> l_l; typedef pair<int, int> i_i; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } #define EPS (1e-7) #define INF (1e9) #define PI (acos(-1)) // const ll mod = 1000000007; int N; int a[105000]; int main() { // cout.precision(10); cin >> N; for (int i = 1; i <= N; i++) { cin >> a[i]; } if (N % 3 != 0) { for (int i = 1; i <= N; i++) { if (a[i] != 0) { cout << "No" << endl; return 0; } } cout << "Yes" << endl; return 0; } set<int> st; map<int, int> mp; for (int i = 1; i <= N; i++) { st.insert(a[i]); mp[a[i]]++; } if (st.size() > 3) { cout << "No" << endl; return 0; } vector<int> v; for (auto itr = st.begin(); itr != st.end(); itr++) { while (mp[*itr] > 0) { if (mp[*itr] % (N / 3) != 0) { cout << "No" << endl; return 0; } mp[*itr] -= N / 3; v.push_back(*itr); } } cerr << v[0] << " " << v[1] << " " << v[2] << endl; if (v[0] ^ v[1] == v[2]) { cout << "Yes" << endl; } else { cout << "No" << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> l_l; typedef pair<int, int> i_i; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } #define EPS (1e-7) #define INF (1e9) #define PI (acos(-1)) // const ll mod = 1000000007; int N; int a[105000]; int main() { // cout.precision(10); cin >> N; for (int i = 1; i <= N; i++) { cin >> a[i]; } if (N % 3 != 0) { for (int i = 1; i <= N; i++) { if (a[i] != 0) { cout << "No" << endl; return 0; } } cout << "Yes" << endl; return 0; } set<int> st; map<int, int> mp; for (int i = 1; i <= N; i++) { st.insert(a[i]); mp[a[i]]++; } if (st.size() > 3) { cout << "No" << endl; return 0; } vector<int> v; for (auto itr = st.begin(); itr != st.end(); itr++) { while (mp[*itr] > 0) { if (mp[*itr] % (N / 3) != 0) { cout << "No" << endl; return 0; } mp[*itr] -= N / 3; v.push_back(*itr); } } cerr << v[0] << " " << v[1] << " " << v[2] << endl; if ((v[0] ^ v[1]) == v[2]) { cout << "Yes" << endl; } else { cout << "No" << endl; } return 0; }
[ "control_flow.branch.if.condition.change" ]
781,878
781,879
u980655160
cpp
p02975
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; long a, b; cin >> a; for (int i = 0; i < N; i++) { cin >> b; a ^= b; } cout << (a == 0 ? "Yes" : "No") << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; long a, b; cin >> a; for (int i = 0; i < N - 1; i++) { cin >> b; a ^= b; } cout << (a == 0 ? "Yes" : "No") << endl; return 0; }
[ "control_flow.loop.for.condition.change", "misc.off_by_one" ]
781,882
781,883
u239087789
cpp
p02975
#include <bits/stdc++.h> using namespace std; using ll = long long; const int MOD = 1e9 + 7; #define REP(i, n) for (int i = 0; i < n; ++i) #define FOR(i, t, n) for (ll i = t; i <= (ll)n; ++i) struct edge { int from, to; ll cost; }; class Eratosthenes { public: vector<bool> prime; Eratosthenes(ll size) { size = max((int)sqrt(size) + 1, 101010); prime.resize(size, 1); prime[0] = 0; prime[1] = 0; for (size_t i = 2; i * i <= size; ++i) if (prime[i]) { for (size_t j = 2; i * j <= size; ++j) prime[i * j] = false; } } }; class Combination { vector<ll> fac; // n!(mod M) vector<ll> ifac; // k!^{M-2} (mod M) public: Combination(ll size) { fac.resize(size); ifac.resize(size); fac[0] = 1; ifac[0] = 1; for (ll i = 0; i < size; i++) { fac[i + 1] = fac[i] * (i + 1) % MOD; ifac[i + 1] = ifac[i] * mpow(i + 1, MOD - 2) % MOD; } } ll mpow(ll x, ll n) { ll ans = 1; while (n != 0) { if (n & 1) ans = ans * x % MOD; x = x * x % MOD; n = n >> 1; } return ans; } ll comb(ll a, ll b) { if (a == 0 && b == 0) return 1; if (a < b || a < 0) return 0; ll tmp = ifac[a - b] * ifac[b] % MOD; return tmp * fac[a] % MOD; } }; ll GCD(ll a, ll b) { if (b == 0) return a; return GCD(b, a % b); } ll LCM(ll a, ll b) { ll gcd = GCD(a, b); return a / gcd * b; } ll N, M; int main() { cin >> N; int x = 0; REP(i, N) { int a; cin >> a; x = x xor a; } if (x) { cout << "NO" << endl; } else { cout << "YES" << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; const int MOD = 1e9 + 7; #define REP(i, n) for (int i = 0; i < n; ++i) #define FOR(i, t, n) for (ll i = t; i <= (ll)n; ++i) struct edge { int from, to; ll cost; }; class Eratosthenes { public: vector<bool> prime; Eratosthenes(ll size) { size = max((int)sqrt(size) + 1, 101010); prime.resize(size, 1); prime[0] = 0; prime[1] = 0; for (size_t i = 2; i * i <= size; ++i) if (prime[i]) { for (size_t j = 2; i * j <= size; ++j) prime[i * j] = false; } } }; class Combination { vector<ll> fac; // n!(mod M) vector<ll> ifac; // k!^{M-2} (mod M) public: Combination(ll size) { fac.resize(size); ifac.resize(size); fac[0] = 1; ifac[0] = 1; for (ll i = 0; i < size; i++) { fac[i + 1] = fac[i] * (i + 1) % MOD; ifac[i + 1] = ifac[i] * mpow(i + 1, MOD - 2) % MOD; } } ll mpow(ll x, ll n) { ll ans = 1; while (n != 0) { if (n & 1) ans = ans * x % MOD; x = x * x % MOD; n = n >> 1; } return ans; } ll comb(ll a, ll b) { if (a == 0 && b == 0) return 1; if (a < b || a < 0) return 0; ll tmp = ifac[a - b] * ifac[b] % MOD; return tmp * fac[a] % MOD; } }; ll GCD(ll a, ll b) { if (b == 0) return a; return GCD(b, a % b); } ll LCM(ll a, ll b) { ll gcd = GCD(a, b); return a / gcd * b; } ll N, M; int main() { cin >> N; int x = 0; REP(i, N) { int a; cin >> a; x = x xor a; } if (x) { cout << "No" << endl; } else { cout << "Yes" << endl; } return 0; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
781,911
781,912
u181806820
cpp
p02975
#include <bits/stdc++.h> #define F first #define S second using namespace std; int n; pair<int, int> res1, res2, res3; main() { cin >> n; res1.F = res2.F = res3.F = 2e9; for (int i = 1; i <= n; i++) { int x; cin >> x; if (x < res1.F) res3 = res2, res2 = res1, res1.F = x, res1.S = 1; else if (x == res1.F) res1.S++; else if (x < res2.F) res3 = res2, res2.F = x, res2.S = 1; else if (x == res2.F) res2.S++; else if (x < res3.F) res3.F = x, res3.S = 1; else if (x == res3.F) res3.S++; } if (res1.S == n && res1.F == 0) { cout << "Yes\n"; return 0; } if (n % 3 != 0) { cout << "No\n"; return 0; } if (!res1.F) { if (res1.S == n / 3 && res2.S == (n / 3) * 2) cout << "Yes\n"; else cout << "No\n"; return 0; } if (res1.S == n / 3 && res2.S == (n / 3) && res3.S == (n / 3) && res1.F ^ res2.F == res3.F) cout << "Yes\n"; else cout << "No\n"; }
#include <bits/stdc++.h> #define F first #define S second using namespace std; int n; pair<int, int> res1, res2, res3; main() { cin >> n; res1.F = res2.F = res3.F = 2e9; for (int i = 1; i <= n; i++) { int x; cin >> x; if (x < res1.F) res3 = res2, res2 = res1, res1.F = x, res1.S = 1; else if (x == res1.F) res1.S++; else if (x < res2.F) res3 = res2, res2.F = x, res2.S = 1; else if (x == res2.F) res2.S++; else if (x < res3.F) res3.F = x, res3.S = 1; else if (x == res3.F) res3.S++; } if (res1.S == n && res1.F == 0) { cout << "Yes\n"; return 0; } if (n % 3 != 0) { cout << "No\n"; return 0; } if (!res1.F) { if (res1.S == n / 3 && res2.S == (n / 3) * 2) cout << "Yes\n"; else cout << "No\n"; return 0; } if (res1.S == n / 3 && res2.S == (n / 3) && res3.S == (n / 3) && (res1.F ^ res2.F) == res3.F) cout << "Yes\n"; else cout << "No\n"; }
[ "control_flow.branch.if.condition.change" ]
781,926
781,927
u898791488
cpp
p02975
#include <bits/stdc++.h> using namespace std; #define int long long #ifdef LOCAL_DEBUG #include "LOCAL_DEBUG.hpp" #endif signed main() { int n; cin >> n; vector<int> a(n); map<int, int> mp; for (int i = 0; i < n; i++) { cin >> a[i]; mp[a[i]]++; } if (mp[0] == n) { cout << "Yes" << endl; return 0; } if (n % 3 != 0) { cout << "No" << endl; return 0; } vector<int> v; for (auto p : mp) { for (int j = 0; j < p.second / (n / 3); j++) { v.push_back(p.first); } } if (v.size() == 3 && (v[0] ^ v[1] ^ v[2] == 0)) { cout << "Yes" << endl; return 0; } cout << "No" << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define int long long #ifdef LOCAL_DEBUG #include "LOCAL_DEBUG.hpp" #endif signed main() { int n; cin >> n; vector<int> a(n); map<int, int> mp; for (int i = 0; i < n; i++) { cin >> a[i]; mp[a[i]]++; } if (mp[0] == n) { cout << "Yes" << endl; return 0; } if (n % 3 != 0) { cout << "No" << endl; return 0; } vector<int> v; for (auto p : mp) { for (int j = 0; j < p.second / (n / 3); j++) { v.push_back(p.first); } } if (v.size() == 3 && ((v[0] ^ v[1] ^ v[2]) == 0)) { cout << "Yes" << endl; return 0; } cout << "No" << endl; return 0; }
[ "control_flow.branch.if.condition.change" ]
781,932
781,933
u344122377
cpp
p02975
#include <bits/stdc++.h> using namespace std; #define int long long #ifdef LOCAL_DEBUG #include "LOCAL_DEBUG.hpp" #endif signed main() { int n; cin >> n; vector<int> a(n); map<int, int> mp; for (int i = 0; i < n; i++) { cin >> a[i]; mp[a[i]]++; } if (mp[0] == n) { cout << "Yes" << endl; return 0; } if (n % 3 != 0) { cout << "No" << endl; return 0; } vector<int> v; for (auto p : mp) { for (int j = 0; j < p.second / (n / 3); j++) { v.push_back(p.first); } } if (v.size() == 3 && (a[0] ^ a[1] ^ a[2] == 0)) { cout << "Yes" << endl; return 0; } cout << "No" << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define int long long #ifdef LOCAL_DEBUG #include "LOCAL_DEBUG.hpp" #endif signed main() { int n; cin >> n; vector<int> a(n); map<int, int> mp; for (int i = 0; i < n; i++) { cin >> a[i]; mp[a[i]]++; } if (mp[0] == n) { cout << "Yes" << endl; return 0; } if (n % 3 != 0) { cout << "No" << endl; return 0; } vector<int> v; for (auto p : mp) { for (int j = 0; j < p.second / (n / 3); j++) { v.push_back(p.first); } } if (v.size() == 3 && ((v[0] ^ v[1] ^ v[2]) == 0)) { cout << "Yes" << endl; return 0; } cout << "No" << endl; return 0; }
[ "control_flow.branch.if.condition.change", "identifier.change" ]
781,934
781,933
u344122377
cpp
p02975
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int i, j, cnt = 0; int n; cin >> n; ll a[n]; for (i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); ll b[n]; b[0] = a[0]; cnt = 1; for (i = 1; i < n; i++) { if (a[i - 1] != a[i]) b[cnt++] = a[i]; } if (cnt > 3) { cout << "No"; return 0; } int c[3] = {0}; for (i = 0; i < n; i++) { if (a[i] == b[0]) c[0]++; if (cnt >= 2) { if (a[i] == b[1]) c[1]++; } if (cnt == 3) { if (a[i] == b[2]) c[2]++; } } if (cnt == 1 && b[0] == 0) cout << "Yes"; else if (cnt == 2 && 2 * c[0] == c[1] && b[0] == 0) cout << "Yes"; else if (cnt == 3 && c[0] == c[1] && c[1] == c[2] && b[0] ^ b[1] == b[2]) cout << "No"; else cout << "No"; }
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int i, j, cnt = 0; int n; cin >> n; int a[n]; for (i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); ll b[n]; b[0] = a[0]; cnt = 1; for (i = 1; i < n; i++) { if (a[i - 1] != a[i]) b[cnt++] = a[i]; } if (cnt > 3) { cout << "No"; return 0; } int c[3] = {0}; for (i = 0; i < n; i++) { if (a[i] == b[0]) c[0]++; if (cnt >= 2) { if (a[i] == b[1]) c[1]++; } if (cnt == 3) { if (a[i] == b[2]) c[2]++; } } if (cnt == 1 && b[0] == 0) cout << "Yes"; else if (cnt == 2 && 2 * c[0] == c[1] && b[0] == 0) cout << "Yes"; else if (cnt == 3 && c[0] == c[1] && c[1] == c[2] && (b[0] ^ b[1]) == b[2]) cout << "Yes"; else cout << "No"; }
[ "variable_declaration.type.change", "control_flow.branch.if.condition.change", "literal.string.change", "io.output.change" ]
781,935
781,936
u952130512
cpp
p02975
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int i, j, cnt = 0; int n; cin >> n; ll a[n]; for (i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); ll b[n]; b[0] = a[0]; cnt = 1; for (i = 1; i < n; i++) { if (a[i - 1] != a[i]) b[cnt++] = a[i]; } if (cnt > 3) { cout << "No"; return 0; } int c[3] = {0}; for (i = 0; i < n; i++) { if (a[i] == b[0]) c[0]++; if (cnt >= 2) { if (a[i] == b[1]) c[1]++; } if (cnt == 3) { if (a[i] == b[2]) c[2]++; } } if (cnt == 1 && b[0] == 0) cout << "Yes"; else if (cnt == 2 && 2 * c[0] == c[1] && b[0] == 0) cout << "Yes"; else if (cnt == 3 && c[0] == c[1] && c[1] == c[2] && b[0] ^ b[1] == b[2]) cout << "Yes"; else cout << "No"; }
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int i, j, cnt = 0; int n; cin >> n; int a[n]; for (i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); ll b[n]; b[0] = a[0]; cnt = 1; for (i = 1; i < n; i++) { if (a[i - 1] != a[i]) b[cnt++] = a[i]; } if (cnt > 3) { cout << "No"; return 0; } int c[3] = {0}; for (i = 0; i < n; i++) { if (a[i] == b[0]) c[0]++; if (cnt >= 2) { if (a[i] == b[1]) c[1]++; } if (cnt == 3) { if (a[i] == b[2]) c[2]++; } } if (cnt == 1 && b[0] == 0) cout << "Yes"; else if (cnt == 2 && 2 * c[0] == c[1] && b[0] == 0) cout << "Yes"; else if (cnt == 3 && c[0] == c[1] && c[1] == c[2] && (b[0] ^ b[1]) == b[2]) cout << "Yes"; else cout << "No"; }
[ "variable_declaration.type.change", "control_flow.branch.if.condition.change" ]
781,937
781,936
u952130512
cpp
p02975
#include <iostream> #include <map> #include <vector> using namespace std; int n; vector<int> a; int main() { cin >> n; a.resize(n); for (int i = 0; i < n; ++i) cin >> a[i]; map<int, int> count; for (int _a : a) { if (count.find(_a) == count.end()) count[_a] = 1; else count[_a]++; } bool has_answer = false; if (count.size() == 3) { // { ok if count[a] == count[b] == count[c] else ng } int size = -1; int _xor = 0; for (pair<int, int> _c : count) { if (size == -1) { size = _c.second; _xor = _c.first; continue; } _xor ^= _c.first; has_answer = (size == _c.second); // something wrong } has_answer &= _xor; } if (count.size() == 2) { // { ok if 2*count[a] == count[0] } int size = -1; for (pair<int, int> _c : count) { if (size == -1) { size = (_c.first == 0) ? 2 * _c.second : _c.second; continue; } has_answer = (size == _c.second); } } if (count.size() == 1) { // { ok if count[0] == n and n%3 == 0} has_answer = (count.find(0) != count.end()); } cout << (has_answer ? "Yes" : "No") << endl; return 0; }
#include <iostream> #include <map> #include <vector> using namespace std; int n; vector<int> a; int main() { cin >> n; a.resize(n); for (int i = 0; i < n; ++i) cin >> a[i]; map<int, int> count; for (int _a : a) { if (count.find(_a) == count.end()) count[_a] = 1; else count[_a]++; } bool has_answer = false; if (count.size() == 3) { // { ok if count[a] == count[b] == count[c] else ng } int size = -1; int _xor = 0; for (pair<int, int> _c : count) { if (size == -1) { size = _c.second; _xor = _c.first; continue; } _xor ^= _c.first; has_answer = (size == _c.second); // something wrong } has_answer &= (_xor == 0); } if (count.size() == 2) { // { ok if 2*count[a] == count[0] } int size = -1; for (pair<int, int> _c : count) { if (size == -1) { size = (_c.first == 0) ? 2 * _c.second : _c.second; continue; } has_answer = (size == _c.second); } } if (count.size() == 1) { // { ok if count[0] == n and n%3 == 0} has_answer = (count.find(0) != count.end()); } cout << (has_answer ? "Yes" : "No") << endl; return 0; }
[]
781,940
781,941
u886790158
cpp
p02975
#include <algorithm> #include <bitset> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, i, j, k, x; cin >> n; map<int, int> ct; vector<int> ans(n); for (i = 0; i < n; i++) { cin >> x; ct[x]++; } bool solved = false; if ((ct.find(0) != ct.end()) && (ct[0] == n)) { solved = true; for (i = 0; i < n; i++) ans[i] = 0; } else { if ((ct.size() == 2) && (n % 3 == 0) && (ct.find(0) != ct.end()) && (ct[0] == n / 3)) { solved = true; x = ct.rbegin()->first; for (i = 0; i < n; i++) { if (i % 3 == 0) ans[i] = 0; else ans[i] = x; } } else if ((ct.size() == 3) && (n % 3 == 0)) { vector<int> a; for (auto p : ct) a.push_back(p.first); if ((ct[a[0]] == n / 3) && (ct[a[1]] == n / 3) && (ct[a[2]] == n / 3) && (((a[0] | a[1]) | a[2]) == 0)) { solved = true; for (i = 0; i < n; i++) ans[i] = a[i % 3]; } } } if (!solved) cout << "No\n"; else { cout << "Yes\n"; } return 0; }
#include <algorithm> #include <bitset> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, i, j, k, x; cin >> n; map<int, int> ct; vector<int> ans(n); for (i = 0; i < n; i++) { cin >> x; ct[x]++; } bool solved = false; if ((ct.find(0) != ct.end()) && (ct[0] == n)) { solved = true; for (i = 0; i < n; i++) ans[i] = 0; } else { if ((ct.size() == 2) && (n % 3 == 0) && (ct.find(0) != ct.end()) && (ct[0] == n / 3)) { solved = true; x = ct.rbegin()->first; for (i = 0; i < n; i++) { if (i % 3 == 0) ans[i] = 0; else ans[i] = x; } } else if ((ct.size() == 3) && (n % 3 == 0)) { vector<int> a; for (auto p : ct) a.push_back(p.first); if ((ct[a[0]] == n / 3) && (ct[a[1]] == n / 3) && (ct[a[2]] == n / 3) && (((a[0] ^ a[1]) ^ a[2]) == 0)) { solved = true; for (i = 0; i < n; i++) ans[i] = a[i % 3]; } } } if (!solved) cout << "No\n"; else { cout << "Yes\n"; } return 0; }
[ "control_flow.branch.if.condition.change" ]
781,942
781,943
u696290869
cpp
p02975
#include <algorithm> #include <bitset> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, i, j, k, x; cin >> n; map<int, int> ct; vector<int> ans(n); for (i = 0; i < n; i++) { cin >> x; ct[x]++; } bool solved = false; if ((ct.find(0) != ct.end()) && (ct[0] == n)) { solved = true; for (i = 0; i < n; i++) ans[i] = 0; } else { if ((ct.size() == 2) && (n % 3 == 0) && (ct.find(0) != ct.end()) && (ct[0] == n / 3)) { solved = true; x = ct.rbegin()->first; for (i = 0; i < n; i++) { if (i % 3 == 0) ans[i] = 0; else ans[i] = x; } } else if ((ct.size() == 3) && (n % 3 == 0)) { vector<int> a; for (auto p : ct) a.push_back(p.first); if ((ct[a[0]] == n / 3) && (ct[a[1]] == n / 3) && (ct[a[2]] == n / 3) && (a[0] | a[1] | a[2] == 0)) { solved = true; for (i = 0; i < n; i++) ans[i] = a[i % 3]; } } } if (!solved) cout << "No\n"; else { cout << "Yes\n"; } return 0; }
#include <algorithm> #include <bitset> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, i, j, k, x; cin >> n; map<int, int> ct; vector<int> ans(n); for (i = 0; i < n; i++) { cin >> x; ct[x]++; } bool solved = false; if ((ct.find(0) != ct.end()) && (ct[0] == n)) { solved = true; for (i = 0; i < n; i++) ans[i] = 0; } else { if ((ct.size() == 2) && (n % 3 == 0) && (ct.find(0) != ct.end()) && (ct[0] == n / 3)) { solved = true; x = ct.rbegin()->first; for (i = 0; i < n; i++) { if (i % 3 == 0) ans[i] = 0; else ans[i] = x; } } else if ((ct.size() == 3) && (n % 3 == 0)) { vector<int> a; for (auto p : ct) a.push_back(p.first); if ((ct[a[0]] == n / 3) && (ct[a[1]] == n / 3) && (ct[a[2]] == n / 3) && (((a[0] ^ a[1]) ^ a[2]) == 0)) { solved = true; for (i = 0; i < n; i++) ans[i] = a[i % 3]; } } } if (!solved) cout << "No\n"; else { cout << "Yes\n"; } return 0; }
[ "control_flow.branch.if.condition.change" ]
781,944
781,943
u696290869
cpp
p02975
#include <algorithm> #include <iostream> using namespace std; const int maxn = 1e5 + 10; int a[maxn]; int num[4], id = 0, cnt = 0, v = -1; int main() { int n; cin >> n; for (int i = 1; i <= n; ++i) cin >> a[i]; if (n % 3 != 0) { for (int i = 1; i <= n; ++i) if (a[i] != 0) { cout << "No" << endl; return 0; } cout << "Yes" << endl; return 0; } sort(a + 1, a + n + 1); for (int i = 1; i <= n; ++i) { if (a[i] != v) { cnt = 1; v = a[i]; } else cnt++; if (cnt == n / 3) { num[++id] = v; cnt = 0; } } if (id != 3) { cout << "No" << endl; } else if (num[1] ^ num[2] ^ num[3] == 0) cout << "Yes" << endl; else cout << "No" << endl; return 0; }
#include <algorithm> #include <iostream> using namespace std; const int maxn = 1e5 + 10; int a[maxn]; int num[4], id = 0, cnt = 0, v = -1; int main() { int n; cin >> n; for (int i = 1; i <= n; ++i) cin >> a[i]; if (n % 3 != 0) { for (int i = 1; i <= n; ++i) if (a[i] != 0) { cout << "No" << endl; return 0; } cout << "Yes" << endl; return 0; } sort(a + 1, a + n + 1); for (int i = 1; i <= n; ++i) { if (a[i] != v) { cnt = 1; v = a[i]; } else cnt++; if (cnt == n / 3) { num[++id] = v; cnt = 0; } } if (id != 3) { cout << "No" << endl; } else if ((num[1] ^ num[2] ^ num[3]) == 0) cout << "Yes" << endl; else cout << "No" << endl; return 0; }
[ "control_flow.branch.if.condition.change" ]
781,945
781,946
u420303440
cpp
p02975
#include "bits/stdc++.h" using namespace std; typedef long long ll; const ll MOD = 998244353; int main() { int N; cin >> N; map<int, int> cnt; vector<int> a(N); for (int i = 0; i < N; i++) { cin >> a[i]; cnt[a[i]]++; } sort(a.begin(), a.end()); a.erase(unique(a.begin(), a.end()), a.end()); if (cnt.size() == 1) { if (cnt[0] == N) cout << "Yes" << endl; else cout << "No" << endl; } else if (cnt.size() == 2) { if (N % 3 == 0 && cnt[0] == N / 3) cout << "Yes" << endl; else cout << "No" << endl; } else if (cnt.size() == 3) { if (N % 3 == 0 && (a[0] ^ a[1] == a[2]) && cnt[a[0]] == N / 3 && cnt[a[1]] == N / 3) cout << "Yes" << endl; else cout << "No" << endl; } else { cout << "No" << endl; } }
#include "bits/stdc++.h" using namespace std; typedef long long ll; const ll MOD = 998244353; int main() { int N; cin >> N; map<int, int> cnt; vector<int> a(N); for (int i = 0; i < N; i++) { cin >> a[i]; cnt[a[i]]++; } sort(a.begin(), a.end()); a.erase(unique(a.begin(), a.end()), a.end()); if (cnt.size() == 1) { if (cnt[0] == N) cout << "Yes" << endl; else cout << "No" << endl; } else if (cnt.size() == 2) { if (N % 3 == 0 && cnt[0] == N / 3) cout << "Yes" << endl; else cout << "No" << endl; } else if (cnt.size() == 3) { if (N % 3 == 0 && ((a[0] ^ a[1]) == a[2]) && cnt[a[0]] == N / 3 && cnt[a[1]] == N / 3) cout << "Yes" << endl; else cout << "No" << endl; } else { cout << "No" << endl; } }
[ "control_flow.branch.if.condition.change" ]
781,950
781,951
u243961437
cpp
p02975
#include "bits/stdc++.h" using namespace std; typedef long long ll; const ll MOD = 1e9 + 7; const ll INF = 1LL << 60; int main() { int N; cin >> N; vector<int> a(N); map<int, int> cnt; for (int i = 0; i < N; i++) { cin >> a[i]; cnt[a[i]]++; } sort(a.begin(), a.end()); a.erase(unique(a.begin(), a.end()), a.end()); if (N % 3 != 0 || a.size() == 1) { if (cnt[0] == N) cout << "Yes" << endl; else cout << "No" << endl; return 0; } if (a.size() > 3) { cout << "No" << endl; return 0; } if (a.size() == 2) { if (a[0] == 0 && cnt[0] == N / 3) cout << "Yes" << endl; else cout << "No" << endl; } else { if (a[0] ^ a[1] == a[2] && cnt[a[0]] == N / 3 && cnt[a[1]] == N / 3) cout << "Yes" << endl; else cout << "No" << endl; } }
#include "bits/stdc++.h" using namespace std; typedef long long ll; const ll MOD = 1e9 + 7; const ll INF = 1LL << 60; int main() { int N; cin >> N; vector<int> a(N); map<int, int> cnt; for (int i = 0; i < N; i++) { cin >> a[i]; cnt[a[i]]++; } sort(a.begin(), a.end()); a.erase(unique(a.begin(), a.end()), a.end()); if (N % 3 != 0 || a.size() == 1) { if (cnt[0] == N) cout << "Yes" << endl; else cout << "No" << endl; return 0; } if (a.size() > 3) { cout << "No" << endl; return 0; } if (a.size() == 2) { if (a[0] == 0 && cnt[0] == N / 3) cout << "Yes" << endl; else cout << "No" << endl; } else { if ((a[0] ^ a[1]) == a[2] && cnt[a[0]] == N / 3 && cnt[a[1]] == N / 3) cout << "Yes" << endl; else cout << "No" << endl; } }
[ "control_flow.branch.if.condition.change" ]
781,952
781,953
u243961437
cpp
p02975
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n); map<int, int> mp; for (auto &x : a) { cin >> x; mp[x]++; } sort(a.begin(), a.end()); unique(a.begin(), a.end()); if (mp.size() == 3) { if ((mp[a[0]] == mp[a[1]]) && (mp[a[1]] == mp[a[2]]) && (a[0] ^ a[1] == a[2])) { cout << "Yes" << endl; } else { cout << "No" << endl; } } else if (mp.size() == 2) { if (mp[a[1]] == 2 * mp[0]) { cout << "Yes" << endl; } else { cout << "No" << endl; } } else if (mp.size() == 1) { if (mp[0]) { cout << "Yes" << endl; } else { cout << "No" << endl; } } else { cout << "No" << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n); map<int, int> mp; for (auto &x : a) { cin >> x; mp[x]++; } sort(a.begin(), a.end()); unique(a.begin(), a.end()); if (mp.size() == 3) { if ((mp[a[0]] == mp[a[1]]) && (mp[a[1]] == mp[a[2]]) && ((a[0] ^ a[1]) == a[2])) { cout << "Yes" << endl; } else { cout << "No" << endl; } } else if (mp.size() == 2) { if (mp[a[1]] == 2 * mp[0]) { cout << "Yes" << endl; } else { cout << "No" << endl; } } else if (mp.size() == 1) { if (mp[0]) { cout << "Yes" << endl; } else { cout << "No" << endl; } } else { cout << "No" << endl; } return 0; }
[ "control_flow.branch.if.condition.change" ]
781,954
781,955
u096840034
cpp
p02975
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> c; map<int, int> mp; for (int i = 0; i < n; i++) { int a; cin >> a; if (mp[a] == 0) { c.push_back(a); } mp[a]++; } sort(c.begin(), c.end()); if (c.size() == 1) { if (c[0] == 0) { cout << "Yes" << endl; return 0; } } if (n % 3 != 0) { cout << "No" << endl; return 0; } if (c.size() == 2) { if (c[0] == 0 && mp[c[0]] * 2 == mp[c[1]]) { cout << "Yes" << endl; return 0; } } if (c.size() == 3) { if (mp[c[0]] == mp[c[1]] && mp[c[1]] == mp[c[2]]) { int t = c[0] ^ c[1]; if (t ^ c[2] == 0) { cout << "Yes" << endl; return 0; } } } cout << "No" << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> c; map<int, int> mp; for (int i = 0; i < n; i++) { int a; cin >> a; if (mp[a] == 0) { c.push_back(a); } mp[a]++; } sort(c.begin(), c.end()); if (c.size() == 1) { if (c[0] == 0) { cout << "Yes" << endl; return 0; } } if (n % 3 != 0) { cout << "No" << endl; return 0; } if (c.size() == 2) { if (c[0] == 0 && mp[c[0]] * 2 == mp[c[1]]) { cout << "Yes" << endl; return 0; } } if (c.size() == 3) { if (mp[c[0]] == mp[c[1]] && mp[c[1]] == mp[c[2]]) { int t = c[0] ^ c[1]; if (t == c[2]) { cout << "Yes" << endl; return 0; } } } cout << "No" << endl; }
[ "control_flow.branch.if.condition.change", "expression.operation.binary.remove" ]
781,956
781,957
u244626757
cpp
p02975
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double ld; #define pb push_back #define mp make_pair #define ff first #define ss second #define gsort(x) sort(x, x + n, greater<ll>()); #define sync \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define sync2 cout << fixed << setprecision(10) const ll inf = 1e9 + 7; #define pi 3.14159265358979323846 #define REP(i, j, n) for (int i = (int)j; i <= (int)n; i++) #define REPD(i, n, j) for (int i = (int)n; i >= (int)j; i--) #define all(vv) vv.begin(), vv.end() // priority_queue <int, vector<int>, greater<int>> mnheap; int main() { sync; int n; cin >> n; ll x, ans = 0; REP(i, 1, n) { cin >> x; ans ^= x; } if (ans == 0) cout << "YES" << endl; else cout << "NO" << endl; } /* 1 4 2 15 28 10 20 */
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double ld; #define pb push_back #define mp make_pair #define ff first #define ss second #define gsort(x) sort(x, x + n, greater<ll>()); #define sync \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define sync2 cout << fixed << setprecision(10) const ll inf = 1e9 + 7; #define pi 3.14159265358979323846 #define REP(i, j, n) for (int i = (int)j; i <= (int)n; i++) #define REPD(i, n, j) for (int i = (int)n; i >= (int)j; i--) #define all(vv) vv.begin(), vv.end() // priority_queue <int, vector<int>, greater<int>> mnheap; int main() { sync; int n; cin >> n; ll x, ans = 0; REP(i, 1, n) { cin >> x; ans ^= x; } if (ans == 0) cout << "Yes" << endl; else cout << "No" << endl; } /* 1 4 2 15 28 10 20 */
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
781,960
781,961
u808256772
cpp
p02975
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; unordered_map<int, int> mp; int n, a[maxn]; int tot = 0; int cnt[maxn]; int b[maxn]; int main() { scanf("%d", &n); for (int i = 1; i <= n; ++i) { scanf("%d", a + i); if (!mp.count(a[i])) { mp[a[i]] = ++tot; b[tot] = a[i]; } cnt[mp[a[i]]]++; } int ans = b[1] ^ b[2] ^ b[3]; if (mp.size() == 1 && b[1] == 0) printf("Yes\n"); else if (mp.size() == 2) { if (cnt[1] == cnt[2] * 2 && b[1] == 0) { printf("Yes\n"); } else if (cnt[1] * 2 == cnt[2] && b[2] == 0) { printf("Yes\n"); } else printf("No\n"); } else if (mp.size() == 3 && ans == 0 && n % 3 == 0 && cnt[1] == cnt[2] && cnt[2] == cnt[3]) printf("Yes\n"); else printf("No\n"); return 0; }
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; unordered_map<int, int> mp; int n, a[maxn]; int tot = 0; int cnt[maxn]; int b[maxn]; int main() { scanf("%d", &n); for (int i = 1; i <= n; ++i) { scanf("%d", a + i); if (!mp.count(a[i])) { mp[a[i]] = ++tot; b[tot] = a[i]; } cnt[mp[a[i]]]++; } int ans = b[1] ^ b[2] ^ b[3]; if (mp.size() == 1 && b[1] == 0) printf("Yes\n"); else if (mp.size() == 2) { if (cnt[1] == cnt[2] * 2 && b[2] == 0) { printf("Yes\n"); } else if (cnt[1] * 2 == cnt[2] && b[1] == 0) { printf("Yes\n"); } else printf("No\n"); } else if (mp.size() == 3 && ans == 0 && n % 3 == 0 && cnt[1] == cnt[2] && cnt[2] == cnt[3]) printf("Yes\n"); else printf("No\n"); return 0; }
[ "literal.number.change", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change" ]
781,962
781,963
u861136518
cpp
p02975
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; int n, a[maxn]; int main() { scanf("%d", &n); long long ans = 0; for (int i = 1; i <= n; ++i) { scanf("%d", a + i); ans ^= a[i]; } sort(a + 1, a + 1 + n); n = unique(a + 1, a + 1 + n) - a - 1; if (n < 3 || ans) puts("No"); else puts("Yes"); return 0; }
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; int n, a[maxn]; int main() { scanf("%d", &n); long long ans = 0; for (int i = 1; i <= n; ++i) { scanf("%d", a + i); ans ^= a[i]; } sort(a + 1, a + 1 + n); n = unique(a + 1, a + 1 + n) - a - 1; if (ans) puts("No"); else puts("Yes"); return 0; }
[ "expression.operation.binary.remove" ]
781,964
781,965
u861136518
cpp
p02975
#include <algorithm> #include <iomanip> #include <iostream> #include <list> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string> #include <vector> using namespace std; using ll = long long; using vll = vector<long long>; using sll = set<long long>; template <typename T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; } template <typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; } template <typename T> map<T, T> primeFactor(T n) { map<T, T> res; for (T i = 2; i * i <= n; ++i) { while (n % i == 0) { res[i]++; n /= i; } } if (n != 1) res[n] = 1; return res; } template <typename T> bool IsPrimeNumber(T num) { if (num <= 2) return true; else if (num % 2 == 0) return false; double sqrtNum = sqrt(num); for (int i = 3; i <= sqrtNum; i += 2) { if (num % i == 0) { return false; } } return true; } #define in(x) cin >> x #define out(x) cout << x #define outn(x) cout << x << '\n' #define outs(x) cout << x << ' ' #define rep(i, s, e) for (long i = s; i < e; i++) #define repeq(i, s, e) for (long i = s; i <= e; i++) inline vll move(vll p, char d) { if (d == 'U') { p[0]--; } else if (d == 'D') { p[0]++; } else if (d == 'R') { p[1]++; } else if (d == 'L') { p[1]--; } return p; } int main() { ll n; ll a; map<ll, ll> m; vll tmp(3); in(n); rep(i, 0, n) { in(a); m[a]++; } if (m.size() == 1) { if (m.begin()->first == 0) { outn("Yes"); return 0; } } if (n % 3 != 0) { outn("No"); return 0; } if (m.size() == 2) { if (m[0] == n / 3) { outn("Yes"); return 0; } } else if (m.size() == 3) { a = 0; for (auto itr = m.begin(); itr != m.end(); itr++) { if (itr->second == n / 3) { tmp[a] = itr->first; a++; } else { outn("No"); return 0; } } if (tmp[0] ^ tmp[1] ^ tmp[2] == 0) { outn("Yes"); return 0; } } outn("No"); return 0; }
#include <algorithm> #include <iomanip> #include <iostream> #include <list> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string> #include <vector> using namespace std; using ll = long long; using vll = vector<long long>; using sll = set<long long>; template <typename T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; } template <typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; } template <typename T> map<T, T> primeFactor(T n) { map<T, T> res; for (T i = 2; i * i <= n; ++i) { while (n % i == 0) { res[i]++; n /= i; } } if (n != 1) res[n] = 1; return res; } template <typename T> bool IsPrimeNumber(T num) { if (num <= 2) return true; else if (num % 2 == 0) return false; double sqrtNum = sqrt(num); for (int i = 3; i <= sqrtNum; i += 2) { if (num % i == 0) { return false; } } return true; } #define in(x) cin >> x #define out(x) cout << x #define outn(x) cout << x << '\n' #define outs(x) cout << x << ' ' #define rep(i, s, e) for (long i = s; i < e; i++) #define repeq(i, s, e) for (long i = s; i <= e; i++) inline vll move(vll p, char d) { if (d == 'U') { p[0]--; } else if (d == 'D') { p[0]++; } else if (d == 'R') { p[1]++; } else if (d == 'L') { p[1]--; } return p; } int main() { ll n; ll a; map<ll, ll> m; vll tmp(3); in(n); rep(i, 0, n) { in(a); m[a]++; } if (m.size() == 1) { if (m.begin()->first == 0) { outn("Yes"); return 0; } } if (n % 3 != 0) { outn("No"); return 0; } if (m.size() == 2) { if (m[0] == n / 3) { outn("Yes"); return 0; } } else if (m.size() == 3) { a = 0; for (auto itr = m.begin(); itr != m.end(); itr++) { if (itr->second == n / 3) { tmp[a] = itr->first; a++; } else { outn("No"); return 0; } } if ((tmp[0] ^ tmp[1] ^ tmp[2]) == 0) { outn("Yes"); return 0; } } outn("No"); return 0; }
[ "control_flow.branch.if.condition.change" ]
781,968
781,969
u757628628
cpp
p02975
#include "bits/stdc++.h" #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; using ll = long long; const ll MOD = 998244353; int main() { int N, A; cin >> N; map<int, int> mp; rep(i, N) { cin >> A; auto itr = mp.find(A); if (itr != mp.end()) mp[A]++; else mp[A] = 1; } if (mp.find(0) != mp.end() && mp[0] == N) { cout << "Yes" << endl; return 0; } if (N % 3 != 0) { cout << "No" << endl; return 0; } if (mp.size() == 2 && mp.find(0) != mp.end() && mp[0] == N / 3) { cout << "Yes" << endl; return 0; } if (mp.size() != 3) { cout << "No" << endl; return 0; } vector<int> b(0), c(0); for (auto itr = mp.begin(); itr != mp.end(); ++itr) { b.push_back(itr->first); c.push_back(itr->second); } if (b[0] ^ b[1] != b[2]) { cout << "No" << endl; return 0; } if (c[0] == c[1] && c[1] == c[2]) { cout << "Yes" << endl; } else { cout << "No" << endl; } }
#include "bits/stdc++.h" #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; using ll = long long; const ll MOD = 998244353; int main() { int N, A; cin >> N; map<int, int> mp; rep(i, N) { cin >> A; auto itr = mp.find(A); if (itr != mp.end()) mp[A]++; else mp[A] = 1; } if (mp.find(0) != mp.end() && mp[0] == N) { cout << "Yes" << endl; return 0; } if (N % 3 != 0) { cout << "No" << endl; return 0; } if (mp.size() == 2 && mp.find(0) != mp.end() && mp[0] == N / 3) { cout << "Yes" << endl; return 0; } if (mp.size() != 3) { cout << "No" << endl; return 0; } vector<int> b(0), c(0); for (auto itr = mp.begin(); itr != mp.end(); ++itr) { b.push_back(itr->first); c.push_back(itr->second); } if ((b[0] ^ b[1]) != b[2]) { cout << "No" << endl; return 0; } if (c[0] == c[1] && c[1] == c[2]) { cout << "Yes" << endl; } else { cout << "No" << endl; } }
[ "control_flow.branch.if.condition.change" ]
781,975
781,976
u555962250
cpp
p02975
#include <algorithm> #include <bitset> #include <cstdio> #include <cstdlib> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <vector> using namespace std; #define INF 11000000000 #define MOD 1000000007 typedef long long ll; typedef pair<ll, ll> P; int main() { int N, count[3]; ll temp; cin >> N; set<ll> S; map<ll, int> M; for (int i = 0; i < N; i++) { cin >> temp; S.insert(temp); if (M.find(temp) == M.end()) M[temp] = 1; else M[temp]++; } // cout<<"Yes"<<endl; return 0; if (S.size() == 1 && temp == 0) cout << "Yes" << endl; else if (M.find(0) != M.end() && M[0] == (N / 3) && N % 3 == 0 && S.size() == 2) cout << "Yes" << endl; else if (S.size() != 3) cout << "No" << endl; else { set<ll>::iterator it = S.begin(); map<ll, int>::iterator mt = M.begin(); int i = 0; for (; mt != M.end(); mt++) { count[i] = mt->second; i++; } // cout<<count[0]<<endl; cout<<count[1]<<endl; cout<<count[2]<<endl; ll a = *it; it++; ll b = *it; it++; ll c = *it; // cout<<a<<endl; cout<<b<<endl; cout<<c<<endl; // a=a^b; // cout<<a<<endl; if (a == c && N % 3 == 0 && count[0] == N / 3 && count[1] == N / 3 && count[2] == N / 3) cout << "Yes" << endl; else cout << "No" << endl; } }
#include <algorithm> #include <bitset> #include <cstdio> #include <cstdlib> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <vector> using namespace std; #define INF 11000000000 #define MOD 1000000007 typedef long long ll; typedef pair<ll, ll> P; int main() { int N, count[3]; ll temp; cin >> N; set<ll> S; map<ll, int> M; for (int i = 0; i < N; i++) { cin >> temp; S.insert(temp); if (M.find(temp) == M.end()) M[temp] = 1; else M[temp]++; } // cout<<"Yes"<<endl; return 0; if (S.size() == 1 && temp == 0) cout << "Yes" << endl; else if (M.find(0) != M.end() && M[0] == (N / 3) && N % 3 == 0 && S.size() == 2) cout << "Yes" << endl; else if (S.size() != 3) cout << "No" << endl; else { set<ll>::iterator it = S.begin(); map<ll, int>::iterator mt = M.begin(); int i = 0; for (; mt != M.end(); mt++) { count[i] = mt->second; i++; } // cout<<count[0]<<endl; cout<<count[1]<<endl; cout<<count[2]<<endl; ll a = *it; it++; ll b = *it; it++; ll c = *it; // cout<<a<<endl; cout<<b<<endl; cout<<c<<endl; a = a ^ b; // cout<<a<<endl; if (a == c && N % 3 == 0 && count[0] == N / 3 && count[1] == N / 3 && count[2] == N / 3) cout << "Yes" << endl; else cout << "No" << endl; } }
[ "assignment.add" ]
781,977
781,978
u591914971
cpp
p02975
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MOD = 1e9 + 7; const int INF = 1e9; int main() { int n; cin >> n; map<int, int> mp; for (int i = 0; i < n; i++) { int a; cin >> a; mp[a]++; } bool ans = true; if (mp.size() == 3) { for (auto p : mp) { if (p.second * 3 != n) { ans = false; } } int a = mp.begin()->first; int b = next(mp.begin())->first; int c = next(mp.begin(), 2)->first; if ((a ^ b) != c) { ans = false; } } else if (mp.size() == 2) { int a = mp.begin()->second; int b = next(mp.begin())->second; int c = mp.begin()->first; int d = next(mp.begin())->first; if ((a + a != b || d != 0) && (a != b + b || c != 0)) { ans = false; } } else if (mp.size() == 1) { int a = mp.begin()->first; if (a != 0) { ans = false; } } else { ans = false; } if (ans) cout << "Yes" << endl; else cout << "No" << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MOD = 1e9 + 7; const int INF = 1e9; int main() { int n; cin >> n; map<int, int> mp; for (int i = 0; i < n; i++) { int a; cin >> a; mp[a]++; } bool ans = true; if (mp.size() == 3) { for (auto p : mp) { if (p.second * 3 != n) { ans = false; } } int a = mp.begin()->first; int b = next(mp.begin())->first; int c = next(mp.begin(), 2)->first; if ((a ^ b) != c) { ans = false; } } else if (mp.size() == 2) { int a = mp.begin()->second; int b = next(mp.begin())->second; int c = mp.begin()->first; int d = next(mp.begin())->first; if ((a + a != b || c != 0) && (a != b + b || d != 0)) { ans = false; } } else if (mp.size() == 1) { int a = mp.begin()->first; if (a != 0) { ans = false; } } else { ans = false; } if (ans) cout << "Yes" << endl; else cout << "No" << endl; }
[ "identifier.change", "control_flow.branch.if.condition.change" ]
781,995
781,996
u708258059
cpp
p02975
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MOD = 1e9 + 7; const int INF = 1e9; int main() { int n; cin >> n; map<int, int> mp; for (int i = 0; i < n; i++) { int a; cin >> a; mp[a]++; } bool ans = true; if (mp.size() == 3) { for (auto p : mp) { if (p.second * 3 != n) { ans = false; } } int a = mp.begin()->first; int b = next(mp.begin())->first; int c = next(mp.begin(), 2)->first; if (a ^ b != c) { ans = false; } } else if (mp.size() == 2) { int a = mp.begin()->second; int b = next(mp.begin())->second; int c = mp.begin()->first; int d = next(mp.begin())->first; if ((a + a != b || d != 0) && (a != b + b || c != 0)) { ans = false; } } else if (mp.size() == 1) { int a = mp.begin()->first; if (a != 0) { ans = false; } } else { ans = false; } if (ans) cout << "Yes" << endl; else cout << "No" << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MOD = 1e9 + 7; const int INF = 1e9; int main() { int n; cin >> n; map<int, int> mp; for (int i = 0; i < n; i++) { int a; cin >> a; mp[a]++; } bool ans = true; if (mp.size() == 3) { for (auto p : mp) { if (p.second * 3 != n) { ans = false; } } int a = mp.begin()->first; int b = next(mp.begin())->first; int c = next(mp.begin(), 2)->first; if ((a ^ b) != c) { ans = false; } } else if (mp.size() == 2) { int a = mp.begin()->second; int b = next(mp.begin())->second; int c = mp.begin()->first; int d = next(mp.begin())->first; if ((a + a != b || c != 0) && (a != b + b || d != 0)) { ans = false; } } else if (mp.size() == 1) { int a = mp.begin()->first; if (a != 0) { ans = false; } } else { ans = false; } if (ans) cout << "Yes" << endl; else cout << "No" << endl; }
[ "control_flow.branch.if.condition.change", "identifier.change" ]
781,997
781,996
u708258059
cpp
p02975
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MOD = 1e9 + 7; const int INF = 1e9; int main() { int n; cin >> n; map<int, int> mp; for (int i = 0; i < n; i++) { int a; cin >> a; mp[a]++; } bool ans = true; if (mp.size() == 3) { for (auto p : mp) { if (p.second * 3 != n) { ans = false; } } int a = mp.begin()->first; int b = next(mp.begin())->first; int c = next(mp.begin(), 2)->first; if ((a ^ b ^ c) != 0) { ans = false; } } else if (mp.size() == 2) { int a = mp.begin()->second; int b = next(mp.begin())->second; int c = mp.begin()->first; int d = next(mp.begin())->first; if ((a + a != b || d != 0) && (a != b + b || c != 0)) { ans = false; } } else if (mp.size() == 1) { int a = mp.begin()->first; if (a != 0) { ans = false; } } else { ans = false; } if (ans) cout << "Yes" << endl; else cout << "No" << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MOD = 1e9 + 7; const int INF = 1e9; int main() { int n; cin >> n; map<int, int> mp; for (int i = 0; i < n; i++) { int a; cin >> a; mp[a]++; } bool ans = true; if (mp.size() == 3) { for (auto p : mp) { if (p.second * 3 != n) { ans = false; } } int a = mp.begin()->first; int b = next(mp.begin())->first; int c = next(mp.begin(), 2)->first; if ((a ^ b) != c) { ans = false; } } else if (mp.size() == 2) { int a = mp.begin()->second; int b = next(mp.begin())->second; int c = mp.begin()->first; int d = next(mp.begin())->first; if ((a + a != b || c != 0) && (a != b + b || d != 0)) { ans = false; } } else if (mp.size() == 1) { int a = mp.begin()->first; if (a != 0) { ans = false; } } else { ans = false; } if (ans) cout << "Yes" << endl; else cout << "No" << endl; }
[ "expression.operation.binary.remove", "identifier.replace.add", "literal.replace.remove", "control_flow.branch.if.condition.change", "identifier.change" ]
781,998
781,996
u708258059
cpp
p02975
#include <algorithm> #include <bitset> #include <cmath> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < n; ++i) #define rep_down(i, n) for (int i = n - 1; i >= 0; --i) #define ALL(a) (a).begin(), (a).end() typedef long long ll; using namespace std; const ll MOD = 1000000007LL; const int INF = 1000000007; int N; map<int, int> Mp; // unordered_mapとは異なり、昇順で保存される。 int main() { cin.sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> N; int a; vector<int> vec; rep(i, N) { cin >> a; if (Mp[a] == 0) vec.push_back(a); Mp[a] += 1; } if (vec.size() > 3) { cout << "No" << "\n"; return 0; } if (vec.size() == 1) { if (vec[0] == 0) cout << "Yes" << "\n"; else cout << "No" << "\n"; return 0; } if (N % 3 != 0) { cout << "No" << "\n"; return 0; } if (vec.size() == 2) { int a = vec[0]; int b = vec[1]; if (a != 0 && b != 0) { cout << "No" << "\n"; return 0; } if (Mp[0] == 2 * N / 3) cout << "Yes" << "\n"; else cout << "No" << "\n"; return 0; } for (auto it = Mp.begin(); it != Mp.end(); ++it) { int cnt = it->second; if (cnt != N / 3) { cout << "No" << "\n"; return 0; } } if ((vec[0] ^ vec[1] ^ vec[2]) == 0) cout << "Yes" << "\n"; else cout << "No" << "\n"; return 0; }
#include <algorithm> #include <bitset> #include <cmath> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < n; ++i) #define rep_down(i, n) for (int i = n - 1; i >= 0; --i) #define ALL(a) (a).begin(), (a).end() typedef long long ll; using namespace std; const ll MOD = 1000000007LL; const int INF = 1000000007; int N; map<int, int> Mp; // unordered_mapとは異なり、昇順で保存される。 int main() { cin.sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> N; int a; vector<int> vec; rep(i, N) { cin >> a; if (Mp[a] == 0) vec.push_back(a); Mp[a] += 1; } if (vec.size() > 3) { cout << "No" << "\n"; return 0; } if (vec.size() == 1) { if (vec[0] == 0) cout << "Yes" << "\n"; else cout << "No" << "\n"; return 0; } if (N % 3 != 0) { cout << "No" << "\n"; return 0; } if (vec.size() == 2) { int a = vec[0]; int b = vec[1]; if (a != 0 && b != 0) { cout << "No" << "\n"; return 0; } if (Mp[0] == N / 3) cout << "Yes" << "\n"; else cout << "No" << "\n"; return 0; } for (auto it = Mp.begin(); it != Mp.end(); ++it) { int cnt = it->second; if (cnt != N / 3) { cout << "No" << "\n"; return 0; } } if ((vec[0] ^ vec[1] ^ vec[2]) == 0) cout << "Yes" << "\n"; else cout << "No" << "\n"; return 0; }
[ "expression.operation.binary.remove" ]
781,999
782,000
u288087195
cpp
p02975
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <string> #include <vector> #define maxs(x, y) x = max(x, y) #define mins(x, y) x = min(x, y) #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define repr(i, n) for (int i = (n)-1; i >= 0; i--) #define FOR(i, i0, n) for (int(i) = (i0); (i) < (n); (i)++) #define FORR(i, i0, n) for (int(i) = (n)-1; (i) >= (i0); (i)--) #define rn return #define fi first #define se second typedef std::pair<int, int> P; using namespace std; using ll = long long; int main() { int N; cin >> N; vector<int> a(N); map<int, int> cnt; rep(i, N) { cin >> a[i]; cnt[a[i]]++; } if (cnt[0] == N) { cout << "Yes"; rn 0; } if (N % 3 != 0) { cout << "No"; rn 0; } vector<int> all; for (auto &e : cnt) { rep(i, e.second / (N / 3)) all.push_back(e.first); } if (all.size() == 3 && (all[0] ^ all[1] ^ all[2] == 0)) { cout << "Yes"; } else { cout << "No"; } rn 0; }
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <string> #include <vector> #define maxs(x, y) x = max(x, y) #define mins(x, y) x = min(x, y) #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define repr(i, n) for (int i = (n)-1; i >= 0; i--) #define FOR(i, i0, n) for (int(i) = (i0); (i) < (n); (i)++) #define FORR(i, i0, n) for (int(i) = (n)-1; (i) >= (i0); (i)--) #define rn return #define fi first #define se second typedef std::pair<int, int> P; using namespace std; using ll = long long; int main() { int N; cin >> N; vector<int> a(N); map<int, int> cnt; rep(i, N) { cin >> a[i]; cnt[a[i]]++; } if (cnt[0] == N) { cout << "Yes"; rn 0; } if (N % 3 != 0) { cout << "No"; rn 0; } vector<int> all; for (auto &e : cnt) { rep(i, e.second / (N / 3)) all.emplace_back(e.first); } if (all.size() == 3 && (all[0] ^ all[1] ^ all[2]) == 0) { cout << "Yes"; } else { cout << "No"; } rn 0; }
[ "call.function.change", "control_flow.branch.if.condition.change" ]
782,005
782,006
u358748139
cpp
p02975
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <string> #include <vector> #define maxs(x, y) x = max(x, y) #define mins(x, y) x = min(x, y) #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define repr(i, n) for (int i = (n)-1; i >= 0; i--) #define FOR(i, i0, n) for (int(i) = (i0); (i) < (n); (i)++) #define FORR(i, i0, n) for (int(i) = (n)-1; (i) >= (i0); (i)--) #define rn return #define fi first #define se second typedef std::pair<int, int> P; using namespace std; using ll = long long; int main() { int N; cin >> N; vector<int> a(N); map<int, int> cnt; rep(i, N) { cin >> a[i]; cnt[a[i]]++; } if (cnt[0] == N) { cout << "Yes"; rn 0; } if (N % 3 != 0) { cout << "No"; rn 0; } vector<int> all; for (auto &e : cnt) { rep(i, e.second / (N / 3)) all.emplace_back(e.first); } if (all.size() == 3 && (all[0] ^ all[1] ^ all[2] == 0)) { cout << "Yes"; } else { cout << "No"; } rn 0; }
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <string> #include <vector> #define maxs(x, y) x = max(x, y) #define mins(x, y) x = min(x, y) #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define repr(i, n) for (int i = (n)-1; i >= 0; i--) #define FOR(i, i0, n) for (int(i) = (i0); (i) < (n); (i)++) #define FORR(i, i0, n) for (int(i) = (n)-1; (i) >= (i0); (i)--) #define rn return #define fi first #define se second typedef std::pair<int, int> P; using namespace std; using ll = long long; int main() { int N; cin >> N; vector<int> a(N); map<int, int> cnt; rep(i, N) { cin >> a[i]; cnt[a[i]]++; } if (cnt[0] == N) { cout << "Yes"; rn 0; } if (N % 3 != 0) { cout << "No"; rn 0; } vector<int> all; for (auto &e : cnt) { rep(i, e.second / (N / 3)) all.emplace_back(e.first); } if (all.size() == 3 && (all[0] ^ all[1] ^ all[2]) == 0) { cout << "Yes"; } else { cout << "No"; } rn 0; }
[ "control_flow.branch.if.condition.change" ]
782,007
782,006
u358748139
cpp
p02975
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<int> xs(n); for (int &x : xs) { cin >> x; } if (n % 3 != 0) { for (int x : xs) { if (x != 0) { cout << "No" << endl; return 0; } } cout << "Yes" << endl; return 0; } sort(xs.begin(), xs.end()); for (int j = 0; j < 3; ++j) { if (xs[j * n / 3] != xs[(j + 1) * n / 3 - 1]) { cout << "No" << endl; return 0; } } if (xs[0] ^ xs[n / 3] ^ xs[2 * n / 3] == 0) { cout << "Yes" << endl; } else { cout << "No" << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<int> xs(n); for (int &x : xs) { cin >> x; } if (n % 3 != 0) { for (int x : xs) { if (x != 0) { cout << "No" << endl; return 0; } } cout << "Yes" << endl; return 0; } sort(xs.begin(), xs.end()); for (int j = 0; j < 3; ++j) { if (xs[j * n / 3] != xs[(j + 1) * n / 3 - 1]) { cout << "No" << endl; return 0; } } if ((xs[0] ^ xs[n / 3] ^ xs[2 * n / 3]) == 0) { cout << "Yes" << endl; } else { cout << "No" << endl; } return 0; }
[ "control_flow.branch.if.condition.change" ]
782,008
782,009
u813181182
cpp
p02975
#include <bits/stdc++.h> using namespace std; #define int long long #define rep(i, n) for (int i = 0; i < (n); i++) #define pb push_back #define all(v) (v).begin(), (v).end() #define fi first #define se second typedef vector<int> vint; typedef pair<int, int> pint; typedef vector<pint> vpint; template <typename A, typename B> inline void chmin(A &a, B b) { if (a > b) a = b; } template <typename A, typename B> inline void chmax(A &a, B b) { if (a < b) a = b; } signed main() { int N; cin >> N; map<int, int> m; rep(i, N) { int a; cin >> a; m[a]++; } if (N % 3) { if (m[0] == N) { cout << "Yes" << endl; } else { cout << "No" << endl; } } else { bool ok = true; int x = 0; N /= 3; for (auto p : m) { if (p.se % N) ok = false; rep(i, p.se / N + 1) x ^= p.fi; } if (x) ok = false; if (ok) cout << "Yes" << endl; else cout << "No" << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; #define int long long #define rep(i, n) for (int i = 0; i < (n); i++) #define pb push_back #define all(v) (v).begin(), (v).end() #define fi first #define se second typedef vector<int> vint; typedef pair<int, int> pint; typedef vector<pint> vpint; template <typename A, typename B> inline void chmin(A &a, B b) { if (a > b) a = b; } template <typename A, typename B> inline void chmax(A &a, B b) { if (a < b) a = b; } signed main() { int N; cin >> N; map<int, int> m; rep(i, N) { int a; cin >> a; m[a]++; } if (N % 3) { if (m[0] == N) { cout << "Yes" << endl; } else { cout << "No" << endl; } } else { bool ok = true; int x = 0; N /= 3; for (auto p : m) { if (p.se % N) ok = false; rep(i, p.se / N) x ^= p.fi; } if (x) ok = false; if (ok) cout << "Yes" << endl; else cout << "No" << endl; } return 0; }
[ "expression.operation.binary.remove" ]
782,010
782,011
u685892567
cpp
p02975
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, j, n) for (ll i = j; i < n; i++) #define all(x) (x).begin(), (x).end() #define INF (LLONG_MAX) #define MOD (1000000007) #define MAX (100000) #define pii pair<int, int> ///////////////////////////////////////////////////////// class XY { public: ll x, y; XY() { x = y = 0; } XY(ll u, ll v) { x = u; y = v; } }; template <typename T1, typename T2> void chmin(T1 &a, T2 b) { if (a > b) a = b; } template <typename T1, typename T2> void chmax(T1 &a, T2 b) { if (a < b) a = b; } template <typename T1, typename T2> T1 mypow(T1 a, T2 n) { if (n == 0) return 1; if (n == 1) return a; if (n % 2) return a * mypow(a, n - 1); T1 tmp = mypow(a, n / 2); return tmp * tmp; } template <typename T> int BS(vector<T> V, int left, int right, T key) { int mid = (left + right) / 2; if (V[mid] <= key) left = mid; else right = mid; if (right - mid == 1) return left; else return BS(V, left, right, key); } ///////////////////////////////////////////////////////// void Main() { ll N; cin >> N; vector<ll> A(N); rep(i, 0, N) cin >> A[i]; map<ll, ll> mp; vector<ll> v; rep(i, 0, N) { if (mp.find(A[i]) == mp.end()) { mp[A[i]] = 1; v.push_back(A[i]); } else { mp[A[i]]++; } } string res = "No"; if (v.size() == 1) { if (v[0] == 0) res = "Yes"; } else if (v.size() == 2) { if (v[1] == 0 && mp[v[0]] == 2 * mp[v[1]]) res = "Yes"; if (v[0] == 0 && mp[v[1]] == 2 * mp[v[0]]) res = "Yes"; } else if (v.size() == 3) { if (v[0] ^ v[1] == v[2] && mp[v[0]] == mp[v[1]] && mp[v[0]] == mp[v[2]]) res = "Yes"; } cout << res << endl; } ///////////////////////////////////////////////////////// int main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); cout << std::fixed << std::setprecision(15); Main(); }
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, j, n) for (ll i = j; i < n; i++) #define all(x) (x).begin(), (x).end() #define INF (LLONG_MAX) #define MOD (1000000007) #define MAX (100000) #define pii pair<int, int> ///////////////////////////////////////////////////////// class XY { public: ll x, y; XY() { x = y = 0; } XY(ll u, ll v) { x = u; y = v; } }; template <typename T1, typename T2> void chmin(T1 &a, T2 b) { if (a > b) a = b; } template <typename T1, typename T2> void chmax(T1 &a, T2 b) { if (a < b) a = b; } template <typename T1, typename T2> T1 mypow(T1 a, T2 n) { if (n == 0) return 1; if (n == 1) return a; if (n % 2) return a * mypow(a, n - 1); T1 tmp = mypow(a, n / 2); return tmp * tmp; } template <typename T> int BS(vector<T> V, int left, int right, T key) { int mid = (left + right) / 2; if (V[mid] <= key) left = mid; else right = mid; if (right - mid == 1) return left; else return BS(V, left, right, key); } ///////////////////////////////////////////////////////// void Main() { ll N; cin >> N; vector<ll> A(N); rep(i, 0, N) cin >> A[i]; map<ll, ll> mp; vector<ll> v; rep(i, 0, N) { if (mp.find(A[i]) == mp.end()) { mp[A[i]] = 1; v.push_back(A[i]); } else { mp[A[i]]++; } } string res = "No"; if (v.size() == 1) { if (v[0] == 0) res = "Yes"; } else if (v.size() == 2) { if (v[1] == 0 && mp[v[0]] == 2 * mp[v[1]]) res = "Yes"; if (v[0] == 0 && mp[v[1]] == 2 * mp[v[0]]) res = "Yes"; } else if (v.size() == 3) { if ((v[0] ^ v[1]) == v[2] && mp[v[0]] == mp[v[1]] && mp[v[0]] == mp[v[2]]) res = "Yes"; } cout << res << endl; } ///////////////////////////////////////////////////////// int main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); cout << std::fixed << std::setprecision(15); Main(); }
[ "control_flow.branch.if.condition.change" ]
782,021
782,022
u855985627
cpp
p02975
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <vector> using namespace std; const int MOD = 1000000007; struct Edge { int to; int weight; Edge(int t, int w) : to(t), weight(w) {} }; int main() { int N; cin >> N; map<int, int> mp; for (int i = 0; i < N; ++i) { int a; cin >> a; mp[a]++; } if (mp[0] == N) { cout << "Yes" << endl; return 0; } if (N % 3 != 0) { cout << "No" << endl; return 0; } vector<int> all; for (auto &p : mp) { for (int i = 0; i < p.second / (N / 3); ++i) { all.emplace_back(p.first); } } if (all.size() == 3 && (all[0] ^ all[1] ^ all[2] == 0)) { cout << "Yes" << endl; } else { cout << "No" << endl; } return 0; }
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <vector> using namespace std; const int MOD = 1000000007; struct Edge { int to; int weight; Edge(int t, int w) : to(t), weight(w) {} }; int main() { int N; cin >> N; map<int, int> mp; for (int i = 0; i < N; ++i) { int a; cin >> a; mp[a]++; } if (mp[0] == N) { cout << "Yes" << endl; return 0; } if (N % 3 != 0) { cout << "No" << endl; return 0; } vector<int> all; for (auto &p : mp) { for (int i = 0; i < p.second / (N / 3); ++i) { all.emplace_back(p.first); } } if (all.size() == 3 && (all[0] ^ all[1] ^ all[2]) == 0) { cout << "Yes" << endl; } else { cout << "No" << endl; } return 0; }
[ "control_flow.branch.if.condition.change" ]
782,030
782,031
u095756391
cpp
p02975
#include <algorithm> #include <iostream> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) #define loop(i, a, b) for (int i = a; i < (b); ++i) #define in(v) cin >> v; #define out(v) cout << v << "\n" int main() { cin.tie(0); ios::sync_with_stdio(false); int N; in(N); int A[N]; bool is_zero = true; rep(i, N) { in(A[i]); if (A[i] != 0) is_zero = false; } if (is_zero) out("Yes"); else if (N % 3 != 0) out("No"); else { sort(A, A + N); rep(k, 3) { rep(i, N / 3) { if (A[i + N / 3 * k] != A[N / 3 * k]) { out("No"); return 0; } } } int x = A[0], y = A[N / 3], z = A[N / 3 * 2]; if (x ^ y ^ z == 0) out("Yes"); else out("No"); } return 0; }
#include <algorithm> #include <iostream> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) #define loop(i, a, b) for (int i = a; i < (b); ++i) #define in(v) cin >> v; #define out(v) cout << v << "\n" int main() { cin.tie(0); ios::sync_with_stdio(false); int N; in(N); int A[N]; bool is_zero = true; rep(i, N) { in(A[i]); if (A[i] != 0) is_zero = false; } if (is_zero) out("Yes"); else if (N % 3 != 0) out("No"); else { sort(A, A + N); rep(k, 3) { rep(i, N / 3) { if (A[N / 3 * k] != A[N / 3 * k + i]) { out("No"); return 0; } } } int x = A[0], y = A[N / 3], z = A[N / 3 * 2]; if ((x ^ y ^ z) == 0) out("Yes"); else out("No"); } return 0; }
[ "expression.operation.binary.remove", "control_flow.branch.if.condition.change" ]
782,032
782,033
u025592199
cpp
p02975
#include <bits/stdc++.h> using namespace std; const int INF = 1000000007; int main() { int N; cin >> N; int A[N]; for (int i = 0; i < N; i++) cin >> A[i]; sort(A, A + N); if (A[0] == 0 && A[N - 1] == 0) { cout << "Yes" << endl; return 0; } if (N % 3 != 0) { cout << "No" << endl; return 0; } if (A[0] == A[N / 3 - 1] && A[N / 3] == A[2 * N / 3 - 1] && A[2 * N / 3] == A[N - 1]) { if (A[0] ^ A[N / 3] ^ A[2 * N / 3] == 0) { cout << "Yes" << endl; return 0; } } cout << "No" << endl; }
#include <bits/stdc++.h> using namespace std; const int INF = 1000000007; int main() { int N; cin >> N; int A[N]; for (int i = 0; i < N; i++) cin >> A[i]; sort(A, A + N); if (A[0] == 0 && A[N - 1] == 0) { cout << "Yes" << endl; return 0; } if (N % 3 != 0) { cout << "No" << endl; return 0; } if (A[0] == A[N / 3 - 1] && A[N / 3] == A[2 * N / 3 - 1] && A[2 * N / 3] == A[N - 1]) { if ((A[0] ^ A[N / 3] ^ A[2 * N / 3]) == 0) { cout << "Yes" << endl; return 0; } } cout << "No" << endl; }
[ "control_flow.branch.if.condition.change" ]
782,034
782,035
u415916075
cpp
p02975
#include <bits/stdc++.h> #pragma GCC optimize("O3") using namespace std; #ifdef _debug #define out(i) cout << #i << ' ' << i #else #define out(i) #endif using ll = long long; using ull = unsigned long long; using ul = unsigned; using db = double; #define int ul const int maxn = 200001; int n; int a[maxn]; map<int, int> cnt; bool valid() { if (cnt.count(0) and cnt.size() == 1) return true; if (cnt.size() > 3 || n % 3) return false; if (cnt.count(0)) { if (cnt.size() != 2) return false; return cnt[0] == n / 3 * 2 and cnt.rbegin()->second == n / 3; } else { vector<int> v; for (auto &i : cnt) if (i.second != n / 3) return false; else v.push_back(i.first); return ((v[0] ^ v[1]) == v[2]) || ((v[1] ^ v[2]) == v[0]) || ((v[0] ^ v[2]) == v[1]); } } signed main() { ios_base::sync_with_stdio(0), cin.tie(0); cin >> n; for (int i = 0; i < n; ++i) cin >> a[i]; for (int i = 0; i < n; ++i) ++cnt[a[i]]; if (valid()) cout << "Yes\n"; else cout << "No\n"; }
#include <bits/stdc++.h> #pragma GCC optimize("O3") using namespace std; #ifdef _debug #define out(i) cout << #i << ' ' << i #else #define out(i) #endif using ll = long long; using ull = unsigned long long; using ul = unsigned; using db = double; #define int ul const int maxn = 200001; int n; int a[maxn]; map<int, int> cnt; bool valid() { if (cnt.count(0) and cnt.size() == 1) return true; if (cnt.size() > 3 || n % 3) return false; if (cnt.count(0)) { if (cnt.size() != 2) return false; return cnt[0] == n / 3 and cnt.rbegin()->second == n / 3 * 2; } else { vector<int> v; for (auto &i : cnt) if (i.second != n / 3) return false; else v.push_back(i.first); return ((v[0] ^ v[1]) == v[2]) || ((v[1] ^ v[2]) == v[0]) || ((v[0] ^ v[2]) == v[1]); } } signed main() { ios_base::sync_with_stdio(0), cin.tie(0); cin >> n; for (int i = 0; i < n; ++i) cin >> a[i]; for (int i = 0; i < n; ++i) ++cnt[a[i]]; if (valid()) cout << "Yes\n"; else cout << "No\n"; }
[ "expression.operation.binary.remove" ]
782,036
782,037
u233690053
cpp
p02975
#include <bits/stdc++.h> #define int long long #define lint long long #define pii pair<int, int> #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(c) (c).begin(), (c).end() #define ZERO(a) memset(a, 0, sizeof(a)) #define MINUS(a) memset(a, 0xff, sizeof(a)) #define MINF(a) memset(a, 0x3f, sizeof(a)) #define POW(n) (1LL << (n)) #define IN(i, a, b) (a <= i && i <= b) using namespace std; template <typename T> inline bool CHMIN(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } template <typename T> inline bool CHMAX(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <typename T> inline void SORT(T &a) { sort(ALL(a)); } template <typename T> inline void REV(T &a) { reverse(ALL(a)); } template <typename T> inline void UNI(T &a) { sort(ALL(a)); a.erase(unique(ALL(a)), a.end()); } template <typename T> inline T LB(vector<T> &v, T a) { return *lower_bound(ALL(v), a); } template <typename T> inline int LBP(vector<T> &v, T a) { return lower_bound(ALL(v), a) - v.begin(); } template <typename T> inline T UB(vector<T> &v, T a) { return *upper_bound(ALL(v), a); } template <typename T> inline int UBP(vector<T> &v, T a) { return upper_bound(ALL(v), a) - v.begin(); } template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << p.first << " " << p.second; return os; } template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; } template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) { REP(i, v.size()) { if (i) os << " "; os << v[i]; } return os; } template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; } template <typename T = int> vector<T> make_v(size_t a) { return vector<T>(a); } template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...)); } template <typename T, typename V> typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) { t = v; } template <typename T, typename V> typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) { for (auto &e : t) fill_v(e, v); } const lint MOD = 1000000007; const lint INF = 0x3f3f3f3f3f3f3f3f; const double EPS = 1e-10; void yes() { cout << "Yes" << endl; exit(0); } void no() { cout << "No" << endl; exit(0); } signed main() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); int N; cin >> N; vector<int> a(N); cin >> a; map<int, int> mp; REP(i, N) mp[a[i]]++; if (mp[0] == N) yes(); vector<int> b; for (auto p : mp) b.push_back(p.first); SORT(b); if (mp[0] * 3 == N) { if (b.size() == 2) { if (b[1] * 3 == 2 * N) yes(); else no(); } else { no(); } } else if (mp[0] == 0) { if (b.size() == 4 && mp[b[1]] * 3 == N && mp[b[2]] * 3 == N && mp[b[3]] * 3 == N && (b[1] ^ b[2] ^ b[3]) == 0) yes(); else no(); } else { no(); } return 0; }
#include <bits/stdc++.h> #define int long long #define lint long long #define pii pair<int, int> #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(c) (c).begin(), (c).end() #define ZERO(a) memset(a, 0, sizeof(a)) #define MINUS(a) memset(a, 0xff, sizeof(a)) #define MINF(a) memset(a, 0x3f, sizeof(a)) #define POW(n) (1LL << (n)) #define IN(i, a, b) (a <= i && i <= b) using namespace std; template <typename T> inline bool CHMIN(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } template <typename T> inline bool CHMAX(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <typename T> inline void SORT(T &a) { sort(ALL(a)); } template <typename T> inline void REV(T &a) { reverse(ALL(a)); } template <typename T> inline void UNI(T &a) { sort(ALL(a)); a.erase(unique(ALL(a)), a.end()); } template <typename T> inline T LB(vector<T> &v, T a) { return *lower_bound(ALL(v), a); } template <typename T> inline int LBP(vector<T> &v, T a) { return lower_bound(ALL(v), a) - v.begin(); } template <typename T> inline T UB(vector<T> &v, T a) { return *upper_bound(ALL(v), a); } template <typename T> inline int UBP(vector<T> &v, T a) { return upper_bound(ALL(v), a) - v.begin(); } template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << p.first << " " << p.second; return os; } template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; } template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) { REP(i, v.size()) { if (i) os << " "; os << v[i]; } return os; } template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; } template <typename T = int> vector<T> make_v(size_t a) { return vector<T>(a); } template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...)); } template <typename T, typename V> typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) { t = v; } template <typename T, typename V> typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) { for (auto &e : t) fill_v(e, v); } const lint MOD = 1000000007; const lint INF = 0x3f3f3f3f3f3f3f3f; const double EPS = 1e-10; void yes() { cout << "Yes" << endl; exit(0); } void no() { cout << "No" << endl; exit(0); } signed main() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); int N; cin >> N; vector<int> a(N); cin >> a; map<int, int> mp; REP(i, N) mp[a[i]]++; if (mp[0] == N) yes(); vector<int> b; for (auto p : mp) b.push_back(p.first); SORT(b); if (mp[0] * 3 == N) { if (b.size() == 2) { if (mp[b[1]] * 3 == 2 * N) yes(); else no(); } else { no(); } } else if (mp[0] == 0) { if (b.size() == 4 && mp[b[1]] * 3 == N && mp[b[2]] * 3 == N && mp[b[3]] * 3 == N && (b[1] ^ b[2] ^ b[3]) == 0) yes(); else no(); } else { no(); } return 0; }
[ "control_flow.branch.if.condition.change" ]
782,038
782,039
u141642872
cpp
p02975
#include <bits/stdc++.h> using namespace std; map<int, int> m; vector<pair<int, int>> pairs; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { int v; cin >> v; m[v]++; } for (auto it : m) { pairs.emplace_back(it.first, it.second); } if (pairs.size() == 3 && pairs[0].second == pairs[1].second && pairs[1].second == pairs[2].second && (pairs[0].first ^ pairs[1].first == pairs[2].first)) { cout << "Yes" << endl; } else if (pairs.size() == 1 && pairs[0].first == 0) { cout << "Yes" << endl; } else if (pairs.size() == 2 && pairs[0].first == 0 && pairs[1].second == 2 * pairs[0].second) { cout << "Yes" << endl; } else { cout << "No" << endl; } }
#include <bits/stdc++.h> using namespace std; map<int, int> m; vector<pair<int, int>> pairs; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { int v; cin >> v; m[v]++; } for (auto it : m) { pairs.emplace_back(it.first, it.second); } if (pairs.size() == 3 && pairs[0].second == pairs[1].second && pairs[1].second == pairs[2].second && ((pairs[0].first ^ pairs[1].first) == pairs[2].first)) { cout << "Yes" << endl; } else if (pairs.size() == 1 && pairs[0].first == 0) { cout << "Yes" << endl; } else if (pairs.size() == 2 && pairs[0].first == 0 && pairs[1].second == 2 * pairs[0].second) { cout << "Yes" << endl; } else { cout << "No" << endl; } }
[ "control_flow.branch.if.condition.change" ]
782,040
782,041
u087498247
cpp
p02975
#include <algorithm> #include <cstdio> const int MN = 100005; int N, A[MN], B[MN], C[MN], M; int main() { scanf("%d", &N); for (int i = 1; i <= N; ++i) scanf("%d", &A[i]), B[i] = A[i]; std::sort(B + 1, B + N + 1), M = std::unique(B + 1, B + N + 1) - B - 1; if (M > 3) return puts("No"), 0; if (M == 1) return puts(B[1] == 0 ? "Yes" : "No"), 0; if (M == 2 && B[1] != 0) return puts("No"), 0; if (N % 3 != 0) return puts("No"), 0; for (int j = 1; j <= M; ++j) for (int i = 1; i <= N; ++i) if (A[i] == B[j]) ++C[j]; if (M == 2 && (C[1] != N / 3 * 2 || C[2] != N / 3)) return puts("No"), 0; if (M == 3 && (C[1] != N / 3 || C[2] != N / 3 || C[3] != N / 3)) return puts("No"), 0; if (M == 3 && (B[1] ^ B[2] ^ B[3]) != 0) return puts("No"), 0; puts("Yes"); return 0; }
#include <algorithm> #include <cstdio> const int MN = 100005; int N, A[MN], B[MN], C[MN], M; int main() { scanf("%d", &N); for (int i = 1; i <= N; ++i) scanf("%d", &A[i]), B[i] = A[i]; std::sort(B + 1, B + N + 1), M = std::unique(B + 1, B + N + 1) - B - 1; if (M > 3) return puts("No"), 0; if (M == 1) return puts(B[1] == 0 ? "Yes" : "No"), 0; if (M == 2 && B[1] != 0) return puts("No"), 0; if (N % 3 != 0) return puts("No"), 0; for (int j = 1; j <= M; ++j) for (int i = 1; i <= N; ++i) if (A[i] == B[j]) ++C[j]; if (M == 2 && (C[1] != N / 3 || C[2] != N / 3 * 2)) return puts("No"), 0; if (M == 3 && (C[1] != N / 3 || C[2] != N / 3 || C[3] != N / 3)) return puts("No"), 0; if (M == 3 && (B[1] ^ B[2] ^ B[3]) != 0) return puts("No"), 0; puts("Yes"); return 0; }
[ "expression.operation.binary.remove", "control_flow.branch.if.condition.change" ]
782,042
782,043
u095826906
cpp
p02975
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <ctime> #include <deque> #include <fstream> #include <iostream> #include <map> #include <queue> #include <set> #include <vector> using namespace std; #define int long long #define mn 100005 #define inf 4444444444444444444 #define mod 1000000009 #define FLN "test" #define pii pair<int, int> #define XX first #define YY second int n, A[mn]; bool checkAll0() { for (int i = 1; i <= n; i++) if (A[i] != 0) return 0; return 1; } bool checkValid() { int a = A[1], b = A[n / 3 + 1], c = (n / 3 * 2 + 1); for (int i = 1; i <= n / 3; i++) if (A[i] != A[1]) return 0; for (int i = n / 3 + 1; i <= n / 3 * 2; i++) if (A[i] != A[n / 3 + 1]) return 0; for (int i = n / 3 * 2 + 1; i <= n; i++) if (A[i] != A[n / 3 * 2 + 1]) return 0; return 1; } signed main() { #ifdef lowie freopen(FLN ".inp", "r", stdin); freopen(FLN ".out", "w", stdout); #endif ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; for (int i = 1; i <= n; i++) cin >> A[i]; if (n % 3 != 0) { if (checkAll0()) cout << "Yes"; else cout << "No"; } else { sort(A + 1, A + n + 1); int a = A[1], b = A[n / 3 + 1], c = (n / 3 * 2 + 1); if (!checkValid()) { cout << "No"; return 0; } if ((a ^ c) == b) cout << "Yes"; else cout << "No"; } } // PLEASE REMOVE cout AND cerr DEBUG LINES BEFORE SUBMITTING PROBLEMS // Code by low_ // Contact me via mail: dung.totuan01@gmail.com // ...or codeforces: www.codeforces.com/profiles/low_ // ...or if you're interested in food: www.instagram.com/lowie_review/
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <ctime> #include <deque> #include <fstream> #include <iostream> #include <map> #include <queue> #include <set> #include <vector> using namespace std; #define int long long #define mn 100005 #define inf 4444444444444444444 #define mod 1000000009 #define FLN "test" #define pii pair<int, int> #define XX first #define YY second int n, A[mn]; bool checkAll0() { for (int i = 1; i <= n; i++) if (A[i] != 0) return 0; return 1; } bool checkValid() { int a = A[1], b = A[n / 3 + 1], c = (n / 3 * 2 + 1); for (int i = 1; i <= n / 3; i++) if (A[i] != A[1]) return 0; for (int i = n / 3 + 1; i <= n / 3 * 2; i++) if (A[i] != A[n / 3 + 1]) return 0; for (int i = n / 3 * 2 + 1; i <= n; i++) if (A[i] != A[n / 3 * 2 + 1]) return 0; return 1; } signed main() { #ifdef lowie freopen(FLN ".inp", "r", stdin); freopen(FLN ".out", "w", stdout); #endif ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; for (int i = 1; i <= n; i++) cin >> A[i]; if (n % 3 != 0) { if (checkAll0()) cout << "Yes"; else cout << "No"; } else { sort(A + 1, A + n + 1); int a = A[1], b = A[n / 3 + 1], c = A[n / 3 * 2 + 1]; if (!checkValid()) { cout << "No"; return 0; } if ((a ^ c) == b) cout << "Yes"; else cout << "No"; } } // PLEASE REMOVE cout AND cerr DEBUG LINES BEFORE SUBMITTING PROBLEMS // Code by low_ // Contact me via mail: dung.totuan01@gmail.com // ...or codeforces: www.codeforces.com/profiles/low_ // ...or if you're interested in food: www.instagram.com/lowie_review/
[]
782,049
782,050
u624520031
cpp
p02975
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <ctime> #include <deque> #include <fstream> #include <iostream> #include <map> #include <queue> #include <set> #include <vector> using namespace std; #define int long long #define mn 100005 #define inf 4444444444444444444 #define mod 1000000009 #define FLN "test" #define pii pair<int, int> #define XX first #define YY second int n, A[mn]; bool checkAll0() { for (int i = 1; i <= n; i++) if (A[i] != 0) return 0; return 1; } bool checkValid() { int a = A[1], b = A[n / 3 + 1], c = (n / 3 * 2 + 1); for (int i = 1; i <= n / 3; i++) if (A[i] != A[1]) return 0; for (int i = n / 3 + 1; i <= n / 3 * 2; i++) if (A[i] != A[n / 3 + 1]) return 0; for (int i = n / 3 * 2 + 1; i <= n; i++) if (A[i] != A[n / 3 * 2 + 1]) return 0; return 1; } signed main() { #ifdef lowie freopen(FLN ".inp", "r", stdin); freopen(FLN ".out", "w", stdout); #endif ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; for (int i = 1; i <= n; i++) cin >> A[i]; if (n % 3 != 0) { if (checkAll0()) cout << "Yes"; else cout << "No"; } else { sort(A + 1, A + n + 1); int a = A[1], b = A[n / 3 + 1], c = (n / 3 * 2 + 1); if (!checkValid()) { cout << "No"; return 0; } if (a ^ c == b) cout << "Yes"; else cout << "No"; } } // PLEASE REMOVE cout AND cerr DEBUG LINES BEFORE SUBMITTING PROBLEMS // Code by low_ // Contact me via mail: dung.totuan01@gmail.com // ...or codeforces: www.codeforces.com/profiles/low_ // ...or if you're interested in food: www.instagram.com/lowie_review/
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <ctime> #include <deque> #include <fstream> #include <iostream> #include <map> #include <queue> #include <set> #include <vector> using namespace std; #define int long long #define mn 100005 #define inf 4444444444444444444 #define mod 1000000009 #define FLN "test" #define pii pair<int, int> #define XX first #define YY second int n, A[mn]; bool checkAll0() { for (int i = 1; i <= n; i++) if (A[i] != 0) return 0; return 1; } bool checkValid() { int a = A[1], b = A[n / 3 + 1], c = (n / 3 * 2 + 1); for (int i = 1; i <= n / 3; i++) if (A[i] != A[1]) return 0; for (int i = n / 3 + 1; i <= n / 3 * 2; i++) if (A[i] != A[n / 3 + 1]) return 0; for (int i = n / 3 * 2 + 1; i <= n; i++) if (A[i] != A[n / 3 * 2 + 1]) return 0; return 1; } signed main() { #ifdef lowie freopen(FLN ".inp", "r", stdin); freopen(FLN ".out", "w", stdout); #endif ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; for (int i = 1; i <= n; i++) cin >> A[i]; if (n % 3 != 0) { if (checkAll0()) cout << "Yes"; else cout << "No"; } else { sort(A + 1, A + n + 1); int a = A[1], b = A[n / 3 + 1], c = A[n / 3 * 2 + 1]; if (!checkValid()) { cout << "No"; return 0; } if ((a ^ c) == b) cout << "Yes"; else cout << "No"; } } // PLEASE REMOVE cout AND cerr DEBUG LINES BEFORE SUBMITTING PROBLEMS // Code by low_ // Contact me via mail: dung.totuan01@gmail.com // ...or codeforces: www.codeforces.com/profiles/low_ // ...or if you're interested in food: www.instagram.com/lowie_review/
[ "control_flow.branch.if.condition.change" ]
782,051
782,050
u624520031
cpp
p02975
#include <bits/stdc++.h> #define INF 1e9 #define llINF 1e18 #define MOD 1000000007 #define pb push_back #define mp make_pair #define F first #define S second #define ll long long #define ull unsigned long long #define vi vector<ll> #define vvi vector<vi> #define DBG_N(hoge) cerr << " " << (hoge) << endl; #define DBG cerr << "!" << endl; #define BITLE(n) (1LL << ((ll)n)) #define BITCNT(n) (__builtin_popcountll(n)) #define SUBS(s, f, t) ((s).substr((f)-1, (t) - (f) + 1)) #define ALL(a) (a).begin(), (a).end() using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); ll n; cin >> n; vi A(n); map<ll, ll> MP; for (auto &a : A) { cin >> a; MP[a]++; } vi num; vi num2; for (auto a : MP) { num.pb(a.S); num2.pb(a.F); } if (num.size() > 3) { cout << "No" << endl; } else if (num.size() == 3) { if (num[0] == num[1] && num[1] == num[2]) { if ((num2[0] ^ num2[1] ^ num2[2]) == 0) cout << "Yes" << endl; else cout << "No" << endl; } else cout << "No" << endl; } else if (num.size() == 2) { if (num[0] == 2 * num[1]) { if (num2[0] == 0) cout << "Yes" << endl; else cout << "No" << endl; } else if (2 * num[0] == num[1]) { if (num2[1] == 0) cout << "Yes" << endl; else cout << "No" << endl; } else cout << "No" << endl; } else if (num.size() == 1) { if (num2[0] == 0) cout << "Yes" << endl; else cout << "No" << endl; } else cout << "No" << endl; return 0; }
#include <bits/stdc++.h> #define INF 1e9 #define llINF 1e18 #define MOD 1000000007 #define pb push_back #define mp make_pair #define F first #define S second #define ll long long #define ull unsigned long long #define vi vector<ll> #define vvi vector<vi> #define DBG_N(hoge) cerr << " " << (hoge) << endl; #define DBG cerr << "!" << endl; #define BITLE(n) (1LL << ((ll)n)) #define BITCNT(n) (__builtin_popcountll(n)) #define SUBS(s, f, t) ((s).substr((f)-1, (t) - (f) + 1)) #define ALL(a) (a).begin(), (a).end() using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); ll n; cin >> n; vi A(n); map<ll, ll> MP; for (auto &a : A) { cin >> a; MP[a]++; } vi num; vi num2; for (auto a : MP) { num.pb(a.S); num2.pb(a.F); } if (num.size() > 3) { cout << "No" << endl; } else if (num.size() == 3) { if (num[0] == num[1] && num[1] == num[2]) { if ((num2[0] ^ num2[1] ^ num2[2]) == 0) cout << "Yes" << endl; else cout << "No" << endl; } else cout << "No" << endl; } else if (num.size() == 2) { if (num[0] == 2 * num[1]) { if (num2[1] == 0) cout << "Yes" << endl; else cout << "No" << endl; } else if (2 * num[0] == num[1]) { if (num2[0] == 0) cout << "Yes" << endl; else cout << "No" << endl; } else cout << "No" << endl; } else if (num.size() == 1) { if (num2[0] == 0) cout << "Yes" << endl; else cout << "No" << endl; } else cout << "No" << endl; return 0; }
[ "literal.number.change", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change" ]
782,052
782,053
u905715926
cpp