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 |
|---|---|---|---|---|---|---|---|
p02981 | #include <iostream>
#include <stdio.h>
#include <string>
using namespace std;
int main(void) {
int a, b, n;
cin >> a >> b >> n;
if (a * n < b)
cout << a * n;
else
cout << b;
}
| #include <iostream>
#include <stdio.h>
#include <string>
using namespace std;
int main(void) {
int a, b, n;
cin >> n >> a >> b;
if (a * n < b)
cout << a * n;
else
cout << b;
}
| [
"expression.operation.binary.remove"
] | 785,485 | 785,486 | u014852120 | cpp |
p02981 | // --------------------<optimizations>--------------------
#pragma GCC optimize("O3")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair<ll, ll>
#define vpii vector<pair<ll, ll>>
#define F first
#define S second
#define ld long double
#define built __builtin_popcountll
#define mst(a, i) memset(a, i, sizeof(a))
#define all(x) x.begin(), x.end()
#define itit(it, a) for (auto it = (a).begin(); it != (a).end(); it++)
#define rep(i, a, b) for (ll i = a; i < b; i++)
#define repr(i, a, b) for (ll i = a; i > b; i--)
#define reprr(i, a, b) for (ll i = a; i >= b; i--)
#define pi 3.14159265358979323846264338327950288419716939937510582097494459230
ll max3(ll x, ll y, ll z) { return max(max(x, y), z); }
ll min3(ll x, ll y, ll z) { return min(min(x, y), z); }
const ll M = 2e5 + 10, M2 = 1e6 + 10, mod = 1e9 + 7, inf = 1e17 + 10;
void add(int &a, int b) {
a += b;
if (a >= mod) {
a -= mod;
}
}
#define trace1(x) cerr << #x << ": " << x << endl
#define trace2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << endl
#define trace3(x, y, z) \
cerr << #x << ":" << x << " | " << #y << ": " << y << " | " << #z << ": " \
<< z << endl
#define trace4(a, b, c, d) \
cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " \
<< c << " | " << #d << ": " << d << endl
#define trace5(a, b, c, d, e) \
cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " \
<< c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl
#define trace6(a, b, c, d, e, f) \
cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " \
<< c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " \
<< #f << ": " << f << endl
int X[] = {0, 1, 0, -1};
int Y[] = {-1, 0, 1, 0};
ll power(ll x, ll n) {
ll result = 1;
while (n > 0) {
if (n % 2 == 1)
result = (result * x) % mod;
x = ((x % mod) * (x % mod)) % mod;
n = n / 2;
}
return result;
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll n, a, b;
cin >> n >> a >> b;
cout << n * min(a, b);
return 0;
}
/* The judge is never wrong! Your code is buggy
Look for:
* * Read the problem carefully.
* * Don't forget to sort(), mod, ll!!!!
* * Initial value = +/- infinity instead of zero!!!
* * an easier and alternate approach
* * read the problem statement carefully
* * if concept is correct and still WA, try with a different implementation
* * special cases (n=1?)
* * if you have no idea just guess the appropriate well-known algorithm instead
of doing nothing :/
*/ | // --------------------<optimizations>--------------------
#pragma GCC optimize("O3")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair<ll, ll>
#define vpii vector<pair<ll, ll>>
#define F first
#define S second
#define ld long double
#define built __builtin_popcountll
#define mst(a, i) memset(a, i, sizeof(a))
#define all(x) x.begin(), x.end()
#define itit(it, a) for (auto it = (a).begin(); it != (a).end(); it++)
#define rep(i, a, b) for (ll i = a; i < b; i++)
#define repr(i, a, b) for (ll i = a; i > b; i--)
#define reprr(i, a, b) for (ll i = a; i >= b; i--)
#define pi 3.14159265358979323846264338327950288419716939937510582097494459230
ll max3(ll x, ll y, ll z) { return max(max(x, y), z); }
ll min3(ll x, ll y, ll z) { return min(min(x, y), z); }
const ll M = 2e5 + 10, M2 = 1e6 + 10, mod = 1e9 + 7, inf = 1e17 + 10;
void add(int &a, int b) {
a += b;
if (a >= mod) {
a -= mod;
}
}
#define trace1(x) cerr << #x << ": " << x << endl
#define trace2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << endl
#define trace3(x, y, z) \
cerr << #x << ":" << x << " | " << #y << ": " << y << " | " << #z << ": " \
<< z << endl
#define trace4(a, b, c, d) \
cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " \
<< c << " | " << #d << ": " << d << endl
#define trace5(a, b, c, d, e) \
cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " \
<< c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl
#define trace6(a, b, c, d, e, f) \
cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " \
<< c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " \
<< #f << ": " << f << endl
int X[] = {0, 1, 0, -1};
int Y[] = {-1, 0, 1, 0};
ll power(ll x, ll n) {
ll result = 1;
while (n > 0) {
if (n % 2 == 1)
result = (result * x) % mod;
x = ((x % mod) * (x % mod)) % mod;
n = n / 2;
}
return result;
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll n, a, b;
cin >> n >> a >> b;
cout << min(n * a, b);
return 0;
}
/* The judge is never wrong! Your code is buggy
Look for:
* * Read the problem carefully.
* * Don't forget to sort(), mod, ll!!!!
* * Initial value = +/- infinity instead of zero!!!
* * an easier and alternate approach
* * read the problem statement carefully
* * if concept is correct and still WA, try with a different implementation
* * special cases (n=1?)
* * if you have no idea just guess the appropriate well-known algorithm instead
of doing nothing :/
*/
| [
"expression.operation.binary.remove"
] | 785,490 | 785,491 | u394634573 | 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 << n * a << endl;
else
cout << b << endl;
}
| [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 785,497 | 785,498 | u943355851 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, a, b, c;
cin >> n >> a >> b;
c = n * a;
if (c > b)
cout << c << endl;
if (c <= b)
cout << b << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, a, b, c;
cin >> n >> a >> b;
c = n * a;
if (c > b)
cout << b << endl;
if (c <= b)
cout << c << endl;
return 0;
} | [
"identifier.change",
"io.output.change"
] | 785,501 | 785,502 | u389216879 | cpp |
p02981 | // -D_GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define pi 3.1415926535
#define print(arr, n) \
for (int i = 0; i < n; i++) \
cout << arr[i] << " "; \
cout << endl
#define fastio ios_base::sync_with_stdio(false);
#define rep(a, b, in) for (int i = a; i < b; i += in)
#define LET(x, a) __typeof(a) x(a)
#define foreach(it, v) for (LET(it, v.begin()); it != v.end(); it++)
#define flush cin.tie(NULL);
using ll = long long int;
#define mod 1000000007
#define S Second
#define F first
#define mp make_pair
#define pb push_back
#define set0(a) memset(a, 0, sizeof(a))
using namespace std;
int32_t main() {
int n, a, b;
cin >> n >> a >> b;
cout << min((n * a), (n * b)) << endl;
return 0;
} | // -D_GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define pi 3.1415926535
#define print(arr, n) \
for (int i = 0; i < n; i++) \
cout << arr[i] << " "; \
cout << endl
#define fastio ios_base::sync_with_stdio(false);
#define rep(a, b, in) for (int i = a; i < b; i += in)
#define LET(x, a) __typeof(a) x(a)
#define foreach(it, v) for (LET(it, v.begin()); it != v.end(); it++)
#define flush cin.tie(NULL);
using ll = long long int;
#define mod 1000000007
#define S Second
#define F first
#define mp make_pair
#define pb push_back
#define set0(a) memset(a, 0, sizeof(a))
using namespace std;
int32_t main() {
int n, a, b;
cin >> n >> a >> b;
cout << (min(n * a, b)) << endl;
return 0;
} | [
"call.add",
"call.arguments.change"
] | 785,508 | 785,509 | u724418357 | cpp |
p02981 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
using ll = int64_t;
/// <summary>
/// 単純なcoutの時に使う
/// </summary>
#define co(a) cout << a << "\n"
/// <summary>
/// [beg, end)の範囲を,添え字indexでループするfor文に置換します
/// </summary>
#define rep(i, a) for (ll i = 0; i < a; ++i)
#define reps(i, a, b) for (ll i = a; i < b; ++i)
/// <summary>
/// 迷路等で使う方向のベクトル
/// </summary>
const vector<ll> dx = {0, 1, 0, -1}, dy = {1, 0, -1, 0};
/// <summary>
/// デバッグ時に使う
/// </summary>
#define DEBUG(x) std::cout << #x << " : " << x << "\n"
///////////////////////////////////////////////////////////////////////////
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
ll N, A, B;
cin >> N >> A >> B;
cout << min(N + A, B) << endl;
} | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
using ll = int64_t;
/// <summary>
/// 単純なcoutの時に使う
/// </summary>
#define co(a) cout << a << "\n"
/// <summary>
/// [beg, end)の範囲を,添え字indexでループするfor文に置換します
/// </summary>
#define rep(i, a) for (ll i = 0; i < a; ++i)
#define reps(i, a, b) for (ll i = a; i < b; ++i)
/// <summary>
/// 迷路等で使う方向のベクトル
/// </summary>
const vector<ll> dx = {0, 1, 0, -1}, dy = {1, 0, -1, 0};
/// <summary>
/// デバッグ時に使う
/// </summary>
#define DEBUG(x) std::cout << #x << " : " << x << "\n"
///////////////////////////////////////////////////////////////////////////
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
ll N, A, B;
cin >> N >> A >> B;
cout << min((N * A), B) << endl;
} | [
"call.arguments.change",
"expression.operator.arithmetic.change",
"io.output.change"
] | 785,510 | 785,511 | u976560086 | cpp |
p02981 | #include <iostream>
int main(void) {
int n, a, b;
std::cin >> n;
std::cin >> a;
std::cin >> b;
if (a < (b / n)) {
std::cout << a * n;
} else {
std::cout << b;
}
return 0;
} | #include <iostream>
int main(void) {
int n, a, b;
std::cin >> n;
std::cin >> a;
std::cin >> b;
if (a * n < b) {
std::cout << a * n;
} else {
std::cout << b;
}
return 0;
}
| [
"control_flow.branch.if.condition.change"
] | 785,515 | 785,516 | u617779302 | cpp |
p02981 | #include <bits/stdc++.h>
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define RREP(i, a, b) for (int i = (int)(a); i >= (int)(b); i--)
#define ALL(v) v.begin(), v.end()
#define INF 2e9
typedef long long ll;
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, const T &b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
using namespace std;
int main() {
int N, A, B;
cin >> N >> A >> B;
if (A > N * B) {
cout << N * B;
} else {
cout << A;
}
cout << "\n";
return 0;
}
| #include <bits/stdc++.h>
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define RREP(i, a, b) for (int i = (int)(a); i >= (int)(b); i--)
#define ALL(v) v.begin(), v.end()
#define INF 2e9
typedef long long ll;
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, const T &b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
using namespace std;
int main() {
int N, A, B;
cin >> N >> A >> B;
if (B > N * A) {
cout << N * A;
} else {
cout << B;
}
cout << "\n";
return 0;
}
| [
"identifier.change",
"control_flow.branch.if.condition.change",
"io.output.change"
] | 785,520 | 785,521 | u245487028 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
#define REP(i, init, n) for (lli i = init; i < n; i++)
#define REPE(i, init, n) for (lli i = init; i <= n; i++)
#define REPIT(it, container) \
for (auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it, container) \
for (auto it = container.rbegin(); it != container.rend(); it++)
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
typedef long long int lli;
typedef pair<lli, lli> P;
int main() {
lli n, a, b;
cin >> n >> a >> b;
cout << min(a, b) * n << endl;
}
| #include <bits/stdc++.h>
using namespace std;
#define REP(i, init, n) for (lli i = init; i < n; i++)
#define REPE(i, init, n) for (lli i = init; i <= n; i++)
#define REPIT(it, container) \
for (auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it, container) \
for (auto it = container.rbegin(); it != container.rend(); it++)
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
typedef long long int lli;
typedef pair<lli, lli> P;
int main() {
lli n, a, b;
cin >> n >> a >> b;
cout << min(a * n, b) << endl;
}
| [
"expression.operation.binary.remove"
] | 785,526 | 785,527 | u058297300 | cpp |
p02981 | #include <bits/stdc++.h>
#include <cmath>
using namespace std;
int main() {
int n, a, b;
cin >> n >> a >> b;
cout << a * n + b << endl;
} | #include <bits/stdc++.h>
#include <cmath>
using namespace std;
int main() {
int n, a, b;
cin >> n >> a >> b;
cout << min(a * n, b) << endl;
} | [
"call.add",
"io.output.change",
"call.arguments.change"
] | 785,530 | 785,531 | u672995180 | cpp |
p02981 | #include <bits/stdc++.h>
#define rep(i, a, b) for (ll i = (a); i <= (b); i++)
#define END(x) \
do { \
cout << (x) << endl; \
exit(0); \
} while (0)
#define debug(x) \
do { \
cerr << #x << ": " << x << "\n"; \
} while (0)
#define debugv(x) \
do { \
cerr << #x << ": "; \
for (auto &e : (x)) \
cerr << e << " "; \
cerr << "\n"; \
} while (0)
#define exp2(x) (1LL << (x))
using namespace std;
using ll = long long;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n, a, b;
cin >> n >> a >> b;
END(max(n * a, b));
// sort(s.begin(), s.end());
// if (s[0]==s[1] and s[2]==s[3] a}
}
| #include <bits/stdc++.h>
#define rep(i, a, b) for (ll i = (a); i <= (b); i++)
#define END(x) \
do { \
cout << (x) << endl; \
exit(0); \
} while (0)
#define debug(x) \
do { \
cerr << #x << ": " << x << "\n"; \
} while (0)
#define debugv(x) \
do { \
cerr << #x << ": "; \
for (auto &e : (x)) \
cerr << e << " "; \
cerr << "\n"; \
} while (0)
#define exp2(x) (1LL << (x))
using namespace std;
using ll = long long;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n, a, b;
cin >> n >> a >> b;
END(min(n * a, b));
// sort(s.begin(), s.end());
// if (s[0]==s[1] and s[2]==s[3] a}
} | [
"misc.opposites",
"identifier.change",
"call.function.change",
"call.arguments.change"
] | 785,544 | 785,545 | u993688697 | 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 if (N * A > B) {
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 << N * A << endl;
} else if (N * A >= B) {
cout << B << endl;
}
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 785,548 | 785,549 | u559112776 | cpp |
p02981 | #include <iostream>
using namespace std;
int main() {
// Your code here!
int a, b, c;
cin >> a >> b >> c;
if (a * b < c) {
cout << a * b << endl;
} else if (a * b > c) {
cout << c << endl;
}
return 0;
} | #include <iostream>
using namespace std;
int main() {
// Your code here!
int a, b, c;
cin >> a >> b >> c;
if (a * b <= c) {
cout << a * b << endl;
} else if (a * b > c) {
cout << c << endl;
}
return 0;
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 785,550 | 785,551 | u821165477 | cpp |
p02981 | #include <iostream>
using namespace std;
int main() {
// Your code here!
int a, b, c;
cin >> a >> b >> c;
if (a * b < c) {
cout << b << endl;
} else if (a * b > c) {
cout << c << endl;
}
return 0;
} | #include <iostream>
using namespace std;
int main() {
// Your code here!
int a, b, c;
cin >> a >> b >> c;
if (a * b <= c) {
cout << a * b << endl;
} else if (a * b > c) {
cout << c << endl;
}
return 0;
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 785,552 | 785,551 | u821165477 | cpp |
p02981 | #include <bits/stdc++.h>
#pragma GCC optimize("O999")
using namespace std;
int main() {
ios::sync_with_stdio(0);
int a, b, n;
cin >> n >> a >> b;
cout << n * min(a, b);
return 0;
}
| #include <bits/stdc++.h>
#pragma GCC optimize("O999")
using namespace std;
int main() {
ios::sync_with_stdio(0);
int a, b, n;
cin >> n >> a >> b;
cout << min(n * a, b);
return 0;
}
| [
"expression.operation.binary.remove"
] | 785,561 | 785,562 | u340127670 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n, a, b;
cin >> n >> a >> b;
if (n * a < n * b)
cout << n * a;
else
cout << n * b;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n, a, b;
cin >> n >> a >> b;
if (n * a < b)
cout << n * a;
else
cout << b;
} | [
"expression.operation.binary.remove"
] | 785,568 | 785,569 | u269192587 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, A, B;
scanf("%d%d", &n, &A, &B);
printf("%d\n", min(n * A, B));
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, A, B;
scanf("%d%d%d", &n, &A, &B);
printf("%d\n", min(n * A, B));
return 0;
} | [
"literal.string.change",
"call.arguments.change"
] | 785,570 | 785,571 | u613623257 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c, t;
cin >> a >> b >> c;
t = a * b;
if (t > c)
cout << c << "\n";
else if (t < c) {
cout << t << "\n";
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c, t;
cin >> a >> b >> c;
t = a * b;
if (t > c)
cout << c << "\n";
else if (t <= c) {
cout << t << "\n";
}
return 0;
}
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 785,578 | 785,579 | u250610025 | cpp |
p02981 | #include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define dofloat cout << fixed << setprecision(8)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount __builtin_popcount
#define all(vec) vec.begin(), vec.end()
#define rall(vec) vec.rbegin(), vec.rend()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long, long long> pll;
typedef vector<pair<long long, long long>> vll;
typedef vector<pair<int, int>> vii;
typedef vector<int> vi;
typedef pair<int, int> ii;
const long long MOD = 1000000007;
const long long MAX = 100005;
const long double PI = 3.14159265359;
const long double G = 9.807;
const long long INF = 1e18;
const long double EPS = 1e-6;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
bool isprime(ll a) {
if (a == 2)
return 1;
if (!(a & 1))
return 0;
for (ll i = 3; i * i <= a; i += 2)
if (a % i == 0)
return 0;
return 1;
}
ll mpow(ll base, ll exponent, ll modulus) {
if (modulus == 1)
return 0;
long long result = 1;
base = base % modulus;
while (exponent) {
if (exponent % 2 == 1)
result = (result * base) % modulus;
exponent = exponent >> 1;
base = (base * base) % modulus;
}
return result;
}
ll minv(ll a, ll mod) {
ll _gcd = gcd(a, mod);
assert(_gcd == 1);
return mpow(a, mod - 2, mod);
}
/*
ll ncr(ll N,ll K){
if(N<K)return 0;
if(K==0)return 1;
if(N==0)return 0;
ll den=1;
for(ll i=1;i<=K;i++)den*=i;
ll num=1;
while(K--){
num*=N;
if(num%den==0){
num/=den;
den=1;
}
N--;
}
return num;
}
*/
ll n, a, b;
int main() {
FAST;
cin >> n >> a >> b;
cout << min(n * a, n * b);
return 0;
} | #include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define dofloat cout << fixed << setprecision(8)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount __builtin_popcount
#define all(vec) vec.begin(), vec.end()
#define rall(vec) vec.rbegin(), vec.rend()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long, long long> pll;
typedef vector<pair<long long, long long>> vll;
typedef vector<pair<int, int>> vii;
typedef vector<int> vi;
typedef pair<int, int> ii;
const long long MOD = 1000000007;
const long long MAX = 100005;
const long double PI = 3.14159265359;
const long double G = 9.807;
const long long INF = 1e18;
const long double EPS = 1e-6;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
bool isprime(ll a) {
if (a == 2)
return 1;
if (!(a & 1))
return 0;
for (ll i = 3; i * i <= a; i += 2)
if (a % i == 0)
return 0;
return 1;
}
ll mpow(ll base, ll exponent, ll modulus) {
if (modulus == 1)
return 0;
long long result = 1;
base = base % modulus;
while (exponent) {
if (exponent % 2 == 1)
result = (result * base) % modulus;
exponent = exponent >> 1;
base = (base * base) % modulus;
}
return result;
}
ll minv(ll a, ll mod) {
ll _gcd = gcd(a, mod);
assert(_gcd == 1);
return mpow(a, mod - 2, mod);
}
/*
ll ncr(ll N,ll K){
if(N<K)return 0;
if(K==0)return 1;
if(N==0)return 0;
ll den=1;
for(ll i=1;i<=K;i++)den*=i;
ll num=1;
while(K--){
num*=N;
if(num%den==0){
num/=den;
den=1;
}
N--;
}
return num;
}
*/
ll n, a, b;
int main() {
FAST;
cin >> n >> a >> b;
cout << min(n * a, b);
return 0;
} | [
"expression.operation.binary.remove"
] | 785,580 | 785,581 | u091650402 | cpp |
p02981 |
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <vector>
#define ll long long
#define rep2(i, a, b) for (int i = a; i <= b; i++)
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep3(i, a, b) for (int i = a; i >= b; i--)
#define REP(e, v) for (auto e : v)
#define queint queue<int>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pq priority_queue<int> //大きい順
#define pqg priority_queue<int, vec, greater<int>> //小さい順
#define pb push_back
#define vec vector<int>
#define vecvec vector<vector<int>>
#define vecll vector<ll>
#define vecvecll vector<vector<ll>>
#define bs binary_search
#define All(c) (c).begin(), (c).end()
#define mp make_pair
using namespace std;
int in() {
int x;
scanf("%d", &x);
return x;
}
string stin() {
string s;
cin >> s;
return s;
}
ll lin() {
ll x;
scanf("%lld", &x);
return x;
}
int main() {
int n = in(), a = in(), b = in();
cout << min(a, b * n);
}
|
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <vector>
#define ll long long
#define rep2(i, a, b) for (int i = a; i <= b; i++)
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep3(i, a, b) for (int i = a; i >= b; i--)
#define REP(e, v) for (auto e : v)
#define queint queue<int>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pq priority_queue<int> //大きい順
#define pqg priority_queue<int, vec, greater<int>> //小さい順
#define pb push_back
#define vec vector<int>
#define vecvec vector<vector<int>>
#define vecll vector<ll>
#define vecvecll vector<vector<ll>>
#define bs binary_search
#define All(c) (c).begin(), (c).end()
#define mp make_pair
using namespace std;
int in() {
int x;
scanf("%d", &x);
return x;
}
string stin() {
string s;
cin >> s;
return s;
}
ll lin() {
ll x;
scanf("%lld", &x);
return x;
}
int main() {
int n = in(), a = in(), b = in();
cout << min(b, a * n);
}
| [
"call.arguments.change",
"call.arguments.add"
] | 785,582 | 785,583 | u434662823 | cpp |
p02981 | #include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
int main() {
int n, a, b;
cin >> n >> a >> b;
if (n * b > a) {
cout << a << endl;
} else
cout << n * b << endl;
return 0;
} | #include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <vector>
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;
return 0;
} | [
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change",
"identifier.change",
"io.output.change"
] | 785,586 | 785,587 | u325768739 | cpp |
p02981 | #include <bits/stdc++.h>
// #include"testlib.h"
using namespace std;
#define ll long long
#define X first
#define Y second
#define all(x) x.begin(), x.end()
const int MX = (int)5e5 + 10;
const int mod = 998244353;
int main(int argc, char *argv[]) {
cin.tie(0);
cout.tie(0);
ios_base::sync_with_stdio(0);
// registerGen(argc, argv, 1);
int n, a, b;
cin >> n >> a >> b;
int res = min(a, b) * n;
cout << res << endl;
return 0;
} | #include <bits/stdc++.h>
// #include"testlib.h"
using namespace std;
#define ll long long
#define X first
#define Y second
#define all(x) x.begin(), x.end()
const int MX = (int)5e5 + 10;
const int mod = 998244353;
int main(int argc, char *argv[]) {
cin.tie(0);
cout.tie(0);
ios_base::sync_with_stdio(0);
// registerGen(argc, argv, 1);
int n, a, b;
cin >> n >> a >> b;
int res = min(a * n, b);
cout << res << endl;
return 0;
} | [
"expression.operation.binary.remove"
] | 785,588 | 785,589 | u770383516 | cpp |
p02981 | #include <algorithm>
#include <bits/stdc++.h>
#include <iomanip>
#include <iostream>
#define ll long long int
#define cases \
int t; \
cin >> t; \
while (t--)
#define pb push_back
using namespace std;
int main() {
int n, a, b;
cin >> a >> b;
if (n * a <= b)
cout << n * a << endl;
else
cout << b << endl;
return 0;
} | #include <algorithm>
#include <bits/stdc++.h>
#include <iomanip>
#include <iostream>
#define ll long long int
#define cases \
int t; \
cin >> t; \
while (t--)
#define pb push_back
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.add"
] | 785,592 | 785,593 | u023461939 | cpp |
p02981 | #include <bits/stdc++.h>
#include <numeric>
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG true
#define LL long long
#define MOD 1000000007
// cout << (c)?"Yay!":":(" << endl;
// sort(a.begin(), a.end(), std::greater<int>());
using namespace std;
int main() {
int n, a, b;
cin >> n >> a >> b;
cout << min(n * a, n * b) << endl;
return 0;
// if(){
// cout<<"YES"<<endl;
// //cout<<"Yes"<<endl;
// }
// else{
// cout<<"NO"<<endl;
// //cout<<"Yes"<<endl;
// }
return 0;
}
| #include <bits/stdc++.h>
#include <numeric>
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG true
#define LL long long
#define MOD 1000000007
// cout << (c)?"Yay!":":(" << endl;
// sort(a.begin(), a.end(), std::greater<int>());
using namespace std;
int main() {
int n, a, b;
cin >> n >> a >> b;
cout << min(n * a, b) << endl;
return 0;
// if(){
// cout<<"YES"<<endl;
// //cout<<"Yes"<<endl;
// }
// else{
// cout<<"NO"<<endl;
// //cout<<"Yes"<<endl;
// }
return 0;
}
| [
"expression.operation.binary.remove"
] | 785,594 | 785,595 | u393086221 | cpp |
p02981 | //#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <iostream>
#include <map>
#include <random>
#include <set>
#include <stdio.h>
#include <time.h>
#include <unordered_set>
#include <vector>
#define prev askdnsajd
#define rank asasdmdnasd
#define next lsjndajbs
#define hash asmdklansd
#define index asdklnas
#define right sld
#define left sldl
using namespace std;
typedef long long ll;
typedef long double dbl;
template <class T> void print(vector<T> s) {
for (T x : s)
cout << x << " ";
cout << endl;
}
int main() {
srand(17);
ios_base::sync_with_stdio(0);
int a, b, n;
cin >> n >> a >> b;
cout << n * min(a, b) << endl;
return 0;
}
| //#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <iostream>
#include <map>
#include <random>
#include <set>
#include <stdio.h>
#include <time.h>
#include <unordered_set>
#include <vector>
#define prev askdnsajd
#define rank asasdmdnasd
#define next lsjndajbs
#define hash asmdklansd
#define index asdklnas
#define right sld
#define left sldl
using namespace std;
typedef long long ll;
typedef long double dbl;
template <class T> void print(vector<T> s) {
for (T x : s)
cout << x << " ";
cout << endl;
}
int main() {
srand(17);
ios_base::sync_with_stdio(0);
int a, b, n;
cin >> n >> a >> b;
cout << min(n * a, b) << endl;
return 0;
}
| [
"expression.operation.binary.remove"
] | 785,600 | 785,601 | u485550995 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n, a, b;
cin >> n >> a >> b;
cout << n * min(a, b) << '\n';
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n, a, b;
cin >> n >> a >> b;
cout << min(n * a, b) << '\n';
return 0;
} | [
"expression.operation.binary.remove"
] | 785,604 | 785,605 | u941934550 | cpp |
p02981 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
template <class T>
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
ll gcd(ll a, ll b) {
if (a % b == 0)
return (b);
else
return (gcd(b, a % b));
}
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
vector<int> bfs(vvi L, int S) { // List,Start
vector<int> v(L.size(), -1);
v[S] = 0;
queue<int> q;
q.push(S);
while (!q.empty()) {
int a = q.front();
q.pop();
for (int x : L[a]) {
if (v[x] == -1) {
v[x] = v[a] + 1;
q.push(x);
}
}
}
return v;
}
void initialize() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
// cout << fixed << setprecision(15);
}
/////////////////////////////////////////
int main() {
initialize();
int N, A, B;
cin >> N >> A >> B;
cout << N * A + B << endl;
return 0;
} | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
template <class T>
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
ll gcd(ll a, ll b) {
if (a % b == 0)
return (b);
else
return (gcd(b, a % b));
}
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
vector<int> bfs(vvi L, int S) { // List,Start
vector<int> v(L.size(), -1);
v[S] = 0;
queue<int> q;
q.push(S);
while (!q.empty()) {
int a = q.front();
q.pop();
for (int x : L[a]) {
if (v[x] == -1) {
v[x] = v[a] + 1;
q.push(x);
}
}
}
return v;
}
void initialize() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
// cout << fixed << setprecision(15);
}
/////////////////////////////////////////
int main() {
initialize();
int N, A, B;
cin >> N >> A >> B;
cout << min(N * A, B) << endl;
return 0;
}
| [
"call.add",
"io.output.change",
"call.arguments.change"
] | 785,616 | 785,617 | u944316525 | cpp |
p02981 | //#include<bits/stdc++.h> // 全てのヘッダーファイルをinclude
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <utility> // wrap,pair
#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++)
const int MOD{int(1e9 + 7)}; // int 1000000007
const int inf{int(1e9)}; // inf = 1000000000 // 1e9 はdouble型
using namespace std;
typedef long long ll;
// 最大公約数(ユークリッドの互除法)
int GCD(int x, int y) {
if (x > y) {
swap(x, y);
}
int r = y % x;
while (r != 0) {
y = x;
x = r;
r = y % x;
}
return x;
}
// 最小公倍数
int LCM(int x, int y) {
ll gcd = GCD(x, y);
return x * y / gcd;
}
// 素数判定(素数ならtrue,合成数ならfalse)
bool IsPrime(int num) {
if (num < 2)
return false; // 0,1
else if (num == 2)
return true; // 2
else if (num % 2 == 0)
return false; // 偶数
double sqrtNum = sqrt(num);
for (int i = 3; i <= sqrtNum; i += 2) {
if (num % i == 0)
return false; // 割り切れたら素数ではない
}
return true; // 全部通ったら素数
}
// pairをsecond基準で昇順sort
// sort(vector_name.begin(),vector_name.end(),compare_by_b);
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
if (a.second != b.second)
return a.second < b.second;
else
return a.first < b.first;
}
// 桁数を返す:unsigned(-の値をとらない)
unsigned Digit(unsigned num) { return log10(num) + 1; }
// ----------------------------------------------------------------
int main(void) {
int n, a, b;
cin >> n >> a >> b;
cout << n * a + b << endl;
return 0;
} | //#include<bits/stdc++.h> // 全てのヘッダーファイルをinclude
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <utility> // wrap,pair
#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++)
const int MOD{int(1e9 + 7)}; // int 1000000007
const int inf{int(1e9)}; // inf = 1000000000 // 1e9 はdouble型
using namespace std;
typedef long long ll;
// 最大公約数(ユークリッドの互除法)
int GCD(int x, int y) {
if (x > y) {
swap(x, y);
}
int r = y % x;
while (r != 0) {
y = x;
x = r;
r = y % x;
}
return x;
}
// 最小公倍数
int LCM(int x, int y) {
ll gcd = GCD(x, y);
return x * y / gcd;
}
// 素数判定(素数ならtrue,合成数ならfalse)
bool IsPrime(int num) {
if (num < 2)
return false; // 0,1
else if (num == 2)
return true; // 2
else if (num % 2 == 0)
return false; // 偶数
double sqrtNum = sqrt(num);
for (int i = 3; i <= sqrtNum; i += 2) {
if (num % i == 0)
return false; // 割り切れたら素数ではない
}
return true; // 全部通ったら素数
}
// pairをsecond基準で昇順sort
// sort(vector_name.begin(),vector_name.end(),compare_by_b);
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
if (a.second != b.second)
return a.second < b.second;
else
return a.first < b.first;
}
// 桁数を返す:unsigned(-の値をとらない)
unsigned Digit(unsigned num) { return log10(num) + 1; }
// ----------------------------------------------------------------
int main(void) {
int n, a, b;
cin >> n >> a >> b;
cout << min(n * a, b) << endl;
return 0;
} | [
"call.add",
"io.output.change",
"call.arguments.change"
] | 785,618 | 785,619 | u121243942 | cpp |
p02981 | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define all(a) a.begin(), a.end()
#define F first
#define S second
#define pb push_back
#define ll long long
#define vi vector<int>
#define pi pair<int, int>
#define mp make_pair
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif
const int mod = 1e9 + 7;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename A, typename B> istream &operator>>(istream &, pair<A, B> &);
template <typename A> istream &operator>>(istream &, vector<A> &);
void add(int &, int);
int mul(int, int);
int powz(int, int);
int sub(int, int);
template <typename A> ostream &operator<<(ostream &, vector<A> &);
const int N = 500001;
void solve() {
int n, a, b;
cin >> n >> a >> b;
cout << min(1ll * n * a, 1ll * n * b);
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int tc = 1;
//~ cin>>tc;
for (int _ = 0; _ < tc; _++) {
//~ cout<<"Case #"<<_+1<<": ";
solve();
if (_ != tc - 1)
cout << "\n";
}
}
int mul(int a, int b) { return ((a)*1ll * (b)) % mod; }
void add(int &a, int b) {
a += b;
if (a >= mod)
a -= mod;
}
int sub(int a, int b) {
a -= b;
if (a < 0) {
a += mod;
}
return a;
}
int powz(int a, int b) {
int res = 1;
while (b) {
if (b & 1)
res = mul(res, a);
b /= 2;
a = mul(a, a);
}
return res;
}
template <typename A, typename B>
istream &operator>>(istream &input, pair<A, B> &x) {
input >> x.F >> x.S;
return input;
}
template <typename A> istream &operator>>(istream &input, vector<A> &x) {
for (auto &i : x)
input >> i;
return input;
}
template <typename A> ostream &operator<<(ostream &output, vector<A> &x) {
for (auto &i : x)
output << i << ' ';
return output;
}
| #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define all(a) a.begin(), a.end()
#define F first
#define S second
#define pb push_back
#define ll long long
#define vi vector<int>
#define pi pair<int, int>
#define mp make_pair
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif
const int mod = 1e9 + 7;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename A, typename B> istream &operator>>(istream &, pair<A, B> &);
template <typename A> istream &operator>>(istream &, vector<A> &);
void add(int &, int);
int mul(int, int);
int powz(int, int);
int sub(int, int);
template <typename A> ostream &operator<<(ostream &, vector<A> &);
const int N = 500001;
void solve() {
int n, a, b;
cin >> n >> a >> b;
cout << min(1ll * n * a, 1ll * b);
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int tc = 1;
//~ cin>>tc;
for (int _ = 0; _ < tc; _++) {
//~ cout<<"Case #"<<_+1<<": ";
solve();
if (_ != tc - 1)
cout << "\n";
}
}
int mul(int a, int b) { return ((a)*1ll * (b)) % mod; }
void add(int &a, int b) {
a += b;
if (a >= mod)
a -= mod;
}
int sub(int a, int b) {
a -= b;
if (a < 0) {
a += mod;
}
return a;
}
int powz(int a, int b) {
int res = 1;
while (b) {
if (b & 1)
res = mul(res, a);
b /= 2;
a = mul(a, a);
}
return res;
}
template <typename A, typename B>
istream &operator>>(istream &input, pair<A, B> &x) {
input >> x.F >> x.S;
return input;
}
template <typename A> istream &operator>>(istream &input, vector<A> &x) {
for (auto &i : x)
input >> i;
return input;
}
template <typename A> ostream &operator<<(ostream &output, vector<A> &x) {
for (auto &i : x)
output << i << ' ';
return output;
}
| [
"expression.operation.binary.remove"
] | 785,620 | 785,621 | u840813237 | cpp |
p02981 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, const T &b) {
if (b < a) {
a = b;
return 1;
}
return 0;
}
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int n, a, b;
cin >> n >> a >> b;
cout << n * min(a, b) << endl;
} | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, const T &b) {
if (b < a) {
a = b;
return 1;
}
return 0;
}
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int n, a, b;
cin >> n >> a >> b;
cout << min(a * n, b) << endl;
} | [
"expression.operation.binary.remove"
] | 785,622 | 785,623 | u746411953 | cpp |
p02981 | #include <bits/stdc++.h>
#define LL long long
#define fi first
#define se second
#define mp make_pair
#define pb push_back
using namespace std;
LL gcd(LL a, LL b) { return b ? gcd(b, a % b) : a; }
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; }
LL powmod(LL a, LL b, LL MOD) {
LL ans = 1;
while (b) {
if (b % 2)
ans = ans * a % MOD;
a = a * a % MOD;
b /= 2;
}
return ans;
}
const int N = 2e5 + 11;
int main() {
ios::sync_with_stdio(false);
int n, a, b;
cin >> n >> a >> b;
cout << min(n * a, n * b);
return 0;
} | #include <bits/stdc++.h>
#define LL long long
#define fi first
#define se second
#define mp make_pair
#define pb push_back
using namespace std;
LL gcd(LL a, LL b) { return b ? gcd(b, a % b) : a; }
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; }
LL powmod(LL a, LL b, LL MOD) {
LL ans = 1;
while (b) {
if (b % 2)
ans = ans * a % MOD;
a = a * a % MOD;
b /= 2;
}
return ans;
}
const int N = 2e5 + 11;
int main() {
ios::sync_with_stdio(false);
int n, a, b;
cin >> n >> a >> b;
cout << min(n * a, b);
return 0;
} | [
"expression.operation.binary.remove"
] | 785,630 | 785,631 | u862237347 | cpp |
p02981 | #include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
int main() {
long long a, b, c;
std::cin >> a >> b >> c;
long long ret = b > c ? c : b;
ret = ret * a;
std::cout << ret << std::endl;
} | #include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
int main() {
long long a, b, c;
std::cin >> a >> b >> c;
long long ret = b * a > c ? c : b * a;
std::cout << ret << std::endl;
} | [
"assignment.change"
] | 785,633 | 785,634 | u750215086 | cpp |
p02981 | #include <bits/stdc++.h>
#define FOR(i, l, r) for (int i = (l), i##R = (r); i <= i##R; i++)
#define DOR(i, r, l) for (int i = (r), i##L = (l); i >= i##L; i--)
#define loop(i, n) for (int i = 0, i##R = (n); i < i##R; i++)
#define sf scanf
#define pf printf
#define mms(a, x) memset(a, x, sizeof a)
using namespace std;
typedef long long ll;
template <typename A, typename B> inline void chkmax(A &x, const B y) {
if (x < y)
x = y;
}
template <typename A, typename B> inline void chkmin(A &x, const B y) {
if (x > y)
x = y;
}
int main() {
int n, a, b;
sf("%d%d%d", &n, &a, &b);
pf("%d\n", min(a, b) * n);
return 0;
} | #include <bits/stdc++.h>
#define FOR(i, l, r) for (int i = (l), i##R = (r); i <= i##R; i++)
#define DOR(i, r, l) for (int i = (r), i##L = (l); i >= i##L; i--)
#define loop(i, n) for (int i = 0, i##R = (n); i < i##R; i++)
#define sf scanf
#define pf printf
#define mms(a, x) memset(a, x, sizeof a)
using namespace std;
typedef long long ll;
template <typename A, typename B> inline void chkmax(A &x, const B y) {
if (x < y)
x = y;
}
template <typename A, typename B> inline void chkmin(A &x, const B y) {
if (x > y)
x = y;
}
int main() {
int n, a, b;
sf("%d%d%d", &n, &a, &b);
pf("%d\n", min(a * n, b));
return 0;
} | [
"expression.operation.binary.remove"
] | 785,635 | 785,636 | u753002569 | cpp |
p02981 | //* AuThOr GaRyMr *//
#include <bits/stdc++.h>
#define rb(a, b, c) for (int a = b; a <= c; ++a)
#define rl(a, b, c) for (int a = b; a >= c; --a)
#define niv vector<int>
#define LL long long
#define IT iterator
#define PB(a) push_back(a)
#define II(a, b) make_pair(a, b)
#define FIR first
#define SEC second
using namespace std;
const int INF = 0x3f3f3f3f;
typedef pair<int, int> mp;
typedef pair<mp, mp> superpair;
int main() {
int n, a, b;
cin >> n >> a >> b;
cout << min(a * n, b * n);
return 0;
} | //* AuThOr GaRyMr *//
#include <bits/stdc++.h>
#define rb(a, b, c) for (int a = b; a <= c; ++a)
#define rl(a, b, c) for (int a = b; a >= c; --a)
#define niv vector<int>
#define LL long long
#define IT iterator
#define PB(a) push_back(a)
#define II(a, b) make_pair(a, b)
#define FIR first
#define SEC second
using namespace std;
const int INF = 0x3f3f3f3f;
typedef pair<int, int> mp;
typedef pair<mp, mp> superpair;
int main() {
int n, a, b;
cin >> n >> a >> b;
cout << min(a * n, b);
return 0;
} | [
"expression.operation.binary.remove"
] | 785,639 | 785,640 | u751730221 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> P3;
typedef pair<P, P> PP;
constexpr ll MOD = ll(1e9) + 7;
constexpr int IINF = INT_MAX;
constexpr ll LLINF = LLONG_MAX;
constexpr int MAX_N = int(1e6) + 5;
constexpr double EPS = 1e-9;
constexpr int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i > 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define ALL(v) (v).begin(), (v).end()
int main() {
int n, a, b;
cin >> n >> a >> b;
cout << (a * n, b) << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> P3;
typedef pair<P, P> PP;
constexpr ll MOD = ll(1e9) + 7;
constexpr int IINF = INT_MAX;
constexpr ll LLINF = LLONG_MAX;
constexpr int MAX_N = int(1e6) + 5;
constexpr double EPS = 1e-9;
constexpr int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i > 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define ALL(v) (v).begin(), (v).end()
int main() {
int n, a, b;
cin >> n >> a >> b;
cout << min(a * n, b) << endl;
return 0;
}
| [
"call.add"
] | 785,643 | 785,644 | u271063202 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define eb emplace_back
typedef long long ll;
const int INF = 1e9;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int N, a, b;
cin >> N >> a >> b;
cout << N * min(a, b) << endl;
}
| #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define eb emplace_back
typedef long long ll;
const int INF = 1e9;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int N, a, b;
cin >> N >> a >> b;
cout << min(N * a, b) << endl;
}
| [
"expression.operation.binary.remove"
] | 785,645 | 785,646 | u874610744 | cpp |
p02981 | #include <iostream>
using namespace std;
int main() {
int n, a, b;
cin >> n >> a >> b;
cout << n * min(a, b) << endl;
return 0;
}
| #include <iostream>
using namespace std;
int main() {
int n, a, b;
cin >> n >> a >> b;
cout << min(n * a, b) << endl;
return 0;
}
| [
"expression.operation.binary.remove"
] | 785,647 | 785,648 | u535008646 | cpp |
p02974 | #include <bits/stdc++.h>
#define owo(i, a, b) for (int i = (a); i < (b); ++i)
#define uwu(i, a, b) for (int i = (a)-1; i >= (b); --i)
#define senpai push_back
#define ttgl pair<int, int>
#define ayaya cout << "ayaya~" << endl
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
gp_hash_table<int, int> mp;*/
using ll = long long;
using ld = long double;
const ll MOD = 998244353;
const ll root = 62;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
ll binpow(ll a, ll b) {
ll res = 1;
while (b) {
if (b & 1)
res = (res * a) % MOD;
a = (a * a) % MOD;
b >>= 1;
}
return res;
}
ll modInv(ll a) { return binpow(a, MOD - 2); }
const double PI = acos(-1);
const double eps = -1e6;
const int INF = 0x3f3f3f3f;
const int NINF = 0xc0c0c0c0;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll NINFLL = 0xc0c0c0c0c0c0c0c0;
const int mxN = 51;
ll dp[mxN][mxN][mxN * mxN + 101];
int n, m;
int main() {
// freopen("file.in", "r", stdin);
// freopen("file.out", "w", stdout);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
cin.tie(0)->sync_with_stdio(0);
cin >> n >> m;
dp[0][0][0] = 1;
owo(i, 0, n) {
owo(j, 0, i + 1) {
owo(k, 0, m + 1) {
// pair the next ones
dp[i + 1][j][k + 2 * j] = (dp[i + 1][j][k + 2 * j] + dp[i][j][k]) % MOD;
// pair one of them backwards
dp[i + 1][j][k + 2 * j] =
(dp[i + 1][j][k + 2 * j] + 2 * j * dp[i][j][k]) % MOD;
// pair them both backwards
if (j > 0) {
dp[i + 1][j - 1][k + 2 * j] =
(dp[i + 1][j - 1][k + 2 * j] + j * j * dp[i][j][k]) % MOD;
}
// pair them both fowards
dp[i + 1][j + 1][k + 2 * j] =
(dp[i + 1][j + 1][k + 2 * j] + dp[i][j][k]) % MOD;
}
}
}
cout << dp[n][0][m] << "\n";
return 0;
}
| #include <bits/stdc++.h>
#define owo(i, a, b) for (int i = (a); i < (b); ++i)
#define uwu(i, a, b) for (int i = (a)-1; i >= (b); --i)
#define senpai push_back
#define ttgl pair<int, int>
#define ayaya cout << "ayaya~" << endl
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
gp_hash_table<int, int> mp;*/
using ll = long long;
using ld = long double;
const ll MOD = 1000000007;
const ll root = 62;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
ll binpow(ll a, ll b) {
ll res = 1;
while (b) {
if (b & 1)
res = (res * a) % MOD;
a = (a * a) % MOD;
b >>= 1;
}
return res;
}
ll modInv(ll a) { return binpow(a, MOD - 2); }
const double PI = acos(-1);
const double eps = -1e6;
const int INF = 0x3f3f3f3f;
const int NINF = 0xc0c0c0c0;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll NINFLL = 0xc0c0c0c0c0c0c0c0;
const int mxN = 51;
ll dp[mxN][mxN][mxN * mxN + 101];
int n, m;
int main() {
// freopen("file.in", "r", stdin);
// freopen("file.out", "w", stdout);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
cin.tie(0)->sync_with_stdio(0);
cin >> n >> m;
dp[0][0][0] = 1;
owo(i, 0, n) {
owo(j, 0, i + 1) {
owo(k, 0, m + 1) {
// pair the next ones
dp[i + 1][j][k + 2 * j] = (dp[i + 1][j][k + 2 * j] + dp[i][j][k]) % MOD;
// pair one of them backwards and one fowards
dp[i + 1][j][k + 2 * j] =
(dp[i + 1][j][k + 2 * j] + 2 * j * dp[i][j][k]) % MOD;
// pair them both backwards
if (j > 0) {
dp[i + 1][j - 1][k + 2 * j] =
(dp[i + 1][j - 1][k + 2 * j] + j * j * dp[i][j][k]) % MOD;
}
// pair them both fowards
dp[i + 1][j + 1][k + 2 * j] =
(dp[i + 1][j + 1][k + 2 * j] + dp[i][j][k]) % MOD;
// cout<<i<<" "<<j<<" "<<k<<" "<<dp[i][j][k]<<"\n";
}
}
}
cout << dp[n][0][m] << "\n";
return 0;
}
| [
"literal.number.change",
"variable_declaration.value.change"
] | 785,653 | 785,652 | u532199771 | cpp |
p02974 | #include <iostream>
using namespace std;
long mod = 1e9 + 7, dp[51][51][2505];
int N, K;
main() {
cin >> N >> K;
if (K % 2 == 1) {
cout << 0 << '\n';
return 0;
}
K /= 2;
dp[0][0][0] = 1;
for (int i = 0; i < N; i++)
for (int j = 0; j <= i; j++) {
for (int k = 0; k <= K - j + 2; k++) {
if (dp[i][j][k] == 0)
continue;
(dp[i + 1][j][k + j] += dp[i][j][k] * (2 * j + 1) % mod) %= mod;
if (j > 0)
(dp[i + 1][j - 1][k + j - 1] += dp[i][j][k] * j * j % mod) %= mod;
(dp[i + 1][j + 1][k + j + 1] += dp[i][j][k]) %= mod;
}
}
cout << dp[N][0][K / 2] << endl;
}
| #include <iostream>
using namespace std;
long mod = 1e9 + 7, dp[51][51][2505];
int N, K;
main() {
cin >> N >> K;
if (K % 2 == 1) {
cout << 0 << '\n';
return 0;
}
K /= 2;
dp[0][0][0] = 1;
for (int i = 0; i < N; i++)
for (int j = 0; j <= i; j++) {
for (int k = 0; k <= K - j + 2; k++) {
if (dp[i][j][k] == 0)
continue;
(dp[i + 1][j][k + j] += dp[i][j][k] * (2 * j + 1) % mod) %= mod;
if (j > 0)
(dp[i + 1][j - 1][k + j - 1] += dp[i][j][k] * j * j % mod) %= mod;
(dp[i + 1][j + 1][k + j + 1] += dp[i][j][k]) %= mod;
}
}
cout << dp[N][0][K] << endl;
}
| [
"expression.operation.binary.remove"
] | 785,660 | 785,661 | u478275206 | cpp |
p02974 | #include <bits/stdc++.h>
using namespace std;
#define N 50 + 5
#define M 2500 + 5
#define Mod 1000000007
#define rep(i, l, r) for (int i = l; i <= r; ++i)
int n, m, dp[N][N][M];
int read() {
char c;
int x = 0, f = 1;
c = getchar();
while (c > '9' || c < '0') {
if (c == '-')
f = -1;
c = getchar();
}
while (c >= '0' && c <= '9')
x = x * 10 + c - '0', c = getchar();
return x * f;
}
int Inc(int a, int b) { return (a += b) >= Mod ? a - Mod : a; }
int Mul(int a, int b) { return 1ll * a * b % Mod; }
int main() {
n = read(), m = read();
if (m & 1) {
puts("");
return 0;
}
m >>= 1;
dp[1][0][0] = dp[1][1][0] = 1;
rep(i, 2, n) rep(j, 0, i) rep(k, 0, m) {
if (k >= j)
dp[i][j][k] = Inc(dp[i][j][k], dp[i - 1][j][k - j]);
if (k >= j && j >= 1)
dp[i][j][k] = Inc(dp[i][j][k], Mul(dp[i - 1][j][k - j], j));
if (k >= j + 1)
dp[i][j][k] = Inc(dp[i][j][k],
Mul(dp[i - 1][j + 1][k - (j + 1)], Mul(j + 1, j + 1)));
if (j >= 1 && k >= j - 1)
dp[i][j][k] = Inc(dp[i][j][k], dp[i - 1][j - 1][k - (j - 1)]);
if (k >= j && j >= 1)
dp[i][j][k] = Inc(dp[i][j][k], Mul(dp[i - 1][j][k - j], j));
}
printf("%d", dp[n][0][m]);
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define N 50 + 5
#define M 2500 + 5
#define Mod 1000000007
#define rep(i, l, r) for (int i = l; i <= r; ++i)
int n, m, dp[N][N][M];
int read() {
char c;
int x = 0, f = 1;
c = getchar();
while (c > '9' || c < '0') {
if (c == '-')
f = -1;
c = getchar();
}
while (c >= '0' && c <= '9')
x = x * 10 + c - '0', c = getchar();
return x * f;
}
int Inc(int a, int b) { return (a += b) >= Mod ? a - Mod : a; }
int Mul(int a, int b) { return 1ll * a * b % Mod; }
int main() {
n = read(), m = read();
if (m & 1) {
puts("0");
return 0;
}
m >>= 1;
dp[1][0][0] = dp[1][1][0] = 1;
rep(i, 2, n) rep(j, 0, i) rep(k, 0, m) {
if (k >= j)
dp[i][j][k] = Inc(dp[i][j][k], dp[i - 1][j][k - j]);
if (k >= j && j >= 1)
dp[i][j][k] = Inc(dp[i][j][k], Mul(dp[i - 1][j][k - j], j));
if (k >= j + 1)
dp[i][j][k] = Inc(dp[i][j][k],
Mul(dp[i - 1][j + 1][k - (j + 1)], Mul(j + 1, j + 1)));
if (j >= 1 && k >= j - 1)
dp[i][j][k] = Inc(dp[i][j][k], dp[i - 1][j - 1][k - (j - 1)]);
if (k >= j && j >= 1)
dp[i][j][k] = Inc(dp[i][j][k], Mul(dp[i - 1][j][k - j], j));
}
printf("%d", dp[n][0][m]);
return 0;
} | [
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 785,662 | 785,663 | u220214337 | cpp |
p02974 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
const int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <typename T> T gcd(T a, T b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
template <typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template <typename T> T pow(T a, int b) {
return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1;
}
ll modpow(ll a, ll b, ll _mod) {
return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1;
}
template <class T> ostream &operator<<(ostream &os, const vector<T> &vec) {
for (auto &vi : vec)
os << vi << " ";
return os;
}
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
os << p.F << " " << p.S;
return os;
}
template <typename T> inline istream &operator>>(istream &is, vector<T> &v) {
rep(j, sz(v)) is >> v[j];
return is;
}
template <class T> inline void add(T &a, int b) {
a += b;
if (a >= mod)
a -= mod;
}
void solve();
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cout << fixed << setprecision(10);
int T;
// cin >> T;
T = 1;
while (T--) {
solve();
}
}
// https://drken1215.hatenablog.com/entry/2019/10/05/173700
// https://www.youtube.com/watch?v=-o4r74eJzV4
// i 段目, j 個残してる, 奇妙さ
int dp[55][55][55 * 55];
void solve() {
int n, K;
cin >> n >> K;
// |i - pi| は, 1 ずつ繰り越していく
dp[0][0][0] = 1;
rep(i, n) rep(j, i + 1) rep(k, K * K + 1) {
// 横と結ぶ
// 残ってる j 分, 奇妙さを 1 繰越す
add(dp[i + 1][j][k + j * 2], dp[i][j][k]);
// 下, 下
// 自分も含めて奇妙さを 1 繰越す
add(dp[i + 1][j + 1][k + (j + 1) * 2], dp[i][j][k]);
// 上, 下
// 片方を上と結んでも保留の個数は変わらない
// 下と結ぶ方は i 個目が保留だが, 上のどこかが結ばれる
// dp[i][j][k] * j*2 : 上と結ぶ方は j 通りの選択肢があり,
// どっちを上と結ぶ方にするかの *2
add(dp[i + 1][j][k + j * 2], 1LL * dp[i][j][k] * j * 2 % mod);
// 上, 上
// 減った 1 つ分以外奇妙さ 1 繰り越し
// 選ぶ候補は残ってる j 個ずつ
if (j - 1 >= 0)
add(dp[i + 1][j - 1][k + (j - 1) * 2], 1LL * dp[i][j][k] * j * j % mod);
}
cout << dp[n][0][K] << endl;
/*
rep(i, n + 1) {
cout << endl;
rep(j, i + 1) { rep(k, K + 1) cout << dp[i][j][k] << " "; cout << endl; }
}
*/
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
const int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <typename T> T gcd(T a, T b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
template <typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template <typename T> T pow(T a, int b) {
return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1;
}
ll modpow(ll a, ll b, ll _mod) {
return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1;
}
template <class T> ostream &operator<<(ostream &os, const vector<T> &vec) {
for (auto &vi : vec)
os << vi << " ";
return os;
}
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
os << p.F << " " << p.S;
return os;
}
template <typename T> inline istream &operator>>(istream &is, vector<T> &v) {
rep(j, sz(v)) is >> v[j];
return is;
}
template <class T> inline void add(T &a, int b) {
a += b;
if (a >= mod)
a -= mod;
}
void solve();
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cout << fixed << setprecision(10);
int T;
// cin >> T;
T = 1;
while (T--) {
solve();
}
}
// https://drken1215.hatenablog.com/entry/2019/10/05/173700
// https://www.youtube.com/watch?v=-o4r74eJzV4
// i 段目, j 個残してる, 奇妙さ
int dp[55][55][55 * 55];
void solve() {
int n, K;
cin >> n >> K;
// |i - pi| は, 1 ずつ繰り越していく
dp[0][0][0] = 1;
rep(i, n) rep(j, i + 1) rep(k, K + 1) { // debuged, K*K to K
// 横と結ぶ
// 残ってる j 分, 奇妙さを 1 繰越す
add(dp[i + 1][j][k + j * 2], dp[i][j][k]);
// 下, 下
// 自分も含めて奇妙さを 1 繰越す
add(dp[i + 1][j + 1][k + (j + 1) * 2], dp[i][j][k]);
// 上, 下
// 片方を上と結んでも保留の個数は変わらない
// 下と結ぶ方は i 個目が保留だが, 上のどこかが結ばれる
// dp[i][j][k] * j*2 : 上と結ぶ方は j 通りの選択肢があり,
// どっちを上と結ぶ方にするかの *2
add(dp[i + 1][j][k + j * 2], 1LL * dp[i][j][k] * j * 2 % mod);
// 上, 上
// 減った 1 つ分以外奇妙さ 1 繰り越し
// 選ぶ候補は残ってる j 個ずつ
if (j - 1 >= 0)
add(dp[i + 1][j - 1][k + (j - 1) * 2], 1LL * dp[i][j][k] * j * j % mod);
}
cout << dp[n][0][K] << endl;
/*
rep(i, n + 1) {
cout << endl;
rep(j, i + 1) { rep(k, K + 1) cout << dp[i][j][k] << " "; cout << endl; }
}
*/
}
| [
"expression.operation.binary.remove"
] | 785,668 | 785,669 | u277556971 | cpp |
p02974 | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
#define pb push_back
#define mp make_pair
#define taskname "A"
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
const int maxn = 50 + 5;
const int mod = 1e9 + 7;
int f[maxn][maxn][maxn * maxn * 2];
int n, k;
void add(int &x, int y) {
x += y;
if (x >= mod)
x -= mod;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
if (fopen(taskname ".INP", "r")) {
freopen(taskname ".INP", "r", stdin);
freopen(taskname ".OUT", "w", stdout);
}
cin >> n >> k;
f[0][0][maxn * maxn] = 1;
for (int i = 0; i < n; ++i) {
for (int j = 0; j <= n; ++j) {
for (int k = 0; k <= n * n * 2; ++k) {
if (f[i][j][k] == 0)
continue;
add(f[i + 1][j][k], (ll)f[i][j][k] * (2 * j + 1) % mod);
add(f[i + 1][j + 1][k - 2 * (i + 1)], f[i][j][k]);
if (j >= 0) {
add(f[i + 1][j - 1][k + 2 * (i + 1)], (ll)f[i][j][k] * j * j % mod);
}
}
}
}
cout << f[n][0][maxn * maxn + k];
}
| #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
#define pb push_back
#define mp make_pair
#define taskname "A"
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
const int maxn = 50 + 5;
const int mod = 1e9 + 7;
int f[maxn][maxn][maxn * maxn * 2];
int n, k;
void add(int &x, int y) {
x += y;
if (x >= mod)
x -= mod;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
if (fopen(taskname ".INP", "r")) {
freopen(taskname ".INP", "r", stdin);
freopen(taskname ".OUT", "w", stdout);
}
cin >> n >> k;
f[0][0][maxn * maxn] = 1;
for (int i = 0; i < n; ++i) {
for (int j = 0; j <= n; ++j) {
for (int k = 0; k < maxn * maxn * 2; ++k) {
if (f[i][j][k] == 0)
continue;
add(f[i + 1][j][k], (ll)f[i][j][k] * (2 * j + 1) % mod);
add(f[i + 1][j + 1][k - 2 * (i + 1)], f[i][j][k]);
if (j >= 0) {
add(f[i + 1][j - 1][k + 2 * (i + 1)], (ll)f[i][j][k] * j * j % mod);
}
}
}
}
cout << f[n][0][maxn * maxn + k];
}
| [
"control_flow.loop.for.condition.change",
"identifier.change",
"expression.operation.binary.change"
] | 785,670 | 785,671 | u368329754 | cpp |
p02974 | #include <bits/stdc++.h>
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for (ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) ((x).begin(), (x).end())
using namespace std;
using ll = long long;
template <typename T> using V = vector<T>;
constexpr int Mod = 998244353;
constexpr int mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;
template <typename T> constexpr bool chmax(T &a, const T &b) {
if (a >= b)
return false;
a = b;
return true;
}
template <typename T> constexpr bool chmin(T &a, const T &b) {
if (a <= b)
return false;
a = b;
return true;
}
/*-------------------------------------------*/
template <int M> class ModInt {
int x;
public:
constexpr ModInt() : x(0) {}
constexpr ModInt(int64_t y) : x(y >= 0 ? y % M : (M - (-y) % M) % M) {}
constexpr ModInt &operator+=(const ModInt &p) {
if ((x += p.x) >= M)
x -= M;
return *this;
}
constexpr ModInt &operator-=(const ModInt &p) {
if ((x += M - p.x) >= M)
x -= M;
return *this;
}
constexpr ModInt &operator*=(const ModInt &p) {
x = (int)(1LL * x * p.x % M);
return *this;
}
constexpr ModInt &operator/=(const ModInt &p) {
*this *= p.inverse();
return *this;
}
constexpr ModInt operator-() const { return ModInt(-x); }
constexpr ModInt operator+(const ModInt &p) const {
return ModInt(*this) += p;
}
constexpr ModInt operator-(const ModInt &p) const {
return ModInt(*this) -= p;
}
constexpr ModInt operator*(const ModInt &p) const {
return ModInt(*this) *= p;
}
constexpr ModInt operator/(const ModInt &p) const {
return ModInt(*this) /= p;
}
constexpr bool operator==(const ModInt &p) const { return x == p.x; }
constexpr bool operator!=(const ModInt &p) const { return x != p.x; }
constexpr ModInt inverse() const {
int a = x, b = M, u = 1, v = 0, t = 0;
while (b > 0) {
t = a / b;
swap(a -= t * b, b);
swap(u -= t * v, v);
}
return ModInt(u);
}
constexpr ModInt pow(const int64_t &n) const {
ModInt ret(1), mul(x);
int64_t k = n % (M - 1);
if (k < 0)
k += M - 1;
while (k > 0) {
if (k & 1)
ret *= mul;
mul *= mul;
k >>= 1;
}
return ret;
}
constexpr friend ostream &operator<<(ostream &os, const ModInt &p) {
return os << p.x;
}
constexpr friend istream &operator>>(istream &is, ModInt &a) {
int64_t t = 0;
is >> t;
a = ModInt(t);
return (is);
}
};
using modint = ModInt<mod>;
int main() {
cin.tie(0);
ios::sync_with_stdio(0);
int n, k;
cin >> n >> k;
V<V<V<modint>>> dp(n + 1, V<V<modint>>(n, V<modint>(k + 1)));
dp[0][0][0] = 1;
rep(i, n) rep(j, n) FOR(l, j * 2, k + 1) {
dp[i + 1][j][l] = dp[i][j][l - 2 * j] * (2 * j + 1);
dp[i + 1][j][l] += dp[i][j + 1][l - 2 * j] * (j + 1) * (j + 1);
if (j)
dp[i + 1][j][l] += dp[i][j - 1][l - 2 * j];
}
cout << dp[n][0][k] << endl;
return 0;
} | #include <bits/stdc++.h>
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for (ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) ((x).begin(), (x).end())
using namespace std;
using ll = long long;
template <typename T> using V = vector<T>;
constexpr int Mod = 998244353;
constexpr int mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;
template <typename T> constexpr bool chmax(T &a, const T &b) {
if (a >= b)
return false;
a = b;
return true;
}
template <typename T> constexpr bool chmin(T &a, const T &b) {
if (a <= b)
return false;
a = b;
return true;
}
/*-------------------------------------------*/
template <int M> class ModInt {
int x;
public:
constexpr ModInt() : x(0) {}
constexpr ModInt(int64_t y) : x(y >= 0 ? y % M : (M - (-y) % M) % M) {}
constexpr ModInt &operator+=(const ModInt &p) {
if ((x += p.x) >= M)
x -= M;
return *this;
}
constexpr ModInt &operator-=(const ModInt &p) {
if ((x += M - p.x) >= M)
x -= M;
return *this;
}
constexpr ModInt &operator*=(const ModInt &p) {
x = (int)(1LL * x * p.x % M);
return *this;
}
constexpr ModInt &operator/=(const ModInt &p) {
*this *= p.inverse();
return *this;
}
constexpr ModInt operator-() const { return ModInt(-x); }
constexpr ModInt operator+(const ModInt &p) const {
return ModInt(*this) += p;
}
constexpr ModInt operator-(const ModInt &p) const {
return ModInt(*this) -= p;
}
constexpr ModInt operator*(const ModInt &p) const {
return ModInt(*this) *= p;
}
constexpr ModInt operator/(const ModInt &p) const {
return ModInt(*this) /= p;
}
constexpr bool operator==(const ModInt &p) const { return x == p.x; }
constexpr bool operator!=(const ModInt &p) const { return x != p.x; }
constexpr ModInt inverse() const {
int a = x, b = M, u = 1, v = 0, t = 0;
while (b > 0) {
t = a / b;
swap(a -= t * b, b);
swap(u -= t * v, v);
}
return ModInt(u);
}
constexpr ModInt pow(const int64_t &n) const {
ModInt ret(1), mul(x);
int64_t k = n % (M - 1);
if (k < 0)
k += M - 1;
while (k > 0) {
if (k & 1)
ret *= mul;
mul *= mul;
k >>= 1;
}
return ret;
}
constexpr friend ostream &operator<<(ostream &os, const ModInt &p) {
return os << p.x;
}
constexpr friend istream &operator>>(istream &is, ModInt &a) {
int64_t t = 0;
is >> t;
a = ModInt(t);
return (is);
}
};
using modint = ModInt<mod>;
int main() {
cin.tie(0);
ios::sync_with_stdio(0);
int n, k;
cin >> n >> k;
V<V<V<modint>>> dp(n + 1, V<V<modint>>(n + 1, V<modint>(k + 1)));
dp[0][0][0] = 1;
rep(i, n) rep(j, n) FOR(l, j * 2, k + 1) {
dp[i + 1][j][l] = dp[i][j][l - 2 * j] * (2 * j + 1);
dp[i + 1][j][l] += dp[i][j + 1][l - 2 * j] * (j + 1) * (j + 1);
if (j)
dp[i + 1][j][l] += dp[i][j - 1][l - 2 * j];
}
cout << dp[n][0][k] << endl;
return 0;
} | [
"assignment.change"
] | 785,674 | 785,675 | u047554023 | cpp |
p02974 | #include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define MOD (1000000007)
using namespace std;
typedef long long int Int;
constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n - 1); }
const int max_n = 55;
Int dp[max_n][max_n][max_n * max_n];
int main(void) {
Int n, k;
cin >> n >> k;
dp[0][0][0] = 1;
if (k & 1) {
cout << 0 << endl;
}
for (Int i = 0; i < n; i++) {
for (Int j = 0; j < i + 1; j++) {
for (Int s = 0; s < k / 2 + 1; s++) {
Int nj;
// both connect
nj = j;
dp[i + 1][nj][s + nj] += dp[i][j][s];
dp[i + 1][nj][s + nj] %= MOD;
// both rest
nj = j + 1;
dp[i + 1][nj][s + nj] += dp[i][j][s];
dp[i + 1][nj][s + nj] %= MOD;
// connect one side
nj = j;
Int x = j * 2;
dp[i + 1][nj][s + nj] += dp[i][j][s] * x % MOD;
dp[i + 1][nj][s + nj] %= MOD;
if (j > 0) {
Int nj = j - 1;
Int x = j * j;
dp[i + 1][nj][s + nj] += dp[i][j][s] * x % MOD;
dp[i + 1][nj][s + nj] %= MOD;
}
}
}
}
cout << dp[n][0][k / 2] % MOD << endl;
return 0;
}
| #include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define MOD (1000000007)
using namespace std;
typedef long long int Int;
constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n - 1); }
const int max_n = 60;
Int dp[max_n][max_n][max_n * max_n];
int main(void) {
Int n, k;
cin >> n >> k;
dp[0][0][0] = 1;
if (k & 1) {
cout << 0 << endl;
return 0;
}
for (Int i = 0; i < n; i++) {
for (Int j = 0; j < i + 1; j++) {
for (Int s = 0; s < k / 2 + 1; s++) {
Int nj;
// both connect
nj = j;
dp[i + 1][nj][s + nj] += dp[i][j][s];
dp[i + 1][nj][s + nj] %= MOD;
// both rest
nj = j + 1;
dp[i + 1][nj][s + nj] += dp[i][j][s];
dp[i + 1][nj][s + nj] %= MOD;
// connect one side
nj = j;
Int x = j * 2;
dp[i + 1][nj][s + nj] += dp[i][j][s] * x % MOD;
dp[i + 1][nj][s + nj] %= MOD;
if (j > 0) {
Int nj = j - 1;
Int x = j * j;
dp[i + 1][nj][s + nj] += dp[i][j][s] * x % MOD;
dp[i + 1][nj][s + nj] %= MOD;
}
}
}
}
cout << dp[n][0][k / 2] % MOD << endl;
return 0;
}
| [
"literal.number.change",
"variable_declaration.value.change",
"control_flow.return.add",
"control_flow.return.0.add"
] | 785,678 | 785,677 | u498141549 | cpp |
p02974 | #include <bits/stdc++.h>
using namespace std;
// Define
using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <class T> using pvector = vector<pair<T, T>>;
template <class T>
using rpriority_queue = priority_queue<T, vector<T>, greater<T>>;
constexpr const ll dx[4] = {1, 0, -1, 0};
constexpr const ll dy[4] = {0, 1, 0, -1};
constexpr const ll MOD = 1e9 + 7;
constexpr const ll mod = 998244353;
constexpr const ll INF = 1LL << 60;
constexpr const ll inf = 1 << 30;
constexpr const char rt = '\n';
constexpr const char sp = ' ';
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define elif else if
#define all(a, v, ...) \
([&](decltype((v)) w) { return (a)(begin(w), end(w), ##__VA_ARGS__); })(v)
#define rall(a, v, ...) \
([&](decltype((v)) w) { return (a)(rbegin(w), rend(w), ##__VA_ARGS__); })(v)
#define fi first
#define se second
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, const T &b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
// Debug
#define debug(...) \
{ \
cerr << __LINE__ << ": " << #__VA_ARGS__ << " = "; \
for (auto &&X : {__VA_ARGS__}) \
cerr << "[" << X << "] "; \
cerr << rt; \
}
#define dump(a, h, w) \
{ \
cerr << __LINE__ << ": " << #a << " = [" << rt; \
rep(_i, h) { \
rep(_j, w) cerr << a[_i][3000 - 9 + _j] << sp; \
cerr << rt; \
} \
cerr << "]" << rt; \
}
#define vdump(a, n) \
{ \
cerr << __LINE__ << ": " << #a << " = ["; \
rep(_i, n) if (_i) cerr << sp << a[_i]; \
else cerr << a[_i]; \
cerr << "]" << rt; \
}
// Loop
#define inc(i, a, n) for (ll i = (a), _##i = (n); i <= _##i; ++i)
#define dec(i, a, n) for (ll i = (a), _##i = (n); i >= _##i; --i)
#define rep(i, n) for (ll i = 0, _##i = (n); i < _##i; ++i)
#define each(i, a) for (auto &&i : a)
// Stream
#define fout(n) cout << fixed << setprecision(n)
struct io {
io() { cin.tie(nullptr), ios::sync_with_stdio(false); }
} io;
// Speed
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// Math
inline constexpr ll gcd(const ll a, const ll b) {
return b ? gcd(b, a % b) : a;
}
inline constexpr ll lcm(const ll a, const ll b) { return a / gcd(a, b) * b; }
inline constexpr ll modulo(const ll n, const ll m = MOD) {
ll k = n % m;
return k + m * (k < 0);
}
inline constexpr ll chmod(ll &n, const ll m = MOD) {
n %= m;
return n += m * (n < 0);
}
inline constexpr ll mpow(ll a, ll n, const ll m = MOD) {
ll r = 1;
rep(i, 64) {
if (n & (1LL << i))
r *= a;
chmod(r, m);
a *= a;
chmod(a, m);
}
return r;
}
inline ll inv(const ll n, const ll m = MOD) {
ll a = n, b = m, x = 1, y = 0;
while (b) {
ll t = a / b;
a -= t * b;
swap(a, b);
x -= t * y;
swap(x, y);
}
return modulo(x, m);
}
ll DP[51][51][6000];
signed main() {
ll N, K;
cin >> N >> K;
DP[0][0][3000] = 1;
rep(i, N) rep(j, N + 1) rep(k, 6000) {
if (not DP[i][j][k])
continue;
{
DP[i + 1][j][k] += DP[i][j][k] * j;
DP[i + 1][j][k] %= MOD;
} // now -> space, stack -> remain
{
if (k + 2 * (i + 1) < 6000 and j >= 1) {
DP[i + 1][j - 1][k + 2 * (i + 1)] += DP[i][j][k] * j;
DP[i + 1][j - 1][k + 2 * (i + 1)] %= MOD;
}
} // now -> space, stack -> now
{
DP[i + 1][j][k] += DP[i][j][k];
DP[i + 1][j][k] %= MOD;
} // now -> now
{
if (k - 2 * (i + 1) >= 0 and j < N) {
DP[i + 1][j + 1][k - 2 * (i + 1)] += DP[i][j][k];
DP[i + 1][j + 1][k - 2 * (i + 1)] %= MOD;
}
} // now -> stack, stack -> remain
{
DP[i + 1][j][k] += DP[i][j][k] * j;
DP[i + 1][j][k] %= MOD;
} // now -> stack, stack -> now
}
cout << DP[N][0][3000 + K] << endl;
}
// -g -D_GLIBCXX_DEBUG -fsanitize=undefined
| #include <bits/stdc++.h>
using namespace std;
// Define
using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <class T> using pvector = vector<pair<T, T>>;
template <class T>
using rpriority_queue = priority_queue<T, vector<T>, greater<T>>;
constexpr const ll dx[4] = {1, 0, -1, 0};
constexpr const ll dy[4] = {0, 1, 0, -1};
constexpr const ll MOD = 1e9 + 7;
constexpr const ll mod = 998244353;
constexpr const ll INF = 1LL << 60;
constexpr const ll inf = 1 << 30;
constexpr const char rt = '\n';
constexpr const char sp = ' ';
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define elif else if
#define all(a, v, ...) \
([&](decltype((v)) w) { return (a)(begin(w), end(w), ##__VA_ARGS__); })(v)
#define rall(a, v, ...) \
([&](decltype((v)) w) { return (a)(rbegin(w), rend(w), ##__VA_ARGS__); })(v)
#define fi first
#define se second
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, const T &b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
// Debug
#define debug(...) \
{ \
cerr << __LINE__ << ": " << #__VA_ARGS__ << " = "; \
for (auto &&X : {__VA_ARGS__}) \
cerr << "[" << X << "] "; \
cerr << rt; \
}
#define dump(a, h, w) \
{ \
cerr << __LINE__ << ": " << #a << " = [" << rt; \
rep(_i, h) { \
rep(_j, w) cerr << a[_i][_j] << sp; \
cerr << rt; \
} \
cerr << "]" << rt; \
}
#define vdump(a, n) \
{ \
cerr << __LINE__ << ": " << #a << " = ["; \
rep(_i, n) if (_i) cerr << sp << a[_i]; \
else cerr << a[_i]; \
cerr << "]" << rt; \
}
// Loop
#define inc(i, a, n) for (ll i = (a), _##i = (n); i <= _##i; ++i)
#define dec(i, a, n) for (ll i = (a), _##i = (n); i >= _##i; --i)
#define rep(i, n) for (ll i = 0, _##i = (n); i < _##i; ++i)
#define each(i, a) for (auto &&i : a)
// Stream
#define fout(n) cout << fixed << setprecision(n)
struct io {
io() { cin.tie(nullptr), ios::sync_with_stdio(false); }
} io;
// Speed
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// Math
inline constexpr ll gcd(const ll a, const ll b) {
return b ? gcd(b, a % b) : a;
}
inline constexpr ll lcm(const ll a, const ll b) { return a / gcd(a, b) * b; }
inline constexpr ll modulo(const ll n, const ll m = MOD) {
ll k = n % m;
return k + m * (k < 0);
}
inline constexpr ll chmod(ll &n, const ll m = MOD) {
n %= m;
return n += m * (n < 0);
}
inline constexpr ll mpow(ll a, ll n, const ll m = MOD) {
ll r = 1;
rep(i, 64) {
if (n & (1LL << i))
r *= a;
chmod(r, m);
a *= a;
chmod(a, m);
}
return r;
}
inline ll inv(const ll n, const ll m = MOD) {
ll a = n, b = m, x = 1, y = 0;
while (b) {
ll t = a / b;
a -= t * b;
swap(a, b);
x -= t * y;
swap(x, y);
}
return modulo(x, m);
}
ll DP[51][51][6000];
signed main() {
ll N, K;
cin >> N >> K;
DP[0][0][3000] = 1;
rep(i, N) rep(j, N + 1) rep(k, 6000) {
if (not DP[i][j][k])
continue;
{
DP[i + 1][j][k] += DP[i][j][k] * j;
DP[i + 1][j][k] %= MOD;
} // now -> space, stack -> remain
{
if (k + 2 * (i + 1) < 6000 and j >= 1) {
DP[i + 1][j - 1][k + 2 * (i + 1)] += DP[i][j][k] * j * j;
DP[i + 1][j - 1][k + 2 * (i + 1)] %= MOD;
}
} // now -> space, stack -> now
{
DP[i + 1][j][k] += DP[i][j][k];
DP[i + 1][j][k] %= MOD;
} // now -> now
{
if (k - 2 * (i + 1) >= 0 and j < N) {
DP[i + 1][j + 1][k - 2 * (i + 1)] += DP[i][j][k];
DP[i + 1][j + 1][k - 2 * (i + 1)] %= MOD;
}
} // now -> stack, stack -> remain
{
DP[i + 1][j][k] += DP[i][j][k] * j;
DP[i + 1][j][k] %= MOD;
} // now -> stack, stack -> now
}
cout << DP[N][0][3000 + K] << endl;
}
// -g -D_GLIBCXX_DEBUG -fsanitize=undefined
| [
"assignment.change"
] | 785,679 | 785,680 | u398942100 | cpp |
p02974 | #include <array>
#include <bits/stdc++.h>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for (UL i = 0; i < (n); i++)
struct Problem {
static const ULL M = 1000000007;
UL dp[51][51][2500] = {};
void Solve() {
UL N, K;
cin >> N >> K;
if (K % 2 == 1) {
cout << 0 << endl;
return;
}
K /= 2;
dp[0][0][0] = 1;
for (UL n = 1; n <= N; n++) {
for (UL pk = 0; pk <= K; pk++) {
for (UL pl = 0; pl < n; pl++) {
if (pk + pl > K)
break;
dp[n][pl + 1][pk + pl] += dp[n - 1][pl][pk];
dp[n][pl][pk + pl] += dp[n - 1][pl][pk] * (2 * pl + 1);
if (pl)
dp[n][pl - 1][pk + pl] += dp[n - 1][pl][pk] * pl * pl;
}
}
rep(l, n + 1) rep(k, K + 1) dp[n][l][k] %= M;
}
cout << dp[N][0][K] << endl;
}
Problem();
};
int main() {
unique_ptr<Problem> p(new Problem());
p->Solve();
return 0;
}
Problem::Problem() { cout << fixed << setprecision(10); }
| #include <array>
#include <bits/stdc++.h>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for (UL i = 0; i < (n); i++)
struct Problem {
static const ULL M = 1000000007;
ULL dp[51][51][2500] = {};
void Solve() {
UL N, K;
cin >> N >> K;
if (K % 2 == 1) {
cout << 0 << endl;
return;
}
K /= 2;
dp[0][0][0] = 1;
for (UL n = 1; n <= N; n++) {
for (UL pk = 0; pk <= K; pk++) {
for (UL pl = 0; pl < n; pl++) {
if (pk + pl > K)
break;
dp[n][pl + 1][pk + pl] += dp[n - 1][pl][pk];
dp[n][pl][pk + pl] += dp[n - 1][pl][pk] * (2 * pl + 1);
if (pl)
dp[n][pl - 1][pk + pl] += dp[n - 1][pl][pk] * pl * pl;
}
}
rep(l, n + 1) rep(k, K + 1) dp[n][l][k] %= M;
}
cout << dp[N][0][K] << endl;
}
Problem();
};
int main() {
unique_ptr<Problem> p(new Problem());
p->Solve();
return 0;
}
Problem::Problem() { cout << fixed << setprecision(10); }
| [] | 785,681 | 785,682 | u331948661 | cpp |
p02974 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <uint_fast64_t Modulus> class modint {
using u64 = uint_fast64_t;
public:
u64 a;
constexpr modint(const u64 x = 0) noexcept
: a(((x % Modulus) + Modulus) % Modulus) {}
constexpr u64 &value() noexcept { return a; }
constexpr const u64 &value() const noexcept { return a; }
constexpr modint &operator+=(const modint &rhs) noexcept {
a += rhs.a;
if (a >= Modulus)
a -= Modulus;
return *this;
}
constexpr modint operator+(const modint &rhs) const noexcept {
return modint(*this) += rhs;
}
constexpr modint &operator++() noexcept { return ++a, *this; }
constexpr modint operator++(int) noexcept {
modint t = *this;
return ++a, t;
}
constexpr modint &operator-=(const modint &rhs) noexcept {
if (a < rhs.a)
a += Modulus;
a -= rhs.a;
return *this;
}
constexpr modint operator-(const modint &rhs) const noexcept {
return modint(*this) -= rhs;
}
constexpr modint &operator--() noexcept { return --a, *this; }
constexpr modint operator--(int) noexcept {
modint t = *this;
return --a, t;
}
constexpr modint &operator*=(const modint &rhs) noexcept {
a = a * rhs.a % Modulus;
return *this;
}
constexpr modint operator*(const modint &rhs) const noexcept {
return modint(*this) *= rhs;
}
constexpr modint &operator/=(modint rhs) noexcept {
u64 exp = Modulus - 2;
while (exp) {
if (exp & 1)
*this *= rhs;
rhs *= rhs;
exp >>= 1;
}
return *this;
}
constexpr modint operator/(const modint &rhs) const noexcept {
return modint(*this) /= rhs;
}
constexpr modint operator-() const noexcept { return modint(Modulus - a); }
constexpr bool operator==(const modint &rhs) const noexcept {
return a == rhs.a;
}
constexpr bool operator!=(const modint &rhs) const noexcept {
return a != rhs.a;
}
constexpr bool operator!() const noexcept { return !a; }
friend constexpr modint pow(modint rhs, long long exp) noexcept {
modint res{1};
while (exp) {
if (exp & 1)
res *= rhs;
rhs *= rhs;
exp >>= 1;
}
return res;
}
template <class T> friend constexpr modint operator+(T x, modint y) noexcept {
return modint(x) + y;
}
template <class T> friend constexpr modint operator-(T x, modint y) noexcept {
return modint(x) - y;
}
template <class T> friend constexpr modint operator*(T x, modint y) noexcept {
return modint(x) * y;
}
template <class T> friend constexpr modint operator/(T x, modint y) noexcept {
return modint(x) / y;
}
friend ostream &operator<<(ostream &s, const modint &rhs) noexcept {
return s << rhs.a;
}
friend istream &operator>>(istream &s, modint &rhs) noexcept {
u64 a;
rhs = modint{(s >> a, a)};
return s;
}
};
using mint = modint<MOD>;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int N, K;
cin >> N >> K;
mint dp[N + 1][N + 1][K + 1];
for (int i = 0; i < N + 1; ++i)
for (int j = 0; j < N + 1; ++j)
for (int k = 0; k < K + 1; ++k)
dp[i][j][k] = 0;
dp[0][0][0] = 1;
for (int i = 0; i < N; ++i) {
for (int j = 0; j < N + 1; ++j) {
for (int k = 0; j + k < K + 1; ++k) {
dp[i + 1][j][j + k] += dp[i][j][k] + dp[i][j][k] * j;
if (1 < j)
dp[i + 1][j - 2][j + k] += dp[i][j][k] * j * j / 4;
if (j < K - 1)
dp[i + 1][j + 2][j + k] += dp[i][j][k];
}
}
}
cout << dp[N][0][K] << endl;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <uint_fast64_t Modulus> class modint {
using u64 = uint_fast64_t;
public:
u64 a;
constexpr modint(const u64 x = 0) noexcept
: a(((x % Modulus) + Modulus) % Modulus) {}
constexpr u64 &value() noexcept { return a; }
constexpr const u64 &value() const noexcept { return a; }
constexpr modint &operator+=(const modint &rhs) noexcept {
a += rhs.a;
if (a >= Modulus)
a -= Modulus;
return *this;
}
constexpr modint operator+(const modint &rhs) const noexcept {
return modint(*this) += rhs;
}
constexpr modint &operator++() noexcept { return ++a, *this; }
constexpr modint operator++(int) noexcept {
modint t = *this;
return ++a, t;
}
constexpr modint &operator-=(const modint &rhs) noexcept {
if (a < rhs.a)
a += Modulus;
a -= rhs.a;
return *this;
}
constexpr modint operator-(const modint &rhs) const noexcept {
return modint(*this) -= rhs;
}
constexpr modint &operator--() noexcept { return --a, *this; }
constexpr modint operator--(int) noexcept {
modint t = *this;
return --a, t;
}
constexpr modint &operator*=(const modint &rhs) noexcept {
a = a * rhs.a % Modulus;
return *this;
}
constexpr modint operator*(const modint &rhs) const noexcept {
return modint(*this) *= rhs;
}
constexpr modint &operator/=(modint rhs) noexcept {
u64 exp = Modulus - 2;
while (exp) {
if (exp & 1)
*this *= rhs;
rhs *= rhs;
exp >>= 1;
}
return *this;
}
constexpr modint operator/(const modint &rhs) const noexcept {
return modint(*this) /= rhs;
}
constexpr modint operator-() const noexcept { return modint(Modulus - a); }
constexpr bool operator==(const modint &rhs) const noexcept {
return a == rhs.a;
}
constexpr bool operator!=(const modint &rhs) const noexcept {
return a != rhs.a;
}
constexpr bool operator!() const noexcept { return !a; }
friend constexpr modint pow(modint rhs, long long exp) noexcept {
modint res{1};
while (exp) {
if (exp & 1)
res *= rhs;
rhs *= rhs;
exp >>= 1;
}
return res;
}
template <class T> friend constexpr modint operator+(T x, modint y) noexcept {
return modint(x) + y;
}
template <class T> friend constexpr modint operator-(T x, modint y) noexcept {
return modint(x) - y;
}
template <class T> friend constexpr modint operator*(T x, modint y) noexcept {
return modint(x) * y;
}
template <class T> friend constexpr modint operator/(T x, modint y) noexcept {
return modint(x) / y;
}
friend ostream &operator<<(ostream &s, const modint &rhs) noexcept {
return s << rhs.a;
}
friend istream &operator>>(istream &s, modint &rhs) noexcept {
u64 a;
rhs = modint{(s >> a, a)};
return s;
}
};
using mint = modint<MOD>;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int N, K;
cin >> N >> K;
mint dp[N + 1][N + 1][K + 1];
for (int i = 0; i < N + 1; ++i)
for (int j = 0; j < N + 1; ++j)
for (int k = 0; k < K + 1; ++k)
dp[i][j][k] = 0;
dp[0][0][0] = 1;
for (int i = 0; i < N; ++i) {
for (int j = 0; j < N + 1; ++j) {
for (int k = 0; j + k < K + 1; ++k) {
dp[i + 1][j][j + k] += dp[i][j][k] + dp[i][j][k] * j;
if (1 < j)
dp[i + 1][j - 2][j + k] += dp[i][j][k] * j * j / 4;
if (j < N - 1)
dp[i + 1][j + 2][j + k] += dp[i][j][k];
}
}
}
cout << dp[N][0][K] << endl;
} | [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 785,688 | 785,689 | u275786410 | cpp |
p02974 | #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define F first
#define S second
//#define int long long
#define ll long long
//#define int unsigned long long
#define pb push_back
#define double long double
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
const int N = 55;
const int K = 60;
const int mod = 1e9 + 7;
map<int, int> mp;
int a[N];
int dp[2][N * N][N + N][N];
int cnt[N][N], p[N];
int solve(int n, int k) {
dp[0][0][0][0] = 1;
for (int i = 1; i <= n; i++) {
int c1 = i % 2;
int c2 = c1 ^ 1;
for (int j = 0; j <= n * n; j++) {
for (int l = 0; l <= i + i; l++) {
for (int t = 0; t <= l; t++) {
dp[c1][j][l][t] = 0;
if (j >= l)
dp[c1][j][l][t] =
(dp[c1][j][l][t] + (1 + l) * dp[c2][j - l][l][t]) % mod;
if (j >= l + 2)
dp[c1][j][l][t] =
(dp[c1][j][l][t] +
(t + 1) * (l - t + 1) * dp[c2][j - (l + 2)][l + 2][t + 1]) %
mod;
if (j >= l - 2 && l - 2 >= 0 && t >= 1)
dp[c1][j][l][t] =
(dp[c1][j][l][t] + dp[c2][j - (l - 2)][l - 2][t - 1]) % mod;
}
}
}
}
return dp[n % 2][k][0][0];
}
main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
// freopen("input.txt", "r", stdin);
int n, k;
cin >> n >> k;
int np = 1;
cout << solve(n, k);
}
| #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define F first
#define S second
//#define int long long
#define ll long long
//#define int unsigned long long
#define pb push_back
#define double long double
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
const int N = 55;
const int K = 60;
const int mod = 1e9 + 7;
map<int, int> mp;
int a[N];
int dp[2][N * N][N + N][N];
int cnt[N][N], p[N];
int solve(int n, int k) {
dp[0][0][0][0] = 1;
for (int i = 1; i <= n; i++) {
int c1 = i % 2;
int c2 = c1 ^ 1;
for (int j = 0; j <= n * n; j++) {
for (int l = 0; l <= i + i; l++) {
for (int t = 0; t <= l; t++) {
dp[c1][j][l][t] = 0;
if (j >= l)
dp[c1][j][l][t] =
(dp[c1][j][l][t] + 1LL * (1 + l) * dp[c2][j - l][l][t]) % mod;
if (j >= l + 2)
dp[c1][j][l][t] =
(dp[c1][j][l][t] + 1LL * (t + 1) * (l - t + 1) *
dp[c2][j - (l + 2)][l + 2][t + 1]) %
mod;
if (j >= l - 2 && l - 2 >= 0 && t >= 1)
dp[c1][j][l][t] =
(dp[c1][j][l][t] + dp[c2][j - (l - 2)][l - 2][t - 1]) % mod;
}
}
}
}
return dp[n % 2][k][0][0];
}
main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
// freopen("input.txt", "r", stdin);
int n, k;
cin >> n >> k;
int np = 1;
cout << solve(n, k);
}
| [
"assignment.change"
] | 785,690 | 785,691 | u373008269 | cpp |
p02974 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int(i) = 0; (i) < (int)(n); ++(i))
#define repl(i, s, n) for (int i = s; i <= n; ++i)
#define rer(i, l, u) for (int(i) = (int)(l); (i) <= (int)(u); ++(i))
#define reu(i, l, u) for (int(i) = (int)(l); (i) < (int)(u); ++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r, v) auto r = (v)
#else
#define aut(r, v) __typeof(v) r = (v)
#endif
#define each(it, o) for (aut(it, (o).begin()); it != (o).end(); ++it)
#define ktya(x) sort(all(x))
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x, y) make_pair((x), (y))
#define mset(m, v) memset(m, v, sizeof(m))
#define INF 1e18
#define INFLL 1000000000000000007LL
#define SIZE 200105
#define REP(i, n) for (int i = 0; i < (int)n; ++i)
#define FOR(i, c) \
for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mind(a, b) (a > b ? b : a)
#define maxd(a, b) (a > b ? a : b)
#define PI (acos(-1))
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair<int, int>> vpii;
typedef long long ll;
typedef pair<int, ll> pill;
typedef pair<ll, int> plli;
typedef pair<double, int> pdi;
template <typename T, typename U> inline void amin(T &x, U y) {
if (y < x)
x = y;
}
template <typename T, typename U> inline void amax(T &x, U y) {
if (x < y)
x = y;
}
typedef complex<double> P;
typedef pair<pill, int> PA;
// ll MOD;
ll MOD = 1000000007;
// ll MOD=998244353;
typedef ll Weight;
struct Edge {
int src, dst;
ll weight;
};
ll dp[55][55][55 * 55] = {0};
int n, k;
int main() {
cin >> n >> k;
dp[0][0][0] = (ll)1;
for (int i = 1; i <= n; i++) {
for (int j = 0; j <= i; j++) {
for (int ki = 0; ki <= 2 * i * i; ki++) {
if (j >= 1 && ki - 2 * j >= 0) {
dp[i][j][ki] += dp[i - 1][j - 1][ki - 2 * j];
dp[i][j][ki] %= MOD;
}
if (ki - 2 * j >= 0) {
dp[i][j][ki] += (dp[i - 1][j][ki - 2 * j] * (ll)(2 * j + 1)) % MOD;
dp[i][j][ki] %= MOD;
}
if (ki - 2 * j >= 0) {
ll num = ((j + 1) * (j + 1)) % MOD;
dp[i][j][ki] += (dp[i - 1][j + 1][ki - 2 * j] * num) % MOD;
dp[i][j][ki] %= MOD;
}
}
}
}
cout << dp[n][0][k] % MOD << endl;
}
| #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int(i) = 0; (i) < (int)(n); ++(i))
#define repl(i, s, n) for (int i = s; i <= n; ++i)
#define rer(i, l, u) for (int(i) = (int)(l); (i) <= (int)(u); ++(i))
#define reu(i, l, u) for (int(i) = (int)(l); (i) < (int)(u); ++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r, v) auto r = (v)
#else
#define aut(r, v) __typeof(v) r = (v)
#endif
#define each(it, o) for (aut(it, (o).begin()); it != (o).end(); ++it)
#define ktya(x) sort(all(x))
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x, y) make_pair((x), (y))
#define mset(m, v) memset(m, v, sizeof(m))
#define INF 1e18
#define INFLL 1000000000000000007LL
#define SIZE 200105
#define REP(i, n) for (int i = 0; i < (int)n; ++i)
#define FOR(i, c) \
for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mind(a, b) (a > b ? b : a)
#define maxd(a, b) (a > b ? a : b)
#define PI (acos(-1))
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair<int, int>> vpii;
typedef long long ll;
typedef pair<int, ll> pill;
typedef pair<ll, int> plli;
typedef pair<double, int> pdi;
template <typename T, typename U> inline void amin(T &x, U y) {
if (y < x)
x = y;
}
template <typename T, typename U> inline void amax(T &x, U y) {
if (x < y)
x = y;
}
typedef complex<double> P;
typedef pair<pill, int> PA;
// ll MOD;
ll MOD = 1000000007;
// ll MOD=998244353;
typedef ll Weight;
struct Edge {
int src, dst;
ll weight;
};
ll dp[55][55][2 * 55 * 55] = {0};
int n, k;
int main() {
cin >> n >> k;
dp[0][0][0] = (ll)1;
for (int i = 1; i <= n; i++) {
for (int j = 0; j <= i; j++) {
for (int ki = 0; ki <= 2 * i * (i + 1); ki++) {
if (j >= 1 && ki - 2 * j >= 0) {
dp[i][j][ki] += dp[i - 1][j - 1][ki - 2 * j];
dp[i][j][ki] %= MOD;
}
if (ki - 2 * j >= 0) {
dp[i][j][ki] += (dp[i - 1][j][ki - 2 * j] * (ll)(2 * j + 1)) % MOD;
dp[i][j][ki] %= MOD;
}
if (ki - 2 * j >= 0) {
ll num = ((j + 1) * (j + 1)) % MOD;
dp[i][j][ki] += (dp[i - 1][j + 1][ki - 2 * j] * num) % MOD;
dp[i][j][ki] %= MOD;
}
}
}
}
cout << dp[n][0][k] % MOD << endl;
}
| [
"control_flow.loop.for.condition.change"
] | 785,692 | 785,693 | u703999673 | cpp |
p02974 | /*{{{*/
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <limits.h>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) \
(sort(c.begin(), c.end()), \
c.resize(distance(c.begin(), unique(c.begin(), c.end()))))
#define GET_POS(c, x) (lower_bound(c.begin(), c.end(), x) - c.begin())
#define CASET \
int ___T; \
scanf("%d", &___T); \
for (int cs = 1; cs <= ___T; cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
template <class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template <class T, class... U> void R(T &head, U &...tail) {
_R(head);
R(tail...);
}
template <class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template <class T, class U> void _W(const pair<T, U> &x) {
_W(x.F);
putchar(' ');
_W(x.S);
}
template <class T> void _W(const vector<T> &x) {
for (auto i = x.begin(); i != x.end(); _W(*i++))
if (i != x.cbegin())
putchar(' ');
}
void W() {}
template <class T, class... U> void W(const T &head, const U &...tail) {
_W(head);
putchar(sizeof...(tail) ? ' ' : '\n');
W(tail...);
}
#ifdef HOME
#define DEBUG(...) \
{ \
printf("# "); \
printf(__VA_ARGS__); \
puts(""); \
}
#else
#define DEBUG(...)
#endif
int MOD = 1e9 + 7;
void ADD(LL &x, LL v) {
x = (x + v) % MOD;
if (x < 0)
x += MOD;
}
/*}}}*/
const int SIZE = 1e6 + 10;
int N, K;
LL dp[2][26][6001];
int main() {
R(N, K);
{
int v = 0;
FOR(i, 1, N) { v += abs(N + 1 - i - i); }
if (K > v) {
W(0);
return 0;
}
}
int now = 0, nxt = 1;
dp[now][0][0] = 1;
for (int i = N; i > 0; i--) {
MS0(dp[nxt]);
REP(j, 26) REP(k, 6001) {
if (!dp[now][j][k])
continue;
ADD(dp[nxt][j][k], dp[now][j][k] * (1 + j * 2));
if (j)
ADD(dp[nxt][j - 1][k - 2 * i], dp[now][j][k] * j * j);
ADD(dp[nxt][j + 1][k + 2 * i], dp[now][j][k]);
}
swap(now, nxt);
}
W(dp[now][0][K]);
return 0;
}
| /*{{{*/
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <limits.h>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) \
(sort(c.begin(), c.end()), \
c.resize(distance(c.begin(), unique(c.begin(), c.end()))))
#define GET_POS(c, x) (lower_bound(c.begin(), c.end(), x) - c.begin())
#define CASET \
int ___T; \
scanf("%d", &___T); \
for (int cs = 1; cs <= ___T; cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
template <class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template <class T, class... U> void R(T &head, U &...tail) {
_R(head);
R(tail...);
}
template <class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template <class T, class U> void _W(const pair<T, U> &x) {
_W(x.F);
putchar(' ');
_W(x.S);
}
template <class T> void _W(const vector<T> &x) {
for (auto i = x.begin(); i != x.end(); _W(*i++))
if (i != x.cbegin())
putchar(' ');
}
void W() {}
template <class T, class... U> void W(const T &head, const U &...tail) {
_W(head);
putchar(sizeof...(tail) ? ' ' : '\n');
W(tail...);
}
#ifdef HOME
#define DEBUG(...) \
{ \
printf("# "); \
printf(__VA_ARGS__); \
puts(""); \
}
#else
#define DEBUG(...)
#endif
int MOD = 1e9 + 7;
void ADD(LL &x, LL v) {
x = (x + v) % MOD;
if (x < 0)
x += MOD;
}
/*}}}*/
const int SIZE = 1e6 + 10;
int N, K;
LL dp[2][26][6001];
int main() {
R(N, K);
{
int v = 0;
FOR(i, 1, N) { v += abs(N + 1 - i - i); }
if (K > v) {
W(0);
return 0;
}
}
int now = 0, nxt = 1;
dp[now][0][0] = 1;
for (int i = N; i > 0; i--) {
MS0(dp[nxt]);
REP(j, 26) REP(k, 6001) {
if (!dp[now][j][k])
continue;
ADD(dp[nxt][j][k], dp[now][j][k] * (1 + j * 2));
if (j)
ADD(dp[nxt][j - 1][k - 2 * i], dp[now][j][k] * j * j);
if (j < 25)
ADD(dp[nxt][j + 1][k + 2 * i], dp[now][j][k]);
}
swap(now, nxt);
}
W(dp[now][0][K]);
return 0;
}
| [
"control_flow.branch.if.add"
] | 785,694 | 785,695 | u284124505 | cpp |
p02974 | #include <bits/stdc++.h>
using namespace std;
#define int long long
// #define double long double
#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 REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOREACH(x, a) for (auto &(x) : (a))
#define VECCIN(x) \
for (auto &youso_ : (x)) \
cin >> youso_
#define bitcnt(x) __builtin_popcount(x)
#define lbit(x) __builtin_ffsll(x)
#define rbit(x) __builtin_clzll(x)
#define SZ(x) ((long long)(x).size())
#define fi first
#define se second
#define All(a) (a).begin(), (a).end()
#define rAll(a) (a).rbegin(), (a).rend()
#define cinfast() cin.tie(0), ios::sync_with_stdio(false)
#define PERM(c) \
sort(All(c)); \
for (bool cp = true; cp; cp = next_permutation(All(c)))
#define MKORDER(n) \
vector<int> od(n); \
iota(All(od), 0LL);
template <typename T = long long> inline T IN() {
T x;
cin >> x;
return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&...tail) {
cin >> head;
CIN(move(tail)...);
}
#define CCIN(...) \
char __VA_ARGS__; \
CIN(__VA_ARGS__)
#define DCIN(...) \
double __VA_ARGS__; \
CIN(__VA_ARGS__)
#define LCIN(...) \
long long __VA_ARGS__; \
CIN(__VA_ARGS__)
#define SCIN(...) \
string __VA_ARGS__; \
CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v) \
{ \
FOREACH(x, v) { cout << x << " "; } \
cout << "\n"; \
}
template <typename T = string> inline void eputs(T s) {
cout << s << "\n";
exit(0);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
std::fill((T *)array, (T *)(array + N), val);
}
template <typename T> using PQG = priority_queue<T, vector<T>, greater<T>>;
template <typename T> using PQ = priority_queue<T>;
typedef long long ll;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<ll, ll> PL;
typedef vector<PL> VPL;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;
const double PI = atan(1.0) * 4.0;
const ll dw[] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dh[] = {0, 1, 1, 1, 0, -1, -1, -1};
#define PI 3.141592653589793238
// 1000000007 で割ったあまりを扱う構造体
template <int MOD> struct Fp {
long long val;
constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
if (val < 0)
v += MOD;
}
constexpr int getmod() { return MOD; }
constexpr Fp operator-() const noexcept { return val ? MOD - val : 0; }
constexpr Fp operator+(const Fp &r) const noexcept { return Fp(*this) += r; }
constexpr Fp operator-(const Fp &r) const noexcept { return Fp(*this) -= r; }
constexpr Fp operator*(const Fp &r) const noexcept { return Fp(*this) *= r; }
constexpr Fp operator/(const Fp &r) const noexcept { return Fp(*this) /= r; }
constexpr Fp &operator+=(const Fp &r) noexcept {
val += r.val;
if (val >= MOD)
val -= MOD;
return *this;
}
constexpr Fp &operator-=(const Fp &r) noexcept {
val -= r.val;
if (val < 0)
val += MOD;
return *this;
}
constexpr Fp &operator*=(const Fp &r) noexcept {
val = val * r.val % MOD;
return *this;
}
constexpr Fp &operator/=(const Fp &r) noexcept {
long long a = r.val, b = MOD, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
val = val * u % MOD;
if (val < 0)
val += MOD;
return *this;
}
constexpr bool operator==(const Fp &r) const noexcept {
return this->val == r.val;
}
constexpr bool operator!=(const Fp &r) const noexcept {
return this->val != r.val;
}
friend constexpr ostream &operator<<(ostream &os, const Fp<MOD> &x) noexcept {
return os << x.val;
}
friend constexpr istream &operator>>(istream &is, Fp<MOD> &x) noexcept {
return is >> x.val;
}
friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
if (n == 0)
return 1;
auto t = modpow(a, n / 2);
t = t * t;
if (n & 1)
t = t * a;
return t;
}
};
using mint = Fp<MOD>;
mint dp[2][51][2505];
signed main() {
cinfast();
LCIN(N, K);
ll now = 0, next = 1;
dp[now][0][0] = 1;
REP(i, N) {
Fill(dp[next], 0);
REP(j, i + 1) FOR(k, 2 * j, K + 1) {
//両方保留
if (j)
dp[next][j][k] += dp[now][j - 1][k - 2 * j];
//保留箱に入れるかつ保留ボールを入れる
dp[next][j][k] += (mint)(j + 1) * (j + 1) * dp[now][j + 1][k - 2 * j];
//保留箱に入れるまたは保留ボールを入れる
dp[next][j][k] += (mint)2 * (j + 1) * dp[now][j][k - 2 * j];
}
swap(now, next);
}
cout << dp[now][0][K] << "\n";
}
| #include <bits/stdc++.h>
using namespace std;
#define int long long
// #define double long double
#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 REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOREACH(x, a) for (auto &(x) : (a))
#define VECCIN(x) \
for (auto &youso_ : (x)) \
cin >> youso_
#define bitcnt(x) __builtin_popcount(x)
#define lbit(x) __builtin_ffsll(x)
#define rbit(x) __builtin_clzll(x)
#define SZ(x) ((long long)(x).size())
#define fi first
#define se second
#define All(a) (a).begin(), (a).end()
#define rAll(a) (a).rbegin(), (a).rend()
#define cinfast() cin.tie(0), ios::sync_with_stdio(false)
#define PERM(c) \
sort(All(c)); \
for (bool cp = true; cp; cp = next_permutation(All(c)))
#define MKORDER(n) \
vector<int> od(n); \
iota(All(od), 0LL);
template <typename T = long long> inline T IN() {
T x;
cin >> x;
return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&...tail) {
cin >> head;
CIN(move(tail)...);
}
#define CCIN(...) \
char __VA_ARGS__; \
CIN(__VA_ARGS__)
#define DCIN(...) \
double __VA_ARGS__; \
CIN(__VA_ARGS__)
#define LCIN(...) \
long long __VA_ARGS__; \
CIN(__VA_ARGS__)
#define SCIN(...) \
string __VA_ARGS__; \
CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v) \
{ \
FOREACH(x, v) { cout << x << " "; } \
cout << "\n"; \
}
template <typename T = string> inline void eputs(T s) {
cout << s << "\n";
exit(0);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
std::fill((T *)array, (T *)(array + N), val);
}
template <typename T> using PQG = priority_queue<T, vector<T>, greater<T>>;
template <typename T> using PQ = priority_queue<T>;
typedef long long ll;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<ll, ll> PL;
typedef vector<PL> VPL;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;
const double PI = atan(1.0) * 4.0;
const ll dw[] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dh[] = {0, 1, 1, 1, 0, -1, -1, -1};
#define PI 3.141592653589793238
// 1000000007 で割ったあまりを扱う構造体
template <int MOD> struct Fp {
long long val;
constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
if (val < 0)
v += MOD;
}
constexpr int getmod() { return MOD; }
constexpr Fp operator-() const noexcept { return val ? MOD - val : 0; }
constexpr Fp operator+(const Fp &r) const noexcept { return Fp(*this) += r; }
constexpr Fp operator-(const Fp &r) const noexcept { return Fp(*this) -= r; }
constexpr Fp operator*(const Fp &r) const noexcept { return Fp(*this) *= r; }
constexpr Fp operator/(const Fp &r) const noexcept { return Fp(*this) /= r; }
constexpr Fp &operator+=(const Fp &r) noexcept {
val += r.val;
if (val >= MOD)
val -= MOD;
return *this;
}
constexpr Fp &operator-=(const Fp &r) noexcept {
val -= r.val;
if (val < 0)
val += MOD;
return *this;
}
constexpr Fp &operator*=(const Fp &r) noexcept {
val = val * r.val % MOD;
return *this;
}
constexpr Fp &operator/=(const Fp &r) noexcept {
long long a = r.val, b = MOD, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
val = val * u % MOD;
if (val < 0)
val += MOD;
return *this;
}
constexpr bool operator==(const Fp &r) const noexcept {
return this->val == r.val;
}
constexpr bool operator!=(const Fp &r) const noexcept {
return this->val != r.val;
}
friend constexpr ostream &operator<<(ostream &os, const Fp<MOD> &x) noexcept {
return os << x.val;
}
friend constexpr istream &operator>>(istream &is, Fp<MOD> &x) noexcept {
return is >> x.val;
}
friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
if (n == 0)
return 1;
auto t = modpow(a, n / 2);
t = t * t;
if (n & 1)
t = t * a;
return t;
}
};
using mint = Fp<MOD>;
mint dp[2][52][2501];
signed main() {
cinfast();
LCIN(N, K);
ll now = 0, next = 1;
dp[now][0][0] = 1;
REP(i, N) {
Fill(dp[next], 0);
REP(j, i + 2) FOR(k, 2 * j, K + 1) {
//両方保留
if (j)
dp[next][j][k] += dp[now][j - 1][k - 2 * j];
//保留箱に入れるかつ保留ボールを入れる
dp[next][j][k] += (mint)(j + 1) * (j + 1) * dp[now][j + 1][k - 2 * j];
//保留箱に入れるまたは保留ボールを入れる
dp[next][j][k] += (mint)(2 * j + 1) * dp[now][j][k - 2 * j];
}
swap(now, next);
}
cout << dp[now][0][K] << "\n";
}
| [
"literal.number.change",
"variable_declaration.array_dimensions.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 785,702 | 785,701 | u139031151 | cpp |
p02974 | #include <bits/stdc++.h>
using namespace std;
#define int long long
// #define double long double
#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 REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOREACH(x, a) for (auto &(x) : (a))
#define VECCIN(x) \
for (auto &youso_ : (x)) \
cin >> youso_
#define bitcnt(x) __builtin_popcount(x)
#define lbit(x) __builtin_ffsll(x)
#define rbit(x) __builtin_clzll(x)
#define SZ(x) ((long long)(x).size())
#define fi first
#define se second
#define All(a) (a).begin(), (a).end()
#define rAll(a) (a).rbegin(), (a).rend()
#define cinfast() cin.tie(0), ios::sync_with_stdio(false)
#define PERM(c) \
sort(All(c)); \
for (bool cp = true; cp; cp = next_permutation(All(c)))
#define MKORDER(n) \
vector<int> od(n); \
iota(All(od), 0LL);
template <typename T = long long> inline T IN() {
T x;
cin >> x;
return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&...tail) {
cin >> head;
CIN(move(tail)...);
}
#define CCIN(...) \
char __VA_ARGS__; \
CIN(__VA_ARGS__)
#define DCIN(...) \
double __VA_ARGS__; \
CIN(__VA_ARGS__)
#define LCIN(...) \
long long __VA_ARGS__; \
CIN(__VA_ARGS__)
#define SCIN(...) \
string __VA_ARGS__; \
CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v) \
{ \
FOREACH(x, v) { cout << x << " "; } \
cout << "\n"; \
}
template <typename T = string> inline void eputs(T s) {
cout << s << "\n";
exit(0);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
std::fill((T *)array, (T *)(array + N), val);
}
template <typename T> using PQG = priority_queue<T, vector<T>, greater<T>>;
template <typename T> using PQ = priority_queue<T>;
typedef long long ll;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<ll, ll> PL;
typedef vector<PL> VPL;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;
const double PI = atan(1.0) * 4.0;
const ll dw[] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dh[] = {0, 1, 1, 1, 0, -1, -1, -1};
#define PI 3.141592653589793238
// 1000000007 で割ったあまりを扱う構造体
template <int MOD> struct Fp {
long long val;
constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
if (val < 0)
v += MOD;
}
constexpr int getmod() { return MOD; }
constexpr Fp operator-() const noexcept { return val ? MOD - val : 0; }
constexpr Fp operator+(const Fp &r) const noexcept { return Fp(*this) += r; }
constexpr Fp operator-(const Fp &r) const noexcept { return Fp(*this) -= r; }
constexpr Fp operator*(const Fp &r) const noexcept { return Fp(*this) *= r; }
constexpr Fp operator/(const Fp &r) const noexcept { return Fp(*this) /= r; }
constexpr Fp &operator+=(const Fp &r) noexcept {
val += r.val;
if (val >= MOD)
val -= MOD;
return *this;
}
constexpr Fp &operator-=(const Fp &r) noexcept {
val -= r.val;
if (val < 0)
val += MOD;
return *this;
}
constexpr Fp &operator*=(const Fp &r) noexcept {
val = val * r.val % MOD;
return *this;
}
constexpr Fp &operator/=(const Fp &r) noexcept {
long long a = r.val, b = MOD, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
val = val * u % MOD;
if (val < 0)
val += MOD;
return *this;
}
constexpr bool operator==(const Fp &r) const noexcept {
return this->val == r.val;
}
constexpr bool operator!=(const Fp &r) const noexcept {
return this->val != r.val;
}
friend constexpr ostream &operator<<(ostream &os, const Fp<MOD> &x) noexcept {
return os << x.val;
}
friend constexpr istream &operator>>(istream &is, Fp<MOD> &x) noexcept {
return is >> x.val;
}
friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
if (n == 0)
return 1;
auto t = modpow(a, n / 2);
t = t * t;
if (n & 1)
t = t * a;
return t;
}
};
using mint = Fp<MOD>;
mint dp[2][51][2505];
signed main() {
cinfast();
LCIN(N, K);
ll now = 0, next = 1;
dp[now][0][0] = 1;
REP(i, N) {
Fill(dp[next], 0);
REP(j, i + 1) FOR(k, 2 * j, K + 1) {
//両方保留
if (j)
dp[next][j][k] += dp[now][j - 1][k - 2 * j];
//保留箱に入れるかつ保留ボールを入れる
dp[next][j][k] += (mint)(j + 1) * (j + 1) * dp[now][j + 1][k - 2 * j];
//保留箱に入れるまたは保留ボールを入れる
dp[next][j][k] += (mint)2 * (j + 1) * dp[now][j][k - 2 * j];
}
swap(now, next);
}
cout << dp[now][0][K] << "\n";
}
| #include <bits/stdc++.h>
using namespace std;
#define int long long
// #define double long double
#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 REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOREACH(x, a) for (auto &(x) : (a))
#define VECCIN(x) \
for (auto &youso_ : (x)) \
cin >> youso_
#define bitcnt(x) __builtin_popcount(x)
#define lbit(x) __builtin_ffsll(x)
#define rbit(x) __builtin_clzll(x)
#define SZ(x) ((long long)(x).size())
#define fi first
#define se second
#define All(a) (a).begin(), (a).end()
#define rAll(a) (a).rbegin(), (a).rend()
#define cinfast() cin.tie(0), ios::sync_with_stdio(false)
#define PERM(c) \
sort(All(c)); \
for (bool cp = true; cp; cp = next_permutation(All(c)))
#define MKORDER(n) \
vector<int> od(n); \
iota(All(od), 0LL);
template <typename T = long long> inline T IN() {
T x;
cin >> x;
return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&...tail) {
cin >> head;
CIN(move(tail)...);
}
#define CCIN(...) \
char __VA_ARGS__; \
CIN(__VA_ARGS__)
#define DCIN(...) \
double __VA_ARGS__; \
CIN(__VA_ARGS__)
#define LCIN(...) \
long long __VA_ARGS__; \
CIN(__VA_ARGS__)
#define SCIN(...) \
string __VA_ARGS__; \
CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v) \
{ \
FOREACH(x, v) { cout << x << " "; } \
cout << "\n"; \
}
template <typename T = string> inline void eputs(T s) {
cout << s << "\n";
exit(0);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
std::fill((T *)array, (T *)(array + N), val);
}
template <typename T> using PQG = priority_queue<T, vector<T>, greater<T>>;
template <typename T> using PQ = priority_queue<T>;
typedef long long ll;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<ll, ll> PL;
typedef vector<PL> VPL;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;
const double PI = atan(1.0) * 4.0;
const ll dw[] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dh[] = {0, 1, 1, 1, 0, -1, -1, -1};
#define PI 3.141592653589793238
// 1000000007 で割ったあまりを扱う構造体
template <int MOD> struct Fp {
long long val;
constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
if (val < 0)
v += MOD;
}
constexpr int getmod() { return MOD; }
constexpr Fp operator-() const noexcept { return val ? MOD - val : 0; }
constexpr Fp operator+(const Fp &r) const noexcept { return Fp(*this) += r; }
constexpr Fp operator-(const Fp &r) const noexcept { return Fp(*this) -= r; }
constexpr Fp operator*(const Fp &r) const noexcept { return Fp(*this) *= r; }
constexpr Fp operator/(const Fp &r) const noexcept { return Fp(*this) /= r; }
constexpr Fp &operator+=(const Fp &r) noexcept {
val += r.val;
if (val >= MOD)
val -= MOD;
return *this;
}
constexpr Fp &operator-=(const Fp &r) noexcept {
val -= r.val;
if (val < 0)
val += MOD;
return *this;
}
constexpr Fp &operator*=(const Fp &r) noexcept {
val = val * r.val % MOD;
return *this;
}
constexpr Fp &operator/=(const Fp &r) noexcept {
long long a = r.val, b = MOD, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
val = val * u % MOD;
if (val < 0)
val += MOD;
return *this;
}
constexpr bool operator==(const Fp &r) const noexcept {
return this->val == r.val;
}
constexpr bool operator!=(const Fp &r) const noexcept {
return this->val != r.val;
}
friend constexpr ostream &operator<<(ostream &os, const Fp<MOD> &x) noexcept {
return os << x.val;
}
friend constexpr istream &operator>>(istream &is, Fp<MOD> &x) noexcept {
return is >> x.val;
}
friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
if (n == 0)
return 1;
auto t = modpow(a, n / 2);
t = t * t;
if (n & 1)
t = t * a;
return t;
}
};
using mint = Fp<MOD>;
mint dp[2][52][2501];
signed main() {
cinfast();
LCIN(N, K);
ll now = 0, next = 1;
dp[now][0][0] = 1;
REP(i, N) {
Fill(dp[next], 0);
REP(j, N + 1) FOR(k, 2 * j, K + 1) {
//両方保留
if (j)
dp[next][j][k] += dp[now][j - 1][k - 2 * j];
//保留箱に入れるかつ保留ボールを入れる
dp[next][j][k] += (mint)(j + 1) * (j + 1) * dp[now][j + 1][k - 2 * j];
//保留箱に入れるまたは保留ボールを入れる
dp[next][j][k] += (mint)(2 * j + 1) * dp[now][j][k - 2 * j];
}
swap(now, next);
}
cout << dp[now][0][K] << "\n";
}
| [
"literal.number.change",
"variable_declaration.array_dimensions.change",
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 785,702 | 785,703 | u139031151 | cpp |
p02974 | #include <bits/stdc++.h>
using namespace std;
#define int long long
// #define double long double
#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 REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOREACH(x, a) for (auto &(x) : (a))
#define VECCIN(x) \
for (auto &youso_ : (x)) \
cin >> youso_
#define bitcnt(x) __builtin_popcount(x)
#define lbit(x) __builtin_ffsll(x)
#define rbit(x) __builtin_clzll(x)
#define SZ(x) ((long long)(x).size())
#define fi first
#define se second
#define All(a) (a).begin(), (a).end()
#define rAll(a) (a).rbegin(), (a).rend()
#define cinfast() cin.tie(0), ios::sync_with_stdio(false)
#define PERM(c) \
sort(All(c)); \
for (bool cp = true; cp; cp = next_permutation(All(c)))
#define MKORDER(n) \
vector<int> od(n); \
iota(All(od), 0LL);
template <typename T = long long> inline T IN() {
T x;
cin >> x;
return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&...tail) {
cin >> head;
CIN(move(tail)...);
}
#define CCIN(...) \
char __VA_ARGS__; \
CIN(__VA_ARGS__)
#define DCIN(...) \
double __VA_ARGS__; \
CIN(__VA_ARGS__)
#define LCIN(...) \
long long __VA_ARGS__; \
CIN(__VA_ARGS__)
#define SCIN(...) \
string __VA_ARGS__; \
CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v) \
{ \
FOREACH(x, v) { cout << x << " "; } \
cout << "\n"; \
}
template <typename T = string> inline void eputs(T s) {
cout << s << "\n";
exit(0);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
std::fill((T *)array, (T *)(array + N), val);
}
template <typename T> using PQG = priority_queue<T, vector<T>, greater<T>>;
template <typename T> using PQ = priority_queue<T>;
typedef long long ll;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<ll, ll> PL;
typedef vector<PL> VPL;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;
const double PI = atan(1.0) * 4.0;
const ll dw[] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dh[] = {0, 1, 1, 1, 0, -1, -1, -1};
#define PI 3.141592653589793238
// 1000000007 で割ったあまりを扱う構造体
template <int MOD> struct Fp {
long long val;
constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
if (val < 0)
v += MOD;
}
constexpr int getmod() { return MOD; }
constexpr Fp operator-() const noexcept { return val ? MOD - val : 0; }
constexpr Fp operator+(const Fp &r) const noexcept { return Fp(*this) += r; }
constexpr Fp operator-(const Fp &r) const noexcept { return Fp(*this) -= r; }
constexpr Fp operator*(const Fp &r) const noexcept { return Fp(*this) *= r; }
constexpr Fp operator/(const Fp &r) const noexcept { return Fp(*this) /= r; }
constexpr Fp &operator+=(const Fp &r) noexcept {
val += r.val;
if (val >= MOD)
val -= MOD;
return *this;
}
constexpr Fp &operator-=(const Fp &r) noexcept {
val -= r.val;
if (val < 0)
val += MOD;
return *this;
}
constexpr Fp &operator*=(const Fp &r) noexcept {
val = val * r.val % MOD;
return *this;
}
constexpr Fp &operator/=(const Fp &r) noexcept {
long long a = r.val, b = MOD, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
val = val * u % MOD;
if (val < 0)
val += MOD;
return *this;
}
constexpr bool operator==(const Fp &r) const noexcept {
return this->val == r.val;
}
constexpr bool operator!=(const Fp &r) const noexcept {
return this->val != r.val;
}
friend constexpr ostream &operator<<(ostream &os, const Fp<MOD> &x) noexcept {
return os << x.val;
}
friend constexpr istream &operator>>(istream &is, Fp<MOD> &x) noexcept {
return is >> x.val;
}
friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
if (n == 0)
return 1;
auto t = modpow(a, n / 2);
t = t * t;
if (n & 1)
t = t * a;
return t;
}
};
using mint = Fp<MOD>;
mint dp[2][51][2505];
signed main() {
cinfast();
LCIN(N, K);
ll now = 0, next = 1;
dp[now][0][0] = 1;
REP(i, N) {
Fill(dp[next], 0);
REP(j, i + 1) FOR(k, 2 * j, K + 1) {
//両方保留
if (j)
dp[next][j][k] += dp[now][j - 1][k - 2 * j];
//保留箱に入れるかつ保留ボールを入れる
dp[next][j][k] += (mint)(j + 1) * (j + 1) * dp[now][j + 1][k - 2 * j];
//保留箱に入れるまたは保留ボールを入れる
dp[next][j][k] += (mint)2 * (j + 1) * dp[now][j][k - 2 * j];
}
swap(now, next);
}
cout << dp[now][0][K] << "\n";
}
| #include <bits/stdc++.h>
using namespace std;
#define int long long
// #define double long double
#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 REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOREACH(x, a) for (auto &(x) : (a))
#define VECCIN(x) \
for (auto &youso_ : (x)) \
cin >> youso_
#define bitcnt(x) __builtin_popcount(x)
#define lbit(x) __builtin_ffsll(x)
#define rbit(x) __builtin_clzll(x)
#define SZ(x) ((long long)(x).size())
#define fi first
#define se second
#define All(a) (a).begin(), (a).end()
#define rAll(a) (a).rbegin(), (a).rend()
#define cinfast() cin.tie(0), ios::sync_with_stdio(false)
#define PERM(c) \
sort(All(c)); \
for (bool cp = true; cp; cp = next_permutation(All(c)))
#define MKORDER(n) \
vector<int> od(n); \
iota(All(od), 0LL);
template <typename T = long long> inline T IN() {
T x;
cin >> x;
return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&...tail) {
cin >> head;
CIN(move(tail)...);
}
#define CCIN(...) \
char __VA_ARGS__; \
CIN(__VA_ARGS__)
#define DCIN(...) \
double __VA_ARGS__; \
CIN(__VA_ARGS__)
#define LCIN(...) \
long long __VA_ARGS__; \
CIN(__VA_ARGS__)
#define SCIN(...) \
string __VA_ARGS__; \
CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v) \
{ \
FOREACH(x, v) { cout << x << " "; } \
cout << "\n"; \
}
template <typename T = string> inline void eputs(T s) {
cout << s << "\n";
exit(0);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
std::fill((T *)array, (T *)(array + N), val);
}
template <typename T> using PQG = priority_queue<T, vector<T>, greater<T>>;
template <typename T> using PQ = priority_queue<T>;
typedef long long ll;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<ll, ll> PL;
typedef vector<PL> VPL;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;
const double PI = atan(1.0) * 4.0;
const ll dw[] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dh[] = {0, 1, 1, 1, 0, -1, -1, -1};
#define PI 3.141592653589793238
// 1000000007 で割ったあまりを扱う構造体
template <int MOD> struct Fp {
long long val;
constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
if (val < 0)
v += MOD;
}
constexpr int getmod() { return MOD; }
constexpr Fp operator-() const noexcept { return val ? MOD - val : 0; }
constexpr Fp operator+(const Fp &r) const noexcept { return Fp(*this) += r; }
constexpr Fp operator-(const Fp &r) const noexcept { return Fp(*this) -= r; }
constexpr Fp operator*(const Fp &r) const noexcept { return Fp(*this) *= r; }
constexpr Fp operator/(const Fp &r) const noexcept { return Fp(*this) /= r; }
constexpr Fp &operator+=(const Fp &r) noexcept {
val += r.val;
if (val >= MOD)
val -= MOD;
return *this;
}
constexpr Fp &operator-=(const Fp &r) noexcept {
val -= r.val;
if (val < 0)
val += MOD;
return *this;
}
constexpr Fp &operator*=(const Fp &r) noexcept {
val = val * r.val % MOD;
return *this;
}
constexpr Fp &operator/=(const Fp &r) noexcept {
long long a = r.val, b = MOD, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
val = val * u % MOD;
if (val < 0)
val += MOD;
return *this;
}
constexpr bool operator==(const Fp &r) const noexcept {
return this->val == r.val;
}
constexpr bool operator!=(const Fp &r) const noexcept {
return this->val != r.val;
}
friend constexpr ostream &operator<<(ostream &os, const Fp<MOD> &x) noexcept {
return os << x.val;
}
friend constexpr istream &operator>>(istream &is, Fp<MOD> &x) noexcept {
return is >> x.val;
}
friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
if (n == 0)
return 1;
auto t = modpow(a, n / 2);
t = t * t;
if (n & 1)
t = t * a;
return t;
}
};
using mint = Fp<MOD>;
mint dp[2][55][2555];
signed main() {
cinfast();
LCIN(N, K);
ll now = 0, next = 1;
dp[now][0][0] = 1;
REP(i, N) {
Fill(dp[next], 0);
REP(j, N + 1) FOR(k, 2 * j, K + 1) {
//両方保留
if (j)
dp[next][j][k] += dp[now][j - 1][k - 2 * j];
//保留箱に入れるかつ保留ボールを入れる
dp[next][j][k] += (mint)(j + 1) * (j + 1) * dp[now][j + 1][k - 2 * j];
//保留箱に入れるまたは保留ボールを入れる
dp[next][j][k] += (mint)(2 * j + 1) * dp[now][j][k - 2 * j];
}
swap(now, next);
}
cout << dp[now][0][K] << "\n";
}
| [
"literal.number.change",
"variable_declaration.array_dimensions.change",
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 785,702 | 785,704 | u139031151 | cpp |
p02974 | #include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep(i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) (x).begin(), (x).end()
#ifdef LOCAL
#include "../../Lib/cout_container.hpp"
#define debug(x) cerr << #x " => " << x << endl
#else
#define debug(x) 0
#endif
using lint = long long;
constexpr int INF = 1 << 30;
constexpr lint INFL = 1LL << 62;
constexpr int MOD = (int)1e9 + 7;
constexpr double EPS = 1e-9;
using namespace std;
namespace {
struct INIT {
INIT() {
cin.tie(0);
ios::sync_with_stdio(false);
cout << fixed << setprecision(15);
}
} INIT;
} // namespace
template <long long mod_num> class ModInt {
long long n_;
public:
constexpr ModInt(const long long num = 0) : n_(num % mod_num) {}
constexpr const long long &value() const { return n_; }
constexpr bool operator==(const ModInt &r) const { return this->n_ == r.n_; }
constexpr bool operator==(const long long &r) const { return this->n_ == r; }
constexpr bool operator!=(const ModInt &r) const { return this->n_ != r.n_; }
constexpr bool operator!=(const long long &r) const { return this->n_ != r; }
constexpr bool operator<(const ModInt &r) const { return this->n_ < r.n_; }
constexpr bool operator<(const long long &r) const { return this->n_ < r; }
constexpr bool operator>(const ModInt &r) const { return this->n_ > r.n_; }
constexpr bool operator>(const long long &r) const { return this->n_ > r; }
constexpr bool operator<=(const ModInt &r) const { return this->n_ <= r.n_; }
constexpr bool operator<=(const long long &r) const { return this->n_ <= r; }
constexpr bool operator>=(const ModInt &r) const { return this->n_ >= r.n_; }
constexpr bool operator>=(const long long &r) const { return this->n_ >= r; }
constexpr ModInt operator+(const ModInt &r) const {
return ModInt(*this) += r;
}
constexpr ModInt operator-(const ModInt &r) const {
return ModInt(*this) -= r;
}
constexpr ModInt operator*(const ModInt &r) const {
return ModInt(*this) *= r;
}
constexpr ModInt operator/(const ModInt &r) const {
return ModInt(*this) /= r;
}
constexpr ModInt operator+(const long long &r) const {
return ModInt(*this) += ModInt(r);
}
constexpr ModInt operator-(const long long &r) const {
return ModInt(*this) -= ModInt(r);
}
constexpr ModInt operator*(const long long &r) const {
return ModInt(*this) *= ModInt(r);
}
constexpr ModInt operator/(const long long &r) const {
return ModInt(*this) /= ModInt(r);
}
friend ModInt operator+(const long long &l, const ModInt &r) {
return ModInt(l) += r;
}
friend ModInt operator-(const long long &l, const ModInt &r) {
return ModInt(l) -= r;
}
friend ModInt operator*(const long long &l, const ModInt &r) {
return ModInt(l) *= r;
}
friend ModInt operator/(const long long &l, const ModInt &r) {
return ModInt(l) /= r;
}
constexpr ModInt &operator++() { return *this += 1; }
constexpr ModInt &operator--() { return *this -= 1; }
constexpr ModInt &operator+=(const ModInt &r) {
n_ += r.n_;
if (n_ >= mod_num)
n_ -= mod_num;
return *this;
}
constexpr ModInt &operator-=(const ModInt &r) {
if (n_ < r.n_)
n_ += mod_num;
n_ -= r.n_;
return *this;
}
constexpr ModInt &operator*=(const ModInt &r) {
n_ = n_ * r.n_ % mod_num;
return *this;
}
constexpr ModInt &operator/=(ModInt r) {
long long exp = mod_num - 2;
while (exp) {
if (exp & 2)
*this *= r;
r *= r;
exp /= 2;
}
return *this;
}
friend istream &operator>>(istream &is, ModInt<mod_num> &r) {
is >> r.n_;
r.n_ %= r.mod_num;
return is;
}
friend ostream &operator<<(ostream &os, const ModInt<mod_num> &r) {
return os << r.n_;
}
explicit operator int() const { return n_; }
explicit operator long long() const { return n_; }
explicit operator double() const { return n_; }
};
using mint = ModInt<MOD>;
vector<vector<vector<mint>>> dp;
int main(void) {
int n, k;
cin >> n >> k;
dp.assign(n + 10, vector<vector<mint>>(n + 10, vector<mint>(k + 10)));
dp[0][0][0] = 1;
rep(i, n) {
rep(j, i + 1) {
rep(l, k + 1) {
dp[i + 1][j][l + 2 * j] += dp[i][j][l];
dp[i + 1][j + 1][l + 2 * (j + 1)] += dp[i][j][l];
dp[i + 1][j][l + 2 * j] += dp[i][j][l] * j * 2;
if (j > 0)
dp[i + 1][j - 1][l + 2 * (j - 1)] += dp[i][j][l] * j * j;
}
}
}
cout << dp[n][0][k] << endl;
return 0;
} | #include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep(i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) (x).begin(), (x).end()
#ifdef LOCAL
#include "../../Lib/cout_container.hpp"
#define debug(x) cerr << #x " => " << x << endl
#else
#define debug(x) 0
#endif
using lint = long long;
constexpr int INF = 1 << 30;
constexpr lint INFL = 1LL << 62;
constexpr int MOD = (int)1e9 + 7;
constexpr double EPS = 1e-9;
using namespace std;
namespace {
struct INIT {
INIT() {
cin.tie(0);
ios::sync_with_stdio(false);
cout << fixed << setprecision(15);
}
} INIT;
} // namespace
template <long long mod_num> class ModInt {
long long n_;
public:
constexpr ModInt(const long long num = 0) : n_(num % mod_num) {}
constexpr const long long &value() const { return n_; }
constexpr bool operator==(const ModInt &r) const { return this->n_ == r.n_; }
constexpr bool operator==(const long long &r) const { return this->n_ == r; }
constexpr bool operator!=(const ModInt &r) const { return this->n_ != r.n_; }
constexpr bool operator!=(const long long &r) const { return this->n_ != r; }
constexpr bool operator<(const ModInt &r) const { return this->n_ < r.n_; }
constexpr bool operator<(const long long &r) const { return this->n_ < r; }
constexpr bool operator>(const ModInt &r) const { return this->n_ > r.n_; }
constexpr bool operator>(const long long &r) const { return this->n_ > r; }
constexpr bool operator<=(const ModInt &r) const { return this->n_ <= r.n_; }
constexpr bool operator<=(const long long &r) const { return this->n_ <= r; }
constexpr bool operator>=(const ModInt &r) const { return this->n_ >= r.n_; }
constexpr bool operator>=(const long long &r) const { return this->n_ >= r; }
constexpr ModInt operator+(const ModInt &r) const {
return ModInt(*this) += r;
}
constexpr ModInt operator-(const ModInt &r) const {
return ModInt(*this) -= r;
}
constexpr ModInt operator*(const ModInt &r) const {
return ModInt(*this) *= r;
}
constexpr ModInt operator/(const ModInt &r) const {
return ModInt(*this) /= r;
}
constexpr ModInt operator+(const long long &r) const {
return ModInt(*this) += ModInt(r);
}
constexpr ModInt operator-(const long long &r) const {
return ModInt(*this) -= ModInt(r);
}
constexpr ModInt operator*(const long long &r) const {
return ModInt(*this) *= ModInt(r);
}
constexpr ModInt operator/(const long long &r) const {
return ModInt(*this) /= ModInt(r);
}
friend ModInt operator+(const long long &l, const ModInt &r) {
return ModInt(l) += r;
}
friend ModInt operator-(const long long &l, const ModInt &r) {
return ModInt(l) -= r;
}
friend ModInt operator*(const long long &l, const ModInt &r) {
return ModInt(l) *= r;
}
friend ModInt operator/(const long long &l, const ModInt &r) {
return ModInt(l) /= r;
}
constexpr ModInt &operator++() { return *this += 1; }
constexpr ModInt &operator--() { return *this -= 1; }
constexpr ModInt &operator+=(const ModInt &r) {
n_ += r.n_;
if (n_ >= mod_num)
n_ -= mod_num;
return *this;
}
constexpr ModInt &operator-=(const ModInt &r) {
if (n_ < r.n_)
n_ += mod_num;
n_ -= r.n_;
return *this;
}
constexpr ModInt &operator*=(const ModInt &r) {
n_ = n_ * r.n_ % mod_num;
return *this;
}
constexpr ModInt &operator/=(ModInt r) {
long long exp = mod_num - 2;
while (exp) {
if (exp & 2)
*this *= r;
r *= r;
exp /= 2;
}
return *this;
}
friend istream &operator>>(istream &is, ModInt<mod_num> &r) {
is >> r.n_;
r.n_ %= r.mod_num;
return is;
}
friend ostream &operator<<(ostream &os, const ModInt<mod_num> &r) {
return os << r.n_;
}
explicit operator int() const { return n_; }
explicit operator long long() const { return n_; }
explicit operator double() const { return n_; }
};
using mint = ModInt<MOD>;
vector<vector<vector<mint>>> dp;
int main(void) {
int n, k;
cin >> n >> k;
dp.assign(n + 1, vector<vector<mint>>(n + 1, vector<mint>(k + 100)));
dp[0][0][0] = 1;
rep(i, n) {
rep(j, i + 1) {
rep(l, k + 1) {
dp[i + 1][j][l + 2 * j] += dp[i][j][l];
dp[i + 1][j + 1][l + 2 * (j + 1)] += dp[i][j][l];
dp[i + 1][j][l + 2 * j] += dp[i][j][l] * j * 2;
if (j > 0)
dp[i + 1][j - 1][l + 2 * (j - 1)] += dp[i][j][l] * j * j;
}
}
}
cout << dp[n][0][k] << endl;
return 0;
} | [
"literal.number.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 785,718 | 785,719 | u020746846 | cpp |
p02974 | #include <algorithm>
#include <array>
#include <assert.h>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef long double ld;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define sz(x) ((int)(x).size())
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<ld>> vvd;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const ll MOD = (ll)1e9 + 7;
ll binpow(ll a, ll n) {
ll res = 1;
while (n) {
if (n & 1) {
res *= a;
res %= MOD;
}
a *= a;
a %= MOD;
n >>= 1;
}
return res % MOD;
}
ll inv(ll x) { return binpow(x, MOD - 2); }
void add(ll &x, ll y) {
x += y;
if (x >= MOD)
x -= MOD;
}
void take(ll &x, ll y) {
x -= y;
if (x < 0)
x += MOD;
}
ll sum(ll a, ll b) {
add(a, b);
return a;
}
ll sub(ll a, ll b) {
take(a, b);
return a;
}
ll mul(ll x, ll y) { return (x * y) % MOD; }
ll rat(ll x, ll y) {
assert(y);
return mul(x, inv(y));
}
const ll MAXN = 52;
const ll MAXT = 26;
const ll MAXK = 50 * 25 + 10;
ll n, k;
ll dp[MAXN][MAXT][MAXK];
void no() {
cout << 0 << endl;
exit(0);
}
ll solve(ll n, ll k) {
if (k >= MAXK || k % 2)
return 0;
return dp[n][0][k / 2];
}
int main() {
cout << setprecision(30);
ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
cin >> n >> k;
dp[0][0][0] = 1;
for (ll pos = 0; pos + 1 < MAXN; ++pos) {
for (ll t = 0; t < MAXT; ++t) {
for (ll odd = 0; odd < MAXK; ++odd) {
if (odd + t < MAXT)
add(dp[pos + 1][t][odd + t], dp[pos][t][odd]);
if (t >= 1 && odd + t - 1 < MAXT)
add(dp[pos + 1][t - 1][odd + t - 1], mul(t * t, dp[pos][t][odd]));
if (t >= 0 && odd + t < MAXT)
add(dp[pos + 1][t][odd + t], mul(2 * t, dp[pos][t][odd]));
if ((t + 1 < MAXT) && odd + t + 1 < MAXK)
add(dp[pos + 1][t + 1][odd + t + 1], mul(1LL, dp[pos][t][odd]));
}
}
}
cout << solve(n, k) << endl;
return 0;
}
| #include <algorithm>
#include <array>
#include <assert.h>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef long double ld;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define sz(x) ((int)(x).size())
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<ld>> vvd;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const ll MOD = (ll)1e9 + 7;
ll binpow(ll a, ll n) {
ll res = 1;
while (n) {
if (n & 1) {
res *= a;
res %= MOD;
}
a *= a;
a %= MOD;
n >>= 1;
}
return res % MOD;
}
ll inv(ll x) { return binpow(x, MOD - 2); }
void add(ll &x, ll y) {
x += y;
if (x >= MOD)
x -= MOD;
}
void take(ll &x, ll y) {
x -= y;
if (x < 0)
x += MOD;
}
ll sum(ll a, ll b) {
add(a, b);
return a;
}
ll sub(ll a, ll b) {
take(a, b);
return a;
}
ll mul(ll x, ll y) { return (x * y) % MOD; }
ll rat(ll x, ll y) {
assert(y);
return mul(x, inv(y));
}
const ll MAXN = 52;
const ll MAXT = 26;
const ll MAXK = 50 * 25 + 10;
ll n, k;
ll dp[MAXN][MAXT][MAXK];
void no() {
cout << 0 << endl;
exit(0);
}
ll solve(ll n, ll k) {
if (k >= MAXK || k % 2)
return 0;
return dp[n][0][k / 2];
}
int main() {
cout << setprecision(30);
ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
cin >> n >> k;
dp[0][0][0] = 1;
for (ll pos = 0; pos + 1 < MAXN; ++pos) {
for (ll t = 0; t < MAXT; ++t) {
for (ll odd = 0; odd < MAXK; ++odd) {
if (odd + t < MAXK)
add(dp[pos + 1][t][odd + t], dp[pos][t][odd]);
if (t >= 1 && odd + t - 1 < MAXK)
add(dp[pos + 1][t - 1][odd + t - 1], mul(t * t, dp[pos][t][odd]));
if (t >= 0 && odd + t < MAXK)
add(dp[pos + 1][t][odd + t], mul(2 * t, dp[pos][t][odd]));
if ((t + 1 < MAXT) && odd + t + 1 < MAXK)
add(dp[pos + 1][t + 1][odd + t + 1], mul(1LL, dp[pos][t][odd]));
}
}
}
cout << solve(n, k) << endl;
return 0;
}
| [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 785,720 | 785,721 | u651764969 | cpp |
p02974 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll << 50;
template <typename T> void printv(const vector<T> &s) {
for (int i = 0; i < (int)(s.size()); ++i) {
cout << s[i];
if (i == (int)(s.size()) - 1)
cout << endl;
else
cout << " ";
}
}
int main() {
cin.tie(0);
cout << fixed << setprecision(10);
ll n, m;
cin >> n >> m;
vector<vvll> dp(n + 1, vvll(n + 1, vll(m + 1, 0)));
dp[0][0][0] = 1;
for (int i = 0; i < n; ++i) {
for (int j = 0; j <= n; ++j) {
for (int k = 0; k <= m; ++k) {
int tmpk = k + 2 * j;
if (0 <= tmpk && tmpk <= m) {
dp[i + 1][j][tmpk] += dp[i][j][k];
dp[i + 1][j][tmpk] %= MOD;
dp[i + 1][j + 1][tmpk] += dp[i][j][k];
dp[i + 1][j + 1][tmpk] %= MOD;
dp[i + 1][j][tmpk] += j * dp[i][j][k] % MOD;
dp[i + 1][j][tmpk] %= MOD;
if (j > 0)
dp[i + 1][j - 1][tmpk] += j * j % MOD * dp[i][j][k] % MOD;
if (j > 0)
dp[i + 1][j - 1][tmpk] %= MOD;
dp[i + 1][j][tmpk] += j * dp[i][j][k] % MOD;
dp[i + 1][j][tmpk] %= MOD;
}
}
}
}
cout << dp[n][0][m] << endl;
}
| #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll << 50;
template <typename T> void printv(const vector<T> &s) {
for (int i = 0; i < (int)(s.size()); ++i) {
cout << s[i];
if (i == (int)(s.size()) - 1)
cout << endl;
else
cout << " ";
}
}
int main() {
cin.tie(0);
cout << fixed << setprecision(10);
ll n, m;
cin >> n >> m;
vector<vvll> dp(n + 1, vvll(n + 2, vll(m + 1, 0)));
dp[0][0][0] = 1;
for (int i = 0; i < n; ++i) {
for (int j = 0; j <= n; ++j) {
for (int k = 0; k <= m; ++k) {
int tmpk = k + 2 * j;
if (0 <= tmpk && tmpk <= m) {
dp[i + 1][j][tmpk] += dp[i][j][k];
dp[i + 1][j][tmpk] %= MOD;
dp[i + 1][j + 1][tmpk] += dp[i][j][k];
dp[i + 1][j + 1][tmpk] %= MOD;
dp[i + 1][j][tmpk] += j * dp[i][j][k] % MOD;
dp[i + 1][j][tmpk] %= MOD;
if (j > 0)
dp[i + 1][j - 1][tmpk] += j * j % MOD * dp[i][j][k] % MOD;
if (j > 0)
dp[i + 1][j - 1][tmpk] %= MOD;
dp[i + 1][j][tmpk] += j * dp[i][j][k] % MOD;
dp[i + 1][j][tmpk] %= MOD;
}
}
}
}
cout << dp[n][0][m] << endl;
}
| [
"literal.number.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 785,725 | 785,726 | u334351654 | cpp |
p02974 | #include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
// using
using namespace std;
// typedef
typedef long long ll;
// define
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define LB(c, x) lower_bound(c.begin(), c.end(), x)
#define UB(c, x) upper_bound(c.begin(), c.end(), x)
#define LI(c, x) distance(c.begin(), LB(c, x))
#define UI(c, x) distance(c.begin(), UB(c, x))
// functions
template <class T> T ceil(T a, T b) { return (a + b - 1) / b; }
template <class T> T round(T a, T b) { return (a + b / 2) / b; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template <class T> bool amax(T &a, const T &b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> bool amin(T &a, const T &b) {
if (b < a) {
a = b;
return true;
}
return false;
}
ll modpow(ll a, ll b, ll m) {
if (b == 0) {
return 1;
} else if (b % 2 == 0) {
ll h = modpow(a, b / 2, m);
return h * h % m;
} else {
return a * modpow(a, b - 1, m) % m;
}
}
ll comb(ll a, ll b, ll m) {
if (b > a - b) {
return comb(a, a - b, m);
}
ll c = 1, d = 1;
REP(i, b) {
c *= (a - i);
d *= (b - i);
c %= m;
d %= m;
}
return c * modpow(d, m - 2, m) % m;
}
const int MAX_N = 50;
const int MOD = 1000000007;
int dp[MAX_N + 1][MAX_N + 1][MAX_N * MAX_N];
// main
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int N, K;
cin >> N >> K;
dp[0][0][0] = 1;
REP(i, N) {
REP(j, i + 1) {
REP(k, K + 1) {
int nj;
nj = j;
dp[i + 1][nj][k + nj * 2] += dp[i][j][k];
dp[i + 1][nj][k + nj * 2] %= MOD;
nj = j + 1;
dp[i + 1][nj][k + nj * 2] += dp[i][j][k];
dp[i + 1][nj][k + nj * 2] %= MOD;
nj = j;
dp[i + 1][nj][k + nj * 2] += dp[i][j][k] * j * 2;
dp[i + 1][nj][k + nj * 2] %= MOD;
if (j >= 1) {
nj = j - 1;
dp[i + 1][nj][k + nj * 2] += dp[i][j][k] * j * j;
dp[i + 1][nj][k + nj * 2] %= MOD;
}
}
}
}
cout << dp[N][0][K] << endl;
return 0;
}
| #include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
// using
using namespace std;
// typedef
typedef long long ll;
// define
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define LB(c, x) lower_bound(c.begin(), c.end(), x)
#define UB(c, x) upper_bound(c.begin(), c.end(), x)
#define LI(c, x) distance(c.begin(), LB(c, x))
#define UI(c, x) distance(c.begin(), UB(c, x))
// functions
template <class T> T ceil(T a, T b) { return (a + b - 1) / b; }
template <class T> T round(T a, T b) { return (a + b / 2) / b; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template <class T> bool amax(T &a, const T &b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> bool amin(T &a, const T &b) {
if (b < a) {
a = b;
return true;
}
return false;
}
ll modpow(ll a, ll b, ll m) {
if (b == 0) {
return 1;
} else if (b % 2 == 0) {
ll h = modpow(a, b / 2, m);
return h * h % m;
} else {
return a * modpow(a, b - 1, m) % m;
}
}
ll comb(ll a, ll b, ll m) {
if (b > a - b) {
return comb(a, a - b, m);
}
ll c = 1, d = 1;
REP(i, b) {
c *= (a - i);
d *= (b - i);
c %= m;
d %= m;
}
return c * modpow(d, m - 2, m) % m;
}
const int MAX_N = 50;
const int MOD = 1000000007;
ll dp[MAX_N + 1][MAX_N + 1][MAX_N * MAX_N];
// main
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int N, K;
cin >> N >> K;
dp[0][0][0] = 1;
REP(i, N) {
REP(j, i + 1) {
REP(k, K + 1) {
int nj;
nj = j;
dp[i + 1][nj][k + nj * 2] += dp[i][j][k];
dp[i + 1][nj][k + nj * 2] %= MOD;
nj = j + 1;
dp[i + 1][nj][k + nj * 2] += dp[i][j][k];
dp[i + 1][nj][k + nj * 2] %= MOD;
nj = j;
dp[i + 1][nj][k + nj * 2] += dp[i][j][k] * j * 2;
dp[i + 1][nj][k + nj * 2] %= MOD;
if (j >= 1) {
nj = j - 1;
dp[i + 1][nj][k + nj * 2] += dp[i][j][k] * j * j;
dp[i + 1][nj][k + nj * 2] %= MOD;
}
}
}
}
cout << dp[N][0][K] << endl;
return 0;
}
| [
"variable_declaration.type.change"
] | 785,735 | 785,736 | u164300951 | cpp |
p02974 | #include <bits/stdc++.h>
#define INL inline
#define REG register
#define DB double
#define LDB long double
#define ULL unsigned long long
#define LL long long
#define RPT(i, x, y) for (REG int i = (x); i < (y); i++)
#define DRPT(i, x, y) for (REG int i = (x); i > (y); i--)
#define MST(a, b) memset((a), (b), sizeof(a))
#define MRK() cout << "Mark" << endl;
#define WRT(x) cout << #x << " = " << (x) << endl;
#define MAXN 10000
#define MAXM 10000
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define LLINF 0x3f3f3f3f3f3f3f3f
#define EPS 1e-5
#define _ 0
using namespace std;
LL dp[52][52][3010];
LL n, k;
int main() {
cin >> n >> k;
if (k & 1) {
cout << 0;
return 0;
}
dp[0][0][0] = 1;
RPT(i, 0, n + 1)
RPT(j, 0, i + 1)
RPT(k, 0, i * i / 2 + 2) {
// cout<<i<<' '<<j<<' '<<k<<' '<<dp[i][j][k]<<endl;
dp[i][j][k] %= MOD;
dp[i + 1][j][k + j] += dp[i][j][k];
dp[i + 1][j + 1][k + j + 1] += dp[i][j][k];
dp[i + 1][j][k + j] += dp[i][j][k] * 2 * j;
if (j >= 1)
dp[i + 1][j - 1][k + j - 1] += dp[i][j][k] * j * j;
}
cout << dp[n][0][k / 2];
return ~~(0 ^ _ ^ 0);
}
| #include <bits/stdc++.h>
#define INL inline
#define REG register
#define DB double
#define LDB long double
#define ULL unsigned long long
#define LL long long
#define RPT(i, x, y) for (REG int i = (x); i < (y); i++)
#define DRPT(i, x, y) for (REG int i = (x); i > (y); i--)
#define MST(a, b) memset((a), (b), sizeof(a))
#define MRK() cout << "Mark" << endl;
#define WRT(x) cout << #x << " = " << (x) << endl;
#define MAXN 10000
#define MAXM 10000
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define LLINF 0x3f3f3f3f3f3f3f3f
#define EPS 1e-5
#define _ 0
using namespace std;
ULL dp[52][52][3010];
LL n, k;
int main() {
cin >> n >> k;
if (k & 1) {
cout << 0;
return 0;
}
dp[0][0][0] = 1;
RPT(i, 0, n + 1)
RPT(j, 0, i + 1)
RPT(k, 0, i * i + 2) {
// cout<<i<<' '<<j<<' '<<k<<' '<<dp[i][j][k]<<endl;
dp[i][j][k] %= MOD;
dp[i + 1][j][k + j] += dp[i][j][k];
dp[i + 1][j + 1][k + j + 1] += dp[i][j][k];
dp[i + 1][j][k + j] += dp[i][j][k] * 2 * j;
if (j >= 1)
dp[i + 1][j - 1][k + j - 1] += dp[i][j][k] * j * j;
}
cout << dp[n][0][k / 2];
return ~~(0 ^ _ ^ 0);
}
| [
"variable_declaration.type.change",
"expression.operation.binary.remove"
] | 785,737 | 785,738 | u071420104 | cpp |
p02974 | #include <algorithm>
#include <cstdio>
using namespace std;
static const int A = 1e+9 + 7;
static const int MAX_N = 50;
static const int MAX_K = 1250;
unsigned int dp[MAX_N + 1][MAX_N + 1][MAX_K + 1];
int n, k;
void solve();
int main() {
scanf("%d %d", &n, &k);
if (k > n * n / 2)
printf("0\n");
else {
solve();
printf("%u\n", dp[n][0][k]);
}
return 0;
}
void solve() {
dp[1][0][0] = 1;
dp[1][1][2] = 1;
for (int i = 2; i <= n; i++) {
for (int l = 0; l <= min(i * (i + 1), k); l++) {
for (int j = 0; j <= n && l >= 2 * j; j++) {
dp[i][j][l] = (2 * j + 1) * dp[i - 1][j][l - 2 * j];
if (j <= n)
dp[i][j][l] += (j + 1) * (j + 1) * dp[i - 1][j + 1][l - 2 * j];
if (j > 0)
dp[i][j][l] += dp[i - 1][j - 1][l - 2 * j];
dp[i][j][l] %= A;
// printf("%d %d %d: %u\n", i, j, l, dp[i][j][l]);
}
}
}
}
| #include <algorithm>
#include <cstdio>
using namespace std;
static const int A = 1e+9 + 7;
static const int MAX_N = 50;
static const int MAX_K = 1250;
unsigned long dp[MAX_N + 1][MAX_N + 1][MAX_K + 1];
int n, k;
void solve();
int main() {
scanf("%d %d", &n, &k);
if (k > n * n / 2)
printf("0\n");
else {
solve();
printf("%lu\n", dp[n][0][k]);
}
return 0;
}
void solve() {
dp[1][0][0] = 1;
dp[1][1][2] = 1;
for (int i = 2; i <= n; i++) {
for (int l = 0; l <= min(i * (i + 1), k); l++) {
for (int j = 0; j <= n && l >= 2 * j; j++) {
dp[i][j][l] = (2 * j + 1) * dp[i - 1][j][l - 2 * j];
if (j <= n)
dp[i][j][l] += (j + 1) * (j + 1) * dp[i - 1][j + 1][l - 2 * j];
if (j > 0)
dp[i][j][l] += dp[i - 1][j - 1][l - 2 * j];
dp[i][j][l] %= A;
// printf("%d %d %d: %u\n", i, j, l, dp[i][j][l]);
}
}
}
}
| [
"variable_declaration.type.primitive.change",
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 785,741 | 785,742 | u675757825 | cpp |
p02974 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl;
int mod = 1000000007;
#define mul(a, b) ((a % mod) * (b % mod)) % mod
int dp[55][55][2600];
int main() {
int n, score;
cin >> n >> score;
dp[0][0][0] = 1;
rep(i, n) {
rep(j, i + 1) {
rep(k, score + 1) {
dp[i + 1][j][k + j * 2] += dp[i][j][k] % mod;
dp[i + 1][j + 1][k + (j + 1) * 2] += dp[i][j][k] % mod;
dp[i + 1][j][k + j * 2] += mul(dp[i][j][k], 2 * j);
if (j >= 1) {
dp[i + 1][j - 1][k + (j - 1) * 2] += mul(mul(dp[i][j][k], j), j);
}
}
}
}
OP(dp[n][0][score])
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl;
int mod = 1000000007;
#define mul(a, b) ((a % mod) * (b % mod)) % mod
long long int dp[55][55][2600];
int main() {
int n, score;
cin >> n >> score;
dp[0][0][0] = 1;
rep(i, n + 1) {
rep(j, i + 1) {
rep(k, score + 1) {
dp[i + 1][j][k + j * 2] += dp[i][j][k] % mod;
dp[i + 1][j + 1][k + (j + 1) * 2] += dp[i][j][k] % mod;
dp[i + 1][j][k + j * 2] += mul(dp[i][j][k], 2 * j);
if (j >= 1) {
dp[i + 1][j - 1][k + (j - 1) * 2] += mul(mul(dp[i][j][k], j), j);
}
}
}
}
OP(dp[n][0][score] % mod)
return 0;
} | [
"variable_declaration.type.widen.change",
"expression.operation.binary.add"
] | 785,747 | 785,748 | u016189984 | cpp |
p02974 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl;
int mod = 1000000007;
#define mul(a, b) ((a % mod) * (b % mod)) % mod
long long int dp[55][55][2600] = {0};
int main() {
int n, score;
cin >> n >> score;
dp[0][0][0] = 1;
rep(i, n) {
rep(j, i + 1) {
rep(k, score + 1) {
dp[i + 1][j][k + j * 2] += dp[i][j][k] % mod;
dp[i + 1][j + 1][k + (j + 1) * 2] += dp[i][j][k] % mod;
dp[i + 1][j][k + j * 2] += mul(dp[i][j][k], 2 * j);
if (j >= 1) {
dp[i + 1][j - 1][k + (j - 1) * 2] += mul(mul(dp[i][j][k], j), j);
}
}
}
}
OP(dp[n][0][score])
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl;
int mod = 1000000007;
#define mul(a, b) ((a % mod) * (b % mod)) % mod
long long int dp[55][55][2600] = {0};
int main() {
int n, score;
cin >> n >> score;
dp[0][0][0] = 1;
rep(i, n + 1) {
rep(j, i + 1) {
rep(k, score + 1) {
dp[i + 1][j][k + j * 2] += dp[i][j][k] % mod;
dp[i + 1][j + 1][k + (j + 1) * 2] += dp[i][j][k] % mod;
dp[i + 1][j][k + j * 2] += mul(dp[i][j][k], 2 * j);
if (j >= 1) {
dp[i + 1][j - 1][k + (j - 1) * 2] += mul(mul(dp[i][j][k], j), j);
}
}
}
}
OP(dp[n][0][score] % mod)
return 0;
} | [
"expression.operation.binary.add"
] | 785,749 | 785,750 | u016189984 | cpp |
p02974 | #include <iostream>
using namespace std;
long long dp[55][55][2605];
long long mod = 10e9 + 7;
int main(int argc, char *argv[]) {
int n, k;
cin >> n >> k;
dp[0][0][0] = 1;
for (int i = 0; i < n; i++) {
for (int j = 0; j < i + 1; j++) {
for (int l = 0; l <= k + 1; l++) {
int nj = j;
(dp[i + 1][nj][l + nj * 2] += dp[i][j][l]) %= mod;
nj = j + 1;
(dp[i + 1][nj][l + nj * 2] += dp[i][j][l]) %= mod;
nj = j;
int x = j * 2 % mod;
(dp[i + 1][nj][l + nj * 2] += dp[i][j][l] * x) %= mod;
if (j >= 1) {
nj = j - 1;
x = j * j % mod;
(dp[i + 1][nj][l + nj * 2] += dp[i][j][l] * x) %= mod;
}
}
}
}
cout << dp[n][0][k] % mod << endl;
return 0;
} | #include <iostream>
using namespace std;
long long dp[55][55][2605];
long long mod = 1e9 + 7;
int main(int argc, char *argv[]) {
int n, k;
cin >> n >> k;
dp[0][0][0] = 1;
for (int i = 0; i < n; i++) {
for (int j = 0; j < i + 1; j++) {
for (int l = 0; l < k + 1; l++) {
int nj = j;
(dp[i + 1][nj][l + nj * 2] += dp[i][j][l]) %= mod;
nj = j + 1;
(dp[i + 1][nj][l + nj * 2] += dp[i][j][l]) %= mod;
nj = j;
int x = j * 2 % mod;
(dp[i + 1][nj][l + nj * 2] += dp[i][j][l] * x) %= mod;
if (j >= 1) {
nj = j - 1;
x = j * j % mod;
(dp[i + 1][nj][l + nj * 2] += dp[i][j][l] * x) %= mod;
}
}
}
}
cout << dp[n][0][k] % mod << endl;
return 0;
} | [
"literal.number.change",
"expression.operation.binary.change",
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one"
] | 785,759 | 785,760 | u993229809 | cpp |
p02974 | #include <iostream>
using namespace std;
long long dp[55][55][2605];
long long mod = 10e9 + 7;
int main(int argc, char *argv[]) {
int n, k;
cin >> n >> k;
dp[0][0][0] = 1;
for (int i = 0; i < n; i++) {
for (int j = 0; j < i + 1; j++) {
for (int l = 0; l < k + 1; l++) {
int nj = j;
(dp[i + 1][nj][l + nj * 2] += dp[i][j][l]) %= mod;
nj = j + 1;
(dp[i + 1][nj][l + nj * 2] += dp[i][j][l]) %= mod;
nj = j;
int x = j * 2 % mod;
(dp[i + 1][nj][l + nj * 2] += dp[i][j][l] * x) %= mod;
if (j >= 1) {
nj = j - 1;
x = j * j % mod;
(dp[i + 1][nj][l + nj * 2] += dp[i][j][l] * x) %= mod;
}
}
}
}
cout << dp[n][0][k] % mod << endl;
return 0;
} | #include <iostream>
using namespace std;
long long dp[55][55][2605];
long long mod = 1e9 + 7;
int main(int argc, char *argv[]) {
int n, k;
cin >> n >> k;
dp[0][0][0] = 1;
for (int i = 0; i < n; i++) {
for (int j = 0; j < i + 1; j++) {
for (int l = 0; l < k + 1; l++) {
int nj = j;
(dp[i + 1][nj][l + nj * 2] += dp[i][j][l]) %= mod;
nj = j + 1;
(dp[i + 1][nj][l + nj * 2] += dp[i][j][l]) %= mod;
nj = j;
int x = j * 2 % mod;
(dp[i + 1][nj][l + nj * 2] += dp[i][j][l] * x) %= mod;
if (j >= 1) {
nj = j - 1;
x = j * j % mod;
(dp[i + 1][nj][l + nj * 2] += dp[i][j][l] * x) %= mod;
}
}
}
}
cout << dp[n][0][k] % mod << endl;
return 0;
} | [
"literal.number.change",
"expression.operation.binary.change"
] | 785,761 | 785,760 | u993229809 | cpp |
p02974 | #include <iostream>
using namespace std;
long long dp[55][55][2605];
long long mod = 10e9 + 7;
int main(int argc, char *argv[]) {
int n, k;
cin >> n >> k;
dp[0][0][0] = 1;
for (int i = 0; i < n; i++) {
for (int j = 0; j < i + 1; j++) {
for (int l = 0; l < k + 1; l++) {
int nj = j;
(dp[i + 1][nj][l + nj * 2] += dp[i][j][l]) %= mod;
nj = j + 1;
(dp[i + 1][nj][l + nj * 2] += dp[i][j][l]) %= mod;
nj = j;
int x = j * 2 % mod;
(dp[i + 1][nj][l + nj * 2] += dp[i][j][l] * x) %= mod;
if (j >= 1) {
nj = j - 1;
x = j * j % mod;
(dp[i + 1][nj][l + nj * 2] += dp[i][j][l] * x) %= mod;
}
}
}
}
cout << dp[n][0][k] << endl;
return 0;
} | #include <iostream>
using namespace std;
long long dp[55][55][2605];
long long mod = 1e9 + 7;
int main(int argc, char *argv[]) {
int n, k;
cin >> n >> k;
dp[0][0][0] = 1;
for (int i = 0; i < n; i++) {
for (int j = 0; j < i + 1; j++) {
for (int l = 0; l < k + 1; l++) {
int nj = j;
(dp[i + 1][nj][l + nj * 2] += dp[i][j][l]) %= mod;
nj = j + 1;
(dp[i + 1][nj][l + nj * 2] += dp[i][j][l]) %= mod;
nj = j;
int x = j * 2 % mod;
(dp[i + 1][nj][l + nj * 2] += dp[i][j][l] * x) %= mod;
if (j >= 1) {
nj = j - 1;
x = j * j % mod;
(dp[i + 1][nj][l + nj * 2] += dp[i][j][l] * x) %= mod;
}
}
}
}
cout << dp[n][0][k] % mod << endl;
return 0;
} | [
"literal.number.change",
"expression.operation.binary.change"
] | 785,762 | 785,760 | u993229809 | cpp |
p02974 | #include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REP_S(i, n, s) for (int i = s; i < (int)(n); i++)
const int mod = 1e9 + 7;
int dp[55][55][55 * 55 + 100] = {};
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int num = 0;
int score = 0;
cin >> num >> score;
dp[0][0][0] = 1;
REP(i, num) {
REP(j, i + 1) {
// nextJ *
// 2は保留ないしつないだ際に次の段で増える奇妙さが両側の線で発生するため
REP(k, score + 1) {
// 両方繋ぐ
{
int nextJ = j; // 残り数が変わらない
dp[i + 1][nextJ][k + nextJ * 2] += dp[i][j][k];
dp[i + 1][nextJ][k + nextJ * 2] %= mod;
}
// どちらも繋がない
{
int nextJ = j + 1; // 残り数が増える
dp[i + 1][nextJ][k + nextJ * 2] += dp[i][j][k];
dp[i + 1][nextJ][k + nextJ * 2] %= mod;
}
// 片側だけ別のにつなぐ
{
int nextJ = j; // 残り数が変わらない
int x = j * 2; // 別のにつなぐつなぎ方はj通りでそれが両側
dp[i + 1][nextJ][k + nextJ * 2] += (dp[i][j][k] * x);
dp[i + 1][nextJ][k + nextJ * 2] %= mod;
}
// 両方別のにつなぐ
if (j >= 1) {
int nextJ = j - 1; // 残り数が減る
int x = j * j; // それぞれのつなぎ方がるので
dp[i + 1][nextJ][k + nextJ * 2] += (dp[i][j][k] * x);
dp[i + 1][nextJ][k + nextJ * 2] %= mod;
}
}
}
}
cout << dp[num][0][score] << endl;
return 0;
} | #include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REP_S(i, n, s) for (int i = s; i < (int)(n); i++)
const int mod = 1e9 + 7;
ll dp[55][55][55 * 55 + 100] = {};
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int num = 0;
int score = 0;
cin >> num >> score;
dp[0][0][0] = 1;
REP(i, num) {
REP(j, i + 1) {
// nextJ *
// 2は保留ないしつないだ際に次の段で増える奇妙さが両側の線で発生するため
REP(k, score + 1) {
// 両方繋ぐ
{
int nextJ = j; // 残り数が変わらない
dp[i + 1][nextJ][k + nextJ * 2] += dp[i][j][k];
dp[i + 1][nextJ][k + nextJ * 2] %= mod;
}
// どちらも繋がない
{
int nextJ = j + 1; // 残り数が増える
dp[i + 1][nextJ][k + nextJ * 2] += dp[i][j][k];
dp[i + 1][nextJ][k + nextJ * 2] %= mod;
}
// 片側だけ別のにつなぐ
{
int nextJ = j; // 残り数が変わらない
int x = j * 2; // 別のにつなぐつなぎ方はj通りでそれが両側
dp[i + 1][nextJ][k + nextJ * 2] += (dp[i][j][k] * x);
dp[i + 1][nextJ][k + nextJ * 2] %= mod;
}
// 両方別のにつなぐ
if (j >= 1) {
int nextJ = j - 1; // 残り数が減る
int x = j * j; // それぞれのつなぎ方がるので
dp[i + 1][nextJ][k + nextJ * 2] += (dp[i][j][k] * x);
dp[i + 1][nextJ][k + nextJ * 2] %= mod;
}
}
}
}
cout << dp[num][0][score] << endl;
return 0;
} | [
"variable_declaration.type.change"
] | 785,763 | 785,764 | u865835920 | cpp |
p02974 | #include <bits/stdc++.h>
using namespace std;
long long dp[51][51][2551];
int main() {
memset(dp, 0, sizeof(dp));
int mod = 1e9 + 7;
int n, K;
cin >> n >> K;
dp[0][0][0] = 1;
for (int i = 0; i < n; ++i) {
for (int j = 0; j <= i; ++j) {
for (int k = 0; k <= K; ++k) {
int curr = dp[i][j][k] % mod;
// connect current
dp[i + 1][j][k + j * 2] += curr;
dp[i + 1][j][k + j * 2] %= mod;
// connect down
dp[i + 1][j + 1][k + j * 2 + 2] += curr;
dp[i + 1][j + 1][k + j * 2 + 2] %= mod;
// connect down connect up
dp[i + 1][j][k + j * 2] += 2 * j * curr;
dp[i + 1][j][k + j * 2] %= mod;
// connect up connect up
dp[i + 1][j - 1][k + j * 2 - 2] += j * j * curr;
dp[i + 1][j - 1][k + j * 2 - 2] %= mod;
// cout<<dp[i+1][j][k+j*2]<<" "<<dp[i+1][j+1][k+j*2+2]<<"
// "<<dp[i+1][j-1][k+j*2-2]<<endl;
}
}
}
cout << (dp[n][0][K] % mod) << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
long long dp[51][51][2551];
int main() {
memset(dp, 0, sizeof(dp));
int mod = 1e9 + 7;
int n, K;
cin >> n >> K;
dp[0][0][0] = 1;
for (int i = 0; i < n; ++i) {
for (int j = 0; j <= i; ++j) {
for (int k = 0; k <= K; ++k) {
long long curr = dp[i][j][k] % mod;
// connect current
dp[i + 1][j][k + j * 2] += curr;
dp[i + 1][j][k + j * 2] %= mod;
// connect down
dp[i + 1][j + 1][k + j * 2 + 2] += curr;
dp[i + 1][j + 1][k + j * 2 + 2] %= mod;
// connect down connect up
dp[i + 1][j][k + j * 2] += 2 * j * curr;
dp[i + 1][j][k + j * 2] %= mod;
// connect up connect up
dp[i + 1][j - 1][k + j * 2 - 2] += j * j * curr;
dp[i + 1][j - 1][k + j * 2 - 2] %= mod;
// cout<<dp[i+1][j][k+j*2]<<" "<<dp[i+1][j+1][k+j*2+2]<<"
// "<<dp[i+1][j-1][k+j*2-2]<<endl;
}
}
}
cout << (dp[n][0][K] % mod) << endl;
return 0;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 785,765 | 785,766 | u542111796 | cpp |
p02974 | #include <bits/stdc++.h>
using namespace std;
int dp[51][51][2551];
int main() {
memset(dp, 0, sizeof(dp));
int mod = 1e9 + 7;
int n, K;
cin >> n >> K;
dp[0][0][0] = 1;
for (int i = 0; i < n; ++i) {
for (int j = 0; j <= i; ++j) {
for (int k = 0; k <= K; ++k) {
int curr = dp[i][j][k] % mod;
// connect current
dp[i + 1][j][k + j * 2] += curr;
dp[i + 1][j][k + j * 2] %= mod;
// connect down
dp[i + 1][j + 1][k + j * 2 + 2] += curr;
dp[i + 1][j + 1][k + j * 2 + 2] %= mod;
// connect down connect up
dp[i + 1][j][k + j * 2] += 2 * j * curr;
dp[i + 1][j][k + j * 2] %= mod;
// connect up connect up
dp[i + 1][j - 1][k + j * 2 - 2] += j * j * curr;
dp[i + 1][j - 1][k + j * 2 - 2] %= mod;
// cout<<dp[i+1][j][k+j*2]<<" "<<dp[i+1][j+1][k+j*2+2]<<"
// "<<dp[i+1][j-1][k+j*2-2]<<endl;
}
}
}
cout << (dp[n][0][K] % mod) << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
long long dp[51][51][2551];
int main() {
memset(dp, 0, sizeof(dp));
int mod = 1e9 + 7;
int n, K;
cin >> n >> K;
dp[0][0][0] = 1;
for (int i = 0; i < n; ++i) {
for (int j = 0; j <= i; ++j) {
for (int k = 0; k <= K; ++k) {
long long curr = dp[i][j][k] % mod;
// connect current
dp[i + 1][j][k + j * 2] += curr;
dp[i + 1][j][k + j * 2] %= mod;
// connect down
dp[i + 1][j + 1][k + j * 2 + 2] += curr;
dp[i + 1][j + 1][k + j * 2 + 2] %= mod;
// connect down connect up
dp[i + 1][j][k + j * 2] += 2 * j * curr;
dp[i + 1][j][k + j * 2] %= mod;
// connect up connect up
dp[i + 1][j - 1][k + j * 2 - 2] += j * j * curr;
dp[i + 1][j - 1][k + j * 2 - 2] %= mod;
// cout<<dp[i+1][j][k+j*2]<<" "<<dp[i+1][j+1][k+j*2+2]<<"
// "<<dp[i+1][j-1][k+j*2-2]<<endl;
}
}
}
cout << (dp[n][0][K] % mod) << endl;
return 0;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 785,767 | 785,766 | u542111796 | cpp |
p02974 | // by Balloons
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#define mpr make_pair
#define debug() puts("okkkkkkkk")
#define rep(i, a, b) for (int(i) = (a); (i) <= (b); (i)++)
using namespace std;
typedef long long LL;
#define int LL
const int inf = 1 << 30, mod = 998244353;
int n, k;
int dp[52][2505][52];
signed main() {
scanf("%lld%lld", &n, &k);
dp[0][0][0] = 1;
for (int i = 0; i <= n; i++) {
for (int s = 0; s <= k; s++) {
for (int j = 0; j <= n; j++) {
if (s + 2 * j <= k) {
(dp[i + 1][s + 2 * j][j] += dp[i][s][j]) %= mod;
(dp[i + 1][s + 2 * j][j + 1] += dp[i][s][j]) %= mod;
if (j > 0) {
(dp[i + 1][s + 2 * j][j - 1] += 1ll * j * j * dp[i][s][j] % mod) %=
mod;
(dp[i + 1][s + 2 * j][j] += 2ll * j * dp[i][s][j] % mod) %= mod;
}
}
}
}
}
printf("%lld\n", dp[n][k][0]);
return 0;
}
| // by Balloons
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#define mpr make_pair
#define debug() puts("okkkkkkkk")
#define rep(i, a, b) for (int(i) = (a); (i) <= (b); (i)++)
using namespace std;
typedef long long LL;
#define int LL
const int inf = 1 << 30, mod = 1000000007;
int n, k;
int dp[52][2505][52];
signed main() {
scanf("%lld%lld", &n, &k);
dp[0][0][0] = 1;
for (int i = 0; i <= n; i++) {
for (int s = 0; s <= k; s++) {
for (int j = 0; j <= n; j++) {
if (s + 2 * j <= k) {
(dp[i + 1][s + 2 * j][j] += dp[i][s][j]) %= mod;
(dp[i + 1][s + 2 * j][j + 1] += dp[i][s][j]) %= mod;
if (j > 0) {
(dp[i + 1][s + 2 * j][j - 1] += 1ll * j * j * dp[i][s][j] % mod) %=
mod;
(dp[i + 1][s + 2 * j][j] += 2ll * j * dp[i][s][j] % mod) %= mod;
}
}
}
}
}
printf("%lld\n", dp[n][k][0]);
return 0;
}
| [
"literal.number.change",
"variable_declaration.value.change"
] | 785,785 | 785,786 | u226963522 | cpp |
p02974 | #include <cassert>
#include <iostream>
#include <vector>
long long MOD = 1000000007;
int main() {
int N, K;
std::cin >> N >> K;
std::vector<std::vector<std::vector<long long>>> dp(N + 1);
for (int i = 0; i <= N; ++i) {
dp[i].resize(N + 1);
for (int j = 0; j <= N; ++j)
dp[i][j].assign(N * (N + 3), 0);
}
dp[0][0][0] = 1;
for (int i = 0; i < N; ++i) {
for (int j = 0; j <= i; ++j) {
for (int k = 0; k <= K; ++k) {
if (dp[i][j][k] == 0)
continue;
(dp[i + 1][j][k + 2 * j] += dp[i][j][k]) %= MOD;
(dp[i + 1][j + 1][k + 2 * (j + 1)] += dp[i][j][k]) %= MOD;
(dp[i + 1][j][k + 2 * j] += dp[i][j][k] * j) %= MOD;
if (j >= 1)
(dp[i + 1][j - 1][k + 2 * (j - 1)] += dp[i][j][k] * j * j) %= MOD;
}
}
}
std::cout << dp[N][0][K / 2] << std::endl;
return 0;
}
| #include <cassert>
#include <iostream>
#include <vector>
long long MOD = 1000000007;
int main() {
int N, K;
std::cin >> N >> K;
std::vector<std::vector<std::vector<long long>>> dp(N + 1);
for (int i = 0; i <= N; ++i) {
dp[i].resize(N + 1);
for (int j = 0; j <= N; ++j)
dp[i][j].assign(N * (N + 3), 0);
}
dp[0][0][0] = 1;
for (int i = 0; i < N; ++i) {
for (int j = 0; j <= i; ++j) {
for (int k = 0; k <= K; ++k) {
if (dp[i][j][k] == 0)
continue;
(dp[i + 1][j][k + 2 * j] += dp[i][j][k]) %= MOD;
(dp[i + 1][j + 1][k + 2 * (j + 1)] += dp[i][j][k]) %= MOD;
(dp[i + 1][j][k + 2 * j] += dp[i][j][k] * 2 * j) %= MOD;
if (j >= 1)
(dp[i + 1][j - 1][k + 2 * (j - 1)] += dp[i][j][k] * j * j) %= MOD;
}
}
}
std::cout << dp[N][0][K] << std::endl;
return 0;
}
| [
"assignment.change",
"expression.operation.binary.remove"
] | 785,797 | 785,798 | u875972329 | cpp |
p02974 | #include <bits/stdc++.h>
using namespace std;
const int N = 52, M = 1e9 + 7, Z = 2505;
int n, k, dp[N][N][N * N << 1];
void ck(int &x) {
if (x >= M)
x -= M;
}
int main() {
scanf("%d %d", &n, &k);
if (k & 1 || k > n * n / 2) {
puts("0");
return 0;
}
dp[0][0][Z] = 1;
for (int i = 0; i < n; ++i) {
for (int o = 0; o <= i; ++o) {
for (int u = 0; u <= 5005; ++u) {
if (!dp[i][o][u])
continue;
dp[i + 1][o][u] += dp[i][o][u];
ck(dp[i + 1][o][u]);
dp[i + 1][o][u] += 1ll * dp[i][o][u] * o % M;
ck(dp[i + 1][o][u]);
dp[i + 1][o][u] += 1ll * dp[i][o][u] * o % M;
ck(dp[i + 1][o][u]);
dp[i + 1][o + 1][u - 2 * i] += dp[i][o][u];
ck(dp[i + 1][o + 1][u - 2 * i]);
if (u)
dp[i + 1][o - 1][u + 2 * i] += 1ll * dp[i][o][u] * o * o % M;
ck(dp[i + 1][o + 1][u - 2 * i]);
}
}
}
printf("%d\n", dp[n][0][Z + k]);
} | #include <bits/stdc++.h>
using namespace std;
const int N = 52, M = 1e9 + 7, Z = 2505;
int n, k, dp[N][N][N * N << 1];
void ck(int &x) {
if (x >= M)
x -= M;
}
int main() {
scanf("%d %d", &n, &k);
if (k & 1 || k > n * n / 2) {
puts("0");
return 0;
}
dp[0][0][Z] = 1;
for (int i = 0; i < n; ++i) {
for (int o = 0; o <= i; ++o) {
for (int u = 0; u <= 5005; ++u) {
if (!dp[i][o][u])
continue;
dp[i + 1][o][u] += dp[i][o][u];
ck(dp[i + 1][o][u]);
dp[i + 1][o][u] += 1ll * dp[i][o][u] * o % M;
ck(dp[i + 1][o][u]);
dp[i + 1][o][u] += 1ll * dp[i][o][u] * o % M;
ck(dp[i + 1][o][u]);
dp[i + 1][o + 1][u - 2 * i] += dp[i][o][u];
ck(dp[i + 1][o + 1][u - 2 * i]);
if (o)
dp[i + 1][o - 1][u + 2 * i] += 1ll * dp[i][o][u] * o * o % M;
ck(dp[i + 1][o - 1][u + 2 * i]);
}
}
}
printf("%d\n", dp[n][0][Z + k]);
} | [
"identifier.change",
"control_flow.branch.if.condition.change",
"misc.opposites",
"expression.operator.arithmetic.change",
"variable_access.subscript.index.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 785,799 | 785,800 | u671537665 | cpp |
p02974 | #include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 55, M = 1e9 + 7, Z = 3000;
int n, k, dp[N][N][N * N << 1];
void ck(int &x) {
if (x >= M)
x -= M;
}
signed main() {
scanf("%lld %lld", &n, &k);
if (k & 1 || k > (n * n >> 1)) {
puts("0");
return 0;
}
dp[0][0][Z] = 1;
for (int i = 0; i < n; ++i) {
for (int o = 0; o <= i; ++o) {
for (int u = 0; u <= 6000; ++u) {
if (!dp[i][o][u])
continue;
dp[i + 1][o][u] += dp[i][o][u];
ck(dp[i + 1][o][u]);
dp[i + 1][o][u] += 1ll * dp[i][o][u] * o % M;
ck(dp[i + 1][o][u]);
dp[i + 1][o][u] += 1ll * dp[i][o][u] * o % M;
ck(dp[i + 1][o][u]);
dp[i + 1][o + 1][u - i] += dp[i][o][u];
ck(dp[i + 1][o + 1][u - i]);
if (o)
dp[i + 1][o - 1][u + i] += 1ll * dp[i][o][u] * o * o % M;
ck(dp[i + 1][o + 1][u - i]);
}
}
}
printf("%lld\n", dp[n][0][Z + k / 2]);
} | #include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 55, M = 1e9 + 7, Z = 3000;
int n, k, dp[N][N][N * N << 1];
void ck(int &x) {
if (x >= M)
x -= M;
}
signed main() {
scanf("%lld %lld", &n, &k);
if (k & 1 || k > (n * n >> 1)) {
puts("0");
return 0;
}
dp[0][0][Z] = 1;
for (int i = 0; i < n; ++i) {
for (int o = 0; o <= i; ++o) {
for (int u = 0; u <= 6000; ++u) {
if (!dp[i][o][u])
continue;
dp[i + 1][o][u] += dp[i][o][u];
ck(dp[i + 1][o][u]);
dp[i + 1][o][u] += 1ll * dp[i][o][u] * o % M;
ck(dp[i + 1][o][u]);
dp[i + 1][o][u] += 1ll * dp[i][o][u] * o % M;
ck(dp[i + 1][o][u]);
dp[i + 1][o + 1][u - i] += dp[i][o][u];
ck(dp[i + 1][o + 1][u - i]);
if (o)
dp[i + 1][o - 1][u + i] += 1ll * dp[i][o][u] * o * o % M;
ck(dp[i + 1][o - 1][u + i]);
}
}
}
printf("%lld\n", dp[n][0][Z + k / 2]);
} | [
"misc.opposites",
"expression.operator.arithmetic.change",
"variable_access.subscript.index.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 785,801 | 785,802 | u671537665 | cpp |
p02974 | #include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 55, M = 1e9 + 7, Z = 3000;
int n, k, dp[N][N][N * N << 1];
void ck(int &x) {
if (x >= M)
x -= M;
}
signed main() {
scanf("%lld %lld", &n, &k);
if (k & 1 || k > (n * n >> 1)) {
puts("0");
return 0;
}
dp[0][0][Z] = 1;
for (int i = 0; i < n; ++i) {
for (int o = 0; o <= i; ++o) {
for (int u = 0; u <= 6000; ++u) {
if (!dp[i][o][u])
continue;
dp[i + 1][o][u] += dp[i][o][u];
ck(dp[i + 1][o][u]);
dp[i + 1][o][u] += 1ll * dp[i][o][u] * o % M;
ck(dp[i + 1][o][u]);
dp[i + 1][o][u] += 1ll * dp[i][o][u] * o % M;
ck(dp[i + 1][o][u]);
dp[i + 1][o + 1][u - i] += dp[i][o][u];
ck(dp[i + 1][o + 1][u - i]);
if (u)
dp[i + 1][o - 1][u + i] += 1ll * dp[i][o][u] * o * o % M;
ck(dp[i + 1][o + 1][u - i]);
}
}
}
printf("%lld\n", dp[n][0][Z + k / 2]);
} | #include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 55, M = 1e9 + 7, Z = 3000;
int n, k, dp[N][N][N * N << 1];
void ck(int &x) {
if (x >= M)
x -= M;
}
signed main() {
scanf("%lld %lld", &n, &k);
if (k & 1 || k > (n * n >> 1)) {
puts("0");
return 0;
}
dp[0][0][Z] = 1;
for (int i = 0; i < n; ++i) {
for (int o = 0; o <= i; ++o) {
for (int u = 0; u <= 6000; ++u) {
if (!dp[i][o][u])
continue;
dp[i + 1][o][u] += dp[i][o][u];
ck(dp[i + 1][o][u]);
dp[i + 1][o][u] += 1ll * dp[i][o][u] * o % M;
ck(dp[i + 1][o][u]);
dp[i + 1][o][u] += 1ll * dp[i][o][u] * o % M;
ck(dp[i + 1][o][u]);
dp[i + 1][o + 1][u - i] += dp[i][o][u];
ck(dp[i + 1][o + 1][u - i]);
if (o)
dp[i + 1][o - 1][u + i] += 1ll * dp[i][o][u] * o * o % M;
ck(dp[i + 1][o - 1][u + i]);
}
}
}
printf("%lld\n", dp[n][0][Z + k / 2]);
} | [
"identifier.change",
"control_flow.branch.if.condition.change",
"misc.opposites",
"expression.operator.arithmetic.change",
"variable_access.subscript.index.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 785,803 | 785,802 | u671537665 | cpp |
p02974 | #include <bits/stdc++.h>
using namespace std;
#define M 2550
#define LL long long
const int mo = 1e9 + 7;
int dp[52][5201][52]; // 放到第i位 在我 之前 的空位有h位.
void Add(int &res, int x) {
res += x;
if (res > mo)
res -= mo;
return;
}
#define debug(x) cout << #x << " " << x << endl;
main() {
int n, k;
cin >> n >> k;
dp[1][M][0] = 1;
for (int i = 1; i <= n; i++) {
for (int j = 0; j <= M * 2; j++) {
for (int h = i - 1; h >= 0; h--) {
if (!dp[i][j][h])
continue;
Add(dp[i + 1][j][h], dp[i][j][h] * (h << 1 | 1)); // 放自己.
Add(dp[i + 1][-2 * i + j][h + 1],
dp[i][j][h]); // 放后面. 且当前位不放先.
if (h)
Add(dp[i + 1][j + 2 * i][h - 1],
1LL * dp[i][j][h] * h % mo * h %
mo); // 放前面 且当前位放前面空出来的.
}
}
}
cout << dp[n + 1][M + k][0];
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define M 2550
#define LL long long
const int mo = 1e9 + 7;
int dp[52][5201][52]; // 放到第i位 在我 之前 的空位有h位.
void Add(int &res, int x) {
res += x;
if (res > mo)
res -= mo;
return;
}
#define debug(x) cout << #x << " " << x << endl;
main() {
int n, k;
cin >> n >> k;
dp[1][M][0] = 1;
for (int i = 1; i <= n; i++) {
for (int j = 0; j <= M * 2; j++) {
for (int h = i - 1; h >= 0; h--) {
if (!dp[i][j][h])
continue;
Add(dp[i + 1][j][h], 1LL * dp[i][j][h] * (h << 1 | 1) % mo); // 放自己.
Add(dp[i + 1][-2 * i + j][h + 1],
dp[i][j][h]); // 放后面 . 且当前位不放先.
if (h)
Add(dp[i + 1][j + 2 * i][h - 1],
1LL * dp[i][j][h] * h % mo * h %
mo); // 放前面 且当前位放前面空出来的.
}
}
}
cout << dp[n + 1][M + k][0];
return 0;
} | [
"expression.operation.binary.add"
] | 785,804 | 785,805 | u399268660 | cpp |
p02974 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
const ll MOD = 1e9 + 7;
ll N, K;
cin >> N >> K;
vector<vector<vector<ll>>> dp(N + 1,
vector<vector<ll>>(N + 1, vector<ll>(K + 1)));
dp[0][0][0] = 1;
for (int i = 1; i <= N; ++i) {
for (int j = 0; j <= i; ++j) {
for (int k = 2 * j; k <= K; ++k) {
ll &v = dp[i][j][k];
(v += (2 * j + 1) * dp[i - 1][j][k - 2 * j]) %= MOD;
(v += (j + 1) * (j + 1) * dp[i - 1][j + 1][k - 2 * j]) %= MOD;
if (0 <= j - 1)
(v += dp[i - 1][j - 1][k - 2 * j]) %= MOD;
}
}
}
cout << dp[N][0][K] << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
const ll MOD = 1e9 + 7;
ll N, K;
cin >> N >> K;
vector<vector<vector<ll>>> dp(N + 1,
vector<vector<ll>>(N + 2, vector<ll>(K + 1)));
dp[0][0][0] = 1;
for (int i = 1; i <= N; ++i) {
for (int j = 0; j <= i; ++j) {
for (int k = 2 * j; k <= K; ++k) {
ll &v = dp[i][j][k];
(v += (2 * j + 1) * dp[i - 1][j][k - 2 * j]) %= MOD;
(v += (j + 1) * (j + 1) * dp[i - 1][j + 1][k - 2 * j]) %= MOD;
if (0 <= j - 1)
(v += dp[i - 1][j - 1][k - 2 * j]) %= MOD;
}
}
}
cout << dp[N][0][K] << endl;
return 0;
}
| [
"literal.number.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 785,806 | 785,807 | u090097090 | cpp |
p02974 | #include <iostream>
#include <vector>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
long long M = 1000000007;
vector<vector<long long>> T(n + 1, vector<long long>(n * n + 1));
T[1][0] = 1;
T[0][0] = 1;
for (int i = 1; i < n; i++) {
vector<vector<long long>> P(n + 1, vector<long long>(n * n + 1));
P.swap(T);
for (int j = 0; j <= n; j++)
for (int k = 0; k <= n * n; k++)
if (P[j][k] != 0) {
// 0
T[j][k + 2 * j] += P[j][k] * (j + 1);
T[j][k + 2 * j] %= M;
// +1
T[j + 1][k + 2 * j] += P[j][k];
T[j + 1][k + 2 * j] %= M;
// -1
if (j > 0) {
T[j - 1][k + 2 * j] += P[j][k] * j;
T[j - 1][k + 2 * j] %= M;
}
}
/*
cout<<i<<endl;
for (int j=0; j<=n; j++)
{
for (int k=0; k<=n*n; k++)
cout<<" "<<T[j][k];
cout<<endl;
}
*/
}
/*
for (int k=0; k<=n*n; k+=2)
cout<<" "<<T[0][k];
cout<<endl;
*/
cout << T[0][k] << endl;
}
| #include <iostream>
#include <vector>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
long long M = 1000000007;
vector<vector<long long>> T(n + 1, vector<long long>(n * n + 1));
T[1][0] = 1;
T[0][0] = 1;
for (int i = 1; i < n; i++) {
vector<vector<long long>> P(n + 1, vector<long long>(n * n + 1));
P.swap(T);
for (int j = 0; j <= n; j++)
for (int k = 0; k <= n * n; k++)
if (P[j][k] != 0) {
// 0
T[j][k + 2 * j] += P[j][k] * (2 * j + 1);
T[j][k + 2 * j] %= M;
// +1
T[j + 1][k + 2 * j] += P[j][k];
T[j + 1][k + 2 * j] %= M;
// -1
if (j > 0) {
T[j - 1][k + 2 * j] += P[j][k] * j * j;
T[j - 1][k + 2 * j] %= M;
}
}
// cout<<i<<endl;
// for (int j=0; j<=n; j++)
//{
// for (int k=0; k<=n*n; k++)
// cout<<" "<<T[j][k];
// cout<<endl;
//}
}
// for (int k=0; k<=n*n; k+=2)
// cout<<" "<<T[0][k];
// cout<<endl;
cout << T[0][k] << endl;
}
| [
"assignment.change"
] | 785,808 | 785,809 | u374099594 | cpp |
p02981 | /*Author: Gautam*/
#include <bits/stdc++.h>
#define FastIO \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
using namespace std;
#define For(i, a, b) for (int(i) = (a); (i) < (b); ++(i))
#define MODULO 1000000007
#define ull unsigned long long int
#define newline cout << endl
/* TYPE DEFINITIONS */
typedef long long i64;
typedef vector<int> vi;
typedef pair<int, int> pi;
/* ALGEBRA */
bool isPrime(ull n) {
if (n <= 1)
return false;
if (n <= 3)
return true;
if (n % 2 == 0 || n % 3 == 0)
return false;
for (ull i = 5; i * i <= n; i = i + 6)
if (n % i == 0 || n % (i + 2) == 0)
return false;
return true;
}
int f;
/* MACROS */
#define all(A) (A).begin(), (A).end()
#define rall(A) (A).rbegin(), (A).rend()
#define sz(A) (int)(A).size()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define ln(X) (int)(X).length()
#define square(X) ((X) * (X))
#define cube(X) ((X) * (X) * (X))
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define forr(i, n) for (int i = int(n - 1); i >= 0; i--)
#define fora(i, a, b) for (int i = int(a); i <= int(b); i++)
#define forb(i, a, b) for (int i = int(a); i >= int(b); i--)
#define fore(it, a) \
for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
void solve() {
int a, b, c;
cin >> a >> b >> c;
cout << a * min(b, c);
}
int main() {
FastIO;
i64 t = 1;
// cin>>t;
while (t--)
solve();
} | /*Author: Gautam*/
#include <bits/stdc++.h>
#define FastIO \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
using namespace std;
#define For(i, a, b) for (int(i) = (a); (i) < (b); ++(i))
#define MODULO 1000000007
#define ull unsigned long long int
#define newline cout << endl
/* TYPE DEFINITIONS */
typedef long long i64;
typedef vector<int> vi;
typedef pair<int, int> pi;
/* ALGEBRA */
bool isPrime(ull n) {
if (n <= 1)
return false;
if (n <= 3)
return true;
if (n % 2 == 0 || n % 3 == 0)
return false;
for (ull i = 5; i * i <= n; i = i + 6)
if (n % i == 0 || n % (i + 2) == 0)
return false;
return true;
}
int f;
/* MACROS */
#define all(A) (A).begin(), (A).end()
#define rall(A) (A).rbegin(), (A).rend()
#define sz(A) (int)(A).size()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define ln(X) (int)(X).length()
#define square(X) ((X) * (X))
#define cube(X) ((X) * (X) * (X))
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define forr(i, n) for (int i = int(n - 1); i >= 0; i--)
#define fora(i, a, b) for (int i = int(a); i <= int(b); i++)
#define forb(i, a, b) for (int i = int(a); i >= int(b); i--)
#define fore(it, a) \
for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
void solve() {
int a, b, c;
cin >> a >> b >> c;
cout << min(a * b, c);
}
int main() {
FastIO;
i64 t = 1;
// cin>>t;
while (t--)
solve();
} | [
"expression.operation.binary.remove"
] | 785,819 | 785,820 | u689000653 | cpp |
p02981 | #include <bits/stdc++.h>
#define int long long
#define uint unsigned int
#define ld long double
#define showoff \
ios::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
#define pb push_back
#define pii pair<int, int>
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define RFOR(i, a, b) for (int i = a; i > b; --i)
#define f first
#define se second
#define maxn 200005
#define all(v) v.begin(), v.end()
#define sz(x) (int)x.size()
#define mod 1000000007
#define pqueue priority_queue<int>
#define pdqueue priority_queue<int, vector<int>, greater<int>>
using namespace std;
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int power(int a, int n) {
a %= mod;
if (n == 1)
return a;
if (n == 0)
return 1;
if (n % 2)
return (a * power((a * a) % mod, n / 2)) % mod;
return power((a * a) % mod, n / 2) % mod;
}
const int md = 998244353;
const int inf = (int)1e18;
int inverse(int x) {
return power(x, mod - 2) % mod; // little fermat....
}
signed main() {
showoff;
int n, a, b;
cin >> n >> a >> b;
cout << n * min(a, b);
return 0;
}
//*->for large size of matrix take int not long long if possible......
//*->always take maximum as inf for safer side ... | #include <bits/stdc++.h>
#define int long long
#define uint unsigned int
#define ld long double
#define showoff \
ios::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
#define pb push_back
#define pii pair<int, int>
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define RFOR(i, a, b) for (int i = a; i > b; --i)
#define f first
#define se second
#define maxn 200005
#define all(v) v.begin(), v.end()
#define sz(x) (int)x.size()
#define mod 1000000007
#define pqueue priority_queue<int>
#define pdqueue priority_queue<int, vector<int>, greater<int>>
using namespace std;
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int power(int a, int n) {
a %= mod;
if (n == 1)
return a;
if (n == 0)
return 1;
if (n % 2)
return (a * power((a * a) % mod, n / 2)) % mod;
return power((a * a) % mod, n / 2) % mod;
}
const int md = 998244353;
const int inf = (int)1e18;
int inverse(int x) {
return power(x, mod - 2) % mod; // little fermat....
}
signed main() {
showoff;
int n, a, b;
cin >> n >> a >> b;
cout << min(n * a, b);
return 0;
}
//*->for large size of matrix take int not long long if possible......
//*->always take maximum as inf for safer side ... | [
"expression.operation.binary.remove"
] | 785,821 | 785,822 | u578751202 | cpp |
p02981 | #include <iostream>
using namespace std;
int main(void) {
int N, A, B;
cin >> N >> A >> B;
A = A * N;
if (A < B)
cout << B << endl;
else
cout << A << endl;
return 0;
} | #include <iostream>
using namespace std;
int main(void) {
int N, A, B;
cin >> N >> A >> B;
A = A * N;
if (A > B)
cout << B << endl;
else
cout << A << endl;
return 0;
} | [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 785,825 | 785,826 | u348109388 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
// define
#define str string
#define rep(x, y) for (int i = x; i < y; i++)
#define REP(x, y) for (int j = x; j < y; j++)
#define all(x) x.begin(), x.end()
#define elif else if
// vectordefine
#define vint vector<int>
#define vc vector<char>
#define vtr vector<string>
#define pb(n) push_back(n)
// queuedefine
#define qint queue<int>
#define qc queue<char>
#define qstr queue<str>
// mapdefine
#define mint map<int>
#define mc map<char>
// pairdefine
#define pint pair<int, int>
#define pis pair<int, str>
#define pic pair<int, char>
#define pci pair<char, int>
#define mod 100000007
// main
signed main() {
int N, M, O, P, count = 0, count2 = mod, count3 = 0, stack = 0;
str S, T;
double l, s;
cin >> N >> M >> O;
if (O * N < M)
cout << O * N << endl;
else
cout << M << endl;
}
| #include <bits/stdc++.h>
using namespace std;
// define
#define str string
#define rep(x, y) for (int i = x; i < y; i++)
#define REP(x, y) for (int j = x; j < y; j++)
#define all(x) x.begin(), x.end()
#define elif else if
// vectordefine
#define vint vector<int>
#define vc vector<char>
#define vtr vector<string>
#define pb(n) push_back(n)
// queuedefine
#define qint queue<int>
#define qc queue<char>
#define qstr queue<str>
// mapdefine
#define mint map<int>
#define mc map<char>
// pairdefine
#define pint pair<int, int>
#define pis pair<int, str>
#define pic pair<int, char>
#define pci pair<char, int>
#define mod 100000007
// main
signed main() {
int N, M, O, P, count = 0, count2 = mod, count3 = 0, stack = 0;
str S, T;
double l, s;
cin >> N >> M >> O;
if (M * N < O)
cout << M * N << endl;
else
cout << O << endl;
}
| [
"identifier.change",
"control_flow.branch.if.condition.change",
"io.output.change"
] | 785,829 | 785,830 | u347579224 | cpp |
p02981 | /**
* code generated by JHelper
* More info: https://github.com/AlexeyDmitriev/JHelper
* @author
*/
#include <fstream>
#include <iostream>
#ifndef _TB
#define _TB
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define RFOR(i, b, a) for (int i = b - 1; i >= a; --i)
#define REP(i, N) FOR(i, 0, N)
#define RREP(i, N) RFOR(i, N, 0)
#define MIN(A, B) ((A) < (B) ? (A) : (B))
#define MAX(A, B) ((A) > (B) ? (A) : (B))
#define ABS(A) ((A) < 0 ? (-(A)) : (A))
#define ALL(V) V.begin(), V.end()
#define SIZE(V) (int)V.size()
#define pb push_back
#define mp make_pair
#define EPS 1e-7
#define Pi 3.14159265358979
#define FILL(a, v) memset(a, v, sizeof(a))
using namespace std;
typedef long long Long;
typedef unsigned long long ULong;
typedef unsigned int Uint;
typedef unsigned char Uchar;
typedef vector<int> VI;
typedef pair<int, int> PII;
#define X first
#define Y second
typedef std::pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<ui, ui> puu;
template <typename T, typename U>
std::istream &operator>>(std::istream &i, pair<T, U> &p) {
i >> p.X >> p.Y;
return i;
}
template <typename T> std::istream &operator>>(std::istream &i, vector<T> &t) {
for (auto &v : t) {
i >> v;
}
return i;
}
template <typename T, typename U>
std::ostream &operator<<(std::ostream &o, const pair<T, U> &p) {
o << p.X << ' ' << p.Y;
return o;
}
template <typename T>
std::ostream &operator<<(std::ostream &o, const vector<T> &t) {
if (t.empty())
o << '\n';
for (size_t i = 0; i < t.size(); ++i) {
o << t[i] << " \n"[i == t.size() - 1];
}
return o;
}
template <typename T> using minheap = priority_queue<T, vector<T>, greater<T>>;
template <typename T> using maxheap = priority_queue<T, vector<T>, less<T>>;
template <typename T> bool in(T a, T b, T c) { return a <= b && b < c; }
ui logceil(int x) { return (ui)(8 * sizeof(int) - __builtin_clz(x)); }
namespace std {
template <typename T, typename U> struct hash<pair<T, U>> {
hash<T> t;
hash<U> u;
size_t operator()(const pair<T, U> &p) const {
return t(p.x) ^ (u(p.y) << 7);
}
};
} // namespace std
template <typename T> T gcd(T a, T b) {
if (a < b)
swap(a, b);
return b ? gcd(b, a % b) : a;
}
template <typename T> class vector2 : public vector<vector<T>> {
public:
vector2() {}
vector2(size_t a, size_t b, T t = T())
: vector<vector<T>>(a, vector<T>(b, t)) {}
};
template <typename T> class vector3 : public vector<vector2<T>> {
public:
vector3() {}
vector3(size_t a, size_t b, size_t c, T t = T())
: vector<vector2<T>>(a, vector2<T>(b, c, t)) {}
};
template <typename T> class vector4 : public vector<vector3<T>> {
public:
vector4() {}
vector4(size_t a, size_t b, size_t c, size_t d, T t = T())
: vector<vector3<T>>(a, vector3<T>(b, c, d, t)) {}
};
template <typename T> class vector5 : public vector<vector4<T>> {
public:
vector5() {}
vector5(size_t a, size_t b, size_t c, size_t d, size_t e, T t = T())
: vector<vector4<T>>(a, vector4<T>(b, c, d, e, t)) {}
};
void fastIO() { ios::sync_with_stdio(false); }
template <typename T, typename... Args> T max(T t, Args... args) {
return max(max<T>(args...), t);
}
template <typename T, typename... Args> T min(T t, Args... args) {
return min(min<T>(args...), t);
}
#endif
class ATOrT {
public:
void solve(std::istream &in, std::ostream &out) {
fastIO();
int n, a, b;
in >> n >> a >> b;
out << n * min(a, b) << endl;
}
};
int main() {
ATOrT solver;
std::istream &in(std::cin);
std::ostream &out(std::cout);
solver.solve(in, out);
return 0;
}
| /**
* code generated by JHelper
* More info: https://github.com/AlexeyDmitriev/JHelper
* @author
*/
#include <fstream>
#include <iostream>
#ifndef _TB
#define _TB
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define RFOR(i, b, a) for (int i = b - 1; i >= a; --i)
#define REP(i, N) FOR(i, 0, N)
#define RREP(i, N) RFOR(i, N, 0)
#define MIN(A, B) ((A) < (B) ? (A) : (B))
#define MAX(A, B) ((A) > (B) ? (A) : (B))
#define ABS(A) ((A) < 0 ? (-(A)) : (A))
#define ALL(V) V.begin(), V.end()
#define SIZE(V) (int)V.size()
#define pb push_back
#define mp make_pair
#define EPS 1e-7
#define Pi 3.14159265358979
#define FILL(a, v) memset(a, v, sizeof(a))
using namespace std;
typedef long long Long;
typedef unsigned long long ULong;
typedef unsigned int Uint;
typedef unsigned char Uchar;
typedef vector<int> VI;
typedef pair<int, int> PII;
#define X first
#define Y second
typedef std::pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<ui, ui> puu;
template <typename T, typename U>
std::istream &operator>>(std::istream &i, pair<T, U> &p) {
i >> p.X >> p.Y;
return i;
}
template <typename T> std::istream &operator>>(std::istream &i, vector<T> &t) {
for (auto &v : t) {
i >> v;
}
return i;
}
template <typename T, typename U>
std::ostream &operator<<(std::ostream &o, const pair<T, U> &p) {
o << p.X << ' ' << p.Y;
return o;
}
template <typename T>
std::ostream &operator<<(std::ostream &o, const vector<T> &t) {
if (t.empty())
o << '\n';
for (size_t i = 0; i < t.size(); ++i) {
o << t[i] << " \n"[i == t.size() - 1];
}
return o;
}
template <typename T> using minheap = priority_queue<T, vector<T>, greater<T>>;
template <typename T> using maxheap = priority_queue<T, vector<T>, less<T>>;
template <typename T> bool in(T a, T b, T c) { return a <= b && b < c; }
ui logceil(int x) { return (ui)(8 * sizeof(int) - __builtin_clz(x)); }
namespace std {
template <typename T, typename U> struct hash<pair<T, U>> {
hash<T> t;
hash<U> u;
size_t operator()(const pair<T, U> &p) const {
return t(p.x) ^ (u(p.y) << 7);
}
};
} // namespace std
template <typename T> T gcd(T a, T b) {
if (a < b)
swap(a, b);
return b ? gcd(b, a % b) : a;
}
template <typename T> class vector2 : public vector<vector<T>> {
public:
vector2() {}
vector2(size_t a, size_t b, T t = T())
: vector<vector<T>>(a, vector<T>(b, t)) {}
};
template <typename T> class vector3 : public vector<vector2<T>> {
public:
vector3() {}
vector3(size_t a, size_t b, size_t c, T t = T())
: vector<vector2<T>>(a, vector2<T>(b, c, t)) {}
};
template <typename T> class vector4 : public vector<vector3<T>> {
public:
vector4() {}
vector4(size_t a, size_t b, size_t c, size_t d, T t = T())
: vector<vector3<T>>(a, vector3<T>(b, c, d, t)) {}
};
template <typename T> class vector5 : public vector<vector4<T>> {
public:
vector5() {}
vector5(size_t a, size_t b, size_t c, size_t d, size_t e, T t = T())
: vector<vector4<T>>(a, vector4<T>(b, c, d, e, t)) {}
};
void fastIO() { ios::sync_with_stdio(false); }
template <typename T, typename... Args> T max(T t, Args... args) {
return max(max<T>(args...), t);
}
template <typename T, typename... Args> T min(T t, Args... args) {
return min(min<T>(args...), t);
}
#endif
class ATOrT {
public:
void solve(std::istream &in, std::ostream &out) {
fastIO();
int n, a, b;
in >> n >> a >> b;
out << min(n * a, b) << endl;
}
};
int main() {
ATOrT solver;
std::istream &in(std::cin);
std::ostream &out(std::cout);
solver.solve(in, out);
return 0;
}
| [
"expression.operation.binary.remove"
] | 785,833 | 785,834 | u920200680 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
int n, a, b;
cin >> n >> a >> b;
cout << n * (min(a, b));
} | #include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
int n, a, b;
cin >> n >> a >> b;
cout << min(n * a, b);
} | [
"expression.operation.binary.remove"
] | 785,837 | 785,838 | u595786324 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define mp(a, b) make_pair(a, b)
#define pb(a) push_back(a)
#define boost \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define check(x) cout << #x << " : " << (x) << endl
#define all(v) v.begin(), v.end()
//#define endl '\n'
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> mypair;
typedef priority_queue<ll> max_heap;
typedef priority_queue<ll, vector<ll>, greater<ll>> min_heap;
const ll mod = 1e9 + 7;
const ll inf = 1e15 + 5;
const ll N = 1e5 + 10;
int main() {
boost;
ll n, a, b;
cin >> n >> a >> b;
cout << min(n * a, n * b);
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define mp(a, b) make_pair(a, b)
#define pb(a) push_back(a)
#define boost \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define check(x) cout << #x << " : " << (x) << endl
#define all(v) v.begin(), v.end()
//#define endl '\n'
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> mypair;
typedef priority_queue<ll> max_heap;
typedef priority_queue<ll, vector<ll>, greater<ll>> min_heap;
const ll mod = 1e9 + 7;
const ll inf = 1e15 + 5;
const ll N = 1e5 + 10;
int main() {
boost;
ll n, a, b;
cin >> n >> a >> b;
cout << min(n * a, b);
return 0;
}
| [
"expression.operation.binary.remove"
] | 785,839 | 785,840 | u202858603 | cpp |
p02981 | #include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
#define fi first
#define se second
#define pb push_back
#define pii pair<int, int>
#define ll long long
#define pll pair<ll, ll>
#define rep(i, from, to) for (int i = from; i < to; i++)
#define repd(i, from, till) for (int i = from; i >= till; i--)
#define waste \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL)
#define inf 1e9 + 1
#define mod 1e9 + 7
#define inf1 1e18 + 1
#define pie 3.14159265358979323846
#define N 100005
using namespace std;
void solve() {
int n;
cin >> n;
int a, b;
cin >> a >> b;
cout << n * min(a, b) << endl;
}
int main() {
waste;
int t;
// cin>>t;
t = 1;
while (t--) {
solve();
}
}
| #include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
#define fi first
#define se second
#define pb push_back
#define pii pair<int, int>
#define ll long long
#define pll pair<ll, ll>
#define rep(i, from, to) for (int i = from; i < to; i++)
#define repd(i, from, till) for (int i = from; i >= till; i--)
#define waste \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL)
#define inf 1e9 + 1
#define mod 1e9 + 7
#define inf1 1e18 + 1
#define pie 3.14159265358979323846
#define N 100005
using namespace std;
void solve() {
int n;
cin >> n;
int a, b;
cin >> a >> b;
cout << min(n * a, b) << endl;
}
int main() {
waste;
int t;
// cin>>t;
t = 1;
while (t--) {
solve();
}
}
| [
"expression.operation.binary.remove"
] | 785,845 | 785,846 | u352350187 | cpp |
p02981 | #include <algorithm>
#include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < n; ++i)
#define PB(s) push_back(s)
#define ST(n) sort(n.begin(), n.end())
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 <algorithm>
#include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < n; ++i)
#define PB(s) push_back(s)
#define ST(n) sort(n.begin(), n.end())
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"
] | 785,851 | 785,852 | u847243301 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ldb = long double;
using pa = pair<ll, ll>;
using vec = vector<ll>;
#define pb push_back
#define po pop_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
#define f(i, x, n) for (ll i = x; i < n; i++)
#define unique_sort(x) \
sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))
#define all(c) c.begin(), c.end()
#define str string
#define edl "\n"
#define add insert
#define cot continue
#define fast() \
ios_base::sync_with_stdio(false); \
cin.tie(NULL)
const int MOD = 1e9 + 7, INF = INT_MAX, N = 1e5 + 10;
const double PI = acos(-1);
const ll LINF = LLONG_MAX;
int main() {
fast();
// #ifndef ONLINE_JUDGE
// freopen("input.txt", "r", stdin);
// freopen("output.txt","w",stdout);
// #endif
ll n, a, b;
cin >> n >> a >> b;
cout << min(a, b) * n;
cerr << "Time taken: " << int((clock() * 1000.) / CLOCKS_PER_SEC) << "ms\n";
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ldb = long double;
using pa = pair<ll, ll>;
using vec = vector<ll>;
#define pb push_back
#define po pop_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
#define f(i, x, n) for (ll i = x; i < n; i++)
#define unique_sort(x) \
sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))
#define all(c) c.begin(), c.end()
#define str string
#define edl "\n"
#define add insert
#define cot continue
#define fast() \
ios_base::sync_with_stdio(false); \
cin.tie(NULL)
const int MOD = 1e9 + 7, INF = INT_MAX, N = 1e5 + 10;
const double PI = acos(-1);
const ll LINF = LLONG_MAX;
int main() {
fast();
// #ifndef ONLINE_JUDGE
// freopen("input.txt", "r", stdin);
// freopen("output.txt","w",stdout);
// #endif
ll n, a, b;
cin >> n >> a >> b;
cout << min(n * a, b);
cerr << "Time taken: " << int((clock() * 1000.) / CLOCKS_PER_SEC) << "ms\n";
return 0;
}
| [
"expression.operation.binary.remove"
] | 785,857 | 785,858 | u063404629 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
#define SZ(items) (int)items.size()
#define CLR(a) memset(a, 0, sizeof(a))
#define SET(a) memset(a, -1, sizeof(a))
#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void __f(const char *name, Arg1 &&arg1) {
cerr << name << " is " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&...args) {
const char *comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << " is " << arg1 << " | ";
__f(comma + 1, args...);
}
#else
#define debug(...)
#endif
void solve() {
long n, a, b;
cin >> n >> a >> b;
cout << min(n * a, n * b);
}
int main() {
ios_base::sync_with_stdio(false);
cout.setf(ios::fixed);
cout.precision(10);
cout.tie(nullptr);
cin.tie(nullptr);
int t = 1;
while (t--) {
solve();
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define SZ(items) (int)items.size()
#define CLR(a) memset(a, 0, sizeof(a))
#define SET(a) memset(a, -1, sizeof(a))
#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void __f(const char *name, Arg1 &&arg1) {
cerr << name << " is " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&...args) {
const char *comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << " is " << arg1 << " | ";
__f(comma + 1, args...);
}
#else
#define debug(...)
#endif
void solve() {
long n, a, b;
cin >> n >> a >> b;
cout << min(n * a, b);
}
int main() {
ios_base::sync_with_stdio(false);
cout.setf(ios::fixed);
cout.precision(10);
cout.tie(nullptr);
cin.tie(nullptr);
int t = 1;
while (t--) {
solve();
}
return 0;
}
| [
"expression.operation.binary.remove"
] | 785,859 | 785,860 | u098704227 | cpp |
p02981 | //==========================Head files==========================
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#define LL long long
#define db double
#define mp make_pair
#define pr pair<int, int>
#define fir first
#define sec second
#define pb push_back
#define ms(i, j) memset(i, j, sizeof i)
using namespace std;
//==========================Templates==========================
inline int read() {
int x = 0, f = 1;
char c = getchar();
while (c < '0' || c > '9') {
if (c == '-')
f = -1;
c = getchar();
}
while (c >= '0' && c <= '9') {
x = x * 10 + c - '0';
c = getchar();
}
return x * f;
}
inline LL readl() {
LL x = 0, f = 1;
char c = getchar();
while (c < '0' || c > '9') {
if (c == '-')
f = -1;
c = getchar();
}
while (c >= '0' && c <= '9') {
x = x * 10 + c - '0';
c = getchar();
}
return x * f;
}
int power(int a, int b) {
int ans = 1;
while (b) {
if (b & 1)
ans = ans * a;
b >>= 1;
a = a * a;
}
return ans;
}
int power_mod(int a, int b, int mod) {
a %= mod;
int ans = 1;
while (b) {
if (b & 1)
ans = (ans * a) % mod;
b >>= 1, a = (a * a) % mod;
}
return ans;
}
LL powerl(LL a, LL b) {
LL ans = 1ll;
while (b) {
if (b & 1ll)
ans = ans * a;
b >>= 1ll;
a = a * a;
}
return ans;
}
LL power_modl(LL a, LL b, LL mod) {
a %= mod;
LL ans = 1ll;
while (b) {
if (b & 1ll)
ans = (ans * a) % mod;
b >>= 1ll, a = (a * a) % mod;
}
return ans;
}
LL gcdl(LL a, LL b) { return b == 0 ? a : gcdl(b, a % b); }
LL abssl(LL a) { return a > 0 ? a : -a; }
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int abss(int a) { return a > 0 ? a : -a; }
//==========================Main body==========================
#define LD "%I64d"
#define D "%d"
#define pt printf
#define sn scanf
#define pty printf("YES\n")
#define ptn printf("NO\n")
//==========================Code here==========================
int n, a, b;
int main() {
cin >> n >> a >> b;
cout << n * min(a, b);
return 0;
} | //==========================Head files==========================
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#define LL long long
#define db double
#define mp make_pair
#define pr pair<int, int>
#define fir first
#define sec second
#define pb push_back
#define ms(i, j) memset(i, j, sizeof i)
using namespace std;
//==========================Templates==========================
inline int read() {
int x = 0, f = 1;
char c = getchar();
while (c < '0' || c > '9') {
if (c == '-')
f = -1;
c = getchar();
}
while (c >= '0' && c <= '9') {
x = x * 10 + c - '0';
c = getchar();
}
return x * f;
}
inline LL readl() {
LL x = 0, f = 1;
char c = getchar();
while (c < '0' || c > '9') {
if (c == '-')
f = -1;
c = getchar();
}
while (c >= '0' && c <= '9') {
x = x * 10 + c - '0';
c = getchar();
}
return x * f;
}
int power(int a, int b) {
int ans = 1;
while (b) {
if (b & 1)
ans = ans * a;
b >>= 1;
a = a * a;
}
return ans;
}
int power_mod(int a, int b, int mod) {
a %= mod;
int ans = 1;
while (b) {
if (b & 1)
ans = (ans * a) % mod;
b >>= 1, a = (a * a) % mod;
}
return ans;
}
LL powerl(LL a, LL b) {
LL ans = 1ll;
while (b) {
if (b & 1ll)
ans = ans * a;
b >>= 1ll;
a = a * a;
}
return ans;
}
LL power_modl(LL a, LL b, LL mod) {
a %= mod;
LL ans = 1ll;
while (b) {
if (b & 1ll)
ans = (ans * a) % mod;
b >>= 1ll, a = (a * a) % mod;
}
return ans;
}
LL gcdl(LL a, LL b) { return b == 0 ? a : gcdl(b, a % b); }
LL abssl(LL a) { return a > 0 ? a : -a; }
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int abss(int a) { return a > 0 ? a : -a; }
//==========================Main body==========================
#define LD "%I64d"
#define D "%d"
#define pt printf
#define sn scanf
#define pty printf("YES\n")
#define ptn printf("NO\n")
//==========================Code here==========================
int n, a, b;
int main() {
cin >> n >> a >> b;
cout << min(n * a, b);
return 0;
} | [
"expression.operation.binary.remove"
] | 785,861 | 785,862 | u774596402 | cpp |
p02981 | #include <algorithm>
#include <assert.h>
#include <bits/stdc++.h>
#include <bitset>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdlib.h>
#include <time.h>
#include <utility>
#include <vector>
using namespace std;
int main() {
int n, a, b;
cin >> n >> a >> b;
cout << n * min(a, b);
} | #include <algorithm>
#include <assert.h>
#include <bits/stdc++.h>
#include <bitset>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdlib.h>
#include <time.h>
#include <utility>
#include <vector>
using namespace std;
int main() {
int n, a, b;
cin >> n >> a >> b;
cout << min(a * n, b);
} | [
"expression.operation.binary.remove"
] | 785,863 | 785,864 | u937608388 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, l, r) for (int i = (int)(l); i < (int)(r); i++)
#define all(x) (x).begin(), (x).end()
#define pb push_back
template <class T> bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
const int inf = 1LL << 60;
const int mod = 1e9 + 7;
const double eps = 1e-9;
/*{
}*/
signed main() {
int n, a, b;
cin >> n >> a >> b;
cout << min(a, b) * n << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, l, r) for (int i = (int)(l); i < (int)(r); i++)
#define all(x) (x).begin(), (x).end()
#define pb push_back
template <class T> bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
const int inf = 1LL << 60;
const int mod = 1e9 + 7;
const double eps = 1e-9;
/*{
}*/
signed main() {
int n, a, b;
cin >> n >> a >> b;
cout << min(a * n, b) << endl;
return 0;
}
| [
"expression.operation.binary.remove"
] | 785,865 | 785,866 | u057866967 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-ffloat-store")
#pragma GCC optimize("-fno-defer-pop")
#define all(a) a.begin(), a.end()
#define ll long long int
#define ld long double
ll power(ll a, ll b, ll m) {
if (b == 0)
return 1;
if (b == 1)
return a % m;
ll t = power(a, b / 2, m) % m;
t = (t * t) % m;
if (b & 1)
t = ((t % m) * (a % m)) % m;
return t;
}
ll modInverse(ll a, ll m) { return power(a, m - 2, m); }
#define ps push_back
#define fs first
#define takeline cin.ignore();
#define sc second
#define N 3000005
#define endl "\n"
#define mod 1000000007
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
ll n, a, b;
cin >> n >> a >> b;
cout << min(n * a, n * b);
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-ffloat-store")
#pragma GCC optimize("-fno-defer-pop")
#define all(a) a.begin(), a.end()
#define ll long long int
#define ld long double
ll power(ll a, ll b, ll m) {
if (b == 0)
return 1;
if (b == 1)
return a % m;
ll t = power(a, b / 2, m) % m;
t = (t * t) % m;
if (b & 1)
t = ((t % m) * (a % m)) % m;
return t;
}
ll modInverse(ll a, ll m) { return power(a, m - 2, m); }
#define ps push_back
#define fs first
#define takeline cin.ignore();
#define sc second
#define N 3000005
#define endl "\n"
#define mod 1000000007
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
ll n, a, b;
cin >> n >> a >> b;
cout << min(n * a, b);
return 0;
} | [
"expression.operation.binary.remove"
] | 785,867 | 785,868 | u838261804 | cpp |
p02981 | #include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define pb push_back
#define int long long
#define all(x) (x).begin(), (x).end()
using LL = long long;
using LD = long double;
using pii = pair<int, int>;
using vii = vector<pii>;
const int INF = 1e18;
const int MOD = 1e9 + 7;
const int N = 1e5 + 5;
int32_t main() {
// ios::sync_with_stdio(false); cin.tie(nullptr);
int n, a, b;
cin >> n >> a >> b;
cout << n * min(a, b) << "\n";
return 0;
}
| #include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define pb push_back
#define int long long
#define all(x) (x).begin(), (x).end()
using LL = long long;
using LD = long double;
using pii = pair<int, int>;
using vii = vector<pii>;
const int INF = 1e18;
const int MOD = 1e9 + 7;
const int N = 1e5 + 5;
int32_t main() {
// ios::sync_with_stdio(false); cin.tie(nullptr);
int n, a, b;
cin >> n >> a >> b;
cout << min(n * a, b) << "\n";
return 0;
}
| [
"expression.operation.binary.remove"
] | 785,869 | 785,870 | u192295874 | cpp |
p02981 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int(i) = (0); (i) < (int)(n); ++(i))
using ll = long long;
using P = pair<int, int>;
using namespace std;
int main() {
int N, A, B;
cin >> N >> A >> B;
if (N * B <= A * N) {
cout << N * B << endl;
} else {
cout << A * N << endl;
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int(i) = (0); (i) < (int)(n); ++(i))
using ll = long long;
using P = pair<int, int>;
using namespace std;
int main() {
int N, A, B;
cin >> N >> A >> B;
if (B <= A * N) {
cout << B << endl;
} else {
cout << A * N << endl;
}
return 0;
}
| [
"expression.operation.binary.remove"
] | 785,873 | 785,874 | u482544950 | cpp |
p02981 | /*
∧,,∧
( 'ω' )つ <WA,またお前か!!
(m9 \
\ \
) ) \
// \ \
(_) (_)
*/
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rep(x, y) for (int x = 0; x < y; x++)
#define MOD 1000000007
typedef long long LL;
typedef long double LD;
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
if (a.second != b.second) {
return a.second < b.second;
} else {
return a.first < b.first;
}
}
ostringstream oss_global;
string s_global = oss_global.str();
int main() {
int N, A, B;
cin >> N >> A >> B;
int ans = N * min(A, B);
cout << ans << endl;
return 0;
}
| /*
∧,,∧
( 'ω' )つ <WA,またお前か!!
(m9 \
\ \
) ) \
// \ \
(_) (_)
*/
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rep(x, y) for (int x = 0; x < y; x++)
#define MOD 1000000007
typedef long long LL;
typedef long double LD;
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
if (a.second != b.second) {
return a.second < b.second;
} else {
return a.first < b.first;
}
}
ostringstream oss_global;
string s_global = oss_global.str();
int main() {
int N, A, B;
cin >> N >> A >> B;
int ans = min(N * A, B);
cout << ans << endl;
return 0;
}
| [
"expression.operation.binary.remove"
] | 785,887 | 785,888 | u321915648 | cpp |
p02981 | #include <bits/stdc++.h> //JuniorMonster a.k.a Sho10
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout << s, 0
#define mod 1000000007
#define PI 3.14159265359
#define CODE_START \
ios_base::sync_with_stdio(); \
cin.tie(); \
cout.tie();
using namespace std;
ll n, a, b;
int32_t main() {
CODE_START;
cin >> n;
cin >> a;
cin >> b;
cout << min(n * a, n * b);
}
| #include <bits/stdc++.h> //JuniorMonster a.k.a Sho10
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout << s, 0
#define mod 1000000007
#define PI 3.14159265359
#define CODE_START \
ios_base::sync_with_stdio(); \
cin.tie(); \
cout.tie();
using namespace std;
ll n, a, b;
int32_t main() {
CODE_START;
cin >> n;
cin >> a;
cin >> b;
cout << min(n * a, b);
}
| [
"expression.operation.binary.remove"
] | 785,889 | 785,890 | u794807449 | cpp |
p02981 | #include <bits/stdc++.h>
#define endl ("\n")
using namespace std;
#define deb(x) cout << (#x) << " -> " << (x) << endl;
#define mod (1000000007)
int main() {
ios_base::sync_with_stdio(false);
cout.tie(0);
cout << fixed;
cout.precision(10);
// Those who cannot acknowledge themselves, will invariably fail
int n, a, b;
cin >> n >> a >> b;
cout << n * a + b;
return 0;
} | #include <bits/stdc++.h>
#define endl ("\n")
using namespace std;
#define deb(x) cout << (#x) << " -> " << (x) << endl;
#define mod (1000000007)
int main() {
ios_base::sync_with_stdio(false);
cout.tie(0);
cout << fixed;
cout.precision(10);
// Those who cannot acknowledge themselves, will invariably fail
int n, a, b;
cin >> n >> a >> b;
cout << min(n * a, b);
return 0;
} | [
"call.add",
"io.output.change",
"call.arguments.change"
] | 785,891 | 785,892 | u612695892 | cpp |
p02981 | #include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
// using
using namespace std;
// typedef
typedef long long ll;
// define
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define LB(c, x) lower_bound(c.begin(), c.end(), x)
#define UB(c, x) upper_bound(c.begin(), c.end(), x)
#define LI(c, x) distance(c.begin(), LB(c, x))
#define UI(c, x) distance(c.begin(), UB(c, x))
// functions
template <class T> T ceil(T a, T b) { return (a + b - 1) / b; }
template <class T> T round(T a, T b) { return (a + b / 2) / b; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template <class T> bool amax(T &a, const T &b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> bool amin(T &a, const T &b) {
if (b < a) {
a = b;
return true;
}
return false;
}
ll modpow(ll a, ll b, ll m) {
if (b == 0) {
return 1;
} else if (b % 2 == 0) {
ll h = modpow(a, b / 2, m);
return h * h % m;
} else {
return a * modpow(a, b - 1, m) % m;
}
}
ll comb(ll a, ll b, ll m) {
if (b > a - b) {
return comb(a, a - b, m);
}
ll c = 1, d = 1;
REP(i, b) {
c *= (a - i);
d *= (b - i);
c %= m;
d %= m;
}
return c * modpow(d, m - 2, m) % m;
}
// main
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int N, A, B;
cin >> N >> A >> B;
cout << N * min(A, B) << endl;
return 0;
}
| #include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
// using
using namespace std;
// typedef
typedef long long ll;
// define
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define LB(c, x) lower_bound(c.begin(), c.end(), x)
#define UB(c, x) upper_bound(c.begin(), c.end(), x)
#define LI(c, x) distance(c.begin(), LB(c, x))
#define UI(c, x) distance(c.begin(), UB(c, x))
// functions
template <class T> T ceil(T a, T b) { return (a + b - 1) / b; }
template <class T> T round(T a, T b) { return (a + b / 2) / b; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template <class T> bool amax(T &a, const T &b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> bool amin(T &a, const T &b) {
if (b < a) {
a = b;
return true;
}
return false;
}
ll modpow(ll a, ll b, ll m) {
if (b == 0) {
return 1;
} else if (b % 2 == 0) {
ll h = modpow(a, b / 2, m);
return h * h % m;
} else {
return a * modpow(a, b - 1, m) % m;
}
}
ll comb(ll a, ll b, ll m) {
if (b > a - b) {
return comb(a, a - b, m);
}
ll c = 1, d = 1;
REP(i, b) {
c *= (a - i);
d *= (b - i);
c %= m;
d %= m;
}
return c * modpow(d, m - 2, m) % m;
}
// main
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int N, A, B;
cin >> N >> A >> B;
cout << min(N * A, B) << endl;
return 0;
}
| [
"expression.operation.binary.remove"
] | 785,893 | 785,894 | u164300951 | cpp |
p02981 | #include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#define initdp(a, b) \
for (int i = 0; i <= a; i++) \
for (int j = 0; j <= b; j++) \
dp[i][j] = -1;
#define fi first
#define se second
#define pb push_back
#define pii pair<int, int>
#define ll long long
#define pll pair<ll, ll>
#define rep(i, n) for (int i = 0; i < n; i++)
#define repd(i, n) for (int i = n - 1; i >= 0; i--)
#define waste \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL)
#define inf 1e9 + 1
#define inf1 1e18 + 1
#define mod 1000000007
#define pie 3.14159265358979323846
#define N 1000005
#define mid(l, r) l + (r - l) / 2
using namespace std;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int ddx[8] = {1, 1, 0, -1, -1, -1, 0, 1}, ddy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
void mad(ll &a, ll b) {
a = (a + b) % mod;
if (a < 0)
a += mod;
}
ll gcd(ll a, ll b) {
if (a > b)
swap(a, b);
if (!a)
return b;
return gcd(b % a, a);
}
void solve() {
ll n, a, b;
cin >> n >> a >> b;
cout << n * min(a, b);
}
int main() {
waste;
int t;
// cin>>t;
t = 1;
while (t--) {
solve();
}
} | #include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#define initdp(a, b) \
for (int i = 0; i <= a; i++) \
for (int j = 0; j <= b; j++) \
dp[i][j] = -1;
#define fi first
#define se second
#define pb push_back
#define pii pair<int, int>
#define ll long long
#define pll pair<ll, ll>
#define rep(i, n) for (int i = 0; i < n; i++)
#define repd(i, n) for (int i = n - 1; i >= 0; i--)
#define waste \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL)
#define inf 1e9 + 1
#define inf1 1e18 + 1
#define mod 1000000007
#define pie 3.14159265358979323846
#define N 1000005
#define mid(l, r) l + (r - l) / 2
using namespace std;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int ddx[8] = {1, 1, 0, -1, -1, -1, 0, 1}, ddy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
void mad(ll &a, ll b) {
a = (a + b) % mod;
if (a < 0)
a += mod;
}
ll gcd(ll a, ll b) {
if (a > b)
swap(a, b);
if (!a)
return b;
return gcd(b % a, a);
}
void solve() {
ll n, a, b;
cin >> n >> a >> b;
cout << min(n * a, b);
}
int main() {
waste;
int t;
// cin>>t;
t = 1;
while (t--) {
solve();
}
} | [
"expression.operation.binary.remove"
] | 785,897 | 785,898 | u133630059 | cpp |
p02981 | #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ld, ld> pdd;
#define fi first
#define se second
#define mp make_pair
#define fastIO \
ios::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
int main() {
fastIO;
int n, a, b;
cin >> n >> a >> b;
cout << min(n * a, n * b);
return 0;
} | #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ld, ld> pdd;
#define fi first
#define se second
#define mp make_pair
#define fastIO \
ios::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
int main() {
fastIO;
int n, a, b;
cin >> n >> a >> b;
cout << min(n * a, b);
return 0;
} | [
"expression.operation.binary.remove"
] | 785,901 | 785,902 | u722777218 | cpp |
p02981 | #include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, a, b;
cin >> n >> a >> b;
cout << n * min(a, b) << '\n';
return 0;
}
| #include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
ios_base::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"
] | 785,905 | 785,906 | u769237842 | cpp |
p02982 | #include <bits/stdc++.h>
using namespace std;
bool is_integer(double x) { return floor(x) == x; }
double Distance(int *p_1, int *p_2, int D) {
double sum = 0;
for (int i = 0; i < D; i++) {
int r, l;
l = *(p_1 + i);
r = *(p_2 + i);
sum += pow((r - l), 2);
}
return sqrt(sum);
}
int main(void) {
int N, D, ans = 0;
cin >> N >> D;
int data[N][D];
for (int i = 0; i < N; i++) {
for (int j = 0; j < D; j++) {
cin >> data[i][j];
}
}
for (int i = 0; i < N; i++) {
for (int j = i + 1; j < D; j++) {
if (is_integer(Distance(&data[i][0], &data[j][0], D)))
ans++;
}
}
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
bool is_integer(double x) { return floor(x) == x; }
double Distance(int *p_1, int *p_2, int D) {
double sum = 0;
for (int i = 0; i < D; i++) {
int r, l;
l = *(p_1 + i);
r = *(p_2 + i);
sum += pow((r - l), 2);
}
return sqrt(sum);
}
int main(void) {
int N, D, ans = 0;
cin >> N >> D;
int data[N][D];
for (int i = 0; i < N; i++) {
for (int j = 0; j < D; j++) {
cin >> data[i][j];
}
}
for (int i = 0; i < N; i++) {
for (int j = i + 1; j < N; j++) {
if (is_integer(Distance(&data[i][0], &data[j][0], D)))
ans++;
}
}
cout << ans << endl;
} | [
"identifier.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change"
] | 785,967 | 785,968 | u861231819 | cpp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.