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>
using namespace std;
typedef long long signed int LL;
typedef long long unsigned int LU;
#define incID(i, l, r) for (LL i = (l); i < (r); ++i)
#define incII(i, l, r) for (LL i = (l); i <= (r); ++i)
#define decID(i, l, r) for (LL i = (r)-1; i >= (l); --i)
#define decII(i, l, r) for (LL i = (r); i >= (l); --i)
#define inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) < (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
template <typename T> bool setmin(T &a, T b) {
if (b < a) {
a = b;
return true;
} else {
return false;
}
}
template <typename T> bool setmax(T &a, T b) {
if (b > a) {
a = b;
return true;
} else {
return false;
}
}
template <typename T> bool setmineq(T &a, T b) {
if (b <= a) {
a = b;
return true;
} else {
return false;
}
}
template <typename T> bool setmaxeq(T &a, T b) {
if (b >= a) {
a = b;
return true;
} else {
return false;
}
}
LL mo(LL a, LL b) {
assert(b > 0);
a %= b;
if (a < 0) {
a += b;
}
return a;
}
LL fl(LL a, LL b) {
assert(b > 0);
return (a > 0 ? a / b : (a - b + 1) / b);
}
LL ce(LL a, LL b) {
assert(b > 0);
return (a < 0 ? a / b : (a + b - 1) / b);
}
template <typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template <typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
#define bit(b, i) (((b) >> (i)) & 1)
#define BC __builtin_popcountll
#define SC static_cast
#define SI(v) SC<int>(v.size())
#define SL(v) SC<LL>(v.size())
#define RF(e, v) for (auto &e : v)
#define ef else if
#define UR assert(false)
// ---- ----
template <typename T> vector<pair<T, LL>> cc(vector<T> v) {
vector<pair<T, LL>> a;
inc(i, v.size()) {
if (i == 0 || v[i] != v[i - 1]) {
a.EB(v[i], 1);
} else {
a.back().SE++;
}
}
return a;
}
int main() {
int n;
cin >> n;
vector<int> a(n);
inc(i, n) { cin >> a[i]; }
sort(ALL(a));
auto v = cc(a);
bool ans = false;
if (n % 3 != 0) {
ans = (SI(v) == 1 && v[0].FI == 0);
} else {
if (SI(v) == 3) {
ans = (v[0].SE == n / 3 && v[1].SE == n / 3 &&
v[0].FI ^ v[1].FI == v[2].FI);
}
if (SI(v) == 2) {
ans = (v[0].SE == 2 * n / 3 && v[0].FI == 0);
}
if (SI(v) == 1) {
ans = (v[0].SE == n && v[0].FI == 0);
}
}
cout << (ans ? "Yes" : "No") << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long signed int LL;
typedef long long unsigned int LU;
#define incID(i, l, r) for (LL i = (l); i < (r); ++i)
#define incII(i, l, r) for (LL i = (l); i <= (r); ++i)
#define decID(i, l, r) for (LL i = (r)-1; i >= (l); --i)
#define decII(i, l, r) for (LL i = (r); i >= (l); --i)
#define inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) < (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
template <typename T> bool setmin(T &a, T b) {
if (b < a) {
a = b;
return true;
} else {
return false;
}
}
template <typename T> bool setmax(T &a, T b) {
if (b > a) {
a = b;
return true;
} else {
return false;
}
}
template <typename T> bool setmineq(T &a, T b) {
if (b <= a) {
a = b;
return true;
} else {
return false;
}
}
template <typename T> bool setmaxeq(T &a, T b) {
if (b >= a) {
a = b;
return true;
} else {
return false;
}
}
LL mo(LL a, LL b) {
assert(b > 0);
a %= b;
if (a < 0) {
a += b;
}
return a;
}
LL fl(LL a, LL b) {
assert(b > 0);
return (a > 0 ? a / b : (a - b + 1) / b);
}
LL ce(LL a, LL b) {
assert(b > 0);
return (a < 0 ? a / b : (a + b - 1) / b);
}
template <typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template <typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
#define bit(b, i) (((b) >> (i)) & 1)
#define BC __builtin_popcountll
#define SC static_cast
#define SI(v) SC<int>(v.size())
#define SL(v) SC<LL>(v.size())
#define RF(e, v) for (auto &e : v)
#define ef else if
#define UR assert(false)
// ---- ----
template <typename T> vector<pair<T, LL>> cc(vector<T> v) {
vector<pair<T, LL>> a;
inc(i, v.size()) {
if (i == 0 || v[i] != v[i - 1]) {
a.EB(v[i], 1);
} else {
a.back().SE++;
}
}
return a;
}
int main() {
int n;
cin >> n;
vector<int> a(n);
inc(i, n) { cin >> a[i]; }
sort(ALL(a));
auto v = cc(a);
bool ans = false;
if (n % 3 != 0) {
ans = (SI(v) == 1 && v[0].FI == 0);
} else {
if (SI(v) == 3) {
ans = (v[0].SE == n / 3 && v[1].SE == n / 3 &&
(v[0].FI ^ v[1].FI) == v[2].FI);
}
if (SI(v) == 2) {
ans = (v[0].SE == n / 3 && v[0].FI == 0);
}
if (SI(v) == 1) {
ans = (v[0].SE == n && v[0].FI == 0);
}
}
cout << (ans ? "Yes" : "No") << endl;
return 0;
}
| [
"expression.operation.binary.remove"
] | 783,015 | 783,014 | u568652083 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
int main() {
int n;
cin >> n;
int a[n];
map<int, int> m;
rep(i, n) {
cin >> a[i];
m[a[i]]++;
}
if (m.size() == 1) {
if (m[0])
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
}
if (n % 3) {
cout << "No" << endl;
return 0;
}
if (m.size() == 2) {
int d[2];
int i = 0;
for (auto x : m) {
d[i] = x.first;
i++;
}
if (d[0] == 0 && m[d[1]] == m[d[0]] * 2)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
}
if (m.size() != 3) {
cout << "No" << endl;
return 0;
}
int b[3];
int i = 0;
for (auto x : m) {
b[i] = x.first;
i++;
}
if (!(m[b[0]] == m[b[1]] && m[b[0]] == m[b[2]])) {
cout << "No" << endl;
return 0;
}
if (b[0] ^ b[1] ^ b[2] == 0)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
int main() {
int n;
cin >> n;
int a[n];
map<int, int> m;
rep(i, n) {
cin >> a[i];
m[a[i]]++;
}
if (m.size() == 1) {
if (m[0])
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
}
if (n % 3) {
cout << "No" << endl;
return 0;
}
if (m.size() == 2) {
int d[2];
int i = 0;
for (auto x : m) {
d[i] = x.first;
i++;
}
if (d[0] == 0 && m[d[1]] == m[d[0]] * 2)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
}
if (m.size() != 3) {
cout << "No" << endl;
return 0;
}
int b[3];
int i = 0;
for (auto x : m) {
b[i] = x.first;
i++;
}
if (!(m[b[0]] == m[b[1]] && m[b[0]] == m[b[2]])) {
cout << "No" << endl;
return 0;
}
if ((b[0] ^ b[1] ^ b[2]) == 0)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
} | [
"control_flow.branch.if.condition.change"
] | 783,018 | 783,019 | u970690920 | cpp |
p02975 | #include <algorithm>
#include <complex>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
const long long int INF = 99999999999999;
const long long int mod = 1000000007;
long long int n, m, k, sum = 0, res = 0, a[200005] = {}, ruiseki[200005] = {},
xornum[50] = {}, one = -1, two = -1, three = -1,
cou[4] = {};
int main() {
map<long long int, long long int> mp;
cout << fixed << setprecision(10);
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
if (one == a[i]) {
cou[1]++;
} else if (two == a[i]) {
cou[2]++;
} else if (three == a[i]) {
cou[3]++;
}
if (one == -1) {
one = a[i];
cou[1] = 1;
}
if (one != -1 && one != a[i] && two == -1) {
two = a[i];
cou[2] = 1;
}
if (one != -1 && one != a[i] && two != a[i] && two != -1 && three == -1) {
three = a[i];
cou[3] = 1;
}
if (one != -1 && two != -1 && three != -1 && one != a[i] && two != a[i] &&
three != a[i]) {
cout << "Yes" << endl;
return 0;
}
}
if (cou[1] == n && one == 0) {
cout << "Yes" << endl;
return 0;
}
if ((cou[1] == 2 * cou[2] && one == 0 || cou[2] == 2 * cou[1] && two == 0) &&
cou[3] == 0) {
cout << "Yes" << endl;
return 0;
}
if (cou[1] == cou[2] && cou[2] == cou[3] && (one ^ two) == three) {
cout << "Yes" << endl;
return 0;
}
cout << "No" << endl;
}
| #include <algorithm>
#include <complex>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
const long long int INF = 99999999999999;
const long long int mod = 1000000007;
long long int n, m, k, sum = 0, res = 0, a[200005] = {}, ruiseki[200005] = {},
xornum[50] = {}, one = -1, two = -1, three = -1,
cou[4] = {};
int main() {
map<long long int, long long int> mp;
cout << fixed << setprecision(10);
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
if (one == a[i]) {
cou[1]++;
} else if (two == a[i]) {
cou[2]++;
} else if (three == a[i]) {
cou[3]++;
}
if (one == -1) {
one = a[i];
cou[1] = 1;
}
if (one != -1 && one != a[i] && two == -1) {
two = a[i];
cou[2] = 1;
}
if (one != -1 && one != a[i] && two != a[i] && two != -1 && three == -1) {
three = a[i];
cou[3] = 1;
}
if (one != -1 && two != -1 && three != -1 && one != a[i] && two != a[i] &&
three != a[i]) {
cout << "No" << endl;
return 0;
}
}
if (cou[1] == n && one == 0) {
cout << "Yes" << endl;
return 0;
}
if ((cou[1] == 2 * cou[2] && two == 0 || cou[2] == 2 * cou[1] && one == 0) &&
cou[3] == 0) {
cout << "Yes" << endl;
return 0;
}
if (cou[1] == cou[2] && cou[2] == cou[3] && (one ^ two) == three) {
cout << "Yes" << endl;
return 0;
}
cout << "No" << endl;
}
| [
"literal.string.change",
"io.output.change",
"identifier.change",
"control_flow.branch.if.condition.change"
] | 783,020 | 783,021 | u018872912 | cpp |
p02975 | #include <algorithm>
#include <complex>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
const long long int INF = 99999999999999;
const long long int mod = 1000000007;
long long int n, m, k, sum = 0, res = 0, a[200005] = {}, ruiseki[200005] = {},
xornum[50] = {}, one = -1, two = -1, three = -1,
cou[4] = {};
int main() {
map<long long int, long long int> mp;
cout << fixed << setprecision(10);
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
if (one == a[i]) {
cou[1]++;
} else if (two == a[i]) {
cou[2]++;
} else if (three == a[i]) {
cou[3]++;
}
if (one == -1) {
one = a[i];
cou[1] = 1;
}
if (one != -1 && one != a[i] && two == -1) {
two = a[i];
cou[2] = 1;
}
if (one != -1 && one != a[i] && two != a[i] && two != -1 && three == -1) {
three = a[i];
cou[3] = 1;
}
if (one != -1 && two != -1 && three != -1 && one != a[i] && two != a[i] &&
three != a[i]) {
cout << "No" << endl;
return 0;
}
}
if (cou[1] == n && one == 0) {
cout << "Yes" << endl;
return 0;
}
if ((cou[1] == 2 * cou[2] && one == 0 || cou[2] == 2 * cou[1] && two == 0) &&
cou[3] == 0) {
cout << "No" << endl;
return 0;
}
if (cou[1] == cou[2] && cou[2] == cou[3] && (one ^ two) == three) {
cout << "Yes" << endl;
return 0;
}
cout << "No" << endl;
}
| #include <algorithm>
#include <complex>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
const long long int INF = 99999999999999;
const long long int mod = 1000000007;
long long int n, m, k, sum = 0, res = 0, a[200005] = {}, ruiseki[200005] = {},
xornum[50] = {}, one = -1, two = -1, three = -1,
cou[4] = {};
int main() {
map<long long int, long long int> mp;
cout << fixed << setprecision(10);
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
if (one == a[i]) {
cou[1]++;
} else if (two == a[i]) {
cou[2]++;
} else if (three == a[i]) {
cou[3]++;
}
if (one == -1) {
one = a[i];
cou[1] = 1;
}
if (one != -1 && one != a[i] && two == -1) {
two = a[i];
cou[2] = 1;
}
if (one != -1 && one != a[i] && two != a[i] && two != -1 && three == -1) {
three = a[i];
cou[3] = 1;
}
if (one != -1 && two != -1 && three != -1 && one != a[i] && two != a[i] &&
three != a[i]) {
cout << "No" << endl;
return 0;
}
}
if (cou[1] == n && one == 0) {
cout << "Yes" << endl;
return 0;
}
if ((cou[1] == 2 * cou[2] && two == 0 || cou[2] == 2 * cou[1] && one == 0) &&
cou[3] == 0) {
cout << "Yes" << endl;
return 0;
}
if (cou[1] == cou[2] && cou[2] == cou[3] && (one ^ two) == three) {
cout << "Yes" << endl;
return 0;
}
cout << "No" << endl;
}
| [
"identifier.change",
"control_flow.branch.if.condition.change",
"literal.string.change",
"io.output.change"
] | 783,022 | 783,021 | u018872912 | cpp |
p02975 | #include <algorithm>
#include <complex>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
const long long int INF = 99999999999999;
const long long int mod = 1000000007;
long long int n, m, k, sum = 0, res = 0, a[200005] = {}, ruiseki[200005] = {},
xornum[50] = {}, one = -1, two = -1, three = -1,
cou[4] = {};
int main() {
map<long long int, long long int> mp;
cout << fixed << setprecision(10);
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
if (one == a[i]) {
cou[1]++;
} else if (two == a[i]) {
cou[2]++;
} else if (three == a[i]) {
cou[3]++;
}
if (one == -1) {
one = a[i];
cou[1] = 1;
}
if (one != -1 && one != a[i] && two == -1) {
two = a[i];
cou[2] = 1;
}
if (one != -1 && one != a[i] && two != a[i] && two != -1 && three == -1) {
three = a[i];
cou[3] = 1;
}
if (one != -1 && two != -1 && three != -1 && one != a[i] && two != a[i] &&
three != a[i]) {
cout << "No" << endl;
return 0;
}
}
if (cou[1] == n && one == 0) {
cout << "Yes" << endl;
return 0;
}
if ((cou[1] == 2 * cou[2] && one == 0 || cou[2] == 2 * cou[1] && two == 0) &&
cou[3] == 0) {
cout << "Yes" << endl;
return 0;
}
if (cou[1] == cou[2] && cou[2] == cou[3] && (one ^ two) == three) {
cout << "Yes" << endl;
return 0;
}
cout << "No" << endl;
}
| #include <algorithm>
#include <complex>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
const long long int INF = 99999999999999;
const long long int mod = 1000000007;
long long int n, m, k, sum = 0, res = 0, a[200005] = {}, ruiseki[200005] = {},
xornum[50] = {}, one = -1, two = -1, three = -1,
cou[4] = {};
int main() {
map<long long int, long long int> mp;
cout << fixed << setprecision(10);
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
if (one == a[i]) {
cou[1]++;
} else if (two == a[i]) {
cou[2]++;
} else if (three == a[i]) {
cou[3]++;
}
if (one == -1) {
one = a[i];
cou[1] = 1;
}
if (one != -1 && one != a[i] && two == -1) {
two = a[i];
cou[2] = 1;
}
if (one != -1 && one != a[i] && two != a[i] && two != -1 && three == -1) {
three = a[i];
cou[3] = 1;
}
if (one != -1 && two != -1 && three != -1 && one != a[i] && two != a[i] &&
three != a[i]) {
cout << "No" << endl;
return 0;
}
}
if (cou[1] == n && one == 0) {
cout << "Yes" << endl;
return 0;
}
if ((cou[1] == 2 * cou[2] && two == 0 || cou[2] == 2 * cou[1] && one == 0) &&
cou[3] == 0) {
cout << "Yes" << endl;
return 0;
}
if (cou[1] == cou[2] && cou[2] == cou[3] && (one ^ two) == three) {
cout << "Yes" << endl;
return 0;
}
cout << "No" << endl;
}
| [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 783,023 | 783,021 | u018872912 | cpp |
p02975 | /* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>
// algorithm library
#include <algorithm>
#include <cmath>
#include <cstring>
#include <numeric>
#include <random>
// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
/* ---------- Namespace ---------- */
using namespace std;
/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>
/* ---------- Constants */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;
/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
int N;
cin >> N;
map<int, int> m;
for (int i = 0; i < N; i++) {
int a;
cin >> a;
m[a]++;
}
if (m.size() > 3) {
cout << "No" << endl;
return 0;
}
vector<int> vec;
for (auto it = m.begin(); it != m.end(); it++) {
vec.push_back(it->first);
}
if (m.size() == 3) {
if (N % 3 == 0 && vec[0] ^ vec[1] == vec[2] && m[vec[0]] == m[vec[1]] &&
m[vec[1]] == m[vec[2]]) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
} else if (m.size() == 2) {
int x = vec[0]; // こっちがおおい
int y = vec[1];
if (m[y] > m[x])
swap(x, y);
if (N % 3 == 0 && m[x] == 2 * m[y] && y == 0) {
cout << "Yes" << endl;
} else if (N % 3 == 2 && (m[x] - 1) == 2 * (m[y] - 1) && y == 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
} else {
if (vec[0] == 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
}
return 0;
} | /* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>
// algorithm library
#include <algorithm>
#include <cmath>
#include <cstring>
#include <numeric>
#include <random>
// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
/* ---------- Namespace ---------- */
using namespace std;
/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>
/* ---------- Constants */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;
/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
int N;
cin >> N;
map<int, int> m;
for (int i = 0; i < N; i++) {
int a;
cin >> a;
m[a]++;
}
if (m.size() > 3) {
cout << "No" << endl;
return 0;
}
vector<int> vec;
for (auto it = m.begin(); it != m.end(); it++) {
vec.push_back(it->first);
}
if (m.size() == 3) {
if (N % 3 == 0 && (vec[0] ^ vec[1]) == vec[2] && m[vec[0]] == m[vec[1]] &&
m[vec[1]] == m[vec[2]]) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
} else if (m.size() == 2) {
int x = vec[0]; // こっちがおおい
int y = vec[1];
if (m[y] > m[x])
swap(x, y);
if (N % 3 == 0 && m[x] == 2 * m[y] && y == 0) {
cout << "Yes" << endl;
} else if (N % 3 == 2 && (m[x] - 1) == 2 * (m[y] - 1) && y == 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
} else {
if (vec[0] == 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
}
return 0;
} | [
"control_flow.branch.if.condition.change"
] | 783,026 | 783,025 | u853132965 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, N) for (i = 0; i < N; i++)
int main() {
ll i, N, c = 0;
cin >> N;
vector<ll> x(N);
rep(i, N) cin >> x[i];
sort(x.begin(), x.end());
if (N % 3 == 0 && x[0] ^ x[N / 3] ^ x[N - 1] == 0 && x[0] == x[N / 3 - 1] &&
x[N / 3] == x[N / 3 * 2 - 1] && x[N / 3 * 2] == x[N - 1])
c++;
if (x[0] == x[N - 1] && x[0] == 0)
c++;
if (c > 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, N) for (i = 0; i < N; i++)
int main() {
ll i, N, c = 0;
cin >> N;
vector<ll> x(N);
rep(i, N) cin >> x[i];
sort(x.begin(), x.end());
if (N % 3 == 0 && (x[0] ^ x[N / 3] ^ x[N - 1]) == 0 && x[0] == x[N / 3 - 1] &&
x[N / 3] == x[N / 3 * 2 - 1] && x[N / 3 * 2] == x[N - 1])
c++;
if (x[0] == x[N - 1] && x[0] == 0)
c++;
if (c > 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
| [
"control_flow.branch.if.condition.change"
] | 783,029 | 783,030 | u251847465 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, N) for (i = 0; i < N; i++)
int main() {
ll i, N, c = 0;
cin >> N;
vector<int> x(N);
rep(i, N) cin >> x[i];
sort(x.begin(), x.end());
if (N % 3 == 0 && x[0] ^ x[N / 3] ^ x[N - 1] == 0 && x[0] == x[N / 3 - 1] &&
x[N / 3] == x[N / 3 * 2 - 1] && x[N / 3 * 2] == x[N - 1])
c++;
if (x[0] == x[N - 1] && x[0] == 0)
c++;
if (c > 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, N) for (i = 0; i < N; i++)
int main() {
ll i, N, c = 0;
cin >> N;
vector<ll> x(N);
rep(i, N) cin >> x[i];
sort(x.begin(), x.end());
if (N % 3 == 0 && (x[0] ^ x[N / 3] ^ x[N - 1]) == 0 && x[0] == x[N / 3 - 1] &&
x[N / 3] == x[N / 3 * 2 - 1] && x[N / 3 * 2] == x[N - 1])
c++;
if (x[0] == x[N - 1] && x[0] == 0)
c++;
if (c > 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
| [
"control_flow.branch.if.condition.change"
] | 783,031 | 783,030 | u251847465 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, N) for (i = 0; i < N; i++)
int main() {
ll i, N, c = 0;
cin >> N;
vector<int> x(N);
rep(i, N) cin >> x[i];
sort(x.begin(), x.end());
if (N % 3 == 0 && x[0] ^ x[N / 3] ^ x[N - 1] == 0 && x[0] == x[N / 3 - 1] &&
x[N / 3] == x[N / 3 * 2 - 1] && x[N / 3 * 2] == x[N - 1])
c++;
if (x[0] == x[N - 1] && x[0] == 0)
c++;
if (c == 1) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, N) for (i = 0; i < N; i++)
int main() {
ll i, N, c = 0;
cin >> N;
vector<ll> x(N);
rep(i, N) cin >> x[i];
sort(x.begin(), x.end());
if (N % 3 == 0 && (x[0] ^ x[N / 3] ^ x[N - 1]) == 0 && x[0] == x[N / 3 - 1] &&
x[N / 3] == x[N / 3 * 2 - 1] && x[N / 3 * 2] == x[N - 1])
c++;
if (x[0] == x[N - 1] && x[0] == 0)
c++;
if (c > 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
| [
"control_flow.branch.if.condition.change"
] | 783,032 | 783,030 | u251847465 | cpp |
p02975 | #include <algorithm>
#include <cmath>
#include <functional>
#include <stdio.h>
using namespace std;
long long mod = 1000000007;
long long a[100000];
int main() {
int N;
int count = 1;
scanf("%d", &N);
for (int i = 0; i < N; i++) {
scanf("%lld", &a[i]);
}
sort(a, a + N);
long long number = a[0];
long long bit;
int count0 = 1;
int count1 = 0;
int count2 = 0;
if (N % 3 == 0) {
if (a[0] == 0) {
for (int i = 1; i < N; i++) {
if (a[i] == 0) {
count0++;
}
if (a[i] != number) {
number = a[i];
count++;
}
}
if (count == 2 && count0 == N / 3) {
printf("Yes");
return 0;
}
} else {
for (int i = 1; i < N; i++) {
if (a[i] == a[0]) {
count0++;
}
if (a[i] == a[N / 3]) {
count1++;
}
if (a[i] == a[N / 3 * 2]) {
count2++;
}
if (a[i] != number) {
number = a[i];
count++;
}
}
if (count == 3 && count0 == N / 3 && count1 == N / 3 && count2 == N / 3) {
bit = a[0] ^ a[N / 3];
if (bit == a[N / 3 * 2]) {
printf("Yes");
return 0;
}
}
}
}
count0 = 0;
for (int i = 0; i < N; i++) {
if (a[i] == 0) {
count0++;
}
}
if (count == N) {
printf("Yes");
} else {
printf("No");
}
return 0;
} | #include <algorithm>
#include <cmath>
#include <functional>
#include <stdio.h>
using namespace std;
long long mod = 1000000007;
long long a[100000];
int main() {
int N;
int count = 1;
scanf("%d", &N);
for (int i = 0; i < N; i++) {
scanf("%lld", &a[i]);
}
sort(a, a + N);
long long number = a[0];
long long bit;
int count0 = 1;
int count1 = 0;
int count2 = 0;
if (N % 3 == 0) {
if (a[0] == 0) {
for (int i = 1; i < N; i++) {
if (a[i] == 0) {
count0++;
}
if (a[i] != number) {
number = a[i];
count++;
}
}
if (count == 2 && count0 == N / 3) {
printf("Yes");
return 0;
}
} else {
for (int i = 1; i < N; i++) {
if (a[i] == a[0]) {
count0++;
}
if (a[i] == a[N / 3]) {
count1++;
}
if (a[i] == a[N / 3 * 2]) {
count2++;
}
if (a[i] != number) {
number = a[i];
count++;
}
}
if (count == 3 && count0 == N / 3 && count1 == N / 3 && count2 == N / 3) {
bit = a[0] ^ a[N / 3];
if (bit == a[N / 3 * 2]) {
printf("Yes");
return 0;
}
}
}
}
count0 = 0;
for (int i = 0; i < N; i++) {
if (a[i] == 0) {
count0++;
}
}
if (count0 == N) {
printf("Yes");
} else {
printf("No");
}
return 0;
} | [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 783,039 | 783,040 | u475843109 | cpp |
p02975 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
typedef long long ll;
int main() {
int N;
cin >> N;
map<int, ll> a;
vector<ll> r;
rep(i, N) {
ll b;
cin >> b;
a[b]++;
if (a[b] == 1)
r.push_back(b);
}
sort(All(r));
if (r[0] == 0) {
if (a.size() == 1) {
cout << "Yes" << endl;
return 0;
} else if (a.size() == 2) {
if (2 * a[r[0]] == a[r[1]]) {
cout << "Yes" << endl;
return 0;
}
}
}
if (r.size() == 3) {
if (r[0] ^ r[1] == r[2] && (a[r[0]] == a[r[1]] && a[r[1]] == a[r[2]]))
cout << "Yes" << endl;
else
cout << "No" << endl;
} else
cout << "No" << endl;
return 0;
} | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
typedef long long ll;
int main() {
int N;
cin >> N;
map<int, ll> a;
vector<ll> r;
rep(i, N) {
ll b;
cin >> b;
a[b]++;
if (a[b] == 1)
r.push_back(b);
}
sort(All(r));
if (r[0] == 0) {
if (a.size() == 1) {
cout << "Yes" << endl;
return 0;
} else if (a.size() == 2) {
if (2 * a[r[0]] == a[r[1]]) {
cout << "Yes" << endl;
return 0;
}
}
}
if (r.size() == 3) {
if ((r[0] ^ r[1]) == r[2] && (a[r[0]] == a[r[1]] && a[r[1]] == a[r[2]]))
cout << "Yes" << endl;
else
cout << "No" << endl;
} else
cout << "No" << endl;
return 0;
} | [
"control_flow.branch.if.condition.change"
] | 783,041 | 783,042 | u917282863 | cpp |
p02975 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
typedef long long ll;
int main() {
int N;
cin >> N;
map<int, ll> mp;
vector<ll> r;
rep(i, N) {
ll b;
cin >> b;
mp[b]++;
if (mp[b] == 1)
r.push_back(b);
}
sort(All(r));
if (mp.size() > 3) {
cout << "No" << endl;
} else if (mp.size() == 1) {
if (r[0] == 0)
cout << "Yes" << endl;
else
cout << "No" << endl;
} else if (mp.size() == 2) {
if (r[0] == 0 && 2 * mp[r[0]] == mp[r[1]])
cout << "Yes" << endl;
else
cout << "No" << endl;
} else if (mp.size() == 3) {
if (r[0] ^ r[1] == r[2] && (mp[r[0]] == mp[r[1]] && mp[r[1]] == mp[r[2]]))
cout << "Yes" << endl;
else
cout << "No" << endl;
}
return 0;
} | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
typedef long long ll;
int main() {
int N;
cin >> N;
map<int, ll> mp;
vector<ll> r;
rep(i, N) {
ll b;
cin >> b;
mp[b]++;
if (mp[b] == 1)
r.push_back(b);
}
sort(All(r));
if (mp.size() > 3) {
cout << "No" << endl;
} else if (mp.size() == 1) {
if (r[0] == 0)
cout << "Yes" << endl;
else
cout << "No" << endl;
} else if (mp.size() == 2) {
if (r[0] == 0 && 2 * mp[r[0]] == mp[r[1]])
cout << "Yes" << endl;
else
cout << "No" << endl;
} else if (mp.size() == 3) {
if ((r[0] ^ r[1]) == r[2] && mp[r[0]] == mp[r[1]] && mp[r[1]] == mp[r[2]])
cout << "Yes" << endl;
else
cout << "No" << endl;
}
return 0;
} | [
"control_flow.branch.if.condition.change"
] | 783,043 | 783,044 | u917282863 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(a) (a).begin(), (a).end()
#define ll long long
int main() {
int N;
cin >> N;
vector<ll> A(N);
rep(i, N) cin >> A[i];
sort(all(A));
ll X[3] = {};
int j = 0;
rep(i, N) {
if (i)
if (A[i] != A[i - 1]) {
j++;
if (j >= 3)
break;
}
X[j]++;
}
if (X[0] == N && A[0] == 0)
cout << "Yes" << endl;
else if (X[0] * 2 == X[1] && X[2] == 0 && A[0] == 0)
cout << "Yes" << endl;
else if (X[0] == X[1] && X[0] == X[2] && X[0] + X[1] + X[2] == N &&
A[0] ^ A[N / 3] == A[N / 3 * 2])
cout << "Yes" << endl;
else
cout << "No" << endl;
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(a) (a).begin(), (a).end()
#define ll long long
int main() {
int N;
cin >> N;
vector<int> A(N);
rep(i, N) cin >> A[i];
sort(all(A));
int X[3] = {};
int j = 0;
rep(i, N) {
if (i)
if (A[i] != A[i - 1]) {
j++;
if (j >= 3)
break;
}
X[j]++;
}
if (X[0] == N && A[0] == 0)
cout << "Yes" << endl;
else if (X[0] * 2 == X[1] && X[2] == 0 && A[0] == 0)
cout << "Yes" << endl;
else if (X[0] == X[1] && X[0] == X[2] && X[0] + X[1] + X[2] == N &&
(A[0] ^ A[N / 3]) == A[N / 3 * 2])
cout << "Yes" << endl;
else
cout << "No" << endl;
}
| [
"variable_declaration.type.change",
"control_flow.branch.if.condition.change"
] | 783,051 | 783,052 | u154756110 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(a) (a).begin(), (a).end()
#define ll long long
int main() {
int N;
cin >> N;
vector<int> A(N);
rep(i, N) cin >> A[i];
sort(all(A));
ll X[3] = {};
int j = 0;
rep(i, N) {
if (i)
if (A[i] != A[i - 1]) {
j++;
if (j >= 3)
break;
}
X[j]++;
}
if (X[0] == N && A[0] == 0)
cout << "Yes" << endl;
else if (X[0] * 2 == X[1] && X[2] == 0 && A[0] == 0)
cout << "Yes" << endl;
else if (X[0] == X[1] && X[0] == X[2] && X[0] + X[1] + X[2] == N &&
A[0] ^ A[N / 3] == A[N / 3 * 2])
cout << "Yes" << endl;
else
cout << "No" << endl;
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(a) (a).begin(), (a).end()
#define ll long long
int main() {
int N;
cin >> N;
vector<int> A(N);
rep(i, N) cin >> A[i];
sort(all(A));
int X[3] = {};
int j = 0;
rep(i, N) {
if (i)
if (A[i] != A[i - 1]) {
j++;
if (j >= 3)
break;
}
X[j]++;
}
if (X[0] == N && A[0] == 0)
cout << "Yes" << endl;
else if (X[0] * 2 == X[1] && X[2] == 0 && A[0] == 0)
cout << "Yes" << endl;
else if (X[0] == X[1] && X[0] == X[2] && X[0] + X[1] + X[2] == N &&
(A[0] ^ A[N / 3]) == A[N / 3 * 2])
cout << "Yes" << endl;
else
cout << "No" << endl;
}
| [
"variable_declaration.type.change",
"control_flow.branch.if.condition.change"
] | 783,053 | 783,052 | u154756110 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(a) (a).begin(), (a).end()
#define ll long long
int main() {
int N;
cin >> N;
vector<int> A(N);
rep(i, N) cin >> A[i];
sort(all(A));
int X[3] = {};
int j = 0;
rep(i, N) {
if (i)
if (A[i] != A[i - 1]) {
j++;
if (j >= 3)
break;
}
X[j]++;
}
if (X[0] == N && A[0] == 0)
cout << "Yes" << endl;
else if (X[0] * 2 == X[1] && X[2] == 0 && A[0] == 0)
cout << "Yes" << endl;
else if (X[0] == X[1] && X[0] == X[2] && X[0] + X[1] + X[2] == N &&
A[0] ^ A[N / 3] == A[N / 3 * 2])
cout << "Yes" << endl;
else
cout << "No" << endl;
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(a) (a).begin(), (a).end()
#define ll long long
int main() {
int N;
cin >> N;
vector<int> A(N);
rep(i, N) cin >> A[i];
sort(all(A));
int X[3] = {};
int j = 0;
rep(i, N) {
if (i)
if (A[i] != A[i - 1]) {
j++;
if (j >= 3)
break;
}
X[j]++;
}
if (X[0] == N && A[0] == 0)
cout << "Yes" << endl;
else if (X[0] * 2 == X[1] && X[2] == 0 && A[0] == 0)
cout << "Yes" << endl;
else if (X[0] == X[1] && X[0] == X[2] && X[0] + X[1] + X[2] == N &&
(A[0] ^ A[N / 3]) == A[N / 3 * 2])
cout << "Yes" << endl;
else
cout << "No" << endl;
}
| [
"control_flow.branch.if.condition.change"
] | 783,054 | 783,052 | u154756110 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll inf = numeric_limits<ll>::max() / 3;
const ll mod = 1e9 + 7;
int main(void) {
int n;
map<ll, ll> a;
cin >> n;
for (int i = 0; i < n; ++i) {
ll tmp;
cin >> tmp;
a[tmp]++;
}
vector<pair<ll, ll>> calc;
for (auto p : a) {
calc.push_back(p);
}
if (a[0] == n) {
puts("Yes");
return 0;
}
if (n % 3 != 0) {
puts("No");
return 0;
}
if (calc.size() == 3 && calc[0].first ^ calc[1].first == calc[2].first &&
calc[0].second == n / 3 && calc[1].second == n / 3 &&
calc[2].second == n / 3) {
cout << "Yes" << endl;
} else if (calc.size() == 2 && calc[0].first == 0 &&
calc[0].second == n / 3 && calc[1].second == (n * 2) / 3) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll inf = numeric_limits<ll>::max() / 3;
const ll mod = 1e9 + 7;
int main(void) {
int n;
map<ll, ll> a;
cin >> n;
for (int i = 0; i < n; ++i) {
ll tmp;
cin >> tmp;
a[tmp]++;
}
vector<pair<ll, ll>> calc;
for (auto p : a) {
calc.push_back(p);
}
if (a[0] == n) {
puts("Yes");
return 0;
}
if (n % 3 != 0) {
puts("No");
return 0;
}
if (calc.size() == 3 && (calc[0].first ^ calc[1].first) == calc[2].first &&
calc[0].second == n / 3 && calc[1].second == n / 3 &&
calc[2].second == n / 3) {
cout << "Yes" << endl;
} else if (calc.size() == 2 && calc[0].first == 0LL &&
calc[0].second == n / 3 && calc[1].second == (n * 2) / 3) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
| [
"control_flow.branch.if.condition.change"
] | 783,057 | 783,058 | u488078009 | cpp |
p02975 | #include <bits/stdc++.h>
using namespace std;
bool solve(vector<int> A, long long N) {
for (long long i = 0; i < 3; i++) {
long long check = A[i * (N / 3)];
for (long long j = 0; j < (N / 3); j++) {
if (A[i * (N / 3) + j] != check)
return false;
}
}
if (A[1 * (N / 3)] ^ A[2 * (N / 3)] == A[0])
return true;
else
return false;
}
bool newSolve(vector<int> A, long long N) {
long long idx = 0;
long long check = 0;
for (long long i = 0; i < A.size(); i++) {
if (A[i] != 0 && check == 0) {
check = A[i];
idx = i;
break;
}
}
if (!check)
return true;
// cout << idx << endl;
// for (auto i : A) {
// cout << i;
// }
// cout << endl;
if (idx * 3 != N)
return false;
for (long long i = idx; i < A.size(); i++) {
if (A[i] != check)
return false;
}
return true;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
long long N;
cin >> N;
vector<int> A(N);
for (long long i = 0; i < N; i++) {
cin >> A[i];
}
sort(A.begin(), A.end());
if (A[0] == 0) {
cout << (newSolve(A, N) ? "Yes" : "No") << endl;
} else if (N % 3 != 0)
cout << "No" << endl;
else {
cout << (solve(A, N) ? "Yes" : "No") << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
bool solve(vector<int> A, long long N) {
for (long long i = 0; i < 3; i++) {
long long check = A[i * (N / 3)];
for (long long j = 0; j < (N / 3); j++) {
if (A[i * (N / 3) + j] != check)
return false;
}
}
if ((A[1 * (N / 3)] ^ A[2 * (N / 3)]) == A[0])
return true;
else
return false;
}
bool newSolve(vector<int> A, long long N) {
long long idx = 0;
long long check = 0;
for (long long i = 0; i < A.size(); i++) {
if (A[i] != 0 && check == 0) {
check = A[i];
idx = i;
break;
}
}
if (!check)
return true;
if (idx * 3 != N)
return false;
for (long long i = idx; i < A.size(); i++) {
if (A[i] != check)
return false;
}
return true;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
long long N;
cin >> N;
vector<int> A(N);
for (long long i = 0; i < N; i++) {
cin >> A[i];
}
sort(A.begin(), A.end());
if (A[0] == 0) {
cout << (newSolve(A, N) ? "Yes" : "No") << endl;
} else if (N % 3 != 0)
cout << "No" << endl;
else {
cout << (solve(A, N) ? "Yes" : "No") << endl;
}
} | [
"control_flow.branch.if.condition.change"
] | 783,061 | 783,062 | u570018655 | cpp |
p02975 | //#pragma GCC optimize ("-O3","unroll-loops")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <complex>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits.h>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v, n) reverse(v, v + n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define m0(x) memset(x, 0, sizeof(x))
#define print(x) cout << x << '\n';
#define pe(x) cout << x << " ";
#define lb(v, n) lower_bound(v.begin(), v.end(), n);
#define ub(v, n) upper_bound(v.begin(), v.end(), n);
#define int long long
#define all(x) (x).begin(), (x).end()
#define double long double
using namespace std;
int MOD = (ll)1000000000 + 7;
const ll INF = 1e17;
const double pi = acos(-1);
const double EPS = 1e-10;
typedef pair<int, int> P;
const int MAX = 200020;
map<int, int> mp;
set<int> st;
signed main() {
cin.tie(0);
ios::sync_with_stdio(false);
int N;
cin >> N;
REP(i, N) {
int x;
cin >> x;
st.insert(x);
mp[x]++;
}
if (st.size() == 1) {
auto itr = st.begin();
if (*itr == 0)
print("Yes") else print("No");
} else if (st.size() == 2) {
auto itr = st.begin();
if (*itr == 0) {
int cnt = mp[0];
for (auto x : mp) {
if (x.first == 0)
continue;
if (x.second != cnt * 2) {
print("No");
return 0;
}
}
print("Yes");
} else
print("No");
} else if (st.size() == 3) {
int a[3];
int c = 0;
for (auto x : st) {
a[c] = x;
}
bool ok = false;
if ((a[0] ^ a[2]) == a[1] && (a[1] ^ a[2]) == a[0]) {
ok = true;
}
if (!ok) {
print("No");
return 0;
}
auto itr = st.begin();
int cnt = mp[*itr];
for (auto x : mp) {
if (x.second != cnt) {
print("No");
return 0;
}
}
print("Yes");
} else {
print("No");
}
}
| //#pragma GCC optimize ("-O3","unroll-loops")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <complex>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits.h>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v, n) reverse(v, v + n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define m0(x) memset(x, 0, sizeof(x))
#define print(x) cout << x << '\n';
#define pe(x) cout << x << " ";
#define lb(v, n) lower_bound(v.begin(), v.end(), n);
#define ub(v, n) upper_bound(v.begin(), v.end(), n);
#define int long long
#define all(x) (x).begin(), (x).end()
#define double long double
using namespace std;
int MOD = (ll)1000000000 + 7;
const ll INF = 1e17;
const double pi = acos(-1);
const double EPS = 1e-10;
typedef pair<int, int> P;
const int MAX = 200020;
map<int, int> mp;
set<int> st;
signed main() {
cin.tie(0);
ios::sync_with_stdio(false);
int N;
cin >> N;
REP(i, N) {
int x;
cin >> x;
st.insert(x);
mp[x]++;
}
if (st.size() == 1) {
auto itr = st.begin();
if (*itr == 0)
print("Yes") else print("No");
} else if (st.size() == 2) {
auto itr = st.begin();
if (*itr == 0) {
int cnt = mp[0];
for (auto x : mp) {
if (x.first == 0)
continue;
if (x.second != cnt * 2) {
print("No");
return 0;
}
}
print("Yes");
} else
print("No");
} else if (st.size() == 3) {
int a[3];
int c = 0;
for (auto x : st) {
a[c] = x;
c++;
}
bool ok = false;
if ((a[0] ^ a[2]) == a[1] && (a[1] ^ a[2]) == a[0]) {
ok = true;
}
if (!ok) {
print("No");
return 0;
}
auto itr = st.begin();
int cnt = mp[*itr];
for (auto x : mp) {
if (x.second != cnt) {
print("No");
return 0;
}
}
print("Yes");
} else {
print("No");
}
}
| [
"expression.unary.arithmetic.add"
] | 783,063 | 783,064 | u859396346 | cpp |
p02976 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORD(i, a, b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define TR(X) \
({ \
if (1) \
cerr << "TR: " << (#X) << " = " << (X) << endl; \
})
vl mark;
vvl adj;
bool dfs(ll i, ll p = -1) {
ll k = -1;
mark[i] = 1;
for (ll j : adj[i]) {
if (j == p)
continue;
if (mark[j] == 2)
continue;
if (mark[j] == 1 || dfs(j, i)) {
if (k == -1) {
k = j;
} else {
cout << i + 1 << " " << j + 1 << endl;
cout << i + 1 << " " << j + 1 << endl;
k = -1;
}
}
}
mark[i] = 2;
if (k == -1)
return true;
cout << i + 1 << " " << k + 1 << endl;
cout << i + 1 << " " << p + 1 << endl;
return false;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n, m;
cin >> n >> m;
adj.resize(n);
if (m % 2 == 1) {
cout << -1 << endl;
return 0;
}
while (m--) {
ll a, b;
cin >> a >> b;
a--, b--;
adj[a].pb(b);
adj[b].pb(a);
}
mark.resize(n);
dfs(0);
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORD(i, a, b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define TR(X) \
({ \
if (1) \
cerr << "TR: " << (#X) << " = " << (X) << endl; \
})
vl mark;
vvl adj;
bool dfs(ll i, ll p = -1) {
ll k = -1;
mark[i] = 1;
for (ll j : adj[i]) {
if (j == p)
continue;
if (mark[j] == 2)
continue;
if (mark[j] == 1 || dfs(j, i)) {
if (k == -1) {
k = j;
} else {
cout << i + 1 << " " << k + 1 << endl;
cout << i + 1 << " " << j + 1 << endl;
k = -1;
}
}
}
mark[i] = 2;
if (k == -1)
return true;
cout << i + 1 << " " << k + 1 << endl;
cout << i + 1 << " " << p + 1 << endl;
return false;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n, m;
cin >> n >> m;
adj.resize(n);
if (m % 2 == 1) {
cout << -1 << endl;
return 0;
}
while (m--) {
ll a, b;
cin >> a >> b;
a--, b--;
adj[a].pb(b);
adj[b].pb(a);
}
mark.resize(n);
dfs(0);
}
| [
"identifier.change",
"io.output.change"
] | 783,072 | 783,073 | u091970605 | cpp |
p02976 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#ifdef iq
mt19937 rnd(228);
#else
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif
bool f[200000];
vector<int> ans1, ans2, ans3;
vector<int> s[200000], g[200000];
int t, n, m, i, x, y;
int p(int v) {
vector<int> pos;
for (int i = 0; i < g[v].size(); i++)
if (!f[s[v][i]]) {
f[s[v][i]] = 1;
t = p(g[v][i]);
if (t != 0) {
ans1.push_back(v);
ans2.push_back(g[v][i]);
ans3.push_back(t);
} else {
pos.push_back(g[v][i]);
}
}
for (int i = 1; i < pos.size(); i += 2)
ans1.push_back(pos[i - 1]), ans2.push_back(v), ans3.push_back(pos[i]);
if (pos.size() % 2 == 1)
return pos[pos.size() - 1];
return 0;
}
int main() {
#ifdef iq
freopen("a.in", "r", stdin);
#endif
ios::sync_with_stdio(0);
cin.tie(0);
int n, m;
cin >> n >> m;
if (m % 2) {
cout << "No\n";
return 0;
}
vector<int> a(m), b(m);
for (int i = 0; i < m; i++) {
cin >> a[i] >> b[i];
int x = a[i], y = b[i];
g[x].push_back(y);
g[y].push_back(x);
s[x].push_back(i);
s[y].push_back(i);
}
for (int i = 1; i <= n; i++) {
assert(p(i) == 0);
}
map<pair<int, int>, int> ord;
for (int i = 0; i < (int)ans1.size(); i++) {
ord[{ans1[i], ans2[i]}] = ord[{ans3[i], ans2[i]}] = 1;
}
for (int i = 0; i < m; i++) {
if (ord.count({a[i], b[i]})) {
cout << a[i] << ' ' << b[i] << '\n';
} else {
cout << b[i] << ' ' << a[i] << '\n';
}
}
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#ifdef iq
mt19937 rnd(228);
#else
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif
bool f[200000];
vector<int> ans1, ans2, ans3;
vector<int> s[200000], g[200000];
int t, n, m, i, x, y;
int p(int v) {
vector<int> pos;
for (int i = 0; i < g[v].size(); i++)
if (!f[s[v][i]]) {
f[s[v][i]] = 1;
t = p(g[v][i]);
if (t != 0) {
ans1.push_back(v);
ans2.push_back(g[v][i]);
ans3.push_back(t);
} else {
pos.push_back(g[v][i]);
}
}
for (int i = 1; i < pos.size(); i += 2)
ans1.push_back(pos[i - 1]), ans2.push_back(v), ans3.push_back(pos[i]);
if (pos.size() % 2 == 1)
return pos[pos.size() - 1];
return 0;
}
int main() {
#ifdef iq
freopen("a.in", "r", stdin);
#endif
ios::sync_with_stdio(0);
cin.tie(0);
int n, m;
cin >> n >> m;
if (m % 2) {
cout << "-1\n";
return 0;
}
vector<int> a(m), b(m);
for (int i = 0; i < m; i++) {
cin >> a[i] >> b[i];
int x = a[i], y = b[i];
g[x].push_back(y);
g[y].push_back(x);
s[x].push_back(i);
s[y].push_back(i);
}
for (int i = 1; i <= n; i++) {
assert(p(i) == 0);
}
map<pair<int, int>, int> ord;
for (int i = 0; i < (int)ans1.size(); i++) {
ord[{ans1[i], ans2[i]}] = ord[{ans3[i], ans2[i]}] = 1;
}
for (int i = 0; i < m; i++) {
if (!ord.count({a[i], b[i]})) {
cout << a[i] << ' ' << b[i] << '\n';
} else {
cout << b[i] << ' ' << a[i] << '\n';
}
}
}
| [
"literal.string.change",
"io.output.change",
"expression.operation.unary.add",
"control_flow.branch.if.condition.change"
] | 783,074 | 783,075 | u814534994 | cpp |
p02977 | #include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define per(i, a, b) for (int i = a; i >= b; i--)
using namespace std;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef long long ll;
template <typename _T> inline void read(_T &f) {
f = 0;
_T fu = 1;
char c = getchar();
while (c < '0' || c > '9') {
if (c == '-') {
fu = -1;
}
c = getchar();
}
while (c >= '0' && c <= '9') {
f = (f << 3) + (f << 1) + (c & 15);
c = getchar();
}
f *= fu;
}
template <typename T> void print(T x) {
if (x < 0)
putchar('-'), x = -x;
if (x < 10)
putchar(x + 48);
else
print(x / 10), putchar(x % 10 + 48);
}
template <typename T> void print(T x, char t) {
print(x);
putchar(t);
}
int n, base;
int main() {
read(n);
for (int i = 0; i <= 16; i++) {
if (n < (1 << i))
break;
base = i;
if (n == (1 << i)) {
printf("NO\n");
return 0;
}
}
printf("YES\n");
for (int i = 2; i < n; i += 2) {
printf("%d %d\n", 1, i);
printf("%d %d\n", i, i + 1);
printf("%d %d\n", 1, i + 1 + n);
printf("%d %d\n", i + 1 + n, i + n);
}
printf("%d 3\n", n + 1);
if (n % 2 == 0) {
int x = (1 << base), y = n - x + 1;
printf("%d %d\n", n, x);
printf("%d %d\n", n * 2, y + n);
}
return 0;
} | #include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define per(i, a, b) for (int i = a; i >= b; i--)
using namespace std;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef long long ll;
template <typename _T> inline void read(_T &f) {
f = 0;
_T fu = 1;
char c = getchar();
while (c < '0' || c > '9') {
if (c == '-') {
fu = -1;
}
c = getchar();
}
while (c >= '0' && c <= '9') {
f = (f << 3) + (f << 1) + (c & 15);
c = getchar();
}
f *= fu;
}
template <typename T> void print(T x) {
if (x < 0)
putchar('-'), x = -x;
if (x < 10)
putchar(x + 48);
else
print(x / 10), putchar(x % 10 + 48);
}
template <typename T> void print(T x, char t) {
print(x);
putchar(t);
}
int n, base;
int main() {
read(n);
for (int i = 0; i <= 16; i++) {
if (n < (1 << i))
break;
base = i;
if (n == (1 << i)) {
printf("No\n");
return 0;
}
}
printf("Yes\n");
for (int i = 2; i < n; i += 2) {
printf("%d %d\n", 1, i);
printf("%d %d\n", i, i + 1);
printf("%d %d\n", 1, i + 1 + n);
printf("%d %d\n", i + 1 + n, i + n);
}
printf("%d 3\n", n + 1);
if (n % 2 == 0) {
int x = (1 << base), y = n - x + 1;
printf("%d %d\n", n, x);
printf("%d %d\n", n * 2, y + n);
}
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 783,097 | 783,098 | u087020019 | cpp |
p02977 | #include <bits/stdc++.h>
#define PB push_back
#define MP std::make_pair
#define FI first
#define SE second
#define M 1000005
#define INF 1000000000
int n;
int read() {
char c = getchar();
int ans = 0;
while (c < '0' || c > '9')
c = getchar();
while (c >= '0' && c <= '9')
ans = ans * 10 + c - '0', c = getchar();
return ans;
}
void Write(int x) {
if (x < 10)
putchar(x + '0');
else
Write(x / 10), putchar(x % 10 + '0');
return;
}
void link(int x, int y) {
return Write(x), putchar(' '), Write(y), putchar('\n'), void();
}
int main() {
n = read();
if (!(n & (n - 1)))
return !printf("NO");
printf("YES\n");
link(1, 2), link(2, 3), link(3, n + 1), link(n + 1, n + 2),
link(n + 2, n + 3);
for (int i = 4; i < n; i += 2)
link(1, i), link(1, i + 1), link(i, n + i + 1), link(i + 1, n + i);
if (!(n & 1)) {
for (int i = 4; i < n; i++) {
int j = i ^ 1 ^ n;
if (j != 3 && j < n)
link(i, n), link(j, n * 2), exit(0);
}
assert(0);
}
return 0;
}
| #include <bits/stdc++.h>
#define PB push_back
#define MP std::make_pair
#define FI first
#define SE second
#define M 1000005
#define INF 1000000000
int n;
int read() {
char c = getchar();
int ans = 0;
while (c < '0' || c > '9')
c = getchar();
while (c >= '0' && c <= '9')
ans = ans * 10 + c - '0', c = getchar();
return ans;
}
void Write(int x) {
if (x < 10)
putchar(x + '0');
else
Write(x / 10), putchar(x % 10 + '0');
return;
}
void link(int x, int y) {
return Write(x), putchar(' '), Write(y), putchar('\n'), void();
}
int main() {
n = read();
if (!(n & (n - 1)))
return !printf("No");
printf("Yes\n");
link(1, 2), link(2, 3), link(3, n + 1), link(n + 1, n + 2),
link(n + 2, n + 3);
for (int i = 4; i < n; i += 2)
link(1, i), link(1, i + 1), link(i, n + i + 1), link(i + 1, n + i);
if (!(n & 1)) {
for (int i = 4; i < n; i++) {
int j = i ^ 1 ^ n;
if (j != 3 && j < n)
link(i, n), link(j, n * 2), exit(0);
}
assert(0);
}
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"function.return_value.change",
"io.output.change"
] | 783,099 | 783,100 | u281390654 | cpp |
p02977 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#define rep(i, l, r) for (int i = (l); i <= (r); ++i)
#define per(i, r, l) for (int i = (r); i >= (l); --i)
using namespace std;
int n, k;
void ot(int u, int v) {
printf("%d %d\n", u, v);
;
}
int main() {
scanf("%d", &n);
while ((1 << k + 1) < n)
++k;
int m = 1 << k;
if (m == n)
return puts("No"), 0;
puts("Yes");
ot(1, 3);
ot(3, 2);
ot(2, n + 1);
ot(n + 1, n + 3);
ot(n + 3, n + 2);
rep(i, 2, (n - 1) / 2) ot(1, 2 * i), ot(1, 2 * i + 1),
ot(2 * i, 2 * i + 1 + n), ot(2 * i + 1, 2 * i + n);
if (!(n & 1)) {
int t = m ^ 1 ^ n;
ot(m, n), ot(t, 2 * n);
}
return 0;
} | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#define rep(i, l, r) for (int i = (l); i <= (r); ++i)
#define per(i, r, l) for (int i = (r); i >= (l); --i)
using namespace std;
int n, k;
void ot(int u, int v) {
printf("%d %d\n", u, v);
;
}
int main() {
scanf("%d", &n);
while ((1 << k + 1) <= n)
++k;
int m = 1 << k;
if (m == n)
return puts("No"), 0;
puts("Yes");
ot(1, 3);
ot(3, 2);
ot(2, n + 1);
ot(n + 1, n + 3);
ot(n + 3, n + 2);
rep(i, 2, (n - 1) / 2) ot(1, 2 * i), ot(1, 2 * i + 1),
ot(2 * i, 2 * i + 1 + n), ot(2 * i + 1, 2 * i + n);
if (!(n & 1)) {
int t = m ^ 1 ^ n;
ot(m, n), ot(t, 2 * n);
}
return 0;
} | [
"expression.operator.compare.change",
"control_flow.loop.condition.change"
] | 783,118 | 783,119 | u058113228 | cpp |
p02977 | #include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <stdio.h>
#include <vector>
using namespace std;
#define int long long
#define rep(s, i, n) for (int i = s; i < n; i++)
#define c(n) cout << n << endl;
#define ic(n) \
int n; \
cin >> n;
#define sc(s) \
string s; \
cin >> s;
#define mod 1000000007
#define inf 1000000000000000007
#define f first
#define s second
#define mini(c, a, b) *min_element(c + a, c + b)
#define maxi(c, a, b) *max_element(c + a, c + b)
#define pi 3.141592653589793238462643383279
#define e_ 2.718281828459045235360287471352
#define P pair<int, int>
#define upp(a, n, x) upper_bound(a, a + n, x) - a;
#define low(a, n, x) lower_bound(a, a + n, x) - a;
#define UF UnionFind
#define pb push_back
// printf("%.12Lf\n",);
int keta(int x) {
rep(0, i, 30) {
if (x < 10) {
return i + 1;
}
x = x / 10;
}
}
int gcd(int x, int y) {
if (x == 0 || y == 0)
return x + y;
int aa = x, bb = y;
rep(0, i, 1000) {
aa = aa % bb;
if (aa == 0) {
return bb;
}
bb = bb % aa;
if (bb == 0) {
return aa;
}
}
}
int lcm(int x, int y) {
int aa = x, bb = y;
rep(0, i, 1000) {
aa = aa % bb;
if (aa == 0) {
return x / bb * y;
}
bb = bb % aa;
if (bb == 0) {
return x / aa * y;
}
}
}
bool prime(int x) {
if (x == 1)
return false;
rep(2, i, sqrt(x) + 1) {
if (x % i == 0 && x != i) {
return false;
}
}
return true;
}
int max(int a, int b) {
if (a >= b)
return a;
else
return b;
}
string maxst(string s, string t) {
int n = s.size();
int m = t.size();
if (n > m)
return s;
else if (n < m)
return t;
else {
rep(0, i, n) {
if (s[i] > t[i])
return s;
if (s[i] < t[i])
return t;
}
return s;
}
}
string minst(string s, string t) {
int n = s.size();
int m = t.size();
if (n < m)
return s;
else if (n > m)
return t;
else {
rep(0, i, n) {
if (s[i] < t[i])
return s;
if (s[i] > t[i])
return t;
}
return s;
}
}
string string_reverse(string s) {
int n = s.size();
string t;
rep(0, i, n) t += s[n - i - 1];
return t;
}
int min(int a, int b) {
if (a >= b)
return b;
else
return a;
}
int n2[41];
int nis[41];
int nia[41];
int mody[41];
int nn;
int com(int n, int y) {
int ni = 1;
for (int i = 0; i < 41; i++) {
n2[i] = ni;
ni *= 2;
}
int bunsi = 1, bunbo = 1;
rep(0, i, y) bunsi = (bunsi * (n - i)) % mod;
rep(0, i, y) bunbo = (bunbo * (i + 1)) % mod;
mody[0] = bunbo;
rep(1, i, 41) {
bunbo = (bunbo * bunbo) % mod;
mody[i] = bunbo;
}
rep(0, i, 41) nis[i] = 0;
nn = mod - 2;
for (int i = 40; i >= 0; i -= 1) {
if (nn > n2[i]) {
nis[i]++;
nn -= n2[i];
}
}
nis[0]++;
rep(0, i, 41) {
if (nis[i] == 1) {
bunsi = (bunsi * mody[i]) % mod;
}
}
return bunsi;
}
int gyakugen(int n, int y) {
int ni = 1;
for (int i = 0; i < 41; i++) {
n2[i] = ni;
ni *= 2;
}
mody[0] = y;
rep(1, i, 41) {
y = (y * y) % mod;
mody[i] = y;
}
rep(0, i, 41) nis[i] = 0;
nn = mod - 2;
for (int i = 40; i >= 0; i -= 1) {
if (nn > n2[i]) {
nis[i]++;
nn -= n2[i];
}
}
nis[0]++;
rep(0, i, 41) {
if (nis[i] == 1) {
n = (n * mody[i]) % mod;
}
}
return n;
}
int yakuwa(int n) {
int sum = 0;
rep(1, i, sqrt(n + 1)) {
if (n % i == 0)
sum += i + n / i;
if (i * i == n)
sum -= i;
}
return sum;
}
int poow(int y, int n) {
if (n == 0)
return 1;
n -= 1;
int ni = 1;
for (int i = 0; i < 41; i++) {
n2[i] = ni;
ni *= 2;
}
int yy = y;
mody[0] = yy;
rep(1, i, 41) {
yy = (yy * yy) % mod;
mody[i] = yy;
}
rep(0, i, 41) nis[i] = 0;
nn = n;
for (int i = 40; i >= 0; i -= 1) {
if (nn >= n2[i]) {
nis[i]++;
nn -= n2[i];
}
}
rep(0, i, 41) {
if (nis[i] == 1) {
y = (y * mody[i]) % mod;
}
}
return y;
}
int minpow(int x, int y) {
int sum = 1;
rep(0, i, y) sum *= x;
return sum;
}
int ketawa(int x, int sinsuu) {
int sum = 0;
rep(0, i, 80) {
if (minpow(sinsuu, i) > x) {
return sum;
}
sum += (x % minpow(sinsuu, i + 1)) / (minpow(sinsuu, i));
}
return sum;
}
double distance(double a, double b, double c, double d) {
return sqrt((b - a) * (b - a) + (c - d) * (c - d));
}
int sankaku(int a) { return a * (a + 1) / 2; }
int sames(int a[1111111], int n) {
int ans = 0;
rep(0, i, n) {
if (a[i] == a[i + 1]) {
int j = i;
while (a[j + 1] == a[i] && j <= n - 2)
j++;
ans += sankaku(j - i);
i = j;
}
}
return ans;
}
using Graph = vector<vector<int>>;
int oya[114514];
int depth[114514];
void dfs(const Graph &G, int v, int p, int d) {
depth[v] = d;
oya[v] = p;
for (auto nv : G[v]) {
if (nv == p)
continue; // nv が親 p だったらダメ
dfs(G, nv, v, d + 1); // d を 1 増やして子ノードへ
}
}
/*int H=10,W=10;
char field[10][10];
char memo[10][10];
void dfs(int h, int w) {
memo[h][w] = 'x';
// 八方向を探索
for (int dh = -1; dh <= 1; ++dh) {
for (int dw = -1; dw <= 1; ++dw) {
if(abs(0-dh)+abs(0-dw)==2)continue;
int nh = h + dh, nw = w + dw;
// 場外アウトしたり、0 だったりはスルー
if (nh < 0 || nh >= H || nw < 0 || nw >= W) continue;
if (memo[nh][nw] == 'x') continue;
// 再帰的に探索
dfs(nh, nw);
}
}
}*/
int XOR(int a, int b) {
if (a == 0 || b == 0) {
return a + b;
}
int ni = 1;
rep(0, i, 41) {
n2[i] = ni;
ni *= 2;
}
rep(0, i, 41) nis[i] = 0;
for (int i = 40; i >= 0; i -= 1) {
if (a >= n2[i]) {
nis[i]++;
a -= n2[i];
}
if (b >= n2[i]) {
nis[i]++;
b -= n2[i];
}
}
int sum = 0;
rep(0, i, 41) sum += (nis[i] % 2 * n2[i]);
return sum;
}
// int ma[1024577][21];
// for(int bit=0;bit<(1<<n);bit++)rep(0,i,n)if(bit&(1<<i))ma[bit][i]=1;
struct UnionFind {
vector<int> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2
UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
for (int i = 0; i < N; i++)
par[i] = i;
}
int root(int x) { // データxが属する木の根を再帰で得る:root(x) = {xの木の根}
if (par[x] == x)
return x;
return par[x] = root(par[x]);
}
void unite(int x, int y) { // xとyの木を併合
int rx = root(x); // xの根をrx
int ry = root(y); // yの根をry
if (rx == ry)
return; // xとyの根が同じ(=同じ木にある)時はそのまま
par[rx] =
ry; // xとyの根が同じでない(=同じ木にない)時:xの根rxをyの根ryにつける
}
bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
int rx = root(x);
int ry = root(y);
return rx == ry;
}
};
signed main() {
ic(n) int k = 2;
int t = n;
rep(0, i, 40) {
if (k == n) {
c("No") return 0;
}
k = k * 2;
if (k > n) {
k = k / 2;
break;
}
}
c("Yes") cout << 3 << " " << 1 << endl;
cout << 1 << " " << 2 << endl;
cout << 2 << " " << 3 + n << endl;
cout << 3 + n << " " << 1 + n << endl;
cout << 1 + n << " " << 2 + n << endl;
rep(2, i, (n - 3) / 2 + 2) {
cout << 2 << " " << i * 2 << endl;
cout << i * 2 << " " << i * 2 + 1 << endl;
cout << 3 + n << " " << i * 2 + 1 + n << endl;
cout << i * 2 + 1 + n << " " << i * 2 + n << endl;
}
if (n % 2 == 0) {
rep(2, i, n) {
if (i * 2 != n + 2 && XOR(i * 2, 2) == n) {
cout << 2 << " " << n << endl;
cout << i * 2 << " " << 2 * n << endl;
return 0;
}
}
cout << k << " " << n << endl;
rep(2, i, k / 2) {
if (XOR(2, i * 2) == n - k) {
cout << i * 2 << " " << 2 * n << endl;
return 0;
}
}
}
}
| #include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <stdio.h>
#include <vector>
using namespace std;
#define int long long
#define rep(s, i, n) for (int i = s; i < n; i++)
#define c(n) cout << n << endl;
#define ic(n) \
int n; \
cin >> n;
#define sc(s) \
string s; \
cin >> s;
#define mod 1000000007
#define inf 1000000000000000007
#define f first
#define s second
#define mini(c, a, b) *min_element(c + a, c + b)
#define maxi(c, a, b) *max_element(c + a, c + b)
#define pi 3.141592653589793238462643383279
#define e_ 2.718281828459045235360287471352
#define P pair<int, int>
#define upp(a, n, x) upper_bound(a, a + n, x) - a;
#define low(a, n, x) lower_bound(a, a + n, x) - a;
#define UF UnionFind
#define pb push_back
// printf("%.12Lf\n",);
int keta(int x) {
rep(0, i, 30) {
if (x < 10) {
return i + 1;
}
x = x / 10;
}
}
int gcd(int x, int y) {
if (x == 0 || y == 0)
return x + y;
int aa = x, bb = y;
rep(0, i, 1000) {
aa = aa % bb;
if (aa == 0) {
return bb;
}
bb = bb % aa;
if (bb == 0) {
return aa;
}
}
}
int lcm(int x, int y) {
int aa = x, bb = y;
rep(0, i, 1000) {
aa = aa % bb;
if (aa == 0) {
return x / bb * y;
}
bb = bb % aa;
if (bb == 0) {
return x / aa * y;
}
}
}
bool prime(int x) {
if (x == 1)
return false;
rep(2, i, sqrt(x) + 1) {
if (x % i == 0 && x != i) {
return false;
}
}
return true;
}
int max(int a, int b) {
if (a >= b)
return a;
else
return b;
}
string maxst(string s, string t) {
int n = s.size();
int m = t.size();
if (n > m)
return s;
else if (n < m)
return t;
else {
rep(0, i, n) {
if (s[i] > t[i])
return s;
if (s[i] < t[i])
return t;
}
return s;
}
}
string minst(string s, string t) {
int n = s.size();
int m = t.size();
if (n < m)
return s;
else if (n > m)
return t;
else {
rep(0, i, n) {
if (s[i] < t[i])
return s;
if (s[i] > t[i])
return t;
}
return s;
}
}
string string_reverse(string s) {
int n = s.size();
string t;
rep(0, i, n) t += s[n - i - 1];
return t;
}
int min(int a, int b) {
if (a >= b)
return b;
else
return a;
}
int n2[41];
int nis[41];
int nia[41];
int mody[41];
int nn;
int com(int n, int y) {
int ni = 1;
for (int i = 0; i < 41; i++) {
n2[i] = ni;
ni *= 2;
}
int bunsi = 1, bunbo = 1;
rep(0, i, y) bunsi = (bunsi * (n - i)) % mod;
rep(0, i, y) bunbo = (bunbo * (i + 1)) % mod;
mody[0] = bunbo;
rep(1, i, 41) {
bunbo = (bunbo * bunbo) % mod;
mody[i] = bunbo;
}
rep(0, i, 41) nis[i] = 0;
nn = mod - 2;
for (int i = 40; i >= 0; i -= 1) {
if (nn > n2[i]) {
nis[i]++;
nn -= n2[i];
}
}
nis[0]++;
rep(0, i, 41) {
if (nis[i] == 1) {
bunsi = (bunsi * mody[i]) % mod;
}
}
return bunsi;
}
int gyakugen(int n, int y) {
int ni = 1;
for (int i = 0; i < 41; i++) {
n2[i] = ni;
ni *= 2;
}
mody[0] = y;
rep(1, i, 41) {
y = (y * y) % mod;
mody[i] = y;
}
rep(0, i, 41) nis[i] = 0;
nn = mod - 2;
for (int i = 40; i >= 0; i -= 1) {
if (nn > n2[i]) {
nis[i]++;
nn -= n2[i];
}
}
nis[0]++;
rep(0, i, 41) {
if (nis[i] == 1) {
n = (n * mody[i]) % mod;
}
}
return n;
}
int yakuwa(int n) {
int sum = 0;
rep(1, i, sqrt(n + 1)) {
if (n % i == 0)
sum += i + n / i;
if (i * i == n)
sum -= i;
}
return sum;
}
int poow(int y, int n) {
if (n == 0)
return 1;
n -= 1;
int ni = 1;
for (int i = 0; i < 41; i++) {
n2[i] = ni;
ni *= 2;
}
int yy = y;
mody[0] = yy;
rep(1, i, 41) {
yy = (yy * yy) % mod;
mody[i] = yy;
}
rep(0, i, 41) nis[i] = 0;
nn = n;
for (int i = 40; i >= 0; i -= 1) {
if (nn >= n2[i]) {
nis[i]++;
nn -= n2[i];
}
}
rep(0, i, 41) {
if (nis[i] == 1) {
y = (y * mody[i]) % mod;
}
}
return y;
}
int minpow(int x, int y) {
int sum = 1;
rep(0, i, y) sum *= x;
return sum;
}
int ketawa(int x, int sinsuu) {
int sum = 0;
rep(0, i, 80) {
if (minpow(sinsuu, i) > x) {
return sum;
}
sum += (x % minpow(sinsuu, i + 1)) / (minpow(sinsuu, i));
}
return sum;
}
double distance(double a, double b, double c, double d) {
return sqrt((b - a) * (b - a) + (c - d) * (c - d));
}
int sankaku(int a) { return a * (a + 1) / 2; }
int sames(int a[1111111], int n) {
int ans = 0;
rep(0, i, n) {
if (a[i] == a[i + 1]) {
int j = i;
while (a[j + 1] == a[i] && j <= n - 2)
j++;
ans += sankaku(j - i);
i = j;
}
}
return ans;
}
using Graph = vector<vector<int>>;
int oya[114514];
int depth[114514];
void dfs(const Graph &G, int v, int p, int d) {
depth[v] = d;
oya[v] = p;
for (auto nv : G[v]) {
if (nv == p)
continue; // nv が親 p だったらダメ
dfs(G, nv, v, d + 1); // d を 1 増やして子ノードへ
}
}
/*int H=10,W=10;
char field[10][10];
char memo[10][10];
void dfs(int h, int w) {
memo[h][w] = 'x';
// 八方向を探索
for (int dh = -1; dh <= 1; ++dh) {
for (int dw = -1; dw <= 1; ++dw) {
if(abs(0-dh)+abs(0-dw)==2)continue;
int nh = h + dh, nw = w + dw;
// 場外アウトしたり、0 だったりはスルー
if (nh < 0 || nh >= H || nw < 0 || nw >= W) continue;
if (memo[nh][nw] == 'x') continue;
// 再帰的に探索
dfs(nh, nw);
}
}
}*/
int XOR(int a, int b) {
if (a == 0 || b == 0) {
return a + b;
}
int ni = 1;
rep(0, i, 41) {
n2[i] = ni;
ni *= 2;
}
rep(0, i, 41) nis[i] = 0;
for (int i = 40; i >= 0; i -= 1) {
if (a >= n2[i]) {
nis[i]++;
a -= n2[i];
}
if (b >= n2[i]) {
nis[i]++;
b -= n2[i];
}
}
int sum = 0;
rep(0, i, 41) sum += (nis[i] % 2 * n2[i]);
return sum;
}
// int ma[1024577][21];
// for(int bit=0;bit<(1<<n);bit++)rep(0,i,n)if(bit&(1<<i))ma[bit][i]=1;
struct UnionFind {
vector<int> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2
UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
for (int i = 0; i < N; i++)
par[i] = i;
}
int root(int x) { // データxが属する木の根を再帰で得る:root(x) = {xの木の根}
if (par[x] == x)
return x;
return par[x] = root(par[x]);
}
void unite(int x, int y) { // xとyの木を併合
int rx = root(x); // xの根をrx
int ry = root(y); // yの根をry
if (rx == ry)
return; // xとyの根が同じ(=同じ木にある)時はそのまま
par[rx] =
ry; // xとyの根が同じでない(=同じ木にない)時:xの根rxをyの根ryにつける
}
bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
int rx = root(x);
int ry = root(y);
return rx == ry;
}
};
signed main() {
ic(n) int k = 1;
int t = n;
rep(0, i, 40) {
if (k == n) {
c("No") return 0;
}
k = k * 2;
if (k > n) {
k = k / 2;
break;
}
}
c("Yes") cout << 3 << " " << 1 << endl;
cout << 1 << " " << 2 << endl;
cout << 2 << " " << 3 + n << endl;
cout << 3 + n << " " << 1 + n << endl;
cout << 1 + n << " " << 2 + n << endl;
rep(2, i, (n - 3) / 2 + 2) {
cout << 2 << " " << i * 2 << endl;
cout << i * 2 << " " << i * 2 + 1 << endl;
cout << 3 + n << " " << i * 2 + 1 + n << endl;
cout << i * 2 + 1 + n << " " << i * 2 + n << endl;
}
if (n % 2 == 0) {
rep(2, i, n) {
if (i * 2 != n + 2 && XOR(i * 2, 2) == n) {
cout << 2 << " " << n << endl;
cout << i * 2 << " " << 2 * n << endl;
return 0;
}
}
cout << k << " " << n << endl;
rep(2, i, k / 2) {
if (XOR(2, i * 2) == n - k) {
cout << i * 2 << " " << 2 * n << endl;
return 0;
}
}
}
}
| [
"literal.number.change",
"variable_declaration.value.change"
] | 783,132 | 783,133 | u942393279 | cpp |
p02977 | #include <bits/stdc++.h>
#define fo(a, b, c) for (a = b; a <= c; a++)
#define fd(a, b, c) for (a = b; a >= c; a--)
#define ll long long
//#define file
using namespace std;
int n, i, j, k, l, x;
int jh(int t, int x, int y) { return t == x ? y : (t == y ? x : t); }
int main() {
#ifdef file
freopen("agc035c.in", "r", stdin);
#endif
scanf("%d", &n);
if (pow(2, floor(log2(n))) == 1) {
printf("No\n");
return 0;
}
printf("Yes\n");
if (!(n & 1)) {
if (!(((n - 1) + 1) & 2)) {
x = n ^ (n - 1);
fo(i, 1, n - 2) printf("%d %d\n", jh(i, 1, x), jh(i + 1, 1, x));
printf("%d %d\n", jh(n - 1, 1, x), jh(n + 1, 1 + n, x + n));
fo(i, 1, n - 2) printf("%d %d\n", jh(i + n, 1 + n, x + n),
jh(i + 1 + n, 1 + n, x + n));
printf("%d %d\n", n, n - 1), printf("%d %d\n", x + n, n + n);
} else {
x = n ^ (n - 2) ^ 1;
fo(i, 1, n - 4) printf("%d %d\n", jh(i, 2, x), jh(i + 1, 2, x));
fo(i, 1, n - 4) printf("%d %d\n", jh(i + n, 2 + n, x + n),
jh(i + 1 + n, 2 + n, x + n));
printf("%d %d\n", jh(n - 3, 2, x), jh(n + 1, 2 + n, x + n));
printf("%d %d\n", n - 2, n - 1), printf("%d %d\n", n - 1, 1),
printf("%d %d\n", 1, n - 2 + n),
printf("%d %d\n", n - 2 + n, n - 1 + n);
printf("%d %d\n", n, n - 2 + n), printf("%d %d\n", x, n + n);
}
} else if (!((n + 1) & 2)) {
fo(i, 1, n + n - 1) printf("%d %d\n", i, i + 1);
} else {
fo(i, 1, n - 3) printf("%d %d\n", i, i + 1);
fo(i, 1, n - 3) printf("%d %d\n", i + n, i + 1 + n);
printf("%d %d\n", n - 2, n + 1);
printf("%d %d\n", n - 1, n), printf("%d %d\n", n, 1),
printf("%d %d\n", 1, n - 1 + n), printf("%d %d\n", n - 1 + n, n + n);
}
fclose(stdin);
fclose(stdout);
return 0;
} | #include <bits/stdc++.h>
#define fo(a, b, c) for (a = b; a <= c; a++)
#define fd(a, b, c) for (a = b; a >= c; a--)
#define ll long long
//#define file
using namespace std;
int n, i, j, k, l, x;
int jh(int t, int x, int y) { return t == x ? y : (t == y ? x : t); }
int main() {
#ifdef file
freopen("agc035c.in", "r", stdin);
#endif
scanf("%d", &n);
if (pow(2, floor(log2(n))) == n) {
printf("No\n");
return 0;
}
printf("Yes\n");
if (!(n & 1)) {
if (!(((n - 1) + 1) & 2)) {
x = n ^ (n - 1);
fo(i, 1, n - 2) printf("%d %d\n", jh(i, 1, x), jh(i + 1, 1, x));
printf("%d %d\n", jh(n - 1, 1, x), jh(n + 1, 1 + n, x + n));
fo(i, 1, n - 2) printf("%d %d\n", jh(i + n, 1 + n, x + n),
jh(i + 1 + n, 1 + n, x + n));
printf("%d %d\n", n, n - 1), printf("%d %d\n", x + n, n + n);
} else {
x = n ^ (n - 2) ^ 1;
fo(i, 1, n - 4) printf("%d %d\n", jh(i, 2, x), jh(i + 1, 2, x));
fo(i, 1, n - 4) printf("%d %d\n", jh(i + n, 2 + n, x + n),
jh(i + 1 + n, 2 + n, x + n));
printf("%d %d\n", jh(n - 3, 2, x), jh(n + 1, 2 + n, x + n));
printf("%d %d\n", n - 2, n - 1), printf("%d %d\n", n - 1, 1),
printf("%d %d\n", 1, n - 2 + n),
printf("%d %d\n", n - 2 + n, n - 1 + n);
printf("%d %d\n", n, n - 2 + n), printf("%d %d\n", x, n + n);
}
} else if (!((n + 1) & 2)) {
fo(i, 1, n + n - 1) printf("%d %d\n", i, i + 1);
} else {
fo(i, 1, n - 3) printf("%d %d\n", i, i + 1);
fo(i, 1, n - 3) printf("%d %d\n", i + n, i + 1 + n);
printf("%d %d\n", n - 2, n + 1);
printf("%d %d\n", n - 1, n), printf("%d %d\n", n, 1),
printf("%d %d\n", 1, n - 1 + n), printf("%d %d\n", n - 1 + n, n + n);
}
fclose(stdin);
fclose(stdout);
return 0;
} | [
"identifier.replace.add",
"literal.replace.remove",
"control_flow.branch.if.condition.change"
] | 783,162 | 783,163 | u741056329 | cpp |
p02977 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
if ((1 << (int)log2(n)) == n)
return puts("NO"), 0;
puts("YES"), printf("1 2\n2 3\n3 %d\n%d %d\n%d %d\n", n + 1, n + 1, n + 2,
n + 2, n + 3);
for (int i = 4; i < n; i += 2)
printf("%d %d\n%d %d\n%d %d\n%d %d\n", i, 1, i + 1, 1, i, i + n + 1, i + 1,
i + n);
if (!(n & 1))
for (int i = 2; i <= n; i++) {
int w = i ^ 1 ^ n;
if (i == 3 || w == 3 || w > n)
continue;
printf("%d %d\n%d %d\n", n, i, n + n, w);
break;
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
if ((1 << (int)log2(n)) == n)
return puts("No"), 0;
puts("Yes"), printf("1 2\n2 3\n3 %d\n%d %d\n%d %d\n", n + 1, n + 1, n + 2,
n + 2, n + 3);
for (int i = 4; i < n; i += 2)
printf("%d %d\n%d %d\n%d %d\n%d %d\n", i, 1, i + 1, 1, i, i + n + 1, i + 1,
i + n);
if (!(n & 1))
for (int i = 2; i <= n; i++) {
int w = i ^ 1 ^ n;
if (i == 3 || w == 3 || w > n)
continue;
printf("%d %d\n%d %d\n", n, i, n + n, w);
break;
}
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"function.return_value.change",
"io.output.change"
] | 783,183 | 783,184 | u030939205 | cpp |
p02977 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
if ((1 << (int)log2(n)) == n)
return puts("NO"), 0;
puts("YES"), printf("1 2\n2 3\n3 %d\n%d %d\n%d %d\n", n + 1, n + 1, n + 2,
n + 2, n + 3);
for (int i = 4; i < n; i += 2)
printf("%d %d\n%d %d\n%d %d\n%d %d\n", i, 1, i + 1, 1, i, i + n + 1, i + 1,
i + n);
if (!(n & 1))
for (int i = 2; i <= n; i++) {
int w = i ^ 1 ^ n;
if (i == 3 || w == 3 || w > n)
continue;
printf("%d %d\n%d %d\n", n, i, n + n, w);
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
if ((1 << (int)log2(n)) == n)
return puts("No"), 0;
puts("Yes"), printf("1 2\n2 3\n3 %d\n%d %d\n%d %d\n", n + 1, n + 1, n + 2,
n + 2, n + 3);
for (int i = 4; i < n; i += 2)
printf("%d %d\n%d %d\n%d %d\n%d %d\n", i, 1, i + 1, 1, i, i + n + 1, i + 1,
i + n);
if (!(n & 1))
for (int i = 2; i <= n; i++) {
int w = i ^ 1 ^ n;
if (i == 3 || w == 3 || w > n)
continue;
printf("%d %d\n%d %d\n", n, i, n + n, w);
break;
}
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"function.return_value.change",
"io.output.change"
] | 783,185 | 783,184 | u030939205 | cpp |
p02977 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
if ((1 << (int)log2(n)) == n)
return puts("NO"), 0;
puts("YES"), printf("1 2\n2 3\n3 %d\n%d %d\n%d %d\n", n + 1, n + 1, n + 2,
n + 2, n + 3);
for (int i = 4; i < n; i += 2)
printf("%d %d\n%d %d\n%d %d\n%d %d\n", i, 1, i + 1, 1, i, i + n + 1, i + 1,
i + n);
if (!n & 1)
for (int i = 2; i <= n; i++) {
int w = i ^ 1 ^ n;
if (i == 3 || w == 3 || w > n)
continue;
printf("%d %d\n%d %d\n", n, i, n + n, w);
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
if ((1 << (int)log2(n)) == n)
return puts("No"), 0;
puts("Yes"), printf("1 2\n2 3\n3 %d\n%d %d\n%d %d\n", n + 1, n + 1, n + 2,
n + 2, n + 3);
for (int i = 4; i < n; i += 2)
printf("%d %d\n%d %d\n%d %d\n%d %d\n", i, 1, i + 1, 1, i, i + n + 1, i + 1,
i + n);
if (!(n & 1))
for (int i = 2; i <= n; i++) {
int w = i ^ 1 ^ n;
if (i == 3 || w == 3 || w > n)
continue;
printf("%d %d\n%d %d\n", n, i, n + n, w);
break;
}
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"function.return_value.change",
"io.output.change",
"control_flow.branch.if.condition.change"
] | 783,186 | 783,184 | u030939205 | cpp |
p02977 | #include <algorithm>
#include <cstdio>
using namespace std;
void out(int u, int v) { printf("%d %d\n", u, v); }
int main() {
int n, tmp = 1;
scanf("%d", &n);
while (tmp <= n)
tmp <<= 1;
tmp >>= 1;
if (tmp == n)
return puts("NO"), 0;
puts("YES");
for (int i = 2; i <= n; i += 2) {
int u = i, v = i + 1;
out(u, 1);
out(v, 1);
out(u, v + n), out(v, u + n);
}
out(n + 1, 2 + n);
if (n % 2 == 0) {
int p = n ^ 1 ^ tmp;
out(tmp, n);
if (!p)
out(1, n);
else
out(p, n);
}
return 0;
} | #include <algorithm>
#include <cstdio>
using namespace std;
void out(int u, int v) { printf("%d %d\n", u, v); }
int main() {
int n, tmp = 1;
scanf("%d", &n);
while (tmp <= n)
tmp <<= 1;
tmp >>= 1;
if (tmp == n)
return puts("No"), 0;
puts("Yes");
for (int i = 2; i < n; i += 2) {
int u = i, v = i + 1;
out(u, 1);
out(v, 1);
out(u, v + n), out(v, u + n);
}
out(n + 1, 2 + n);
if (n % 2 == 0) {
int p = n ^ 1 ^ tmp;
out(tmp, n + n);
if (!p)
out(1, n);
else
out(p, n);
}
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"function.return_value.change",
"io.output.change",
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 783,205 | 783,203 | u615698034 | cpp |
p02977 | #include <algorithm>
#include <cstdio>
#include <cstring>
using namespace std;
int n, m;
int main() {
scanf("%d", &n);
m = 1;
while (m - 1 <= n)
m <<= 1;
m >>= 1;
m--;
if (n == m + 1) {
printf("No\n");
return 0;
}
printf("Yes\n");
for (int i = 1; i < m; i++)
printf("%d %d\n%d %d\n", i, i + 1, n + i, n + i + 1);
printf("%d %d\n", m, n + 1);
if (n == m)
return 0;
printf("1 %d\n%d %d\n1 %d\n%d %d\n", m + 1, m + 1, m + 2, n + m + 2,
n + m + 2, n + m + 1);
for (int i = m + 3; i <= n; i++)
printf("%d %d\n%d %d\n", i + n - 1, i, i - m - 1, i + n);
return 0;
} | #include <algorithm>
#include <cstdio>
#include <cstring>
using namespace std;
int n, m;
int main() {
scanf("%d", &n);
m = 1;
while (m - 1 <= n)
m <<= 1;
m >>= 1;
m--;
if (n == m + 1 || n == 1) {
printf("No\n");
return 0;
}
printf("Yes\n");
for (int i = 1; i < m; i++)
printf("%d %d\n%d %d\n", i, i + 1, n + i, n + i + 1);
printf("%d %d\n", m, n + 1);
if (n == m)
return 0;
printf("1 %d\n%d %d\n1 %d\n%d %d\n", m + 1, m + 1, m + 2, n + m + 2,
n + m + 2, n + m + 1);
for (int i = m + 3; i <= n; i++)
printf("%d %d\n%d %d\n", i + n - 1, i, i - m - 1, i + n);
return 0;
} | [
"control_flow.branch.if.condition.change"
] | 783,236 | 783,237 | u656762776 | cpp |
p02978 | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x, to) for (x = 0; x < (to); x++)
#define FORR(x, arr) for (auto &x : arr)
#define ITR(x, c) for (__typeof(c.begin()) x = c.begin(); x != c.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))
//-------------------------------------------------------
int N;
ll A[18];
vector<pair<ll, ll>> dp[18][18];
void solve() {
int i, j, k, l, r, x, y;
string s;
cin >> N;
ll L, R;
cin >> L;
N -= 2;
FOR(i, N) cin >> A[i];
cin >> R;
if (N == 2) {
cout << L + R << endl;
return;
}
FOR(i, N) dp[i][1].push_back({A[i], A[i]});
for (l = 2; l <= N; l++) {
for (x = 0; x + l <= N; x++) {
vector<pair<ll, ll>> R;
for (y = x; y < x + l; y++) {
if (y == x) {
FORR(d, dp[x + 1][l - 1]) {
R.push_back({d.first + A[y], d.first + A[y] + d.second});
}
} else if (y + 1 == x + l) {
FORR(d, dp[x][l - 1]) {
R.push_back({d.first + A[y] + d.second, A[y] + d.second});
}
} else {
FORR(d1, dp[x][y - x]) {
FORR(d2, dp[y + 1][x + l - (y + 1)]) {
R.push_back({d1.first + A[y] + d1.second + d2.first,
d1.second + d2.first + A[y] + d2.second});
}
}
}
}
sort(ALL(R));
ll pre = 1LL << 60;
FORR(r, R) if (r.second < pre) {
dp[x][l].push_back(r);
pre = r.second;
}
}
}
ll ret = 1LL << 60;
FORR(d, dp[0][N]) ret = min(ret, d.first + d.second);
cout << ret + L + R << endl;
}
int main(int argc, char **argv) {
string s;
int i;
if (argc == 1)
ios::sync_with_stdio(false), cin.tie(0);
FOR(i, argc - 1) s += argv[i + 1], s += '\n';
FOR(i, s.size()) ungetc(s[s.size() - 1 - i], stdin);
cout.tie(0);
solve();
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x, to) for (x = 0; x < (to); x++)
#define FORR(x, arr) for (auto &x : arr)
#define ITR(x, c) for (__typeof(c.begin()) x = c.begin(); x != c.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))
//-------------------------------------------------------
int N;
ll A[18];
vector<pair<ll, ll>> dp[18][18];
void solve() {
int i, j, k, l, r, x, y;
string s;
cin >> N;
ll L, R;
cin >> L;
N -= 2;
FOR(i, N) cin >> A[i];
cin >> R;
if (N == 0) {
cout << L + R << endl;
return;
}
FOR(i, N) dp[i][1].push_back({A[i], A[i]});
for (l = 2; l <= N; l++) {
for (x = 0; x + l <= N; x++) {
vector<pair<ll, ll>> R;
for (y = x; y < x + l; y++) {
if (y == x) {
FORR(d, dp[x + 1][l - 1]) {
R.push_back({d.first + A[y], d.first + A[y] + d.second});
}
} else if (y + 1 == x + l) {
FORR(d, dp[x][l - 1]) {
R.push_back({d.first + A[y] + d.second, A[y] + d.second});
}
} else {
FORR(d1, dp[x][y - x]) {
FORR(d2, dp[y + 1][x + l - (y + 1)]) {
R.push_back({d1.first + A[y] + d1.second + d2.first,
d1.second + d2.first + A[y] + d2.second});
}
}
}
}
sort(ALL(R));
ll pre = 1LL << 62;
FORR(r, R) if (r.second < pre) {
dp[x][l].push_back(r);
pre = r.second;
}
}
}
ll ret = 1LL << 62;
FORR(d, dp[0][N]) ret = min(ret, d.first + d.second);
cout << ret + L + R << endl;
}
int main(int argc, char **argv) {
string s;
int i;
if (argc == 1)
ios::sync_with_stdio(false), cin.tie(0);
FOR(i, argc - 1) s += argv[i + 1], s += '\n';
FOR(i, s.size()) ungetc(s[s.size() - 1 - i], stdin);
cout.tie(0);
solve();
return 0;
}
| [
"literal.number.change",
"control_flow.branch.if.condition.change",
"expression.operation.binary.change"
] | 783,345 | 783,346 | u452725238 | cpp |
p02978 | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x, to) for (x = 0; x < (to); x++)
#define FORR(x, arr) for (auto &x : arr)
#define ITR(x, c) for (__typeof(c.begin()) x = c.begin(); x != c.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))
//-------------------------------------------------------
int N;
ll A[18];
vector<pair<ll, ll>> dp[16][16];
void solve() {
int i, j, k, l, r, x, y;
string s;
cin >> N;
ll L, R;
cin >> L;
N -= 2;
FOR(i, N) cin >> A[i];
cin >> R;
if (N == 2) {
cout << L + R << endl;
return;
}
FOR(i, N) dp[i][1].push_back({A[i], A[i]});
for (l = 2; l <= N; l++) {
for (x = 0; x + l <= N; x++) {
vector<pair<ll, ll>> R;
for (y = x; y < x + l; y++) {
if (y == x) {
FORR(d, dp[x + 1][l - 1]) {
R.push_back({d.first + A[y], d.first + A[y] + d.second});
}
} else if (y + 1 == x + l) {
FORR(d, dp[x][l - 1]) {
R.push_back({d.first + A[y] + d.second, A[y] + d.second});
}
} else {
FORR(d1, dp[x][y - x]) {
FORR(d2, dp[y + 1][x + l - (y + 1)]) {
R.push_back({d1.first + A[y] + d1.second + d2.first,
d1.second + d2.first + A[y] + d2.second});
}
}
}
}
sort(ALL(R));
ll pre = 1LL << 60;
FORR(r, R) if (r.second < pre) {
dp[x][l].push_back(r);
pre = r.second;
}
}
}
ll ret = 1LL << 60;
FORR(d, dp[0][N]) ret = min(ret, d.first + d.second);
cout << ret + L + R << endl;
}
int main(int argc, char **argv) {
string s;
int i;
if (argc == 1)
ios::sync_with_stdio(false), cin.tie(0);
FOR(i, argc - 1) s += argv[i + 1], s += '\n';
FOR(i, s.size()) ungetc(s[s.size() - 1 - i], stdin);
cout.tie(0);
solve();
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x, to) for (x = 0; x < (to); x++)
#define FORR(x, arr) for (auto &x : arr)
#define ITR(x, c) for (__typeof(c.begin()) x = c.begin(); x != c.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))
//-------------------------------------------------------
int N;
ll A[18];
vector<pair<ll, ll>> dp[18][18];
void solve() {
int i, j, k, l, r, x, y;
string s;
cin >> N;
ll L, R;
cin >> L;
N -= 2;
FOR(i, N) cin >> A[i];
cin >> R;
if (N == 0) {
cout << L + R << endl;
return;
}
FOR(i, N) dp[i][1].push_back({A[i], A[i]});
for (l = 2; l <= N; l++) {
for (x = 0; x + l <= N; x++) {
vector<pair<ll, ll>> R;
for (y = x; y < x + l; y++) {
if (y == x) {
FORR(d, dp[x + 1][l - 1]) {
R.push_back({d.first + A[y], d.first + A[y] + d.second});
}
} else if (y + 1 == x + l) {
FORR(d, dp[x][l - 1]) {
R.push_back({d.first + A[y] + d.second, A[y] + d.second});
}
} else {
FORR(d1, dp[x][y - x]) {
FORR(d2, dp[y + 1][x + l - (y + 1)]) {
R.push_back({d1.first + A[y] + d1.second + d2.first,
d1.second + d2.first + A[y] + d2.second});
}
}
}
}
sort(ALL(R));
ll pre = 1LL << 62;
FORR(r, R) if (r.second < pre) {
dp[x][l].push_back(r);
pre = r.second;
}
}
}
ll ret = 1LL << 62;
FORR(d, dp[0][N]) ret = min(ret, d.first + d.second);
cout << ret + L + R << endl;
}
int main(int argc, char **argv) {
string s;
int i;
if (argc == 1)
ios::sync_with_stdio(false), cin.tie(0);
FOR(i, argc - 1) s += argv[i + 1], s += '\n';
FOR(i, s.size()) ungetc(s[s.size() - 1 - i], stdin);
cout.tie(0);
solve();
return 0;
}
| [
"literal.number.change",
"variable_declaration.array_dimensions.change",
"control_flow.branch.if.condition.change",
"expression.operation.binary.change"
] | 783,347 | 783,346 | u452725238 | cpp |
p02979 | #include <cstdio>
#include <cstring>
#include <iostream>
#define cri const int
#define ll long long
#define re register
using namespace std;
int N, K, mod;
int f[152][152];
inline int mo(cri x) { return x >= mod ? x - mod : x; }
inline void solve2() {
f[0][0] = f[1][0] = f[1][1] = f[2][0] = f[2][1] = 1;
K = (K >> 1) + 1;
for (int i = 3; i <= N; i++) {
for (int j = 0; j < K; j++)
f[i][j] = mo(f[i][0] + f[i - 2][j]);
for (int j = 0; j < K - 1; j++)
f[i][j + 1] = f[i - 2][j];
}
int tmp1 = 0, tmp2 = 0;
for (int i = 0; i < K; i++)
tmp1 = mo(tmp1 + f[N][i]), tmp2 = mo(tmp2 + f[N - 1][i]);
cout << 1ll * tmp1 * tmp2 % mod << endl;
}
int dp[152][152][152];
inline void solve1() {
dp[0][0][0] = 1;
for (int i = 1; i <= N + K >> 1; i++) { // cout<<"i="<<i<<endl;
if (i <= K / 2)
for (int j = 0; j < i; j++)
dp[i][0][j + 1] = dp[i - 1][0][j],
dp[i][0][0] = mo(dp[i][0][0] + dp[i - 1][0][j]);
else if (i <= N / 2) {
for (int j = 0; j <= i; j++)
for (int k = 0; k < i; k++) {
// cout<<j<<" "<<k<<endl;
dp[i][0][0] = mo(dp[i][0][0] + dp[i - 1][j][k]);
if (j >= 2)
dp[i][j + 1][0] = mo(dp[i][j + 1][0] + dp[i - 1][j][k]);
else
dp[i][0][0] = mo(dp[i][0][0] + dp[i - 1][j][k]);
dp[i][0][k + 1] = mo(dp[i][0][k + 1] + dp[i - 1][j][k]);
dp[i][max(j + 1, k + 2)][k + 1] =
mo(dp[i][max(j + 1, k + 2)][k + 1] + dp[i - 1][j][k]);
}
} else {
for (int j = 0; j <= i; j++)
for (int k = 0; k < i; k++) {
dp[i][0][0] = mo(dp[i][0][0] + dp[i - 1][j][k]);
if (j >= 2)
dp[i][j + 1][0] = mo(dp[i][j + 1][0] + dp[i - 1][j][k]);
else
dp[i][0][0] = mo(dp[i][0][0] + dp[i - 1][j][k]);
}
}
for (int j = K + 2; j <= i + 1; j++)
memset(dp[i][j], 0, sizeof dp[i][j]);
}
int ans = 0;
for (int i = 0; i <= N; i++)
for (int k = 0; k <= N; k++)
ans = mo(ans + dp[N + K >> 1][i][k]);
cout << ans << endl;
}
int main() {
cin >> N >> K >> mod;
if (K & 1)
solve1();
else
solve2();
} | #include <cstdio>
#include <cstring>
#include <iostream>
#define cri const int
#define ll long long
#define re register
using namespace std;
int N, K, mod;
int f[152][152];
inline int mo(cri x) { return x >= mod ? x - mod : x; }
inline void solve2() {
f[0][0] = f[1][0] = f[1][1] = f[2][0] = f[2][1] = 1;
K = (K >> 1) + 1;
for (int i = 3; i <= N; i++) {
for (int j = 0; j < K; j++)
f[i][0] = mo(f[i][0] + f[i - 2][j]);
for (int j = 0; j < K - 1; j++)
f[i][j + 1] = f[i - 2][j];
}
int tmp1 = 0, tmp2 = 0;
for (int i = 0; i < K; i++)
tmp1 = mo(tmp1 + f[N][i]), tmp2 = mo(tmp2 + f[N - 1][i]);
cout << 1ll * tmp1 * tmp2 % mod << endl;
}
int dp[152][152][152];
inline void solve1() {
dp[0][0][0] = 1;
for (int i = 1; i <= N + K >> 1; i++) { // cout<<"i="<<i<<endl;
if (i <= K / 2)
for (int j = 0; j < i; j++)
dp[i][0][j + 1] = dp[i - 1][0][j],
dp[i][0][0] = mo(dp[i][0][0] + dp[i - 1][0][j]);
else if (i <= N / 2) {
for (int j = 0; j <= i; j++)
for (int k = 0; k < i; k++) {
// cout<<j<<" "<<k<<endl;
dp[i][0][0] = mo(dp[i][0][0] + dp[i - 1][j][k]);
if (j >= 2)
dp[i][j + 1][0] = mo(dp[i][j + 1][0] + dp[i - 1][j][k]);
else
dp[i][0][0] = mo(dp[i][0][0] + dp[i - 1][j][k]);
dp[i][0][k + 1] = mo(dp[i][0][k + 1] + dp[i - 1][j][k]);
dp[i][max(j + 1, k + 2)][k + 1] =
mo(dp[i][max(j + 1, k + 2)][k + 1] + dp[i - 1][j][k]);
}
} else {
for (int j = 0; j <= i; j++)
for (int k = 0; k < i; k++) {
dp[i][0][0] = mo(dp[i][0][0] + dp[i - 1][j][k]);
if (j >= 2)
dp[i][j + 1][0] = mo(dp[i][j + 1][0] + dp[i - 1][j][k]);
else
dp[i][0][0] = mo(dp[i][0][0] + dp[i - 1][j][k]);
}
}
for (int j = K + 2; j <= i + 1; j++)
memset(dp[i][j], 0, sizeof dp[i][j]);
}
int ans = 0;
for (int i = 0; i <= N; i++)
for (int k = 0; k <= N; k++)
ans = mo(ans + dp[N + K >> 1][i][k]);
cout << ans << endl;
}
int main() {
cin >> N >> K >> mod;
if (K & 1)
solve1();
else
solve2();
} | [
"assignment.variable.change",
"identifier.replace.remove",
"literal.replace.add",
"variable_access.subscript.index.change"
] | 783,356 | 783,357 | u891122128 | cpp |
p02979 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <queue>
using namespace std;
int read() {
char c = getchar();
int res = 0;
while (c < '0' || c > '9')
c = getchar();
while (c >= '0' && c <= '9')
res = (res << 1) + (res << 3) + (c ^ 48), c = getchar();
return res;
}
int n, p, K, f[155][155], g[155][155][155];
void solve1() {
K /= 2;
f[0][0] = 1;
for (int i = 1; i <= (n + 1) / 2; i++) {
for (int j = 0; j <= K; j++)
f[i][0] = (f[i][0] + f[i - 1][j]) % p;
for (int j = 0; j < K; j++)
f[i][j + 1] = (f[i][j + 1] + f[i - 1][j]) % p;
}
int ans1 = 0, ans2 = 0;
for (int i = 0; i <= K; i++)
ans1 = (ans1 + f[n / 2][i]) % p;
for (int i = 0; i <= K; i++)
ans2 = (ans2 + f[(n + 1) / 2][i]) % p;
printf("%lld\n", 1ll * ans1 * ans2 % p);
}
void solve2() {
int last = 0;
g[0][0][0] = 1;
for (int i = 2; i - K <= n; i += 2) {
for (int j = 0; j <= n; j++)
for (int k = 0; k <= K + 1; k++)
g[i][0][0] = (g[i][0][0] + g[i - 2][j][k]) % p;
if (i <= n) {
for (int j = 0; j <= n; j++)
for (int k = 0; k <= K + 1; k++)
g[i][j + 1][0] = (g[i][j + 1][0] + g[i - 2][j][k]) % p;
}
if (i - K >= 1) {
for (int j = 0; j <= n; j++) {
for (int k = 1; k <= K; k++)
g[i][0][k + 1] = (g[i][0][k + 1] + g[i - 2][j][k]) % p;
g[i][0][0] = (g[i][0][0] + g[i - 2][j][0]) % p;
}
}
if (i <= n && i - K >= 1) {
for (int j = 0; j <= n; j++)
for (int k = 0; max(k, j + 1) <= K; k++) {
g[i][j + 1][max(k + 1, j + 2)] =
(g[i][j + 1][max(k + 1, j + 2)] + g[i - 2][j][k]) % p;
}
}
last = i;
}
int ans = 0;
for (int j = 0; j <= n; j++)
for (int k = 0; k <= K + 1; k++)
ans = (ans + g[last][j][k]) % p;
printf("%d\n", ans);
}
int main() {
n = read(), K = read(), p = read();
if (!(K & 1))
solve1();
else
solve2();
} | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <queue>
using namespace std;
int read() {
char c = getchar();
int res = 0;
while (c < '0' || c > '9')
c = getchar();
while (c >= '0' && c <= '9')
res = (res << 1) + (res << 3) + (c ^ 48), c = getchar();
return res;
}
int n, p, K, f[155][155], g[305][155][155];
void solve1() {
K /= 2;
f[0][0] = 1;
for (int i = 1; i <= (n + 1) / 2; i++) {
for (int j = 0; j <= K; j++)
f[i][0] = (f[i][0] + f[i - 1][j]) % p;
for (int j = 0; j < K; j++)
f[i][j + 1] = (f[i][j + 1] + f[i - 1][j]) % p;
}
int ans1 = 0, ans2 = 0;
for (int i = 0; i <= K; i++)
ans1 = (ans1 + f[n / 2][i]) % p;
for (int i = 0; i <= K; i++)
ans2 = (ans2 + f[(n + 1) / 2][i]) % p;
printf("%lld\n", 1ll * ans1 * ans2 % p);
}
void solve2() {
int last = 0;
g[0][0][0] = 1;
for (int i = 2; i - K <= n; i += 2) {
for (int j = 0; j <= n; j++)
for (int k = 0; k <= K + 1; k++)
g[i][0][0] = (g[i][0][0] + g[i - 2][j][k]) % p;
if (i <= n) {
for (int j = 0; j <= n; j++)
for (int k = 0; k <= K + 1; k++)
g[i][j + 1][0] = (g[i][j + 1][0] + g[i - 2][j][k]) % p;
}
if (i - K >= 1) {
for (int j = 0; j <= n; j++) {
for (int k = 1; k <= K; k++)
g[i][0][k + 1] = (g[i][0][k + 1] + g[i - 2][j][k]) % p;
g[i][0][0] = (g[i][0][0] + g[i - 2][j][0]) % p;
}
}
if (i <= n && i - K >= 1) {
for (int j = 0; j <= n; j++)
for (int k = 0; max(k, j + 1) <= K; k++) {
g[i][j + 1][max(k + 1, j + 2)] =
(g[i][j + 1][max(k + 1, j + 2)] + g[i - 2][j][k]) % p;
}
}
last = i;
}
int ans = 0;
for (int j = 0; j <= n; j++)
for (int k = 0; k <= K + 1; k++)
ans = (ans + g[last][j][k]) % p;
printf("%d\n", ans);
}
int main() {
n = read(), K = read(), p = read();
if (!(K & 1))
solve1();
else
solve2();
} | [
"literal.number.change",
"variable_declaration.array_dimensions.change"
] | 783,358 | 783,359 | u562042360 | cpp |
p02979 | #include <bits/stdc++.h>
using namespace std;
int n, k, m;
int s1(int n, int k) {
static int f[155];
f[0] = 1;
for (int i = 1; i <= n + 1; ++i) {
f[i] = 0;
for (int j = 0; j <= k; ++j)
if (i - j - 1 >= 0)
f[i] = (f[i] + f[i - j - 1]) % m;
}
return f[n + 1];
}
int s2(int n, int k) {
static int f[155][155][155];
static int typ[155];
int tot = 0;
for (int i = 1; i * 2 - k <= n; ++i) {
tot++;
if (i * 2 <= n)
typ[tot] |= 2;
if (i * 2 - k > 0)
typ[tot] |= 1;
}
f[0][0][0] = 1;
for (int i = 1; i <= tot; ++i)
for (int j = 0; j <= k + 1; ++j)
for (int l = 0; l <= i; ++l)
if (f[i - 1][j][l]) {
//×óÓÒ¾ù²»Ñ¡
f[i][0][0] = (f[i][0][0] + f[i - 1][j][l]) % m;
//Ñ¡×ó²»Ñ¡ÓÒ
if (typ[i] & 1)
f[i][j ? j + 1 : 0][0] =
(f[i][j ? j + 1 : 0][0] + f[i - 1][j][l]) % m;
//Ñ¡ÓÒ²»Ñ¡×ó
if (typ[i] & 2)
f[i][0][l + 1] = (f[i][0][l + 1] + f[i - 1][j][l]) % m;
if (typ[i] == 3)
f[i][j ? j + 1 : l + 2][l + 1] =
(f[i][j ? j + 1 : l + 2][l + 1] + f[i - 1][j][l]) % m;
}
int as = 0;
for (int i = 0; i <= k + 1; ++i)
for (int j = 0; j <= k; ++j)
as = (as + f[tot][i][j]) % m;
return as;
}
int main() {
scanf("%d%d%d", &n, &k, &m);
if (k % 2 == 0) {
printf("%lld\n", (s1(n / 2, k / 2) * 1ll * s1((n + 1) / 2, k / 2)) % m);
} else
printf("%d\n", s2(n, k));
} | #include <bits/stdc++.h>
using namespace std;
int n, k, m;
int s1(int n, int k) {
static int f[155];
f[0] = 1;
for (int i = 1; i <= n + 1; ++i) {
f[i] = 0;
for (int j = 0; j <= k; ++j)
if (i - j - 1 >= 0)
f[i] = (f[i] + f[i - j - 1]) % m;
}
return f[n + 1];
}
int s2(int n, int k) {
static int f[155][155][155];
static int typ[155];
int tot = 0;
for (int i = 1; i * 2 - k <= n; ++i) {
tot++;
if (i * 2 <= n)
typ[tot] |= 2;
if (i * 2 - k > 0)
typ[tot] |= 1;
}
f[0][0][0] = 1;
for (int i = 1; i <= tot; ++i)
for (int j = 0; j <= k + 1; ++j)
for (int l = 0; l <= i; ++l)
if (f[i - 1][j][l]) {
//×óÓÒ¾ù²»Ñ¡
f[i][0][0] = (f[i][0][0] + f[i - 1][j][l]) % m;
//Ñ¡×ó²»Ñ¡ÓÒ
if (typ[i] & 1)
f[i][j ? j + 1 : 0][0] =
(f[i][j ? j + 1 : 0][0] + f[i - 1][j][l]) % m;
//Ñ¡ÓÒ²»Ñ¡×ó
if (typ[i] & 2)
f[i][0][l + 1] = (f[i][0][l + 1] + f[i - 1][j][l]) % m;
if (typ[i] == 3)
f[i][j ? j + 1 : l + 2][l + 1] =
(f[i][j ? j + 1 : l + 2][l + 1] + f[i - 1][j][l]) % m;
}
int as = 0;
for (int i = 0; i <= k + 1; ++i)
for (int j = 0; j <= tot; ++j)
as = (as + f[tot][i][j]) % m;
return as;
}
int main() {
scanf("%d%d%d", &n, &k, &m);
if (k % 2 == 0) {
printf("%lld\n", (s1(n / 2, k / 2) * 1ll * s1((n + 1) / 2, k / 2)) % m);
} else
printf("%d\n", s2(n, k));
} | [
"identifier.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change"
] | 783,360 | 783,361 | u863209865 | cpp |
p02979 | #include <bits/stdc++.h>
using namespace std;
int n, k, m;
int s1(int n, int k) {
static int f[155];
f[0] = 1;
for (int i = 1; i <= n + 1; ++i) {
f[i] = 0;
for (int j = 0; j <= k; ++j)
if (i - j - 1 >= 0)
f[i] = (f[i] + f[i - j - 1]) % m;
}
return f[n + 1];
}
int s2(int n, int k) {
static int f[155][155][155];
static int typ[155];
int tot = 0;
for (int i = 1; i * 2 - k <= n; ++i) {
tot++;
if (i * 2 <= n)
typ[tot] |= 2;
if (i * 2 - k > 0)
typ[tot] |= 1;
}
f[0][0][0] = 1;
for (int i = 1; i <= tot; ++i)
for (int j = 0; j <= k + 1; ++j)
for (int l = 0; l <= i; ++l)
if (f[i - 1][j][l]) {
//×óÓÒ¾ù²»Ñ¡
f[i][0][0] = (f[i][0][0] + f[i - 1][j][l]) % m;
//Ñ¡×ó²»Ñ¡ÓÒ
if (typ[i] & 1)
f[i][j ? j + 1 : 0][0] =
(f[i][j ? j + 1 : 0][0] + f[i - 1][j][l]) % m;
//Ñ¡ÓÒ²»Ñ¡×ó
if (typ[i] & 2)
f[i][0][l + 1] = (f[i][0][l + 1] + f[i - 1][j][l]) % m;
if (typ[i] == 3)
f[i][j ? j + 1 : l + 2][l + 1] =
(f[i][j ? j + 1 : l + 2][l + 1] + f[i - 1][j][l]) % m;
}
int as = 0;
for (int i = 0; i <= k + 1; ++i)
for (int j = 0; j <= k; ++j)
as = (as + f[tot][i][j]) % m;
return as;
}
int main() {
scanf("%d%d%d", &n, &k, &m);
if (k % 2 == 0) {
printf("%d\n", (s1(n / 2, k / 2) * 1ll * s1((n + 1) / 2, k / 2)) % m);
} else
printf("%d\n", s2(n, k));
} | #include <bits/stdc++.h>
using namespace std;
int n, k, m;
int s1(int n, int k) {
static int f[155];
f[0] = 1;
for (int i = 1; i <= n + 1; ++i) {
f[i] = 0;
for (int j = 0; j <= k; ++j)
if (i - j - 1 >= 0)
f[i] = (f[i] + f[i - j - 1]) % m;
}
return f[n + 1];
}
int s2(int n, int k) {
static int f[155][155][155];
static int typ[155];
int tot = 0;
for (int i = 1; i * 2 - k <= n; ++i) {
tot++;
if (i * 2 <= n)
typ[tot] |= 2;
if (i * 2 - k > 0)
typ[tot] |= 1;
}
f[0][0][0] = 1;
for (int i = 1; i <= tot; ++i)
for (int j = 0; j <= k + 1; ++j)
for (int l = 0; l <= i; ++l)
if (f[i - 1][j][l]) {
//×óÓÒ¾ù²»Ñ¡
f[i][0][0] = (f[i][0][0] + f[i - 1][j][l]) % m;
//Ñ¡×ó²»Ñ¡ÓÒ
if (typ[i] & 1)
f[i][j ? j + 1 : 0][0] =
(f[i][j ? j + 1 : 0][0] + f[i - 1][j][l]) % m;
//Ñ¡ÓÒ²»Ñ¡×ó
if (typ[i] & 2)
f[i][0][l + 1] = (f[i][0][l + 1] + f[i - 1][j][l]) % m;
if (typ[i] == 3)
f[i][j ? j + 1 : l + 2][l + 1] =
(f[i][j ? j + 1 : l + 2][l + 1] + f[i - 1][j][l]) % m;
}
int as = 0;
for (int i = 0; i <= k + 1; ++i)
for (int j = 0; j <= tot; ++j)
as = (as + f[tot][i][j]) % m;
return as;
}
int main() {
scanf("%d%d%d", &n, &k, &m);
if (k % 2 == 0) {
printf("%lld\n", (s1(n / 2, k / 2) * 1ll * s1((n + 1) / 2, k / 2)) % m);
} else
printf("%d\n", s2(n, k));
} | [
"identifier.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change",
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 783,362 | 783,361 | u863209865 | cpp |
p02979 | #include <bits/stdc++.h>
using namespace std;
int n, k, m;
int s1(int n, int k) {
static int f[155];
f[0] = 1;
for (int i = 1; i <= n + 1; ++i) {
f[i] = 0;
for (int j = 0; j <= k; ++j)
if (i - j - 1 >= 0)
f[i] = (f[i] + f[i - j - 1]) % m;
}
return f[n + 1];
}
int s2(int n, int k) {
static int f[155][155][155];
static int typ[155];
int tot = 0;
for (int i = 1; i * 2 - k <= n; ++i) {
tot++;
if (i * 2 <= n)
typ[tot] |= 2;
if (i * 2 - k > 0)
typ[tot] |= 1;
}
f[0][0][0] = 1;
for (int i = 1; i <= tot; ++i)
for (int j = 0; j <= k + 1; ++j)
for (int l = 0; l <= k; ++l)
if (f[i - 1][j][l]) {
//×óÓÒ¾ù²»Ñ¡
f[i][0][0] = (f[i][0][0] + f[i - 1][j][l]) % m;
//Ñ¡×ó²»Ñ¡ÓÒ
if (typ[i] & 1)
f[i][j ? j + 1 : 0][0] =
(f[i][j ? j + 1 : 0][0] + f[i - 1][j][l]) % m;
//Ñ¡ÓÒ²»Ñ¡×ó
if (typ[i] & 2)
f[i][0][l + 1] = (f[i][0][l + 1] + f[i - 1][j][l]) % m;
if (typ[i] == 3)
f[i][j ? j + 1 : l + 2][l + 1] =
(f[i][j ? j + 1 : l + 2][l + 1] + f[i - 1][j][l]) % m;
}
int as = 0;
for (int i = 0; i <= k + 1; ++i)
for (int j = 0; j <= k; ++j)
as = (as + f[tot][i][j]) % m;
return as;
}
int main() {
scanf("%d%d%d", &n, &k, &m);
if (k % 2 == 0) {
printf("%d\n", (s1(n / 2, k / 2) * 1ll * s1((n + 1) / 2, k / 2)) % m);
} else
printf("%d\n", s2(n, k));
} | #include <bits/stdc++.h>
using namespace std;
int n, k, m;
int s1(int n, int k) {
static int f[155];
f[0] = 1;
for (int i = 1; i <= n + 1; ++i) {
f[i] = 0;
for (int j = 0; j <= k; ++j)
if (i - j - 1 >= 0)
f[i] = (f[i] + f[i - j - 1]) % m;
}
return f[n + 1];
}
int s2(int n, int k) {
static int f[155][155][155];
static int typ[155];
int tot = 0;
for (int i = 1; i * 2 - k <= n; ++i) {
tot++;
if (i * 2 <= n)
typ[tot] |= 2;
if (i * 2 - k > 0)
typ[tot] |= 1;
}
f[0][0][0] = 1;
for (int i = 1; i <= tot; ++i)
for (int j = 0; j <= k + 1; ++j)
for (int l = 0; l <= i; ++l)
if (f[i - 1][j][l]) {
//×óÓÒ¾ù²»Ñ¡
f[i][0][0] = (f[i][0][0] + f[i - 1][j][l]) % m;
//Ñ¡×ó²»Ñ¡ÓÒ
if (typ[i] & 1)
f[i][j ? j + 1 : 0][0] =
(f[i][j ? j + 1 : 0][0] + f[i - 1][j][l]) % m;
//Ñ¡ÓÒ²»Ñ¡×ó
if (typ[i] & 2)
f[i][0][l + 1] = (f[i][0][l + 1] + f[i - 1][j][l]) % m;
if (typ[i] == 3)
f[i][j ? j + 1 : l + 2][l + 1] =
(f[i][j ? j + 1 : l + 2][l + 1] + f[i - 1][j][l]) % m;
}
int as = 0;
for (int i = 0; i <= k + 1; ++i)
for (int j = 0; j <= tot; ++j)
as = (as + f[tot][i][j]) % m;
return as;
}
int main() {
scanf("%d%d%d", &n, &k, &m);
if (k % 2 == 0) {
printf("%lld\n", (s1(n / 2, k / 2) * 1ll * s1((n + 1) / 2, k / 2)) % m);
} else
printf("%d\n", s2(n, k));
} | [
"identifier.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change",
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 783,363 | 783,361 | u863209865 | cpp |
p02979 | /*
Author: QAQAutomaton
Lang: C++
Code: E.cpp
Mail: lk@qaq-am.com
Blog: https://www.qaq-am.com/
*/
#include <bits/stdc++.h>
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define DEBUG printf("Passing [%s] in LINE %d\n", __FUNCTION__, __LINE__)
#define Debug debug("Passing [%s] in LINE %d\n", __FUNCTION__, __LINE__)
#define all(x) x.begin(), x.end()
#define x first
#define y second
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
int inf;
const double eps = 1e-8;
const double pi = acos(-1.0);
template <class T, class T2> int chkmin(T &a, T2 b) {
return a > b ? a = b, 1 : 0;
}
template <class T, class T2> int chkmax(T &a, T2 b) {
return a < b ? a = b, 1 : 0;
}
template <class T> T sqr(T a) { return a * a; }
template <class T, class T2> T mmin(T a, T2 b) { return a < b ? a : b; }
template <class T, class T2> T mmax(T a, T2 b) { return a > b ? a : b; }
template <class T> T aabs(T a) { return a < 0 ? -a : a; }
template <class T> int dcmp(T a, T b) { return a > b; }
template <int *a> int cmp_a(int x, int y) { return a[x] < a[y]; }
#define min mmin
#define max mmax
#define abs aabs
struct __INIT__ {
__INIT__() { memset(&inf, 0x3f, sizeof(inf)); }
} __INIT___;
namespace io {
const int SIZE = (1 << 21) + 1;
char ibuf[SIZE], *iS, *iT, obuf[SIZE], *oS = obuf, *oT = oS + SIZE - 1, c,
qu[55];
int f, qr;
// getchar
#define gc() \
(iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, SIZE, stdin), \
(iS == iT ? EOF : *iS++)) \
: *iS++)
// print the remaining part
inline void flush() {
fwrite(obuf, 1, oS - obuf, stdout);
oS = obuf;
}
// putchar
inline void putc(char x) {
*oS++ = x;
if (oS == oT)
flush();
}
template <typename A> inline bool read(A &x) {
for (f = 1, c = gc(); c < '0' || c > '9'; c = gc())
if (c == '-')
f = -1;
else if (c == EOF)
return 0;
for (x = 0; c <= '9' && c >= '0'; c = gc())
x = x * 10 + (c & 15);
x *= f;
return 1;
}
inline bool read(char &x) {
while ((x = gc()) == ' ' || x == '\n' || x == '\r')
;
return x != EOF;
}
inline bool read(char *x) {
while ((*x = gc()) == '\n' || *x == ' ' || *x == '\r')
;
if (*x == EOF)
return 0;
while (!(*x == '\n' || *x == ' ' || *x == '\r' || *x == EOF))
*(++x) = gc();
*x = 0;
return 1;
}
template <typename A, typename... B> inline bool read(A &x, B &...y) {
return read(x) && read(y...);
}
template <typename A> inline bool write(A x) {
if (!x)
putc('0');
if (x < 0)
putc('-'), x = -x;
while (x)
qu[++qr] = x % 10 + '0', x /= 10;
while (qr)
putc(qu[qr--]);
return 0;
}
inline bool write(char x) {
putc(x);
return 0;
}
inline bool write(const char *x) {
while (*x) {
putc(*x);
++x;
}
return 0;
}
inline bool write(char *x) {
while (*x) {
putc(*x);
++x;
}
return 0;
}
template <typename A, typename... B> inline bool write(A x, B... y) {
return write(x) || write(y...);
}
// no need to call flush at the end manually!
struct Flusher_ {
~Flusher_() { flush(); }
} io_flusher_;
} // namespace io
using io ::putc;
using io ::read;
using io ::write;
int n, k, p;
namespace work1 {
int f[155], g[155];
int dp(int n, int k) {
f[0] = 1;
g[0] = 1;
for (int i = 1; i <= n; ++i) {
f[i] = 0;
for (int j = 1; j <= k && j <= i; ++j) {
(f[i] += g[i == j ? 0 : i - j - 1]) >= p ? f[i] -= p : 0;
}
(g[i] = f[i] + g[i - 1]) >= p ? g[i] -= p : 0;
}
return g[n];
}
} // namespace work1
namespace work2 {
int f[79], g[79][79], l[79], r[79];
int &add(int &a, int b) { return (a += b) >= p ? a -= p : a; }
void main() {
int m1 = n >> 1, m2 = (n + 1) >> 1;
int w = 1;
g[0][0] = 1;
for (int i = 1; i <= m1; ++i) {
int x = ((i << 1) - k + 1);
if (x <= 0)
l[i] = 0;
else
l[i] = x >> 1;
x = ((i << 1) + k + 1);
r[i] = x >> 1;
chkmin(r[i], m2 + 1);
}
for (int i = 1; i <= m2; ++i) {
g[0][i] = w;
(w <<= 1) >= p ? w -= p : 0;
}
for (int i = 1; i <= m1; ++i) {
for (int j = 1; j <= i; ++j) {
for (int k = 0; k <= m2; ++k)
f[k] = g[j == 1 ? 0 : j - 2][k];
if (l[i] >= r[j]) {
f[l[i]] = f[r[j]];
for (int k = 0; k < l[i]; ++k)
f[k] = 0;
int w = f[l[i]];
for (int k = l[i] + 1; k <= m2; ++k) {
f[k] = w;
add(w, f[k]);
}
} else {
if (r[j] <= m2) {
for (int k = 0; k < l[i]; ++k)
f[k] = 0;
int s = 0;
for (int k = 0; k <= r[j]; ++k)
add(s, f[k]);
for (int k = r[j] + 1; k <= m2; ++k) {
f[k] = s;
add(s, f[k]);
}
}
}
for (int k = 0; k <= m2; ++k)
add(g[i][k], f[k]);
}
for (int j = 0; j <= m2; ++j) {
add(g[i][j], g[i - 1][j]);
}
}
int s = 0;
for (int i = 0; i <= m2; ++i)
(s += g[m1][i]) >= p ? s -= p : 0;
write(s, '\n');
}
} // namespace work2
signed main() {
#ifdef QAQAutoMaton
freopen("E.in", "r", stdin);
freopen("E.out", "w", stdout);
#endif
read(n, k, p);
if (!(k & 1)) {
k >>= 1;
write(work1::dp(n >> 1, k) * work1::dp(n - (n >> 1), k) % p, '\n');
} else {
work2::main();
}
return 0;
}
| /*
Author: QAQAutomaton
Lang: C++
Code: E.cpp
Mail: lk@qaq-am.com
Blog: https://www.qaq-am.com/
*/
#include <bits/stdc++.h>
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define DEBUG printf("Passing [%s] in LINE %d\n", __FUNCTION__, __LINE__)
#define Debug debug("Passing [%s] in LINE %d\n", __FUNCTION__, __LINE__)
#define all(x) x.begin(), x.end()
#define x first
#define y second
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
int inf;
const double eps = 1e-8;
const double pi = acos(-1.0);
template <class T, class T2> int chkmin(T &a, T2 b) {
return a > b ? a = b, 1 : 0;
}
template <class T, class T2> int chkmax(T &a, T2 b) {
return a < b ? a = b, 1 : 0;
}
template <class T> T sqr(T a) { return a * a; }
template <class T, class T2> T mmin(T a, T2 b) { return a < b ? a : b; }
template <class T, class T2> T mmax(T a, T2 b) { return a > b ? a : b; }
template <class T> T aabs(T a) { return a < 0 ? -a : a; }
template <class T> int dcmp(T a, T b) { return a > b; }
template <int *a> int cmp_a(int x, int y) { return a[x] < a[y]; }
#define min mmin
#define max mmax
#define abs aabs
struct __INIT__ {
__INIT__() { memset(&inf, 0x3f, sizeof(inf)); }
} __INIT___;
namespace io {
const int SIZE = (1 << 21) + 1;
char ibuf[SIZE], *iS, *iT, obuf[SIZE], *oS = obuf, *oT = oS + SIZE - 1, c,
qu[55];
int f, qr;
// getchar
#define gc() \
(iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, SIZE, stdin), \
(iS == iT ? EOF : *iS++)) \
: *iS++)
// print the remaining part
inline void flush() {
fwrite(obuf, 1, oS - obuf, stdout);
oS = obuf;
}
// putchar
inline void putc(char x) {
*oS++ = x;
if (oS == oT)
flush();
}
template <typename A> inline bool read(A &x) {
for (f = 1, c = gc(); c < '0' || c > '9'; c = gc())
if (c == '-')
f = -1;
else if (c == EOF)
return 0;
for (x = 0; c <= '9' && c >= '0'; c = gc())
x = x * 10 + (c & 15);
x *= f;
return 1;
}
inline bool read(char &x) {
while ((x = gc()) == ' ' || x == '\n' || x == '\r')
;
return x != EOF;
}
inline bool read(char *x) {
while ((*x = gc()) == '\n' || *x == ' ' || *x == '\r')
;
if (*x == EOF)
return 0;
while (!(*x == '\n' || *x == ' ' || *x == '\r' || *x == EOF))
*(++x) = gc();
*x = 0;
return 1;
}
template <typename A, typename... B> inline bool read(A &x, B &...y) {
return read(x) && read(y...);
}
template <typename A> inline bool write(A x) {
if (!x)
putc('0');
if (x < 0)
putc('-'), x = -x;
while (x)
qu[++qr] = x % 10 + '0', x /= 10;
while (qr)
putc(qu[qr--]);
return 0;
}
inline bool write(char x) {
putc(x);
return 0;
}
inline bool write(const char *x) {
while (*x) {
putc(*x);
++x;
}
return 0;
}
inline bool write(char *x) {
while (*x) {
putc(*x);
++x;
}
return 0;
}
template <typename A, typename... B> inline bool write(A x, B... y) {
return write(x) || write(y...);
}
// no need to call flush at the end manually!
struct Flusher_ {
~Flusher_() { flush(); }
} io_flusher_;
} // namespace io
using io ::putc;
using io ::read;
using io ::write;
int n, k, p;
namespace work1 {
int f[155], g[155];
int dp(int n, int k) {
f[0] = 1;
g[0] = 1;
for (int i = 1; i <= n; ++i) {
f[i] = 0;
for (int j = 1; j <= k && j <= i; ++j) {
(f[i] += g[i == j ? 0 : i - j - 1]) >= p ? f[i] -= p : 0;
}
(g[i] = f[i] + g[i - 1]) >= p ? g[i] -= p : 0;
}
return g[n];
}
} // namespace work1
namespace work2 {
int f[79], g[79][79], l[79], r[79];
int &add(int &a, int b) { return (a += b) >= p ? a -= p : a; }
void main() {
int m1 = n >> 1, m2 = (n + 1) >> 1;
int w = 1;
g[0][0] = 1;
for (int i = 1; i <= m1; ++i) {
int x = ((i << 1) - k + 1);
if (x <= 0)
l[i] = 0;
else
l[i] = x >> 1;
x = ((i << 1) + k + 1);
r[i] = x >> 1;
chkmin(r[i], m2 + 1);
}
for (int i = 1; i <= m2; ++i) {
g[0][i] = w;
(w <<= 1) >= p ? w -= p : 0;
}
for (int i = 1; i <= m1; ++i) {
for (int j = 1; j <= i; ++j) {
for (int k = 0; k <= m2; ++k)
f[k] = g[j == 1 ? 0 : j - 2][k];
if (l[i] >= r[j]) {
f[l[i]] = f[r[j]];
for (int k = 0; k < l[i]; ++k)
f[k] = 0;
int w = f[l[i]];
for (int k = l[i] + 1; k <= m2; ++k) {
f[k] = w;
add(w, f[k]);
}
} else {
if (r[j] <= m2) {
for (int k = 0; k < l[i]; ++k)
f[k] = 0;
int s = 0;
for (int k = 0; k <= r[j]; ++k)
add(s, f[k]);
for (int k = r[j] + 1; k <= m2; ++k) {
f[k] = s;
add(s, f[k]);
}
}
}
for (int k = 0; k <= m2; ++k)
add(g[i][k], f[k]);
}
for (int j = 0; j <= m2; ++j) {
add(g[i][j], g[i - 1][j]);
}
}
int s = 0;
for (int i = 0; i <= m2; ++i)
(s += g[m1][i]) >= p ? s -= p : 0;
write(s, '\n');
}
} // namespace work2
signed main() {
#ifdef QAQAutoMaton
freopen("E.in", "r", stdin);
freopen("E.out", "w", stdout);
#endif
read(n, k, p);
if (!(k & 1)) {
k >>= 1;
write((ll)work1::dp(n >> 1, k) * work1::dp(n - (n >> 1), k) % p, '\n');
} else {
work2::main();
}
return 0;
}
| [
"type_conversion.add"
] | 783,364 | 783,365 | u228297051 | cpp |
p02979 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 160;
int n, k, mod, g[N][N], f[N][N][N];
int main() {
scanf("%d%d%d", &n, &k, &mod);
if (!(k & 1)) {
g[0][0] = 1;
for (int i = 0; i < n; i++) {
for (int j = 0; j <= i && j <= k >> 1; j++) {
g[i + 1][j + 1] = (g[i + 1][j + 1] + g[i][j]) % mod;
g[i + 1][0] = (g[i + 1][0] + g[i][j]) % mod;
}
}
int ansx = 0, ansy = 0;
for (int j = 0; j <= n + 1 >> 1 && j <= k >> 1; j++) {
ansx = (ansx + g[n >> 1][j]) % mod;
ansy = (ansy + g[n >> 1 | 1][j]) % mod;
}
ansx = (ll)ansx * ansy % mod;
printf("%d\n", ansx);
} else {
f[0][0][0] = 1;
for (int i = 0; i <= n; i++) {
bool px = 2 * i + 1 <= n, py = 2 * i + 1 - k >= 2 && 2 * i + 1 - k <= n;
for (int c = 0; c <= i + 1 && c < k + 2; c++) {
for (int d = 0; d <= i; d++) {
if (true)
f[i + 1][0][0] = (f[i + 1][0][0] + f[i][c][d]) % mod;
if (px)
f[i + 1][0][d + 1] = (f[i + 1][0][d + 1] + f[i][c][d]) % mod;
if (py)
f[i + 1][c ? c + 1 : 0][0] =
(f[i + 1][c ? c + 1 : 0][0] + f[i][c][d]) % mod;
if (px & py)
f[i + 1][max(c + 1, d + 2)][d + 1] =
(f[i + 1][max(c + 1, d + 2)][d + 1] + f[i][c][d]) % mod;
}
}
}
printf("%d\n", f[n + 1][0][0]);
}
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 160;
int n, k, mod, g[N][N], f[N][N][N];
int main() {
scanf("%d%d%d", &n, &k, &mod);
if (!(k & 1)) {
g[0][0] = 1;
for (int i = 0; i < n; i++) {
for (int j = 0; j <= i && j <= k >> 1; j++) {
g[i + 1][j + 1] = (g[i + 1][j + 1] + g[i][j]) % mod;
g[i + 1][0] = (g[i + 1][0] + g[i][j]) % mod;
}
}
int ansx = 0, ansy = 0;
for (int j = 0; j <= n + 1 >> 1 && j <= k >> 1; j++) {
ansx = (ansx + g[n >> 1][j]) % mod;
ansy = (ansy + g[n + 1 >> 1][j]) % mod;
}
ansx = (ll)ansx * ansy % mod;
printf("%d\n", ansx);
} else {
f[0][0][0] = 1;
for (int i = 0; i <= n; i++) {
bool px = 2 * i + 1 <= n, py = 2 * i + 1 - k >= 2 && 2 * i + 1 - k <= n;
for (int c = 0; c <= i + 1 && c < k + 2; c++) {
for (int d = 0; d <= i; d++) {
if (true)
f[i + 1][0][0] = (f[i + 1][0][0] + f[i][c][d]) % mod;
if (px)
f[i + 1][0][d + 1] = (f[i + 1][0][d + 1] + f[i][c][d]) % mod;
if (py)
f[i + 1][c ? c + 1 : 0][0] =
(f[i + 1][c ? c + 1 : 0][0] + f[i][c][d]) % mod;
if (px & py)
f[i + 1][max(c + 1, d + 2)][d + 1] =
(f[i + 1][max(c + 1, d + 2)][d + 1] + f[i][c][d]) % mod;
}
}
}
printf("%d\n", f[n + 1][0][0]);
}
}
| [
"assignment.value.change",
"variable_access.subscript.index.change",
"expression.operation.binary.change"
] | 783,366 | 783,367 | u473087154 | cpp |
p02979 | #include <bits/stdc++.h>
using namespace std;
const int N = 101;
#define fr(i, a, b) for (int i = a; i <= b; ++i)
#define nfr(i, a, b) for (int i = a; i >= b; --i)
int f[2][N];
int g[2][N][N][N];
int n, K, m;
inline void add(int &x, int y) {
x += y;
if (x >= m)
x -= m;
}
int main() {
scanf("%d%d%d", &n, &K, &m);
if (K % 2 == 0) {
int ans = 1;
fr(t, 0, 1) {
int len = (n + t) / 2;
int cur = 0;
memset(f, 0, sizeof f);
f[0][0] = 1;
fr(z, 1, len) {
cur ^= 1;
memset(f[cur], 0, sizeof f[cur]);
fr(j, 0, K / 2) {
if (j < K / 2)
add(f[cur][j + 1], f[cur ^ 1][j]);
add(f[cur][0], f[cur ^ 1][j]);
}
}
int res = 0;
fr(z, 0, len) add(res, f[cur][z]);
ans = 1LL * ans * res % m;
}
printf("%d\n", ans);
} else {
int cur = 0;
g[0][0][0][n] = 1;
int ans = 0;
fr(i, 1, n) {
cur ^= 1;
memset(g[cur], 0, sizeof g[cur]);
int odd = i / 2, even = (i + 1) / 2;
fr(j, 0, even) {
fr(k, 0, odd) {
fr(t, i - 1, n) {
int to = (t % 2 != i % 2) ? n : t;
add(g[cur][0][j][to], g[cur ^ 1][j][k][t]);
if (t != i - 1) {
to = t;
if (j * 2 > K)
to = min(to, i - k * 2 + K - 1);
add(g[cur][k + 1][j][to], g[cur ^ 1][j][k][t]);
}
}
}
}
}
fr(j, 0, n) {
fr(k, 0, n) { add(ans, g[cur][j][k][n]); }
}
printf("%d\n", ans);
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
const int N = 155;
#define fr(i, a, b) for (int i = a; i <= b; ++i)
#define nfr(i, a, b) for (int i = a; i >= b; --i)
int f[2][N];
int g[2][N][N][N];
int n, K, m;
inline void add(int &x, int y) {
x += y;
if (x >= m)
x -= m;
}
int main() {
scanf("%d%d%d", &n, &K, &m);
if (K % 2 == 0) {
int ans = 1;
fr(t, 0, 1) {
int len = (n + t) / 2;
int cur = 0;
memset(f, 0, sizeof f);
f[0][0] = 1;
fr(z, 1, len) {
cur ^= 1;
memset(f[cur], 0, sizeof f[cur]);
fr(j, 0, K / 2) {
if (j < K / 2)
add(f[cur][j + 1], f[cur ^ 1][j]);
add(f[cur][0], f[cur ^ 1][j]);
}
}
int res = 0;
fr(z, 0, len) add(res, f[cur][z]);
ans = 1LL * ans * res % m;
}
printf("%d\n", ans);
} else {
int cur = 0;
g[0][0][0][n] = 1;
int ans = 0;
fr(i, 1, n) {
cur ^= 1;
memset(g[cur], 0, sizeof g[cur]);
int odd = i / 2, even = (i + 1) / 2;
fr(j, 0, even) {
fr(k, 0, odd) {
fr(t, i - 1, n) {
int to = (t % 2 != i % 2) ? n : t;
add(g[cur][0][j][to], g[cur ^ 1][j][k][t]);
if (t != i - 1) {
to = t;
if (j * 2 > K)
to = min(to, i - k * 2 + K - 1);
add(g[cur][k + 1][j][to], g[cur ^ 1][j][k][t]);
}
}
}
}
}
fr(j, 0, n) {
fr(k, 0, n) { add(ans, g[cur][j][k][n]); }
}
printf("%d\n", ans);
}
return 0;
}
| [
"literal.number.change",
"variable_declaration.value.change"
] | 783,377 | 783,378 | u106671729 | cpp |
p02979 | #include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef long double louble;
template <typename T1, typename T2> inline T1 max(T1 a, T2 b) {
return a < b ? b : a;
}
template <typename T1, typename T2> inline T1 min(T1 a, T2 b) {
return a < b ? a : b;
}
namespace ae86 {
const int bufl = 1 << 15;
char buf[bufl], *s = buf, *t = buf;
inline int fetch() {
if (s == t) {
t = (s = buf) + fread(buf, 1, bufl, stdin);
if (s == t)
return EOF;
}
return *s++;
}
inline int ty() {
int a = 0, b = 1, c = fetch();
while (!isdigit(c))
b ^= c == '-', c = fetch();
while (isdigit(c))
a = a * 10 + c - 48, c = fetch();
return b ? a : -a;
}
} // namespace ae86
using ae86::ty;
const int _ = 153;
int mo;
template <typename T1, typename T2> inline T1 ad(T1 &a, T2 b) {
return a = a + b >= mo ? a + b - mo : a + b;
}
template <typename T1, typename T2> inline T1 dl(T1 &a, T2 b) {
return a = a >= b ? a - b : a - b + mo;
}
int n, tran;
namespace whentraniseven {
lint f[_][_];
int main() {
memset(f, 0, sizeof(f)), f[0][0] = 1;
int lim = tran / 2, len = (n + 1) / 2;
for (int i = 1; i <= len; i++) {
for (int j = 0; j <= lim; j++)
ad(f[i][0], f[i - 1][j]);
for (int j = 1; j <= lim; j++)
ad(f[i][j], f[i - 1][j - 1]);
}
lint anse = 0, anso = 0;
for (int i = 0; i <= lim; i++)
ad(anse, f[n / 2][i]);
for (int i = 0; i <= lim; i++)
ad(anso, f[n / 2 + 1][i]);
printf("%lld\n", anse * anso % mo);
return 0;
}
} // namespace whentraniseven
namespace whentranisodd {
lint f[_][_][_];
int main() {
memset(f, 0, sizeof(f)), f[0][0][0] = 1;
int lim = tran + 1;
for (int i = 1; i + i - tran <= n; i++)
for (int j = 0; j <= n; j++)
for (int k = 0; k <= lim; k++) {
if (!f[i - 1][j][k])
continue;
lint x = f[i - 1][j][k];
ad(f[i][0][0], x);
if (i + i <= n)
ad(f[i][j + 1][0], x);
if (i + i - tran >= 1)
ad(f[i][0][k == 0 ? 0 : k + 1], x);
if (i + i <= n && i + i - tran >= 1)
ad(f[i][j + 1][max(j + 2, k + 1)], x);
}
lint ans = 0;
for (int i = 0; i <= n; i++)
for (int j = 0; j <= lim; j++)
ad(ans, f[(n + tran) / 2][i][j]);
printf("%lld\n", ans);
return 0;
}
} // namespace whentranisodd
int main() {
n = ty(), tran = ty(), mo = ty();
if (tran % 2 == 0)
return whentraniseven::main();
return whentranisodd::main();
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef long double louble;
template <typename T1, typename T2> inline T1 max(T1 a, T2 b) {
return a < b ? b : a;
}
template <typename T1, typename T2> inline T1 min(T1 a, T2 b) {
return a < b ? a : b;
}
namespace ae86 {
const int bufl = 1 << 15;
char buf[bufl], *s = buf, *t = buf;
inline int fetch() {
if (s == t) {
t = (s = buf) + fread(buf, 1, bufl, stdin);
if (s == t)
return EOF;
}
return *s++;
}
inline int ty() {
int a = 0, b = 1, c = fetch();
while (!isdigit(c))
b ^= c == '-', c = fetch();
while (isdigit(c))
a = a * 10 + c - 48, c = fetch();
return b ? a : -a;
}
} // namespace ae86
using ae86::ty;
const int _ = 153;
int mo;
template <typename T1, typename T2> inline T1 ad(T1 &a, T2 b) {
return a = a + b >= mo ? a + b - mo : a + b;
}
template <typename T1, typename T2> inline T1 dl(T1 &a, T2 b) {
return a = a >= b ? a - b : a - b + mo;
}
int n, tran;
namespace whentraniseven {
lint f[_][_];
int main() {
memset(f, 0, sizeof(f)), f[0][0] = 1;
int lim = tran / 2, len = (n + 1) / 2;
for (int i = 1; i <= len; i++) {
for (int j = 0; j <= lim; j++)
ad(f[i][0], f[i - 1][j]);
for (int j = 1; j <= lim; j++)
ad(f[i][j], f[i - 1][j - 1]);
}
lint anse = 0, anso = 0;
for (int i = 0; i <= lim; i++)
ad(anse, f[n / 2][i]);
for (int i = 0; i <= lim; i++)
ad(anso, f[(n + 1) / 2][i]);
printf("%lld\n", anse * anso % mo);
return 0;
}
} // namespace whentraniseven
namespace whentranisodd {
lint f[_][_][_];
int main() {
memset(f, 0, sizeof(f)), f[0][0][0] = 1;
int lim = tran + 1;
for (int i = 1; i + i - tran <= n; i++)
for (int j = 0; j <= n; j++)
for (int k = 0; k <= lim; k++) {
if (!f[i - 1][j][k])
continue;
lint x = f[i - 1][j][k];
ad(f[i][0][0], x);
if (i + i <= n)
ad(f[i][j + 1][0], x);
if (i + i - tran >= 1)
ad(f[i][0][k == 0 ? 0 : k + 1], x);
if (i + i <= n && i + i - tran >= 1)
ad(f[i][j + 1][max(j + 2, k + 1)], x);
}
lint ans = 0;
for (int i = 0; i <= n; i++)
for (int j = 0; j <= lim; j++)
ad(ans, f[(n + tran) / 2][i][j]);
printf("%lld\n", ans);
return 0;
}
} // namespace whentranisodd
int main() {
n = ty(), tran = ty(), mo = ty();
if (tran % 2 == 0)
return whentraniseven::main();
return whentranisodd::main();
}
| [
"call.arguments.change",
"expression.operation.binary.remove"
] | 783,379 | 783,380 | u326034736 | cpp |
p02979 | #include <bits/stdc++.h>
const int N = 155;
int n, K, mo, f[N][N][N], i, j, k, ans, x, y;
inline void add(int &x, const int &y) {
x += y - mo;
x += x >> 31 & mo;
}
inline int calc(int n, int K) {
static int g[N][N];
memset(g, 0, sizeof g);
g[0][0] = 1;
for (i = 1; i <= n; ++i)
for (j = 0; j <= K; ++j) {
g[i][0] = (g[i][0] + g[i - 1][j]) % mo;
if (j < K)
g[i][j + 1] = g[i - 1][j];
}
int ans = 0;
for (j = 0; j <= K; ++j)
ans = (ans + g[n][j]) % mo;
return ans;
}
int main() {
scanf("%d%d%d", &n, &K, &mo);
if (n == K) {
ans = 1;
for (i = 1; i <= n; ++i)
ans = 2ll * ans * i % mo;
printf("%d\n", ans);
return 0;
}
if (!(K & 1)) {
K >>= 1;
printf("%lld\n", 1ll * calc(n >> 1, K) * calc(n + 1 >> 1, K) % mo);
return 0;
}
if (K == 1) {
printf("%d\n", calc(n, 2));
return 0;
}
int lb1, rb1, lb2, rb2;
lb1 = (K >> 1) + 1;
rb1 = lb1 + (n + 1 >> 1) - 1;
lb2 = 1;
rb2 = lb2 + (n >> 1) - 1;
for (i = rb1 + 1, f[i][0][0] = 1; i > 1; --i)
for (j = 0; j <= n; ++j)
for (k = 0; k <= n; ++k)
if (x = f[i][j][k]) {
bool b1 = lb1 <= i - 1 && i - 1 <= rb1,
b2 = lb2 <= i - 1 && i - 1 <= rb2;
add(f[i - 1][0][0], x);
if (b1)
add(f[i - 1][j + 1][0], x);
if (k + 1 <= K + 1 && b2)
add(f[i - 1][0][k ? k + 1 : 0], x);
y = std::max(j + 2, k + 1);
if (y <= K + 1 && b1 && b2)
add(f[i - 1][j + 1][y], x);
}
for (j = 0; j <= n; ++j)
for (k = 0; k <= n; ++k)
add(ans, f[1][j][k]);
printf("%d\n", ans);
return 0;
} | #include <bits/stdc++.h>
const int N = 155;
int n, K, mo, f[N][N][N], i, j, k, ans, x, y;
inline void add(int &x, const int &y) {
x += y - mo;
x += x >> 31 & mo;
}
inline int calc(int n, int K) {
static int g[N][N];
memset(g, 0, sizeof g);
g[0][0] = 1;
for (i = 1; i <= n; ++i)
for (j = 0; j <= K; ++j) {
g[i][0] = (g[i][0] + g[i - 1][j]) % mo;
if (j < K)
g[i][j + 1] = g[i - 1][j];
}
int ans = 0;
for (j = 0; j <= K; ++j)
ans = (ans + g[n][j]) % mo;
return ans;
}
int main() {
scanf("%d%d%d", &n, &K, &mo);
if (n == K) {
ans = 1;
for (i = 1; i <= n; ++i)
ans = 2ll * ans % mo;
printf("%d\n", ans);
return 0;
}
if (!(K & 1)) {
K >>= 1;
printf("%lld\n", 1ll * calc(n >> 1, K) * calc(n + 1 >> 1, K) % mo);
return 0;
}
if (K == 1) {
printf("%d\n", calc(n, 2));
return 0;
}
int lb1, rb1, lb2, rb2;
lb1 = (K >> 1) + 1;
rb1 = lb1 + (n + 1 >> 1) - 1;
lb2 = 1;
rb2 = lb2 + (n >> 1) - 1;
for (i = rb1 + 1, f[i][0][0] = 1; i > 1; --i)
for (j = 0; j <= n; ++j)
for (k = 0; k <= n; ++k)
if (x = f[i][j][k]) {
bool b1 = lb1 <= i - 1 && i - 1 <= rb1,
b2 = lb2 <= i - 1 && i - 1 <= rb2;
add(f[i - 1][0][0], x);
if (b1)
add(f[i - 1][j + 1][0], x);
if (k + 1 <= K + 1 && b2)
add(f[i - 1][0][k ? k + 1 : 0], x);
y = std::max(j + 2, k + 1);
if (y <= K + 1 && b1 && b2)
add(f[i - 1][j + 1][y], x);
}
for (j = 0; j <= n; ++j)
for (k = 0; k <= n; ++k)
add(ans, f[1][j][k]);
printf("%d\n", ans);
return 0;
} | [
"expression.operation.binary.remove"
] | 783,381 | 783,382 | u146586861 | cpp |
p02979 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <queue>
#include <vector>
#define LL long long
#define LD long double
using namespace std;
const int NN = 200;
const int MM = +117;
int read() {
int fl = 1, x;
char c;
for (c = getchar(); (c < '0' || c > '9') && c != '-'; c = getchar())
;
if (c == '-') {
fl = -1;
c = getchar();
}
for (x = 0; c >= '0' && c <= '9'; c = getchar())
x = (x << 3) + (x << 1) + c - '0';
return x * fl;
}
void open() {
freopen("a.in", "r", stdin);
// freopen("a.out","w",stdout);
}
void close() {
fclose(stdin);
fclose(stdout);
}
int k, n;
LL dp[2][NN][NN] = {};
int mod;
LL ksm(LL a, LL b) {
LL ret = 1;
for (; b; b >>= 1, a = a * a % mod)
if (b & 1)
ret = ret * a % mod;
return ret;
}
void upd(LL &x, LL y) { x = (x + y) % mod; }
void solve1() {
dp[0][0][0] = 1;
int lim = k / 2;
for (int i = 1; i <= n; ++i) {
for (int a = 0; a <= lim; ++a) {
for (int b = 0; b <= lim; ++b) {
if (i & 1) {
upd(dp[i][a][0], dp[i - 1][a][b]);
upd(dp[i][a][b + 1], dp[i - 1][a][b]);
} else {
upd(dp[i][0][b], dp[i - 1][a][b]);
upd(dp[i][a + 1][b], dp[i - 1][a][b]);
}
}
}
}
LL ans = 0;
for (int a = 0; a <= lim; ++a) {
for (int b = 0; b <= lim; ++b) {
upd(ans, dp[n][a][b]);
}
}
printf("%lld\n", ans);
}
void empty(int now) {
for (int j = 0; j <= k + 2; ++j) {
for (int l = 0; l <= k + 2; ++l) {
dp[now][j][l] = 0;
}
}
}
void cut(int now) {
for (int j = 0; j <= k + 2; ++j) {
for (int l = k - j + 2; l <= k + 2; ++l) {
dp[now][j][l] = 0;
}
}
}
void pushodd(int now) {
for (int j = 0; j <= k + 1; ++j) {
for (int l = 0; l <= k + 1; ++l) {
upd(dp[now][j][0], dp[now ^ 1][j][l]);
upd(dp[now][j][l + 1], dp[now ^ 1][j][l]);
}
}
upd(dp[now][0][k + 1], dp[now ^ 1][0][k + 1]);
}
void pusheven(int now) {
for (int j = 1; j <= k + 2; ++j) {
for (int l = 0; l <= k + 2; ++l) {
upd(dp[now][j - 1][l], dp[now ^ 1][j][l]);
}
}
upd(dp[now][k + 1][0], dp[now ^ 1][k + 1][0]);
for (int j = 0; j <= k + 1; ++j) {
for (int l = 0; l <= k + 1; ++l) {
upd(dp[now][j][l], dp[now ^ 1][0][l]);
}
}
}
void solve2() {
int t = (k + 1) / 2;
int now = 0;
dp[0][0][0] = 1;
for (int i = 1; i <= k; i += 2) { // 2 4 6 | 1 3 5
now ^= 1;
empty(now);
pushodd(now);
cut(now);
}
for (int i = k + 2; i <= n; i += 2) {
now ^= 1;
empty(now);
pushodd(now);
now ^= 1;
empty(now);
pusheven(now);
cut(now);
}
int cur = (n + 1) / 2 * 2 - 1 - k;
int cnt = (n - cur) / 2;
LL ans = 0;
for (int j = 0; j <= cnt; ++j) {
for (int l = 0; l <= k + 1 - j; ++l) {
int rem = cnt - j;
upd(ans, dp[now][j][l] * ksm(2, rem));
}
}
for (int l = 0; l <= k + 1 - cnt - 1; ++l) {
upd(ans, dp[now][cnt + 1][l]);
}
/*for(int i=cur+2;i<=n;i+=2){
now^=1;
empty(now);
pusheven(now);
cut(now);
}
for(int i=0;i<=k+1;++i){
upd(ans,dp[now][0][i]);
if(i<=k)upd(ans,dp[now][1][i]);
}*/
printf("%lld\n", ans);
}
int main() {
// open();
n = read();
k = read();
mod = read();
if (k % 2 == 0) {
solve1();
} else
solve2();
close();
return 0;
} | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <queue>
#include <vector>
#define LL long long
#define LD long double
using namespace std;
const int NN = 200;
const int MM = +117;
int read() {
int fl = 1, x;
char c;
for (c = getchar(); (c < '0' || c > '9') && c != '-'; c = getchar())
;
if (c == '-') {
fl = -1;
c = getchar();
}
for (x = 0; c >= '0' && c <= '9'; c = getchar())
x = (x << 3) + (x << 1) + c - '0';
return x * fl;
}
void open() {
freopen("a.in", "r", stdin);
// freopen("a.out","w",stdout);
}
void close() {
fclose(stdin);
fclose(stdout);
}
int k, n;
LL dp[NN][NN][NN] = {};
int mod;
LL ksm(LL a, LL b) {
LL ret = 1;
for (; b; b >>= 1, a = a * a % mod)
if (b & 1)
ret = ret * a % mod;
return ret;
}
void upd(LL &x, LL y) { x = (x + y) % mod; }
void solve1() {
dp[0][0][0] = 1;
int lim = k / 2;
for (int i = 1; i <= n; ++i) {
for (int a = 0; a <= lim; ++a) {
for (int b = 0; b <= lim; ++b) {
if (i & 1) {
upd(dp[i][a][0], dp[i - 1][a][b]);
upd(dp[i][a][b + 1], dp[i - 1][a][b]);
} else {
upd(dp[i][0][b], dp[i - 1][a][b]);
upd(dp[i][a + 1][b], dp[i - 1][a][b]);
}
}
}
}
LL ans = 0;
for (int a = 0; a <= lim; ++a) {
for (int b = 0; b <= lim; ++b) {
upd(ans, dp[n][a][b]);
}
}
printf("%lld\n", ans);
}
void empty(int now) {
for (int j = 0; j <= k + 2; ++j) {
for (int l = 0; l <= k + 2; ++l) {
dp[now][j][l] = 0;
}
}
}
void cut(int now) {
for (int j = 0; j <= k + 2; ++j) {
for (int l = k - j + 2; l <= k + 2; ++l) {
dp[now][j][l] = 0;
}
}
}
void pushodd(int now) {
for (int j = 0; j <= k + 1; ++j) {
for (int l = 0; l <= k + 1; ++l) {
upd(dp[now][j][0], dp[now ^ 1][j][l]);
upd(dp[now][j][l + 1], dp[now ^ 1][j][l]);
}
}
upd(dp[now][0][k + 1], dp[now ^ 1][0][k + 1]);
}
void pusheven(int now) {
for (int j = 1; j <= k + 2; ++j) {
for (int l = 0; l <= k + 2; ++l) {
upd(dp[now][j - 1][l], dp[now ^ 1][j][l]);
}
}
upd(dp[now][k + 1][0], dp[now ^ 1][k + 1][0]);
for (int j = 0; j <= k + 1; ++j) {
for (int l = 0; l <= k + 1; ++l) {
upd(dp[now][j][l], dp[now ^ 1][0][l]);
}
}
}
void solve2() {
int t = (k + 1) / 2;
int now = 0;
dp[0][0][0] = 1;
for (int i = 1; i <= k; i += 2) { // 2 4 6 | 1 3 5
now ^= 1;
empty(now);
pushodd(now);
cut(now);
}
for (int i = k + 2; i <= n; i += 2) {
now ^= 1;
empty(now);
pushodd(now);
now ^= 1;
empty(now);
pusheven(now);
cut(now);
}
int cur = (n + 1) / 2 * 2 - 1 - k;
int cnt = (n - cur) / 2;
LL ans = 0;
for (int j = 0; j <= cnt; ++j) {
for (int l = 0; l <= k + 1 - j; ++l) {
int rem = cnt - j;
upd(ans, dp[now][j][l] * ksm(2, rem));
}
}
for (int l = 0; l <= k + 1 - cnt - 1; ++l) {
upd(ans, dp[now][cnt + 1][l]);
}
/*for(int i=cur+2;i<=n;i+=2){
now^=1;
empty(now);
pusheven(now);
cut(now);
}
for(int i=0;i<=k+1;++i){
upd(ans,dp[now][0][i]);
if(i<=k)upd(ans,dp[now][1][i]);
}*/
printf("%lld\n", ans);
}
int main() {
// open();
n = read();
k = read();
mod = read();
if (k % 2 == 0) {
solve1();
} else
solve2();
close();
return 0;
} | [
"identifier.replace.add",
"literal.replace.remove",
"variable_declaration.array_dimensions.change"
] | 783,385 | 783,386 | u634654042 | cpp |
p02979 | #include <cstdio>
#include <iostream>
#define ll long long
using namespace std;
const int N = 360;
int mod;
inline void Add(int &x, int y) {
x += y;
if (x >= mod)
x -= mod;
}
int solve0(int n, int k) { // you can't choose k consecutive integers
static int f[N];
f[0] = 1;
for (int i = 1; i <= n + 1; ++i) {
f[i] = 0;
for (int j = i - 1; i - j - 1 < k && j >= 0; --j)
f[i] = (f[i] + f[j]) % mod;
}
return f[n + 1];
}
int solve1(int n, int k) { // k is odd, k!=1
static int f[N][N][N];
f[1][0][0] = 1;
f[1][1][0] = 1;
for (int i = 2; i * 2 - k <= n; ++i) {
int a = 2 * i, b = 2 * i - k;
for (int j = 0; j <= i - 1; ++j) // go down
for (int l = 0; l <= i - 1; ++l)
if (f[i - 1][j][l]) { // go down - left - down
// cout<<i-1<<' '<<j<<' '<<l<<':'<<f[i-1][j][l]<<endl;
if (b < 0) {
Add(f[i][0][0], f[i - 1][j][l]);
Add(f[i][j + 1][0], f[i - 1][j][l]);
} else if (a > n) {
Add(f[i][0][0], f[i - 1][j][l]);
if (l) {
if (l < k)
Add(f[i][0][l + 1], f[i - 1][j][l]);
} else
Add(f[i][0][0], f[i - 1][j][l]);
} else {
for (int s = 0; s < 4; ++s) {
int x = s & 1, y = s & 2;
int j1 = x ? j + 1 : 0;
int l1 = (y && l) ? l + 1 : 0;
if (x && y)
l1 = max(l1, j + 1);
if (l1 >= k + 1)
continue;
Add(f[i][j1][l1], f[i - 1][j][l]);
}
}
}
}
int ans = 0;
for (int j = 0; j <= (n + k) / 2; ++j)
for (int l = 0; l <= k; ++l)
if (f[(n + k) / 2][j][l])
ans =
(ans + f[(n + k) / 2][j][l]) %
mod; //,cout<<(n+k)/2<<' '<<j<<' '<<l<<':'<<f[(n+k)/2][j][l]<<endl;
return ans;
}
int main() {
int n, k;
scanf("%d%d%d", &n, &k, &mod);
if (k == 1) {
printf("%d\n", solve0(n, 3));
return 0;
}
if (k % 2 == 0) {
k /= 2;
printf("%d\n",
(int)(solve0(n / 2, k + 1) * 1ll * solve0((n + 1) / 2, k + 1)));
return 0;
}
printf("%d\n", solve1(n, k));
return 0;
} | #include <cstdio>
#include <iostream>
#define ll long long
using namespace std;
const int N = 360;
int mod;
inline void Add(int &x, int y) {
x += y;
if (x >= mod)
x -= mod;
}
int solve0(int n, int k) { // you can't choose k consecutive integers
static int f[N];
f[0] = 1;
for (int i = 1; i <= n + 1; ++i) {
f[i] = 0;
for (int j = i - 1; i - j - 1 < k && j >= 0; --j)
f[i] = (f[i] + f[j]) % mod;
}
return f[n + 1];
}
int solve1(int n, int k) { // k is odd, k!=1
static int f[N][N][N];
f[1][0][0] = 1;
f[1][1][0] = 1;
for (int i = 2; i * 2 - k <= n; ++i) {
int a = 2 * i, b = 2 * i - k;
for (int j = 0; j <= i - 1; ++j) // go down
for (int l = 0; l <= i - 1; ++l)
if (f[i - 1][j][l]) { // go down - left - down
// cout<<i-1<<' '<<j<<' '<<l<<':'<<f[i-1][j][l]<<endl;
if (b < 0) {
Add(f[i][0][0], f[i - 1][j][l]);
Add(f[i][j + 1][0], f[i - 1][j][l]);
} else if (a > n) {
Add(f[i][0][0], f[i - 1][j][l]);
if (l) {
if (l < k)
Add(f[i][0][l + 1], f[i - 1][j][l]);
} else
Add(f[i][0][0], f[i - 1][j][l]);
} else {
for (int s = 0; s < 4; ++s) {
int x = s & 1, y = s & 2;
int j1 = x ? j + 1 : 0;
int l1 = (y && l) ? l + 1 : 0;
if (x && y)
l1 = max(l1, j + 1);
if (l1 >= k + 1)
continue;
Add(f[i][j1][l1], f[i - 1][j][l]);
}
}
}
}
int ans = 0;
for (int j = 0; j <= (n + k) / 2; ++j)
for (int l = 0; l <= k; ++l)
if (f[(n + k) / 2][j][l])
ans =
(ans + f[(n + k) / 2][j][l]) %
mod; //,cout<<(n+k)/2<<' '<<j<<' '<<l<<':'<<f[(n+k)/2][j][l]<<endl;
return ans;
}
int main() {
int n, k;
scanf("%d%d%d", &n, &k, &mod);
if (k == 1) {
printf("%d\n", solve0(n, 3));
return 0;
}
if (k % 2 == 0) {
k /= 2;
printf("%d\n", (int)(solve0(n / 2, k + 1) * 1ll *
solve0((n + 1) / 2, k + 1) % mod));
return 0;
}
printf("%d\n", solve1(n, k));
return 0;
} | [
"expression.operation.binary.add"
] | 783,389 | 783,390 | u973935896 | cpp |
p02980 | #include <bits/stdc++.h>
using namespace std;
long long n, m;
long long inv[100010];
long long qpow(long long a, long long b) {
long long ans = 1, base = a;
while (b) {
if (b & 1) {
ans *= base;
ans %= 998244353;
}
base *= base;
base %= 998244353;
b >>= 1;
}
return ans;
}
long long cn[100010];
long long cm[100010];
long long ans;
long long jc[100010];
long long m_[100010];
long long n_[100010];
int main() {
cin >> n >> m;
inv[1] = 1;
for (long long i = 2; i <= max(n, m); i++) {
inv[i] =
(998244353ll - 998244353ll / i) * inv[998244353ll % i] % 998244353ll;
}
jc[0] = jc[1] = 1;
for (long long i = 2; i <= max(n, m); i++) {
jc[i] = jc[i - 1] * i % 998244353ll;
}
cn[0] = 1;
for (long long i = 0; i < n; i++) {
cn[i + 1] = cn[i] * (n - i) % 998244353ll * inv[i + 1] % 998244353ll;
}
cm[0] = 1;
for (long long i = 0; i < m; i++) {
cm[i + 1] = cm[i] * (m - i) % 998244353ll * inv[i + 1] % 998244353ll;
}
m_[0] = n_[0] = 1;
for (long long i = 1; i <= max(m, n); i++) {
m_[i] = m_[i - 1] * (m + 1) % 998244353ll;
n_[i] = n_[i - 1] * (n + 1) % 998244353ll;
}
for (long long i = 0; i <= min(n, m); i++) {
long long s = cn[i] * cm[i] % 998244353ll * jc[i] % 998244353ll *
m_[n - i] % 998244353ll * n_[m - i] % 998244353ll;
ans = i & 1 ? (ans - s) : (ans + s);
ans = (ans % 998244353ll + 998244353ll) % 998244353ll;
}
cout << ans;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
long long n, m;
long long inv[500010];
long long qpow(long long a, long long b) {
long long ans = 1, base = a;
while (b) {
if (b & 1) {
ans *= base;
ans %= 998244353;
}
base *= base;
base %= 998244353;
b >>= 1;
}
return ans;
}
long long cn[500010];
long long cm[500010];
long long ans;
long long jc[500010];
long long m_[500010];
long long n_[500010];
int main() {
cin >> n >> m;
inv[1] = 1;
for (long long i = 2; i <= max(n, m); i++) {
inv[i] =
(998244353ll - 998244353ll / i) * inv[998244353ll % i] % 998244353ll;
}
jc[0] = jc[1] = 1;
for (long long i = 2; i <= max(n, m); i++) {
jc[i] = jc[i - 1] * i % 998244353ll;
}
cn[0] = 1;
for (long long i = 0; i < n; i++) {
cn[i + 1] = cn[i] * (n - i) % 998244353ll * inv[i + 1] % 998244353ll;
}
cm[0] = 1;
for (long long i = 0; i < m; i++) {
cm[i + 1] = cm[i] * (m - i) % 998244353ll * inv[i + 1] % 998244353ll;
}
m_[0] = n_[0] = 1;
for (long long i = 1; i <= max(m, n); i++) {
m_[i] = m_[i - 1] * (m + 1) % 998244353ll;
n_[i] = n_[i - 1] * (n + 1) % 998244353ll;
}
for (long long i = 0; i <= min(n, m); i++) {
long long s = cn[i] * cm[i] % 998244353ll * jc[i] % 998244353ll *
m_[n - i] % 998244353ll * n_[m - i] % 998244353ll;
ans = i & 1 ? (ans - s) : (ans + s);
ans = (ans % 998244353ll + 998244353ll) % 998244353ll;
}
cout << ans;
return 0;
} | [
"literal.number.change",
"variable_declaration.array_dimensions.change"
] | 783,393 | 783,394 | u727749587 | cpp |
p02980 | #include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
#define MAXN 500006
#define P 998244353
int n, m;
int Pow(int x, int a) {
int ret = 1;
while (a) {
if (a & 1)
ret = 1ll * ret * x % P;
x = 1ll * x * x % P, a >>= 1;
}
return ret;
}
int J[MAXN], iJ[MAXN];
int C(int a, int b) { return J[a] * 1ll * iJ[b] % P * iJ[a] % P; }
int main() {
J[0] = iJ[0] = 1;
for (int i = 1; i < MAXN; ++i)
J[i] = J[i - 1] * 1ll * i % P, iJ[i] = Pow(J[i], P - 2);
cin >> n >> m;
int lim = min(n, m);
int c = 0, res = 0;
for (int i = 0, zjk; i <= lim; ++i) {
zjk = C(n, i) * 1ll * C(m, i) % P * J[i] % P * Pow(n + 1, m - i) % P *
Pow(m + 1, n - i) % P;
if (c)
zjk = P - zjk;
c ^= 1;
res = (res + zjk) % P;
}
cout << res << endl;
} | #include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
#define MAXN 500006
#define P 998244353
int n, m;
int Pow(int x, int a) {
int ret = 1;
while (a) {
if (a & 1)
ret = 1ll * ret * x % P;
x = 1ll * x * x % P, a >>= 1;
}
return ret;
}
int J[MAXN], iJ[MAXN];
int C(int a, int b) { return J[a] * 1ll * iJ[b] % P * iJ[a - b] % P; }
int main() {
J[0] = iJ[0] = 1;
for (int i = 1; i < MAXN; ++i)
J[i] = J[i - 1] * 1ll * i % P, iJ[i] = Pow(J[i], P - 2);
cin >> n >> m;
int lim = min(n, m);
int c = 0, res = 0;
for (int i = 0, zjk; i <= lim; ++i) {
zjk = C(n, i) * 1ll * C(m, i) % P * J[i] % P * Pow(n + 1, m - i) % P *
Pow(m + 1, n - i) % P;
if (c)
zjk = P - zjk;
c ^= 1;
res = (res + zjk) % P;
}
cout << res << endl;
} | [
"expression.operation.binary.add"
] | 783,397 | 783,398 | u390140944 | cpp |
p02980 | #include <bits/stdc++.h>
#define int long long
const int mo = 998244353, N = 1e5 + 5;
int ksm(int a, int b) {
int ans = 1;
while (b) {
if (b & 1)
ans = ans * a % mo;
a = a * a % mo;
b >>= 1;
}
return ans;
}
int fac[N], inv[N], f[N];
int C(int a, int b) { return fac[a] * inv[b] % mo * inv[a - b] % mo; }
signed main() {
int n, m, ans = 0;
scanf("%lld%lld", &n, &m);
fac[0] = 1;
for (int i = 1; i < N; ++i)
fac[i] = (fac[i - 1] * i) % mo;
inv[N - 1] = ksm(fac[N - 1], mo - 2);
for (int i = N - 2; i >= 0; i--)
inv[i] = (inv[i + 1] * (i + 1)) % mo;
if (n > m)
std::swap(n, m);
for (int i = 0; i <= n; ++i)
f[i] = C(n, i) * C(m, i) % mo * fac[i] % mo * ksm(n + 1, m - i) % mo *
ksm(m + 1, n - i) % mo;
for (int i = 0; i <= n; ++i)
ans = ((ans + (1 - ((i & 1) << 1)) * f[i]) % mo + mo) % mo;
printf("%lld\n", ans);
} | #include <bits/stdc++.h>
#define int long long
const int mo = 998244353, N = 1e6 + 5;
int ksm(int a, int b) {
int ans = 1;
while (b) {
if (b & 1)
ans = ans * a % mo;
a = a * a % mo;
b >>= 1;
}
return ans;
}
int fac[N], inv[N], f[N];
int C(int a, int b) { return fac[a] * inv[b] % mo * inv[a - b] % mo; }
signed main() {
int n, m, ans = 0;
scanf("%lld%lld", &n, &m);
fac[0] = 1;
for (int i = 1; i < N; ++i)
fac[i] = (fac[i - 1] * i) % mo;
inv[N - 1] = ksm(fac[N - 1], mo - 2);
for (int i = N - 2; i >= 0; i--)
inv[i] = (inv[i + 1] * (i + 1)) % mo;
if (n > m)
std::swap(n, m);
for (int i = 0; i <= n; ++i)
f[i] = C(n, i) * C(m, i) % mo * fac[i] % mo * ksm(n + 1, m - i) % mo *
ksm(m + 1, n - i) % mo;
for (int i = 0; i <= n; ++i)
ans = ((ans + (1 - ((i & 1) << 1)) * f[i]) % mo + mo) % mo;
printf("%lld\n", ans);
} | [
"literal.number.change",
"expression.operation.binary.change"
] | 783,401 | 783,402 | u658406065 | cpp |
p02977 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<pair<int, int>> a(5);
for (int i = 0; i < 2; i++) {
a.at(i) = make_pair(i + 1, i + 2);
a.at(i + 3) = make_pair(i + N + 1, i + N + 2);
}
a.at(2) = make_pair(3, 1 + N);
if (N < 3) {
cout << "No" << endl;
} else if (N % 2 != 0) {
cout << "Yes" << endl;
for (int i = 4; i < N; i += 2) {
a.push_back(make_pair(i, i + 1));
a.push_back(make_pair(i + N, i + 1 + N));
a.push_back(make_pair(i + 1, 1 + N));
a.push_back(make_pair(i + N, 1 + N));
}
for (int i = 0; i < a.size(); i++) {
cout << a.at(i).first << " " << a.at(i).second << endl;
}
} else {
int c = N;
while (true) {
if (c % 2 != 0)
break;
else {
c /= 2;
if (c == 0) {
cout << "No" << endl;
return 0;
}
}
}
cout << "Yes" << endl;
for (int i = 4; i <= N - 1; i += 2) {
a.push_back(make_pair(i, i + 1));
a.push_back(make_pair(i + N, i + 1 + N));
a.push_back(make_pair(i, 1 + N));
a.push_back(make_pair(i + N + 1, 1 + N));
}
bool b = false;
for (int i = 2; i < N; i++) {
for (int j = i + 1; j < N; j++) {
int m, l, k;
m = i;
l = j;
k = N;
int n = 1;
while (true) {
if ((n % 2 + m % 2 + l % 2 + k % 2) % 2 != 0)
break;
else {
n /= 2;
m /= 2;
l /= 2;
k /= 2;
}
if (m == 0) {
if (i == 2)
i += N;
else if (i % 2 != 0 && i != 3)
i += N;
if (j % 2 != 0 && j != 3)
j += N;
a.push_back(make_pair(N, i));
a.push_back(make_pair(2 * N, j));
b = true;
break;
}
}
if (b)
break;
}
if (b)
break;
}
for (int i = 0; i < a.size(); i++) {
cout << a.at(i).first << " " << a.at(i).second << endl;
}
}
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<pair<int, int>> a(5);
for (int i = 0; i < 2; i++) {
a.at(i) = make_pair(i + 1, i + 2);
a.at(i + 3) = make_pair(i + N + 1, i + N + 2);
}
a.at(2) = make_pair(3, 1 + N);
if (N < 3) {
cout << "No" << endl;
} else if (N % 2 != 0) {
cout << "Yes" << endl;
for (int i = 4; i < N; i += 2) {
a.push_back(make_pair(i, i + 1));
a.push_back(make_pair(i + N, i + 1 + N));
a.push_back(make_pair(i + 1, 1 + N));
a.push_back(make_pair(i + N, 1 + N));
}
for (int i = 0; i < a.size(); i++) {
cout << a.at(i).first << " " << a.at(i).second << endl;
}
} else {
int c = N;
while (true) {
if (c % 2 != 0)
break;
else {
c /= 2;
if (c == 1) {
cout << "No" << endl;
return 0;
}
}
}
cout << "Yes" << endl;
for (int i = 4; i <= N - 1; i += 2) {
a.push_back(make_pair(i, i + 1));
a.push_back(make_pair(i + N, i + 1 + N));
a.push_back(make_pair(i, 1 + N));
a.push_back(make_pair(i + N + 1, 1 + N));
}
bool b = false;
for (int i = 2; i < N; i++) {
for (int j = i + 1; j < N; j++) {
int m, l, k;
m = i;
l = j;
k = N;
//最大値は言わずもがなk
int n = 1;
while (true) {
if ((n % 2 + m % 2 + l % 2 + k % 2) % 2 != 0)
break;
else {
n /= 2;
m /= 2;
l /= 2;
k /= 2;
}
if (k == 0) {
if (i == 2)
i += N;
else if (i % 2 != 0 && i != 3)
i += N;
if (j % 2 != 0 && j != 3)
j += N;
a.push_back(make_pair(N, i));
a.push_back(make_pair(2 * N, j));
b = true;
break;
}
}
if (b)
break;
}
if (b)
break;
}
for (int i = 0; i < a.size(); i++) {
cout << a.at(i).first << " " << a.at(i).second << endl;
}
}
}
| [
"literal.number.change",
"control_flow.branch.if.condition.change",
"identifier.change"
] | 783,451 | 783,450 | u222866518 | cpp |
p02977 | #include <algorithm>
#include <cstdio>
#include <set>
using namespace std;
typedef long long ll;
int n, m, k;
int main() {
scanf("%d", &n);
if (n & (n - 1) == 0) {
printf("No\n");
return 0;
}
printf("Yes\n");
printf("%d %d\n%d %d\n%d %d\n%d %d\n%d %d\n", n + 1, n + 2, n + 2, n + 3,
n + 3, 1, 1, 2, 2, 3);
for (int i = 4; i < n; i += 2) {
printf("%d %d\n", 1, i);
printf("%d %d\n", i, i + 1);
printf("%d %d\n", 1, n + i + 1);
printf("%d %d\n", n + i + 1, n + i);
}
if (n % 2 == 0) {
m = n ^ 1;
k = 0;
while ((m >> k) != 1)
k++;
k = 1 << k;
m ^= k;
printf("%d %d\n%d %d\n", k, n, n + m, n + n);
}
} | #include <algorithm>
#include <cstdio>
#include <set>
using namespace std;
typedef long long ll;
int n, m, k;
int main() {
scanf("%d", &n);
if ((n & (n - 1)) == 0) {
printf("No\n");
return 0;
}
printf("Yes\n");
printf("%d %d\n%d %d\n%d %d\n%d %d\n%d %d\n", n + 1, n + 2, n + 2, n + 3,
n + 3, 1, 1, 2, 2, 3);
for (int i = 4; i < n; i += 2) {
printf("%d %d\n", 1, i);
printf("%d %d\n", i, i + 1);
printf("%d %d\n", 1, n + i + 1);
printf("%d %d\n", n + i + 1, n + i);
}
if (n % 2 == 0) {
m = n ^ 1;
k = 0;
while ((m >> k) != 1)
k++;
k = 1 << k;
m ^= k;
printf("%d %d\n%d %d\n", k, n, n + m, n + n);
}
} | [
"control_flow.branch.if.condition.change"
] | 783,498 | 783,499 | u325423411 | cpp |
p02977 | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define ub upper_bound
#define lb upper_bound
#define mp make_pair
#define F first
#define S second
#define FOR(i, a, b) for (int(i) = (a); (i) < (b); (i)++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(), (c).end())
#define ve vector
#define vi vector<int>
#define vp vector<pair<int, int>>
#define vvi vector<vector<int>>
using ll = long long;
const ll INF = LLONG_MAX - 100;
ll mod = 1e9 + 7;
int dx[] = {-1, 0, 1, 0}, dy[] = {0, 1, 0, -1};
vector<ll> prime;
class fact {
public:
int fmod = 1e9 + 7;
vector<int> fac, inv;
fact(int n, int Mod = 1e9 + 7) {
fmod = Mod;
fac = vector<int>(n, 0);
inv = vector<int>(n, 0);
fac[0] = 1;
for (int i = 1; i < n; i++)
fac[i] = fac[i - 1] * i % fmod;
for (int i = 0; i < n; i++)
inv[i] = fact::POW(fac[i], fmod - 2);
}
ll nCr(ll n, ll r) { return (fac[n] * inv[r] % fmod) * inv[n - r] % fmod; }
ll POW(ll a, ll b) {
ll c = 1;
while (b > 0) {
if (b & 1) {
c = a * c % fmod;
}
a = a * a % fmod;
b >>= 1;
}
return c;
}
};
template <class T = ll> T in() {
T x;
cin >> x;
return (x);
}
void DEBUG(vector<int> a) {
for (int i = 0; i < a.size(); i++)
cout << a[i] << " ";
cout << endl;
}
void EMP(int x) { cout << "!!!" << x << "!!!" << endl; }
ll GCD(ll a, ll b) {
ll c;
while (b != 0) {
c = a % b;
a = b;
b = c;
}
return a;
}
ll LCM(ll a, ll b) { return a * b / GCD(a, b); }
ll POW(ll a, ll b) {
ll c = 1;
while (b > 0) {
if (b & 1) {
c = a * c % mod;
}
a = a * a % mod;
b >>= 1;
}
return c;
}
void PRI(ll n) {
bool a[n + 1LL];
for (int i = 0; i < n + 1LL; i++) {
a[i] = 1LL;
}
for (int i = 2; i < n + 1LL; i++) {
if (a[i]) {
prime.pb(i);
ll b = i;
while (b <= n) {
a[b] = 0;
b += i;
}
}
}
}
template <typename T> T chmin(T &a, T b) {
if (a > b)
a = b;
return a;
}
template <typename T> T chmax(T &a, T b) {
if (a < b)
a = b;
return b;
}
bool isSqrt(ll a) { return pow(sqrt(a), 2) == a ? 1 : 0; }
void YesNo(bool a) {
if (a)
cout << "Yes";
else
cout << "No";
cout << endl;
}
void yesno(bool a) {
if (a)
cout << "yes";
else
cout << "no";
cout << endl;
}
void YESNO(bool a) {
if (a)
cout << "YES";
else
cout << "NO";
cout << endl;
}
vector<pair<int, int>> ans;
void add(int a, int b) { ans.pb({a, b}); }
bool solve() {
int n;
cin >> n;
int tm = 1;
if (n == 1) {
cout << "No" << endl;
return 0;
}
for (; tm <= n; tm *= 2) {
if (tm == n) {
cout << -1 << endl;
return 0;
}
}
tm /= 2;
add(n + 1, n + 2);
for (int i = 2; i < n; i += 2) {
add(1, i);
add(1, i + 1);
add(i, i + n + 1);
add(i + 1, i + n);
}
if (n % 2 == 0) {
add(n, tm);
add(tm ^ (n + 1), 2 * n);
}
cout << "Yes" << endl;
for (auto &&a : ans) {
cout << a.first << " " << a.second << endl;
}
}
signed main() {
cin.tie(0);
ios::sync_with_stdio(false);
solve();
}
| #include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define ub upper_bound
#define lb upper_bound
#define mp make_pair
#define F first
#define S second
#define FOR(i, a, b) for (int(i) = (a); (i) < (b); (i)++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(), (c).end())
#define ve vector
#define vi vector<int>
#define vp vector<pair<int, int>>
#define vvi vector<vector<int>>
using ll = long long;
const ll INF = LLONG_MAX - 100;
ll mod = 1e9 + 7;
int dx[] = {-1, 0, 1, 0}, dy[] = {0, 1, 0, -1};
vector<ll> prime;
class fact {
public:
int fmod = 1e9 + 7;
vector<int> fac, inv;
fact(int n, int Mod = 1e9 + 7) {
fmod = Mod;
fac = vector<int>(n, 0);
inv = vector<int>(n, 0);
fac[0] = 1;
for (int i = 1; i < n; i++)
fac[i] = fac[i - 1] * i % fmod;
for (int i = 0; i < n; i++)
inv[i] = fact::POW(fac[i], fmod - 2);
}
ll nCr(ll n, ll r) { return (fac[n] * inv[r] % fmod) * inv[n - r] % fmod; }
ll POW(ll a, ll b) {
ll c = 1;
while (b > 0) {
if (b & 1) {
c = a * c % fmod;
}
a = a * a % fmod;
b >>= 1;
}
return c;
}
};
template <class T = ll> T in() {
T x;
cin >> x;
return (x);
}
void DEBUG(vector<int> a) {
for (int i = 0; i < a.size(); i++)
cout << a[i] << " ";
cout << endl;
}
void EMP(int x) { cout << "!!!" << x << "!!!" << endl; }
ll GCD(ll a, ll b) {
ll c;
while (b != 0) {
c = a % b;
a = b;
b = c;
}
return a;
}
ll LCM(ll a, ll b) { return a * b / GCD(a, b); }
ll POW(ll a, ll b) {
ll c = 1;
while (b > 0) {
if (b & 1) {
c = a * c % mod;
}
a = a * a % mod;
b >>= 1;
}
return c;
}
void PRI(ll n) {
bool a[n + 1LL];
for (int i = 0; i < n + 1LL; i++) {
a[i] = 1LL;
}
for (int i = 2; i < n + 1LL; i++) {
if (a[i]) {
prime.pb(i);
ll b = i;
while (b <= n) {
a[b] = 0;
b += i;
}
}
}
}
template <typename T> T chmin(T &a, T b) {
if (a > b)
a = b;
return a;
}
template <typename T> T chmax(T &a, T b) {
if (a < b)
a = b;
return b;
}
bool isSqrt(ll a) { return pow(sqrt(a), 2) == a ? 1 : 0; }
void YesNo(bool a) {
if (a)
cout << "Yes";
else
cout << "No";
cout << endl;
}
void yesno(bool a) {
if (a)
cout << "yes";
else
cout << "no";
cout << endl;
}
void YESNO(bool a) {
if (a)
cout << "YES";
else
cout << "NO";
cout << endl;
}
vector<pair<int, int>> ans;
void add(int a, int b) { ans.pb({a, b}); }
bool solve() {
int n;
cin >> n;
int tm = 1;
if (n == 1) {
cout << "No" << endl;
return 0;
}
for (; tm <= n; tm *= 2) {
if (tm == n) {
cout << "No" << endl;
return 0;
}
}
tm /= 2;
add(n + 1, n + 2);
for (int i = 2; i < n; i += 2) {
add(1, i);
add(1, i + 1);
add(i, i + n + 1);
add(i + 1, i + n);
}
if (n % 2 == 0) {
add(n, tm);
add(tm ^ (n + 1), 2 * n);
}
cout << "Yes" << endl;
for (auto &&a : ans) {
cout << a.first << " " << a.second << endl;
}
}
signed main() {
cin.tie(0);
ios::sync_with_stdio(false);
solve();
}
| [] | 783,529 | 783,530 | u764234894 | cpp |
p02977 | #include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdio>
#include <deque>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define FORR(i, a, b) for (int i = a; i >= b; --i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<double> VD;
typedef vector<VD> VVD;
template <typename T> void chmin(T &a, T b) {
if (a > b)
a = b;
}
template <typename T> void chmax(T &a, T b) {
if (a < b)
a = b;
}
int in() {
int x;
scanf("%d", &x);
return x;
}
ll lin() {
ll x;
scanf("%lld", &x);
return x;
}
int main() {
int n;
cin >> n;
int b = 1;
while (2 * b <= n)
b *= 2;
if (n < 3 || b == n) {
cout << "NO" << endl;
return 0;
}
int m = n;
while (m % 4 != 3)
m--;
vector<P> ans;
FOR(x, 1, m - 1) ans.emplace_back(x, x + 1);
ans.emplace_back(m, n + 1);
FOR(x, 1, m - 1) ans.emplace_back(x + n, x + n + 1);
if (n % 4 == 1) {
ans.emplace_back(n - 1, n);
ans.emplace_back(n, 1);
ans.emplace_back(1, n + (n - 1));
ans.emplace_back(n + (n - 1), n + n);
} else if (n % 4 == 2) {
ans.emplace_back(n - 2, n - 1);
ans.emplace_back(n - 1, 1);
ans.emplace_back(1, n + (n - 2));
ans.emplace_back(n + (n - 2), n + n - 1);
ans.emplace_back(n, n - 1);
ans.emplace_back(2, 2 * n);
} else if (n % 4 == 0) {
int x = n - b + 1;
ans.emplace_back(x, n);
ans.emplace_back(b, 2 * n);
}
cout << "YES" << endl;
for (P p : ans)
printf("%d %d\n", p.first, p.second);
return 0;
}
| #include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdio>
#include <deque>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define FORR(i, a, b) for (int i = a; i >= b; --i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<double> VD;
typedef vector<VD> VVD;
template <typename T> void chmin(T &a, T b) {
if (a > b)
a = b;
}
template <typename T> void chmax(T &a, T b) {
if (a < b)
a = b;
}
int in() {
int x;
scanf("%d", &x);
return x;
}
ll lin() {
ll x;
scanf("%lld", &x);
return x;
}
int main() {
int n;
cin >> n;
int b = 1;
while (2 * b <= n)
b *= 2;
if (n < 3 || b == n) {
cout << "No" << endl;
return 0;
}
int m = n;
while (m % 4 != 3)
m--;
vector<P> ans;
FOR(x, 1, m - 1) ans.emplace_back(x, x + 1);
ans.emplace_back(m, n + 1);
FOR(x, 1, m - 1) ans.emplace_back(x + n, x + n + 1);
if (n % 4 == 1) {
ans.emplace_back(n - 1, n);
ans.emplace_back(n, 1);
ans.emplace_back(1, n + (n - 1));
ans.emplace_back(n + (n - 1), n + n);
} else if (n % 4 == 2) {
ans.emplace_back(n - 2, n - 1);
ans.emplace_back(n - 1, 1);
ans.emplace_back(1, n + (n - 2));
ans.emplace_back(n + (n - 2), n + n - 1);
ans.emplace_back(n, n - 1);
ans.emplace_back(2, 2 * n);
} else if (n % 4 == 0) {
int x = n - b + 1;
ans.emplace_back(x, n);
ans.emplace_back(b, 2 * n);
}
cout << "Yes" << endl;
for (P p : ans)
printf("%d %d\n", p.first, p.second);
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 783,637 | 783,638 | u016572066 | cpp |
p02981 | #include <algorithm>
#include <array>
#include <assert.h>
#include <bitset>
#include <chrono>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
template <typename T, typename V> void __print(const pair<T, V> &x) {
cerr << '{';
__print(x.first);
cerr << ',';
__print(x.second);
cerr << '}';
}
template <typename T> void __print(const T &x) {
int f = 0;
cerr << '{';
for (auto &i : x)
cerr << (f++ ? "," : ""), __print(i);
cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V> void _print(T t, V... v) {
__print(t);
if (sizeof...(v))
cerr << ", ";
_print(v...);
}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) \
cerr << "[" << #x << "] = ["; \
_print(x)
#else
#define maxn 2000006
#define gcd __gcd
#define debug(x...)
#endif
#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define PI 3.14159265358979323846264338327950L
#define f(i, x, n) for (int i = x; i <= n; i++)
#define fr(i, x, n) for (int i = x; i >= n; i--)
struct _ {
ios_base::Init i;
_() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); }
} _;
int dx[] = {-1, 0, 1, 0, -1, -1, 1, 1};
int dy[] = {0, 1, 0, -1, -1, 1, 1, -1};
int main() {
int n, a, b;
cin >> n >> a >> b;
cout << n * min(a, b);
return 0;
} | #include <algorithm>
#include <array>
#include <assert.h>
#include <bitset>
#include <chrono>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
template <typename T, typename V> void __print(const pair<T, V> &x) {
cerr << '{';
__print(x.first);
cerr << ',';
__print(x.second);
cerr << '}';
}
template <typename T> void __print(const T &x) {
int f = 0;
cerr << '{';
for (auto &i : x)
cerr << (f++ ? "," : ""), __print(i);
cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V> void _print(T t, V... v) {
__print(t);
if (sizeof...(v))
cerr << ", ";
_print(v...);
}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) \
cerr << "[" << #x << "] = ["; \
_print(x)
#else
#define maxn 2000006
#define gcd __gcd
#define debug(x...)
#endif
#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define PI 3.14159265358979323846264338327950L
#define f(i, x, n) for (int i = x; i <= n; i++)
#define fr(i, x, n) for (int i = x; i >= n; i--)
struct _ {
ios_base::Init i;
_() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); }
} _;
int dx[] = {-1, 0, 1, 0, -1, -1, 1, 1};
int dy[] = {0, 1, 0, -1, -1, 1, 1, -1};
int main() {
int n, a, b;
cin >> n >> a >> b;
cout << min(n * a, b);
return 0;
} | [
"expression.operation.binary.remove"
] | 783,641 | 783,642 | u118868154 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int N, a, b;
cin >> N >> a >> b;
cout << min(N * a, N * b) << endl;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int N, a, b;
cin >> N >> a >> b;
cout << min(N * a, b) << endl;
} | [
"expression.operation.binary.remove"
] | 783,645 | 783,646 | u401152875 | cpp |
p02981 | #include <iostream>
using namespace std;
int main() {
int n, a, b;
cin >> n >> a >> b;
if (n * a <= n * b) {
cout << n * a;
} else {
cout << n * b;
}
return 0;
}
| #include <iostream>
using namespace std;
int main() {
int n, a, b;
cin >> n >> a >> b;
if (n * a <= b) {
cout << n * a;
} else {
cout << b;
}
return 0;
}
| [
"expression.operation.binary.remove"
] | 783,647 | 783,648 | u746613804 | cpp |
p02981 | #include <iostream>
using namespace std;
int main() {
int n, a, b;
cin >> n >> a >> b;
if (n * a >= n * b) {
cout << n * a;
} else {
cout << n * b;
}
return 0;
}
| #include <iostream>
using namespace std;
int main() {
int n, a, b;
cin >> n >> a >> b;
if (n * a <= b) {
cout << n * a;
} else {
cout << b;
}
return 0;
}
| [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"expression.operation.binary.remove"
] | 783,649 | 783,648 | u746613804 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(v) v.begin(), v.end()
int main() {
ll N, A, B;
cin >> N >> A >> B;
if (N * A > B) {
cout << N * A << endl;
} else {
cout << B << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(v) v.begin(), v.end()
int main() {
ll N, A, B;
cin >> N >> A >> B;
if (N * A < B) {
cout << N * A << endl;
} else {
cout << B << endl;
}
}
| [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 783,652 | 783,653 | u072293789 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
#define LL long long
int main() {
ios::sync_with_stdio(0), cin.tie(0);
int n, a, b;
cin >> n >> a >> b;
cout << n * min(a, b);
} | #include <bits/stdc++.h>
using namespace std;
#define LL long long
int main() {
ios::sync_with_stdio(0), cin.tie(0);
int n, a, b;
cin >> n >> a >> b;
cout << min(n * a, b);
} | [
"expression.operation.binary.remove"
] | 783,654 | 783,655 | u280859559 | cpp |
p02981 | #include <algorithm>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep1(i, n) for (ll i = 1; i < n; ++i)
#define mrep(i, n) for (ll i = n; i >= 0; --i)
#define all(a) (a).begin(), (a).end()
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define pl pair<ll, ll>
#define inf 1001001001001001000
//#define mod 1000000007
#define mod 998244353
#define pi 3.1415926535
using namespace std;
struct __INIT {
__INIT() {
cin.tie(0);
ios::sync_with_stdio(false);
cout << fixed << setprecision(15);
}
} __init;
int main(void) {
ll n, a, b;
cin >> n >> a >> b;
cout << (n * min(a, b)) << endl;
return 0;
}
| #include <algorithm>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep1(i, n) for (ll i = 1; i < n; ++i)
#define mrep(i, n) for (ll i = n; i >= 0; --i)
#define all(a) (a).begin(), (a).end()
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define pl pair<ll, ll>
#define inf 1001001001001001000
//#define mod 1000000007
#define mod 998244353
#define pi 3.1415926535
using namespace std;
struct __INIT {
__INIT() {
cin.tie(0);
ios::sync_with_stdio(false);
cout << fixed << setprecision(15);
}
} __init;
int main(void) {
ll n, a, b;
cin >> n >> a >> b;
cout << (min(n * a, b)) << endl;
return 0;
}
| [
"expression.operation.binary.remove"
] | 783,658 | 783,659 | u386131832 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n, a, b;
cin >> n >> a >> b;
cout << n * a + b << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n, a, b;
cin >> n >> a >> b;
cout << min(n * a, b) << endl;
return 0;
} | [
"call.add",
"io.output.change",
"call.arguments.change"
] | 783,660 | 783,661 | u221391729 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B, N;
cin >> A >> B >> N;
if (N * A > B) {
cout << B;
} else {
cout << N * A;
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B, N;
cin >> N >> A >> B;
if (N * A > B) {
cout << B;
} else {
cout << N * A;
}
return 0;
}
| [
"expression.operation.binary.remove"
] | 783,668 | 783,669 | u523119383 | cpp |
p02981 | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main() {
int n, x, y;
cin >> n >> x >> y;
cout << min({n * x, n * y}) << endl;
}
| #include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main() {
int n, x, y;
cin >> n >> x >> y;
cout << min({n * x, y}) << endl;
}
| [
"expression.operation.binary.remove"
] | 783,670 | 783,671 | u499138699 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree<int, null_type,less<int>,
// rb_tree_tag,tree_order_statistics_node_update>
#define FS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define ll long long int
#define ld long double
#define pb push_back
#define bp __builtin_popcount
#define sz size()
#define ff first
#define ss second
#define vll vector<ll>
#define vbool vector<bool>
#define vpll vector<pair<ll, ll>>
#define pll pair<ll, ll>
#define vllv vector<vector<ll>>
#define setpri(x) cout << setprecision(x) << fixed;
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define yesr \
{ \
cout << "YES" << endl; \
return; \
}
#define nor \
{ \
cout << "NO" << endl; \
return; \
}
// getline (std::cin,name);
ll MOD = 1e9 + 7;
ll ceil1(ll n, ll x) { return (n - 1) / x + (n > 0); }
ll gcd(ll a, ll b) { return __gcd(a, b); }
ll lcm(ll a, ll b) { return (max(a, b) / gcd(a, b)) * min(a, b); }
ll pow1(ll n, ll m, ll mod = MOD);
ll pow2(ll n, ll k);
ll modinv(ll n, ll mod = MOD) { return pow1(n, mod - 2, mod); }
bool func(pair<ll, ll> &a, pair<ll, ll> &b) {
if (a.ff != b.ff)
return a.ff < b.ff;
return a.ss > b.ss;
}
ll const N = (ll)3e2 + 11;
ll const LG = (ll)log2(N) + 1;
void solve() {
ll i, j, k, l, n, m, x, y, z, r;
ll a, b;
cin >> n >> a >> b;
cout << n * min(a, b) << endl;
}
int main() {
FS;
ll i, j, k, n, m, x, y, z, q;
q = 1;
// cin>>q;
while (q--) {
solve();
}
return 0;
}
ll pow1(ll n, ll m, ll mod) {
if (m == 0)
return 1;
if (m % 2 == 0)
return pow1((n * n) % mod, m / 2, mod);
return (pow1((n * n) % mod, m / 2, mod) * n) % mod;
}
ll pow2(ll n, ll k) {
ll ans = 1;
while (k > 0) {
if (k % 2 == 1)
ans = ans * n;
n = n * n;
k /= 2;
}
return ans;
} | #include <bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree<int, null_type,less<int>,
// rb_tree_tag,tree_order_statistics_node_update>
#define FS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define ll long long int
#define ld long double
#define pb push_back
#define bp __builtin_popcount
#define sz size()
#define ff first
#define ss second
#define vll vector<ll>
#define vbool vector<bool>
#define vpll vector<pair<ll, ll>>
#define pll pair<ll, ll>
#define vllv vector<vector<ll>>
#define setpri(x) cout << setprecision(x) << fixed;
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define yesr \
{ \
cout << "YES" << endl; \
return; \
}
#define nor \
{ \
cout << "NO" << endl; \
return; \
}
// getline (std::cin,name);
ll MOD = 1e9 + 7;
ll ceil1(ll n, ll x) { return (n - 1) / x + (n > 0); }
ll gcd(ll a, ll b) { return __gcd(a, b); }
ll lcm(ll a, ll b) { return (max(a, b) / gcd(a, b)) * min(a, b); }
ll pow1(ll n, ll m, ll mod = MOD);
ll pow2(ll n, ll k);
ll modinv(ll n, ll mod = MOD) { return pow1(n, mod - 2, mod); }
bool func(pair<ll, ll> &a, pair<ll, ll> &b) {
if (a.ff != b.ff)
return a.ff < b.ff;
return a.ss > b.ss;
}
ll const N = (ll)3e2 + 11;
ll const LG = (ll)log2(N) + 1;
void solve() {
ll i, j, k, l, n, m, x, y, z, r;
ll a, b;
cin >> n >> a >> b;
cout << min(n * a, b) << endl;
}
int main() {
FS;
ll i, j, k, n, m, x, y, z, q;
q = 1;
// cin>>q;
while (q--) {
solve();
}
return 0;
}
ll pow1(ll n, ll m, ll mod) {
if (m == 0)
return 1;
if (m % 2 == 0)
return pow1((n * n) % mod, m / 2, mod);
return (pow1((n * n) % mod, m / 2, mod) * n) % mod;
}
ll pow2(ll n, ll k) {
ll ans = 1;
while (k > 0) {
if (k % 2 == 1)
ans = ans * n;
n = n * n;
k /= 2;
}
return ans;
} | [
"expression.operation.binary.remove"
] | 783,672 | 783,673 | u293991054 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define endl "\n"
#define F(i, n) for (ll i = 0; i < n; i++)
#define rep(i, a, b) for (ll i = a; i < b; i++)
#define repp(i, a, b) for (ll i = a; i >= b; i--)
#define fast \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define pb push_back
#define mp make_pair
#define vll vector<ll>
#define f first
#define s second
#define ALL(v) v.begin(), v.end()
void solve() {
ll n, a, b;
cin >> n >> a >> b;
if (n * a < b)
cout << b;
else
cout << n * a;
}
signed main() {
fast;
solve();
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define endl "\n"
#define F(i, n) for (ll i = 0; i < n; i++)
#define rep(i, a, b) for (ll i = a; i < b; i++)
#define repp(i, a, b) for (ll i = a; i >= b; i--)
#define fast \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define pb push_back
#define mp make_pair
#define vll vector<ll>
#define f first
#define s second
#define ALL(v) v.begin(), v.end()
void solve() {
ll n, a, b;
cin >> n >> a >> b;
if (n * a > b)
cout << b;
else
cout << n * a;
}
signed main() {
fast;
solve();
return 0;
}
| [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 783,674 | 783,675 | u603991349 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define endl "\n"
#define F(i, n) for (ll i = 0; i < n; i++)
#define rep(i, a, b) for (ll i = a; i < b; i++)
#define repp(i, a, b) for (ll i = a; i >= b; i--)
#define fast \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define pb push_back
#define mp make_pair
#define vll vector<ll>
#define f first
#define s second
#define ALL(v) v.begin(), v.end()
void solve() {
ll n, a, b;
cin >> n >> a >> b;
if (a > b)
cout << n * b;
else
cout << n * a;
}
signed main() {
fast;
solve();
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define endl "\n"
#define F(i, n) for (ll i = 0; i < n; i++)
#define rep(i, a, b) for (ll i = a; i < b; i++)
#define repp(i, a, b) for (ll i = a; i >= b; i--)
#define fast \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define pb push_back
#define mp make_pair
#define vll vector<ll>
#define f first
#define s second
#define ALL(v) v.begin(), v.end()
void solve() {
ll n, a, b;
cin >> n >> a >> b;
if (n * a > b)
cout << b;
else
cout << n * a;
}
signed main() {
fast;
solve();
return 0;
}
| [
"control_flow.branch.if.condition.change",
"expression.operation.binary.remove"
] | 783,676 | 783,675 | u603991349 | cpp |
p02981 | #include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define limit(x, l, r) max(l, min(x, r))
#define lims(x, l, r) (x = max(l, min(x, r)))
#define isin(x, l, r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)), x.end())
#define show(x) cout << #x << " = " << x << endl;
#define print(x) cout << x << endl;
#define PQ(T) priority_queue<T, v(T), greater<T>>
#define bn(x) ((1 << x) - 1)
#define dup(x, y) (((x) + (y)-1) / (y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
int main() {
int n, a, b;
cin >> n >> a >> b;
cout << min(a * n, b / n) << endl;
} | #include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define limit(x, l, r) max(l, min(x, r))
#define lims(x, l, r) (x = max(l, min(x, r)))
#define isin(x, l, r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)), x.end())
#define show(x) cout << #x << " = " << x << endl;
#define print(x) cout << x << endl;
#define PQ(T) priority_queue<T, v(T), greater<T>>
#define bn(x) ((1 << x) - 1)
#define dup(x, y) (((x) + (y)-1) / (y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
int main() {
int n, a, b;
cin >> n >> a >> b;
cout << min(a * n, b) << endl;
}
| [
"expression.operation.binary.remove"
] | 783,677 | 783,678 | u814715203 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, A, B;
cin >> N >> A >> B;
if (N * A > B) {
cout << N * A << endl;
} else {
cout << B << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, A, B;
cin >> N >> A >> B;
if (N * A > B) {
cout << B << endl;
} else {
cout << N * A << endl;
}
}
| [
"control_flow.branch.else.add"
] | 783,679 | 783,680 | u740002394 | cpp |
p02981 | #include <bits/stdc++.h>
#define cn count
#define pb push_back
#define in insert
#define fs first
#define sc second
#define sz size
#define len length
#define forn(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define forni(i, n) for (ll i = 1; i < (ll)(n); ++i)
#define IO \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0)
using namespace std;
using ll = long long;
const ll inf = 1e9 + 7;
const double PI = 3.141592653589793;
int main() {
IO;
ll n, a, b;
cin >> n >> a >> b;
ll ans = n * min(a, b);
cout << ans << "\n";
return 0;
}
// _ .-') .-. .-') .-')
//( '.( OO )_ \ ( OO ) ( OO ).
// ,--. ,--.).-'),-----. ,--. ,--. .-'),-----. (_)---\_) ,--. ,--. .-----.
// ,-.-') .-'),-----. | `.' |( OO' .-. '| .' / ( OO' .-. '/ _ |
// | | | | ' .--./ | |OO)( OO' .-. ' | |/ | | | || /,
// / | | | |\ :` `. | | | .-') | |('-. | | \/ | | | | | |'.'|
// |\_) | |\| || ' _)\_) | |\| | '..`''.) | |_|( OO )/_) |OO ) |
// |(_/\_) | |\| | | | | | \ | | | || . \ \ | | | |.-._) \ |
// | | `-' /|| |`-'| ,| |_.' \ | | | | | | | | `' '-' '|
// |\ \ `' '-' '\ /(' '-'(_.-'(_' '--'\(_| | `' '-' '
// """ """ """""""" """ """" """"""" """"""" """""""" """"""
// """ """""""
| #include <bits/stdc++.h>
#define cn count
#define pb push_back
#define in insert
#define fs first
#define sc second
#define sz size
#define len length
#define forn(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define forni(i, n) for (ll i = 1; i < (ll)(n); ++i)
#define IO \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0)
using namespace std;
using ll = long long;
const ll inf = 1e9 + 7;
const double PI = 3.141592653589793;
int main() {
IO;
ll n, a, b;
cin >> n >> a >> b;
ll ans = min(n * a, b);
cout << ans << "\n";
return 0;
}
// _ .-') .-. .-') .-')
//( '.( OO )_ \ ( OO ) ( OO ).
// ,--. ,--.).-'),-----. ,--. ,--. .-'),-----. (_)---\_) ,--. ,--. .-----.
// ,-.-') .-'),-----. | `.' |( OO' .-. '| .' / ( OO' .-. '/ _ |
// | | | | ' .--./ | |OO)( OO' .-. ' | |/ | | | || /,
// / | | | |\ :` `. | | | .-') | |('-. | | \/ | | | | | |'.'|
// |\_) | |\| || ' _)\_) | |\| | '..`''.) | |_|( OO )/_) |OO ) |
// |(_/\_) | |\| | | | | | \ | | | || . \ \ | | | |.-._) \ |
// | | `-' /|| |`-'| ,| |_.' \ | | | | | | | | `' '-' '|
// |\ \ `' '-' '\ /(' '-'(_.-'(_' '--'\(_| | `' '-' '
// """ """ """""""" """ """" """"""" """"""" """""""" """"""
// """ """""""
| [
"expression.operation.binary.remove"
] | 783,688 | 783,689 | u379682992 | cpp |
p02981 | #include <algorithm>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdio.h>
#include <tuple>
#include <unordered_map>
#include <vector>
// #include<bits/stdc++.h>
// #include "unionFind.h"
using namespace std;
#define ll long long
#define int long long
typedef vector<ll> vi;
typedef pair<ll, ll> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;
#define INF 1e9
#define INF64 (ll)1e18
#define pb push_back
#define F first
#define S second
#define MP make_pair
#define forn(i, l, r) for (ll i = l; i < r; i++)
void ain(vector<ll> &a) {
for (ll i = 0; i < (ll)a.size(); i++)
cin >> a[i];
}
ll max(ll a, ll b) { return (a > b) ? a : b; }
ll min(ll a, ll b) { return (a > b) ? b : a; }
int Ceil(double x) { return (((int)x == x) ? x : (int)x + 1); }
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n, a, b;
cin >> n >> a >> b;
cout << n * min(a, b) << endl;
return 0;
}
/*
10 7 8 3
3 10 4 9 2 7 6 10 4 8
*/
| #include <algorithm>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdio.h>
#include <tuple>
#include <unordered_map>
#include <vector>
// #include<bits/stdc++.h>
// #include "unionFind.h"
using namespace std;
#define ll long long
#define int long long
typedef vector<ll> vi;
typedef pair<ll, ll> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;
#define INF 1e9
#define INF64 (ll)1e18
#define pb push_back
#define F first
#define S second
#define MP make_pair
#define forn(i, l, r) for (ll i = l; i < r; i++)
void ain(vector<ll> &a) {
for (ll i = 0; i < (ll)a.size(); i++)
cin >> a[i];
}
ll max(ll a, ll b) { return (a > b) ? a : b; }
ll min(ll a, ll b) { return (a > b) ? b : a; }
int Ceil(double x) { return (((int)x == x) ? x : (int)x + 1); }
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n, a, b;
cin >> n >> a >> b;
cout << min(n * a, b) << endl;
return 0;
}
/*
10 7 8 3
3 10 4 9 2 7 6 10 4 8
*/
| [
"expression.operation.binary.remove"
] | 783,692 | 783,693 | u204970462 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, a, b;
cin >> n >> a >> b;
int ans = min(n * a, b * n);
cout << ans << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n, a, b;
cin >> n >> a >> b;
int ans = min(n * a, b);
cout << ans << endl;
}
| [
"expression.operation.binary.remove"
] | 783,694 | 783,695 | u864785784 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, a, b;
cin >> n >> a >> b;
int ans = min(a, b);
cout << ans << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n, a, b;
cin >> n >> a >> b;
int ans = min(n * a, b);
cout << ans << endl;
}
| [
"assignment.change"
] | 783,696 | 783,695 | u864785784 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, a, b;
cin >> n >> a >> b;
cout << max(a * n, b) << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, a, b;
cin >> n >> a >> b;
cout << min(a * n, b) << endl;
} | [
"misc.opposites",
"identifier.change",
"call.function.change",
"io.output.change"
] | 783,703 | 783,704 | u769530239 | cpp |
p02981 | /*The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep.*/
// PRABHJOT SINGH A.K.A. PRABHI
//~~~~~conquizztador~~~~~
#include <bits/stdc++.h>
using namespace std;
using lli = long long int;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
const int MOD = 1000000007;
const int MOD1 = 998244353;
const int maxn = 100010;
const int lim = (int)1e9;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n = 0, a = 0, b = 0;
cin >> n >> a >> b;
cout << n * min(a, b) << endl;
} | /*The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep.*/
// PRABHJOT SINGH A.K.A. PRABHI
//~~~~~conquizztador~~~~~
#include <bits/stdc++.h>
using namespace std;
using lli = long long int;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
const int MOD = 1000000007;
const int MOD1 = 998244353;
const int maxn = 100010;
const int lim = (int)1e9;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n = 0, a = 0, b = 0;
cin >> n >> a >> b;
cout << min(n * a, b) << endl;
} | [
"expression.operation.binary.remove"
] | 783,705 | 783,706 | u217942651 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, A, B;
cin >> N >> A >> B;
int count = A * N;
if (count > B) {
cout << count << endl;
} else {
cout << B << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, A, B;
cin >> N >> A >> B;
int count = A * N;
if (count < B) {
cout << count << endl;
} else {
cout << B << endl;
}
} | [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 783,707 | 783,708 | u431458875 | cpp |
p02981 | /*
* Author : Sadi
* Mon 06/07/2020
* 16:30:21.13
*/
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
#define watch(x) \
; \
cout << "\n" << #x << " is: " << x << "\n";
#define all(a) (a).begin(), (a).end()
#define fi first
#define se second
template <class A, class B>
ostream &operator<<(ostream &output, const pair<A, B> &p) {
output << "(" << p.first << ", " << p.second << ")";
return output;
}
template <class A> ostream &operator<<(ostream &output, const vector<A> &a) {
output << "[";
for (auto it = a.begin(); it != a.end(); ++it) {
if (it != a.begin()) {
output << ", ";
}
output << *it;
}
output << "]";
return output;
}
using lld = long long;
using pii = pair<int, int>;
using pll = pair<lld, lld>;
// const int inf = 1e9;
// const int mod = 1e9 + 7;
// const double PI = acos(-1.0);
// const int mx = 1e5 + 5;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
#ifndef ONLINE_JUDGE
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE
int n, a, b;
cin >> n >> a >> b;
cout << min(n * a, n * b) << endl;
return 0;
}
| /*
* Author : Sadi
* Mon 06/07/2020
* 16:30:21.13
*/
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
#define watch(x) \
; \
cout << "\n" << #x << " is: " << x << "\n";
#define all(a) (a).begin(), (a).end()
#define fi first
#define se second
template <class A, class B>
ostream &operator<<(ostream &output, const pair<A, B> &p) {
output << "(" << p.first << ", " << p.second << ")";
return output;
}
template <class A> ostream &operator<<(ostream &output, const vector<A> &a) {
output << "[";
for (auto it = a.begin(); it != a.end(); ++it) {
if (it != a.begin()) {
output << ", ";
}
output << *it;
}
output << "]";
return output;
}
using lld = long long;
using pii = pair<int, int>;
using pll = pair<lld, lld>;
// const int inf = 1e9;
// const int mod = 1e9 + 7;
// const double PI = acos(-1.0);
// const int mx = 1e5 + 5;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
#ifndef ONLINE_JUDGE
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE
int n, a, b;
cin >> n >> a >> b;
cout << min(n * a, b) << endl;
return 0;
}
| [
"expression.operation.binary.remove"
] | 783,709 | 783,710 | u055538052 | cpp |
p02981 | #include <algorithm>
#include <cctype>
#include <cstdio>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using f80 = __float80;
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
using namespace std;
#define rep(i, n) for (i64 i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for (i64 i = m; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define REVE(x) reverse(x.begin(), x.end())
#define all(x) (x).begin(), (x).end()
#define fst first
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#define sw swap
#define UP(x) transform(x.begin(), x.end(), x.begin(), ::toupper);
#define down(x) transform(x.begin(), x.end(), x.begin(), ::tolower);
using LL = long long;
using ULL = unsigned long long;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
int main() {
i64 n, k, l, a, b, c;
string aa, bb, cc;
cin >> n >> a >> b;
cout << (n * a > n * b ? n * b : n * a);
} | #include <algorithm>
#include <cctype>
#include <cstdio>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using f80 = __float80;
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
using namespace std;
#define rep(i, n) for (i64 i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for (i64 i = m; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define REVE(x) reverse(x.begin(), x.end())
#define all(x) (x).begin(), (x).end()
#define fst first
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#define sw swap
#define UP(x) transform(x.begin(), x.end(), x.begin(), ::toupper);
#define down(x) transform(x.begin(), x.end(), x.begin(), ::tolower);
using LL = long long;
using ULL = unsigned long long;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
int main() {
i64 n, k, l, a, b, c;
string aa, bb, cc;
cin >> n >> a >> b;
cout << (n * a > b ? b : n * a);
} | [
"expression.operation.binary.remove"
] | 783,711 | 783,712 | u379928983 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B, C;
cin >> A >> B >> C;
if (A * B < C) {
cout << C << endl;
} else {
cout << A * B << endl;
}
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B, C;
cin >> A >> B >> C;
if (A * B < C) {
cout << A * B << endl;
} else {
cout << C << endl;
}
}
| [
"control_flow.branch.else.add"
] | 783,713 | 783,714 | u425231382 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
cout << max(a * b, c);
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
cout << min(a * b, c);
}
| [
"misc.opposites",
"identifier.change",
"call.function.change",
"io.output.change"
] | 783,719 | 783,720 | u829521436 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define mod 1000000007
#define inf 1000000000000000
#define infty 1000000000000000000LL
#define md 998244353
#define PI acos(-1.0)
#define endl "\n"
#define rr return
#define br cout << "\n";
long long prime[1000000];
void sieve() {
prime[0] = 0;
prime[1] = 0;
for (int i = 2; i < 1000000; i++)
prime[i] = 1;
for (int i = 2; i * i < 1000000; i++)
if (prime[i] == 1)
for (int j = i * i; j < 1000000; j += i)
prime[j] = 0;
}
bool isPrime(int n) {
if (n <= 1)
return false;
for (ll i = 2; i <= floor(sqrt(n)); i++)
if (n % i == 0)
return false;
return true;
}
int factorial(int n) {
int f = 1;
for (int i = 1; i <= n; i++)
f = (f * i) % mod;
return f;
}
int gcd(int a, int b) { return !b ? a : gcd(b, a % b); }
int lcm(int a, int b) { return (a / gcd(a, b)) * b; }
int fastExponentiation(int n, int x, int modulo) {
int res = 1;
while (x > 0) {
if (x & 1)
res = (res * n) % modulo;
x = x >> 1;
n = (n * n) % modulo;
}
return res;
}
int power(int n, int p) {
if (p == 0)
return 1;
int res = power((n * n) % mod, p / 2);
if (p % 2 == 1)
res = (n * res) % mod;
return res;
}
bool isPowerOfTwo(int n) { return n && (!(n & (n - 1))); }
bool isSet(int n, int i) {
// To check if ith bit is set or not in binary representation of n
return n & (1 << i);
}
bool valid_coordinate(ll x, ll y, ll n, ll m) {
if (x < 0 || y < 0)
return false;
else if (x >= n || y >= m)
return false;
else
return true;
}
int sod(int n) {
int sum = 0;
while (n) {
sum += (n % 10);
n /= 10;
}
return sum;
}
void solve() {
int n, a, b;
cin >> n >> a >> b;
cout << n * min(a, b) << endl;
}
int32_t main() {
// int t; cin>>t; while(t--)
solve();
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define mod 1000000007
#define inf 1000000000000000
#define infty 1000000000000000000LL
#define md 998244353
#define PI acos(-1.0)
#define endl "\n"
#define rr return
#define br cout << "\n";
long long prime[1000000];
void sieve() {
prime[0] = 0;
prime[1] = 0;
for (int i = 2; i < 1000000; i++)
prime[i] = 1;
for (int i = 2; i * i < 1000000; i++)
if (prime[i] == 1)
for (int j = i * i; j < 1000000; j += i)
prime[j] = 0;
}
bool isPrime(int n) {
if (n <= 1)
return false;
for (ll i = 2; i <= floor(sqrt(n)); i++)
if (n % i == 0)
return false;
return true;
}
int factorial(int n) {
int f = 1;
for (int i = 1; i <= n; i++)
f = (f * i) % mod;
return f;
}
int gcd(int a, int b) { return !b ? a : gcd(b, a % b); }
int lcm(int a, int b) { return (a / gcd(a, b)) * b; }
int fastExponentiation(int n, int x, int modulo) {
int res = 1;
while (x > 0) {
if (x & 1)
res = (res * n) % modulo;
x = x >> 1;
n = (n * n) % modulo;
}
return res;
}
int power(int n, int p) {
if (p == 0)
return 1;
int res = power((n * n) % mod, p / 2);
if (p % 2 == 1)
res = (n * res) % mod;
return res;
}
bool isPowerOfTwo(int n) { return n && (!(n & (n - 1))); }
bool isSet(int n, int i) {
// To check if ith bit is set or not in binary representation of n
return n & (1 << i);
}
bool valid_coordinate(ll x, ll y, ll n, ll m) {
if (x < 0 || y < 0)
return false;
else if (x >= n || y >= m)
return false;
else
return true;
}
int sod(int n) {
int sum = 0;
while (n) {
sum += (n % 10);
n /= 10;
}
return sum;
}
void solve() {
int n, a, b;
cin >> n >> a >> b;
cout << min(n * a, b) << endl;
}
int32_t main() {
// int t; cin>>t; while(t--)
solve();
return 0;
}
| [
"expression.operation.binary.remove"
] | 783,721 | 783,722 | u874915633 | cpp |
p02981 | #include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <cstring>
#include <iostream>
using namespace std;
int main() {
int n, a, b;
cin >> n >> a >> b;
if ((n * a) >= (n * b))
cout << (n * b);
else
cout << (n * a);
return 0;
} | #include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <cstring>
#include <iostream>
using namespace std;
int main() {
int n, a, b;
cin >> n >> a >> b;
if ((n * a) >= (b))
cout << b;
else
cout << (n * a);
return 0;
} | [
"expression.operation.binary.remove"
] | 783,728 | 783,729 | u128595605 | cpp |
p02981 | #include <algorithm>
#include <iostream>
using namespace std;
int main() {
int n, a, b, taku, den;
cin >> n >> a >> b;
den = n * a;
taku = n;
cout << min({taku, den}) << endl;
} | #include <algorithm>
#include <iostream>
using namespace std;
int main() {
int n, a, b, taku, den;
cin >> n >> a >> b;
den = n * a;
taku = b;
cout << min({taku, den}) << endl;
} | [
"assignment.value.change",
"identifier.change"
] | 783,732 | 783,733 | u540695932 | cpp |
p02981 | #include <iostream>
using namespace std;
int main(void) {
// Your code here!
int a, b, c, ans;
cin >> a >> b >> c;
ans = min(a * b, a * c);
cout << ans << endl;
return 0;
}
| #include <iostream>
using namespace std;
int main(void) {
// Your code here!
int a, b, c, ans;
cin >> a >> b >> c;
ans = min(a * b, c);
cout << ans << endl;
return 0;
}
| [
"expression.operation.binary.remove"
] | 783,734 | 783,735 | u713617140 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B, C;
cin >> A >> B >> C;
if (A * B >= C) {
cout << A * B << endl;
} else {
cout << C << endl;
}
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B, C;
cin >> A >> B >> C;
if (A * B >= C) {
cout << C << endl;
} else {
cout << A * B << endl;
}
}
| [
"control_flow.branch.else.add"
] | 783,736 | 783,737 | u185806788 | cpp |
p02980 | // Have a nice day:)
#include <bits/stdc++.h>
using namespace std;
#define LL long long
inline int read();
const int maxn = 5e5 + 5;
const int mod = 998244353;
int n, m, ans;
int fac[maxn], inv[maxn];
int Pow(int a, int b) {
int u = 1;
for (; b; b >>= 1, a = 1ll * a * a % mod)
if (b & 1)
u = 1ll * u * a % mod;
return u;
}
void Init() {
fac[0] = inv[0] = 1;
for (int i = 1; i <= maxn - 5; ++i)
fac[i] = 1ll * fac[i - 1] * i % mod;
inv[maxn - 5] = Pow(fac[maxn - 5], mod - 2);
for (int i = maxn - 6; i >= 1; --i)
inv[i] = 1ll * inv[i + 1] * (i + 1) % mod;
}
int C(int a, int b) { return 1ll * fac[b] * inv[a] % mod * inv[b - a] % mod; }
void Work() {
n = read(), m = read();
Init();
for (int i = min(n, m); i >= 0; --i) {
ans = (ans + (i & 1 ? -1ll : 1ll) * C(i, n) * C(i, m) % mod * fac[i] % mod *
Pow(n + 1, m - i) % mod * Pow(m + 1, n - i) % mod) %
mod;
}
printf("%d", ans);
}
int main() {
Work();
return 0;
}
inline int read() {
char c;
bool type = 1;
while ((c = getchar()) < '0' || c > '9')
if (c == '-')
type = 0;
int ans = c ^ 48;
while ((c = getchar()) >= '0' && c <= '9')
ans = (ans << 3) + (ans << 1) + (c ^ 48);
return type ? ans : -ans;
}
| // Have a nice day:)
#include <bits/stdc++.h>
using namespace std;
#define LL long long
inline int read();
const int maxn = 5e5 + 5;
const int mod = 998244353;
int n, m, ans;
int fac[maxn], inv[maxn];
int Pow(int a, int b) {
int u = 1;
for (; b; b >>= 1, a = 1ll * a * a % mod)
if (b & 1)
u = 1ll * u * a % mod;
return u;
}
void Init() {
fac[0] = inv[0] = 1;
for (int i = 1; i <= maxn - 5; ++i)
fac[i] = 1ll * fac[i - 1] * i % mod;
inv[maxn - 5] = Pow(fac[maxn - 5], mod - 2);
for (int i = maxn - 6; i >= 1; --i)
inv[i] = 1ll * inv[i + 1] * (i + 1) % mod;
}
int C(int a, int b) { return 1ll * fac[b] * inv[a] % mod * inv[b - a] % mod; }
void Work() {
n = read(), m = read();
Init();
for (int i = min(n, m); i >= 0; --i) {
ans = (ans + (i & 1 ? -1ll : 1ll) * C(i, n) * C(i, m) % mod * fac[i] % mod *
Pow(n + 1, m - i) % mod * Pow(m + 1, n - i) % mod) %
mod;
}
printf("%d", (ans + mod) % mod);
}
int main() {
Work();
return 0;
}
inline int read() {
char c;
bool type = 1;
while ((c = getchar()) < '0' || c > '9')
if (c == '-')
type = 0;
int ans = c ^ 48;
while ((c = getchar()) >= '0' && c <= '9')
ans = (ans << 3) + (ans << 1) + (c ^ 48);
return type ? ans : -ans;
}
| [
"call.arguments.change"
] | 783,749 | 783,750 | u724263602 | cpp |
p02981 | #include <algorithm>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <sstream>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
int main() {
int a, b, n;
cin >> n >> a >> b;
if (a > n * b)
cout << n * b << endl;
else
cout << a << endl;
}
| #include <algorithm>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <sstream>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
int main() {
int a, b, n;
cin >> n >> b >> a;
if (a > n * b)
cout << n * b << endl;
else
cout << a << endl;
}
| [
"expression.operation.binary.remove"
] | 783,758 | 783,759 | u000113982 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, a, b;
cin >> n >> a >> b;
if (n * a < n * b)
cout << n * a << endl;
else
cout << n * b << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n, a, b;
cin >> n >> a >> b;
if (n * a < b)
cout << n * a << endl;
else
cout << b << endl;
return 0;
}
| [
"expression.operation.binary.remove"
] | 783,760 | 783,761 | u018679195 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, A, B;
cin >> N >> A >> B;
if (N * A > B) {
cout << N * A << endl;
} else {
cout << B << endl;
}
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int N, A, B;
cin >> N >> A >> B;
if (N * A > B) {
cout << B << endl;
} else {
cout << N * A << endl;
}
}
| [
"control_flow.branch.else.add"
] | 783,764 | 783,765 | u308463793 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<vl> vvl;
double EPS = 1e-9;
int INF = 1000000005;
long long INFF = 1000000000000000005ll;
double PI = acos(-1);
int dirx[8] = {-1, 0, 0, 1, -1, -1, 1, 1};
int diry[8] = {0, 1, -1, 0, -1, 1, -1, 1};
const ll MOD = 1000000007;
ll sum() { return 0; }
template <typename T, typename... Args> T sum(T a, Args... args) {
return a + sum(args...);
}
#define DEBUG fprintf(stderr, "====TESTING====\n")
#define VALUE(x) cerr << "The value of " << #x << " is " << x << endl
#define OUT(x) cout << x << endl
#define OUTH(x) cout << x << " "
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define READ(x) \
for (auto &(z) : x) \
cin >> z;
#define FOR(a, b, c) for (int(a) = (b); (a) < (c); ++(a))
#define FORN(a, b, c) for (int(a) = (b); (a) <= (c); ++(a))
#define FORD(a, b, c) for (int(a) = (b); (a) >= (c); --(a))
#define FORSQ(a, b, c) for (int(a) = (b); (a) * (a) <= (c); ++(a))
#define FORC(a, b, c) for (char(a) = (b); (a) <= (c); ++(a))
#define EACH(a, b) for (auto &(a) : (b))
#define REP(i, n) FOR(i, 0, n)
#define REPN(i, n) FORN(i, 1, n)
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define SQR(x) ((ll)(x) * (x))
#define RESET(a, b) memset(a, b, sizeof(a))
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ALL(v) v.begin(), v.end()
#define ALLA(arr, sz) arr, arr + sz
#define SIZE(v) (int)v.size()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define SORTA(arr, sz) sort(ALLA(arr, sz))
#define REVERSEA(arr, sz) reverse(ALLA(arr, sz))
#define PERMUTE next_permutation
#define TC(t) while (t--)
#define FAST_INP \
ios_base::sync_with_stdio(false); \
cin.tie(NULL)
#define what_is(x) cerr << #x << " is " << x << endl;
void solve() {}
int main() {
FAST_INP;
// #ifndef ONLINE_JUDGE
// freopen("input.txt","r", stdin);
// freopen("output.txt","w", stdout);
// #endif
// int tc; cin >> tc;
// TC(tc) solve();
int n, a, b;
cin >> n >> a >> b;
OUT(min(n * a, n * b));
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<vl> vvl;
double EPS = 1e-9;
int INF = 1000000005;
long long INFF = 1000000000000000005ll;
double PI = acos(-1);
int dirx[8] = {-1, 0, 0, 1, -1, -1, 1, 1};
int diry[8] = {0, 1, -1, 0, -1, 1, -1, 1};
const ll MOD = 1000000007;
ll sum() { return 0; }
template <typename T, typename... Args> T sum(T a, Args... args) {
return a + sum(args...);
}
#define DEBUG fprintf(stderr, "====TESTING====\n")
#define VALUE(x) cerr << "The value of " << #x << " is " << x << endl
#define OUT(x) cout << x << endl
#define OUTH(x) cout << x << " "
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define READ(x) \
for (auto &(z) : x) \
cin >> z;
#define FOR(a, b, c) for (int(a) = (b); (a) < (c); ++(a))
#define FORN(a, b, c) for (int(a) = (b); (a) <= (c); ++(a))
#define FORD(a, b, c) for (int(a) = (b); (a) >= (c); --(a))
#define FORSQ(a, b, c) for (int(a) = (b); (a) * (a) <= (c); ++(a))
#define FORC(a, b, c) for (char(a) = (b); (a) <= (c); ++(a))
#define EACH(a, b) for (auto &(a) : (b))
#define REP(i, n) FOR(i, 0, n)
#define REPN(i, n) FORN(i, 1, n)
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define SQR(x) ((ll)(x) * (x))
#define RESET(a, b) memset(a, b, sizeof(a))
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ALL(v) v.begin(), v.end()
#define ALLA(arr, sz) arr, arr + sz
#define SIZE(v) (int)v.size()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define SORTA(arr, sz) sort(ALLA(arr, sz))
#define REVERSEA(arr, sz) reverse(ALLA(arr, sz))
#define PERMUTE next_permutation
#define TC(t) while (t--)
#define FAST_INP \
ios_base::sync_with_stdio(false); \
cin.tie(NULL)
#define what_is(x) cerr << #x << " is " << x << endl;
void solve() {}
int main() {
FAST_INP;
// #ifndef ONLINE_JUDGE
// freopen("input.txt","r", stdin);
// freopen("output.txt","w", stdout);
// #endif
// int tc; cin >> tc;
// TC(tc) solve();
int n, a, b;
cin >> n >> a >> b;
OUT(min(n * a, b));
return 0;
} | [
"expression.operation.binary.remove"
] | 783,766 | 783,767 | u040094338 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
vector<int> forintinput(int n) {
vector<int> x;
for (int i = 0; i < n; i++) {
int ia;
cin >> ia;
x.push_back(ia);
}
return x;
}
int main() {
int n, a, b;
cin >> n >> a >> b;
if (a * n >= b) {
cout << b << endl;
} else {
cout << a << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
vector<int> forintinput(int n) {
vector<int> x;
for (int i = 0; i < n; i++) {
int ia;
cin >> ia;
x.push_back(ia);
}
return x;
}
int main() {
int n, a, b;
cin >> n >> a >> b;
if (a * n >= b) {
cout << b << endl;
} else {
cout << a * n << endl;
}
} | [
"expression.operation.binary.add"
] | 783,776 | 783,777 | u025223061 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
vector<int> forintinput(int n) {
vector<int> x;
for (int i = 0; i < n; i++) {
int ia;
cin >> ia;
x.push_back(ia);
}
return x;
}
int main() {
int n, a, b;
cin >> n >> a >> b;
if (a * n <= b) {
cout << b << endl;
} else {
cout << a << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
vector<int> forintinput(int n) {
vector<int> x;
for (int i = 0; i < n; i++) {
int ia;
cin >> ia;
x.push_back(ia);
}
return x;
}
int main() {
int n, a, b;
cin >> n >> a >> b;
if (a * n >= b) {
cout << b << endl;
} else {
cout << a * n << endl;
}
} | [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 783,778 | 783,777 | u025223061 | cpp |
p02981 | #include <iostream>
using namespace std;
int main() {
int N, A, B;
cin >> N >> A >> B;
cout << (N * A > B ? N * A : B) << endl;
} | #include <iostream>
using namespace std;
int main() {
int N, A, B;
cin >> N >> A >> B;
cout << (N * A > B ? B : N * A) << endl;
} | [] | 783,785 | 783,786 | u449415671 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, a, b;
cin >> n >> a >> b;
cout << min(n * a, n * b) << '\n';
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, a, b;
cin >> n >> a >> b;
cout << min(n * a, b) << '\n';
return 0;
} | [
"expression.operation.binary.remove"
] | 783,789 | 783,790 | u712429027 | cpp |
p02981 | #include <iostream>
using namespace std;
int main(void) {
// Your code here!
int n, a, b;
cin >> n >> a >> b;
if (n * a > b) {
cout << n * a << endl;
} else {
cout << b << endl;
}
}
| #include <iostream>
using namespace std;
int main(void) {
// Your code here!
int n, a, b;
cin >> n >> a >> b;
if (n * a > b) {
cout << b << endl;
} else {
cout << n * a << endl;
}
}
| [
"control_flow.branch.else.add"
] | 783,791 | 783,792 | u325443482 | cpp |
p02981 | #include <stdio.h>
int main() {
int a, b, c;
scanf("%d %d", &a, &b, &c);
int trip = a * b;
if (trip <= c) {
printf("%d\n", trip);
}
else {
printf("%d\n", c);
}
return 0;
} | #include <stdio.h>
int main() {
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
int trip = a * b;
if (trip <= c) {
printf("%d\n", trip);
}
else {
printf("%d\n", c);
}
return 0;
} | [
"literal.string.change",
"call.arguments.change"
] | 783,793 | 783,794 | u353919145 | cpp |
p02981 | #include <iostream>
using namespace std;
int main() {
int N, A, B;
cin >> N >> A >> B;
if (N * A >= B) {
cout << "B" << endl;
} else {
cout << "A" << endl;
}
}
| #include <iostream>
using namespace std;
int main() {
int N, A, B;
cin >> N >> A >> B;
if (N * A >= B) {
cout << B << endl;
} else {
cout << N * A << endl;
}
}
| [
"io.output.change"
] | 783,801 | 783,802 | u312172322 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, a, b;
cin >> n >> a >> b;
if (n * a >= b)
cout << n * a << endl;
else
cout << b << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n, a, b;
cin >> n >> a >> b;
if (n * a >= b)
cout << b << endl;
else
cout << n * a << endl;
}
| [
"control_flow.branch.else_if.replace.remove",
"control_flow.branch.if.replace.add",
"control_flow.branch.else.remove"
] | 783,803 | 783,804 | u596234104 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, A, B;
cin >> N >> A >> B;
int ans = max(B, N * A);
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, A, B;
cin >> N >> A >> B;
int ans = min(B, N * A);
cout << ans << endl;
} | [
"misc.opposites",
"identifier.change",
"call.function.change"
] | 783,805 | 783,806 | u615258936 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve() {
int n, a, b;
cin >> n >> a >> b;
cout << min(n * a, n * b) << "\n";
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int t = 1;
while (t--) {
solve();
}
}
| #include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve() {
int n, a, b;
cin >> n >> a >> b;
cout << min(n * a, b) << "\n";
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int t = 1;
while (t--) {
solve();
}
}
| [
"expression.operation.binary.remove"
] | 783,809 | 783,810 | u839715645 | cpp |
p02981 | /*
ID: anonymo14
TASK: wormhole
LANG: C++
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pair<int, int>> vpii;
#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back
#define REP(i, a, b) for (int i = a; i <= b; i++)
#define MOD 1000000007
void solve(int test_case) {
int a, b, c;
cin >> a >> b >> c;
cout << min(a * b, a * c);
}
int main() {
////// FILE BASED IO////
// freopen("wormhole.in", "r", stdin);
// freopen("wormhole.out", "w", stdout);
///////////////
ios::sync_with_stdio(0);
cin.tie(0);
int t = 1;
// cin>>t;
REP(i, 1, t) { solve(i); }
return 0;
}
| /*
ID: anonymo14
TASK: wormhole
LANG: C++
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pair<int, int>> vpii;
#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back
#define REP(i, a, b) for (int i = a; i <= b; i++)
#define MOD 1000000007
void solve(int test_case) {
int a, b, c;
cin >> a >> b >> c;
cout << min(a * b, c);
}
int main() {
////// FILE BASED IO////
// freopen("wormhole.in", "r", stdin);
// freopen("wormhole.out", "w", stdout);
///////////////
ios::sync_with_stdio(0);
cin.tie(0);
int t = 1;
// cin>>t;
REP(i, 1, t) { solve(i); }
return 0;
}
| [
"expression.operation.binary.remove"
] | 783,811 | 783,812 | u455371217 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;
int main() {
int n, a, b;
cin >> n >> a >> b;
cout << max(a * n, b) << endl;
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;
int main() {
int n, a, b;
cin >> n >> a >> b;
cout << min(a * n, b) << endl;
} | [
"misc.opposites",
"identifier.change",
"call.function.change",
"io.output.change"
] | 783,813 | 783,814 | u897135531 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace ::std;
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef array<int, 3> tri;
typedef long double ld;
template <class T> istream &operator>>(istream &I, vector<T> &v) {
for (T &e : v)
I >> e;
return I;
}
template <class T> ostream &operator<<(ostream &O, const vector<T> &v) {
for (const T &e : v)
O << e << ' ';
return O;
}
void _main() {
int n, a, b;
cin >> n >> a >> b;
cout << n * min(a, b);
}
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
// freopen("input.txt", "r", stdin);
int _t = 1;
// cin >> _t;
while (_t--)
_main();
return 0;
} | #include <bits/stdc++.h>
using namespace ::std;
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef array<int, 3> tri;
typedef long double ld;
template <class T> istream &operator>>(istream &I, vector<T> &v) {
for (T &e : v)
I >> e;
return I;
}
template <class T> ostream &operator<<(ostream &O, const vector<T> &v) {
for (const T &e : v)
O << e << ' ';
return O;
}
void _main() {
int n, a, b;
cin >> n >> a >> b;
cout << min(n * a, b);
}
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
// freopen("input.txt", "r", stdin);
int _t = 1;
// cin >> _t;
while (_t--)
_main();
return 0;
}
| [
"expression.operation.binary.remove"
] | 783,815 | 783,816 | u093681822 | cpp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.