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 <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define dbg(...) \
do { \
cerr << __LINE__ << ": "; \
dbgprint(#__VA_ARGS__, __VA_ARGS__); \
} while (0);
using namespace std;
namespace std {
template <class S, class T> struct hash<pair<S, T>> {
size_t operator()(const pair<S, T> &p) const {
return ((size_t)1e9 + 7) * hash<S>()(p.first) + hash<T>()(p.second);
}
};
template <class T> struct hash<vector<T>> {
size_t operator()(const vector<T> &v) const {
size_t h = 0;
for (auto i : v)
h = h * ((size_t)1e9 + 7) + hash<T>()(i) + 1;
return h;
}
};
} // namespace std
template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
os << "[ ";
rep(i, v.size()) os << v[i] << (i == v.size() - 1 ? " ]" : ", ");
return os;
}
template <class T> ostream &operator<<(ostream &os, const set<T> &v) {
os << "{ ";
for (const auto &i : v)
os << i << ", ";
return os << "}";
}
template <class T, class U>
ostream &operator<<(ostream &os, const map<T, U> &v) {
os << "{";
for (const auto &i : v)
os << " " << i.first << ": " << i.second << ",";
return os << "}";
}
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
return os << "(" << p.first << ", " << p.second << ")";
}
void dbgprint(const string &fmt) { cerr << endl; }
template <class H, class... T>
void dbgprint(const string &fmt, const H &h, const T &...r) {
cerr << fmt.substr(0, fmt.find(",")) << "= " << h << " ";
dbgprint(fmt.substr(fmt.find(",") + 1), r...);
}
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
const int inf = (int)1e9;
const double INF = 1e12, EPS = 1e-9;
int main() {
cin.tie(0);
cin.sync_with_stdio(0);
int n;
cin >> n;
vi a(n);
rep(i, n) cin >> a[i];
map<int, int> cnt;
rep(i, n) cnt[a[i]]++;
auto solve = [&]() {
if (cnt.size() == 1 && a[0] == 0)
return true;
if (n % 3 || cnt.size() > 3)
return false;
vi v;
for (const auto &i : cnt) {
if (i.second % (n / 3))
return false;
rep(j, n / 3) v.pb(i.first);
}
return (v[0] ^ v[1]) == v[2];
};
cout << (solve() ? "Yes" : "No") << endl;
return 0;
} | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define dbg(...) \
do { \
cerr << __LINE__ << ": "; \
dbgprint(#__VA_ARGS__, __VA_ARGS__); \
} while (0);
using namespace std;
namespace std {
template <class S, class T> struct hash<pair<S, T>> {
size_t operator()(const pair<S, T> &p) const {
return ((size_t)1e9 + 7) * hash<S>()(p.first) + hash<T>()(p.second);
}
};
template <class T> struct hash<vector<T>> {
size_t operator()(const vector<T> &v) const {
size_t h = 0;
for (auto i : v)
h = h * ((size_t)1e9 + 7) + hash<T>()(i) + 1;
return h;
}
};
} // namespace std
template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
os << "[ ";
rep(i, v.size()) os << v[i] << (i == v.size() - 1 ? " ]" : ", ");
return os;
}
template <class T> ostream &operator<<(ostream &os, const set<T> &v) {
os << "{ ";
for (const auto &i : v)
os << i << ", ";
return os << "}";
}
template <class T, class U>
ostream &operator<<(ostream &os, const map<T, U> &v) {
os << "{";
for (const auto &i : v)
os << " " << i.first << ": " << i.second << ",";
return os << "}";
}
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
return os << "(" << p.first << ", " << p.second << ")";
}
void dbgprint(const string &fmt) { cerr << endl; }
template <class H, class... T>
void dbgprint(const string &fmt, const H &h, const T &...r) {
cerr << fmt.substr(0, fmt.find(",")) << "= " << h << " ";
dbgprint(fmt.substr(fmt.find(",") + 1), r...);
}
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
const int inf = (int)1e9;
const double INF = 1e12, EPS = 1e-9;
int main() {
cin.tie(0);
cin.sync_with_stdio(0);
int n;
cin >> n;
vi a(n);
rep(i, n) cin >> a[i];
map<int, int> cnt;
rep(i, n) cnt[a[i]]++;
auto solve = [&]() {
if (cnt.size() == 1 && a[0] == 0)
return true;
if (n % 3 || cnt.size() > 3)
return false;
vi v;
for (const auto &i : cnt) {
if (i.second % (n / 3))
return false;
rep(j, i.second / (n / 3)) v.pb(i.first);
}
return (v[0] ^ v[1]) == v[2];
};
cout << (solve() ? "Yes" : "No") << endl;
return 0;
} | [
"call.arguments.change"
] | 782,058 | 782,059 | u525288965 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
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]] += 1;
}
if (cnt[0] == n) {
cout << "Yes" << endl;
return 0;
}
if (n % 3 != 0) {
cout << "No" << endl;
return 0;
}
vector<int> all;
for (auto &p : cnt) {
for (int i = 0; i < p.second / (n / 3); i++) {
all.push_back(p.first);
}
}
if (all.size() == 3 & (all[0] ^ all[1] ^ all[2] == 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);
map<int, int> cnt;
for (int i = 0; i < n; i++) {
cin >> A[i];
cnt[A[i]] += 1;
}
if (cnt[0] == n) {
cout << "Yes" << endl;
return 0;
}
if (n % 3 != 0) {
cout << "No" << endl;
return 0;
}
vector<int> all;
for (auto &p : cnt) {
for (int i = 0; i < p.second / (n / 3); i++) {
all.push_back(p.first);
}
}
if (all.size() == 3 && (all[0] ^ all[1] ^ all[2]) == 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
} | [
"control_flow.branch.if.condition.change"
] | 782,066 | 782,065 | u138486156 | cpp |
p02975 | /*
гонфлад
*/
#pragma ARCENIY_KIRILLOV_UVIDEL_KROKODILOV
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("no-stack-protector")
//#pragma GCC push_options
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC pop_options
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define rng(a) a.begin(), a.end()
#define fast \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
using namespace std;
typedef long long ll;
main() {
int n;
cin >> n;
vector<int> a(n);
map<int, int> b;
for (int i = 0; i < n; i++) {
cin >> a[i];
b[a[i]]++;
}
if (b.size() > 3) {
cout << "No";
return 0;
}
if (b.size() == 3) {
vector<pair<int, int>> c;
for (auto x : b)
c.pb(x);
if (c[0].fi ^ c[1].fi == c[2].fi) {
if (c[0].se == c[1].se && c[1].se == c[2].se) {
cout << "Yes";
return 0;
}
}
cout << "No";
return 0;
}
if (b.size() == 1) {
int c;
for (auto x : b)
c = x.fi;
if (c == 0) {
cout << "Yes";
} else
cout << "No";
return 0;
}
int c = -1;
int d = -1;
for (auto x : b) {
if (d == -1) {
if (x.fi != 0) {
cout << "No";
return 0;
}
d = x.se;
} else
c = x.se;
}
if (d + d == c) {
cout << "Yes";
return 0;
}
cout << "No";
}
| /*
гонфлад
*/
#pragma ARCENIY_KIRILLOV_UVIDEL_KROKODILOV
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("no-stack-protector")
//#pragma GCC push_options
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC pop_options
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define rng(a) a.begin(), a.end()
#define fast \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
using namespace std;
typedef long long ll;
main() {
int n;
cin >> n;
vector<int> a(n);
map<int, int> b;
for (int i = 0; i < n; i++) {
cin >> a[i];
b[a[i]]++;
}
if (b.size() > 3) {
cout << "No";
return 0;
}
if (b.size() == 3) {
vector<pair<int, int>> c;
for (auto x : b)
c.pb(x);
if ((c[0].fi ^ c[1].fi) == c[2].fi) {
if (c[0].se == c[1].se && c[1].se == c[2].se) {
cout << "Yes";
return 0;
}
}
cout << "No";
return 0;
}
if (b.size() == 1) {
int c;
for (auto x : b)
c = x.fi;
if (c == 0) {
cout << "Yes";
} else
cout << "No";
return 0;
}
int c = -1;
int d = -1;
for (auto x : b) {
if (d == -1) {
if (x.fi != 0) {
cout << "No";
return 0;
}
d = x.se;
} else
c = x.se;
}
if (d + d == c) {
cout << "Yes";
return 0;
}
cout << "No";
}
| [
"control_flow.branch.if.condition.change"
] | 782,069 | 782,070 | u122149278 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
long long n;
cin >> n;
map<long long, long long> mp;
for (long long i = 0; i < n; i++) {
long long a;
cin >> a;
mp[a]++;
}
if (mp.size() == 1) {
for (auto x : mp) {
if (x.first == 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
break;
}
return 0;
}
if ((n % 3 != 0) || (mp.size() > 3)) {
cout << "No" << endl;
return 0;
}
if (mp.size() == 2) {
vector<long long> A, B;
for (auto x : mp) {
A.push_back(x.first);
B.push_back(x.second);
}
if (A[1] == 0)
swap(A[0], A[1]);
swap(B[0], B[1]);
if (A[0] != 0) {
cout << "No" << endl;
return 0;
}
if (B[0] * 2 == B[1]) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
} else if (mp.size() == 3) {
vector<long long> A, B;
for (auto x : mp) {
A.push_back(x.first);
B.push_back(x.second);
}
sort(B.begin(), B.end());
if (B[0] == B[2] and A[0] ^ A[1] == A[2]) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
// cout << "No" << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
long long n;
cin >> n;
map<long long, long long> mp;
for (long long i = 0; i < n; i++) {
long long a;
cin >> a;
mp[a]++;
}
if (mp.size() == 1) {
for (auto x : mp) {
if (x.first == 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
break;
}
return 0;
}
if ((n % 3 != 0) || (mp.size() > 3)) {
cout << "No" << endl;
return 0;
}
if (mp.size() == 2) {
vector<long long> A, B;
for (auto x : mp) {
A.push_back(x.first);
B.push_back(x.second);
}
if (A[1] == 0) {
swap(A[0], A[1]);
swap(B[0], B[1]);
}
if (A[0] != 0) {
cout << "No" << endl;
return 0;
}
if (B[0] * 2 == B[1]) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
} else if (mp.size() == 3) {
vector<long long> A, B;
for (auto x : mp) {
A.push_back(x.first);
B.push_back(x.second);
}
sort(B.begin(), B.end());
if (B[0] == B[2] and (A[0] ^ A[1]) == A[2]) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
// cout << "No" << endl;
return 0;
} | [
"control_flow.branch.if.condition.change"
] | 782,080 | 782,081 | u136869985 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, l, r) for (int i = (int)(l); i < (int)(r); i++)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
const int inf = 1LL << 60;
const int mod = 1e9 + 7;
const double eps = 1e-9;
/*{
}*/
signed main() {
int n;
cin >> n;
vi a(n);
rep(i, 0, n) cin >> a[i];
map<int, int> c;
rep(i, 0, n) c[a[i]]++;
cout << ([&]() {
if (c.size() == 1) {
if (c.begin()->first != 0)
return false;
return true;
} else if (c.size() == 2) {
if (n % 3) {
return false;
} else {
bool zero = false, one = false;
for (auto i : c) {
if (i.first == 0) {
if (i.second != n / 3)
return false;
zero = true;
} else {
if (i.second != 2 * n / 3)
return false;
one = true;
}
}
if (!zero or !one)
return false;
return true;
}
} else if (c.size() == 3) {
if (n % 3) {
return false;
} else {
vi v;
for (auto i : c) {
if (i.second != n / 3)
return false;
v.emplace_back(i.first);
}
if (v[0] ^ v[1] ^ v[2] != 0)
return false;
return true;
}
} else {
return false;
}
}()
? "Yes"
: "No")
<< endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, l, r) for (int i = (int)(l); i < (int)(r); i++)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
const int inf = 1LL << 60;
const int mod = 1e9 + 7;
const double eps = 1e-9;
/*{
}*/
signed main() {
int n;
cin >> n;
vi a(n);
rep(i, 0, n) cin >> a[i];
map<int, int> c;
rep(i, 0, n) c[a[i]]++;
cout << ([&]() {
if (c.size() == 1) {
if (c.begin()->first != 0)
return false;
return true;
} else if (c.size() == 2) {
if (n % 3) {
return false;
} else {
bool zero = false, one = false;
for (auto i : c) {
if (i.first == 0) {
if (i.second != n / 3)
return false;
zero = true;
} else {
if (i.second != 2 * n / 3)
return false;
one = true;
}
}
if (!zero or !one)
return false;
return true;
}
} else if (c.size() == 3) {
if (n % 3) {
return false;
} else {
vi v;
for (auto i : c) {
if (i.second != n / 3)
return false;
v.emplace_back(i.first);
}
if ((v[0] ^ v[1] ^ v[2]) != 0)
return false;
return true;
}
} else {
return false;
}
}()
? "Yes"
: "No")
<< endl;
return 0;
}
| [
"control_flow.branch.if.condition.change"
] | 782,084 | 782,085 | u057866967 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ll long long
#define f first
#define s second
#define FIO \
ios_base::sync_with_stdio(false); \
cin.tie(NULL);
int main() {
ll n, t, q;
FIO;
cin >> n;
int a[n + 1];
map<int, int> m;
for (int i = 0; i < n; ++i) {
cin >> a[i];
m[a[i]]++;
}
vector<pair<int, int>> v;
int flag = 0;
for (auto i : m) {
v.push_back(make_pair(i.f, i.s));
}
sort(v.begin(), v.end());
if (v.size() <= 3) {
if (m[0] == n)
flag = 1;
else if (m[0] == n / 3 && v.size() == 2 && v[1].s == (2 * n) / 3)
flag = 1;
else {
int t = ((v[0].f ^ v[1].f) ^ v[2].f);
if (v[0].s == n / 3 && v[1].s == n / 3 && v[2].s == n / 3 && t == 0)
flag = 1;
}
}
if (flag == 1)
cout << "YES\n";
else
cout << "NO\n";
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ll long long
#define f first
#define s second
#define FIO \
ios_base::sync_with_stdio(false); \
cin.tie(NULL);
int main() {
ll n, t, q;
FIO;
cin >> n;
int a[n + 1];
map<int, int> m;
for (int i = 0; i < n; ++i) {
cin >> a[i];
m[a[i]]++;
}
vector<pair<int, int>> v;
int flag = 0;
for (auto i : m) {
v.push_back(make_pair(i.f, i.s));
}
sort(v.begin(), v.end());
if (v.size() <= 3) {
if (m[0] == n)
flag = 1;
else if (m[0] == n / 3 && v.size() == 2 && v[1].s == (2 * n) / 3)
flag = 1;
else {
int t = ((v[0].f ^ v[1].f) ^ v[2].f);
if (v[0].s == n / 3 && v[1].s == n / 3 && v[2].s == n / 3 && t == 0)
flag = 1;
}
}
if (flag == 1)
cout << "Yes\n";
else
cout << "No\n";
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 782,093 | 782,094 | u714262341 | cpp |
p02975 | /*author ADITYA BANSAL
//~ MNNIT ALLAHABAD */
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
using namespace std;
#define db double
#define ll long long
#define ull unsigned long long
ll power(ll, ll);
ll ncr(ll, ll);
void seive();
void fact();
const ll M = 5;
void powmat(ll B[M][M], ll A[M][M], ll n);
void matrix_multi(ll A[M][M], ll B[M][M]);
ll mul(ll a, ll b);
#define watch(x) cerr << (#x) << "is" << x << nl;
#define fast \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
#define fi(a, b) for (ll i = a; i < b; i++)
#define fk(a, b) for (ll k = a; k < b; k++)
#define fri(a, b) for (ll i = a; i >= b; i--)
#define fj(a, b) for (ll j = a; j < b; j++)
#define ffi(a, b) for (ll i = a; i * i <= b; i++)
#define mp make_pair
#define ff first
#define tc \
ll t; \
cin >> t; \
while (t--)
#define all(v) (v).begin(), (v).end()
#define ss second
#define pb push_back
#define mem(v, a) memset((v), a, sizeof(v));
#define pll pair<ll, ll>
#define mll map<ll, ll>
#define mcl map<char, ll>
#define sll set<ll>
#define vll vector<ll>
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define ad(a, b) (a % mod + b % mod + mod) % mod
#define pob pop_back
#define nl endl
const int mod = 1e9 + 7;
const ll N = 100002LL;
ll fac[N + 2];
ll prime[N + 3];
vll primes;
ll inv[N + 2];
signed main() {
fast
//~ seive();
// tc
{
ll n;
cin >> n;
ll x = 0, tp;
fi(0, n) cin >> tp, x ^= tp;
if (x == 0)
cout << "YES";
else
cout << "NO";
}
return 0;
}
/******************************************************************************/
ll mul(ll a, ll b) { return ((a) * (b)) % (mod); }
void seive() {
ffi(2, N) {
if (!prime[i]) {
for (ll j = i * i; j <= N; j += i)
prime[j] = 1;
}
}
fi(2, N + 1) if (!prime[i]) primes.pb(i);
}
ll power(ll a, ll n) {
ll res = 1;
while (n) {
if (n & 1)
res = mul(res, a);
n >>= 1;
a = mul(a, a);
}
return res;
}
void fact() {
inv[0] = fac[0] = 1;
fi(1, N) {
fac[i] = mul(fac[i - 1], i);
inv[i] = power(fac[i], mod - 2);
}
}
ll ncr(ll r, ll n) {
if (r > n)
return 0;
ll e = fac[n];
e = mul(e, inv[r]);
e = mul(e, inv[n - r]);
return e;
}
void matrix_multi(ll A[M][M], ll B[M][M]) {
ll C[M][M];
for (ll i = 0; i < M; i++) {
for (ll j = 0; j < M; j++) {
C[i][j] = 0;
for (ll k = 0; k < M; k++) {
C[i][j] = ad(C[i][j], mul(A[i][k], B[k][j]));
}
}
}
for (ll i = 0; i < M; i++) {
for (ll j = 0; j < M; j++) {
A[i][j] = C[i][j] % (mod);
}
}
}
void powmat(ll B[M][M], ll A[M][M], ll n) {
while (n) {
if (n & 1)
matrix_multi(B, A);
matrix_multi(A, A);
n >>= 1;
}
} | /*author ADITYA BANSAL
//~ MNNIT ALLAHABAD */
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
using namespace std;
#define db double
#define ll long long
#define ull unsigned long long
ll power(ll, ll);
ll ncr(ll, ll);
void seive();
void fact();
const ll M = 5;
void powmat(ll B[M][M], ll A[M][M], ll n);
void matrix_multi(ll A[M][M], ll B[M][M]);
ll mul(ll a, ll b);
#define watch(x) cerr << (#x) << "is" << x << nl;
#define fast \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
#define fi(a, b) for (ll i = a; i < b; i++)
#define fk(a, b) for (ll k = a; k < b; k++)
#define fri(a, b) for (ll i = a; i >= b; i--)
#define fj(a, b) for (ll j = a; j < b; j++)
#define ffi(a, b) for (ll i = a; i * i <= b; i++)
#define mp make_pair
#define ff first
#define tc \
ll t; \
cin >> t; \
while (t--)
#define all(v) (v).begin(), (v).end()
#define ss second
#define pb push_back
#define mem(v, a) memset((v), a, sizeof(v));
#define pll pair<ll, ll>
#define mll map<ll, ll>
#define mcl map<char, ll>
#define sll set<ll>
#define vll vector<ll>
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define ad(a, b) (a % mod + b % mod + mod) % mod
#define pob pop_back
#define nl endl
const int mod = 1e9 + 7;
const ll N = 100002LL;
ll fac[N + 2];
ll prime[N + 3];
vll primes;
ll inv[N + 2];
signed main() {
fast
//~ seive();
// tc
{
ll n;
cin >> n;
ll x = 0, tp;
fi(0, n) cin >> tp, x ^= tp;
if (x == 0)
cout << "Yes";
else
cout << "No";
}
return 0;
}
/******************************************************************************/
ll mul(ll a, ll b) { return ((a) * (b)) % (mod); }
void seive() {
ffi(2, N) {
if (!prime[i]) {
for (ll j = i * i; j <= N; j += i)
prime[j] = 1;
}
}
fi(2, N + 1) if (!prime[i]) primes.pb(i);
}
ll power(ll a, ll n) {
ll res = 1;
while (n) {
if (n & 1)
res = mul(res, a);
n >>= 1;
a = mul(a, a);
}
return res;
}
void fact() {
inv[0] = fac[0] = 1;
fi(1, N) {
fac[i] = mul(fac[i - 1], i);
inv[i] = power(fac[i], mod - 2);
}
}
ll ncr(ll r, ll n) {
if (r > n)
return 0;
ll e = fac[n];
e = mul(e, inv[r]);
e = mul(e, inv[n - r]);
return e;
}
void matrix_multi(ll A[M][M], ll B[M][M]) {
ll C[M][M];
for (ll i = 0; i < M; i++) {
for (ll j = 0; j < M; j++) {
C[i][j] = 0;
for (ll k = 0; k < M; k++) {
C[i][j] = ad(C[i][j], mul(A[i][k], B[k][j]));
}
}
}
for (ll i = 0; i < M; i++) {
for (ll j = 0; j < M; j++) {
A[i][j] = C[i][j] % (mod);
}
}
}
void powmat(ll B[M][M], ll A[M][M], ll n) {
while (n) {
if (n & 1)
matrix_multi(B, A);
matrix_multi(A, A);
n >>= 1;
}
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 782,101 | 782,102 | u719780128 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define m0(x) memset(x, 0, sizeof(x))
int dx4[4] = {1, 0, -1, 0}, dy4[4] = {0, 1, 0, -1};
int main() {
bool ans = false;
ll n;
cin >> n;
vector<ll> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
sort(all(a));
if (a[0] == 0 && a[n - 1] == 0) {
ans = true;
} else if (n % 3 == 0) {
ll nn = n / 3;
if (a[0] == a[nn - 1] && a[nn] == a[nn * 2 - 1] &&
a[nn * 2] == a[nn * 3 - 1]) {
if (a[0] == 0 && a[nn] == a[nn * 2]) {
ans = true;
} else if (a[0] ^ a[nn] == a[nn * 2]) {
ans = true;
}
}
}
if (ans == true) {
cout << "Yes" << endl;
} else
cout << "No" << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define m0(x) memset(x, 0, sizeof(x))
int dx4[4] = {1, 0, -1, 0}, dy4[4] = {0, 1, 0, -1};
int main() {
bool ans = false;
ll n;
cin >> n;
vector<ll> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
sort(all(a));
if (a[0] == 0 && a[n - 1] == 0) {
ans = true;
} else if (n % 3 == 0) {
ll nn = n / 3;
if (a[0] == a[nn - 1] && a[nn] == a[nn * 2 - 1] &&
a[nn * 2] == a[nn * 3 - 1]) {
if (a[0] == 0 && a[nn] == a[nn * 2]) {
ans = true;
} else if ((a[0] ^ a[nn]) == a[nn * 2]) {
ans = true;
}
}
}
if (ans == true) {
cout << "Yes" << endl;
} else
cout << "No" << endl;
return 0;
} | [
"control_flow.branch.if.condition.change"
] | 782,110 | 782,111 | u773916255 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for (int i = 0; i < 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 MOD = 1e9 + 7;
int main() {
int N;
cin >> N;
map<ll, int> A;
map<ll, int> B;
vector<ll> X;
REP(i, N) {
ll a;
cin >> a;
A[a]++;
B[a]++;
if (A[a] == N / 3) {
X.push_back(a);
A[a] = 0;
}
}
bool ans = true;
if (N % 3 != 0)
ans = false;
if (X.size() != 3)
ans = false;
// for(auto&& p : A){
// X.push_back(p.first);
// if(p.second != N/3) ans = false;
//}
if (ans && (X[0] ^ X[1] != X[2])) {
ans = false;
}
if (B[0] == N)
ans = true;
if (ans) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for (int i = 0; i < 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 MOD = 1e9 + 7;
int main() {
int N;
cin >> N;
map<ll, int> A;
map<ll, int> B;
vector<ll> X;
REP(i, N) {
ll a;
cin >> a;
A[a]++;
B[a]++;
if (A[a] == N / 3) {
X.push_back(a);
A[a] = 0;
}
}
bool ans = true;
if (N % 3 != 0)
ans = false;
if (X.size() != 3)
ans = false;
// for(auto&& p : A){
// X.push_back(p.first);
// if(p.second != N/3) ans = false;
//}
if (ans && ((X[0] ^ X[1]) != X[2])) {
// cout << "ok" << endl;
// REP(i,3) cout << X[i] << endl;
ans = false;
}
if (B[0] == N)
ans = true;
if (ans) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
| [
"control_flow.branch.if.condition.change"
] | 782,115 | 782,116 | u666394517 | cpp |
p02975 | // https://atcoder.jp/contests/agc035/tasks/agc035_a
// A - XOR Circle
// a,b,a^b でならぶので、a,b,a^bの3種
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define FOR(i, a, b) for (int64_t i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
int main() {
ll N;
cin >> N;
vector<ll> an(N);
unordered_map<ll, ll> vnum;
for (auto &&a : an) {
cin >> a;
++vnum[a];
}
bool ret = false;
//全0
if (vnum.size() == 1 && vnum.begin()->first == 0) {
ret = true;
}
// 0一つ、x,x,0
if (N % 3 == 0 && vnum.size() == 2 && vnum.count(0) == N / 3) {
ret = true;
}
// 3つ違う a,b,c
if (N % 3 == 0 && vnum.size() == 3) {
ll x = 0;
bool ret3 = true;
for (auto &d : vnum) {
x ^= d.first;
if (d.second != N / 3) {
ret3 = false;
}
}
if (x != 0)
ret3 = false;
ret |= ret3;
}
#if 0
ll tmp=an[i]
ll ans=an[0];
FOR(i,1,N){
ans ^= an[i];
}
#endif
cout << (ret ? "Yes" : "No") << endl;
return 0;
} | // https://atcoder.jp/contests/agc035/tasks/agc035_a
// A - XOR Circle
// a,b,a^b でならぶので、a,b,a^bの3種
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define FOR(i, a, b) for (int64_t i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
int main() {
ll N;
cin >> N;
vector<ll> an(N);
unordered_map<ll, ll> vnum;
for (auto &&a : an) {
cin >> a;
++vnum[a];
}
bool ret = false;
//全0
if (vnum.size() == 1 && vnum.begin()->first == 0) {
ret = true;
}
// 0一つ、x,x,0
if (N % 3 == 0 && vnum.size() == 2 && vnum.count(0) && vnum[0] == N / 3) {
ret = true;
}
// 3つ違う a,b,c
if (N % 3 == 0 && vnum.size() == 3) {
ll x = 0;
bool ret3 = true;
for (auto &d : vnum) {
x ^= d.first;
if (d.second != N / 3) {
ret3 = false;
}
}
if (x != 0)
ret3 = false;
ret |= ret3;
}
#if 0
ll tmp=an[i]
ll ans=an[0];
FOR(i,1,N){
ans ^= an[i];
}
#endif
cout << (ret ? "Yes" : "No") << endl;
return 0;
} | [
"control_flow.branch.if.condition.change"
] | 782,122 | 782,123 | u182321487 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
auto solve = [&]() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
map<int, int> c;
for (int i = 0; i < n; ++i) {
++c[a[i]];
}
if (c.find(0) != c.end() && c[0] == n) {
return 1;
}
if (n % 3 != 0) {
return 0;
}
if (c.find(0) != c.end() && c[0] == n / 3 && c.size() == 2) {
return 1;
}
if (c.size() == 3) {
vector<pair<int, int>> a;
for (auto i : c) {
a.push_back(i);
}
if (a[0].second == a[1].second && a[1].second == a[2].second) {
if (a[0].first ^ a[1].first == a[2].first) {
return 1;
}
}
}
return 0;
};
cout << (solve() ? "Yes" : "No") << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
auto solve = [&]() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
map<int, int> c;
for (int i = 0; i < n; ++i) {
++c[a[i]];
}
if (c.find(0) != c.end() && c[0] == n) {
return 1;
}
if (n % 3 != 0) {
return 0;
}
if (c.find(0) != c.end() && c[0] == n / 3 && c.size() == 2) {
return 1;
}
if (c.size() == 3) {
vector<pair<int, int>> a;
for (auto i : c) {
a.push_back(i);
}
if (a[0].second == a[1].second && a[1].second == a[2].second) {
if ((a[0].first ^ a[1].first) == a[2].first) {
return 1;
}
}
}
return 0;
};
cout << (solve() ? "Yes" : "No") << endl;
return 0;
}
| [
"control_flow.branch.if.condition.change"
] | 782,124 | 782,125 | u499656581 | cpp |
p02975 | #include <bits/stdc++.h>
int main() {
using namespace std;
size_t N;
cin >> N;
unordered_map<unsigned long, size_t> mp;
for (unsigned long i = 0, a; i < N; ++i) {
cin >> a;
++mp[a];
}
if (mp.size() > 3)
return 0 & puts("No");
if (mp.size() == 1)
return 0 & puts(mp[0] == N ? "Yes" : "No");
if (mp.size() == 2)
return 0 & puts(mp[0] * 3 == N ? "Yes" : "No");
if (mp.size() == 3) {
vector<unsigned long> a;
for (const auto &i : mp) {
if (i.second * 3 != N)
return 0 & puts("No");
a.push_back(i.first);
}
puts(a[0] ^ a[1] == a[2] ? "Yes" : "No");
}
return 0;
} | #include <bits/stdc++.h>
int main() {
using namespace std;
size_t N;
cin >> N;
unordered_map<unsigned long, size_t> mp;
for (unsigned long i = 0, a; i < N; ++i) {
cin >> a;
++mp[a];
}
if (mp.size() > 3)
return 0 & puts("No");
if (mp.size() == 1)
return 0 & puts(mp[0] == N ? "Yes" : "No");
if (mp.size() == 2)
return 0 & puts(mp[0] * 3 == N ? "Yes" : "No");
if (mp.size() == 3) {
vector<unsigned long> a;
for (const auto &i : mp) {
if (i.second * 3 != N)
return 0 & puts("No");
a.push_back(i.first);
}
puts(a[0] ^ a[1] ^ a[2] ? "No" : "Yes");
}
return 0;
} | [
"control_flow.branch.if.condition.change",
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 782,130 | 782,131 | u462437857 | cpp |
p02975 | #include <bits/stdc++.h>
int main() {
using namespace std;
size_t N;
cin >> N;
unordered_map<unsigned long, size_t> mp;
for (unsigned long i = 0, a; i < N; ++i) {
cin >> a;
++mp[a];
}
if (mp.size() > 3)
return 0 & puts("No");
if (mp.size() == 1)
return 0 & puts(mp[0] == N ? "Yes" : "No");
if (mp.size() == 2)
return 0 & puts(mp[0] * 3 == N ? "Yes" : "No");
if (mp.size() == 3) {
vector<unsigned long> a;
for (const auto &i : mp) {
if (i.second * 3 != N)
return 0 & puts("No");
a.push_back(i.first);
}
puts(a[0] ^ a[1] == a[2] ? "Yes" : "No");
}
return 0;
} | #include <bits/stdc++.h>
int main() {
using namespace std;
size_t N;
cin >> N;
unordered_map<unsigned long, size_t> mp;
for (unsigned long i = 0, a; i < N; ++i) {
cin >> a;
++mp[a];
}
if (mp.size() > 3)
return 0 & puts("No");
if (mp.size() == 1)
return 0 & puts(mp[0] == N ? "Yes" : "No");
if (mp.size() == 2)
return 0 & puts(mp[0] * 3 == N ? "Yes" : "No");
if (mp.size() == 3) {
vector<unsigned long> a;
for (const auto &i : mp) {
if (i.second * 3 != N)
return 0 & puts("No");
a.push_back(i.first);
}
puts((a[0] ^ a[1]) == a[2] ? "Yes" : "No");
}
return 0;
} | [
"call.arguments.change",
"control_flow.branch.if.condition.change"
] | 782,130 | 782,132 | u462437857 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
int main(void) {
int n;
cin >> n;
vector<int> a(n);
for (auto &x : a)
cin >> x;
std::sort(a.begin(), a.end());
int k = 0, t = a[0];
vector<int> b(3), c(3);
for (auto &x : a) {
if (t != x)
k++, t = x;
if (k >= 3) {
cout << "No" << endl;
return 0;
}
c[k] = x;
b[k]++;
}
if (k == 0) {
if (c[0] == 0)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
}
if (k == 1) {
if (c[0] == 0 && 2 * b[0] == b[1])
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
}
// k==2
if (c[0] ^ c[1] != c[2]) {
cout << "No" << endl;
return 0;
}
if (b[0] == b[1] && b[1] == b[2]) {
cout << "Yes" << endl;
return 0;
}
cout << "No" << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main(void) {
int n;
cin >> n;
vector<long> a(n);
for (auto &x : a)
cin >> x;
std::sort(a.begin(), a.end());
int k = 0, t = a[0];
vector<int> b(3), c(3);
for (auto &x : a) {
if (t != x)
k++, t = x;
if (k >= 3) {
cout << "No" << endl;
return 0;
}
c[k] = x;
b[k]++;
}
if (k == 0) {
if (c[0] == 0)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
}
if (k == 1) {
if (c[0] == 0 && 2 * b[0] == b[1])
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
}
// k==2
if ((c[0] ^ c[1]) != c[2]) {
cout << "No" << endl;
return 0;
}
if (b[0] == b[1] && b[1] == b[2]) {
cout << "Yes" << endl;
return 0;
}
cout << "No" << endl;
return 0;
}
| [
"variable_declaration.type.primitive.change",
"control_flow.branch.if.condition.change"
] | 782,133 | 782,134 | u056944756 | cpp |
p02975 | #include "bits/stdc++.h"
using namespace std;
const int MAXN = 1e5 + 5;
int n, a[MAXN];
map<int, int> num;
vector<int> vals;
int main() {
scanf("%d", &n);
bool doZero = false;
for (int i = 0; i < n; ++i) {
scanf("%d", &a[i]);
num[a[i]]++;
if (a[i] == 0)
doZero = true;
}
if (n % 3 == 0) {
if (num.size() > 3) {
printf("No\n");
} else if (num.size() == 3) {
// All should equal
vector<int> vals, nums;
for (auto i : num) {
vals.push_back(i.first);
nums.push_back(i.second);
assert(i.second > 0);
}
assert(nums.size() == 3);
if (nums[0] == nums[1] && nums[1] == nums[2] &&
vals[0] ^ vals[1] == vals[2]) {
printf("Yes\n");
} else {
printf("No\n");
}
} else if (num.size() == 2) {
vector<int> vals, nums;
for (auto i : num) {
vals.push_back(i.first);
nums.push_back(i.second);
}
bool valid = true;
assert(nums.size() == 2);
if (vals[0] == 0) {
if (2 * nums[0] != nums[1])
valid = false;
} else if (vals[1] == 0) {
if (2 * nums[1] != nums[0])
valid = false;
} else {
valid = false;
}
if (valid)
printf("Yes\n");
else
printf("No\n");
} else {
if (doZero) {
printf("Yes\n");
} else {
printf("No\n");
}
}
} else {
if (num.size() == 1 && doZero) {
printf("Yes\n");
} else {
printf("No\n");
}
}
} | #include "bits/stdc++.h"
using namespace std;
const int MAXN = 1e5 + 5;
int n, a[MAXN];
map<int, int> num;
vector<int> vals;
int main() {
scanf("%d", &n);
bool doZero = false;
for (int i = 0; i < n; ++i) {
scanf("%d", &a[i]);
num[a[i]]++;
if (a[i] == 0)
doZero = true;
}
if (n % 3 == 0) {
if (num.size() > 3) {
printf("No\n");
} else if (num.size() == 3) {
// All should equal
vector<int> vals, nums;
for (auto i : num) {
vals.push_back(i.first);
nums.push_back(i.second);
assert(i.second > 0);
}
assert(nums.size() == 3);
if (nums[0] == nums[1] && nums[1] == nums[2] &&
(vals[0] ^ vals[1]) == vals[2]) {
printf("Yes\n");
} else {
printf("No\n");
}
} else if (num.size() == 2) {
vector<int> vals, nums;
for (auto i : num) {
vals.push_back(i.first);
nums.push_back(i.second);
}
bool valid = true;
assert(nums.size() == 2);
if (vals[0] == 0) {
if (2 * nums[0] != nums[1])
valid = false;
} else if (vals[1] == 0) {
if (2 * nums[1] != nums[0])
valid = false;
} else {
valid = false;
}
if (valid)
printf("Yes\n");
else
printf("No\n");
} else {
if (doZero) {
printf("Yes\n");
} else {
printf("No\n");
}
}
} else {
if (num.size() == 1 && doZero) {
printf("Yes\n");
} else {
printf("No\n");
}
}
} | [
"control_flow.branch.if.condition.change"
] | 782,143 | 782,144 | u198150045 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
map<int, int> mp;
for (int i = 0; i < n; ++i) {
int curr;
cin >> curr;
mp[curr]++;
}
// case
if (mp.size() == 1 && mp[0] > 0) {
cout << "Yes" << endl;
} else if (mp.size() == 3 && n % 3 == 0) {
vector<int> arr;
bool f = true;
for (auto i : mp) {
if (i.second != n / 3) {
f = false;
}
arr.push_back(i.first);
}
if (arr[0] ^ arr[2] != arr[1] || arr[0] ^ arr[1] != arr[2] ||
arr[2] ^ arr[1] != arr[0]) {
f = false;
}
if (f) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
} else if (mp.size() == 2 && n % 3 == 0 && mp[0] == n / 3) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
map<int, int> mp;
for (int i = 0; i < n; ++i) {
int curr;
cin >> curr;
mp[curr]++;
}
// case
if (mp.size() == 1 && mp[0] > 0) {
cout << "Yes" << endl;
} else if (mp.size() == 3 && n % 3 == 0) {
vector<int> arr;
bool f = true;
for (auto i : mp) {
if (i.second != n / 3) {
f = false;
}
arr.push_back(i.first);
}
if ((arr[0] ^ arr[2]) != arr[1] || (arr[0] ^ arr[1]) != arr[2] ||
(arr[2] ^ arr[1]) != arr[0]) {
f = false;
}
if (f) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
} else if (mp.size() == 2 && n % 3 == 0 && mp[0] == n / 3) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
| [
"control_flow.branch.if.condition.change"
] | 782,156 | 782,157 | u542111796 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
map<int, int> mp;
for (int i = 0; i < n; ++i) {
int curr;
cin >> curr;
mp[curr]++;
}
// case
if (mp.size() == 1 && mp[0] > 0) {
cout << "Yes" << endl;
} else if (mp.size() == 3 && n % 3 == 0) {
vector<int> arr;
bool f = true;
for (auto i : mp) {
if (i.second != n / 3) {
f = false;
}
arr.push_back(i.first);
}
if (arr[0] ^ arr[2] ^ arr[1] != 0) {
f = false;
}
if (f) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
} else if (mp.size() == 2 && n % 3 == 0 && mp[0] == n / 3) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
map<int, int> mp;
for (int i = 0; i < n; ++i) {
int curr;
cin >> curr;
mp[curr]++;
}
// case
if (mp.size() == 1 && mp[0] > 0) {
cout << "Yes" << endl;
} else if (mp.size() == 3 && n % 3 == 0) {
vector<int> arr;
bool f = true;
for (auto i : mp) {
if (i.second != n / 3) {
f = false;
}
arr.push_back(i.first);
}
if ((arr[0] ^ arr[2] ^ arr[1]) != 0) {
f = false;
}
if (f) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
} else if (mp.size() == 2 && n % 3 == 0 && mp[0] == n / 3) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
| [
"control_flow.branch.if.condition.change"
] | 782,158 | 782,159 | u542111796 | cpp |
p02975 | #include <bits/stdc++.h>
#include <type_traits>
using namespace std;
using ll = int64_t;
#define int ll
#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()
using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
os << "(" << p.first << "," << p.second << ")";
return os;
}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
os << "{";
REP(i, (int)v.size()) {
if (i)
os << ",";
os << v[i];
}
os << "}";
return os;
}
ll read() {
ll i;
scanf("%" SCNd64, &i);
return i;
}
void printSpace() { printf(" "); }
void printEoln() { printf("\n"); }
void print(ll x, int suc = 1) {
printf("%" PRId64, x);
if (suc == 1)
printEoln();
if (suc == 2)
printSpace();
}
string readString() {
static char buf[3341000];
scanf("%s", buf);
return string(buf);
}
char *readCharArray() {
static char buf[3341000];
static int bufUsed = 0;
char *ret = buf + bufUsed;
scanf("%s", ret);
bufUsed += strlen(ret) + 1;
return ret;
}
template <class T, class U> void chmax(T &a, U b) {
if (a < b)
a = b;
}
template <class T, class U> void chmin(T &a, U b) {
if (b < a)
a = b;
}
template <class T> T Sq(const T &t) { return t * t; }
const int mod = 1e9 + 7;
signed main() {
int n = read();
vi a;
map<int, int> cnt;
REP(i, n) {
a.PB(read());
cnt[a[i]]++;
}
if (cnt[0] == n) {
std::cout << "Yes" << std::endl;
return 0;
}
if (n % 3 != 0) {
std::cout << "No" << std::endl;
return 0;
}
vi all;
for (auto &p : cnt) {
REP(i, p.second / (n / 3)) all.PB(p.first);
}
if (all.size() == 3 && all[0] ^ all[1] == all[2]) {
std::cout << "Yes" << std::endl;
return 0;
}
std::cout << "No" << std::endl;
}
| #include <bits/stdc++.h>
#include <type_traits>
using namespace std;
using ll = int64_t;
#define int ll
#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()
using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
os << "(" << p.first << "," << p.second << ")";
return os;
}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
os << "{";
REP(i, (int)v.size()) {
if (i)
os << ",";
os << v[i];
}
os << "}";
return os;
}
ll read() {
ll i;
scanf("%" SCNd64, &i);
return i;
}
void printSpace() { printf(" "); }
void printEoln() { printf("\n"); }
void print(ll x, int suc = 1) {
printf("%" PRId64, x);
if (suc == 1)
printEoln();
if (suc == 2)
printSpace();
}
string readString() {
static char buf[3341000];
scanf("%s", buf);
return string(buf);
}
char *readCharArray() {
static char buf[3341000];
static int bufUsed = 0;
char *ret = buf + bufUsed;
scanf("%s", ret);
bufUsed += strlen(ret) + 1;
return ret;
}
template <class T, class U> void chmax(T &a, U b) {
if (a < b)
a = b;
}
template <class T, class U> void chmin(T &a, U b) {
if (b < a)
a = b;
}
template <class T> T Sq(const T &t) { return t * t; }
const int mod = 1e9 + 7;
signed main() {
int n = read();
vi a;
map<int, int> cnt;
REP(i, n) {
a.PB(read());
cnt[a[i]]++;
}
if (cnt[0] == n) {
std::cout << "Yes" << std::endl;
return 0;
}
if (n % 3 != 0) {
std::cout << "No" << std::endl;
return 0;
}
vi all;
for (auto &p : cnt) {
REP(i, p.second / (n / 3)) all.PB(p.first);
}
if (all.size() == 3 && (all[0] ^ all[1]) == all[2]) {
std::cout << "Yes" << std::endl;
return 0;
}
std::cout << "No" << std::endl;
}
| [
"control_flow.branch.if.condition.change"
] | 782,160 | 782,161 | u700484101 | cpp |
p02975 | #include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;
#define MOD 1000000007
#define EPS 10e-8
ll p[3]; // kazu
ll g[3]; // p[i]no kazu
int main() {
ll n;
ll c = 0; // cor
int t = 1; // tigau num
int l; // tigau sum
cin >> n;
ll a[100007];
rep(i, n) { cin >> a[i]; }
p[0] = a[0];
rep(i, n - 1) { //同じ個数判定
l = 0;
rep(j, t) {
if (a[i + 1] != p[j]) {
l++;
} else {
g[j]++;
}
}
if (l == t) {
p[t] = a[i + 1];
t++;
}
if (t == 4) {
c++;
break;
}
}
if (t == 1) {
if (a[0] != 0) {
c++;
}
}
if (t == 2) {
if (p[0] == 0) {
if (p[0] != (p[0] xor p[1]) || (g[0] + 1) * 2 != g[1] + 1) {
c++;
}
} else if (p[1] == 0) {
if (p[0] != (p[0] xor p[1]) || (g[1] + 1) * 2 != g[0] + 1) {
c++;
}
} else {
c++;
}
}
if (t == 3) {
if (p[0] != (p[1] xor p[2]) || g[0] != g[1] || g[1] != g[2] ||
g[2] != g[0]) {
c++;
}
}
if (c == 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
} | #include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;
#define MOD 1000000007
#define EPS 10e-8
ll p[3]; // kazu
ll g[3]; // p[i]no kazu
int main() {
ll n;
ll c = 0; // cor
int t = 1; // tigau num
int l; // tigau sum
cin >> n;
ll a[100007];
rep(i, n) { cin >> a[i]; }
p[0] = a[0];
rep(i, n - 1) { //同じ個数判定
l = 0;
rep(j, t) {
if (a[i + 1] != p[j]) {
l++;
} else {
g[j]++;
}
}
if (l == t) {
p[t] = a[i + 1];
t++;
}
if (t == 4) {
c++;
break;
}
}
if (t == 1) {
if (a[0] != 0) {
c++;
}
}
if (t == 2) {
if (p[0] == 0) {
if (p[1] != (p[0] xor p[1]) || (g[0] + 1) * 2 != g[1] + 1) {
c++;
}
} else if (p[1] == 0) {
if (p[0] != (p[0] xor p[1]) || (g[1] + 1) * 2 != g[0] + 1) {
c++;
}
} else {
c++;
}
}
if (t == 3) {
if (p[0] != (p[1] xor p[2]) || g[0] != g[1] || g[1] != g[2] ||
g[2] != g[0]) {
c++;
}
}
if (c == 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
}
| [
"literal.number.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change"
] | 782,169 | 782,170 | u008229752 | cpp |
p02975 | #include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;
#define MOD 1000000007
#define EPS 10e-8
ll p[3]; // kazu
ll g[3]; // p[i]no kazu
int main() {
ll n;
ll c = 0; // cor
int t = 1; // tigau num
int l; // tigau sum
cin >> n;
ll a[100007];
rep(i, n) { cin >> a[i]; }
p[0] = a[0];
rep(i, n - 1) { //同じ個数判定
l = 0;
rep(j, t) {
if (a[i + 1] != p[j]) {
l++;
} else {
g[j]++;
}
}
if (l == t) {
p[t] = a[i + 1];
t++;
}
if (t == 4) {
c++;
break;
}
}
if (t == 1) {
if (a[0] != 0) {
c++;
}
}
if (t == 2) {
if (p[0] == 0) {
if (p[0] != (p[0] xor p[1]) || (g[0] + 1) * 2 != g[1] + 1) {
c++;
}
} else if (p[1] == 0) {
if (p[0] != (p[0] xor p[1]) || (g[1] + 1) * 2 != g[0] + 1) {
c++;
}
} else {
c++;
}
}
if (t == 3) {
if (p[0] != (p[1] xor p[2]) || g[0] != g[1] || g[1] != g[2] ||
g[2] != g[0]) {
c++;
}
}
if (c == 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
} | #include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;
#define MOD 1000000007
#define EPS 10e-8
ll p[3]; // kazu
ll g[3]; // p[i]no kazu
int main() {
ll n;
ll c = 0; // cor
int t = 1; // tigau num
int l; // tigau sum
cin >> n;
ll a[100007];
rep(i, n) { cin >> a[i]; }
p[0] = a[0];
rep(i, n - 1) { //同じ個数判定
l = 0;
rep(j, t) {
if (a[i + 1] != p[j]) {
l++;
} else {
g[j]++;
}
}
if (l == t) {
p[t] = a[i + 1];
t++;
}
if (t == 4) {
c++;
break;
}
}
if (t == 1) {
if (a[0] != 0) {
c++;
}
}
if (t == 2) {
if (p[0] == 0) {
if (p[1] != (p[0] xor p[1]) || (g[0] + 1) * 2 != g[1] + 1) {
c++;
}
} else if (p[1] == 0) {
if (p[0] != (p[0] xor p[1]) || (g[1] + 1) * 2 != g[0] + 1) {
c++;
}
} else {
c++;
}
}
if (t == 3) {
if (p[0] != (p[1] xor p[2]) || g[0] != g[1] || g[1] != g[2] ||
g[2] != g[0]) {
c++;
}
}
if (c == 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
} | [
"literal.number.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change"
] | 782,169 | 782,171 | u008229752 | cpp |
p02975 | #include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
int main() {
int n;
cin >> n;
ll a;
vector<ll> v;
map<ll, int> cnt;
for (int i = 0; i < n; i++) {
cin >> a;
if (cnt[a] == 0)
v.push_back(a);
cnt[a]++;
}
if (n % 3 != 0) {
if (cnt[0] == n) {
cout << "Yes" << endl;
} else {
cout << "NO" << endl;
}
return 0;
}
bool b = false;
sort(v.begin(), v.end());
if (v.size() == 1) {
if (cnt[0] == n) {
b = true;
}
} else if (v.size() == 2) {
if (cnt[0] == n / 3 && cnt[v[1]] == 2 * n / 3) {
b = true;
}
} else if (v.size() == 3) {
if (cnt[v[0]] == n / 3 && cnt[v[1]] == n / 3 && cnt[v[2]] == n / 3 &&
v[0] ^ v[1] ^ v[2] == 0) {
b = true;
}
}
if (b)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
} | #include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
int main() {
int n;
cin >> n;
ll a;
vector<ll> v;
map<ll, int> cnt;
for (int i = 0; i < n; i++) {
cin >> a;
if (cnt[a] == 0)
v.push_back(a);
cnt[a]++;
}
if (n % 3 != 0) {
if (cnt[0] == n) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
bool b = false;
sort(v.begin(), v.end());
if (v.size() == 1) {
if (cnt[0] == n) {
b = true;
}
} else if (v.size() == 2) {
if (cnt[0] == n / 3 && cnt[v[1]] == 2 * n / 3) {
b = true;
}
} else if (v.size() == 3) {
if (cnt[v[0]] == n / 3 && cnt[v[1]] == n / 3 && cnt[v[2]] == n / 3 &&
(v[0] ^ v[1] ^ v[2]) == 0) {
b = true;
}
}
if (b)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change",
"control_flow.branch.if.condition.change"
] | 782,174 | 782,175 | u348670055 | cpp |
p02975 | #include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
int main() {
int n;
cin >> n;
ll a;
vector<ll> v;
map<ll, int> cnt;
for (int i = 0; i < n; i++) {
cin >> a;
if (cnt[a] == 0)
v.push_back(a);
cnt[a]++;
}
if (n % 3 != 0) {
if (cnt[0] == n) {
cout << "YES" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
bool b = false;
sort(v.begin(), v.end());
if (v.size() == 1) {
if (cnt[0] == n) {
b = true;
}
} else if (v.size() == 2) {
if (cnt[0] == n / 3 && cnt[v[1]] == 2 * n / 3) {
b = true;
}
} else if (v.size() == 3) {
if (cnt[v[0]] == n / 3 && cnt[v[1]] == n / 3 && cnt[v[2]] == n / 3 &&
v[0] ^ v[1] ^ v[2] == 0) {
b = true;
}
}
if (b)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
} | #include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
int main() {
int n;
cin >> n;
ll a;
vector<ll> v;
map<ll, int> cnt;
for (int i = 0; i < n; i++) {
cin >> a;
if (cnt[a] == 0)
v.push_back(a);
cnt[a]++;
}
if (n % 3 != 0) {
if (cnt[0] == n) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
bool b = false;
sort(v.begin(), v.end());
if (v.size() == 1) {
if (cnt[0] == n) {
b = true;
}
} else if (v.size() == 2) {
if (cnt[0] == n / 3 && cnt[v[1]] == 2 * n / 3) {
b = true;
}
} else if (v.size() == 3) {
if (cnt[v[0]] == n / 3 && cnt[v[1]] == n / 3 && cnt[v[2]] == n / 3 &&
(v[0] ^ v[1] ^ v[2]) == 0) {
b = true;
}
}
if (b)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change",
"control_flow.branch.if.condition.change"
] | 782,176 | 782,175 | u348670055 | cpp |
p02975 | #include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
int main() {
int n;
cin >> n;
ll a;
vector<ll> v;
map<ll, int> cnt;
for (int i = 0; i < n; i++) {
cin >> a;
if (cnt[a] == 0)
v.push_back(a);
cnt[a]++;
}
if (n % 3 != 0) {
if (cnt[0] == n) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
bool b = false;
sort(v.begin(), v.end());
if (v.size() == 1) {
if (cnt[0] == n) {
b = true;
}
} else if (v.size() == 2) {
if (cnt[0] == n / 3 && cnt[v[1]] == 2 * n / 3) {
b = true;
}
} else if (v.size() == 3) {
if (cnt[v[0]] == n / 3 && cnt[v[1]] == n / 3 && cnt[v[2]] == n / 3 &&
v[0] ^ v[1] ^ v[2] == 0) {
b = true;
}
}
if (b)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
} | #include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
int main() {
int n;
cin >> n;
ll a;
vector<ll> v;
map<ll, int> cnt;
for (int i = 0; i < n; i++) {
cin >> a;
if (cnt[a] == 0)
v.push_back(a);
cnt[a]++;
}
if (n % 3 != 0) {
if (cnt[0] == n) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
bool b = false;
sort(v.begin(), v.end());
if (v.size() == 1) {
if (cnt[0] == n) {
b = true;
}
} else if (v.size() == 2) {
if (cnt[0] == n / 3 && cnt[v[1]] == 2 * n / 3) {
b = true;
}
} else if (v.size() == 3) {
if (cnt[v[0]] == n / 3 && cnt[v[1]] == n / 3 && cnt[v[2]] == n / 3 &&
(v[0] ^ v[1] ^ v[2]) == 0) {
b = true;
}
}
if (b)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
} | [
"control_flow.branch.if.condition.change"
] | 782,177 | 782,175 | u348670055 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
map<int, int> C;
int main() {
ios_base::sync_with_stdio(0), cin.tie(0);
int N;
cin >> N;
vector<int> A(N);
for (int i = 0; i < N; ++i)
cin >> A[i];
sort(A.begin(), A.end());
for (auto i : A)
++C[i];
A.erase(unique(A.begin(), A.end()), A.end());
if (A.size() > 3)
printf("No");
else if (A.size() == 3) {
if ((A[0] ^ A[1]) == A[2] && C[A[0]] == C[A[1]] && C[A[1]] == C[A[2]])
printf("Yes");
else
printf("No");
} else {
if (A[0])
printf("No");
else {
if (A.size() == 2 && C[A[0]] == C[A[1]])
printf("No");
else
printf("Yes");
}
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
map<int, int> C;
int main() {
ios_base::sync_with_stdio(0), cin.tie(0);
int N;
cin >> N;
vector<int> A(N);
for (int i = 0; i < N; ++i)
cin >> A[i];
sort(A.begin(), A.end());
for (auto i : A)
++C[i];
A.erase(unique(A.begin(), A.end()), A.end());
if (A.size() > 3)
printf("No");
else if (A.size() == 3) {
if ((A[0] ^ A[1]) == A[2] && C[A[0]] == C[A[1]] && C[A[1]] == C[A[2]])
printf("Yes");
else
printf("No");
} else {
if (A[0])
printf("No");
else {
if (A.size() == 2 && C[A[0]] * 2 != C[A[1]])
printf("No");
else
printf("Yes");
}
}
return 0;
} | [
"control_flow.branch.if.condition.change"
] | 782,182 | 782,183 | u935196741 | cpp |
p02975 | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
bool all_zero(vector<int> V) {
bool flag = true;
for (int i = 1; i < V.size(); i++) {
if (V[0] == 0) {
if (V[i - 1] != V[i])
flag = false;
} else {
flag = false;
}
}
return flag;
}
int main() {
int n;
cin >> n;
vector<int> V(n);
for (int i = 0; i < n; i++)
cin >> V[i];
bool ans = true;
if (all_zero(V)) {
cout << "Yes" << endl;
return 0;
}
if (n % 3 != 0) {
cout << "No" << endl;
return 0;
}
vector<int> S;
int cnt = 0;
sort(V.begin(), V.end());
S.push_back(V[0]);
for (int i = 1; i < n; i++) {
if (V[i - 1] != V[i]) {
cnt++;
S.push_back(V[i]);
}
}
if (cnt == 2) {
if ((S[0] ^ S[1] ^ S[2]) != 0) {
ans = false;
} else {
int s1 = 0, s2 = 0, s3 = 0;
for (int i = 0; i < n; i++) {
if (S[0] == V[i])
s1++;
if (S[1] == V[i])
s2++;
if (S[2] == V[i])
s3++;
}
if (s1 != s2 || s2 != s3)
ans = false;
}
} else if (cnt == 1) {
int s1 = 0, s2 = 0;
for (int i = 0; i < n; i++) {
if (S[0] == V[i])
s1++;
if (S[1] == V[i])
s2++;
}
if (S[0] != 0 || s1 != 2 * s2)
ans = false;
} else {
ans = false;
}
if (ans)
cout << "Yes" << endl;
else
cout << "No" << endl;
}
| #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
bool all_zero(vector<int> V) {
bool flag = true;
for (int i = 1; i < V.size(); i++) {
if (V[0] == 0) {
if (V[i - 1] != V[i])
flag = false;
} else {
flag = false;
}
}
return flag;
}
int main() {
int n;
cin >> n;
vector<int> V(n);
for (int i = 0; i < n; i++)
cin >> V[i];
bool ans = true;
if (all_zero(V)) {
cout << "Yes" << endl;
return 0;
}
if (n % 3 != 0) {
cout << "No" << endl;
return 0;
}
vector<int> S;
int cnt = 0;
sort(V.begin(), V.end());
S.push_back(V[0]);
for (int i = 1; i < n; i++) {
if (V[i - 1] != V[i]) {
cnt++;
S.push_back(V[i]);
}
}
if (cnt == 2) {
if ((S[0] ^ S[1] ^ S[2]) != 0) {
ans = false;
} else {
int s1 = 0, s2 = 0, s3 = 0;
for (int i = 0; i < n; i++) {
if (S[0] == V[i])
s1++;
if (S[1] == V[i])
s2++;
if (S[2] == V[i])
s3++;
}
if (s1 != s2 || s2 != s3)
ans = false;
}
} else if (cnt == 1) {
int s1 = 0, s2 = 0;
for (int i = 0; i < n; i++) {
if (S[0] == V[i])
s1++;
if (S[1] == V[i])
s2++;
}
if (S[0] != 0 || s2 != 2 * s1) {
ans = false;
}
} else {
ans = false;
}
if (ans)
cout << "Yes" << endl;
else
cout << "No" << endl;
}
| [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 782,184 | 782,185 | u056123277 | cpp |
p02975 | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
#pragma warning(disable : 4996)
const int maxn = 100005;
int a[maxn];
map<int, int> Map;
vector<int> E;
int main() {
int n;
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", &a[i]);
if (++Map[a[i]] == 1) {
E.push_back(a[i]);
}
}
if (E.size() > 3) {
printf("No\n");
return 0;
}
sort(E.begin(), E.end());
if (E.size() == 1 && E[0] == 0) {
printf("Yes\n");
return 0;
}
if (n % 3)
printf("No\n");
else if (E.size() == 2 && E[0] == 0 && Map[E[1]] == 2 * Map[E[0]])
printf("Yes\n");
else if (E.size() == 3 && Map[E[0]] == Map[E[1]] && Map[E[1]] == Map[E[2]]) {
if (E[0] == E[1] ^ E[2] && E[1] == E[0] ^ E[2] && E[2] == E[0] ^ E[1])
printf("Yes\n");
else
printf("No\n");
} else
printf("No\n");
} | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
#pragma warning(disable : 4996)
const int maxn = 100005;
int a[maxn];
map<int, int> Map;
vector<int> E;
int main() {
int n;
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", &a[i]);
if (++Map[a[i]] == 1) {
E.push_back(a[i]);
}
}
if (E.size() > 3) {
printf("No\n");
return 0;
}
sort(E.begin(), E.end());
if (E.size() == 1 && E[0] == 0) {
printf("Yes\n");
return 0;
}
if (n % 3)
printf("No\n");
else if (E.size() == 2 && E[0] == 0 && Map[E[1]] == 2 * Map[E[0]])
printf("Yes\n");
else if (E.size() == 3 && Map[E[0]] == Map[E[1]] && Map[E[1]] == Map[E[2]]) {
if (E[0] == (E[1] ^ E[2]) && E[1] == (E[0] ^ E[2]) && E[2] == (E[0] ^ E[1]))
printf("Yes\n");
else
printf("No\n");
} else
printf("No\n");
} | [
"control_flow.branch.if.condition.change"
] | 782,188 | 782,189 | u825625766 | cpp |
p02975 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<long long> v(n);
map<long long, int> mp;
for (int i = 0; i < n; i++) {
cin >> v[i];
mp[v[i]]++;
}
if (mp[0] == n)
return !printf("Yes");
if (n % 3 != 0)
return !printf("No");
vector<long long> res;
for (auto ele : mp) {
for (int j = 0; j < ele.second / (n / 3); j++) {
res.push_back(ele.first);
}
}
if (res.size() == 3 && (res[0] ^ res[1] ^ res[2] == 0))
cout << "Yes";
else
cout << "No";
return 0;
} |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<long long> v(n);
map<long long, int> mp;
for (int i = 0; i < n; i++) {
cin >> v[i];
mp[v[i]]++;
}
if (mp[0] == n)
return !printf("Yes");
if (n % 3 != 0)
return !printf("No");
vector<long long> res;
for (auto ele : mp) {
for (int j = 0; j < ele.second / (n / 3); j++) {
res.push_back(ele.first);
}
}
if (res.size() == 3 && ((res[0] ^ res[1] ^ res[2]) == 0))
cout << "Yes";
else
cout << "No";
return 0;
} | [
"control_flow.branch.if.condition.change"
] | 782,194 | 782,195 | u717021668 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
const int dx[4] = {+1, 0, -1, 0};
const int dy[4] = {0, -1, 0, +1};
int main() {
cin.tie(0);
ios_base::sync_with_stdio(false);
int n;
cin >> n;
unordered_map<ll, ll> mp;
ll zero = 0;
for (int i = 0; i < n; i++) {
ll a;
cin >> a;
mp[a]++;
if (a == 0)
zero++;
}
if (zero == n) {
cout << "Yes" << endl;
return 0;
}
// x x 0 x x 0 x x 0 ...
if (!(n % 3) && mp.size() == 2 && zero == n / 3) {
bool ok = true;
for (auto m : mp) {
if (m.first != 0 && m.second != 2 * n / 3) {
ok = false;
}
}
if (ok) {
cout << "Yes" << endl;
return 0;
}
}
// x y z x y z x y z ...
if (!(n % 3) && mp.size() == 3) {
ll sum = 0;
bool ok = true;
for (auto m : mp) {
sum ^= m.first;
if (m.second != n / 3) {
ok = false;
break;
}
}
if (ok) {
cout << "Yes" << endl;
return 0;
}
}
cout << "No" << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
const int dx[4] = {+1, 0, -1, 0};
const int dy[4] = {0, -1, 0, +1};
int main() {
cin.tie(0);
ios_base::sync_with_stdio(false);
int n;
cin >> n;
unordered_map<ll, ll> mp;
ll zero = 0;
for (int i = 0; i < n; i++) {
ll a;
cin >> a;
mp[a]++;
if (a == 0)
zero++;
}
if (zero == n) {
cout << "Yes" << endl;
return 0;
}
// x x 0 x x 0 x x 0 ...
if (!(n % 3) && mp.size() == 2 && zero == n / 3) {
bool ok = true;
for (auto m : mp) {
if (m.first != 0 && m.second != 2 * n / 3) {
ok = false;
}
}
if (ok) {
cout << "Yes" << endl;
return 0;
}
}
// x y z x y z x y z ...
if (!(n % 3) && mp.size() == 3) {
ll sum = 0;
bool ok = true;
for (auto m : mp) {
sum ^= m.first;
if (m.second != n / 3) {
ok = false;
break;
}
}
if (ok && sum == 0) {
cout << "Yes" << endl;
return 0;
}
}
cout << "No" << endl;
return 0;
}
| [
"control_flow.branch.if.condition.change"
] | 782,200 | 782,201 | u637771514 | cpp |
p02975 | #include <algorithm>
#include <bits/stdc++.h>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, x) for (int i = 0; i < x; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> ivec;
const ll N = 1e9 + 7;
int main() {
int n;
cin >> n;
vector<ll> a(n);
rep(i, n) cin >> a[i];
set<ll> st;
rep(i, n) { st.insert(a[i]); }
int st_size = st.size();
bool ok = false;
if (st_size == 1) {
auto itr = st.begin();
if (!*itr)
ok = true;
} else if (st_size == 2) {
if (n % 3 == 0) {
auto itr = st.begin();
int count = 0;
if (!*itr) {
rep(i, n) {
if (a[i] == 0)
count++;
}
}
if (count == n / 3)
ok = true;
}
} else if (st_size == 3) {
if (n % 3 == 0) {
auto itr = st.begin();
ll x, y, z;
x = *itr;
itr++;
y = *itr;
itr++;
z = *itr;
int count[3] = {};
if (x ^ y ^ z == 0) {
ok = true;
rep(i, n) {
if (a[i] == x)
count[0]++;
else if (a[i] == y)
count[1]++;
else
count[2]++;
}
rep(i, 3) {
if (count[i] != n / 3)
ok = false;
}
}
}
}
if (ok)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
} | #include <algorithm>
#include <bits/stdc++.h>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, x) for (int i = 0; i < x; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> ivec;
const ll N = 1e9 + 7;
int main() {
int n;
cin >> n;
vector<ll> a(n);
rep(i, n) cin >> a[i];
set<ll> st;
rep(i, n) { st.insert(a[i]); }
int st_size = st.size();
bool ok = false;
if (st_size == 1) {
auto itr = st.begin();
if (!*itr)
ok = true;
} else if (st_size == 2) {
if (n % 3 == 0) {
auto itr = st.begin();
int count = 0;
if (!*itr) {
rep(i, n) {
if (a[i] == 0)
count++;
}
}
if (count == n / 3)
ok = true;
}
} else if (st_size == 3) {
if (n % 3 == 0) {
auto itr = st.begin();
ll x, y, z;
x = *itr;
itr++;
y = *itr;
itr++;
z = *itr;
// cout << x << " " << y << " " << z << endl;
int count[3] = {};
if ((x ^ y ^ z) == 0) {
ok = true;
rep(i, n) {
if (a[i] == x)
count[0]++;
else if (a[i] == y)
count[1]++;
else
count[2]++;
}
rep(i, 3) {
if (count[i] != n / 3)
ok = false;
}
}
}
}
if (ok)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
} | [
"control_flow.branch.if.condition.change"
] | 782,205 | 782,206 | u899645116 | cpp |
p02975 | #include <algorithm>
#include <bits/stdc++.h>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, x) for (int i = 0; i < x; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> ivec;
const ll N = 1e9 + 7;
int main() {
int n;
cin >> n;
vector<int> a(n);
rep(i, n) cin >> a[i];
set<int> st;
rep(i, n) { st.insert(a[i]); }
int st_size = st.size();
bool ok = false;
if (st_size == 1) {
auto itr = st.begin();
if (!*itr)
ok = true;
} else if (st_size == 2) {
if (n % 3 == 0) {
auto itr = st.begin();
int count = 0;
if (!*itr) {
rep(i, n) {
if (a[i] == 0)
count++;
}
}
if (count == n / 3)
ok = true;
}
} else if (st_size == 3) {
if (n % 3 == 0) {
auto itr = st.begin();
int x, y, z;
x = *itr;
itr++;
y = *itr;
itr++;
z = *itr;
int count[3] = {};
if (x ^ y ^ z == 0) {
ok = true;
rep(i, n) {
if (a[i] == x)
count[0]++;
else if (a[i] == y)
count[1]++;
else
count[2]++;
}
rep(i, 3) {
if (count[i] != n / 3)
ok = false;
}
}
}
}
if (ok)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
} | #include <algorithm>
#include <bits/stdc++.h>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, x) for (int i = 0; i < x; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> ivec;
const ll N = 1e9 + 7;
int main() {
int n;
cin >> n;
vector<ll> a(n);
rep(i, n) cin >> a[i];
set<ll> st;
rep(i, n) { st.insert(a[i]); }
int st_size = st.size();
bool ok = false;
if (st_size == 1) {
auto itr = st.begin();
if (!*itr)
ok = true;
} else if (st_size == 2) {
if (n % 3 == 0) {
auto itr = st.begin();
int count = 0;
if (!*itr) {
rep(i, n) {
if (a[i] == 0)
count++;
}
}
if (count == n / 3)
ok = true;
}
} else if (st_size == 3) {
if (n % 3 == 0) {
auto itr = st.begin();
ll x, y, z;
x = *itr;
itr++;
y = *itr;
itr++;
z = *itr;
// cout << x << " " << y << " " << z << endl;
int count[3] = {};
if ((x ^ y ^ z) == 0) {
ok = true;
rep(i, n) {
if (a[i] == x)
count[0]++;
else if (a[i] == y)
count[1]++;
else
count[2]++;
}
rep(i, 3) {
if (count[i] != n / 3)
ok = false;
}
}
}
}
if (ok)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
} | [
"variable_declaration.type.change",
"control_flow.branch.if.condition.change"
] | 782,207 | 782,206 | u899645116 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template <class T> constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template <class T> constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char> T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char> T_char TU(T_char cX) { return toupper(cX); };
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);
}
const int vy[] = {-1, -1, -1, 0, 1, 1, 1, 0},
vx[] = {-1, 0, 1, 1, 1, 0, -1, -1};
const int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
int popcnt(unsigned long long n) {
int cnt = 0;
for (int i = 0; i < 64; i++)
if ((n >> i) & 1)
cnt++;
return cnt;
}
int d_sum(LL n) {
int ret = 0;
while (n > 0) {
ret += n % 10;
n /= 10;
}
return ret;
}
int d_cnt(LL n) {
int ret = 0;
while (n > 0) {
ret++;
n /= 10;
}
return ret;
}
LL gcd(LL a, LL b) {
if (b == 0)
return a;
return gcd(b, a % b);
};
LL lcm(LL a, LL b) {
LL g = gcd(a, b);
return a / g * b;
};
#define ALL(qpqpq) (qpqpq).begin(), (qpqpq).end()
#define UNIQUE(wpwpw) \
sort(ALL((wpwpw))); \
(wpwpw).erase(unique(ALL((wpwpw))), (wpwpw).end())
#define LOWER(epepe) transform(ALL((epepe)), (epepe).begin(), TL<char>)
#define UPPER(rprpr) transform(ALL((rprpr)), (rprpr).begin(), TU<char>)
#define FOR(i, tptpt, ypypy) for (LL i = (tptpt); i < (ypypy); i++)
#define REP(i, upupu) FOR(i, 0, upupu)
#define INIT \
std::ios::sync_with_stdio(false); \
std::cin.tie(0)
int n;
int a[101010];
map<int, int> mp;
int main() {
cin >> n;
REP(i, n) {
cin >> a[i];
mp[a[i]]++;
}
if (mp[0] == n) {
cout << "Yes" << endl;
} else if (n % 3 == 0) {
set<int> st;
REP(i, n) { st.insert(a[i]); }
if ((int)st.size() == 2) {
if (mp[0] != n / 3) {
cout << "No" << endl;
return 0;
}
REP(i, n) {
if (a[i] != 0) {
if (mp[a[i]] != n / 3 * 2) {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
}
} else if ((int)st.size() != 3) {
cout << "No" << endl;
} else {
LL num = 0;
for (auto it = st.begin(); it != st.end(); it++) {
if (mp[*it] != n / 3) {
cout << "No" << endl;
return 0;
}
num ^= *it;
}
if (num == 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
}
} else {
cout << "No" << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template <class T> constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template <class T> constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char> T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char> T_char TU(T_char cX) { return toupper(cX); };
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);
}
const int vy[] = {-1, -1, -1, 0, 1, 1, 1, 0},
vx[] = {-1, 0, 1, 1, 1, 0, -1, -1};
const int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
int popcnt(unsigned long long n) {
int cnt = 0;
for (int i = 0; i < 64; i++)
if ((n >> i) & 1)
cnt++;
return cnt;
}
int d_sum(LL n) {
int ret = 0;
while (n > 0) {
ret += n % 10;
n /= 10;
}
return ret;
}
int d_cnt(LL n) {
int ret = 0;
while (n > 0) {
ret++;
n /= 10;
}
return ret;
}
LL gcd(LL a, LL b) {
if (b == 0)
return a;
return gcd(b, a % b);
};
LL lcm(LL a, LL b) {
LL g = gcd(a, b);
return a / g * b;
};
#define ALL(qpqpq) (qpqpq).begin(), (qpqpq).end()
#define UNIQUE(wpwpw) \
sort(ALL((wpwpw))); \
(wpwpw).erase(unique(ALL((wpwpw))), (wpwpw).end())
#define LOWER(epepe) transform(ALL((epepe)), (epepe).begin(), TL<char>)
#define UPPER(rprpr) transform(ALL((rprpr)), (rprpr).begin(), TU<char>)
#define FOR(i, tptpt, ypypy) for (LL i = (tptpt); i < (ypypy); i++)
#define REP(i, upupu) FOR(i, 0, upupu)
#define INIT \
std::ios::sync_with_stdio(false); \
std::cin.tie(0)
int n;
int a[101010];
map<int, int> mp;
int main() {
cin >> n;
REP(i, n) {
cin >> a[i];
mp[a[i]]++;
}
if (mp[0] == n) {
cout << "Yes" << endl;
} else if (n % 3 == 0) {
set<int> st;
REP(i, n) { st.insert(a[i]); }
if ((int)st.size() == 2) {
if (mp[0] != n / 3) {
cout << "No" << endl;
return 0;
}
REP(i, n) {
if (a[i] != 0) {
if (mp[a[i]] != n / 3 * 2) {
cout << "No" << endl;
return 0;
}
}
}
cout << "Yes" << endl;
} else if ((int)st.size() != 3) {
cout << "No" << endl;
} else {
LL num = 0;
for (auto it = st.begin(); it != st.end(); it++) {
if (mp[*it] != n / 3) {
cout << "No" << endl;
return 0;
}
num ^= *it;
}
if (num == 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
}
} else {
cout << "No" << endl;
}
} | [] | 782,210 | 782,211 | u093922224 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
scanf("%d", &n);
map<int, int> occs;
for (int i = 0; i < n; ++i) {
int x;
scanf("%d", &x);
occs[x]++;
}
// a b a^b a b a^b a (= b)
// x x 0 x x 0
//
string answer = "No";
if (occs.count(0) > 0 && occs[0] == n)
answer = "Yes";
if (n % 3 == 0) {
bool allEqual = true;
int xorAll = 0;
if (occs.size() == 3) {
for (auto pp : occs) {
if (pp.second != n / 3)
allEqual = false;
xorAll ^= pp.first;
}
}
if (allEqual && (xorAll == 0))
answer = "Yes";
if (occs.size() == 2 && occs[0] == n / 3)
answer = "Yes";
}
printf("%s\n", answer.c_str());
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
scanf("%d", &n);
map<int, int> occs;
for (int i = 0; i < n; ++i) {
int x;
scanf("%d", &x);
occs[x]++;
}
// a b a^b a b a^b a (= b)
// x x 0 x x 0
//
string answer = "No";
if (occs.count(0) > 0 && occs[0] == n)
answer = "Yes";
if (n % 3 == 0) {
bool allEqual = true;
int xorAll = 0;
if (occs.size() == 3) {
for (auto pp : occs) {
if (pp.second != n / 3)
allEqual = false;
xorAll ^= pp.first;
}
} else
xorAll = 1;
if (allEqual && (xorAll == 0))
answer = "Yes";
if (occs.size() == 2 && occs[0] == n / 3)
answer = "Yes";
}
printf("%s\n", answer.c_str());
return 0;
}
| [
"control_flow.branch.else_if.replace.remove",
"control_flow.branch.if.replace.add",
"assignment.add"
] | 782,218 | 782,219 | u904217313 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
scanf("%d", &n);
map<int, int> occs;
for (int i = 0; i < n; ++i) {
int x;
scanf("%d", &x);
occs[x]++;
}
// a b a^b a b a^b a (= b)
// x x 0 x x 0
//
string answer = "No";
if (occs.count(0) > 0 && occs[0] == n)
answer = "Yes";
if (n % 3 == 0) {
bool allEqual = true;
int xorAll = 0;
if (occs.size() == 3) {
for (auto pp : occs) {
if (pp.second != n / 3)
allEqual = false;
xorAll ^= pp.first;
}
}
if (allEqual && (xorAll == 0))
answer = "Yes";
if (occs.size() == 2 || occs[0] == n / 3)
answer = "Yes";
}
printf("%s\n", answer.c_str());
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
scanf("%d", &n);
map<int, int> occs;
for (int i = 0; i < n; ++i) {
int x;
scanf("%d", &x);
occs[x]++;
}
// a b a^b a b a^b a (= b)
// x x 0 x x 0
//
string answer = "No";
if (occs.count(0) > 0 && occs[0] == n)
answer = "Yes";
if (n % 3 == 0) {
bool allEqual = true;
int xorAll = 0;
if (occs.size() == 3) {
for (auto pp : occs) {
if (pp.second != n / 3)
allEqual = false;
xorAll ^= pp.first;
}
} else
xorAll = 1;
if (allEqual && (xorAll == 0))
answer = "Yes";
if (occs.size() == 2 && occs[0] == n / 3)
answer = "Yes";
}
printf("%s\n", answer.c_str());
return 0;
}
| [
"control_flow.branch.else_if.replace.remove",
"control_flow.branch.if.replace.add",
"assignment.add",
"misc.opposites",
"control_flow.branch.if.condition.change"
] | 782,220 | 782,219 | u904217313 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
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.resize(unique(a.begin(), a.end()) - a.begin());
if (a.size() == 1 && a[0] == 0) {
cout << "Yes";
return 0;
}
if (n % 3) {
cout << "No";
return 0;
}
if (a.size() == 2 && cnt.count(0) && cnt[0] == n / 3) {
cout << "Yes";
return 0;
}
if (a.size() == 3 && a[0] ^ a[1] ^ a[2] == 0 && cnt[a[0]] == n / 3 &&
cnt[a[1]] == n / 3) {
cout << "Yes";
} else {
cout << "No";
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
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.resize(unique(a.begin(), a.end()) - a.begin());
if (a.size() == 1 && a[0] == 0) {
cout << "Yes";
return 0;
}
if (n % 3) {
cout << "No";
return 0;
}
if (a.size() == 2 && cnt.count(0) && cnt[0] == n / 3) {
cout << "Yes";
return 0;
}
if (a.size() == 3 && (a[0] ^ a[1] ^ a[2]) == 0 && cnt[a[0]] == n / 3 &&
cnt[a[1]] == n / 3) {
cout << "Yes";
} else {
cout << "No";
}
return 0;
} | [
"control_flow.branch.if.condition.change"
] | 782,227 | 782,228 | u537871123 | cpp |
p02975 | #include <algorithm>
#include <bitset>
#include <deque>
#include <iostream>
#include <iterator>
#include <map>
#include <set>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
int main() {
int n;
cin >> n;
vector<ll> camels(n);
set<int> xo;
for (int i = 0; i < n; i++) {
ll j;
cin >> j;
camels[i] = j;
xo.insert(j);
}
bool b = true;
sort(camels.begin(), camels.end());
if (n % 3 == 0) {
if ((camels[0] != camels[n / 3 - 1]) ||
(camels[n / 3] != camels[2 * n / 3 - 1]) ||
(camels[2 * n / 3] != camels[n - 1])) {
b = false;
}
if (xo.size() == 1) {
if (camels[0] == 0) {
cout << "Ye";
} else {
cout << "No";
}
} else if (xo.size() == 2 && b) {
ll num = 0;
for (int i = 0; i < camels.size(); i++) {
if (camels[i] == 0) {
num++;
}
}
if (num == n / 3) {
cout << "Yes";
} else {
cout << "No";
}
} else if (xo.size() == 3 && b) {
bool ans = true;
ll c = 0;
for (auto itr = xo.begin(); itr != xo.end(); itr++) {
c = c ^ *itr;
}
if (c != 0) {
ans = false;
}
if (ans) {
cout << "Yes";
} else {
cout << "No";
}
} else {
cout << "No";
}
}
else {
if (xo.size() == 1) {
if (camels[0] == 0) {
cout << "Yes";
}
} else {
cout << "No";
}
}
}
| #include <algorithm>
#include <bitset>
#include <deque>
#include <iostream>
#include <iterator>
#include <map>
#include <set>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
int main() {
int n;
cin >> n;
vector<ll> camels(n);
set<int> xo;
for (int i = 0; i < n; i++) {
ll j;
cin >> j;
camels[i] = j;
xo.insert(j);
}
bool b = true;
sort(camels.begin(), camels.end());
if (n % 3 == 0) {
if ((camels[0] != camels[n / 3 - 1]) ||
(camels[n / 3] != camels[2 * n / 3 - 1]) ||
(camels[2 * n / 3] != camels[n - 1])) {
b = false;
}
if (xo.size() == 1) {
if (camels[0] == 0) {
cout << "Yes";
} else {
cout << "No";
}
} else if (xo.size() == 2 && b) {
ll num = 0;
for (int i = 0; i < camels.size(); i++) {
if (camels[i] == 0) {
num++;
}
}
if (num == n / 3) {
cout << "Yes";
} else {
cout << "No";
}
} else if (xo.size() == 3 && b) {
bool ans = true;
ll c = 0;
for (auto itr = xo.begin(); itr != xo.end(); itr++) {
c = c ^ *itr;
}
if (c != 0) {
ans = false;
}
if (ans) {
cout << "Yes";
} else {
cout << "No";
}
} else {
cout << "No";
}
}
else {
if (xo.size() == 1) {
if (camels[0] == 0) {
cout << "Yes";
}
} else {
cout << "No";
}
}
}
| [
"literal.string.change",
"io.output.change"
] | 782,234 | 782,235 | u906095123 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD 1000000007
#define ff first
#define ss second
#define pb push_back
#define N 505
#define mod 998244353
ll gcd(ll a, ll b) { return (b == 0 ? a : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
ll bexp(ll a, ll b) {
ll res = 1;
while (b) {
if (b & 1) {
res = res * a % mod;
}
a = a * a % mod;
b >>= 1;
}
return res % mod;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
map<ll, ll> mi;
ll a[n];
for (int i = 0; i < n; ++i) {
cin >> a[i];
mi[a[i]]++;
}
// cout << mi.size() << "\n";
int f = 0;
if (mi[0] == n) {
cout << "Yes\n";
return 0;
}
if (n % 3 != 0) {
cout << "No\n";
return 0;
}
// if(mi.size() == 2)
// {
// ll k1 = mi.begin()->ff, l1 = mi.begin()->ss,
// k2 = mi.rbegin()->ff, l2 = mi.rbegin()->ss;
// if(l2 == 2 * l1 && l1 == 0)
// f = 1;
// else if(l1 == 2 * l2 && l2 == 0)
// f = 1;
// }
// else if(mi.size() == 3)
// {
vector<int> b;
for (auto e : mi) {
for (int i = 0; i < e.ss / (n / 3); ++i) {
b.pb(e.ff);
}
}
if (b.size() == 3 && (b[0] ^ b[1] ^ b[2] == 0))
// f = 1;
// // }
// if(f)
cout << "Yes\n";
else
cout << "No\n";
// vector<int> all;
// for (auto& p : mi) {
// for (int i = 0; i < p.second / (n / 3); i++) {
// all.push_back(p.first);
// }
// }
// if (all.size() == 3 && (all[0] ^ all[1] ^ all[2]) == 0) {
// cout << "Yes" << '\n';
// } else {
// cout << "No" << '\n';
// }
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD 1000000007
#define ff first
#define ss second
#define pb push_back
#define N 505
#define mod 998244353
ll gcd(ll a, ll b) { return (b == 0 ? a : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
ll bexp(ll a, ll b) {
ll res = 1;
while (b) {
if (b & 1) {
res = res * a % mod;
}
a = a * a % mod;
b >>= 1;
}
return res % mod;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
map<ll, ll> mi;
ll a[n];
for (int i = 0; i < n; ++i) {
cin >> a[i];
mi[a[i]]++;
}
// cout << mi.size() << "\n";
int f = 0;
if (mi[0] == n) {
cout << "Yes\n";
return 0;
}
if (n % 3 != 0) {
cout << "No\n";
return 0;
}
// if(mi.size() == 2)
// {
// ll k1 = mi.begin()->ff, l1 = mi.begin()->ss,
// k2 = mi.rbegin()->ff, l2 = mi.rbegin()->ss;
// if(l2 == 2 * l1 && l1 == 0)
// f = 1;
// else if(l1 == 2 * l2 && l2 == 0)
// f = 1;
// }
// else if(mi.size() == 3)
// {
vector<int> b;
for (auto e : mi) {
for (int i = 0; i < e.ss / (n / 3); ++i) {
b.pb(e.ff);
}
}
if (b.size() == 3 && (b[0] ^ b[1] ^ b[2]) == 0)
// f = 1;
// // }
// if(f)
cout << "Yes\n";
else
cout << "No\n";
// vector<int> all;
// for (auto& p : mi) {
// for (int i = 0; i < p.second / (n / 3); i++) {
// all.push_back(p.first);
// }
// }
// if (all.size() == 3 && (all[0] ^ all[1] ^ all[2]) == 0) {
// cout << "Yes" << '\n';
// } else {
// cout << "No" << '\n';
// }
return 0;
} | [
"control_flow.branch.if.condition.change"
] | 782,247 | 782,246 | u060049558 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD 1000000007
#define ff first
#define ss second
#define pb push_back
#define N 505
#define mod 998244353
ll gcd(ll a, ll b) { return (b == 0 ? a : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
ll bexp(ll a, ll b) {
ll res = 1;
while (b) {
if (b & 1) {
res = res * a % mod;
}
a = a * a % mod;
b >>= 1;
}
return res % mod;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
map<ll, ll> mi;
ll a[n];
for (int i = 0; i < n; ++i) {
cin >> a[i];
mi[a[i]]++;
}
// cout << mi.size() << "\n";
int f = 0;
if (mi[0] == n) {
cout << "Yes\n";
return 0;
}
if (n % 3 != 0) {
cout << "No\n";
return 0;
}
// if(mi.size() == 2)
// {
// ll k1 = mi.begin()->ff, l1 = mi.begin()->ss,
// k2 = mi.rbegin()->ff, l2 = mi.rbegin()->ss;
// if(l2 == 2 * l1 && l1 == 0)
// f = 1;
// else if(l1 == 2 * l2 && l2 == 0)
// f = 1;
// }
// else if(mi.size() == 3)
// {
vector<int> b;
for (auto e : mi) {
for (int i = 0; i < e.ss / (n / 3); ++i) {
b.pb(e.ff);
}
}
if (b.size() == 3 && (b[0] ^ b[1] == b[2]))
// f = 1;
// // }
// if(f)
cout << "Yes\n";
else
cout << "No\n";
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD 1000000007
#define ff first
#define ss second
#define pb push_back
#define N 505
#define mod 998244353
ll gcd(ll a, ll b) { return (b == 0 ? a : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
ll bexp(ll a, ll b) {
ll res = 1;
while (b) {
if (b & 1) {
res = res * a % mod;
}
a = a * a % mod;
b >>= 1;
}
return res % mod;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
map<ll, ll> mi;
ll a[n];
for (int i = 0; i < n; ++i) {
cin >> a[i];
mi[a[i]]++;
}
// cout << mi.size() << "\n";
int f = 0;
if (mi[0] == n) {
cout << "Yes\n";
return 0;
}
if (n % 3 != 0) {
cout << "No\n";
return 0;
}
// if(mi.size() == 2)
// {
// ll k1 = mi.begin()->ff, l1 = mi.begin()->ss,
// k2 = mi.rbegin()->ff, l2 = mi.rbegin()->ss;
// if(l2 == 2 * l1 && l1 == 0)
// f = 1;
// else if(l1 == 2 * l2 && l2 == 0)
// f = 1;
// }
// else if(mi.size() == 3)
// {
vector<int> b;
for (auto e : mi) {
for (int i = 0; i < e.ss / (n / 3); ++i) {
b.pb(e.ff);
}
}
if (b.size() == 3 && (b[0] ^ b[1] ^ b[2]) == 0)
// f = 1;
// // }
// if(f)
cout << "Yes\n";
else
cout << "No\n";
// vector<int> all;
// for (auto& p : mi) {
// for (int i = 0; i < p.second / (n / 3); i++) {
// all.push_back(p.first);
// }
// }
// if (all.size() == 3 && (all[0] ^ all[1] ^ all[2]) == 0) {
// cout << "Yes" << '\n';
// } else {
// cout << "No" << '\n';
// }
return 0;
} | [
"control_flow.branch.if.condition.change"
] | 782,248 | 782,246 | u060049558 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
const int MAXN = 1e5 + 5;
const int MOD = 1e9 + 7;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define FAIL0 \
{ \
cout << "0\n"; \
return 0; \
}
#define FAIL1 \
{ \
cout << "-1\n"; \
return 0; \
}
#define FAILNO \
{ \
cout << "No\n"; \
return 0; \
}
#define YES \
{ \
cout << "Yes\n"; \
return 0; \
}
int N;
map<int, int> M;
int main() {
#ifdef OJ
freopen("input.txt", "rt", stdin);
// freopen("output.txt", "wt", stdout);
#endif
ios::sync_with_stdio(false);
cin.tie(0);
cin >> N;
for (int i = 0; i < N; i++) {
int a;
cin >> a;
M[a]++;
}
if (M.size() > 3)
FAILNO;
if (M.size() == 1) {
auto it1 = M.begin();
if (it1->fi != 0)
FAILNO;
YES;
}
if (M.size() == 2) {
if (M.begin()->fi != 0)
FAILNO;
auto it1 = M.begin();
auto it2 = next(it1);
if (it1->se * 2 != it2->se)
FAILNO;
YES;
}
auto it1 = M.begin();
auto it2 = next(it1);
auto it3 = next(it2);
if (!(it1->se == it2->se && it2->se == it3->se))
FAILNO;
int a1 = it1->fi;
int a2 = it2->fi;
int a3 = it3->fi;
if (a1 ^ a2 != a3)
FAILNO;
YES;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
const int MAXN = 1e5 + 5;
const int MOD = 1e9 + 7;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define FAIL0 \
{ \
cout << "0\n"; \
return 0; \
}
#define FAIL1 \
{ \
cout << "-1\n"; \
return 0; \
}
#define FAILNO \
{ \
cout << "No\n"; \
return 0; \
}
#define YES \
{ \
cout << "Yes\n"; \
return 0; \
}
int N;
map<int, int> M;
int main() {
#ifdef OJ
freopen("input.txt", "rt", stdin);
// freopen("output.txt", "wt", stdout);
#endif
ios::sync_with_stdio(false);
cin.tie(0);
cin >> N;
for (int i = 0; i < N; i++) {
int a;
cin >> a;
M[a]++;
}
if (M.size() > 3)
FAILNO;
if (M.size() == 1) {
auto it1 = M.begin();
if (it1->fi != 0)
FAILNO;
YES;
}
if (M.size() == 2) {
if (M.begin()->fi != 0)
FAILNO;
auto it1 = M.begin();
auto it2 = next(it1);
if (it1->se * 2 != it2->se)
FAILNO;
YES;
}
auto it1 = M.begin();
auto it2 = next(it1);
auto it3 = next(it2);
if (!(it1->se == it2->se && it2->se == it3->se))
FAILNO;
int a1 = it1->fi;
int a2 = it2->fi;
int a3 = it3->fi;
if ((a1 ^ a2) != a3)
FAILNO;
YES;
return 0;
}
| [
"control_flow.branch.if.condition.change"
] | 782,249 | 782,250 | u066478371 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
const int MAXN = 1e5 + 5;
const int MOD = 1e9 + 7;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define FAIL0 \
{ \
cout << "0\n"; \
return 0; \
}
#define FAIL1 \
{ \
cout << "-1\n"; \
return 0; \
}
#define FAILNO \
{ \
cout << "No\n"; \
return 0; \
}
#define YES \
{ \
cout << "Yes\n"; \
return 0; \
}
int N;
map<int, int> M;
int main() {
#ifdef OJ
freopen("input.txt", "rt", stdin);
// freopen("output.txt", "wt", stdout);
#endif
ios::sync_with_stdio(false);
cin.tie(0);
cin >> N;
for (int i = 0; i < N; i++) {
int a;
cin >> a;
M[a]++;
}
if (M.size() > 3)
FAILNO;
if (M.size() == 0) {
auto it1 = M.begin();
if (it1->fi != 0)
FAILNO;
YES;
}
if (M.size() == 2) {
if (M.begin()->fi != 0)
FAILNO;
auto it1 = M.begin();
auto it2 = next(it1);
if (it1->se * 2 != it2->se)
FAILNO;
YES;
}
auto it1 = M.begin();
auto it2 = next(it1);
auto it3 = next(it2);
if (!(it1->se == it2->se && it2->se == it3->se))
FAILNO;
int a1 = it1->fi;
int a2 = it2->fi;
int a3 = it3->fi;
if (a1 ^ a2 != a3)
FAILNO;
YES;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
const int MAXN = 1e5 + 5;
const int MOD = 1e9 + 7;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define FAIL0 \
{ \
cout << "0\n"; \
return 0; \
}
#define FAIL1 \
{ \
cout << "-1\n"; \
return 0; \
}
#define FAILNO \
{ \
cout << "No\n"; \
return 0; \
}
#define YES \
{ \
cout << "Yes\n"; \
return 0; \
}
int N;
map<int, int> M;
int main() {
#ifdef OJ
freopen("input.txt", "rt", stdin);
// freopen("output.txt", "wt", stdout);
#endif
ios::sync_with_stdio(false);
cin.tie(0);
cin >> N;
for (int i = 0; i < N; i++) {
int a;
cin >> a;
M[a]++;
}
if (M.size() > 3)
FAILNO;
if (M.size() == 1) {
auto it1 = M.begin();
if (it1->fi != 0)
FAILNO;
YES;
}
if (M.size() == 2) {
if (M.begin()->fi != 0)
FAILNO;
auto it1 = M.begin();
auto it2 = next(it1);
if (it1->se * 2 != it2->se)
FAILNO;
YES;
}
auto it1 = M.begin();
auto it2 = next(it1);
auto it3 = next(it2);
if (!(it1->se == it2->se && it2->se == it3->se))
FAILNO;
int a1 = it1->fi;
int a2 = it2->fi;
int a3 = it3->fi;
if ((a1 ^ a2) != a3)
FAILNO;
YES;
return 0;
}
| [
"literal.number.change",
"control_flow.branch.if.condition.change"
] | 782,251 | 782,250 | u066478371 | cpp |
p02975 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define print(s) cout << s << endl
#define acc(v) accumulate(v.begin(), v.end(), 0)
#define cinv(n, v) rep(i, n) cin >> v[i]
using namespace std;
const int INF = 1e9;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
int x_pos[4] = {1, 0, -1, 0}, y_pos[4] = {0, 1, 0, -1};
int ctoi(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
return 0;
}
char upper(char c) { return c - 0x20; }
char lower(char c) { return c + 0x20; }
void unique_vector(vector<int> &v) {
sort(all(v));
v.erase(unique(all(v)), v.end());
}
// n次元配列の初期化。第2引数の型のサイズごとに初期化していく。
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
std::fill((T *)array, (T *)(array + N), val);
}
int main() {
int n;
cin >> n;
vector<int> cnt(50, 0), v(n);
rep(i, n) { cin >> v[i]; }
rep(i, n) {
for (int j = 0; j < 50; j++) {
if (v[i] & (1 << j))
cnt[j] = 1;
}
}
rep(i, 50) {
if (cnt[i] % 2 != 0) {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
}
| #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define print(s) cout << s << endl
#define acc(v) accumulate(v.begin(), v.end(), 0)
#define cinv(n, v) rep(i, n) cin >> v[i]
using namespace std;
const int INF = 1e9;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
int x_pos[4] = {1, 0, -1, 0}, y_pos[4] = {0, 1, 0, -1};
int ctoi(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
return 0;
}
char upper(char c) { return c - 0x20; }
char lower(char c) { return c + 0x20; }
void unique_vector(vector<int> &v) {
sort(all(v));
v.erase(unique(all(v)), v.end());
}
// n次元配列の初期化。第2引数の型のサイズごとに初期化していく。
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
std::fill((T *)array, (T *)(array + N), val);
}
int main() {
int n;
cin >> n;
vector<int> cnt(50, 0), v(n);
rep(i, n) { cin >> v[i]; }
rep(i, n) {
for (int j = 0; j < 50; j++) {
if (v[i] & (1 << j))
cnt[j] += 1;
}
}
rep(i, 50) {
if (cnt[i] % 2 != 0) {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
}
| [
"assignment.value.change"
] | 782,257 | 782,258 | u130834452 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
const int N = 100010;
int a[N];
// 36 - 38 - idea
// 39 - 41 - how to code
int main() {
int n;
scanf("%d", &n);
map<int, int> mp;
vector<int> v;
for (int i = 0; i < n; ++i) {
scanf("%d", &a[i]);
mp[a[i]]++;
v.push_back(a[i]);
}
sort(v.begin(), v.end());
v.erase(unique(v.begin(), v.end()), v.end());
if (v.size() >= 4) {
puts("No");
} else if (v.size() == 3) {
int ok = (mp[v[0]] == mp[v[1]]);
ok = (ok & (mp[v[1]] == mp[v[2]]));
ok = (ok & ((v[0] ^ v[1]) == v[2]));
if (ok) {
puts("Yes");
} else {
puts("No");
}
} else if (v.size() == 2) {
int ok = (mp[v[0]] == 2 * mp[v[1]]);
ok = (ok & (v[0] == 0));
if (ok) {
puts("Yes");
} else {
puts("No");
}
} else if (v.size() == 1) {
int ok = (v[0] == 0);
if (ok) {
puts("Yes");
} else {
puts("No");
}
}
} | #include <bits/stdc++.h>
using namespace std;
const int N = 100010;
int a[N];
// 36 - 38 - idea
// 39 - 41 - how to code
int main() {
int n;
scanf("%d", &n);
map<int, int> mp;
vector<int> v;
for (int i = 0; i < n; ++i) {
scanf("%d", &a[i]);
mp[a[i]]++;
v.push_back(a[i]);
}
sort(v.begin(), v.end());
v.erase(unique(v.begin(), v.end()), v.end());
if (v.size() >= 4) {
puts("No");
} else if (v.size() == 3) {
int ok = (mp[v[0]] == mp[v[1]]);
ok = (ok & (mp[v[1]] == mp[v[2]]));
ok = (ok & ((v[0] ^ v[1]) == v[2]));
if (ok) {
puts("Yes");
} else {
puts("No");
}
} else if (v.size() == 2) {
int ok = (2 * mp[v[0]] == mp[v[1]]);
ok = (ok & (v[0] == 0));
if (ok) {
puts("Yes");
} else {
puts("No");
}
} else if (v.size() == 1) {
int ok = (v[0] == 0);
if (ok) {
puts("Yes");
} else {
puts("No");
}
}
} | [
"expression.operation.binary.remove"
] | 782,259 | 782,260 | u939637096 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
const int N = 100010;
int a[N];
// 36 - 38 - idea
// 39 - 41 - how to code
int main() {
int n;
scanf("%d", &n);
map<int, int> mp;
vector<int> v;
for (int i = 0; i < n; ++i) {
scanf("%d", &a[i]);
mp[a[i]]++;
v.push_back(a[i]);
}
sort(v.begin(), v.end());
v.erase(unique(v.begin(), v.end()), v.end());
if (v.size() >= 4) {
puts("No");
} else if (v.size() == 3) {
int ok = (mp[v[0]] == mp[v[1]]);
ok = (ok & (mp[v[1]] == mp[v[2]]));
ok = (ok & ((v[0] ^ v[1]) == v[2]));
if (ok) {
puts("Yes");
} else {
puts("No");
}
} else if (v.size() == 2) {
int ok = (mp[v[0]] == mp[v[1]]);
ok = (ok & (v[0] == 0));
if (ok) {
puts("Yes");
} else {
puts("No");
}
} else if (v.size() == 1) {
int ok = (v[0] == 0);
if (ok) {
puts("Yes");
} else {
puts("No");
}
}
} | #include <bits/stdc++.h>
using namespace std;
const int N = 100010;
int a[N];
// 36 - 38 - idea
// 39 - 41 - how to code
int main() {
int n;
scanf("%d", &n);
map<int, int> mp;
vector<int> v;
for (int i = 0; i < n; ++i) {
scanf("%d", &a[i]);
mp[a[i]]++;
v.push_back(a[i]);
}
sort(v.begin(), v.end());
v.erase(unique(v.begin(), v.end()), v.end());
if (v.size() >= 4) {
puts("No");
} else if (v.size() == 3) {
int ok = (mp[v[0]] == mp[v[1]]);
ok = (ok & (mp[v[1]] == mp[v[2]]));
ok = (ok & ((v[0] ^ v[1]) == v[2]));
if (ok) {
puts("Yes");
} else {
puts("No");
}
} else if (v.size() == 2) {
int ok = (2 * mp[v[0]] == mp[v[1]]);
ok = (ok & (v[0] == 0));
if (ok) {
puts("Yes");
} else {
puts("No");
}
} else if (v.size() == 1) {
int ok = (v[0] == 0);
if (ok) {
puts("Yes");
} else {
puts("No");
}
}
} | [
"assignment.change"
] | 782,261 | 782,260 | u939637096 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
long long n;
vector<long long> a, s;
map<long long, long long> mp;
bool solve();
int main() {
cin >> n;
a.resize(n);
for (int i = 0; i < n; ++i)
cin >> a[i];
if (solve())
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
}
bool solve() {
for (int i = 0; i < n; ++i)
++mp[a[i]];
sort(a.begin(), a.end());
a.erase(unique(a.begin(), a.end()), a.end());
if (mp.size() == 1 && a[0] == 0)
return 1;
if (mp.size() == 2) {
if (n % 3 == 0 && a[0] == 0 && mp[a[0]] == n / 3)
return 1;
else
return 0;
}
if (mp.size() != 3)
return 0;
if ((a[0] ^ a[1] ^ a[2]) == 0)
return 0;
if (n % 3 == 0 && mp[a[0]] == n / 3 && mp[a[1]] == n / 3 && mp[a[2]] == n / 3)
return 1;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
long long n;
vector<long long> a, s;
map<long long, long long> mp;
bool solve();
int main() {
cin >> n;
a.resize(n);
for (int i = 0; i < n; ++i)
cin >> a[i];
if (solve())
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
}
bool solve() {
for (int i = 0; i < n; ++i)
++mp[a[i]];
sort(a.begin(), a.end());
a.erase(unique(a.begin(), a.end()), a.end());
if (mp.size() == 1 && a[0] == 0)
return 1;
if (mp.size() == 2) {
if (n % 3 == 0 && a[0] == 0 && mp[a[0]] == n / 3)
return 1;
else
return 0;
}
if (mp.size() != 3)
return 0;
if ((a[0] ^ a[1] ^ a[2]) != 0)
return 0;
if (n % 3 == 0 && mp[a[0]] == n / 3 && mp[a[1]] == n / 3 && mp[a[2]] == n / 3)
return 1;
return 0;
}
| [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 782,264 | 782,265 | u269963329 | cpp |
p02975 | // --------------------<optimizations>--------------------
#pragma GCC optimize("O3")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair<ll, ll>
#define vpii vector<pair<ll, ll>>
#define F first
#define S second
#define ld long double
#define built __builtin_popcountll
#define mst(a, i) memset(a, i, sizeof(a))
#define all(x) x.begin(), x.end()
#define itit(it, a) for (auto it = (a).begin(); it != (a).end(); it++)
#define rep(i, a, b) for (ll i = a; i < b; i++)
#define repr(i, a, b) for (ll i = a; i > b; i--)
#define reprr(i, a, b) for (ll i = a; i >= b; i--)
#define pi 3.14159265358979323846264338327950288419716939937510582097494459230
ll max3(ll x, ll y, ll z) { return max(max(x, y), z); }
ll min3(ll x, ll y, ll z) { return min(min(x, y), z); }
const ll M = 2e5 + 10, M2 = 1e6 + 10, mod = 1e9 + 7, inf = 1e17 + 10;
void add(int &a, int b) {
a += b;
if (a >= mod) {
a -= mod;
}
}
#define trace1(x) cerr << #x << ": " << x << endl
#define trace2(x, y) cerr << #x << ": " << x << " " << #y << ": " << y << endl
#define trace3(x, y, z) \
cerr << #x << ":" << x << " | " << #y << ": " << y << " | " << #z << ": " \
<< z << endl
#define trace4(a, b, c, d) \
cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " \
<< c << " | " << #d << ": " << d << endl
#define trace5(a, b, c, d, e) \
cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " \
<< c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl
#define trace6(a, b, c, d, e, f) \
cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " \
<< c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " \
<< #f << ": " << f << endl
int X[] = {0, 1, 0, -1};
int Y[] = {-1, 0, 1, 0};
ll power(ll x, ll n) {
ll result = 1;
while (n > 0) {
if (n % 2 == 1)
result = (result * x) % mod;
x = ((x % mod) * (x % mod)) % mod;
n = n / 2;
}
return result;
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll n;
cin >> n;
ll a[n];
ll xo = 0;
rep(i, 0, n) {
cin >> a[i];
xo ^= a[i];
}
if (xo == 0)
cout << "YES";
else
cout << "NO";
return 0;
}
| // --------------------<optimizations>--------------------
#pragma GCC optimize("O3")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair<ll, ll>
#define vpii vector<pair<ll, ll>>
#define F first
#define S second
#define ld long double
#define built __builtin_popcountll
#define mst(a, i) memset(a, i, sizeof(a))
#define all(x) x.begin(), x.end()
#define itit(it, a) for (auto it = (a).begin(); it != (a).end(); it++)
#define rep(i, a, b) for (ll i = a; i < b; i++)
#define repr(i, a, b) for (ll i = a; i > b; i--)
#define reprr(i, a, b) for (ll i = a; i >= b; i--)
#define pi 3.14159265358979323846264338327950288419716939937510582097494459230
ll max3(ll x, ll y, ll z) { return max(max(x, y), z); }
ll min3(ll x, ll y, ll z) { return min(min(x, y), z); }
const ll M = 2e5 + 10, M2 = 1e6 + 10, mod = 1e9 + 7, inf = 1e17 + 10;
void add(int &a, int b) {
a += b;
if (a >= mod) {
a -= mod;
}
}
#define trace1(x) cerr << #x << ": " << x << endl
#define trace2(x, y) cerr << #x << ": " << x << " " << #y << ": " << y << endl
#define trace3(x, y, z) \
cerr << #x << ":" << x << " | " << #y << ": " << y << " | " << #z << ": " \
<< z << endl
#define trace4(a, b, c, d) \
cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " \
<< c << " | " << #d << ": " << d << endl
#define trace5(a, b, c, d, e) \
cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " \
<< c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl
#define trace6(a, b, c, d, e, f) \
cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " \
<< c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " \
<< #f << ": " << f << endl
int X[] = {0, 1, 0, -1};
int Y[] = {-1, 0, 1, 0};
ll power(ll x, ll n) {
ll result = 1;
while (n > 0) {
if (n % 2 == 1)
result = (result * x) % mod;
x = ((x % mod) * (x % mod)) % mod;
n = n / 2;
}
return result;
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll n;
cin >> n;
ll a[n];
ll xo = 0;
rep(i, 0, n) {
cin >> a[i];
xo ^= a[i];
}
if (xo == 0)
cout << "Yes";
else
cout << "No";
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 782,266 | 782,267 | u394634573 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
vector<ll> a(n);
bool f0 = true;
for (int i = 0; i < n; i++) {
cin >> a[i];
if (a[i] != 0)
f0 = false;
}
if (f0) {
cout << "Yes" << endl;
return 0;
}
if (n % 3 != 0) {
cout << "No" << endl;
return 0;
}
map<ll, int> cnt;
for (ll x : a)
cnt[x]++;
if (cnt.size() > 3) {
cout << "No" << endl;
} else if (cnt.size() == 1) {
cout << (a[0] == 0 ? "Yes" : "No") << endl;
} else if (cnt.size() == 2) {
vector<ll> v;
for (auto &p : cnt)
v.push_back(p.first);
if (v[0] == 0) {
cout << (cnt[v[1]] == cnt[v[0]] * 2 ? "Yes" : "No") << endl;
} else if (v[1] == 0) {
cout << (cnt[v[0]] == cnt[v[1]] * 2 ? "Yes" : "No") << endl;
} else {
cout << "No" << endl;
}
} else {
vector<ll> v;
for (auto &p : cnt)
v.push_back(p.first);
if (v[0] ^ v[1] == v[2]) {
cout << ((cnt[v[0]] == cnt[v[1]] && cnt[v[1]] == cnt[v[2]]) ? "Yes"
: "No")
<< endl;
} else {
cout << "No" << endl;
}
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
vector<ll> a(n);
bool f0 = true;
for (int i = 0; i < n; i++) {
cin >> a[i];
if (a[i] != 0)
f0 = false;
}
if (f0) {
cout << "Yes" << endl;
return 0;
}
if (n % 3 != 0) {
cout << "No" << endl;
return 0;
}
map<ll, int> cnt;
for (ll x : a)
cnt[x]++;
if (cnt.size() > 3) {
cout << "No" << endl;
} else if (cnt.size() == 1) {
cout << (a[0] == 0 ? "Yes" : "No") << endl;
} else if (cnt.size() == 2) {
vector<ll> v;
for (auto &p : cnt)
v.push_back(p.first);
if (v[0] == 0) {
cout << (cnt[v[1]] == cnt[v[0]] * 2 ? "Yes" : "No") << endl;
} else if (v[1] == 0) {
cout << (cnt[v[0]] == cnt[v[1]] * 2 ? "Yes" : "No") << endl;
} else {
cout << "No" << endl;
}
} else {
vector<ll> v;
for (auto &p : cnt)
v.push_back(p.first);
if ((v[0] ^ v[1]) == v[2]) {
cout << ((cnt[v[0]] == cnt[v[1]] && cnt[v[1]] == cnt[v[2]]) ? "Yes"
: "No")
<< endl;
} else {
cout << "No" << endl;
}
}
return 0;
} | [
"control_flow.branch.if.condition.change"
] | 782,268 | 782,269 | u553623615 | cpp |
p02975 | #include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define REP(i, n) FOR(i, 0, n)
using namespace std;
int main() {
int n;
cin >> n;
int cnt;
REP(i, n) {
int temp;
cin >> temp;
if (i == 0) {
cnt == temp;
} else {
cnt ^= temp;
}
}
if (cnt == 0)
cout << "Yes" << endl;
else
cout << "No" << endl;
}
| #include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define REP(i, n) FOR(i, 0, n)
using namespace std;
int main() {
int n;
cin >> n;
int cnt;
REP(i, n) {
int temp;
cin >> temp;
if (i == 0) {
cnt = temp;
} else {
cnt ^= temp;
}
}
if (cnt == 0)
cout << "Yes" << endl;
else
cout << "No" << endl;
} | [
"expression.operation.compare.replace.remove",
"assignment.replace.add",
"misc.typo"
] | 782,272 | 782,273 | u538853954 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define siz(v) (ll)(v).size()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repn(i, n) for (ll i = 0; i <= (ll)(n); i++)
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
// cin.tie(0);
// ios::sync_with_stdio(false);
signed main() {
ll n;
cin >> n;
bool ans = true;
vector<ll> a(n);
rep(i, n) {
cin >> a[i];
if (a[i] != 0)
ans = false;
}
sort(all(a));
if (ans == true) {
cout << "Yes" << endl;
return 0;
} // OK
if (n % 3 != 0) { // OK
cout << "No" << endl;
} else { // OK
if (a[0] == a[-1 + n / 3] && a[n / 3] == a[2 * n / 3 - 1] &&
a[2 * n / 3] == a[n - 1] && a[0] ^ a[n - 1] == a[n / 3] &&
a[0] ^ a[n / 3] == a[n - 1] && a[n - 1] ^ a[n / 3] == a[0]) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
}
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define siz(v) (ll)(v).size()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repn(i, n) for (ll i = 0; i <= (ll)(n); i++)
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
// cin.tie(0);
// ios::sync_with_stdio(false);
signed main() {
ll n;
cin >> n;
bool ans = true;
vector<ll> a(n);
rep(i, n) {
cin >> a[i];
if (a[i] != 0)
ans = false;
}
sort(all(a));
if (ans == true) {
cout << "Yes" << endl;
return 0;
} // OK
if (n % 3 != 0) { // OK
cout << "No" << endl;
} else { // OK
if (a[0] == a[-1 + n / 3] && a[n / 3] == a[2 * n / 3 - 1] &&
a[2 * n / 3] == a[n - 1] && (a[0] ^ a[n - 1]) == a[n / 3] &&
(a[0] ^ a[n / 3]) == a[n - 1] && (a[n - 1] ^ a[n / 3]) == a[0]) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
}
} | [
"control_flow.branch.if.condition.change"
] | 782,285 | 782,286 | u317711717 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> v(n);
int a, b, c, ax = 0, bx = 0, cx = 0, x = 1;
string ans = "No";
for (int i = 0; i < n; i++) {
cin >> v[i];
}
sort(v.begin(), v.end());
a = v[0];
ax++;
for (int i = 1; i < n; i++) {
if (v[i - 1] != v[i]) {
x++;
}
if (x == 1) {
ax++;
}
if (x == 2) {
b = v[i];
bx++;
}
if (x == 3) {
c = v[i];
cx++;
}
}
if ((x == 1) && (a == 0))
ans = "Yes";
if ((x == 2) && (a == 0) && (ax == bx))
ans = "Yes";
if (x == 3) {
if (((a | b) - (a & b) == c) && ((b | c) - (b & c) == a) &&
((c | a) - (c & a) == b)) {
if (ax == bx && bx == cx && cx == ax) {
ans = "Yes";
}
if (a == 0) {
ans = "No";
}
}
}
cout << ans << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> v(n);
int a, b, c, ax = 0, bx = 0, cx = 0, x = 1;
string ans = "No";
for (int i = 0; i < n; i++) {
cin >> v[i];
}
sort(v.begin(), v.end());
a = v[0];
ax++;
for (int i = 1; i < n; i++) {
if (v[i - 1] != v[i]) {
x++;
}
if (x == 1) {
ax++;
}
if (x == 2) {
b = v[i];
bx++;
}
if (x == 3) {
c = v[i];
cx++;
}
}
if ((x == 1) && (a == 0))
ans = "Yes";
if ((x == 2) && (a == 0) && (2 * ax == bx))
ans = "Yes";
if (x == 3) {
if (((a | b) - (a & b) == c) && ((b | c) - (b & c) == a) &&
((c | a) - (c & a) == b)) {
if (ax == bx && bx == cx && cx == ax) {
ans = "Yes";
}
if (a == 0) {
ans = "No";
}
}
}
cout << ans << endl;
}
| [
"control_flow.branch.if.condition.change"
] | 782,287 | 782,288 | u249546633 | cpp |
p02975 | #include <algorithm>
#include <iostream>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
typedef long long int64;
int main(void) {
int64 N;
cin >> N;
vector<int64> a(N);
vector<int64> num;
int64 num0 = 0, num1 = 0, num2 = 0;
for (int64 i = 0; i < N; i++) {
cin >> a[i];
}
num.push_back(a[0]);
if (N % 3 != 0) {
for (int64 i = 0; i < N; i++) {
if (a[i] != 0) {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
return 0;
} else {
for (int64 i = 0; i < N; i++) {
if (a[i] == num[0]) {
num0++;
} else {
if (num.size() <= 1) {
num.push_back(a[i]);
}
if (a[i] == num[1]) {
num1++;
} else {
if (num.size() <= 2) {
num.push_back(a[i]);
}
if (a[i] == num[2]) {
num2++;
}
}
}
}
if (num0 == N / 3 && num1 == N / 3 && num2 == N / 3) {
if (num[0] ^ num[1] == num[2]) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
} else if (num0 == 2 * N / 3 && num1 == N / 3) {
if (num[1] == 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
} else if (num0 == N / 3 && num1 == 2 * N / 3) {
if (num[0] == 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
} else if (num0 == N) {
if (num[0] == 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
} else {
cout << "No" << endl;
}
}
return 0;
} | #include <algorithm>
#include <iostream>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
typedef long long int64;
int main(void) {
int64 N;
cin >> N;
vector<int64> a(N);
vector<int64> num;
int64 num0 = 0, num1 = 0, num2 = 0;
for (int64 i = 0; i < N; i++) {
cin >> a[i];
}
num.push_back(a[0]);
if (N % 3 != 0) {
for (int64 i = 0; i < N; i++) {
if (a[i] != 0) {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
return 0;
} else {
for (int64 i = 0; i < N; i++) {
if (a[i] == num[0]) {
num0++;
} else {
if (num.size() <= 1) {
num.push_back(a[i]);
}
if (a[i] == num[1]) {
num1++;
} else {
if (num.size() <= 2) {
num.push_back(a[i]);
}
if (a[i] == num[2]) {
num2++;
}
}
}
}
if (num0 == N / 3 && num1 == N / 3 && num2 == N / 3) {
if ((num[0] ^ num[1]) == num[2]) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
} else if (num0 == 2 * N / 3 && num1 == N / 3) {
if (num[1] == 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
} else if (num0 == N / 3 && num1 == 2 * N / 3) {
if (num[0] == 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
} else if (num0 == N) {
if (num[0] == 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
} else {
cout << "No" << endl;
}
}
return 0;
} | [
"control_flow.branch.if.condition.change"
] | 782,289 | 782,290 | u647569169 | cpp |
p02975 | #include <algorithm>
#include <iostream>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
typedef long long int64;
int main(void) {
int64 N;
cin >> N;
vector<int64> a(N);
vector<int64> num;
int64 num0 = 0, num1 = 0, num2 = 0;
for (int64 i = 0; i < N; i++) {
cin >> a[i];
}
num.push_back(a[0]);
if (N % 3 != 0) {
for (int64 i = 0; i < N; i++) {
if (a[i] != 0) {
cout << "No" << endl;
return 0;
}
cout << "Yes" << endl;
return 0;
}
} else {
for (int64 i = 0; i < N; i++) {
if (a[i] == num[0]) {
num0++;
} else {
if (num.size() <= 1) {
num.push_back(a[i]);
}
if (a[i] == num[1]) {
num1++;
} else {
if (num.size() <= 2) {
num.push_back(a[i]);
}
if (a[i] == num[2]) {
num2++;
}
}
}
}
// if(
// (num0==N/3&&num1==N/3&&num2==N/3)||
// (num0==2*N/3&&num1==N/3)||
// (num0==N/3&&num1==2*N/3)||
// num0==N
// ){
// if(num.size()==1){
// if(num[0]==0){
// cout<<"Yes"<<endl;
// }else{
// cout<<"No"<<endl;
// }
// }else if(num.size()==2){
// if(num[0]==0||num[1]==0){
// cout<<"Yes"<<endl;
// }else{
// cout<<"No"<<endl;
// }
// }else{
// if(num[0]^num[1]==num[2]){
// cout<<"Yes"<<endl;
// }else{
// cout<<"No"<<endl;
// }
// }
// cout<<"Yes"<<endl;
// }else{
// cout<<"No"<<endl;
// }
if (num0 == N / 3 && num1 == N / 3 && num2 == N / 3) {
if (num[0] ^ num[1] == num[2]) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
} else if (num0 == 2 * N / 3 && num1 == N / 3) {
if (num[1] == 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
} else if (num0 == N / 3 && num1 == 2 * N / 3) {
if (num[0] == 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
} else if (num0 == N) {
if (num[0] == 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
} else {
cout << "No" << endl;
}
}
return 0;
} | #include <algorithm>
#include <iostream>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
typedef long long int64;
int main(void) {
int64 N;
cin >> N;
vector<int64> a(N);
vector<int64> num;
int64 num0 = 0, num1 = 0, num2 = 0;
for (int64 i = 0; i < N; i++) {
cin >> a[i];
}
num.push_back(a[0]);
if (N % 3 != 0) {
for (int64 i = 0; i < N; i++) {
if (a[i] != 0) {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
return 0;
} else {
for (int64 i = 0; i < N; i++) {
if (a[i] == num[0]) {
num0++;
} else {
if (num.size() <= 1) {
num.push_back(a[i]);
}
if (a[i] == num[1]) {
num1++;
} else {
if (num.size() <= 2) {
num.push_back(a[i]);
}
if (a[i] == num[2]) {
num2++;
}
}
}
}
if (num0 == N / 3 && num1 == N / 3 && num2 == N / 3) {
if ((num[0] ^ num[1]) == num[2]) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
} else if (num0 == 2 * N / 3 && num1 == N / 3) {
if (num[1] == 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
} else if (num0 == N / 3 && num1 == 2 * N / 3) {
if (num[0] == 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
} else if (num0 == N) {
if (num[0] == 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
} else {
cout << "No" << endl;
}
}
return 0;
} | [
"control_flow.branch.if.condition.change"
] | 782,291 | 782,290 | u647569169 | cpp |
p02975 | #include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll n, a[100008];
int main() {
cin >> n;
map<ll, ll> mp;
string ans = "No";
for (ll i = 0; i < n; i++) {
cin >> a[i];
auto itr = mp.find(a[i]);
if (itr != mp.end()) {
itr->second = itr->second + 1;
} else {
mp[a[i]] = 1;
}
}
if (mp.size() == 3) {
auto itr = mp.begin();
ll a = itr->first;
ll ca = itr->second;
itr++;
ll b = itr->first;
ll cb = itr->second;
itr++;
ll c = itr->first;
ll cc = itr->second;
if (ca == cb && cb == cc) {
ans = "Yes";
for (ll k = 0; k <= 50; k++) {
bool ba = a & (1 << k);
bool bb = b & (1 << k);
bool bc = c & (1 << k);
if ((ba && bb && bc) && (!ba && !bb && bc) && (ba && !bb && !bc) &&
(!ba && bb && !bc)) {
ans = "No";
}
}
}
}
if (mp.size() == 2) {
auto itr = mp.begin();
ll a = itr->first;
ll ca = itr->second;
itr++;
ll b = itr->first;
ll cb = itr->second;
if ((2 * ca == cb && a == 0) || (ca == 2 * cb && b == 0)) {
ans = "Yes";
}
}
if (mp.size() == 1) {
auto itr = mp.begin();
ll a = itr->first;
if (a == 0) {
ans = "Yes";
}
}
cout << ans << endl;
return 0;
} | #include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll n, a[100008];
int main() {
cin >> n;
map<ll, ll> mp;
string ans = "No";
for (ll i = 0; i < n; i++) {
cin >> a[i];
auto itr = mp.find(a[i]);
if (itr != mp.end()) {
itr->second = itr->second + 1;
} else {
mp[a[i]] = 1;
}
}
if (mp.size() == 3) {
auto itr = mp.begin();
ll a = itr->first;
ll ca = itr->second;
itr++;
ll b = itr->first;
ll cb = itr->second;
itr++;
ll c = itr->first;
ll cc = itr->second;
if (ca == cb && cb == cc) {
ans = "Yes";
for (ll k = 0; k <= 50; k++) {
bool ba = a & (1 << k);
bool bb = b & (1 << k);
bool bc = c & (1 << k);
if ((ba && bb && bc) || (!ba && !bb && bc) || (ba && !bb && !bc) ||
(!ba && bb && !bc)) {
ans = "No";
}
}
}
}
if (mp.size() == 2) {
auto itr = mp.begin();
ll a = itr->first;
ll ca = itr->second;
itr++;
ll b = itr->first;
ll cb = itr->second;
if ((2 * ca == cb && a == 0) || (ca == 2 * cb && b == 0)) {
ans = "Yes";
}
}
if (mp.size() == 1) {
auto itr = mp.begin();
ll a = itr->first;
if (a == 0) {
ans = "Yes";
}
}
cout << ans << endl;
return 0;
} | [
"misc.opposites",
"control_flow.branch.if.condition.change"
] | 782,304 | 782,305 | u388697579 | cpp |
p02975 | #include <bits/stdc++.h>
#define REP(x, y, z) for (int x = y; x <= z; x++)
#define FORD(x, y, z) for (int x = y; x >= z; x--)
#define MSET(x, y) memset(x, y, sizeof(x))
#define FOR(x, y) for (__typeof(y.begin()) x = y.begin(); x != y.end(); x++)
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define SZ size()
#define M 100005
void RI() {}
template <typename... T> void RI(int &head, T &...tail) {
scanf("%d", &head);
RI(tail...);
}
using namespace std;
typedef long long LL;
int arr[M];
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++)
cin >> arr[i];
sort(arr, arr + n);
vector<pair<int, int>> v;
for (int i = 0; i < n;) {
int j = i + 1;
while (j < n && arr[j] == arr[i])
j++;
v.push_back(make_pair(arr[i], j - i));
i = j;
}
bool ans = false;
int len = v.size();
if (len == 1 && v[0].first == 0)
ans = true;
else if (len == 2 && n % 3 == 0 && v[0].first == 0 &&
v[0].second * 2 == v[1].second)
ans = true;
else if (len == 3 && n % 3 == 0 && v[0].first ^ v[1].first == v[2].first &&
v[0].second == v[1].second && v[1].second == v[2].second)
ans = true;
if (ans)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
}
| #include <bits/stdc++.h>
#define REP(x, y, z) for (int x = y; x <= z; x++)
#define FORD(x, y, z) for (int x = y; x >= z; x--)
#define MSET(x, y) memset(x, y, sizeof(x))
#define FOR(x, y) for (__typeof(y.begin()) x = y.begin(); x != y.end(); x++)
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define SZ size()
#define M 100005
void RI() {}
template <typename... T> void RI(int &head, T &...tail) {
scanf("%d", &head);
RI(tail...);
}
using namespace std;
typedef long long LL;
int arr[M];
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++)
cin >> arr[i];
sort(arr, arr + n);
vector<pair<int, int>> v;
for (int i = 0; i < n;) {
int j = i + 1;
while (j < n && arr[j] == arr[i])
j++;
v.push_back(make_pair(arr[i], j - i));
i = j;
}
bool ans = false;
int len = v.size();
if (len == 1 && v[0].first == 0)
ans = true;
else if (len == 2 && n % 3 == 0 && v[0].first == 0 &&
v[0].second * 2 == v[1].second)
ans = true;
else if (len == 3 && n % 3 == 0 && (v[0].first ^ v[1].first) == v[2].first &&
v[0].second == v[1].second && v[1].second == v[2].second)
ans = true;
if (ans)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
}
| [
"control_flow.branch.if.condition.change"
] | 782,310 | 782,311 | u978434688 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
int n;
bool solve() {
int i, j;
string str;
cin >> n;
vector<int> a(n);
for (i = 0; i < n; i++) {
cin >> a[i];
}
sort(a.begin(), a.end());
vector<pair<int, int>> ct;
ct.push_back(make_pair(a[0], 1));
for (i = 1; i < n; i++) {
if (a[i] == a[i - 1])
ct[ct.size() - 1].second += 1;
else
ct.push_back(make_pair(a[i], 1));
}
if (ct.size() == 3 && n % 3 == 0) {
if (ct[0].second == ct[1].second && ct[1].second == ct[2].second &&
ct[0].first ^ ct[1].first == ct[2].first)
return true;
}
if (ct.size() == 2 && n % 3 == 0) {
if (ct[0].second * 2 == ct[1].second && ct[0].first == 0)
return true;
}
if (ct.size() == 1 && ct[0].first == 0)
return true;
return false;
}
int main() {
if (solve())
cout << "Yes" << endl;
else
cout << "No" << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int n;
bool solve() {
int i, j;
string str;
cin >> n;
vector<int> a(n);
for (i = 0; i < n; i++) {
cin >> a[i];
}
sort(a.begin(), a.end());
vector<pair<int, int>> ct;
ct.push_back(make_pair(a[0], 1));
for (i = 1; i < n; i++) {
if (a[i] == a[i - 1])
ct[ct.size() - 1].second += 1;
else
ct.push_back(make_pair(a[i], 1));
}
if (ct.size() == 3 && n % 3 == 0) {
if (ct[0].second == ct[1].second && ct[1].second == ct[2].second &&
(ct[0].first ^ ct[1].first) == ct[2].first)
return true;
}
if (ct.size() == 2 && n % 3 == 0) {
if (ct[0].second * 2 == ct[1].second && ct[0].first == 0)
return true;
}
if (ct.size() == 1 && ct[0].first == 0)
return true;
return false;
}
int main() {
if (solve())
cout << "Yes" << endl;
else
cout << "No" << endl;
}
| [
"control_flow.branch.if.condition.change"
] | 782,314 | 782,315 | u309112964 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
int n;
bool solve() {
int i, j;
string str;
cin >> n;
vector<int> a(n);
for (i = 0; i < n; i++) {
cin >> a[i];
}
sort(a.begin(), a.end());
vector<pair<int, int>> ct;
ct.push_back(make_pair(a[0], 1));
for (i = 1; i < n; i++) {
if (a[i] == a[i - 1])
ct[ct.size() - 1].second += 1;
else
ct.push_back(make_pair(a[i], 1));
}
if (ct.size() == 3 && n % 3 == 0) {
if (ct[0].second == ct[1].second && ct[1].second == ct[2].second &&
ct[0].first ^ ct[1].first == ct[2].first)
return true;
}
if (ct.size() == 2 && n % 3 == 0) {
if (ct[0].second == ct[1].second * 2 && ct[0].first == 0)
return true;
}
if (ct.size() == 1 && ct[0].first == 0)
return true;
return false;
}
int main() {
if (solve())
cout << "Yes" << endl;
else
cout << "No" << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int n;
bool solve() {
int i, j;
string str;
cin >> n;
vector<int> a(n);
for (i = 0; i < n; i++) {
cin >> a[i];
}
sort(a.begin(), a.end());
vector<pair<int, int>> ct;
ct.push_back(make_pair(a[0], 1));
for (i = 1; i < n; i++) {
if (a[i] == a[i - 1])
ct[ct.size() - 1].second += 1;
else
ct.push_back(make_pair(a[i], 1));
}
if (ct.size() == 3 && n % 3 == 0) {
if (ct[0].second == ct[1].second && ct[1].second == ct[2].second &&
(ct[0].first ^ ct[1].first) == ct[2].first)
return true;
}
if (ct.size() == 2 && n % 3 == 0) {
if (ct[0].second * 2 == ct[1].second && ct[0].first == 0)
return true;
}
if (ct.size() == 1 && ct[0].first == 0)
return true;
return false;
}
int main() {
if (solve())
cout << "Yes" << endl;
else
cout << "No" << endl;
}
| [
"control_flow.branch.if.condition.change",
"expression.operation.binary.remove"
] | 782,316 | 782,315 | u309112964 | cpp |
p02975 | #include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
const long long N = 1e5 + 100;
long long n, a[N];
map<long long, long long> cnt;
set<long long> st;
int main() {
ios_base::sync_with_stdio(false);
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
cnt[a[i]]++;
st.insert(a[i]);
}
if (st.size() > 3) {
cout << "No";
return 0;
}
if (st.size() == 3) {
long long x1 = *st.begin();
st.erase(st.begin());
long long x2 = *st.begin();
st.erase(st.begin());
long long x3 = *st.begin();
st.erase(st.begin());
if (x1 ^ x2 == x3 && cnt[x1] == cnt[x2] && cnt[x2] == cnt[x3]) {
cout << "Yes";
} else {
cout << "No";
}
return 0;
}
if (st.size() == 2) {
long long x1 = *st.begin();
st.erase(st.begin());
long long x2 = *st.begin();
st.erase(st.begin());
if (x1 == 0 && cnt[x1] * 2 == cnt[x2]) {
cout << "Yes";
} else {
cout << "No";
}
return 0;
}
if (st.size() == 1) {
long long x1 = *st.begin();
st.erase(st.begin());
if (x1 == 0) {
cout << "Yes";
} else {
cout << "No";
}
return 0;
}
return 0;
}
| #include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
const long long N = 1e5 + 100;
long long n, a[N];
map<long long, long long> cnt;
set<long long> st;
int main() {
ios_base::sync_with_stdio(false);
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
cnt[a[i]]++;
st.insert(a[i]);
}
if (st.size() > 3) {
cout << "No";
return 0;
}
if (st.size() == 3) {
long long x1 = *st.begin();
st.erase(st.begin());
long long x2 = *st.begin();
st.erase(st.begin());
long long x3 = *st.begin();
st.erase(st.begin());
if ((x1 ^ x2) == x3 && cnt[x1] == cnt[x2] && cnt[x2] == cnt[x3]) {
cout << "Yes";
} else {
cout << "No";
}
return 0;
}
if (st.size() == 2) {
long long x1 = *st.begin();
st.erase(st.begin());
long long x2 = *st.begin();
st.erase(st.begin());
if (x1 == 0 && cnt[x1] * 2 == cnt[x2]) {
cout << "Yes";
} else {
cout << "No";
}
return 0;
}
if (st.size() == 1) {
long long x1 = *st.begin();
st.erase(st.begin());
if (x1 == 0) {
cout << "Yes";
} else {
cout << "No";
}
return 0;
}
return 0;
}
| [
"control_flow.branch.if.condition.change"
] | 782,319 | 782,320 | u866968224 | cpp |
p02975 | #include <cstdio>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
using namespace std;
int No() {
cout << "No";
return 0;
}
int Yes() {
cout << "Yes";
return 0;
}
int main() {
int a[3][2] = {}, n;
cin >> n;
for (int i = 0; i < n; i++) {
int tmp;
cin >> tmp;
for (int j = 0; j <= 3; j++) {
if (j == 3) {
return No();
}
if (a[j][1] == 0) {
a[j][0] = tmp;
a[j][1]++;
break;
} else if (a[j][0] == tmp) {
a[j][1]++;
break;
}
}
}
if (a[2][1] != 0) { //
if (a[0][1] != a[1][1])
return No();
if (a[1][1] != a[2][1])
return No();
if (a[0][0] ^ a[1][0] != a[2][0])
return No();
return Yes();
} else if (a[1][1] != 0) {
if (a[0][0] == 0) {
if (a[0][1] * 2 == a[1][1])
return No();
return Yes();
}
if (a[1][0] == 0) {
if (a[1][1] * 2 == a[0][1])
return No();
return Yes();
}
return No();
} else if (a[0][1] != 0) { //
if (a[0][0] != 0)
return No();
return Yes();
}
} | #include <cstdio>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
using namespace std;
int No() {
cout << "No";
return 0;
}
int Yes() {
cout << "Yes";
return 0;
}
int main() {
int a[3][2] = {}, n;
cin >> n;
for (int i = 0; i < n; i++) {
int tmp;
cin >> tmp;
for (int j = 0; j <= 3; j++) {
if (j == 3) {
return No();
}
if (a[j][1] == 0) {
a[j][0] = tmp;
a[j][1]++;
break;
} else if (a[j][0] == tmp) {
a[j][1]++;
break;
}
}
}
if (a[2][1] != 0) { //
if (a[0][1] != a[1][1])
return No();
if (a[1][1] != a[2][1])
return No();
if ((a[0][0] ^ a[1][0]) != a[2][0])
return No();
return Yes();
} else if (a[1][1] != 0) {
if (a[0][0] == 0) {
if (a[0][1] * 2 != a[1][1])
return No();
return Yes();
}
if (a[1][0] == 0) {
if (a[1][1] * 2 != a[0][1])
return No();
return Yes();
}
return No();
} else if (a[0][1] != 0) { //
if (a[0][0] != 0)
return No();
return Yes();
}
} | [
"control_flow.branch.if.condition.change",
"misc.opposites",
"expression.operator.compare.change"
] | 782,321 | 782,322 | u145483532 | cpp |
p02975 | #include <cstdio>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
using namespace std;
int No() {
cout << "No";
return 0;
}
int Yes() {
cout << "Yes";
return 0;
}
int main() {
int a[3][2] = {}, n;
cin >> n;
for (int i = 0; i < n; i++) {
int tmp;
cin >> tmp;
for (int j = 0; j <= 3; j++) {
if (j == 3) {
return No();
}
if (a[j][1] == 0) {
a[j][0] = tmp;
a[j][1]++;
break;
} else if (a[j][0] == tmp) {
a[j][1]++;
break;
}
}
}
if (a[2][1] != 0) { //
if (a[0][1] != a[1][1])
return No();
if (a[1][1] != a[2][1])
return No();
if (a[0][0] ^ a[1][0] != a[2][0])
return No();
return Yes();
} else if (a[1][1] != 0) {
if (a[0][0] == 0) {
if (a[0][1] * 2 != a[1][1])
return No();
return Yes();
}
if (a[1][0] == 0) {
if (a[1][1] * 2 != a[0][1])
return No();
return Yes();
}
return No();
} else if (a[0][1] != 0) { //
if (a[0][0] != 0)
return No();
return Yes();
}
} | #include <cstdio>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
using namespace std;
int No() {
cout << "No";
return 0;
}
int Yes() {
cout << "Yes";
return 0;
}
int main() {
int a[3][2] = {}, n;
cin >> n;
for (int i = 0; i < n; i++) {
int tmp;
cin >> tmp;
for (int j = 0; j <= 3; j++) {
if (j == 3) {
return No();
}
if (a[j][1] == 0) {
a[j][0] = tmp;
a[j][1]++;
break;
} else if (a[j][0] == tmp) {
a[j][1]++;
break;
}
}
}
if (a[2][1] != 0) { //
if (a[0][1] != a[1][1])
return No();
if (a[1][1] != a[2][1])
return No();
if ((a[0][0] ^ a[1][0]) != a[2][0])
return No();
return Yes();
} else if (a[1][1] != 0) {
if (a[0][0] == 0) {
if (a[0][1] * 2 != a[1][1])
return No();
return Yes();
}
if (a[1][0] == 0) {
if (a[1][1] * 2 != a[0][1])
return No();
return Yes();
}
return No();
} else if (a[0][1] != 0) { //
if (a[0][0] != 0)
return No();
return Yes();
}
} | [
"control_flow.branch.if.condition.change"
] | 782,323 | 782,322 | u145483532 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
inline int read() {
int out = 0, fh = 1;
char jp = getchar();
while ((jp > '9' || jp < '0') && jp != '-')
jp = getchar();
if (jp == '-')
fh = -1, jp = getchar();
while (jp >= '0' && jp <= '9')
out = out * 10 + jp - '0', jp = getchar();
return out * fh;
}
const int MAXN = 1e5 + 10;
int n, a[MAXN];
set<int> s;
map<int, int> p;
set<int>::iterator it;
bool judge() {
for (int i = 1; i <= n; ++i) {
s.insert(a[i]);
++p[a[i]];
}
if (n % 3 == 0) {
if (s.size() > 3)
return false;
int sz = s.size();
int x[3];
it = s.begin();
for (int i = 0; i < 3; ++i) {
x[i] = *it;
if (s.size() > 1)
s.erase(it);
it = s.begin();
}
if (sz == 3)
return (x[0] ^ x[1] == x[2]) && p[x[0]] == n / 3 && p[x[1]] == n / 3;
if (sz == 2)
return (x[0] == 0) && p[x[0]] == n / 3;
if (sz == 1)
return (x[0] == 0);
}
return s.size() == 1 && a[1] == 0;
}
int main() {
n = read();
for (int i = 1; i <= n; ++i) {
a[i] = read();
p[a[i]] = 0;
}
if (judge())
puts("Yes");
else
puts("No");
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
inline int read() {
int out = 0, fh = 1;
char jp = getchar();
while ((jp > '9' || jp < '0') && jp != '-')
jp = getchar();
if (jp == '-')
fh = -1, jp = getchar();
while (jp >= '0' && jp <= '9')
out = out * 10 + jp - '0', jp = getchar();
return out * fh;
}
const int MAXN = 1e5 + 10;
int n, a[MAXN];
set<int> s;
map<int, int> p;
set<int>::iterator it;
bool judge() {
for (int i = 1; i <= n; ++i) {
s.insert(a[i]);
++p[a[i]];
}
if (n % 3 == 0) {
if (s.size() > 3)
return false;
int sz = s.size();
int x[3];
it = s.begin();
for (int i = 0; i < 3; ++i) {
x[i] = *it;
if (s.size() > 1)
s.erase(it);
it = s.begin();
}
if (sz == 3)
return ((x[0] ^ x[1]) == x[2]) && p[x[0]] == n / 3 && p[x[1]] == n / 3;
if (sz == 2)
return (x[0] == 0) && p[x[0]] == n / 3;
if (sz == 1)
return (x[0] == 0);
}
return s.size() == 1 && a[1] == 0;
}
int main() {
n = read();
for (int i = 1; i <= n; ++i) {
a[i] = read();
p[a[i]] = 0;
}
if (judge())
puts("Yes");
else
puts("No");
return 0;
}
| [
"function.return_value.change"
] | 782,332 | 782,333 | u351568836 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
string s;
const int max_n = 1e5 + 10;
int main() {
int n, a[max_n];
pair<int, int> b[3];
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
bool flag = true;
for (int i = 0; i < n; ++i) {
if (a[i] != 0) {
flag = false;
break;
}
}
if (flag) {
cout << "Yes" << endl;
return 0;
}
flag = true;
if (n % 3 == 0) {
int k = 0;
b[0].first = a[0];
b[0].second = 0;
for (int i = 1; i < n; ++i) {
bool flag_2 = true;
for (int j = 0; j <= k; ++j) {
if (b[j].first == a[i]) {
flag_2 = false;
break;
}
}
if (flag_2) {
++k;
b[k].first = a[i];
b[k].second = 0;
}
}
if (k + 1 > 4) {
flag = false;
} else {
if (k == 0) {
flag = false;
} else if (k == 1) {
sort(b, b + 1);
if (b[1].first == 0) {
for (int i = 0; i < n; ++i) {
for (int j = 0; j < 3; ++j) {
if (b[j].first == a[i]) {
++b[j].second;
}
}
}
flag = (flag && b[1].second * 2 == b[0].second);
} else {
flag = false;
}
} else {
if ((b[0].first ^ b[1].first) != b[2].first) {
flag = false;
}
for (int i = 0; i < n; ++i) {
for (int j = 0; j < 3; ++j) {
if (b[j].first == a[i]) {
++b[j].second;
}
}
}
flag =
(flag && b[0].second == b[1].second && b[1].second == b[2].second);
}
}
} else {
flag = false;
}
if (flag) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
string s;
const int max_n = 1e5 + 10;
int main() {
int n, a[max_n];
pair<int, int> b[3];
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
bool flag = true;
for (int i = 0; i < n; ++i) {
if (a[i] != 0) {
flag = false;
break;
}
}
if (flag) {
cout << "Yes" << endl;
return 0;
}
flag = true;
if (n % 3 == 0) {
int k = 0;
b[0].first = a[0];
b[0].second = 0;
for (int i = 1; i < n; ++i) {
bool flag_2 = true;
for (int j = 0; j <= k; ++j) {
if (b[j].first == a[i]) {
flag_2 = false;
break;
}
}
if (flag_2) {
++k;
b[k].first = a[i];
b[k].second = 0;
}
}
if (k + 1 > 4) {
flag = false;
} else {
if (k == 0) {
flag = false;
} else if (k == 1) {
sort(b, b + 2);
if (b[0].first == 0) {
for (int i = 0; i < n; ++i) {
for (int j = 0; j < 2; ++j) {
if (b[j].first == a[i]) {
++b[j].second;
}
}
}
flag = (flag && b[0].second * 2 == b[1].second);
} else {
flag = false;
}
} else {
if ((b[0].first ^ b[1].first) != b[2].first) {
flag = false;
}
for (int i = 0; i < n; ++i) {
for (int j = 0; j < 3; ++j) {
if (b[j].first == a[i]) {
++b[j].second;
}
}
}
flag =
(flag && b[0].second == b[1].second && b[1].second == b[2].second);
}
}
} else {
flag = false;
}
if (flag) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
} | [
"literal.number.change",
"call.arguments.change",
"expression.operation.binary.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change",
"assignment.value.change"
] | 782,336 | 782,337 | u835629653 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
string s;
const int max_n = 1e5 + 10;
int main() {
int n, a[max_n];
pair<int, int> b[3];
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
bool flag = true;
for (int i = 0; i < n; ++i) {
if (a[i] != 0) {
flag = false;
break;
}
}
if (flag) {
cout << "Yes" << endl;
return 0;
}
flag = true;
if (n % 3 == 0) {
int k = 0;
b[0].first = a[0];
b[0].second = 0;
for (int i = 1; i < n; ++i) {
bool flag_2 = true;
for (int j = 0; j <= k; ++j) {
if (b[j].first == a[i]) {
flag_2 = false;
break;
}
}
if (flag_2) {
++k;
b[k].first = a[i];
b[k].second = 0;
}
}
if (k + 1 > 4) {
flag = false;
} else {
if (k == 0) {
flag = false;
} else if (k == 1) {
sort(b, b + 1);
if (b[0].first == 0) {
for (int i = 0; i < n; ++i) {
for (int j = 0; j < 3; ++j) {
if (b[j].first == a[i]) {
++b[j].second;
}
}
}
flag = (flag && b[0].second * 2 == b[1].second);
} else {
flag = false;
}
} else {
if ((b[0].first ^ b[1].first) != b[2].first) {
flag = false;
}
for (int i = 0; i < n; ++i) {
for (int j = 0; j < 3; ++j) {
if (b[j].first == a[i]) {
++b[j].second;
}
}
}
flag =
(flag && b[0].second == b[1].second && b[1].second == b[2].second);
}
}
} else {
flag = false;
}
if (flag) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
string s;
const int max_n = 1e5 + 10;
int main() {
int n, a[max_n];
pair<int, int> b[3];
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
bool flag = true;
for (int i = 0; i < n; ++i) {
if (a[i] != 0) {
flag = false;
break;
}
}
if (flag) {
cout << "Yes" << endl;
return 0;
}
flag = true;
if (n % 3 == 0) {
int k = 0;
b[0].first = a[0];
b[0].second = 0;
for (int i = 1; i < n; ++i) {
bool flag_2 = true;
for (int j = 0; j <= k; ++j) {
if (b[j].first == a[i]) {
flag_2 = false;
break;
}
}
if (flag_2) {
++k;
b[k].first = a[i];
b[k].second = 0;
}
}
if (k + 1 > 4) {
flag = false;
} else {
if (k == 0) {
flag = false;
} else if (k == 1) {
sort(b, b + 2);
if (b[0].first == 0) {
for (int i = 0; i < n; ++i) {
for (int j = 0; j < 2; ++j) {
if (b[j].first == a[i]) {
++b[j].second;
}
}
}
flag = (flag && b[0].second * 2 == b[1].second);
} else {
flag = false;
}
} else {
if ((b[0].first ^ b[1].first) != b[2].first) {
flag = false;
}
for (int i = 0; i < n; ++i) {
for (int j = 0; j < 3; ++j) {
if (b[j].first == a[i]) {
++b[j].second;
}
}
}
flag =
(flag && b[0].second == b[1].second && b[1].second == b[2].second);
}
}
} else {
flag = false;
}
if (flag) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
} | [
"literal.number.change",
"call.arguments.change",
"expression.operation.binary.change",
"control_flow.branch.if.condition.change"
] | 782,338 | 782,337 | u835629653 | cpp |
p02975 | #include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <algorithm>
#include <bitset>
#include <chrono>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <vector>
#define LOG(FMT...) fprintf(stderr, FMT)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N = 100010;
int n;
int a[N], b[N];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; ++i)
scanf("%d", &a[i]);
if (count(a + 1, a + n + 1, 0) == n) {
puts("Yes");
return 0;
}
if (n % 3) {
puts("No");
return 0;
}
sort(a + 1, a + n + 1);
copy(a + 1, a + n + 1, b + 1);
int m = unique(b + 1, b + n + 1) - b - 1;
if (m == 2 && b[1] == 0 && count(a + 1, a + n + 1, 0) == n / 3 * 2) {
puts("Yes");
} else if (m == 3 && (b[1] == (b[2] ^ b[3])) &&
count(a + 1, a + n + 1, b[1]) == n / 3 &&
count(a + 1, a + n + 1, b[2]) == n / 3 &&
count(a + 1, a + n + 1, b[3]) == n / 3)
puts("Yes");
else
puts("No");
return 0;
}
| #include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <algorithm>
#include <bitset>
#include <chrono>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <vector>
#define LOG(FMT...) fprintf(stderr, FMT)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N = 100010;
int n;
int a[N], b[N];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; ++i)
scanf("%d", &a[i]);
if (count(a + 1, a + n + 1, 0) == n) {
puts("Yes");
return 0;
}
if (n % 3) {
puts("No");
return 0;
}
sort(a + 1, a + n + 1);
copy(a + 1, a + n + 1, b + 1);
int m = unique(b + 1, b + n + 1) - b - 1;
if (m == 2 && b[1] == 0 && count(a + 1, a + n + 1, 0) == n / 3) {
puts("Yes");
} else if (m == 3 && (b[1] == (b[2] ^ b[3])) &&
count(a + 1, a + n + 1, b[1]) == n / 3 &&
count(a + 1, a + n + 1, b[2]) == n / 3 &&
count(a + 1, a + n + 1, b[3]) == n / 3)
puts("Yes");
else
puts("No");
return 0;
}
| [
"expression.operation.binary.remove"
] | 782,339 | 782,340 | u895067736 | cpp |
p02975 | #include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
const ll INF = 1LL << 60;
int main() {
ll n;
cin >> n;
map<ll, ll> mp;
for (ll i = 0; i < n; i++) {
ll a;
cin >> a;
mp[a]++;
}
if (mp.size() != 3 && mp.size() != 2 && mp.size() != 1) {
cout << "No" << endl;
return 0;
}
if (mp.size() == 3) {
vector<ll> b(3), c(3);
ll p = 0;
for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
b[p] = (itr->second);
c[p] = (itr->first);
p++;
}
for (ll i = 1; i < 3; i++) {
if (b[i] != b[i - 1]) {
cout << "No" << endl;
return 0;
}
}
if (c[1] != (c[0] ^ c[2]) || c[2] != (c[1] ^ c[0]) ||
c[0] != (c[1] ^ c[2])) {
cout << "No" << endl;
return 0;
}
}
if (mp.size() == 2) {
vector<ll> b(2), c(2);
ll p = 0;
for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
b[p] = (itr->second);
c[p] = (itr->first);
p++;
}
if (!(c[0] == 0 && b[0] * 2 == b[1]) && !(c[1] == 0 && b[1] * 2 == b[0])) {
cout << "No" << endl;
return 0;
}
}
if (mp.size() == 1) {
vector<ll> b(1), c(1);
ll p = 0;
for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
b[p] = (itr->second);
c[p] = (itr->first);
p++;
}
if (b[0] != n || b[0] != 0) {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
}
| #include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
const ll INF = 1LL << 60;
int main() {
ll n;
cin >> n;
map<ll, ll> mp;
for (ll i = 0; i < n; i++) {
ll a;
cin >> a;
mp[a]++;
}
if (mp.size() != 3 && mp.size() != 2 && mp.size() != 1) {
cout << "No" << endl;
return 0;
}
if (mp.size() == 3) {
vector<ll> b(3), c(3);
ll p = 0;
for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
b[p] = (itr->second);
c[p] = (itr->first);
p++;
}
for (ll i = 1; i < 3; i++) {
if (b[i] != b[i - 1]) {
cout << "No" << endl;
return 0;
}
}
if (c[1] != (c[0] ^ c[2]) || c[2] != (c[1] ^ c[0]) ||
c[0] != (c[1] ^ c[2])) {
cout << "No" << endl;
return 0;
}
}
if (mp.size() == 2) {
vector<ll> b(2), c(2);
ll p = 0;
for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
b[p] = (itr->second);
c[p] = (itr->first);
p++;
}
if (!(c[0] == 0 && b[0] * 2 == b[1]) && !(c[1] == 0 && b[1] * 2 == b[0])) {
cout << "No" << endl;
return 0;
}
}
if (mp.size() == 1) {
vector<ll> b(1), c(1);
ll p = 0;
for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
b[p] = (itr->second);
c[p] = (itr->first);
p++;
}
if (b[0] != n || c[0] != 0) {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
}
| [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 782,344 | 782,345 | u553605501 | cpp |
p02975 | #pragma GCC optimize(3)
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/priority_queue.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define MAXN 100005
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef pair<int, int> P;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
typedef __gnu_pbds::priority_queue<int, greater<int>, pairing_heap_tag> pq;
int n, k, a[MAXN];
map<int, int> mp;
int main() {
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
mp[a[i]]++;
}
if (n % 3 != 0) {
if (mp.size() == 1 && a[0] == 0)
puts("YES");
else
puts("NO");
} else {
bool f = true;
if (mp.size() > 3)
f = false;
int x = 0;
for (auto p : mp) {
if (p.S % (n / 3) != 0)
f = false;
for (int j = 0; j < p.S / (n / 3); j++)
x ^= p.F;
}
if (x != 0)
f = false;
if (f)
puts("YES");
else
puts("NO");
}
return 0;
}
| #pragma GCC optimize(3)
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/priority_queue.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define MAXN 100005
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef pair<int, int> P;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
typedef __gnu_pbds::priority_queue<int, greater<int>, pairing_heap_tag> pq;
int n, k, a[MAXN];
map<int, int> mp;
int main() {
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
mp[a[i]]++;
}
if (n % 3 != 0) {
if (mp.size() == 1 && a[0] == 0)
puts("Yes");
else
puts("No");
} else {
bool f = true;
if (mp.size() > 3)
f = false;
int x = 0;
for (auto p : mp) {
if (p.S % (n / 3) != 0)
f = false;
for (int j = 0; j < p.S / (n / 3); j++)
x ^= p.F;
}
if (x != 0)
f = false;
if (f)
puts("Yes");
else
puts("No");
}
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 782,351 | 782,352 | u237254894 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
#ifdef ENABLE_DEBUG
#define dump(a) cerr << #a << "=" << a << endl
#define dumparr(a, n) cerr << #a << "[" << n << "]=" << a[n] << endl
#else
#define dump(a)
#define dumparr(a, n)
#endif
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for (int i = b - 1; i >= a; i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll, pll> ppll;
typedef vector<ll> vll;
const ll INF = (1LL << 50);
template <class S, class T>
std::ostream &operator<<(std::ostream &os, pair<S, T> a) {
os << "(" << a.first << "," << a.second << ")";
return os;
}
template <class T> std::ostream &operator<<(std::ostream &os, vector<T> a) {
os << "[ ";
REP(a.size()) { os << a[i] << " "; }
os << " ]";
return os;
}
const string YES = "Yes";
const string NO = "No";
void p(string s) {
cout << s << endl;
exit(0);
}
map<ll, ll> x;
void inc_x(ll a) {
if (x.count(a)) {
++x[a];
} else {
x[a] = 1;
}
}
void solve(long long N, std::vector<long long> a) {
REP(N) inc_x(a[i]);
if (x.size() > 3)
p(NO);
if (x.size() == 2) {
if (N % 3 != 0)
p(NO);
if (x.count(0) && x[0] == N / 3)
p(NO);
p(YES);
}
if (x.size() == 1) {
if (x.count(0))
p(YES);
p(NO);
}
if (x.size() == 3) {
vector<ll> X;
for (auto &&i : x) {
X.push_back(i.first);
}
if (N % 3 == 0 && x[X[0]] == x[X[1]] && x[X[1]] == x[X[2]] &&
X[0] == (X[1] ^ X[2]))
p(YES);
p(NO);
}
}
int main() {
long long N;
scanf("%lld", &N);
std::vector<long long> a(N);
for (int i = 0; i < N; i++) {
scanf("%lld", &a[i]);
}
solve(N, std::move(a));
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#ifdef ENABLE_DEBUG
#define dump(a) cerr << #a << "=" << a << endl
#define dumparr(a, n) cerr << #a << "[" << n << "]=" << a[n] << endl
#else
#define dump(a)
#define dumparr(a, n)
#endif
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for (int i = b - 1; i >= a; i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll, pll> ppll;
typedef vector<ll> vll;
const ll INF = (1LL << 50);
template <class S, class T>
std::ostream &operator<<(std::ostream &os, pair<S, T> a) {
os << "(" << a.first << "," << a.second << ")";
return os;
}
template <class T> std::ostream &operator<<(std::ostream &os, vector<T> a) {
os << "[ ";
REP(a.size()) { os << a[i] << " "; }
os << " ]";
return os;
}
const string YES = "Yes";
const string NO = "No";
void p(string s) {
cout << s << endl;
exit(0);
}
map<ll, ll> x;
void inc_x(ll a) {
if (x.count(a)) {
++x[a];
} else {
x[a] = 1;
}
}
void solve(long long N, std::vector<long long> a) {
REP(N) inc_x(a[i]);
if (x.size() > 3)
p(NO);
if (x.size() == 2) {
if (N % 3 != 0)
p(NO);
if (x.count(0) && x[0] == N / 3)
p(YES);
p(NO);
}
if (x.size() == 1) {
if (x.count(0))
p(YES);
p(NO);
}
if (x.size() == 3) {
vector<ll> X;
for (auto &&i : x) {
X.push_back(i.first);
}
if (N % 3 == 0 && x[X[0]] == x[X[1]] && x[X[1]] == x[X[2]] &&
X[0] == (X[1] ^ X[2]))
p(YES);
p(NO);
}
}
int main() {
long long N;
scanf("%lld", &N);
std::vector<long long> a(N);
for (int i = 0; i < N; i++) {
scanf("%lld", &a[i]);
}
solve(N, std::move(a));
return 0;
} | [
"call.remove",
"call.add"
] | 782,353 | 782,354 | u634743753 | cpp |
p02975 | #include <algorithm>
#include <array>
#include <assert.h>
#include <bitset>
#include <cmath> // 変数名にy1が使えなくなるかも…。
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
typedef __int128_t int128_t;
std::istream &
operator>>(std::istream &input,
int128_t &value) { // int128_tの入力。入力が64bitに収まる前提。
long long tmp;
input >> tmp;
value = tmp;
return input;
}
std::ostream &
operator<<(std::ostream &output,
const int128_t value) { // int128_tの出力。出力が64bitに収まる前提。
output << (long long)value;
return output;
}
const int MAX_N = 1e5 + 7;
int N;
int64_t a[MAX_N];
std::map<int64_t, int> mp;
int main(int argc, char **argv) {
std::cin >> N;
for (int i = 1; i <= N; i++) {
std::cin >> a[i];
mp[a[i]]++;
}
if (3 < mp.size()) {
std::cout << "No" << std::endl;
return 0;
}
if (mp.size() == 1) {
if (a[1] == 0) {
std::cout << "Yes" << std::endl;
} else {
std::cout << "No" << std::endl;
}
return 0;
}
std::vector<int64_t> x, y;
for (auto p : mp) {
x.push_back(p.first);
y.push_back(p.second);
}
if (mp.size() == 2) {
if (N % 3 == 0 && x[0] == 0 && y[0] * 2 == y[1]) {
std::cout << "Yes" << std::endl;
} else {
std::cout << "No" << std::endl;
}
return 0;
}
if (x[0] ^ x[1] == x[2] && y[0] == y[1] && y[1] == y[2]) {
std::cout << "Yes" << std::endl;
} else {
std::cout << "No" << std::endl;
}
return 0;
} | #include <algorithm>
#include <array>
#include <assert.h>
#include <bitset>
#include <cmath> // 変数名にy1が使えなくなるかも…。
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
typedef __int128_t int128_t;
std::istream &
operator>>(std::istream &input,
int128_t &value) { // int128_tの入力。入力が64bitに収まる前提。
long long tmp;
input >> tmp;
value = tmp;
return input;
}
std::ostream &
operator<<(std::ostream &output,
const int128_t value) { // int128_tの出力。出力が64bitに収まる前提。
output << (long long)value;
return output;
}
const int MAX_N = 1e5 + 7;
int N;
int64_t a[MAX_N];
std::map<int64_t, int> mp;
int main(int argc, char **argv) {
std::cin >> N;
for (int i = 1; i <= N; i++) {
std::cin >> a[i];
mp[a[i]]++;
}
if (3 < mp.size()) {
std::cout << "No" << std::endl;
return 0;
}
if (mp.size() == 1) {
if (a[1] == 0) {
std::cout << "Yes" << std::endl;
} else {
std::cout << "No" << std::endl;
}
return 0;
}
std::vector<int64_t> x, y;
for (auto p : mp) {
x.push_back(p.first);
y.push_back(p.second);
}
if (mp.size() == 2) {
if (N % 3 == 0 && x[0] == 0 && y[0] * 2 == y[1]) {
std::cout << "Yes" << std::endl;
} else {
std::cout << "No" << std::endl;
}
return 0;
}
// std::cout << x[0] << " " << x[1] << " " << x[2] << std::endl;
if ((x[0] ^ x[1]) == x[2] && y[0] == y[1] && y[1] == y[2]) {
std::cout << "Yes" << std::endl;
} else {
std::cout << "No" << std::endl;
}
return 0;
} | [
"control_flow.branch.if.condition.change"
] | 782,368 | 782,369 | u370768058 | cpp |
p02975 | #define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <bitset>
#include <climits>
#include <float.h>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <time.h>
#include <utility>
#include <vector>
using namespace std;
long long gcd(long long a, long long b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
vector<long long> divisor(long long n) {
vector<long long> ret;
for (long long i = 1; i * i <= n; i++) {
if (n % i == 0) {
ret.push_back(i);
if (i * i != n)
ret.push_back(n / i);
}
}
sort(begin(ret), end(ret));
return (ret);
}
struct LazySegmentTree {
private:
int n;
vector<int> node, lazy;
vector<bool> lazyFlag;
public:
LazySegmentTree(vector<int> v) {
int sz = (int)v.size();
n = 1;
while (n < sz)
n *= 2;
node.resize(2 * n - 1);
lazy.resize(2 * n - 1, INT_MAX);
lazyFlag.resize(2 * n - 1, false);
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[i * 2 + 1], node[i * 2 + 2]);
}
void lazyEvaluate(int k, int l, int r) {
if (lazyFlag[k]) {
node[k] = lazy[k];
if (r - l > 1) {
lazy[k * 2 + 1] = lazy[k * 2 + 2] = lazy[k];
lazyFlag[k * 2 + 1] = lazyFlag[k * 2 + 2] = true;
}
lazyFlag[k] = false;
}
}
void update(int a, int b, int x, int k = 0, int l = 0, int r = -1) {
if (r < 0)
r = n;
lazyEvaluate(k, l, r);
if (b <= l || r <= a)
return;
if (a <= l && r <= b) {
lazy[k] = x;
lazyFlag[k] = true;
lazyEvaluate(k, l, r);
} else {
update(a, b, x, 2 * k + 1, l, (l + r) / 2);
update(a, b, x, 2 * k + 2, (l + r) / 2, r);
node[k] = min(node[2 * k + 1], node[2 * k + 2]);
}
}
int find(int a, int b, int k = 0, int l = 0, int r = -1) {
if (r < 0)
r = n;
lazyEvaluate(k, l, r);
if (b <= l || r <= a)
return INT_MAX;
if (a <= l && r <= b)
return node[k];
int vl = find(a, b, 2 * k + 1, l, (l + r) / 2);
int vr = find(a, b, 2 * k + 2, (l + r) / 2, r);
return min(vl, vr);
}
};
#define ll long long
class UnionFind {
public:
vector<ll> par; // 各元の親を表す配列
vector<ll> siz; // 素集合のサイズを表す配列(1 で初期化)
// Constructor
UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
for (ll i = 0; i < sz_; ++i)
par[i] = i; // 初期では親は自分自身
}
void init(ll sz_) {
par.resize(sz_);
siz.assign(sz_, 1LL); // resize だとなぜか初期化されなかった
for (ll i = 0; i < sz_; ++i)
par[i] = i; // 初期では親は自分自身
}
// Member Function
// Find
ll root(ll x) { // 根の検索
while (par[x] != x) {
x = par[x] = par[par[x]]; // x の親の親を x の親とする
}
return x;
}
// Union(Unite, Merge)
bool merge(ll x, ll y) {
x = root(x);
y = root(y);
if (x == y)
return false;
// merge technique(データ構造をマージするテク.小を大にくっつける)
if (siz[x] < siz[y])
swap(x, y);
siz[x] += siz[y];
par[y] = x;
return true;
}
bool issame(ll x, ll y) { // 連結判定
return root(x) == root(y);
}
ll size(ll x) { // 素集合のサイズ
return siz[root(x)];
}
};
typedef pair<long long, long long> p;
long long mod = 1000000007;
long long calc(long long k) { return k * (k + 1) / 2; }
class BIT {
public:
vector<int> bit;
int M;
BIT(int M) : bit(vector<int>(M + 1, 0)), M(M) {}
int sum(int i) {
if (!i)
return 0;
if (i == 0)
return 0;
return bit[i] + sum(i - (i & -i));
}
void add(int i, int x) {
if (i > M)
return;
bit[i] += x;
add(i + (i & -i), x);
}
};
#define int long long
int n, m;
signed main() {
cin.tie(0);
ios::sync_with_stdio(false);
cout << fixed << setprecision(16);
cin >> n;
int a[100004];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
sort(a, a + n);
vector<p> vec;
vec.push_back(p(a[0], 1));
for (int i = 1; i < n; i++) {
if (a[i] == vec[vec.size() - 1].first) {
vec[vec.size() - 1].second += 1;
} else {
vec.push_back(p(a[i], 1));
}
}
if (vec.size() == 1) {
if (vec[0].first == 0) {
cout << "Yes";
} else {
cout << "No";
}
}
if (vec.size() == 2) {
if (vec[0].first == 0 && (vec[0].second * 2 == vec[1].second)) {
cout << "Yes";
} else
cout << "No";
}
if (vec.size() == 3) {
if (vec[0].first != 0 && vec[0].first ^ vec[1].first == vec[2].first &&
vec[0].second == vec[1].second && vec[1].second == vec[2].second) {
cout << "Yes";
} else
cout << "No";
}
if (vec.size() >= 4) {
cout << "No";
}
} | #define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <bitset>
#include <climits>
#include <float.h>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <time.h>
#include <utility>
#include <vector>
using namespace std;
long long gcd(long long a, long long b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
vector<long long> divisor(long long n) {
vector<long long> ret;
for (long long i = 1; i * i <= n; i++) {
if (n % i == 0) {
ret.push_back(i);
if (i * i != n)
ret.push_back(n / i);
}
}
sort(begin(ret), end(ret));
return (ret);
}
struct LazySegmentTree {
private:
int n;
vector<int> node, lazy;
vector<bool> lazyFlag;
public:
LazySegmentTree(vector<int> v) {
int sz = (int)v.size();
n = 1;
while (n < sz)
n *= 2;
node.resize(2 * n - 1);
lazy.resize(2 * n - 1, INT_MAX);
lazyFlag.resize(2 * n - 1, false);
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[i * 2 + 1], node[i * 2 + 2]);
}
void lazyEvaluate(int k, int l, int r) {
if (lazyFlag[k]) {
node[k] = lazy[k];
if (r - l > 1) {
lazy[k * 2 + 1] = lazy[k * 2 + 2] = lazy[k];
lazyFlag[k * 2 + 1] = lazyFlag[k * 2 + 2] = true;
}
lazyFlag[k] = false;
}
}
void update(int a, int b, int x, int k = 0, int l = 0, int r = -1) {
if (r < 0)
r = n;
lazyEvaluate(k, l, r);
if (b <= l || r <= a)
return;
if (a <= l && r <= b) {
lazy[k] = x;
lazyFlag[k] = true;
lazyEvaluate(k, l, r);
} else {
update(a, b, x, 2 * k + 1, l, (l + r) / 2);
update(a, b, x, 2 * k + 2, (l + r) / 2, r);
node[k] = min(node[2 * k + 1], node[2 * k + 2]);
}
}
int find(int a, int b, int k = 0, int l = 0, int r = -1) {
if (r < 0)
r = n;
lazyEvaluate(k, l, r);
if (b <= l || r <= a)
return INT_MAX;
if (a <= l && r <= b)
return node[k];
int vl = find(a, b, 2 * k + 1, l, (l + r) / 2);
int vr = find(a, b, 2 * k + 2, (l + r) / 2, r);
return min(vl, vr);
}
};
#define ll long long
class UnionFind {
public:
vector<ll> par; // 各元の親を表す配列
vector<ll> siz; // 素集合のサイズを表す配列(1 で初期化)
// Constructor
UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
for (ll i = 0; i < sz_; ++i)
par[i] = i; // 初期では親は自分自身
}
void init(ll sz_) {
par.resize(sz_);
siz.assign(sz_, 1LL); // resize だとなぜか初期化されなかった
for (ll i = 0; i < sz_; ++i)
par[i] = i; // 初期では親は自分自身
}
// Member Function
// Find
ll root(ll x) { // 根の検索
while (par[x] != x) {
x = par[x] = par[par[x]]; // x の親の親を x の親とする
}
return x;
}
// Union(Unite, Merge)
bool merge(ll x, ll y) {
x = root(x);
y = root(y);
if (x == y)
return false;
// merge technique(データ構造をマージするテク.小を大にくっつける)
if (siz[x] < siz[y])
swap(x, y);
siz[x] += siz[y];
par[y] = x;
return true;
}
bool issame(ll x, ll y) { // 連結判定
return root(x) == root(y);
}
ll size(ll x) { // 素集合のサイズ
return siz[root(x)];
}
};
typedef pair<long long, long long> p;
long long mod = 1000000007;
long long calc(long long k) { return k * (k + 1) / 2; }
class BIT {
public:
vector<int> bit;
int M;
BIT(int M) : bit(vector<int>(M + 1, 0)), M(M) {}
int sum(int i) {
if (!i)
return 0;
if (i == 0)
return 0;
return bit[i] + sum(i - (i & -i));
}
void add(int i, int x) {
if (i > M)
return;
bit[i] += x;
add(i + (i & -i), x);
}
};
#define int long long
int n, m;
signed main() {
cin.tie(0);
ios::sync_with_stdio(false);
cout << fixed << setprecision(16);
cin >> n;
int a[100004];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
sort(a, a + n);
vector<p> vec;
vec.push_back(p(a[0], 1));
for (int i = 1; i < n; i++) {
if (a[i] == vec[vec.size() - 1].first) {
vec[vec.size() - 1].second += 1;
} else {
vec.push_back(p(a[i], 1));
}
}
if (vec.size() == 1) {
if (vec[0].first == 0) {
cout << "Yes";
} else {
cout << "No";
}
}
if (vec.size() == 2) {
if (vec[0].first == 0 && (vec[0].second * 2 == vec[1].second)) {
cout << "Yes";
} else
cout << "No";
}
if (vec.size() == 3) {
if (vec[0].first != 0 && (vec[0].first ^ vec[1].first) == vec[2].first &&
vec[0].second == vec[1].second && vec[1].second == vec[2].second) {
cout << "Yes";
} else
cout << "No";
}
if (vec.size() >= 4) {
cout << "No";
}
} | [
"control_flow.branch.if.condition.change"
] | 782,375 | 782,376 | u313288017 | cpp |
p02975 | //#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
#define mem(a, v) memset((a), (v), sizeof(a))
#define enl printf("\n")
#define case (t) printf("Case #%d: ", (t))
#define ni(n) scanf("%d", &(n))
#define nl(n) scanf("%lld", &(n))
#define nai(a, n) \
for (int i = 0; i < (n); i++) \
ni(a[i])
#define nal(a, n) \
for (int i = 0; i < (n); i++) \
nl(a[i])
#define pri(n) printf("%d\n", (n))
#define prl(n) printf("%lld\n", (n))
#define pii pair<int, int>
#define pil pair<int, long long>
#define pll pair<long long, long long>
#define vii vector<pii>
#define vil vector<pil>
#define vll vector<pll>
#define vi vector<int>
#define vl vector<long long>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef cc_hash_table<int, int, hash<int>> ht;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update>
oset;
const double pi = acos(-1);
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const int MAXN = 1e6 + 5;
const double eps = 1e-9;
ll a[MAXN];
set<ll> cnt;
map<ll, int> xy;
int main() {
int n;
ni(n);
for (int i = 0; i < n; i++) {
nl(a[i]);
cnt.insert(a[i]);
if (xy.find(a[i]) == xy.end())
xy[a[i]] = 0;
xy[a[i]]++;
}
if (cnt.size() > 3)
return !printf("No\n");
vl tmp;
for (set<ll>::iterator it = cnt.begin(); it != cnt.end(); it = next(it))
tmp.pb(*it);
sort(tmp.begin(), tmp.end());
if (tmp.size() == 1 && tmp[0] == 0)
return !printf("Yes\n");
if (tmp.size() == 2 && tmp[0] == 0 && xy[tmp[0]] * 2 == xy[tmp[1]])
return !printf("Yes\n");
if (tmp.size() == 3 && xy[tmp[0]] == xy[tmp[1]] && xy[tmp[2]] == xy[tmp[0]]) {
if (tmp[0] ^ tmp[1] == tmp[2])
return !printf("Yes\n");
}
printf("No\n");
return 0;
}
| //#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
#define mem(a, v) memset((a), (v), sizeof(a))
#define enl printf("\n")
#define case (t) printf("Case #%d: ", (t))
#define ni(n) scanf("%d", &(n))
#define nl(n) scanf("%lld", &(n))
#define nai(a, n) \
for (int i = 0; i < (n); i++) \
ni(a[i])
#define nal(a, n) \
for (int i = 0; i < (n); i++) \
nl(a[i])
#define pri(n) printf("%d\n", (n))
#define prl(n) printf("%lld\n", (n))
#define pii pair<int, int>
#define pil pair<int, long long>
#define pll pair<long long, long long>
#define vii vector<pii>
#define vil vector<pil>
#define vll vector<pll>
#define vi vector<int>
#define vl vector<long long>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef cc_hash_table<int, int, hash<int>> ht;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update>
oset;
const double pi = acos(-1);
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const int MAXN = 1e6 + 5;
const double eps = 1e-9;
ll a[MAXN];
set<ll> cnt;
map<ll, int> xy;
int main() {
int n;
ni(n);
for (int i = 0; i < n; i++) {
nl(a[i]);
cnt.insert(a[i]);
if (xy.find(a[i]) == xy.end())
xy[a[i]] = 0;
xy[a[i]]++;
}
if (cnt.size() > 3)
return !printf("No\n");
vl tmp;
for (set<ll>::iterator it = cnt.begin(); it != cnt.end(); it = next(it))
tmp.pb(*it);
sort(tmp.begin(), tmp.end());
if (tmp.size() == 1 && tmp[0] == 0)
return !printf("Yes\n");
if (tmp.size() == 2 && tmp[0] == 0 && xy[tmp[0]] * 2 == xy[tmp[1]])
return !printf("Yes\n");
if (tmp.size() == 3 && xy[tmp[0]] == xy[tmp[1]] && xy[tmp[2]] == xy[tmp[0]]) {
if ((tmp[0] ^ tmp[1]) == tmp[2])
return !printf("Yes\n");
}
printf("No\n");
return 0;
}
| [
"control_flow.branch.if.condition.change"
] | 782,377 | 782,378 | u270920804 | cpp |
p02975 | #include <algorithm>
#include <bitset>
#include <ciso646>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop \
char nyaa; \
cin >> nyaa;
#define rep(i, n) for (int i = 0; i < n; i++)
#define per(i, n) for (int i = n - 1; i >= 0; i--)
#define Rep(i, sta, n) for (int i = sta; i < n; i++)
#define rep1(i, n) for (int i = 1; i <= n; i++)
#define per1(i, n) for (int i = n; i >= 1; i--)
#define Rep1(i, sta, n) for (int i = sta; i <= n; i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(), c.end()
#define pb push_back
void Yes() {
cout << "Yes" << endl;
exit(0);
}
void No() {
cout << "No" << endl;
exit(0);
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int N;
cin >> N;
ll a[100100];
rep(i, N) cin >> a[i];
if (N % 3 == 0) {
sort(a, a + N);
if (a[0] == 0 && a[N - 1] == 0)
Yes();
int n = N / 3;
ll b = a[0], c = a[n], d = a[2 * n];
if (b ^ c == d && a[n - 1] == b && a[2 * n - 1] == c && a[N - 1] == d) {
Yes();
}
No();
} else {
sort(a, a + N);
if (a[0] == 0 && a[N - 1] == 0)
Yes();
No();
}
return 0;
} | #include <algorithm>
#include <bitset>
#include <ciso646>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop \
char nyaa; \
cin >> nyaa;
#define rep(i, n) for (int i = 0; i < n; i++)
#define per(i, n) for (int i = n - 1; i >= 0; i--)
#define Rep(i, sta, n) for (int i = sta; i < n; i++)
#define rep1(i, n) for (int i = 1; i <= n; i++)
#define per1(i, n) for (int i = n; i >= 1; i--)
#define Rep1(i, sta, n) for (int i = sta; i <= n; i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(), c.end()
#define pb push_back
void Yes() {
cout << "Yes" << endl;
exit(0);
}
void No() {
cout << "No" << endl;
exit(0);
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int N;
cin >> N;
ll a[100100];
rep(i, N) cin >> a[i];
if (N % 3 == 0) {
sort(a, a + N);
if (a[0] == 0 && a[N - 1] == 0)
Yes();
int n = N / 3;
ll b = a[0], c = a[n], d = a[2 * n];
if ((b ^ c) == d && a[n - 1] == b && a[2 * n - 1] == c && a[N - 1] == d) {
Yes();
}
No();
} else {
sort(a, a + N);
if (a[0] == 0 && a[N - 1] == 0)
Yes();
No();
}
return 0;
} | [
"control_flow.branch.if.condition.change"
] | 782,379 | 782,380 | u508571192 | cpp |
p02975 | #include <algorithm>
#include <climits>
#include <iostream>
#include <set>
#include <string>
#include <vector>
#define MAX 1000000007
using namespace std;
#define ll long long
#define dbg if (0)
#define ISRANGE(val, lo, hi) ((lo <= val) && (val < hi))
ll list[3][2];
void init() {
for (int i = 0; i < 3; i++) {
list[i][0] = -1;
list[i][1] = 0;
}
}
bool find(ll a) {
for (int i = 0; i < 3; i++) {
if (a == list[i][0]) {
list[i][1]++;
return true;
} else if (list[i][0] == -1) {
list[i][1]++;
list[i][0] = a;
return true;
}
}
//4種類目が出た
return false;
}
bool check() {
return (list[0][0] ^ list[1][0] ^ list[2][0] == 0) &&
list[0][1] == list[1][1] && list[0][1] == list[2][1];
}
int main() {
init();
ll ans = 0, n;
cin >> n;
ll a[n + 1];
a[0] = 0;
bool f = true;
for (int i = 1; i <= n; i++) {
ll t;
cin >> t;
/* if(!find(t)){
f=false;
break;
}else*/
{ f = f && find(t); }
ans ^= t;
}
f = f && check();
if (f && ans == 0)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
} | #include <algorithm>
#include <climits>
#include <iostream>
#include <set>
#include <string>
#include <vector>
#define MAX 1000000007
using namespace std;
#define ll long long
#define dbg if (0)
#define ISRANGE(val, lo, hi) ((lo <= val) && (val < hi))
ll list[3][2];
void init() {
for (int i = 0; i < 3; i++) {
list[i][0] = -1;
list[i][1] = 0;
}
}
bool find(ll a) {
for (int i = 0; i < 3; i++) {
if (a == list[i][0]) {
list[i][1]++;
return true;
} else if (list[i][0] == -1) {
list[i][1]++;
list[i][0] = a;
return true;
}
}
//4種類目が出た
return false;
}
bool check() {
return (list[0][0] ^ list[1][0] ^ list[2][0] == 0) &&
list[0][1] == list[1][1] && list[0][1] == list[2][1];
}
int main() {
init();
ll ans = 0, n;
cin >> n;
ll a[n + 1];
a[0] = 0;
bool f = true;
for (int i = 1; i <= n; i++) {
ll t;
cin >> t;
/* if(!find(t)){
f=false;
break;
}else*/
{ f = f && find(t); }
ans ^= t;
}
f = f && check();
if (ans == 0)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
} | [
"expression.operation.binary.remove"
] | 782,383 | 782,384 | u828752458 | cpp |
p02975 | #include <algorithm>
#include <bitset>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <stack>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
int n;
scanf("%d", &n);
ll a[100005] = {};
int alz = 1;
int kep[3] = {-1, -1, -1};
int c[3] = {1, 0, 0};
int count = 1;
REP(i, n) {
scanf("%lld", &a[i]);
if (a[i] != 0)
alz = 0;
}
if (n % 3 == 1 || n % 3 == 2) {
if (alz == 1)
printf("Yes\n");
else
printf("No\n");
return 0;
}
kep[0] = a[0];
for (int i = 1; i < n; i++) {
int judge = 1;
REP(j, count) {
if (kep[j] == a[i]) {
judge = 0;
c[j]++;
}
}
if (judge == 1) {
if (count >= 3) {
printf("No\n");
return 0;
} else {
kep[count] = a[i];
c[count]++;
count++;
}
}
}
// REP(i,3)printf("###%d\n",kep[i]);
// REP(i,3)printf("###%d\n",c[i]);
if (count == 1) {
if (alz == 1)
printf("Yes\n");
else
printf("No\n");
return 0;
}
if (count == 2) {
if (alz == 1)
printf("Yes\n");
else if (c[0] == c[1] * 2 && kep[0] == 0) {
printf("Yes\n");
} else if (c[1] == c[0] * 2 && kep[1] == 0) {
printf("Yes\n");
} else
printf("No\n");
return 0;
}
if (count == 3) {
if (c[0] == c[1] && c[1] == c[2]) {
if ((kep[0] ^ kep[2]) == kep[1])
printf("Yes\n");
else
printf("No\n");
} else
printf("No\n");
return 0;
}
} | #include <algorithm>
#include <bitset>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <stack>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
int n;
scanf("%d", &n);
ll a[100005] = {};
int alz = 1;
int kep[3] = {-1, -1, -1};
int c[3] = {1, 0, 0};
int count = 1;
REP(i, n) {
scanf("%lld", &a[i]);
if (a[i] != 0)
alz = 0;
}
if (n % 3 == 1 || n % 3 == 2) {
if (alz == 1)
printf("Yes\n");
else
printf("No\n");
return 0;
}
kep[0] = a[0];
for (int i = 1; i < n; i++) {
int judge = 1;
REP(j, count) {
if (kep[j] == a[i]) {
judge = 0;
c[j]++;
}
}
if (judge == 1) {
if (count >= 3) {
printf("No\n");
return 0;
} else {
kep[count] = a[i];
c[count]++;
count++;
}
}
}
// REP(i,3)printf("###%d\n",kep[i]);
// REP(i,3)printf("###%d\n",c[i]);
if (count == 1) {
if (alz == 1)
printf("Yes\n");
else
printf("No\n");
return 0;
}
if (count == 2) {
if (alz == 1)
printf("Yes\n");
else if (c[0] == c[1] * 2 && kep[1] == 0) {
printf("Yes\n");
} else if (c[1] == c[0] * 2 && kep[0] == 0) {
printf("Yes\n");
} else
printf("No\n");
return 0;
}
if (count == 3) {
if (c[0] == c[1] && c[1] == c[2]) {
if ((kep[0] ^ kep[2]) == kep[1])
printf("Yes\n");
else
printf("No\n");
} else
printf("No\n");
return 0;
}
} | [
"literal.number.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change"
] | 782,396 | 782,397 | u092002408 | cpp |
p02975 | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define ALL(a) (a).begin(), (a).end()
#define SORT(c) sort((c).begin(), (c).end())
#define REV(c) reverse((c).begin(), (c).end())
using namespace std;
typedef pair<int, int> P;
// 最大公約数
int64_t gcd(int64_t a, int64_t b) { return b != 0 ? gcd(b, a % b) : a; }
// 最小公倍数
int64_t lcm(int64_t a, int64_t b) { return a * b / gcd(a, b); }
int ctoi(char c) { return c - '0'; }
int main() {
int64_t n;
cin >> n;
vector<int64_t> vec(n);
int64_t f, s, t;
f = INT_MIN;
s = INT_MIN;
t = INT_MIN;
REP(i, n) { cin >> vec.at(i); }
int64_t fc = 0;
int64_t sc = 0;
int64_t tc = 0;
int64_t oc = 0;
REP(i, n) {
if (f == INT_MIN) {
f = vec.at(i);
fc++;
} else if (vec.at(i) == f) {
fc++;
} else if (s == INT_MIN) {
s = vec.at(i);
sc++;
} else if (vec.at(i) == s) {
sc++;
} else if (t == INT_MIN) {
t = vec.at(i);
tc++;
} else if (vec.at(i) == t) {
tc++;
} else {
oc++;
}
}
if (f == 0 && sc == 0 && tc == 0 && oc == 0) {
cout << "Yes" << endl;
return 0;
}
if (f == 0 && fc * 2 == sc && tc == 0 && oc == 0) {
cout << "Yes" << endl;
return 0;
}
if (((f ^ s) ^ t) == 0 && ((s ^ t) ^ f) == 0 && ((t ^ f) ^ s) == 0) {
if (fc == sc && sc == tc && oc == 0) {
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++)
#define ALL(a) (a).begin(), (a).end()
#define SORT(c) sort((c).begin(), (c).end())
#define REV(c) reverse((c).begin(), (c).end())
using namespace std;
typedef pair<int, int> P;
// 最大公約数
int64_t gcd(int64_t a, int64_t b) { return b != 0 ? gcd(b, a % b) : a; }
// 最小公倍数
int64_t lcm(int64_t a, int64_t b) { return a * b / gcd(a, b); }
int ctoi(char c) { return c - '0'; }
int main() {
int64_t n;
cin >> n;
vector<int64_t> vec(n);
int64_t f, s, t;
f = INT_MIN;
s = INT_MIN;
t = INT_MIN;
REP(i, n) { cin >> vec.at(i); }
SORT(vec);
int64_t fc = 0;
int64_t sc = 0;
int64_t tc = 0;
int64_t oc = 0;
REP(i, n) {
if (f == INT_MIN) {
f = vec.at(i);
fc++;
} else if (vec.at(i) == f) {
fc++;
} else if (s == INT_MIN) {
s = vec.at(i);
sc++;
} else if (vec.at(i) == s) {
sc++;
} else if (t == INT_MIN) {
t = vec.at(i);
tc++;
} else if (vec.at(i) == t) {
tc++;
} else {
oc++;
}
}
if (f == 0 && sc == 0 && tc == 0 && oc == 0) {
cout << "Yes" << endl;
return 0;
}
if (f == 0 && fc * 2 == sc && tc == 0 && oc == 0) {
cout << "Yes" << endl;
return 0;
}
if (((f ^ s) ^ t) == 0 && ((s ^ t) ^ f) == 0 && ((t ^ f) ^ s) == 0) {
if (fc == sc && sc == tc && oc == 0) {
cout << "Yes" << endl;
return 0;
}
}
cout << "No" << endl;
return 0;
}
| [
"call.add"
] | 782,398 | 782,399 | u942230032 | cpp |
p02975 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define ll long long
#define fr(i, k, N) for (ll i = k; i < N; i++)
#define rep(i, N) for (ll i = 0; i < N; i++)
#define ALL(v) v.begin(), v.end()
#define mp make_pair
using namespace std;
template <class X> void pr(X test) { cout << test << endl; }
template <class X> void prr(X test) {
for (auto it : test) {
cout << it << endl;
}
}
template <class X> void prrr(X test) {
int f = 0;
for (auto it : test) {
cout << (f++ != 0 ? " " : "") << it;
}
cout << endl;
}
template <typename X> istream &operator>>(istream &i, vector<X> &v) {
for (X &x : v)
i >> x;
return i;
}
class UF { // union find from https://github.com/kartikkukreja/blog-codes (MIT)
// [usage]
// auto uf = new UF(n);
// uf->merge(l, r); // 0 <= l, r <= n-1
// ...
public:
int *id; // inner id
int cnt; // number of all vartices
int *sz; // sz[i] means size of i's set
UF(int N) {
cnt = N;
id = new int[N];
sz = new int[N];
for (int i = 0; i < N; i++) {
id[i] = i;
sz[i] = 1;
}
}
~UF() {
delete[] id;
delete[] sz;
}
int find(int p) {
int root = p;
while (root != id[root])
root = id[root];
while (p != root) {
int newp = id[p];
id[p] = root;
p = newp;
}
return root;
}
void merge(int x, int y) {
int i = find(x);
int j = find(y);
if (i == j)
return;
if (sz[i] < sz[j]) {
id[i] = j;
sz[j] += sz[i];
} else {
id[j] = i;
sz[i] += sz[j];
}
cnt--;
}
bool connected(int x, int y) { return find(x) == find(y); }
int count() { return cnt; }
};
// return sorted 約数list 1 <= x <= n
vector<ll> divv(ll n) {
vector<ll> v;
for (ll i = 1; i * i <= n; i++) {
if (n % i == 0) {
v.push_back(i);
if (i * i != n)
v.push_back(n / i);
}
}
sort(ALL(v));
return v;
}
int main() {
ll n;
cin >> n;
vector<ll> v(n);
cin >> v;
unordered_map<ll, ll> m;
ll nc = 0;
rep(i, n) {
m[v[i]] += 1;
if (v[i] != 0)
nc = 1;
}
if (nc == 0) {
pr("yes");
return 0;
}
ll siz = m.size();
if (n % 3 != 0) {
pr("No");
} else if (siz > 3) {
pr("No");
} else {
ll cout = n / 3;
vector<ll> ans;
for (auto it : m) {
if (it.second % cout != 0) {
pr("No");
return 0;
} else if (it.second / cout == 1) {
ans.push_back(it.first);
} else if (it.second / cout == 2) {
ans.push_back(it.first);
ans.push_back(it.first);
} else if (it.second / cout == 3) {
ans.push_back(it.first);
ans.push_back(it.first);
ans.push_back(it.first);
} else {
pr("No");
return 0;
}
}
bool b = false;
if ((ans[0] ^ ans[1]) == ans[2])
b = true;
if ((ans[0] ^ ans[2]) == ans[1])
b = true;
if ((ans[1] ^ ans[2]) == ans[0])
b = true;
if (b)
pr("Yes");
else
pr("No");
}
return 0;
}
| #include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define ll long long
#define fr(i, k, N) for (ll i = k; i < N; i++)
#define rep(i, N) for (ll i = 0; i < N; i++)
#define ALL(v) v.begin(), v.end()
#define mp make_pair
using namespace std;
template <class X> void pr(X test) { cout << test << endl; }
template <class X> void prr(X test) {
for (auto it : test) {
cout << it << endl;
}
}
template <class X> void prrr(X test) {
int f = 0;
for (auto it : test) {
cout << (f++ != 0 ? " " : "") << it;
}
cout << endl;
}
template <typename X> istream &operator>>(istream &i, vector<X> &v) {
for (X &x : v)
i >> x;
return i;
}
class UF { // union find from https://github.com/kartikkukreja/blog-codes (MIT)
// [usage]
// auto uf = new UF(n);
// uf->merge(l, r); // 0 <= l, r <= n-1
// ...
public:
int *id; // inner id
int cnt; // number of all vartices
int *sz; // sz[i] means size of i's set
UF(int N) {
cnt = N;
id = new int[N];
sz = new int[N];
for (int i = 0; i < N; i++) {
id[i] = i;
sz[i] = 1;
}
}
~UF() {
delete[] id;
delete[] sz;
}
int find(int p) {
int root = p;
while (root != id[root])
root = id[root];
while (p != root) {
int newp = id[p];
id[p] = root;
p = newp;
}
return root;
}
void merge(int x, int y) {
int i = find(x);
int j = find(y);
if (i == j)
return;
if (sz[i] < sz[j]) {
id[i] = j;
sz[j] += sz[i];
} else {
id[j] = i;
sz[i] += sz[j];
}
cnt--;
}
bool connected(int x, int y) { return find(x) == find(y); }
int count() { return cnt; }
};
// return sorted 約数list 1 <= x <= n
vector<ll> divv(ll n) {
vector<ll> v;
for (ll i = 1; i * i <= n; i++) {
if (n % i == 0) {
v.push_back(i);
if (i * i != n)
v.push_back(n / i);
}
}
sort(ALL(v));
return v;
}
int main() {
ll n;
cin >> n;
vector<ll> v(n);
cin >> v;
unordered_map<ll, ll> m;
ll nc = 0;
rep(i, n) {
m[v[i]] += 1;
if (v[i] != 0)
nc = 1;
}
if (nc == 0) {
pr("Yes");
return 0;
}
ll siz = m.size();
if (n % 3 != 0) {
pr("No");
} else if (siz > 3) {
pr("No");
} else {
ll cout = n / 3;
vector<ll> ans;
for (auto it : m) {
if (it.second % cout != 0) {
pr("No");
return 0;
} else if (it.second / cout == 1) {
ans.push_back(it.first);
} else if (it.second / cout == 2) {
ans.push_back(it.first);
ans.push_back(it.first);
} else if (it.second / cout == 3) {
ans.push_back(it.first);
ans.push_back(it.first);
ans.push_back(it.first);
} else {
pr("No");
return 0;
}
}
bool b = false;
if ((ans[0] ^ ans[1]) == ans[2])
b = true;
if ((ans[0] ^ ans[2]) == ans[1])
b = true;
if ((ans[1] ^ ans[2]) == ans[0])
b = true;
if (b)
pr("Yes");
else
pr("No");
}
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 782,404 | 782,405 | u754514364 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> A(N);
map<int, int> cnt;
vector<int> num;
for (int i = 0; i < N; ++i) {
cin >> A[i];
cnt[A[i]] += 1;
if (cnt[A[i]] == 1)
num.push_back(A[i]);
}
if (N % 3) {
if (cnt[0] == N)
cout << "Yes" << endl;
else
cout << "No" << endl;
} else {
if (num.size() > 3)
cout << "No" << endl;
else if (num.size() == 3) {
if (cnt[num[0]] == N / 3 && cnt[num[1]] == N / 3 &&
cnt[num[2]] == N / 3 && (num[0] ^ num[1] == num[2]))
cout << "Yes" << endl;
else
cout << "No" << endl;
} else if (num.size() == 2) {
if (num[0] == 0 && cnt[num[1]] == 2 * cnt[num[0]])
cout << "Yes" << endl;
else if (num[1] == 0 && cnt[num[0]] == 2 * cnt[num[1]])
cout << "Yes" << endl;
else
cout << "No" << endl;
} else {
if (num[0] == 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);
map<int, int> cnt;
vector<int> num;
for (int i = 0; i < N; ++i) {
cin >> A[i];
cnt[A[i]] += 1;
if (cnt[A[i]] == 1)
num.push_back(A[i]);
}
if (N % 3) {
if (cnt[0] == N)
cout << "Yes" << endl;
else
cout << "No" << endl;
} else {
if (num.size() > 3)
cout << "No" << endl;
else if (num.size() == 3) {
if (cnt[num[0]] == N / 3 && cnt[num[1]] == N / 3 &&
cnt[num[2]] == N / 3 && (num[0] ^ num[1]) == num[2])
cout << "Yes" << endl;
else
cout << "No" << endl;
} else if (num.size() == 2) {
if (num[0] == 0 && cnt[num[1]] == 2 * cnt[num[0]])
cout << "Yes" << endl;
else if (num[1] == 0 && cnt[num[0]] == 2 * cnt[num[1]])
cout << "Yes" << endl;
else
cout << "No" << endl;
} else {
if (num[0] == 0)
cout << "Yes" << endl;
else
cout << "No" << endl;
}
}
} | [
"control_flow.branch.if.condition.change"
] | 782,415 | 782,416 | u645369394 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
cerr << " " << to_string(H);
debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
#define rep(i, n) for (int i = 0; i < (int)(n); 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;
}
using ll = long long;
using P = pair<ll, ll>;
// constexpr ll mod = 998244353;
constexpr ll mod = 1e9 + 7;
const double PI = acos(-1.0);
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
unordered_map<int, int> mp;
rep(i, n) {
int a;
cin >> a;
mp[a]++;
}
if (mp.size() > 3) {
cout << "No" << endl;
return 0;
}
if (mp.size() == 3) {
if (n % 3 != 0) {
cout << "No" << endl;
return 0;
}
vector<int> vec;
for (auto e : mp) {
vec.push_back(e.first);
if (e.second != n / 3) {
cout << "No" << endl;
return 0;
}
}
if (vec[0] ^ vec[1] == vec[2]) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
if (mp.size() == 2) {
if (n % 3 != 0) {
cout << "No" << endl;
return 0;
}
bool flag1 = false;
bool flag2 = false;
for (auto e : mp) {
if (e.first == 0 && e.second == n / 3) {
flag1 = true;
}
if (e.first != 0 && e.second == n * 2 / 3) {
flag2 = true;
}
}
if (flag1 && flag2) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
if (mp.size() == 1) {
for (auto e : mp) {
if (e.first == 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
}
} | #include <bits/stdc++.h>
using namespace std;
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
cerr << " " << to_string(H);
debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
#define rep(i, n) for (int i = 0; i < (int)(n); 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;
}
using ll = long long;
using P = pair<ll, ll>;
// constexpr ll mod = 998244353;
constexpr ll mod = 1e9 + 7;
const double PI = acos(-1.0);
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
unordered_map<int, int> mp;
rep(i, n) {
int a;
cin >> a;
mp[a]++;
}
if (mp.size() > 3) {
cout << "No" << endl;
return 0;
}
if (mp.size() == 3) {
if (n % 3 != 0) {
cout << "No" << endl;
return 0;
}
vector<int> vec;
for (auto e : mp) {
vec.push_back(e.first);
if (e.second != n / 3) {
cout << "No" << endl;
return 0;
}
}
if ((vec[0] ^ vec[1]) == vec[2]) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
if (mp.size() == 2) {
if (n % 3 != 0) {
cout << "No" << endl;
return 0;
}
bool flag1 = false;
bool flag2 = false;
for (auto e : mp) {
if (e.first == 0 && e.second == n / 3) {
flag1 = true;
}
if (e.first != 0 && e.second == n * 2 / 3) {
flag2 = true;
}
}
if (flag1 && flag2) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
if (mp.size() == 1) {
for (auto e : mp) {
if (e.first == 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
}
} | [
"control_flow.branch.if.condition.change"
] | 782,425 | 782,426 | u492373312 | cpp |
p02975 | #include <bits/stdc++.h>
#define va first
#define vb second
#define lb lower_bound
#define ub upper_bound
#define pp push_back
#define ep emplace_back
#define all(v) (v).begin(), (v).end()
#define szz(v) ((int)(v).size())
#define psm partial_sum
#define acm accumulate
#define fio \
ios_base::sync_with_stdio(0); \
cin.tie(0);
using namespace std;
using ll = long long;
using lf = long double;
using pii = pair<int, int>;
using ppi = pair<int, pii>;
using pss = pair<short, short>;
using pll = pair<ll, ll>;
const lf PI = 3.14159265358979323846264338L;
template <typename T> inline T umax(T &u, T v) { return u = max(u, v); }
template <typename T> inline T umin(T &u, T v) { return u = min(u, v); }
int n, a[100005];
map<int, int> M;
int main() {
fio;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
M[a[i]]++;
}
sort(a, a + n);
int u = unique(a, a + n) - a;
switch (u) {
case 1:
cout << (a[0] == 0 ? "Yes" : "No") << '\n';
break;
case 2:
cout << (a[0] == 0 && (M[0] * 2 == M[a[1]]) ? "Yes" : "No") << '\n';
break;
case 3:
cout << (n % 3 == 0 && a[0] ^ a[1] == a[2] && M[a[0]] == M[a[1]] &&
M[a[1]] == M[a[2]]
? "Yes"
: "No")
<< '\n';
break;
default:
cout << "No\n";
}
return 0;
} | #include <bits/stdc++.h>
#define va first
#define vb second
#define lb lower_bound
#define ub upper_bound
#define pp push_back
#define ep emplace_back
#define all(v) (v).begin(), (v).end()
#define szz(v) ((int)(v).size())
#define psm partial_sum
#define acm accumulate
#define fio \
ios_base::sync_with_stdio(0); \
cin.tie(0);
using namespace std;
using ll = long long;
using lf = long double;
using pii = pair<int, int>;
using ppi = pair<int, pii>;
using pss = pair<short, short>;
using pll = pair<ll, ll>;
const lf PI = 3.14159265358979323846264338L;
template <typename T> inline T umax(T &u, T v) { return u = max(u, v); }
template <typename T> inline T umin(T &u, T v) { return u = min(u, v); }
int n, a[100005];
map<int, int> M;
int main() {
fio;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
M[a[i]]++;
}
sort(a, a + n);
int u = unique(a, a + n) - a;
switch (u) {
case 1:
cout << (a[0] == 0 ? "Yes" : "No") << '\n';
break;
case 2:
cout << (a[0] == 0 && (M[0] * 2 == M[a[1]]) ? "Yes" : "No") << '\n';
break;
case 3:
cout << (n % 3 == 0 && (a[0] ^ a[1]) == a[2] && M[a[0]] == M[a[1]] &&
M[a[1]] == M[a[2]]
? "Yes"
: "No")
<< '\n';
break;
default:
cout << "No\n";
}
return 0;
} | [] | 782,427 | 782,428 | u582763758 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
int n, a[100010], l[10];
vector<int> v;
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
v.push_back(a[i]);
}
sort(v.begin(), v.end());
v.erase(unique(v.begin(), v.end()), v.end());
if (v[0] == 0) {
if (v.size() > 2) {
cout << "No" << endl;
return 0;
}
if (v.size() == 1) {
cout << "Yes" << endl;
return 0;
} else if (v.size() == 2) {
for (int i = 0; i < n; i++) {
if (a[i] == v[0])
l[0]++;
if (a[i] == v[1])
l[1]++;
}
if (l[0] * 2 == l[1])
cout << "Yes" << endl;
else
cout << "No" << endl;
}
return 0;
}
if (v.size() != 3) {
cout << "No" << endl;
return 0;
}
for (int i = 0; i < n; i++) {
if (a[i] == v[0])
l[0]++;
if (a[i] == v[1])
l[1]++;
if (a[i] == v[2])
l[2]++;
}
if (l[0] == l[1] && l[1] == l[2] &&
(v[0] ^ v[1] == v[2] || v[1] ^ v[2] == v[0] || v[0] ^ v[2] == v[1]))
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int n, a[100010], l[10];
vector<int> v;
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
v.push_back(a[i]);
}
sort(v.begin(), v.end());
v.erase(unique(v.begin(), v.end()), v.end());
if (v[0] == 0) {
if (v.size() > 2) {
cout << "No" << endl;
return 0;
}
if (v.size() == 1) {
cout << "Yes" << endl;
return 0;
} else if (v.size() == 2) {
for (int i = 0; i < n; i++) {
if (a[i] == v[0])
l[0]++;
if (a[i] == v[1])
l[1]++;
}
if (l[0] * 2 == l[1])
cout << "Yes" << endl;
else
cout << "No" << endl;
}
return 0;
}
if (v.size() != 3) {
cout << "No" << endl;
return 0;
}
for (int i = 0; i < n; i++) {
if (a[i] == v[0])
l[0]++;
if (a[i] == v[1])
l[1]++;
if (a[i] == v[2])
l[2]++;
}
if (l[0] == l[1] && l[1] == l[2] &&
((v[0] ^ v[1]) == v[2] || (v[1] ^ v[2]) == v[0] || (v[0] ^ v[2]) == v[1]))
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
} | [
"control_flow.branch.if.condition.change"
] | 782,429 | 782,430 | u966582222 | cpp |
p02975 | // failed to generate code
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> P1;
typedef pair<P, P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i, x) for (int i = 0; i < x; i++)
#define repn(i, x) for (int i = 1; i <= x; i++)
#define SORT(x) sort(x.begin(), x.end())
#define ERASE(x) x.erase(unique(x.begin(), x.end()), x.end())
#define POSL(x, v) (lower_bound(x.begin(), x.end(), v) - x.begin())
#define POSU(x, v) (upper_bound(x.begin(), x.end(), v) - x.begin())
vector<pair<string, P>> vec;
int main() {
ll N;
cin >> N;
vector<ll> a(N), b(3);
map<ll, ll> m;
ll k = 0;
rep(i, N) {
cin >> a[i];
if (m[a[i]] == 0) {
if (k == 0)
b[0] = a[i];
if (k == 1)
b[1] = a[i];
if (k == 2)
b[2] = a[i];
k++;
}
m[a[i]]++;
}
if ((k == 3 && (b[0] | b[1]) == b[2] && m[b[0]] == m[b[1]] &&
m[b[0]] == m[b[2]]) ||
(k == 2 && ((b[0] == 0 && 2 * m[b[0]] == m[b[1]]) ||
(b[1] == 0 && 2 * m[b[1]] == m[b[0]]))) ||
(k == 1 && b[0] == 0))
cout << "Yes" << endl;
else
cout << "No" << endl;
}
| // failed to generate code
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> P1;
typedef pair<P, P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i, x) for (int i = 0; i < x; i++)
#define repn(i, x) for (int i = 1; i <= x; i++)
#define SORT(x) sort(x.begin(), x.end())
#define ERASE(x) x.erase(unique(x.begin(), x.end()), x.end())
#define POSL(x, v) (lower_bound(x.begin(), x.end(), v) - x.begin())
#define POSU(x, v) (upper_bound(x.begin(), x.end(), v) - x.begin())
vector<pair<string, P>> vec;
int main() {
ll N;
cin >> N;
vector<ll> a(N), b(3);
map<ll, ll> m;
ll k = 0;
rep(i, N) {
cin >> a[i];
if (m[a[i]] == 0) {
if (k == 0)
b[0] = a[i];
if (k == 1)
b[1] = a[i];
if (k == 2)
b[2] = a[i];
k++;
}
m[a[i]]++;
}
if ((k == 3 && (b[0] ^ b[1]) == b[2] && m[b[0]] == m[b[1]] &&
m[b[0]] == m[b[2]]) ||
(k == 2 && ((b[0] == 0 && 2 * m[b[0]] == m[b[1]]) ||
(b[1] == 0 && 2 * m[b[1]] == m[b[0]]))) ||
(k == 1 && b[0] == 0))
cout << "Yes" << endl;
else
cout << "No" << endl;
}
| [
"control_flow.branch.if.condition.change"
] | 782,433 | 782,434 | u709604332 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
bool solve(int N, vector<ll> k, vector<ll> n) {
if (k.size() == 1) {
if (k[0] == 0) {
return true;
}
} else if (k.size() == 2) {
if (N % 3 != 0)
return false;
if (k[0] == 0) {
if (2 * n[0] == n[1]) {
return true;
}
} else if (k[1] == 0) {
if (2 * n[1] == n[0]) {
return true;
}
}
} else if (k.size() == 3) {
if (N % 3 != 0)
return false;
if (k[0] ^ k[1] == k[2] && n[0] == n[1] && n[1] == n[2]) {
return true;
}
}
return false;
}
int main() {
ll N;
cin >> N;
ll a;
map<ll, int> c;
for (int i = 0; i < N; i++) {
cin >> a;
c[a]++;
}
vector<ll> k, n;
for (auto p : c) {
k.push_back(p.first);
n.push_back(p.second);
}
string ans = solve(N, k, n) ? "Yes" : "No";
cout << ans << "\n";
return 0;
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
bool solve(int N, vector<ll> k, vector<ll> n) {
if (k.size() == 1) {
if (k[0] == 0) {
return true;
}
} else if (k.size() == 2) {
if (N % 3 != 0)
return false;
if (k[0] == 0) {
if (2 * n[0] == n[1]) {
return true;
}
} else if (k[1] == 0) {
if (2 * n[1] == n[0]) {
return true;
}
}
} else if (k.size() == 3) {
if (N % 3 != 0)
return false;
if ((k[0] ^ k[1]) == k[2] && n[0] == n[1] && n[1] == n[2]) {
return true;
}
}
return false;
}
int main() {
ll N;
cin >> N;
ll a;
map<ll, int> c;
for (int i = 0; i < N; i++) {
cin >> a;
c[a]++;
}
vector<ll> k, n;
for (auto p : c) {
k.push_back(p.first);
n.push_back(p.second);
}
string ans = solve(N, k, n) ? "Yes" : "No";
cout << ans << "\n";
return 0;
} | [
"control_flow.branch.if.condition.change"
] | 782,435 | 782,436 | u930841425 | cpp |
p02975 | #include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i, N) for (LL i = 0; i < N; ++i)
typedef long long int LL;
int main() {
LL N;
in >> N;
std::vector<LL> a(N);
rep(i, N) in >> a[i];
std::map<LL, LL> cnt;
rep(i, N)++ cnt[a[i]];
bool ans = false;
if (cnt.size() == 3) {
LL b[3];
LL d[3];
LL c = 0;
for (auto i : cnt) {
b[c] = i.second;
d[c] = i.first;
++c;
}
std::sort(b, b + 3);
if (N % 3 == 0 && (d[0] ^ d[1] == d[2]) && (d[0] ^ d[2] == d[1]) &&
(d[1] ^ d[2] == d[0])) {
if (b[0] == b[1] && b[1] == b[2] && b[0] == b[2])
ans = true;
}
}
if (cnt.size() == 2) {
LL b[2];
LL d[2];
LL c = 0;
for (auto i : cnt) {
b[c] = i.second;
d[c] = i.first;
++c;
}
std::sort(b, b + 2);
std::sort(d, d + 2);
if (N % 3 == 0) {
if (cnt[d[1]] == cnt[d[0]] * 2 && d[0] == 0)
ans = true;
}
}
if (cnt.size() == 1) {
if (cnt[0] == N)
ans = true;
}
out << (ans ? "Yes" : "No") << std::endl;
}
| #include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i, N) for (LL i = 0; i < N; ++i)
typedef long long int LL;
int main() {
LL N;
in >> N;
std::vector<LL> a(N);
rep(i, N) in >> a[i];
std::map<LL, LL> cnt;
rep(i, N)++ cnt[a[i]];
bool ans = false;
if (cnt.size() == 3) {
LL b[3];
LL d[3];
LL c = 0;
for (auto i : cnt) {
b[c] = i.second;
d[c] = i.first;
++c;
}
std::sort(b, b + 3);
if (N % 3 == 0 && ((d[0] ^ d[1]) == d[2]) && ((d[0] ^ d[2]) == d[1]) &&
((d[1] ^ d[2]) == d[0])) {
if (b[0] == b[1] && b[1] == b[2] && b[0] == b[2])
ans = true;
}
}
if (cnt.size() == 2) {
LL b[2];
LL d[2];
LL c = 0;
for (auto i : cnt) {
b[c] = i.second;
d[c] = i.first;
++c;
}
std::sort(b, b + 2);
std::sort(d, d + 2);
if (N % 3 == 0) {
if (cnt[d[1]] == cnt[d[0]] * 2 && d[0] == 0)
ans = true;
}
}
if (cnt.size() == 1) {
if (cnt[0] == N)
ans = true;
}
out << (ans ? "Yes" : "No") << std::endl;
}
| [
"control_flow.branch.if.condition.change"
] | 782,437 | 782,438 | u660613376 | cpp |
p02975 | #include <algorithm>
#include <assert.h>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iosfwd>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
using namespace std;
const int N = 6e5 + 500;
const int LN = 21;
const long long mod = 1e9 + 7;
const long long INF = 1LL << 57;
long long n, m, u, v, k, t, q, a, x, d, b, c, p;
set<int> res;
int arr[N];
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> n;
for (int i = 1; i <= n; ++i) {
cin >> arr[i];
res.insert(arr[i]);
}
sort(arr + 1, arr + 1 + n);
if (res.size() == 1 and arr[1] == 0) {
cout << "YES" << endl;
return 0;
}
if (n % 3 != 0 or res.size() > 3) {
cout << "NO" << endl;
return 0;
} else {
int f = n / 3;
if (arr[1] != arr[f] or arr[f + 1] != arr[2 * f] or
arr[2 * f + 1] != arr[3 * f]) {
cout << "NO" << endl;
return 0;
}
if ((arr[1] ^ arr[1 + f]) != arr[2 * f + 1]) {
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
}
| #include <algorithm>
#include <assert.h>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iosfwd>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
using namespace std;
const int N = 6e5 + 500;
const int LN = 21;
const long long mod = 1e9 + 7;
const long long INF = 1LL << 57;
long long n, m, u, v, k, t, q, a, x, d, b, c, p;
set<int> res;
int arr[N];
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> n;
for (int i = 1; i <= n; ++i) {
cin >> arr[i];
res.insert(arr[i]);
}
sort(arr + 1, arr + 1 + n);
if (res.size() == 1 and arr[1] == 0) {
cout << "Yes" << endl;
return 0;
}
if (n % 3 != 0 or res.size() > 3) {
cout << "No" << endl;
return 0;
} else {
int f = n / 3;
if (arr[1] != arr[f] or arr[f + 1] != arr[2 * f] or
arr[2 * f + 1] != arr[3 * f]) {
cout << "No" << endl;
return 0;
}
if ((arr[1] ^ arr[1 + f]) != arr[2 * f + 1]) {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 782,449 | 782,450 | u093316595 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
const int maxx = 1e5 + 2;
int a[maxx];
unordered_map<int, int> mp;
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
scanf("%d", &a[i]);
}
int cnt = 0;
for (int i = 1; i <= n; i++) {
if (a[i] == 0)
cnt++;
}
if (cnt == n) {
return 0 * puts("Yes");
}
if (n % 3) {
return 0 * puts("No");
}
for (int i = 1; i <= n; i++) {
mp[a[i]]++;
}
if (cnt > 0) {
if (cnt == n / 3) {
for (auto t : mp) {
if (t.first == 0)
continue;
if (t.second == n / 2 * 3) {
return 0 * puts("Yes");
} else {
return 0 * puts("No");
}
}
} else {
return 0 * puts("No");
}
}
if (mp.size() == 3) {
for (auto t : mp) {
if (t.second != n / 3) {
return 0 * puts("No");
}
}
int ans = 0;
for (auto t : mp) {
ans ^= t.first;
}
if (ans)
return 0 * puts("No");
else
return 0 * puts("Yes");
} else {
return 0 * puts("No");
}
} | #include <bits/stdc++.h>
using namespace std;
const int maxx = 1e5 + 2;
int a[maxx];
unordered_map<int, int> mp;
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
scanf("%d", &a[i]);
}
int cnt = 0;
for (int i = 1; i <= n; i++) {
if (a[i] == 0)
cnt++;
}
if (cnt == n) {
return 0 * puts("Yes");
}
if (n % 3) {
return 0 * puts("No");
}
for (int i = 1; i <= n; i++) {
mp[a[i]]++;
}
if (cnt > 0) {
if (cnt == n / 3) {
for (auto t : mp) {
if (t.first == 0)
continue;
if (t.second == n / 3 * 2) {
return 0 * puts("Yes");
} else {
return 0 * puts("No");
}
}
} else {
return 0 * puts("No");
}
}
if (mp.size() == 3) {
for (auto t : mp) {
if (t.second != n / 3) {
return 0 * puts("No");
}
}
int ans = 0;
for (auto t : mp) {
ans ^= t.first;
}
if (ans)
return 0 * puts("No");
else
return 0 * puts("Yes");
} else {
return 0 * puts("No");
}
} | [
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 782,453 | 782,454 | u128408308 | cpp |
p02975 | #include <bits/stdc++.h>
#define lowbit(a) ((a) & (-(a)))
using namespace std;
int n;
int a[100000 + 5];
int main() {
cin >> n;
for (int i = 0; i < n; i++)
cin >> a[i];
int flag = 0;
for (int i = 0; i < n; i++) {
flag ^= a[i];
}
if (flag == 0)
printf("YES\n");
else
printf("NO\n");
return 0;
} | #include <bits/stdc++.h>
#define lowbit(a) ((a) & (-(a)))
using namespace std;
int n;
int a[100000 + 5];
int main() {
cin >> n;
for (int i = 0; i < n; i++)
cin >> a[i];
int flag = 0;
for (int i = 0; i < n; i++) {
flag ^= a[i];
}
if (flag == 0)
printf("Yes\n");
else
printf("No\n");
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 782,455 | 782,456 | u066917439 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
#define FasterIO \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
int main() {
FasterIO;
int n;
while (cin >> n) {
int data[n];
for (int i = 0; i < n; i++)
cin >> data[i];
int XOR = 0;
for (int i = 0; i < n; i++) {
XOR ^= data[i];
}
cout << (XOR ? "Yes" : "No") << endl;
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define FasterIO \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
int main() {
FasterIO;
int n;
while (cin >> n) {
int data[n];
for (int i = 0; i < n; i++)
cin >> data[i];
int XOR = 0;
for (int i = 0; i < n; i++) {
XOR ^= data[i];
}
cout << (!XOR ? "Yes" : "No") << endl;
}
return 0;
}
| [
"expression.operation.unary.add",
"control_flow.loop.condition.change"
] | 782,459 | 782,460 | u151681737 | cpp |
p02975 | #define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <string>
#include <time.h>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
int N, a[112345];
int main() {
scanf("%d", &N);
rep(i, N) scanf("%d", &a[i]);
map<int, int> m;
rep(i, N) m[a[i]]++;
if (m.size() > 3) {
printf("No\n");
return 0;
}
if (m.size() == 1) {
if (m[0]) {
printf("Yes\n");
return 0;
}
printf("No\n");
return 0;
}
if (m.size() == 2) {
if (N % 2 || !m[0]) {
printf("No\n");
return 0;
}
int n;
for (auto mm : m) {
n = mm.first;
}
if (m[0] == m[n]) {
printf("Yes\n");
return 0;
}
printf("No\n");
return 0;
}
if (N % 3) {
printf("No\n");
return 0;
}
vector<int> v;
for (auto mm : m) {
v.push_back(mm.first);
}
if ((v[0] ^ v[1]) == v[2]) {
if (m[v[0]] == m[v[1]] && m[v[1]] == m[v[2]]) {
printf("Yes\n");
return 0;
}
}
printf("No\n");
return 0;
}
| #define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <string>
#include <time.h>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
int N, a[112345];
int main() {
scanf("%d", &N);
rep(i, N) scanf("%d", &a[i]);
map<int, int> m;
rep(i, N) m[a[i]]++;
if (m.size() > 3) {
printf("No\n");
return 0;
}
if (m.size() == 1) {
if (m[0]) {
printf("Yes\n");
return 0;
}
printf("No\n");
return 0;
}
if (m.size() == 2) {
if (N % 3 || !m[0]) {
printf("No\n");
return 0;
}
int n;
for (auto mm : m) {
n = mm.first;
}
if (m[0] * 2 == m[n]) {
printf("Yes\n");
return 0;
}
printf("No\n");
return 0;
}
if (N % 3) {
printf("No\n");
return 0;
}
vector<int> v;
for (auto mm : m) {
v.push_back(mm.first);
}
if ((v[0] ^ v[1]) == v[2]) {
if (m[v[0]] == m[v[1]] && m[v[1]] == m[v[2]]) {
printf("Yes\n");
return 0;
}
}
printf("No\n");
return 0;
}
| [
"literal.number.change",
"control_flow.branch.if.condition.change"
] | 782,465 | 782,466 | u810616694 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int n, a, x;
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a;
x = x ^ a;
}
if (x == 0)
cout << "yes";
else
cout << "no";
}
| #include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int n, a, x;
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a;
x = x ^ a;
}
if (x == 0)
cout << "Yes" << endl;
else
cout << "No";
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change",
"io.output.newline.add"
] | 782,467 | 782,468 | u589412018 | cpp |
p02975 | #include <bits/stdc++.h>
#define FOR(a, b, c) for (int a = (b), _for = (c); a < _for; ++a)
#define REP(a, n) FOR(a, 0, n)
#define x first
#define y second
#define pb push_back
#define pii pair<int, int>
#define ll long long
#define lf double
using namespace std;
const int MAX = (int)1e5 + 5;
int n;
int p[MAX];
void END(int out) {
if (out)
puts("YES");
else
puts("NO");
exit(0);
}
int main() {
scanf("%d", &n);
REP(i, n) scanf("%d", p + i);
int c = 0;
REP(i, n) if (p[i] != 0) c = 1;
if (!c)
END(1);
if (n % 3)
END(0);
map<int, int> m;
REP(i, n) m[p[i]]++;
if (m.size() > 3)
END(0);
vector<int> v;
for (auto x : m) {
REP(i, x.y * 3 / n) v.pb(x.x);
}
if (v.size() != 3)
END(0);
int a = v[0], b = v[1];
c = v[2];
if ((a ^ b) != c)
END(0);
if ((c ^ b) != a)
END(0);
if ((a ^ c) != b)
END(0);
END(1);
return 0;
}
| #include <bits/stdc++.h>
#define FOR(a, b, c) for (int a = (b), _for = (c); a < _for; ++a)
#define REP(a, n) FOR(a, 0, n)
#define x first
#define y second
#define pb push_back
#define pii pair<int, int>
#define ll long long
#define lf double
using namespace std;
const int MAX = (int)1e5 + 5;
int n;
int p[MAX];
void END(int out) {
if (out)
puts("Yes");
else
puts("No");
exit(0);
}
int main() {
scanf("%d", &n);
REP(i, n) scanf("%d", p + i);
int c = 0;
REP(i, n) if (p[i] != 0) c = 1;
if (!c)
END(1);
if (n % 3)
END(0);
map<int, int> m;
REP(i, n) m[p[i]]++;
if (m.size() > 3)
END(0);
vector<int> v;
for (auto x : m) {
REP(i, x.y * 3 / n) v.pb(x.x);
}
if (v.size() != 3)
END(0);
int a = v[0], b = v[1];
c = v[2];
if ((a ^ b) != c)
END(0);
if ((c ^ b) != a)
END(0);
if ((a ^ c) != b)
END(0);
END(1);
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 782,469 | 782,470 | u556696449 | cpp |
p02975 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long INF64 = 3e18;
const unsigned long long HASHBASE = 1222827239ull;
const long long MODNUM = 1000000007ll;
/////////////////////////
int a[100010];
/////////////////////////
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, sum;
for (int i = 1; i <= n; ++i) {
cin >> a[i];
}
sum = a[1];
for (int i = 2; i <= n; ++i) {
sum = sum ^ a[i];
}
if (sum == 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
| #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long INF64 = 3e18;
const unsigned long long HASHBASE = 1222827239ull;
const long long MODNUM = 1000000007ll;
/////////////////////////
int a[100010];
/////////////////////////
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, sum;
cin >> n;
for (int i = 1; i <= n; ++i) {
cin >> a[i];
}
sum = a[1];
for (int i = 2; i <= n; ++i) {
sum = sum ^ a[i];
}
if (sum == 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
| [] | 782,473 | 782,474 | u203891294 | cpp |
p02975 | #include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long i64;
const int inf = (int)1.05e9;
int main() {
int n;
vector<int> as;
map<int, int> counts;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
int a;
scanf("%d", &a);
counts[a] += 1;
as.push_back(a);
}
sort(as.begin(), as.end());
as.erase(unique(as.begin(), as.end()), as.end());
bool ok = false;
if (as.size() == 3) {
int x = as[0];
int y = as[1];
int z = as[2];
ok = (x ^ y == z) && (n % 3 == 0) && (counts[x] == counts[y]) &&
(counts[y] == counts[z]);
}
if (as.size() == 2) {
int x = as[0];
int y = as[1];
ok = (x == 0) && (n % 3 == 0) && (counts[y] == counts[x] * 2);
}
if (as.size() == 1) {
int x = as[0];
ok = (x == 0);
}
printf("%s\n", ok ? "Yes" : "No");
return 0;
}
/* waffle */
| #include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long i64;
const int inf = (int)1.05e9;
int main() {
int n;
vector<int> as;
map<int, int> counts;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
int a;
scanf("%d", &a);
counts[a] += 1;
as.push_back(a);
}
sort(as.begin(), as.end());
as.erase(unique(as.begin(), as.end()), as.end());
bool ok = false;
if (as.size() == 3) {
int x = as[0];
int y = as[1];
int z = as[2];
ok = ((x ^ y) == z) && (n % 3 == 0) && (counts[x] == counts[y]) &&
(counts[y] == counts[z]);
}
if (as.size() == 2) {
int x = as[0];
int y = as[1];
ok = (x == 0) && (n % 3 == 0) && (counts[y] == counts[x] * 2);
}
if (as.size() == 1) {
int x = as[0];
ok = (x == 0);
}
printf("%s\n", ok ? "Yes" : "No");
return 0;
}
/* waffle */
| [] | 782,475 | 782,476 | u643383200 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
using Int = long long;
template <typename T1, typename T2> inline void chmin(T1 &a, T2 b) {
if (a > b)
a = b;
}
template <typename T1, typename T2> inline void chmax(T1 &a, T2 b) {
if (a < b)
a = b;
}
template <typename T> void drop(const T &x) {
cout << x << endl;
exit(0);
}
// INSERT ABOVE HERE
signed main() {
Int n;
cin >> n;
vector<Int> as(n);
for (Int i = 0; i < n; i++)
cin >> as[i];
map<Int, Int> cnt;
for (Int a : as)
cnt[a]++;
if (cnt.size() > 3u)
drop("No");
vector<Int> vs;
for (auto p : cnt)
vs.emplace_back(p.first);
for (Int x : vs) {
for (Int y : vs) {
auto check = cnt;
vector<Int> zs(n + 2);
zs[0] = x;
check[zs[0]]--;
zs[1] = y;
check[zs[1]]--;
for (Int i = 2; i < n; i++) {
zs[i] = zs[i - 1] ^ zs[i - 2];
check[zs[i]]--;
}
zs[n + 0] = x;
zs[n + 1] = y;
Int ok = 1;
for (auto p : check)
ok &= p.second == 0;
for (Int i = 1; i < n + 2; i++)
ok &= zs[i] == (zs[i - 1] ^ zs[i + 1]);
if (ok)
drop("Yes");
}
}
drop("No");
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
using Int = long long;
template <typename T1, typename T2> inline void chmin(T1 &a, T2 b) {
if (a > b)
a = b;
}
template <typename T1, typename T2> inline void chmax(T1 &a, T2 b) {
if (a < b)
a = b;
}
template <typename T> void drop(const T &x) {
cout << x << endl;
exit(0);
}
// INSERT ABOVE HERE
signed main() {
Int n;
cin >> n;
vector<Int> as(n);
for (Int i = 0; i < n; i++)
cin >> as[i];
map<Int, Int> cnt;
for (Int a : as)
cnt[a]++;
if (cnt.size() > 3u)
drop("No");
vector<Int> vs;
for (auto p : cnt)
vs.emplace_back(p.first);
for (Int x : vs) {
for (Int y : vs) {
auto check = cnt;
vector<Int> zs(n + 2);
zs[0] = x;
check[zs[0]]--;
zs[1] = y;
check[zs[1]]--;
for (Int i = 2; i < n; i++) {
zs[i] = zs[i - 1] ^ zs[i - 2];
check[zs[i]]--;
}
zs[n + 0] = x;
zs[n + 1] = y;
Int ok = 1;
for (auto p : check)
ok &= p.second == 0;
for (Int i = 1; i <= n; i++)
ok &= zs[i] == (zs[i - 1] ^ zs[i + 1]);
if (ok)
drop("Yes");
}
}
drop("No");
return 0;
}
| [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change",
"expression.operation.binary.remove"
] | 782,477 | 782,478 | u687214625 | cpp |
p02975 | #include <bits/stdc++.h>
#define pi 3.1415
#define ll long long
#define pii pair<int, int>
#define debug(a) cout << a << '\n'
#define maxn 100009
#define MOD 1000000007
#define INF (int)300009
#define inp freopen("input.txt", "r", stdin)
#define out freopen("out.txt", "w", stdout)
using namespace std;
int main() {
ios::sync_with_stdio(false);
ll n;
cin >> n;
ll vet[maxn];
for (int i = 0; i < n; i++) {
cin >> vet[i];
}
ll ans = vet[0];
for (int i = 1; i < n; i++) {
ans ^= vet[i];
}
if (ans == 0)
cout << "YES" << endl;
else
cout << "NO" << endl;
return 0;
} | #include <bits/stdc++.h>
#define pi 3.1415
#define ll long long
#define pii pair<int, int>
#define debug(a) cout << a << '\n'
#define maxn 100009
#define MOD 1000000007
#define INF (int)300009
#define inp freopen("input.txt", "r", stdin)
#define out freopen("out.txt", "w", stdout)
using namespace std;
int main() {
ios::sync_with_stdio(false);
ll n;
cin >> n;
ll vet[maxn];
for (int i = 0; i < n; i++) {
cin >> vet[i];
}
ll ans = vet[0];
for (int i = 1; i < n; i++) {
ans ^= vet[i];
}
if (ans == 0)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 782,481 | 782,482 | u371493016 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
#define pii pair<int, int>
#define ll long long
#define s second
#define f first
ll n;
ll xr = 0;
ll a[100005];
int main() {
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> a[i];
xr = (xr ^ a[i]);
}
if (xr == 0) {
cout << "yes" << endl;
return 0;
}
cout << "no" << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define pii pair<int, int>
#define ll long long
#define s second
#define f first
ll n;
ll xr = 0;
ll a[100005];
int main() {
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> a[i];
xr = (xr ^ a[i]);
}
if (xr == 0) {
cout << "Yes" << endl;
return 0;
}
cout << "No" << endl;
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 782,483 | 782,484 | u522784682 | cpp |
p02975 | #include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <stdio.h>
#include <string>
#include <vector>
#define MOD (long long)1000000007
#define INF (long long)998244353
using namespace std;
int main(void) {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int ans = 0;
for (int i = 0; i < n; i++) {
ans ^ a[i];
}
if (ans == 0)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
}
| #include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <stdio.h>
#include <string>
#include <vector>
#define MOD (long long)1000000007
#define INF (long long)998244353
using namespace std;
int main(void) {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int ans = 0;
for (int i = 0; i < n; i++) {
ans = ans ^ a[i];
}
if (ans == 0)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
}
| [
"assignment.change"
] | 782,497 | 782,498 | u122365993 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 1.1e5;
int N;
int A[MAXN];
bool go() {
map<int, int> cnts;
for (int i = 0; i < N; i++) {
cnts[A[i]]++;
}
if (cnts.size() == 1) {
return cnts.begin()->first == 0;
} else {
if (N % 3 != 0)
return false;
vector<int> vals;
for (auto &it : cnts) {
if (it.second % (N / 3) != 0)
return false;
it.second /= (N / 3);
for (int v = 0; v < it.second; v++) {
vals.push_back(it.first);
}
}
assert(vals.size() == 3);
return vals[0] ^ vals[1] ^ vals[2] == 0;
}
}
int main() {
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
cin >> N;
for (int i = 0; i < N; i++)
cin >> A[i];
cout << (go() ? "Yes" : "No") << '\n';
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
const int MAXN = 1.1e5;
int N;
int A[MAXN];
bool go() {
map<int, int> cnts;
for (int i = 0; i < N; i++) {
cnts[A[i]]++;
}
if (cnts.size() == 1) {
return cnts.begin()->first == 0;
} else {
if (N % 3 != 0)
return false;
vector<int> vals;
for (auto &it : cnts) {
if (it.second % (N / 3) != 0)
return false;
it.second /= (N / 3);
for (int v = 0; v < it.second; v++) {
vals.push_back(it.first);
}
}
assert(vals.size() == 3);
return (vals[0] ^ vals[1] ^ vals[2]) == 0;
}
}
int main() {
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
cin >> N;
for (int i = 0; i < N; i++)
cin >> A[i];
cout << (go() ? "Yes" : "No") << '\n';
return 0;
}
| [
"function.return_value.change"
] | 782,499 | 782,500 | u570944601 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pi = pair<ll, ll>;
int n;
int A[100005];
void input() {
cin >> n;
for (int i = 1; i <= n; i++)
cin >> A[i];
}
void calc() {
if (n % 3 != 0) {
for (int i = 1; i <= n; i++) {
if (A[i] != 0) {
cout << "No";
return;
}
}
cout << "Yes";
} else {
map<int, int> mp;
for (int i = 1; i <= n; i++) {
mp[A[i]]++;
}
int x = 0;
for (auto i : mp) {
int v = i.second;
while (v > n / 3) {
x ^= i.first;
v -= n / 3;
}
if (v > 0) {
cout << "No";
return;
}
}
if (x != 0) {
cout << "No";
} else
cout << "Yes";
}
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
input();
calc();
return 0;
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pi = pair<ll, ll>;
int n;
int A[100005];
void input() {
cin >> n;
for (int i = 1; i <= n; i++)
cin >> A[i];
}
void calc() {
if (n % 3 != 0) {
for (int i = 1; i <= n; i++) {
if (A[i] != 0) {
cout << "No";
return;
}
}
cout << "Yes";
} else {
map<int, int> mp;
for (int i = 1; i <= n; i++) {
mp[A[i]]++;
}
int x = 0;
for (auto i : mp) {
int v = i.second;
while (v >= n / 3) {
x ^= i.first;
v -= n / 3;
}
if (v > 0) {
cout << "No";
return;
}
}
if (x != 0) {
cout << "No";
} else
cout << "Yes";
}
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
input();
calc();
return 0;
} | [
"expression.operator.compare.change",
"control_flow.loop.condition.change"
] | 782,505 | 782,506 | u610510492 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pi = pair<ll, ll>;
int n;
int A[100005];
void input() {
cin >> n;
for (int i = 1; i <= n; i++)
cin >> A[i];
}
void calc() {
if (n % 3 != 0) {
for (int i = 2; i <= n; i++) {
if (A[i] != A[1]) {
cout << "No";
return;
}
}
cout << "Yes";
} else {
map<int, int> mp;
for (int i = 1; i <= n; i++) {
mp[A[i]]++;
}
int x = 0;
for (auto i : mp) {
int v = i.second;
while (v > n / 3) {
x ^= i.first;
v -= n / 3;
}
if (v > 0) {
cout << "No";
return;
}
}
if (x != 0) {
cout << "No";
} else
cout << "Yes";
}
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
input();
calc();
return 0;
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pi = pair<ll, ll>;
int n;
int A[100005];
void input() {
cin >> n;
for (int i = 1; i <= n; i++)
cin >> A[i];
}
void calc() {
if (n % 3 != 0) {
for (int i = 1; i <= n; i++) {
if (A[i] != 0) {
cout << "No";
return;
}
}
cout << "Yes";
} else {
map<int, int> mp;
for (int i = 1; i <= n; i++) {
mp[A[i]]++;
}
int x = 0;
for (auto i : mp) {
int v = i.second;
while (v >= n / 3) {
x ^= i.first;
v -= n / 3;
}
if (v > 0) {
cout << "No";
return;
}
}
if (x != 0) {
cout << "No";
} else
cout << "Yes";
}
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
input();
calc();
return 0;
} | [
"literal.number.change",
"variable_declaration.value.change",
"control_flow.loop.for.initializer.change",
"expression.off_by_one",
"identifier.replace.remove",
"literal.replace.add",
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change",
"expression.operator.compare.cha... | 782,507 | 782,506 | u610510492 | cpp |
p02975 | #include <bits/stdc++.h>
#include <queue>
#include <stack>
using namespace std;
typedef pair<long long int, long long int> pa;
#define resize(A) A.resize(unique(A.begin(), A.end()) - A.begin())
#define pb push_back
#define MAX 200005
long long int MOD = 1e9 + 7;
long long int INF = 1e18;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long int i, j, k = 0, l = 0, r = 0, m = 0, n, p = 0, cnt = 0, cnt1 = 0,
x, y, z = 0, a, b, low, mid, high, ans = 0, maxi = 0,
mini = INF, t;
cin >> n;
long long int A[n];
map<long long int, long long int> ma;
map<long long int, long long int>::iterator it;
for (i = 0; i < n; i++) {
cin >> A[i];
ma[A[i]]++;
if (A[i] == 0)
cnt++;
}
if (cnt == n)
cout << "Yes\n";
else if (n % 3 == 0) {
if (ma.size() == 2) {
r = n / 3;
vector<pa> V;
for (it = ma.begin(); it != ma.end(); it++) {
V.push_back({it->second, it->first});
}
sort(V.begin(), V.end());
if (V[1].first == 2 * r && V[i].second == 0) {
cout << "Yes\n";
} else
cout << "No\n";
} else if (ma.size() == 3) {
r = n / 3;
vector<pa> V;
for (it = ma.begin(); it != ma.end(); it++) {
V.push_back({it->second, it->first});
}
sort(V.begin(), V.end());
k = 0;
k = k ^ V[0].second ^ V[1].second ^ V[2].second;
if (V[0].first == r && V[1].first == r && V[2].first == r && k == 0) {
cout << "Yes\n";
} else
cout << "No\n";
} else
cout << "No\n";
} else
cout << "No\n";
} | #include <bits/stdc++.h>
#include <queue>
#include <stack>
using namespace std;
typedef pair<long long int, long long int> pa;
#define resize(A) A.resize(unique(A.begin(), A.end()) - A.begin())
#define pb push_back
#define MAX 200005
long long int MOD = 1e9 + 7;
long long int INF = 1e18;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long int i, j, k = 0, l = 0, r = 0, m = 0, n, p = 0, cnt = 0, cnt1 = 0,
x, y, z = 0, a, b, low, mid, high, ans = 0, maxi = 0,
mini = INF, t;
cin >> n;
long long int A[n];
map<long long int, long long int> ma;
map<long long int, long long int>::iterator it;
for (i = 0; i < n; i++) {
cin >> A[i];
ma[A[i]]++;
if (A[i] == 0)
cnt++;
}
if (cnt == n)
cout << "Yes\n";
else if (n % 3 == 0) {
if (ma.size() == 2) {
r = n / 3;
vector<pa> V;
for (it = ma.begin(); it != ma.end(); it++) {
V.push_back({it->second, it->first});
}
sort(V.begin(), V.end());
if (V[1].first == 2 * r && V[0].second == 0) {
cout << "Yes\n";
} else
cout << "No\n";
} else if (ma.size() == 3) {
r = n / 3;
vector<pa> V;
for (it = ma.begin(); it != ma.end(); it++) {
V.push_back({it->second, it->first});
}
sort(V.begin(), V.end());
k = 0;
k = k ^ V[0].second ^ V[1].second ^ V[2].second;
if (V[0].first == r && V[1].first == r && V[2].first == r && k == 0) {
cout << "Yes\n";
} else
cout << "No\n";
} else
cout << "No\n";
} else
cout << "No\n";
} | [
"identifier.replace.remove",
"literal.replace.add",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change"
] | 782,510 | 782,511 | u422347032 | cpp |
p02975 | #include <cstdlib>
#include <iostream>
#include <map>
using namespace std;
const int MAXN = 1e5 + 10;
int ar[MAXN];
void yes() {
cout << "Yes" << endl;
exit(0);
}
void no() {
cout << "No" << endl;
exit(0);
}
int main() {
int n;
cin >> n;
for (int i = 0; i < n; ++i)
cin >> ar[i];
// if all zero than n doesn't matter
bool nz = false;
for (int i = 0; i < ar[i] and not nz; ++i)
if (ar[i] != 0)
nz = true;
if (not nz) {
yes();
}
if (n % 3 != 0) {
no();
}
map<int, int> unique;
for (int i = 0; i < n; ++i) {
auto iter = unique.find(ar[i]);
if (iter != unique.end()) {
int count = iter->second + 1;
unique.erase(iter);
unique.emplace(ar[i], count);
} else
unique.emplace(ar[i], 1);
if (unique.size() > 3) {
break;
}
}
if (unique.size() > 3 or unique.size() == 1) {
no();
}
if (unique.size() == 2) {
auto iter = unique.begin();
int i1 = iter->first, c1 = iter->second;
++iter;
int i2 = iter->first, c2 = iter->second;
if (c1 > c2) {
swap(c1, c2);
swap(i1, i2);
}
if (c1 == n / 3 and c2 == c1 * 2) {
if ((i1 ^ i2 ^ i2) == 0)
yes();
else
no();
} else
no();
} else {
auto iter = unique.begin();
int i1 = iter->first, c1 = iter->second;
++iter;
int i2 = iter->first, c2 = iter->second;
++iter;
int i3 = iter->first, c3 = iter->second;
if (not(c1 == c2 and c1 == c3 and c1 == n / 3))
no();
else if (not((i1 ^ i2 ^ i3) == 0))
no();
else
yes();
}
}
| #include <cstdlib>
#include <iostream>
#include <map>
using namespace std;
const int MAXN = 1e5 + 10;
int ar[MAXN];
void yes() {
cout << "Yes" << endl;
exit(0);
}
void no() {
cout << "No" << endl;
exit(0);
}
int main() {
// freopen("tmp.txt", "r", stdin);
int n;
cin >> n;
for (int i = 0; i < n; ++i)
cin >> ar[i];
// if all zero than n doesn't matter
bool nz = false;
for (int i = 0; i < n and not nz; ++i)
if (ar[i] != 0)
nz = true;
if (not nz) {
yes();
}
if (n % 3 != 0) {
no();
}
map<int, int> unique;
for (int i = 0; i < n; ++i) {
auto iter = unique.find(ar[i]);
if (iter != unique.end()) {
int count = iter->second + 1;
unique.erase(iter);
unique.emplace(ar[i], count);
} else
unique.emplace(ar[i], 1);
if (unique.size() > 3) {
break;
}
}
if (unique.size() > 3 or unique.size() == 1) {
no();
}
if (unique.size() == 2) {
auto iter = unique.begin();
int i1 = iter->first, c1 = iter->second;
++iter;
int i2 = iter->first, c2 = iter->second;
if (c1 > c2) {
swap(c1, c2);
swap(i1, i2);
}
if (c1 == n / 3 and c2 == c1 * 2) {
if ((i1 ^ i2 ^ i2) == 0)
yes();
else
no();
} else
no();
} else {
auto iter = unique.begin();
int i1 = iter->first, c1 = iter->second;
++iter;
int i2 = iter->first, c2 = iter->second;
++iter;
int i3 = iter->first, c3 = iter->second;
if (not(c1 == c2 and c1 == c3 and c1 == n / 3))
no();
else if (not((i1 ^ i2 ^ i3) == 0))
no();
else
yes();
}
}
| [] | 782,516 | 782,517 | u017806365 | cpp |
p02975 | #include <algorithm>
#include <bitset> //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <iomanip> //do setprecision
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define FOR(i, b, e) for (int i = (b); i < (e); ++i)
#define FORQ(i, b, e) for (int i = (b); i <= (e); ++i)
#define FORD(i, b, e) for (int i = (b)-1; i >= (e); --i)
#define REP(x, n) for (int x = 0; x < (n); ++x)
#define ST first
#define ND second
#define PB push_back
#define PF push_front
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
#define pii pair<int, int>
#define pll pair<LL, LL>
#define vi vector<int>
#define vii vector<vi>
const double pi = 3.14159265358979323846264;
const int mod = 1000000007;
int main() {
// cin.tie(0);
// ios::sync_with_stdio(false);
// std::cout << std::fixed;
// std::cout << std::setprecision(12);
// std::cout << std::defaultfloat;
int n;
cin >> n;
vector<int> v(n);
int f = 1, var = 0;
map<int, int> mp;
FOR(i, 0, n) {
cin >> v[i];
if (v[i] != 0)
f = 0;
if (mp[v[i]] == 0)
var++;
mp[v[i]]++;
}
if (f) {
cout << "Yes" << endl;
return 0;
}
if (mp[0] != 0) {
if (var != 2) {
cout << "No" << endl;
return 0;
} else {
int t = 0;
for (auto x : mp) {
if (x.ST != 0)
t = x.ST;
}
if (mp[t] == mp[0] * 2) {
cout << "YES" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
} else {
cerr << "test" << endl;
if (var != 3) {
cout << "No" << endl;
return 0;
} else {
cerr << "test2" << endl;
int lst[3] = {};
int idx = 0, t = 0;
for (auto x : mp) {
if (x.ST == 0)
continue;
lst[idx] = x.ST;
t = x.ND;
idx++;
}
for (auto x : mp) {
if (x.ST != 0 && x.ND != t) {
cout << "No" << endl;
return 0;
}
}
cerr << "test2" << endl;
FOR(i, 0, 31) {
int cnt[2] = {};
FOR(j, 0, 3) {
int tt = lst[j];
cnt[(tt >> i) & 1]++;
}
if (cnt[1] == 0 || (cnt[0] * 2 == cnt[1])) {
} else {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
}
}
return 0;
}
| #include <algorithm>
#include <bitset> //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <iomanip> //do setprecision
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define FOR(i, b, e) for (int i = (b); i < (e); ++i)
#define FORQ(i, b, e) for (int i = (b); i <= (e); ++i)
#define FORD(i, b, e) for (int i = (b)-1; i >= (e); --i)
#define REP(x, n) for (int x = 0; x < (n); ++x)
#define ST first
#define ND second
#define PB push_back
#define PF push_front
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
#define pii pair<int, int>
#define pll pair<LL, LL>
#define vi vector<int>
#define vii vector<vi>
const double pi = 3.14159265358979323846264;
const int mod = 1000000007;
int main() {
// cin.tie(0);
// ios::sync_with_stdio(false);
// std::cout << std::fixed;
// std::cout << std::setprecision(12);
// std::cout << std::defaultfloat;
int n;
cin >> n;
vector<int> v(n);
int f = 1, var = 0;
map<int, int> mp;
FOR(i, 0, n) {
cin >> v[i];
if (v[i] != 0)
f = 0;
if (mp[v[i]] == 0)
var++;
mp[v[i]]++;
}
if (f) {
cout << "Yes" << endl;
return 0;
}
if (mp[0] != 0) {
if (var != 2) {
cout << "No" << endl;
return 0;
} else {
int t = 0;
for (auto x : mp) {
if (x.ST != 0)
t = x.ST;
}
if (mp[t] == mp[0] * 2) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
} else {
cerr << "test" << endl;
if (var != 3) {
cout << "No" << endl;
return 0;
} else {
cerr << "test2" << endl;
int lst[3] = {};
int idx = 0, t = 0;
for (auto x : mp) {
if (x.ST == 0)
continue;
lst[idx] = x.ST;
t = x.ND;
idx++;
}
for (auto x : mp) {
if (x.ST != 0 && x.ND != t) {
cout << "No" << endl;
return 0;
}
}
cerr << "test2" << endl;
FOR(i, 0, 31) {
int cnt[2] = {};
FOR(j, 0, 3) {
int tt = lst[j];
cnt[(tt >> i) & 1]++;
}
if (cnt[1] == 0 || (cnt[0] * 2 == cnt[1])) {
} else {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
}
}
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 782,518 | 782,519 | u404075706 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, x;
cin >> n;
long long ans = 0;
for (int i = 0; i < n; ++i) {
cin >> x;
ans ^= x;
}
if (ans % 2 == 0)
puts("Yes");
else
puts("No");
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, x;
cin >> n;
long long ans = 0;
for (int i = 0; i < n; ++i) {
cin >> x;
ans ^= x;
}
if (ans == 0)
puts("Yes");
else
puts("No");
return 0;
}
| [
"expression.operation.binary.remove"
] | 782,525 | 782,526 | u485837651 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, x;
cin >> n;
int ans = 0;
for (int i = 0; i < n; ++i) {
cin >> x;
ans ^= x;
}
if (ans % 2 == 0)
puts("Yes");
else
puts("No");
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, x;
cin >> n;
long long ans = 0;
for (int i = 0; i < n; ++i) {
cin >> x;
ans ^= x;
}
if (ans == 0)
puts("Yes");
else
puts("No");
return 0;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change",
"expression.operation.binary.remove"
] | 782,527 | 782,526 | u485837651 | cpp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.