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 |
|---|---|---|---|---|---|---|---|
p03183 | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define F(i, a, b) for (int i = (int)a; i <= (int)b; i++)
#define FD(i, a, b) for (int i = (int)a; i >= (int)b; i--)
#define pii pair<int, int>
#define reset(x, y) memset(x, y, sizeof(x))
#define MIN(x, y) \
if (x > (y)) \
x = (y)
#define MAX(x, y) \
if (x < (y)) \
x = (y)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define EL putchar('\n');
#define mod 1000000007
#define oo 1000006
typedef pair<int, int> ii;
const int N = 1005;
const int M = 2e4 + 5;
const int inf = 1e15;
int n, dp[N][M], s[N], w[N], v[N];
vector<pair<ii, ii>> vec;
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;
}
void write(int x) {
if (x > 9)
write(x / 10);
putchar(x % 10 + '0');
}
void ReadInPut() {
cin.tie(0), ios::sync_with_stdio(0);
cin >> n;
for (int i = 1; i <= n; i++) {
int x, y, z;
cin >> x >> y >> z;
vec.pb({{y + x, x}, {y, z}});
}
sort(vec.begin(), vec.end());
}
void Solve() {
for (int i = 0; i < vec.size(); i++) {
s[i + 1] = vec[i].se.fi;
w[i + 1] = vec[i].fi.se;
v[i + 1] = vec[i].se.se;
}
for (int i = 1; i <= n; i++) {
for (int j = 0; j < M; j++)
dp[i][j] = -inf;
}
dp[0][0] = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < M; j++) {
if (j <= s[i + 1])
dp[i + 1][j + w[i + 1]] =
max(dp[i + 1][j + w[i + 1]], dp[i][j] + v[i + 1]);
dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
}
}
int ans = 0;
for (int j = 0; j < M; j++)
ans = max(ans, dp[n][j]);
cout << ans;
}
main() {
// freopen("t.INP","r",stdin);
// freopen(".OUT","w",stdout);
int sotest = 1;
// cin>>sotest;
for (int i = 1; i <= sotest; i++) {
ReadInPut();
Solve();
}
}
| #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define F(i, a, b) for (int i = (int)a; i <= (int)b; i++)
#define FD(i, a, b) for (int i = (int)a; i >= (int)b; i--)
#define pii pair<int, int>
#define reset(x, y) memset(x, y, sizeof(x))
#define MIN(x, y) \
if (x > (y)) \
x = (y)
#define MAX(x, y) \
if (x < (y)) \
x = (y)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define EL putchar('\n');
#define mod 1000000007
#define oo 1000006
typedef pair<int, int> ii;
const int N = 1005;
const int M = 2e4 + 5;
const int inf = 1e15;
int n, dp[N][M], s[N], w[N], v[N];
vector<pair<ii, ii>> vec;
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;
}
void write(int x) {
if (x > 9)
write(x / 10);
putchar(x % 10 + '0');
}
void ReadInPut() {
cin.tie(0), ios::sync_with_stdio(0);
cin >> n;
for (int i = 1; i <= n; i++) {
int x, y, z;
cin >> x >> y >> z;
vec.pb({{y + x, x}, {y, z}});
}
sort(vec.begin(), vec.end());
}
void Solve() {
for (int i = 0; i < vec.size(); i++) {
s[i + 1] = vec[i].se.fi;
w[i + 1] = vec[i].fi.se;
v[i + 1] = vec[i].se.se;
}
for (int i = 1; i <= n; i++) {
for (int j = 0; j < M; j++)
dp[i][j] = -inf;
}
dp[0][0] = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < M; j++) {
if (j <= s[i + 1])
dp[i + 1][j + w[i + 1]] =
max(dp[i + 1][j + w[i + 1]], dp[i][j] + v[i + 1]);
dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
}
}
int ans = 0;
for (int j = 0; j < M; j++)
ans = max(ans, dp[n][j]);
cout << ans;
}
main() {
// freopen("t.INP","r",stdin);
// freopen(".OUT","w",stdout);
int sotest = 1;
// cin>>sotest;
for (int i = 1; i <= sotest; i++) {
ReadInPut();
Solve();
}
}
| [] | 989,699 | 989,700 | u117337152 | cpp |
p03183 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> w(n), s(n), v(n);
for (int i = 0; i < n; i++)
cin >> w[i] >> s[i] >> v[i];
vector<int> od(n);
iota(od.begin(), od.end(), 0);
sort(od.begin(), od.end(), [&](int a, int b) {
if (s[a] + w[a] == s[b] + w[b])
return v[a] > v[b];
return s[a] + w[a] < s[b] + w[b];
});
const int l = 2 * 10100;
vector<int> f(l + 1, 0);
for (int i = 0; i < n; i++) {
int id = od[i];
for (int j = s[id]; j >= 0; j--) {
f[j + w[id]] = max(f[j + w[id]], f[j] + v[id]);
}
}
int ans = 0;
for (int i = 0; i <= l; i++)
ans = max(ans, f[i]);
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> w(n), s(n), v(n);
for (int i = 0; i < n; i++)
cin >> w[i] >> s[i] >> v[i];
vector<int> od(n);
iota(od.begin(), od.end(), 0);
sort(od.begin(), od.end(), [&](int a, int b) {
if (s[a] + w[a] == s[b] + w[b])
return v[a] > v[b];
return s[a] + w[a] < s[b] + w[b];
});
const int l = 2 * 10100;
vector<long long> f(l + 1, 0);
for (int i = 0; i < n; i++) {
int id = od[i];
for (int j = s[id]; j >= 0; j--) {
f[j + w[id]] = max(f[j + w[id]], f[j] + v[id]);
}
}
long long ans = 0;
for (int i = 0; i <= l; i++)
ans = max(ans, f[i]);
cout << ans << endl;
return 0;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 989,707 | 989,708 | u251828455 | cpp |
p03183 | #include <bits/stdc++.h>
#define each(i, c) for (auto &i : c)
#define unless(cond) if (!(cond))
using namespace std;
typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;
template <typename P, typename Q>
ostream &operator<<(ostream &os, pair<P, Q> p) {
os << "(" << p.first << "," << p.second << ")";
return os;
}
template <typename P, typename Q>
istream &operator>>(istream &is, pair<P, Q> &p) {
is >> p.first >> p.second;
return is;
}
template <typename T> ostream &operator<<(ostream &os, vector<T> v) {
os << "(";
each(i, v) os << i << ",";
os << ")";
return os;
}
template <typename T> istream &operator>>(istream &is, vector<T> &v) {
each(i, v) is >> i;
return is;
}
template <typename T> inline T setmax(T &a, T b) { return a = std::max(a, b); }
template <typename T> inline T setmin(T &a, T b) { return a = std::min(a, b); }
int main(int argc, char *argv[]) {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
while (cin >> n) {
using Block = struct { lli w, s, v; };
vector<Block> v(n);
for (int i = 0; i < n; ++i) {
cin >> v[i].w >> v[i].s >> v[i].v;
}
sort(v.begin(), v.end(),
[](auto a, auto b) { return a.w + a.s < b.w + b.w; });
const int N = 1000 + 5;
const int M = 20000 + 5;
static lli dp[N][M];
fill(&dp[0][0], &dp[N - 1][M - 1], 0);
for (int i = 0; i < v.size(); ++i) {
for (int j = 0; j < M; ++j) {
setmax(dp[i + 1][j], dp[i][j]);
}
for (int j = 0; j <= v[i].s; ++j) {
setmax(dp[i + 1][j + v[i].w], dp[i][j] + v[i].v);
}
}
cout << *max_element(&dp[0][0], &dp[N - 1][M - 1] + 1) << endl;
}
return 0;
}
| #include <bits/stdc++.h>
#define each(i, c) for (auto &i : c)
#define unless(cond) if (!(cond))
using namespace std;
typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;
template <typename P, typename Q>
ostream &operator<<(ostream &os, pair<P, Q> p) {
os << "(" << p.first << "," << p.second << ")";
return os;
}
template <typename P, typename Q>
istream &operator>>(istream &is, pair<P, Q> &p) {
is >> p.first >> p.second;
return is;
}
template <typename T> ostream &operator<<(ostream &os, vector<T> v) {
os << "(";
each(i, v) os << i << ",";
os << ")";
return os;
}
template <typename T> istream &operator>>(istream &is, vector<T> &v) {
each(i, v) is >> i;
return is;
}
template <typename T> inline T setmax(T &a, T b) { return a = std::max(a, b); }
template <typename T> inline T setmin(T &a, T b) { return a = std::min(a, b); }
int main(int argc, char *argv[]) {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
while (cin >> n) {
using Block = struct { lli w, s, v; };
vector<Block> v(n);
for (int i = 0; i < n; ++i) {
cin >> v[i].w >> v[i].s >> v[i].v;
}
sort(v.begin(), v.end(),
[](auto a, auto b) { return a.w + a.s < b.w + b.s; });
const int N = 1000 + 5;
const int M = 20000 + 5;
static lli dp[N][M];
fill(&dp[0][0], &dp[N - 1][M - 1], 0);
for (int i = 0; i < v.size(); ++i) {
for (int j = 0; j < M; ++j) {
setmax(dp[i + 1][j], dp[i][j]);
}
for (int j = 0; j <= v[i].s; ++j) {
setmax(dp[i + 1][j + v[i].w], dp[i][j] + v[i].v);
}
}
cout << *max_element(&dp[0][0], &dp[N - 1][M - 1] + 1) << endl;
}
return 0;
}
| [
"call.arguments.change",
"function.return_value.change",
"expression.operation.binary.change"
] | 989,730 | 989,731 | u768334187 | cpp |
p03183 | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define INF 1e18 + 5
vector<int> w(1009);
vector<int> s(1009);
vector<int> v(1009);
vector<int> dp(10009);
bool comp(int a, int b) { return s[a] + w[a] > s[b] + w[b]; }
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<int> elements(n);
for (int i = 0; i < n; i++) {
elements[i] = i;
cin >> w[i] >> s[i] >> v[i];
}
sort(elements.begin(), elements.end(), comp);
for (int j = 0; j < n; j++) {
int i = elements[j];
for (int k = w[i]; k < 20009; k++) {
dp[min(k - w[i], s[i])] = max(dp[min(k - w[i], s[i])], dp[k] + v[i]);
}
}
int ans = 0;
for (int i = 0; i < 10009; i++) {
ans = max(ans, dp[i]);
}
cout << ans << endl;
}
| #include <bits/stdc++.h>
using namespace std;
#define int long long
#define INF 1e18 + 5
vector<int> w(1009);
vector<int> s(1009);
vector<int> v(1009);
vector<int> dp(20009);
bool comp(int a, int b) { return s[a] + w[a] > s[b] + w[b]; }
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<int> elements(n);
for (int i = 0; i < n; i++) {
elements[i] = i;
cin >> w[i] >> s[i] >> v[i];
}
sort(elements.begin(), elements.end(), comp);
for (int j = 0; j < n; j++) {
int i = elements[j];
for (int k = w[i]; k < 20009; k++) {
dp[min(k - w[i], s[i])] = max(dp[min(k - w[i], s[i])], dp[k] + v[i]);
}
}
int ans = 0;
for (int i = 0; i < 10009; i++) {
ans = max(ans, dp[i]);
}
cout << ans << endl;
}
| [
"literal.number.change",
"call.arguments.change"
] | 989,741 | 989,742 | u457198113 | cpp |
p03183 | // Author : Rifayat Samee (Sanzee)
// Problem :
// Algorithm:
/*
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define maxval 10005
struct Node {
int w;
int s;
ll v;
bool operator<(const Node &b) const { return b.w + b.s > w + s; }
};
int main() {
// freopen("in.txt","r",stdin);
// freopen("out.txt","w",stdout);
int n;
scanf("%d", &n);
vector<Node> B(n);
for (int i = 0; i < n; i++) {
scanf("%d %d %d", &B[i].w, &B[i].s, &B[i].v);
}
sort(B.begin(), B.end());
vector<ll> P(maxval + 1, 0);
for (int i = 0; i < n; i++) {
vector<ll> dp(maxval + 1);
dp = P;
for (int w = 0; w <= B[i].s; w++) {
dp[w + B[i].w] = max(P[w + B[i].w], P[w] + B[i].v);
}
P = dp;
}
ll res = 0;
for (int w = 0; w <= maxval; w++)
res = max(res, P[w]);
printf("%lld\n", res);
return 0;
}
| // Author : Rifayat Samee (Sanzee)
// Problem :
// Algorithm:
/*
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define maxval 2 * 10005
struct Node {
int w;
int s;
ll v;
bool operator<(const Node &b) const { return b.w + b.s > w + s; }
};
int main() {
// freopen("in.txt","r",stdin);
// freopen("out.txt","w",stdout);
int n;
scanf("%d", &n);
vector<Node> B(n);
for (int i = 0; i < n; i++) {
scanf("%d %d %d", &B[i].w, &B[i].s, &B[i].v);
}
sort(B.begin(), B.end());
vector<ll> P(maxval + 1, 0);
for (int i = 0; i < n; i++) {
vector<ll> dp(maxval + 1);
dp = P;
for (int w = 0; w <= B[i].s; w++) {
dp[w + B[i].w] = max(P[w + B[i].w], P[w] + B[i].v);
}
P = dp;
}
ll res = 0;
for (int w = 0; w <= maxval; w++)
res = max(res, P[w]);
printf("%lld\n", res);
return 0;
}
| [] | 989,747 | 989,748 | u926505307 | cpp |
p03183 | #include <bits/stdc++.h>
using namespace std;
using ld = double;
using ll = long long;
using ull = unsigned long long;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int SZ = 1 << 13;
char buff[SZ], *pos = buff + SZ - 1;
#define getchar() \
(++pos == buff + SZ ? fread(pos = buff, 1, SZ, stdin), *pos : *pos)
inline ll read() {
ll x = 0;
int f = 1, c = getchar();
for (; !isdigit(c); c = getchar())
if (c == '-')
f = -f;
for (; isdigit(c); c = getchar())
x = (x << 3) + (x << 1) + (c ^ 48);
return x * f;
}
const int N = 1005;
ll n;
ll w[N], s[N], v[N];
ll ind[N];
ll dp[N][N * 10];
ll maxw, maxs;
inline void chk(ll &a, ll b) {
if (b > a)
a = b;
}
int main() {
n = read();
for (int i = 0; i < n; ++i) {
w[i] = read(), s[i] = read(), v[i] = read();
chk(maxw, w[i]);
chk(maxs, s[i]);
ind[i] = i;
}
sort(ind, ind + n, [&](ll a, ll b) { return w[a] + s[a] < w[b] + s[b]; });
ll ans = 0;
for (ll ii = 0; ii < n; ++ii) {
ll i = ind[ii];
for (ll j = 0; j <= maxs + maxw; ++j) {
chk(dp[ii + 1][j], dp[ii][j]);
if (j > s[i])
continue;
if (j + w[i] <= maxs + maxw)
chk(dp[ii + 1][j + w[i]], dp[ii][j] + v[i]);
}
}
for (ll i = 0; i <= n; ++i) {
for (ll j = 0; j <= maxs + maxw; ++j) {
chk(ans, dp[i][j]);
}
}
printf("%lld\n", ans);
return 0;
} | #include <bits/stdc++.h>
using namespace std;
using ld = double;
using ll = long long;
using ull = unsigned long long;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int SZ = 1 << 13;
char buff[SZ], *pos = buff + SZ - 1;
#define getchar() \
(++pos == buff + SZ ? fread(pos = buff, 1, SZ, stdin), *pos : *pos)
inline ll read() {
ll x = 0;
int f = 1, c = getchar();
for (; !isdigit(c); c = getchar())
if (c == '-')
f = -f;
for (; isdigit(c); c = getchar())
x = (x << 3) + (x << 1) + (c ^ 48);
return x * f;
}
const int N = 1005;
ll n;
ll w[N], s[N], v[N];
ll ind[N];
ll dp[N][N * 20];
ll maxw, maxs;
inline void chk(ll &a, ll b) {
if (b > a)
a = b;
}
int main() {
n = read();
for (int i = 0; i < n; ++i) {
w[i] = read(), s[i] = read(), v[i] = read();
chk(maxw, w[i]);
chk(maxs, s[i]);
ind[i] = i;
}
sort(ind, ind + n, [&](ll a, ll b) { return w[a] + s[a] < w[b] + s[b]; });
ll ans = 0;
for (ll ii = 0; ii < n; ++ii) {
ll i = ind[ii];
for (ll j = 0; j <= maxs + maxw; ++j) {
chk(dp[ii + 1][j], dp[ii][j]);
if (j > s[i])
continue;
if (j + w[i] <= maxs + maxw)
chk(dp[ii + 1][j + w[i]], dp[ii][j] + v[i]);
}
}
for (ll i = 0; i <= n; ++i) {
for (ll j = 0; j <= maxs + maxw; ++j) {
chk(ans, dp[i][j]);
}
}
printf("%lld\n", ans);
return 0;
} | [
"literal.number.change",
"expression.operation.binary.change"
] | 989,781 | 989,782 | u274463010 | cpp |
p03183 | #include <bits/stdc++.h>
using namespace std;
#define NDEBUG
#include <cassert>
typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef pair<ll, ll> llll;
typedef pair<double, double> dd;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<llll> vllll;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;
#define sz(a) int((a).size())
#define pb push_back
#define eb emplace_back
#define FOR(var, from, to) for (int var = (from); var <= (to); ++var)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define rep1(var, n) for (int var = 1; var <= (n); ++var)
#define repC2(vari, varj, n) \
for (int vari = 0; vari < (n)-1; ++vari) \
for (int varj = vari + 1; varj < (n); ++varj)
#define repC3(vari, varj, vark, n) \
for (int vari = 0; vari < (n)-2; ++vari) \
for (int varj = vari + 1; varj < (n)-1; ++varj) \
for (int vark = varj + 1; vark < (n); ++vark)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define tr(i, c) for (auto i = (c).begin(); i != (c).end(); ++i)
#define found(s, e) ((s).find(e) != (s).end())
#define mset(arr, val) memset(arr, val, sizeof(arr))
#define mid(x, y) ((x) + ((y) - (x)) / 2)
#define IN(x, a, b) ((a) <= (x) && (x) <= (b))
#define cons make_pair
template <class T> inline void amin(T &a, T const &b) { a = min(a, b); }
template <class T> inline void amax(T &a, T const &b) { a = max(a, b); }
template <typename X, typename T> auto vectors(X x, T a) {
return vector<T>(x, a);
}
template <typename X, typename Y, typename Z, typename... Zs>
auto vectors(X x, Y y, Z z, Zs... zs) {
auto cont = vectors(y, z, zs...);
return vector<decltype(cont)>(x, cont);
}
ll gcd(ll a, ll b) {
while (a)
swap(a, b %= a);
return b;
}
const ll MOD = 1000000007LL;
ll ADD(ll x, ll y) { return (x + y) % MOD; }
ll SUB(ll x, ll y) { return (x - y + MOD) % MOD; }
ll MUL(ll x, ll y) { return x * y % MOD; }
ll POW(ll x, ll e) {
ll v = 1;
for (; e; x = MUL(x, x), e >>= 1)
if (e & 1)
v = MUL(v, x);
return v;
}
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/
return MUL(x, POW(y, MOD - 2));
}
#define INTSPACE 12
char _buf[INTSPACE * 1000000 + 3];
int loadint() {
if (fgets(_buf, INTSPACE + 3, stdin) == NULL)
return 0;
return atoi(_buf);
}
int loadvec(vector<int> &v, int N = -1) {
if (N == 0) {
v.clear();
return 0;
}
if (N == -1) {
N = loadint();
if (N == 0)
return 0;
}
int bufsize = INTSPACE * N + 3;
if (fgets(_buf, bufsize, stdin) == NULL)
return 0;
v.resize(N);
int i = 0;
bool last = false;
for (char *p = &_buf[0];;) {
char *q = p;
while (*q > ' ')
++q;
if (*q == 0x0D || *q == 0x0A)
last = true;
*q = 0;
v[i++] = atoi(p);
if (last || i == N)
break;
p = q + 1;
}
return i;
}
void read_cr() { fgets(_buf, 256, stdin); }
#define WMAX 10000
ll solve(int N, vi &w, vi &s, vi &v) {
vector<pair<int, ii>> x(N);
rep(i, N) x[i] = pair<int, ii>(s[i] + w[i], ii(w[i], v[i]));
sort(ALL(x));
vector<vll> dp(2, vll(WMAX + 1, -1));
dp[0][0] = 0;
rep(i, N) {
dp[1 - i % 2].assign(WMAX + 1, -1);
int cap = x[i].first, wa = x[i].second.first, va = x[i].second.second;
for (int ws = 0; ws <= WMAX; ++ws) {
dp[1 - i % 2][ws] = max(dp[1 - i % 2][ws], dp[i % 2][ws]);
if (ws + wa <= cap) {
dp[1 - i % 2][ws + wa] = max(dp[1 - i % 2][ws], dp[i % 2][ws] + va);
}
}
}
ll ans = 0;
rep(i, WMAX + 1) ans = max(ans, dp[N % 2][i]);
return ans;
}
int main() {
int N;
scanf("%d", &N);
vi w(N), s(N), v(N);
rep(i, N) { scanf("%d%d%d", &w[i], &s[i], &v[i]); }
cout << solve(N, w, s, v) << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define NDEBUG
#include <cassert>
typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef pair<ll, ll> llll;
typedef pair<double, double> dd;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<llll> vllll;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;
#define sz(a) int((a).size())
#define pb push_back
#define eb emplace_back
#define FOR(var, from, to) for (int var = (from); var <= (to); ++var)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define rep1(var, n) for (int var = 1; var <= (n); ++var)
#define repC2(vari, varj, n) \
for (int vari = 0; vari < (n)-1; ++vari) \
for (int varj = vari + 1; varj < (n); ++varj)
#define repC3(vari, varj, vark, n) \
for (int vari = 0; vari < (n)-2; ++vari) \
for (int varj = vari + 1; varj < (n)-1; ++varj) \
for (int vark = varj + 1; vark < (n); ++vark)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define tr(i, c) for (auto i = (c).begin(); i != (c).end(); ++i)
#define found(s, e) ((s).find(e) != (s).end())
#define mset(arr, val) memset(arr, val, sizeof(arr))
#define mid(x, y) ((x) + ((y) - (x)) / 2)
#define IN(x, a, b) ((a) <= (x) && (x) <= (b))
#define cons make_pair
template <class T> inline void amin(T &a, T const &b) { a = min(a, b); }
template <class T> inline void amax(T &a, T const &b) { a = max(a, b); }
template <typename X, typename T> auto vectors(X x, T a) {
return vector<T>(x, a);
}
template <typename X, typename Y, typename Z, typename... Zs>
auto vectors(X x, Y y, Z z, Zs... zs) {
auto cont = vectors(y, z, zs...);
return vector<decltype(cont)>(x, cont);
}
ll gcd(ll a, ll b) {
while (a)
swap(a, b %= a);
return b;
}
const ll MOD = 1000000007LL;
ll ADD(ll x, ll y) { return (x + y) % MOD; }
ll SUB(ll x, ll y) { return (x - y + MOD) % MOD; }
ll MUL(ll x, ll y) { return x * y % MOD; }
ll POW(ll x, ll e) {
ll v = 1;
for (; e; x = MUL(x, x), e >>= 1)
if (e & 1)
v = MUL(v, x);
return v;
}
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/
return MUL(x, POW(y, MOD - 2));
}
#define INTSPACE 12
char _buf[INTSPACE * 1000000 + 3];
int loadint() {
if (fgets(_buf, INTSPACE + 3, stdin) == NULL)
return 0;
return atoi(_buf);
}
int loadvec(vector<int> &v, int N = -1) {
if (N == 0) {
v.clear();
return 0;
}
if (N == -1) {
N = loadint();
if (N == 0)
return 0;
}
int bufsize = INTSPACE * N + 3;
if (fgets(_buf, bufsize, stdin) == NULL)
return 0;
v.resize(N);
int i = 0;
bool last = false;
for (char *p = &_buf[0];;) {
char *q = p;
while (*q > ' ')
++q;
if (*q == 0x0D || *q == 0x0A)
last = true;
*q = 0;
v[i++] = atoi(p);
if (last || i == N)
break;
p = q + 1;
}
return i;
}
void read_cr() { fgets(_buf, 256, stdin); }
#define WMAX 20000
ll solve(int N, vi &w, vi &s, vi &v) {
vector<pair<int, ii>> x(N);
rep(i, N) x[i] = pair<int, ii>(s[i] + w[i], ii(w[i], v[i]));
sort(ALL(x));
vector<vll> dp(2, vll(WMAX + 1, -1));
dp[0][0] = 0;
rep(i, N) {
dp[1 - i % 2].assign(WMAX + 1, -1);
int cap = x[i].first, wa = x[i].second.first, va = x[i].second.second;
for (int ws = 0; ws <= WMAX; ++ws) {
dp[1 - i % 2][ws] = max(dp[1 - i % 2][ws], dp[i % 2][ws]);
if (ws + wa <= cap) {
dp[1 - i % 2][ws + wa] = max(dp[1 - i % 2][ws], dp[i % 2][ws] + va);
}
}
}
ll ans = 0;
rep(i, WMAX + 1) ans = max(ans, dp[N % 2][i]);
return ans;
}
int main() {
int N;
scanf("%d", &N);
vi w(N), s(N), v(N);
rep(i, N) { scanf("%d%d%d", &w[i], &s[i], &v[i]); }
cout << solve(N, w, s, v) << endl;
return 0;
}
| [
"preprocessor.define.value.change",
"literal.integer.change"
] | 989,783 | 989,784 | u108808596 | cpp |
p03183 | #include <bits/stdc++.h>
#define x first
#define y second
#define y1 Y1
#define y2 Y2
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
template <typename T> inline int Chkmax(T &a, T b) {
return a < b ? a = b, 1 : 0;
}
template <typename T> inline int Chkmin(T &a, T b) {
return a > b ? a = b, 1 : 0;
}
template <typename T> T read() {
T sum = 0, fl = 1;
char ch = getchar();
for (; !isdigit(ch); ch = getchar())
if (ch == '-')
fl = -1;
for (; isdigit(ch); ch = getchar())
sum = (sum << 3) + (sum << 1) + ch - '0';
return sum * fl;
}
inline void proc_status() {
ifstream t("/proc/self/status");
cerr << string(istreambuf_iterator<char>(t), istreambuf_iterator<char>())
<< endl;
}
const int Maxn = 1e3 + 100;
int N;
LL Dp[10000 + 100];
struct info {
int w, s, v;
} A[Maxn];
inline int cmp(info a, info b) { return a.s + a.w < b.s + b.w; }
int Max;
inline void Solve() {
sort(A + 1, A + N + 1, cmp);
LL ans = 0;
for (int i = 1; i <= N; ++i)
for (int j = A[i].s; j >= 0; --j) {
Chkmax(Dp[j + A[i].w], Dp[j] + A[i].v);
Chkmax(ans, Dp[j + A[i].w]);
}
cout << ans << endl;
}
inline void Input() {
N = read<int>();
for (int i = 1; i <= N; ++i)
A[i].w = read<int>(), A[i].s = read<int>(), A[i].v = read<int>(),
Chkmax(Max, A[i].s);
}
int main() {
#ifdef hk_cnyali
freopen("X.in", "r", stdin);
freopen("X.out", "w", stdout);
#endif
Input();
Solve();
return 0;
} | #include <bits/stdc++.h>
#define x first
#define y second
#define y1 Y1
#define y2 Y2
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
template <typename T> inline int Chkmax(T &a, T b) {
return a < b ? a = b, 1 : 0;
}
template <typename T> inline int Chkmin(T &a, T b) {
return a > b ? a = b, 1 : 0;
}
template <typename T> T read() {
T sum = 0, fl = 1;
char ch = getchar();
for (; !isdigit(ch); ch = getchar())
if (ch == '-')
fl = -1;
for (; isdigit(ch); ch = getchar())
sum = (sum << 3) + (sum << 1) + ch - '0';
return sum * fl;
}
inline void proc_status() {
ifstream t("/proc/self/status");
cerr << string(istreambuf_iterator<char>(t), istreambuf_iterator<char>())
<< endl;
}
const int Maxn = 1e3 + 100;
int N;
LL Dp[20000 + 100];
struct info {
int w, s, v;
} A[Maxn];
inline int cmp(info a, info b) { return a.s + a.w < b.s + b.w; }
int Max;
inline void Solve() {
sort(A + 1, A + N + 1, cmp);
LL ans = 0;
for (int i = 1; i <= N; ++i)
for (int j = A[i].s; j >= 0; --j) {
Chkmax(Dp[j + A[i].w], Dp[j] + A[i].v);
Chkmax(ans, Dp[j + A[i].w]);
}
cout << ans << endl;
}
inline void Input() {
N = read<int>();
for (int i = 1; i <= N; ++i)
A[i].w = read<int>(), A[i].s = read<int>(), A[i].v = read<int>(),
Chkmax(Max, A[i].s);
}
int main() {
#ifdef hk_cnyali
freopen("X.in", "r", stdin);
freopen("X.out", "w", stdout);
#endif
Input();
Solve();
return 0;
} | [
"literal.number.change",
"expression.operation.binary.change"
] | 989,792 | 989,793 | u124985450 | cpp |
p03183 | #include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <complex>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cassert>
#include <functional>
typedef long long ll;
using namespace std;
#ifdef LOCAL
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;
#else
#define debug(x) ;
#endif
#define mod 1000000007 // 1e9+7(prime number)
#define INF 1000000000 // 1e9
#define LLINF 2000000000000000000LL // 2e18
#define SIZE 3010
#define SIZE2 10010
ll dp[SIZE2];
int main() {
int n, w[SIZE], s[SIZE], v[SIZE];
pair<int, int> blocks[SIZE];
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d%d%d", w + i, s + i, v + i);
blocks[i] = {s[i] + w[i], i};
}
sort(blocks, blocks + n);
for (int i = 1; i <= 10000; i++) {
dp[i] = -LLINF;
}
ll ans = 0;
for (int i = 0; i < n; i++) {
int id = blocks[i].second;
for (int j = s[id]; j >= 0; j--) {
dp[j + w[id]] = max(dp[j + w[id]], dp[j] + v[id]);
ans = max(ans, dp[j + w[id]]);
}
}
cout << ans << endl;
return 0;
}
| #include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <complex>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cassert>
#include <functional>
typedef long long ll;
using namespace std;
#ifdef LOCAL
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;
#else
#define debug(x) ;
#endif
#define mod 1000000007 // 1e9+7(prime number)
#define INF 1000000000 // 1e9
#define LLINF 2000000000000000000LL // 2e18
#define SIZE 3010
#define SIZE2 20010
ll dp[SIZE2];
int main() {
int n, w[SIZE], s[SIZE], v[SIZE];
pair<int, int> blocks[SIZE];
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d%d%d", w + i, s + i, v + i);
blocks[i] = {s[i] + w[i], i};
}
sort(blocks, blocks + n);
for (int i = 1; i < SIZE2; i++) {
dp[i] = -LLINF;
}
ll ans = 0;
for (int i = 0; i < n; i++) {
int id = blocks[i].second;
for (int j = s[id]; j >= 0; j--) {
dp[j + w[id]] = max(dp[j + w[id]], dp[j] + v[id]);
ans = max(ans, dp[j + w[id]]);
}
}
cout << ans << endl;
return 0;
}
| [
"preprocessor.define.value.change",
"literal.integer.change",
"control_flow.loop.for.condition.change"
] | 989,807 | 989,808 | u378419207 | cpp |
p03183 | #include "bits/stdc++.h"
using namespace std;
#define FAST \
ios_base::sync_with_stdio(false); \
cin.tie(0);
#define LLINF (long long)1e18 // 1234567890987654321
#define INF 1234567890
#define pb push_back
#define ins insert
#define f first
#define s second
#define db 0
#define EPS (1e-7) // 0.0000001 the value
#define PI (acos(-1))
#define MAXN 300006
#define MAXK 26
#define MAXX 15000006
#define ll long long int
#define ld long double
#define rep0(kk, l1, l2) for (ll kk = l1; kk < l2; kk++)
#define rep1(kk, l1, l2) for (ll kk = l1; kk <= l2; kk++)
#define foritr(itr, A) \
for (set<ll>::iterator itr = A.begin(); itr != A.end(); itr++)
mt19937
rng(chrono::steady_clock::now()
.time_since_epoch()
.count()); // can be used by calling rng() or shuffle(A, A+n, rng)
#define FOR(ii, ss, ee) for (ll ii = ss; ii < ee; ii++)
#define cr(x) cerr << #x << " = " << x << "\n";
#define crA(x, A) cerr << #x << " = " << A[x] << "\n";
#define spacing \
if (db) \
cout << " ";
#define mmst(x, v) memset((x), v, sizeof((x)));
#define bg(ms) (*ms.begin())
#define ed(ms) (*prev(ms.end(), 1))
#define addedge(a, b, c, v) \
v[(a)].pb(pi((b), (c))); \
v[(b)].pb(pi((a), (c)))
#define ph push
#define btinpct(x) __builtin_popcountll(x)
#define p2(x) (1LL << (x))
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
typedef pair<ll, ll> pi;
typedef pair<ll, pi> spi;
typedef pair<pi, pi> dpi;
inline ll rand(ll x, ll y) {
++y;
return (rng() % (y - x)) + x;
} // inclusivesss
ll n, dp[10006];
struct item {
ll w, s, v;
bool operator<(const item &e) const { return s + w > e.s + e.w; }
} A[1006];
int main() {
cin >> n;
FOR(i, 0, n) cin >> A[i].w >> A[i].s >> A[i].v;
sort(A, A + n);
for (ll i = 0; i < n; i++) {
ll w = A[i].w, s = A[i].s, v = A[i].v;
// cout << s << ' ' << w << ' ' << v << '\n';
for (ll i = 0; i <= s; i++) {
dp[i] = max(dp[i], dp[i + w] + v);
}
}
cout << *max_element(dp, dp + 10006) << '\n';
}
| #include "bits/stdc++.h"
using namespace std;
#define FAST \
ios_base::sync_with_stdio(false); \
cin.tie(0);
#define LLINF (long long)1e18 // 1234567890987654321
#define INF 1234567890
#define pb push_back
#define ins insert
#define f first
#define s second
#define db 0
#define EPS (1e-7) // 0.0000001 the value
#define PI (acos(-1))
#define MAXN 300006
#define MAXK 26
#define MAXX 15000006
#define ll long long int
#define ld long double
#define rep0(kk, l1, l2) for (ll kk = l1; kk < l2; kk++)
#define rep1(kk, l1, l2) for (ll kk = l1; kk <= l2; kk++)
#define foritr(itr, A) \
for (set<ll>::iterator itr = A.begin(); itr != A.end(); itr++)
mt19937
rng(chrono::steady_clock::now()
.time_since_epoch()
.count()); // can be used by calling rng() or shuffle(A, A+n, rng)
#define FOR(ii, ss, ee) for (ll ii = ss; ii < ee; ii++)
#define cr(x) cerr << #x << " = " << x << "\n";
#define crA(x, A) cerr << #x << " = " << A[x] << "\n";
#define spacing \
if (db) \
cout << " ";
#define mmst(x, v) memset((x), v, sizeof((x)));
#define bg(ms) (*ms.begin())
#define ed(ms) (*prev(ms.end(), 1))
#define addedge(a, b, c, v) \
v[(a)].pb(pi((b), (c))); \
v[(b)].pb(pi((a), (c)))
#define ph push
#define btinpct(x) __builtin_popcountll(x)
#define p2(x) (1LL << (x))
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
typedef pair<ll, ll> pi;
typedef pair<ll, pi> spi;
typedef pair<pi, pi> dpi;
inline ll rand(ll x, ll y) {
++y;
return (rng() % (y - x)) + x;
} // inclusivesss
ll n, dp[10006 * 3];
struct item {
ll w, s, v;
bool operator<(const item &e) const { return s + w > e.s + e.w; }
} A[1006];
int main() {
cin >> n;
FOR(i, 0, n) cin >> A[i].w >> A[i].s >> A[i].v;
sort(A, A + n);
for (ll i = 0; i < n; i++) {
ll w = A[i].w, s = A[i].s, v = A[i].v;
// cout << s << ' ' << w << ' ' << v << '\n';
for (ll i = 0; i <= s; i++) {
dp[i] = max(dp[i], dp[i + w] + v);
}
}
cout << *max_element(dp, dp + 10006) << '\n';
}
| [
"variable_declaration.array_dimensions.change",
"expression.operation.binary.add"
] | 989,809 | 989,810 | u844961982 | cpp |
p03183 | #include <bits/stdc++.h>
#define va first
#define vb second
#define lb lower_bound
#define pb push_back
#define all(v) v.begin(), v.end()
#define fio \
ios_base::sync_with_stdio(0); \
cin.tie(0);
using namespace std;
using ll = long long;
using lf = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
ll D[10005];
int n;
struct box {
int w, v, s;
bool operator<(box b) { return s + w < b.s + b.w; }
} B[1005];
int main() {
fio;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> B[i].w >> B[i].s >> B[i].v;
}
sort(B, B + n);
for (int i = 0; i < n; i++) {
for (int j = B[i].s; j >= 0; j--) {
D[j + B[i].w] = max(D[j + B[i].w], D[j] + B[i].v);
}
}
cout << *max_element(D, D + 10001) << '\n';
} | #include <bits/stdc++.h>
#define va first
#define vb second
#define lb lower_bound
#define pb push_back
#define all(v) v.begin(), v.end()
#define fio \
ios_base::sync_with_stdio(0); \
cin.tie(0);
using namespace std;
using ll = long long;
using lf = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
ll D[20005];
int n;
struct box {
int w, v, s;
bool operator<(box b) { return s + w < b.s + b.w; }
} B[1005];
int main() {
fio;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> B[i].w >> B[i].s >> B[i].v;
}
sort(B, B + n);
for (int i = 0; i < n; i++) {
for (int j = B[i].s; j >= 0; j--) {
D[j + B[i].w] = max(D[j + B[i].w], D[j] + B[i].v);
}
}
cout << *max_element(D, D + 20001) << '\n';
}
| [
"literal.number.change",
"variable_declaration.array_dimensions.change",
"io.output.change"
] | 989,819 | 989,820 | u582763758 | cpp |
p03183 | #include <bits/stdc++.h>
using namespace std;
struct trio {
int wt, sz, v;
bool operator<(const trio &t) const { return sz + wt < t.sz + t.wt; }
};
int N;
trio arr[1005];
long long dp[10005];
int main() {
cin >> N;
for (int i = 1; i <= N; i++) {
cin >> arr[i].wt >> arr[i].sz >> arr[i].v;
}
sort(arr + 1, arr + N + 1);
long long ans = 0;
for (int i = 1; i <= N; i++) {
for (int j = arr[i].sz; j >= 0; j--) {
dp[j + arr[i].wt] = max(dp[j + arr[i].wt], dp[j] + arr[i].v);
ans = max(dp[j + arr[i].wt], ans);
}
}
cout << ans << endl;
}
| #include <bits/stdc++.h>
using namespace std;
struct trio {
int wt, sz, v;
bool operator<(const trio &t) const { return sz + wt < t.sz + t.wt; }
};
int N;
trio arr[1005];
long long dp[30005];
int main() {
cin >> N;
for (int i = 1; i <= N; i++) {
cin >> arr[i].wt >> arr[i].sz >> arr[i].v;
}
sort(arr + 1, arr + N + 1);
long long ans = 0;
for (int i = 1; i <= N; i++) {
for (int j = arr[i].sz; j >= 0; j--) {
dp[j + arr[i].wt] = max(dp[j + arr[i].wt], dp[j] + arr[i].v);
ans = max(dp[j + arr[i].wt], ans);
}
}
cout << ans << endl;
}
| [
"literal.number.change",
"variable_declaration.array_dimensions.change"
] | 989,857 | 989,858 | u937063359 | cpp |
p03183 | #include <bits/stdc++.h>
#define ll long long
#define ld long double
using namespace std;
int n;
pair<pair<int, int>, int> t[1005];
bool cmp(pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) {
return b.first.first + b.first.second > a.first.first + a.first.second;
}
ll dp[10005];
int main() {
cin >> n;
for (int i = 0; n > i; i++) {
cin >> t[i].first.first >> t[i].first.second >> t[i].second;
}
sort(t, t + n, cmp);
fill(dp, dp + 10003, -1e18);
dp[0] = 0;
for (int i = 0; n > i; i++) {
int val = t[i].second;
int waga = t[i].first.first;
int wyt = t[i].first.second;
for (int j = wyt; j >= 0; j--)
if (dp[j] >= 0)
dp[j + waga] = max(dp[j + waga], dp[j] + val);
}
ll out = 0;
for (int i = 0; 10000 >= i; i++)
out = max(out, dp[i]);
cout << out;
return 0;
}
| #include <bits/stdc++.h>
#define ll long long
#define ld long double
using namespace std;
int n;
pair<pair<int, int>, int> t[1005];
bool cmp(pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) {
return b.first.first + b.first.second > a.first.first + a.first.second;
}
ll dp[50005];
int main() {
cin >> n;
for (int i = 0; n > i; i++) {
cin >> t[i].first.first >> t[i].first.second >> t[i].second;
}
sort(t, t + n, cmp);
fill(dp, dp + 20003, -1e18);
dp[0] = 0;
for (int i = 0; n > i; i++) {
int val = t[i].second;
int waga = t[i].first.first;
int wyt = t[i].first.second;
for (int j = wyt; j >= 0; j--)
if (dp[j] >= 0)
dp[j + waga] = max(dp[j + waga], dp[j] + val);
}
ll out = 0;
for (int i = 0; 20005 >= i; i++)
out = max(out, dp[i]);
cout << out;
return 0;
}
| [
"literal.number.change",
"variable_declaration.array_dimensions.change",
"call.arguments.change",
"expression.operation.binary.change",
"control_flow.loop.for.condition.change"
] | 989,862 | 989,863 | u559535763 | cpp |
p03183 | #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
//#include<bits/extc++.h>
using namespace std;
// using namespace __gnu_pbds;
// typedef
// tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
// set_t;
#define mp(a, b) make_pair((a), (b))
#define pii pair<int, int>
#define pll pair<LL, LL>
#define pdd pair<double, double>
#define pb push_back
#define x first
#define y second
#define sqr(x) ((x) * (x))
#define EPS 1e-6
#define MEM(x) memset(x, 0, sizeof(x))
#define MEMS(x) memset(x, -1, sizeof(x))
#define pi acos(-1)
#define index Index
#define Line pll
typedef long long LL;
int main() {
int n;
scanf("%d", &n);
pair<int, pii> p[1005];
for (int i = 0; i < n; i++) {
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
p[i] = mp(a + b, mp(a, c));
}
sort(p, p + n);
LL dp[10005];
MEM(dp);
LL ans = 0;
for (int i = 0; i < n; i++) {
for (int j = p[i].x - p[i].y.x; j >= 0; j--) {
dp[j + p[i].y.x] = max(dp[j + p[i].y.x], dp[j] + p[i].y.y);
ans = max(ans, dp[j + p[i].y.x]);
}
}
printf("%lld\n", ans);
}
| #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
//#include<bits/extc++.h>
using namespace std;
// using namespace __gnu_pbds;
// typedef
// tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
// set_t;
#define mp(a, b) make_pair((a), (b))
#define pii pair<int, int>
#define pll pair<LL, LL>
#define pdd pair<double, double>
#define pb push_back
#define x first
#define y second
#define sqr(x) ((x) * (x))
#define EPS 1e-6
#define MEM(x) memset(x, 0, sizeof(x))
#define MEMS(x) memset(x, -1, sizeof(x))
#define pi acos(-1)
#define index Index
#define Line pll
typedef long long LL;
int main() {
int n;
scanf("%d", &n);
pair<int, pii> p[1005];
for (int i = 0; i < n; i++) {
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
p[i] = mp(a + b, mp(a, c));
}
sort(p, p + n);
LL dp[20005];
MEM(dp);
LL ans = 0;
for (int i = 0; i < n; i++) {
for (int j = p[i].x - p[i].y.x; j >= 0; j--) {
dp[j + p[i].y.x] = max(dp[j + p[i].y.x], dp[j] + p[i].y.y);
ans = max(ans, dp[j + p[i].y.x]);
}
}
printf("%lld\n", ans);
}
| [
"literal.number.change",
"variable_declaration.array_dimensions.change"
] | 989,881 | 989,882 | u682550266 | cpp |
p03189 | #include <bits/stdc++.h>
#define pb push_back
#define mk make_pair
#define ll long long
#define int long long
using namespace std;
const int maxn = 3010;
const int mod = 1e9 + 7;
int qsm(int i, int j) {
int ans = 1;
while (j) {
if (j & 1)
ans = ans * i % mod;
j >>= 1;
i = i * i % mod;
}
return ans;
}
int dp[maxn][maxn];
int n, m;
int q;
int a[maxn];
signed main() {
scanf("%lld%lld", &n, &m);
for (int i = 1; i <= n; i++)
scanf("%lld", &a[i]); // a[i]=read();
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
dp[i][j] = (a[i] > a[j]);
int inv = qsm(2, mod - 2);
for (int i = 1; i <= m; i++) {
int x, y;
scanf("%lld%lld", &x, &y);
dp[x][y] = dp[y][x] = (dp[x][y] + dp[y][x]) * inv % mod;
for (int i = 1; i <= n; i++) {
if (i != x && i != y) {
dp[x][i] = dp[y][i] = (dp[x][i] + dp[y][i]) * inv % mod;
dp[i][x] = dp[i][y] = (dp[i][x] + dp[i][y]) * inv % mod;
}
}
}
int ans = 0;
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
ans = (ans + dp[i][j]) % mod;
cout << ans * qsm(2, m) % mod * inv % mod;
return 0;
}
| #include <bits/stdc++.h>
#define pb push_back
#define mk make_pair
#define ll long long
#define int long long
using namespace std;
const int maxn = 3010;
const int mod = 1e9 + 7;
int qsm(int i, int j) {
int ans = 1;
while (j) {
if (j & 1)
ans = ans * i % mod;
j >>= 1;
i = i * i % mod;
}
return ans;
}
int dp[maxn][maxn];
int n, m;
int q;
int a[maxn];
signed main() {
scanf("%lld%lld", &n, &m);
for (int i = 1; i <= n; i++)
scanf("%lld", &a[i]); // a[i]=read();
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
dp[i][j] = (a[i] > a[j]); // a[i]在前,a[j]在后形成逆序对的概率
int inv = qsm(2, mod - 2);
for (int i = 1; i <= m; i++) {
int x, y;
scanf("%lld%lld", &x, &y);
dp[x][y] = dp[y][x] = (dp[x][y] + dp[y][x]) * inv % mod;
for (int i = 1; i <= n; i++) {
if (i != x && i != y) {
dp[x][i] = dp[y][i] = (dp[x][i] + dp[y][i]) * inv % mod;
dp[i][x] = dp[i][y] = (dp[i][x] + dp[i][y]) * inv % mod;
}
}
}
int ans = 0;
for (int i = 1; i <= n; i++)
for (int j = i + 1; j <= n; j++)
ans = (ans + dp[i][j]) % mod;
cout << ans * qsm(2, m) % mod;
return 0;
} | [
"control_flow.loop.for.initializer.change",
"expression.operation.binary.remove"
] | 989,908 | 989,909 | u749011596 | cpp |
p03189 | #include <bits/stdc++.h>
#define pb push_back
#define mk make_pair
#define ll long long
#define int long long
using namespace std;
const int maxn = 3010;
const int mod = 1e9 + 7;
int qsm(int i, int j) {
int ans = 1;
while (j) {
if (j & 1)
ans = ans * i % mod;
j >>= 1;
i = i * i % mod;
}
return ans;
}
int dp[maxn][maxn];
int n, m;
int q;
int a[maxn];
signed main() {
scanf("%lld%lld", &n, &m);
for (int i = 1; i <= n; i++)
scanf("%lld", &a[i]); // a[i]=read();
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
dp[i][j] = (a[i] > a[j]);
int inv = qsm(2, mod - 2);
for (int i = 1; i <= m; i++) {
int x, y;
scanf("%lld%lld", &x, &y);
dp[x][y] = dp[y][x] = (dp[x][y] + dp[y][x]) * inv % mod;
for (int i = 1; i <= n; i++) {
if (i != x && i != y) {
dp[x][i] = dp[y][i] = (dp[x][i] + dp[y][i]) * inv % mod;
dp[i][x] = dp[i][y] = (dp[i][x] + dp[i][y]) * inv % mod;
}
}
}
int ans = 0;
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
ans = (ans + dp[i][j]) % mod;
cout << ans * qsm(2, m) % mod * inv;
return 0;
}
| #include <bits/stdc++.h>
#define pb push_back
#define mk make_pair
#define ll long long
#define int long long
using namespace std;
const int maxn = 3010;
const int mod = 1e9 + 7;
int qsm(int i, int j) {
int ans = 1;
while (j) {
if (j & 1)
ans = ans * i % mod;
j >>= 1;
i = i * i % mod;
}
return ans;
}
int dp[maxn][maxn];
int n, m;
int q;
int a[maxn];
signed main() {
scanf("%lld%lld", &n, &m);
for (int i = 1; i <= n; i++)
scanf("%lld", &a[i]); // a[i]=read();
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
dp[i][j] = (a[i] > a[j]); // a[i]在前,a[j]在后形成逆序对的概率
int inv = qsm(2, mod - 2);
for (int i = 1; i <= m; i++) {
int x, y;
scanf("%lld%lld", &x, &y);
dp[x][y] = dp[y][x] = (dp[x][y] + dp[y][x]) * inv % mod;
for (int i = 1; i <= n; i++) {
if (i != x && i != y) {
dp[x][i] = dp[y][i] = (dp[x][i] + dp[y][i]) * inv % mod;
dp[i][x] = dp[i][y] = (dp[i][x] + dp[i][y]) * inv % mod;
}
}
}
int ans = 0;
for (int i = 1; i <= n; i++)
for (int j = i + 1; j <= n; j++)
ans = (ans + dp[i][j]) % mod;
cout << ans * qsm(2, m) % mod;
return 0;
} | [
"control_flow.loop.for.initializer.change",
"expression.operation.binary.remove"
] | 989,910 | 989,909 | u749011596 | cpp |
p03189 | #include <bits/stdc++.h>
#define pb push_back
#define mk make_pair
#define ll long long
#define int long long
using namespace std;
const int maxn = 3010;
const int mod = 1e9 + 7;
int qsm(int i, int j) {
int ans = 1;
while (j) {
if (j & 1)
ans = ans * i % mod;
j >>= 1;
i = i * i % mod;
}
return ans;
}
int dp[maxn][maxn];
int n, m;
int q;
int a[maxn];
signed main() {
scanf("%lld%lld", &n, &m);
for (int i = 1; i <= n; i++)
scanf("%lld", &a[i]); // a[i]=read();
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
dp[i][j] = (a[i] > a[j]);
int inv = qsm(2, mod - 2);
for (int i = 1; i <= m; i++) {
int x, y;
scanf("%lld%lld", &x, &y);
dp[x][y] = dp[y][x] = (dp[x][y] + dp[y][x]) * inv % mod;
for (int i = 1; i <= n; i++) {
if (i != x && i != y) {
dp[x][i] = dp[y][i] = (dp[x][i] + dp[y][i]) * inv % mod;
dp[i][x] = dp[i][y] = (dp[i][x] + dp[i][y]) * inv % mod;
}
}
}
int ans = 0;
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
ans = (ans + dp[i][j]) % mod;
cout << ans * qsm(2, m) % mod * inv % mod;
return 0;
}
| #include <bits/stdc++.h>
#define pb push_back
#define mk make_pair
#define ll long long
#define int long long
using namespace std;
const int maxn = 3010;
const int mod = 1e9 + 7;
int qsm(int i, int j) {
int ans = 1;
while (j) {
if (j & 1)
ans = ans * i % mod;
j >>= 1;
i = i * i % mod;
}
return ans;
}
int dp[maxn][maxn];
int n, m;
int q;
int a[maxn];
signed main() {
scanf("%lld%lld", &n, &m);
for (int i = 1; i <= n; i++)
scanf("%lld", &a[i]); // a[i]=read();
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
dp[i][j] = (a[i] > a[j]);
int inv = qsm(2, mod - 2);
for (int i = 1; i <= m; i++) {
int x, y;
scanf("%lld%lld", &x, &y);
dp[x][y] = dp[y][x] = (dp[x][y] + dp[y][x]) * inv % mod;
for (int i = 1; i <= n; i++) {
if (i != x && i != y) {
dp[x][i] = dp[y][i] = (dp[x][i] + dp[y][i]) * inv % mod;
dp[i][x] = dp[i][y] = (dp[i][x] + dp[i][y]) * inv % mod;
}
}
}
int ans = 0;
for (int i = 1; i <= n; i++)
for (int j = i + 1; j <= n; j++)
ans = (ans + dp[i][j]) % mod;
cout << ans * qsm(2, m) % mod;
return 0;
}
| [
"control_flow.loop.for.initializer.change",
"expression.operation.binary.remove"
] | 989,908 | 989,911 | u749011596 | cpp |
p03189 | #include <bits/stdc++.h>
#define pb push_back
#define mk make_pair
#define ll long long
#define int long long
using namespace std;
const int maxn = 3010;
const int mod = 1e9 + 7;
int qsm(int i, int j) {
int ans = 1;
while (j) {
if (j & 1)
ans = ans * i % mod;
j >>= 1;
i = i * i % mod;
}
return ans;
}
int dp[maxn][maxn];
int n, m;
int q;
int a[maxn];
signed main() {
scanf("%lld%lld", &n, &m);
for (int i = 1; i <= n; i++)
scanf("%lld", &a[i]); // a[i]=read();
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
dp[i][j] = (a[i] > a[j]);
int inv = qsm(2, mod - 2);
for (int i = 1; i <= m; i++) {
int x, y;
scanf("%lld%lld", &x, &y);
dp[x][y] = dp[y][x] = (dp[x][y] + dp[y][x]) * inv % mod;
for (int i = 1; i <= n; i++) {
if (i != x && i != y) {
dp[x][i] = dp[y][i] = (dp[x][i] + dp[y][i]) * inv % mod;
dp[i][x] = dp[i][y] = (dp[i][x] + dp[i][y]) * inv % mod;
}
}
}
int ans = 0;
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
ans = (ans + dp[i][j]) % mod;
cout << ans * qsm(2, m) % mod * inv;
return 0;
}
| #include <bits/stdc++.h>
#define pb push_back
#define mk make_pair
#define ll long long
#define int long long
using namespace std;
const int maxn = 3010;
const int mod = 1e9 + 7;
int qsm(int i, int j) {
int ans = 1;
while (j) {
if (j & 1)
ans = ans * i % mod;
j >>= 1;
i = i * i % mod;
}
return ans;
}
int dp[maxn][maxn];
int n, m;
int q;
int a[maxn];
signed main() {
scanf("%lld%lld", &n, &m);
for (int i = 1; i <= n; i++)
scanf("%lld", &a[i]); // a[i]=read();
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
dp[i][j] = (a[i] > a[j]);
int inv = qsm(2, mod - 2);
for (int i = 1; i <= m; i++) {
int x, y;
scanf("%lld%lld", &x, &y);
dp[x][y] = dp[y][x] = (dp[x][y] + dp[y][x]) * inv % mod;
for (int i = 1; i <= n; i++) {
if (i != x && i != y) {
dp[x][i] = dp[y][i] = (dp[x][i] + dp[y][i]) * inv % mod;
dp[i][x] = dp[i][y] = (dp[i][x] + dp[i][y]) * inv % mod;
}
}
}
int ans = 0;
for (int i = 1; i <= n; i++)
for (int j = i + 1; j <= n; j++)
ans = (ans + dp[i][j]) % mod;
cout << ans * qsm(2, m) % mod;
return 0;
}
| [
"control_flow.loop.for.initializer.change",
"expression.operation.binary.remove"
] | 989,910 | 989,911 | u749011596 | cpp |
p03190 | #include <bits/stdc++.h>
#define ll long long
#define ld long double
#define db double
#define pint pair<int, int>
#define mk(x, y) make_pair(x, y)
#define fir first
#define sec second
#define Rep(x, y, z) for (int x = y; x <= z; x++)
#define Red(x, y, z) for (int x = y; x >= z; x--)
using namespace std;
const int MAXN = 5005;
char buf[1 << 12], *pp1 = buf, *pp2 = buf, nc;
int ny;
// inline char gc() {return
// pp1==pp2&&(pp2=(pp1=buf)+fread(buf,1,1<<12,stdin),pp1==pp2)?EOF:*pp1++;}
inline char gc() { return getchar(); }
inline int read() {
int x = 0;
for (ny = 1; nc = gc(), (nc < 48 || nc > 57) && nc != EOF;)
if (nc == 45)
ny = -1;
if (nc < 0)
return nc;
for (x = nc - 48; nc = gc(), 47 < nc && nc < 58 && nc != EOF;
x = (x << 3) + (x << 1) + (nc ^ 48))
;
return x * ny;
}
int ans = 1e9, n, a[MAXN], b[MAXN], cnt1, cnt2;
char s1[MAXN], s2[MAXN];
int main() {
// freopen("std.in","r",stdin);
// freopen("std.out","w",stdout);
n = read(), scanf("%s%s", s1 + 1, s2 + 1);
Rep(i, 1, n - 1) if (s1[i] != s2[i + 1]) a[++cnt1] = i;
Rep(i, 1, n - 1) if (s2[i] != s2[i + 1]) b[++cnt2] = i;
Rep(i, -cnt1 - 1, cnt2 + 1) if ((i & 1) ^ (s1[1] == s2[1])) {
int tmp = 0;
Rep(j, min(1, 1 - i), max(cnt1, cnt2 - i)) tmp +=
abs((j < 0 ? 0
: j > cnt1 ? n
: a[j]) -
(i + j < 0 ? 0
: i + j > cnt2 ? n
: b[i + j]));
ans = min(ans, tmp);
}
cout << ans << '\n';
return 0;
}
| #include <bits/stdc++.h>
#define ll long long
#define ld long double
#define db double
#define pint pair<int, int>
#define mk(x, y) make_pair(x, y)
#define fir first
#define sec second
#define Rep(x, y, z) for (int x = y; x <= z; x++)
#define Red(x, y, z) for (int x = y; x >= z; x--)
using namespace std;
const int MAXN = 5005;
char buf[1 << 12], *pp1 = buf, *pp2 = buf, nc;
int ny;
// inline char gc() {return
// pp1==pp2&&(pp2=(pp1=buf)+fread(buf,1,1<<12,stdin),pp1==pp2)?EOF:*pp1++;}
inline char gc() { return getchar(); }
inline int read() {
int x = 0;
for (ny = 1; nc = gc(), (nc < 48 || nc > 57) && nc != EOF;)
if (nc == 45)
ny = -1;
if (nc < 0)
return nc;
for (x = nc - 48; nc = gc(), 47 < nc && nc < 58 && nc != EOF;
x = (x << 3) + (x << 1) + (nc ^ 48))
;
return x * ny;
}
int ans = 1e9, n, a[MAXN], b[MAXN], cnt1, cnt2;
char s1[MAXN], s2[MAXN];
int main() {
// freopen("std.in","r",stdin);
// freopen("std.out","w",stdout);
n = read(), scanf("%s%s", s1 + 1, s2 + 1);
Rep(i, 1, n - 1) if (s1[i] != s1[i + 1]) a[++cnt1] = i;
Rep(i, 1, n - 1) if (s2[i] != s2[i + 1]) b[++cnt2] = i;
Rep(i, -cnt1 - 1, cnt2 + 1) if ((i & 1) ^ (s1[1] == s2[1])) {
int tmp = 0;
Rep(j, min(1, 1 - i), max(cnt1, cnt2 - i)) tmp +=
abs((j < 0 ? 0
: j > cnt1 ? n
: a[j]) -
(i + j < 0 ? 0
: i + j > cnt2 ? n
: b[i + j]));
ans = min(ans, tmp);
}
cout << ans << '\n';
return 0;
}
| [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 989,944 | 989,945 | u710376653 | cpp |
p03190 | #include <bits/stdc++.h>
#define ll long long
#define ld long double
#define db double
#define pint pair<int, int>
#define mk(x, y) make_pair(x, y)
#define fir first
#define sec second
#define Rep(x, y, z) for (int x = y; x <= z; x++)
#define Red(x, y, z) for (int x = y; x >= z; x--)
using namespace std;
const int MAXN = 5005;
char buf[1 << 12], *pp1 = buf, *pp2 = buf, nc;
int ny;
// inline char gc() {return
// pp1==pp2&&(pp2=(pp1=buf)+fread(buf,1,1<<12,stdin),pp1==pp2)?EOF:*pp1++;}
inline char gc() { return getchar(); }
inline int read() {
int x = 0;
for (ny = 1; nc = gc(), (nc < 48 || nc > 57) && nc != EOF;)
if (nc == 45)
ny = -1;
if (nc < 0)
return nc;
for (x = nc - 48; nc = gc(), 47 < nc && nc < 58 && nc != EOF;
x = (x << 3) + (x << 1) + (nc ^ 48))
;
return x * ny;
}
int ans = 1e9, n, a[MAXN], b[MAXN], cnt1, cnt2;
char s1[MAXN], s2[MAXN];
int main() {
// freopen("std.in","r",stdin);
// freopen("std.out","w",stdout);
n = read(), scanf("%s%s", s1 + 1, s2 + 1);
Rep(i, 1, n - 1) if (s1[i] != s2[i + 1]) a[++cnt1] = i;
Rep(i, 1, n - 1) if (s2[i] != s2[i + 1]) b[++cnt2] = i;
Rep(i, -cnt1 - 1, cnt2 + 1) if ((i & 1) ^ (s1[1] == s2[1])) {
int tmp = 0;
Rep(j, min(1, 1 - i), max(cnt1, cnt2 - i)) tmp +=
abs((j < 0 ? 0
: j > cnt1 ? n
: a[i]) -
(i + j < 0 ? 0
: i + j > cnt2 ? n
: b[i + j]));
ans = min(ans, tmp);
}
cout << ans << '\n';
return 0;
}
| #include <bits/stdc++.h>
#define ll long long
#define ld long double
#define db double
#define pint pair<int, int>
#define mk(x, y) make_pair(x, y)
#define fir first
#define sec second
#define Rep(x, y, z) for (int x = y; x <= z; x++)
#define Red(x, y, z) for (int x = y; x >= z; x--)
using namespace std;
const int MAXN = 5005;
char buf[1 << 12], *pp1 = buf, *pp2 = buf, nc;
int ny;
// inline char gc() {return
// pp1==pp2&&(pp2=(pp1=buf)+fread(buf,1,1<<12,stdin),pp1==pp2)?EOF:*pp1++;}
inline char gc() { return getchar(); }
inline int read() {
int x = 0;
for (ny = 1; nc = gc(), (nc < 48 || nc > 57) && nc != EOF;)
if (nc == 45)
ny = -1;
if (nc < 0)
return nc;
for (x = nc - 48; nc = gc(), 47 < nc && nc < 58 && nc != EOF;
x = (x << 3) + (x << 1) + (nc ^ 48))
;
return x * ny;
}
int ans = 1e9, n, a[MAXN], b[MAXN], cnt1, cnt2;
char s1[MAXN], s2[MAXN];
int main() {
// freopen("std.in","r",stdin);
// freopen("std.out","w",stdout);
n = read(), scanf("%s%s", s1 + 1, s2 + 1);
Rep(i, 1, n - 1) if (s1[i] != s1[i + 1]) a[++cnt1] = i;
Rep(i, 1, n - 1) if (s2[i] != s2[i + 1]) b[++cnt2] = i;
Rep(i, -cnt1 - 1, cnt2 + 1) if ((i & 1) ^ (s1[1] == s2[1])) {
int tmp = 0;
Rep(j, min(1, 1 - i), max(cnt1, cnt2 - i)) tmp +=
abs((j < 0 ? 0
: j > cnt1 ? n
: a[j]) -
(i + j < 0 ? 0
: i + j > cnt2 ? n
: b[i + j]));
ans = min(ans, tmp);
}
cout << ans << '\n';
return 0;
}
| [
"identifier.change",
"control_flow.branch.if.condition.change",
"assignment.value.change",
"variable_access.subscript.index.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 989,946 | 989,945 | u710376653 | cpp |
p03190 | #include <bits/stdc++.h>
using namespace std;
constexpr int INF = 1E9;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
string s, t;
cin >> n >> s >> t;
vector<int> x{0}, y{0};
for (int i = 1; i < n; ++i)
if (s[i] != s[i - 1])
x.push_back(i);
for (int i = 1; i < n; ++i)
if (t[i] != t[i - 1])
y.push_back(i);
x.push_back(n);
y.push_back(n);
int ans = INF;
for (int i = -(int)x.size() + 1; i < (int)y.size(); ++i) {
if (i % 2 == (s[0] == t[0]))
continue;
int cnt = 0;
for (int j = max(0, -i); j < min((int)y.size() - i, (int)x.size()); ++j)
cnt += abs(x[j] - y[i + j]);
for (int j = 0; j < -i; ++j)
cnt += x[j];
for (int j = (int)y.size() - i; j < (int)x.size(); ++j)
cnt += n - x[j];
for (int j = 0; j < i; ++j)
cnt += y[j];
for (int j = (int)x.size() + i; j < (int)y.size(); ++j)
cnt += n - y[j];
ans = min(ans, cnt);
}
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
constexpr int INF = 1E9;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
string s, t;
cin >> n >> s >> t;
vector<int> x{0}, y{0};
for (int i = 1; i < n; ++i)
if (s[i] != s[i - 1])
x.push_back(i);
for (int i = 1; i < n; ++i)
if (t[i] != t[i - 1])
y.push_back(i);
x.push_back(n);
y.push_back(n);
int ans = INF;
for (int i = -(int)x.size() + 1; i < (int)y.size(); ++i) {
if ((i & 1) == (s[0] == t[0]))
continue;
int cnt = 0;
for (int j = max(0, -i); j < min((int)y.size() - i, (int)x.size()); ++j)
cnt += abs(x[j] - y[i + j]);
for (int j = 0; j < -i; ++j)
cnt += x[j];
for (int j = (int)y.size() - i; j < (int)x.size(); ++j)
cnt += n - x[j];
for (int j = 0; j < i; ++j)
cnt += y[j];
for (int j = (int)x.size() + i; j < (int)y.size(); ++j)
cnt += n - y[j];
ans = min(ans, cnt);
}
cout << ans << endl;
return 0;
} | [
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change"
] | 989,964 | 989,965 | u803731421 | cpp |
p03190 | #include <bits/stdc++.h>
using namespace std;
const int Maxn = 5005;
int n;
char s[Maxn], t[Maxn];
int pool1[2 * Maxn], pool2[2 * Maxn], *a = pool1 + Maxn, *b = pool2 + Maxn;
int main() {
cin >> n >> (s + 1) >> (t + 1);
int cnta = 0, cntb = 0, ans = INT_MAX;
if (s[1] != t[1])
a[++cnta] = 0;
for (int i = 1; i < n; i++)
if (s[i] != s[i + 1])
a[++cnta] = i;
for (int i = 1; i < n; i++)
if (t[i] != t[i + 1])
b[++cntb] = i;
for (int i = cnta + 1; i <= n; i++)
a[i] = n;
for (int i = cntb + 1; i <= n; i++)
b[i] = n;
for (int i = -cnta; i <= cntb; i++) {
if (i & 1)
continue;
int sum = 0;
for (int delta = -n; delta <= n; delta++) {
int pos = i + delta;
if (pos > n)
sum += b[delta];
else if (pos < -n)
sum += n - b[delta];
else
sum += abs(a[pos] - b[delta]);
}
ans = min(ans, sum);
}
cout << ans << "\n";
return 0;
} | #include <bits/stdc++.h>
using namespace std;
const int Maxn = 5005;
int n;
char s[Maxn], t[Maxn];
int pool1[2 * Maxn], pool2[2 * Maxn], *a = pool1 + Maxn, *b = pool2 + Maxn;
int main() {
cin >> n >> (s + 1) >> (t + 1);
int cnta = 0, cntb = 0, ans = INT_MAX;
if (s[1] != t[1])
a[++cnta] = 0;
for (int i = 1; i < n; i++)
if (s[i] != s[i + 1])
a[++cnta] = i;
for (int i = 1; i < n; i++)
if (t[i] != t[i + 1])
b[++cntb] = i;
for (int i = cnta + 1; i <= n; i++)
a[i] = n;
for (int i = cntb + 1; i <= n; i++)
b[i] = n;
for (int i = -n; i <= n; i++) {
if (i & 1)
continue;
int sum = 0;
for (int delta = -n; delta <= n; delta++) {
int pos = i + delta;
if (pos > n)
sum += n - b[delta];
else if (pos < -n)
sum += b[delta];
else
sum += abs(a[pos] - b[delta]);
}
ans = min(ans, sum);
}
cout << ans << "\n";
return 0;
} | [
"identifier.change",
"control_flow.loop.for.initializer.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change",
"assignment.change",
"expression.operation.binary.remove"
] | 989,969 | 989,970 | u004427876 | cpp |
p03190 | #include <bits/stdc++.h>
using namespace std;
const int Maxn = 5005;
int n;
char s[Maxn], t[Maxn];
int pool1[2 * Maxn], pool2[2 * Maxn], *a = pool1 + Maxn, *b = pool2 + Maxn;
int main() {
cin >> n >> (s + 1) >> (t + 1);
int cnta = 0, cntb = 0, ans = INT_MAX;
if (s[1] != t[1])
a[++cnta] = 0;
for (int i = 1; i < n; i++)
if (s[i] != s[i + 1])
a[++cnta] = i;
for (int i = 1; i < n; i++)
if (t[i] != t[i + 1])
b[++cntb] = i;
for (int i = cnta + 1; i <= n; i++)
a[i] = n;
for (int i = cntb + 1; i <= n; i++)
b[i] = n;
for (int i = -n; i <= n; i++) {
if (i & 1)
continue;
int sum = 0;
for (int delta = -n; delta <= n; delta++) {
int pos = i + delta;
if (pos > n)
sum += b[delta];
else if (pos < -n)
sum += n - b[delta];
else
sum += abs(a[pos] - b[delta]);
}
ans = min(ans, sum);
}
cout << ans << "\n";
return 0;
} | #include <bits/stdc++.h>
using namespace std;
const int Maxn = 5005;
int n;
char s[Maxn], t[Maxn];
int pool1[2 * Maxn], pool2[2 * Maxn], *a = pool1 + Maxn, *b = pool2 + Maxn;
int main() {
cin >> n >> (s + 1) >> (t + 1);
int cnta = 0, cntb = 0, ans = INT_MAX;
if (s[1] != t[1])
a[++cnta] = 0;
for (int i = 1; i < n; i++)
if (s[i] != s[i + 1])
a[++cnta] = i;
for (int i = 1; i < n; i++)
if (t[i] != t[i + 1])
b[++cntb] = i;
for (int i = cnta + 1; i <= n; i++)
a[i] = n;
for (int i = cntb + 1; i <= n; i++)
b[i] = n;
for (int i = -n; i <= n; i++) {
if (i & 1)
continue;
int sum = 0;
for (int delta = -n; delta <= n; delta++) {
int pos = i + delta;
if (pos > n)
sum += n - b[delta];
else if (pos < -n)
sum += b[delta];
else
sum += abs(a[pos] - b[delta]);
}
ans = min(ans, sum);
}
cout << ans << "\n";
return 0;
} | [
"assignment.change",
"expression.operation.binary.remove"
] | 989,971 | 989,970 | u004427876 | cpp |
p03190 | #include <bits/stdc++.h>
using namespace std;
const int Maxn = 5005;
int n;
char s[Maxn], t[Maxn];
int pool1[2 * Maxn], pool2[2 * Maxn], *a = pool1 + Maxn, *b = pool2 + Maxn;
int main() {
cin >> n >> (s + 1) >> (t + 1);
int cnta = 0, cntb = 0, ans = INT_MAX;
if (s[1] != t[1])
a[++cnta] = 0;
for (int i = 1; i < n; i++)
if (s[i] != s[i + 1])
a[++cnta] = i;
for (int i = 1; i < n; i++)
if (t[i] != t[i + 1])
b[++cntb] = i;
for (int i = cnta + 1; i <= n; i++)
a[i] = n;
for (int i = cntb + 1; i <= n; i++)
b[i] = n;
for (int i = -cnta; i <= cntb; i++) {
if (i & 1)
continue;
int sum = 0;
for (int delta = -n; delta <= n; delta++) {
int pos = i + delta;
if (pos > n)
sum += b[delta];
else if (pos < -n)
sum += n - b[delta];
else
sum += abs(a[pos] - b[delta]);
}
ans = min(ans, sum);
}
cout << ans << "\n";
return 0;
} | #include <bits/stdc++.h>
using namespace std;
const int Maxn = 5005;
int n;
char s[Maxn], t[Maxn];
int pool1[2 * Maxn], pool2[2 * Maxn], *a = pool1 + Maxn, *b = pool2 + Maxn;
int main() {
cin >> n >> (s + 1) >> (t + 1);
int cnta = 0, cntb = 0, ans = INT_MAX;
if (s[1] != t[1])
a[++cnta] = 0;
for (int i = 1; i < n; i++)
if (s[i] != s[i + 1])
a[++cnta] = i;
for (int i = 1; i < n; i++)
if (t[i] != t[i + 1])
b[++cntb] = i;
for (int i = cnta + 1; i <= n; i++)
a[i] = n;
for (int i = cntb + 1; i <= n; i++)
b[i] = n;
for (int i = -cnta; i <= cntb; i++) {
if (i & 1)
continue;
int sum = 0;
for (int delta = -n; delta <= n; delta++) {
int pos = i + delta;
if (pos > n)
sum += n - b[delta];
else if (pos < -n)
sum += b[delta];
else
sum += abs(a[pos] - b[delta]);
}
ans = min(ans, sum);
}
cout << ans << "\n";
return 0;
} | [
"assignment.change",
"expression.operation.binary.remove"
] | 989,969 | 989,972 | u004427876 | cpp |
p03190 | #include <bits/stdc++.h>
using namespace std;
const int Maxn = 5005;
int n;
char s[Maxn], t[Maxn];
int pool1[2 * Maxn], pool2[2 * Maxn], *a = pool1 + Maxn, *b = pool2 + Maxn;
int main() {
cin >> n >> (s + 1) >> (t + 1);
int cnta = 0, cntb = 0, ans = INT_MAX;
if (s[1] != t[1])
a[++cnta] = 0;
for (int i = 1; i < n; i++)
if (s[i] != s[i + 1])
a[++cnta] = i;
for (int i = 1; i < n; i++)
if (t[i] != t[i + 1])
b[++cntb] = i;
for (int i = cnta + 1; i <= n; i++)
a[i] = n;
for (int i = cntb + 1; i <= n; i++)
b[i] = n;
for (int i = -n; i <= n; i++) {
if (i & 1)
continue;
int sum = 0;
for (int delta = -n; delta <= n; delta++) {
int pos = i + delta;
if (pos > n)
sum += b[delta];
else if (pos < -n)
sum += n - b[delta];
else
sum += abs(a[pos] - b[delta]);
}
ans = min(ans, sum);
}
cout << ans << "\n";
return 0;
} | #include <bits/stdc++.h>
using namespace std;
const int Maxn = 5005;
int n;
char s[Maxn], t[Maxn];
int pool1[2 * Maxn], pool2[2 * Maxn], *a = pool1 + Maxn, *b = pool2 + Maxn;
int main() {
cin >> n >> (s + 1) >> (t + 1);
int cnta = 0, cntb = 0, ans = INT_MAX;
if (s[1] != t[1])
a[++cnta] = 0;
for (int i = 1; i < n; i++)
if (s[i] != s[i + 1])
a[++cnta] = i;
for (int i = 1; i < n; i++)
if (t[i] != t[i + 1])
b[++cntb] = i;
for (int i = cnta + 1; i <= n; i++)
a[i] = n;
for (int i = cntb + 1; i <= n; i++)
b[i] = n;
for (int i = -cnta; i <= cntb; i++) {
if (i & 1)
continue;
int sum = 0;
for (int delta = -n; delta <= n; delta++) {
int pos = i + delta;
if (pos > n)
sum += n - b[delta];
else if (pos < -n)
sum += b[delta];
else
sum += abs(a[pos] - b[delta]);
}
ans = min(ans, sum);
}
cout << ans << "\n";
return 0;
} | [
"identifier.change",
"control_flow.loop.for.initializer.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change",
"assignment.change",
"expression.operation.binary.remove"
] | 989,971 | 989,972 | u004427876 | cpp |
p03190 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <map>
#include <queue>
#include <set>
#include <vector>
#define MAXN 5005
#define P 998244353
#define INF 0x3f3f3f3f
#define rint register int
#define LL long long
#define LD long double
using namespace std;
int n, ans = INF, t1, t2, p[MAXN], q[MAXN];
char s[MAXN], t[MAXN];
int solve(int x) {
int sum = 0;
for (rint i = 1; i < x - 1; ++i)
sum += p[i];
for (rint i = 1; i <= t2; ++i, ++x) {
if (x <= 0)
sum += q[i];
else if (x <= t1)
sum += abs(p[x] - q[i]);
else
sum += n - q[i];
}
for (rint i = max(x, 1); i <= t1; ++i)
sum += n - p[i];
return sum;
}
int main() {
scanf("%d%s%s", &n, s + 1, t + 1);
for (rint i = 1; i < n; ++i)
if (s[i] != s[i + 1])
p[++t1] = i;
for (rint i = 1; i < n; ++i)
if (t[i] != t[i + 1])
q[++t2] = i;
if (!t1 && !t2 && s[1] != t[1]) {
printf("%d\n", n);
return 0;
}
int tag = (s[1] == t[1]);
for (rint i = -t2 - 1; i <= t1 + 1; ++i)
if ((i + INF - tag) & 1)
ans = min(ans, solve(i));
printf("%d\n", ans);
return 0;
} | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <map>
#include <queue>
#include <set>
#include <vector>
#define MAXN 5005
#define P 998244353
#define INF 0x3f3f3f3f
#define rint register int
#define LL long long
#define LD long double
using namespace std;
int n, ans = INF, t1, t2, p[MAXN], q[MAXN];
char s[MAXN], t[MAXN];
int solve(int x) {
int sum = 0;
for (rint i = 1; i < x; ++i)
sum += p[i];
for (rint i = 1; i <= t2; ++i, ++x) {
if (x <= 0)
sum += q[i];
else if (x <= t1)
sum += abs(p[x] - q[i]);
else
sum += n - q[i];
}
for (rint i = max(x, 1); i <= t1; ++i)
sum += n - p[i];
return sum;
}
int main() {
scanf("%d%s%s", &n, s + 1, t + 1);
for (rint i = 1; i < n; ++i)
if (s[i] != s[i + 1])
p[++t1] = i;
for (rint i = 1; i < n; ++i)
if (t[i] != t[i + 1])
q[++t2] = i;
if (!t1 && !t2 && s[1] != t[1]) {
printf("%d\n", n);
return 0;
}
int tag = (s[1] == t[1]);
for (rint i = -t2 - 1; i <= t1 + 1; ++i)
if ((i + INF - tag) & 1)
ans = min(ans, solve(i));
printf("%d\n", ans);
return 0;
} | [
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove"
] | 989,995 | 989,996 | u229056063 | cpp |
p03190 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <map>
#include <queue>
#include <set>
#include <vector>
#define MAXN 5005
#define P 998244353
#define INF 0x3f3f3f3f
#define rint register int
#define LL long long
#define LD long double
using namespace std;
int n, ans = INF, t1, t2, p[MAXN], q[MAXN];
char s[MAXN], t[MAXN];
int solve(int x) {
int sum = 0;
for (rint i = 1; i < x - 1; ++i)
sum += p[i];
for (rint i = 1; i <= t2; ++i, ++x) {
if (x <= 0)
sum += q[i];
else if (x <= t1)
sum += abs(p[x] - q[i]);
else
sum += n - q[i];
}
for (rint i = max(x, 1); i <= t1; ++i)
sum += n - p[i];
return sum;
}
int main() {
scanf("%d%s%s", &n, s + 1, t + 1);
for (rint i = 1; i < n; ++i)
if (s[i] != s[i + 1])
p[++t1] = i;
for (rint i = 1; i < n; ++i)
if (t[i] != t[i + 1])
q[++t2] = i;
if (!t1 && !t2 && s[1] != t[1]) {
printf("%d\n", n);
return 0;
}
int tag = (s[1] == t[1]);
for (rint i = -t1 - 1; i <= t2 + 1; ++i)
if ((i + INF - tag) & 1)
ans = min(ans, solve(i));
printf("%d\n", ans);
return 0;
} | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <map>
#include <queue>
#include <set>
#include <vector>
#define MAXN 5005
#define P 998244353
#define INF 0x3f3f3f3f
#define rint register int
#define LL long long
#define LD long double
using namespace std;
int n, ans = INF, t1, t2, p[MAXN], q[MAXN];
char s[MAXN], t[MAXN];
int solve(int x) {
int sum = 0;
for (rint i = 1; i < x; ++i)
sum += p[i];
for (rint i = 1; i <= t2; ++i, ++x) {
if (x <= 0)
sum += q[i];
else if (x <= t1)
sum += abs(p[x] - q[i]);
else
sum += n - q[i];
}
for (rint i = max(x, 1); i <= t1; ++i)
sum += n - p[i];
return sum;
}
int main() {
scanf("%d%s%s", &n, s + 1, t + 1);
for (rint i = 1; i < n; ++i)
if (s[i] != s[i + 1])
p[++t1] = i;
for (rint i = 1; i < n; ++i)
if (t[i] != t[i + 1])
q[++t2] = i;
if (!t1 && !t2 && s[1] != t[1]) {
printf("%d\n", n);
return 0;
}
int tag = (s[1] == t[1]);
for (rint i = -t2 - 1; i <= t1 + 1; ++i)
if ((i + INF - tag) & 1)
ans = min(ans, solve(i));
printf("%d\n", ans);
return 0;
} | [
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove",
"identifier.change",
"control_flow.loop.for.initializer.change",
"expression.operation.binary.change"
] | 989,997 | 989,996 | u229056063 | cpp |
p03193 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
int n, h, w;
cin >> n >> h >> w;
int c = 0;
for (int i = 0; i < n; ++i) {
int a, b;
cin >> a >> b;
c += (a <= h && b <= w);
}
cout << c << '\n';
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
int n, h, w;
cin >> n >> h >> w;
int c = 0;
for (int i = 0; i < n; ++i) {
int a, b;
cin >> a >> b;
c += (a >= h && b >= w);
}
cout << c << '\n';
return 0;
}
| [
"misc.opposites",
"expression.operator.compare.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 990,018 | 990,019 | u651918401 | cpp |
p03194 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define mod (1e9 + 7)
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x) x.begin(), x.end()
typedef long long ll;
map<ll, ll> prime_facto(ll n) {
map<ll, ll> res;
for (ll i = 2; i * i <= n; i++) {
while (n % i == 0) {
n /= i;
res[i]++;
}
}
if (n != 1) {
res[n] = 1;
}
return res;
}
void solve1() {
ll n, p;
cin >> n >> p;
map<ll, ll> num;
num = prime_facto(p);
ll maxnum = 1;
for (auto itr = num.begin(); itr != num.end(); itr++) {
if (itr->second >= n) {
maxnum *= itr->first * (itr->second / n);
}
}
cout << maxnum << endl;
}
int main() { solve1(); }
| #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define mod (1e9 + 7)
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x) x.begin(), x.end()
typedef long long ll;
map<ll, ll> prime_facto(ll n) {
map<ll, ll> res;
for (ll i = 2; i * i <= n; i++) {
while (n % i == 0) {
n /= i;
res[i]++;
}
}
if (n != 1) {
res[n] = 1;
}
return res;
}
void solve1() {
ll n, p;
cin >> n >> p;
map<ll, ll> num;
num = prime_facto(p);
ll maxnum = 1;
for (auto itr = num.begin(); itr != num.end(); itr++) {
if (itr->second >= n) {
maxnum *= pow(itr->first, (itr->second / n));
}
}
cout << maxnum << endl;
}
int main() { solve1(); }
| [
"call.add",
"assignment.value.change",
"expression.operation.binary.change",
"call.arguments.change"
] | 990,022 | 990,023 | u825343780 | cpp |
p03194 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define repl(i, l, r) for (ll i = (l); i < (r); i++)
#define per(i, n) for (ll i = n - 1; i >= 0; i--)
#define perl(i, r, l) for (ll i = r - 1; i >= l; i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define all(x) (x).begin(), (x).end()
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
const ll MOD = 1000000007;
const ll MOD9 = 998244353;
const int inf = 1e9 + 10;
const ll INF = 4e18;
const ll dy[8] = {1, 0, -1, 0, 1, 1, -1, -1};
const ll dx[8] = {0, -1, 0, 1, 1, -1, 1, -1};
using Graph = vector<vector<int>>;
const ll mod = 1000000007;
const int MAX_N = 1000; // n の最大値
double nCk(int n, int k) {
double res = 1.0;
for (int i = 0; i < n; i++) {
res *= 0.5;
}
for (int i = 0; i < k; i++) {
res *= (double)(n - i);
res /= (double)(k - i);
}
return res;
}
int main() {
ll n, p;
cin >> n >> p;
map<ll, ll> a;
for (ll i = 2; i * i <= p; ++i) {
if (p % i != 0)
continue;
ll ex = 0;
while (p % i == 0) {
++ex;
p /= i;
}
a[i] = ex;
}
if (p != 1)
a[p] = 1;
ll ans = 1;
for (auto p : a) {
if (p.second >= n) {
ll ca = p.second / n;
ans *= ca * p.first;
}
}
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define repl(i, l, r) for (ll i = (l); i < (r); i++)
#define per(i, n) for (ll i = n - 1; i >= 0; i--)
#define perl(i, r, l) for (ll i = r - 1; i >= l; i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define all(x) (x).begin(), (x).end()
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
const ll MOD = 1000000007;
const ll MOD9 = 998244353;
const int inf = 1e9 + 10;
const ll INF = 4e18;
const ll dy[8] = {1, 0, -1, 0, 1, 1, -1, -1};
const ll dx[8] = {0, -1, 0, 1, 1, -1, 1, -1};
using Graph = vector<vector<int>>;
const ll mod = 1000000007;
const int MAX_N = 1000; // n の最大値
double nCk(int n, int k) {
double res = 1.0;
for (int i = 0; i < n; i++) {
res *= 0.5;
}
for (int i = 0; i < k; i++) {
res *= (double)(n - i);
res /= (double)(k - i);
}
return res;
}
int main() {
ll n, p;
cin >> n >> p;
map<ll, ll> a;
for (ll i = 2; i * i <= p; ++i) {
if (p % i != 0)
continue;
ll ex = 0;
while (p % i == 0) {
++ex;
p /= i;
}
a[i] = ex;
}
if (p != 1)
a[p] = 1;
ll ans = 1;
for (auto p : a) {
if (p.second >= n) {
ll ca = p.second / n;
ans *= pow(p.first, ca);
}
}
cout << ans << endl;
} | [
"call.arguments.add"
] | 990,032 | 990,033 | u722640678 | cpp |
p03194 | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
template <class T> inline vector<pair<T, T>> primeFactorize(T n) {
vector<pair<T, T>> res;
for (T a = 2; a * a <= n; a++) {
if (n % a != 0)
continue;
T ex = 0;
while (n % a == 0) {
++ex;
n /= a;
}
res.push_back({a, ex});
}
if (n != 1)
res.push_back({n, 1});
return res;
}
int main() {
cin.tie(0)->sync_with_stdio(false);
ll n, p;
cin >> n >> p;
int ans = 1;
if (n == 1)
ans = p;
else {
const auto res = primeFactorize(p);
for (auto x : res) {
if (x.second >= n)
ans *= x.first * (x.second / n);
}
}
cout << ans << '\n';
return 0;
} | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
template <class T> inline vector<pair<T, T>> primeFactorize(T n) {
vector<pair<T, T>> res;
for (T a = 2; a * a <= n; a++) {
if (n % a != 0)
continue;
T ex = 0;
while (n % a == 0) {
++ex;
n /= a;
}
res.push_back({a, ex});
}
if (n != 1)
res.push_back({n, 1});
return res;
}
int main() {
cin.tie(0)->sync_with_stdio(false);
ll n, p;
cin >> n >> p;
ll ans = 1;
if (n == 1)
ans = p;
else {
auto res = primeFactorize(p);
for (auto x : res) {
if (x.second >= n)
ans *= pow(x.first, (x.second / n));
}
}
cout << ans << '\n';
return 0;
} | [
"variable_declaration.type.change",
"call.add",
"assignment.value.change",
"expression.operation.binary.change",
"call.arguments.change"
] | 990,038 | 990,037 | u596385287 | cpp |
p03194 | #include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using ll = long long;
using namespace std;
constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;
int main(void) {
ll n, p;
cin >> n >> p;
map<ll, ll> prf;
for (ll i = 2; i * i <= p; ++i) {
while (p % i == 0) {
prf[i]++;
p /= i;
}
}
if (p != 1)
prf[n] = 1;
ll ans = 1LL;
for (auto x : prf) {
if (x.second >= n) {
ans *= (ll)pow(x.first, x.second / n);
}
}
cout << ans << endl;
return 0;
}
| #include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using ll = long long;
using namespace std;
constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;
int main(void) {
ll n, p;
cin >> n >> p;
map<ll, ll> prf;
for (ll i = 2; i * i <= p; ++i) {
while (p % i == 0) {
prf[i]++;
p /= i;
}
}
if (p != 1)
prf[p] = 1;
ll ans = 1LL;
for (auto x : prf) {
if (x.second >= n) {
ans *= (ll)pow(x.first, x.second / n);
}
}
cout << ans << endl;
return 0;
}
| [
"assignment.variable.change",
"identifier.change",
"variable_access.subscript.index.change"
] | 990,046 | 990,047 | u835805357 | cpp |
p03194 | #include <cstdio>
#include <iostream>
using namespace std;
typedef long long ll;
ll n, p, ans = 1;
int main() {
ll i, j, t;
cin >> n >> p;
if (n == 1) {
return printf("%d", p) * 0;
}
for (i = 2;; i++) {
t = 1;
for (j = 0; j < n; j++) {
t *= i;
if (t < 0 || t > p) {
cout << ans;
return 0;
}
}
if (p % t == 0)
ans = i;
}
return 0;
} | #include <cstdio>
#include <iostream>
using namespace std;
typedef long long ll;
ll n, p, ans = 1;
int main() {
ll i, j, t;
cin >> n >> p;
if (n == 1) {
return printf("%lld", p) * 0;
}
for (i = 2;; i++) {
t = 1;
for (j = 0; j < n; j++) {
t *= i;
if (t < 0 || t > p) {
cout << ans;
return 0;
}
}
if (p % t == 0)
ans = i;
}
return 0;
} | [
"literal.string.change",
"call.arguments.change",
"function.return_value.change",
"expression.operation.binary.change",
"io.output.change"
] | 990,048 | 990,049 | u093170535 | cpp |
p03194 | #include <cmath>
#include <cstdio>
#include <iostream>
using namespace std;
typedef long long ll;
ll n, p, ans = 1;
int main() {
cin >> n >> p;
if (n == 1) {
return printf("%d", p) * 0;
}
for (ll i = 1; pow(i, n) <= p; i++) {
if (p % (ll)pow(i, n) == 0)
ans = i;
}
cout << ans;
return 0;
} | #include <cmath>
#include <cstdio>
#include <iostream>
using namespace std;
typedef long long ll;
ll n, p, ans = 1;
int main() {
cin >> n >> p;
if (n == 1) {
return printf("%lld", p) * 0;
}
for (ll i = 1; pow(i, n) <= p; i++) {
if (p % (ll)pow(i, n) == 0)
ans = i;
}
cout << ans;
return 0;
} | [
"literal.string.change",
"call.arguments.change",
"function.return_value.change",
"expression.operation.binary.change",
"io.output.change"
] | 990,050 | 990,051 | u093170535 | cpp |
p03194 | #include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <immintrin.h>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
int main(int argc, const char *argv[]) {
#ifdef __APPLE__
freopen("/Users/danya.smelskiy/Documents/Danya/Resources/input.txt", "r",
stdin);
// freopen("/Users/danya.smelskiy/Documents/Danya/Danya/output.out", "w",
// stdout);
#endif
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
long long n, m;
cin >> n >> m;
long long res = 1;
for (long long i = 2; i * i <= m; ++i)
if (m % i == 0) {
int c = 0;
while (m % i == 0) {
m /= i;
++c;
}
c /= n;
for (int j = 1; j <= c; ++j)
res *= i;
}
if (m == 1)
res *= m;
cout << res << '\n';
return 0;
}
| #include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <immintrin.h>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
int main(int argc, const char *argv[]) {
#ifdef __APPLE__
freopen("/Users/danya.smelskiy/Documents/Danya/Resources/input.txt", "r",
stdin);
// freopen("/Users/danya.smelskiy/Documents/Danya/Danya/output.out", "w",
// stdout);
#endif
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
long long n, m;
cin >> n >> m;
long long res = 1;
for (long long i = 2; i * i <= m; ++i)
if (m % i == 0) {
int c = 0;
while (m % i == 0) {
m /= i;
++c;
}
c /= n;
for (int j = 1; j <= c; ++j)
res *= i;
}
if (n == 1)
res *= m;
cout << res << '\n';
return 0;
}
| [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 990,059 | 990,060 | u301704561 | cpp |
p03192 | #include <iostream>
using namespace std;
int main() {
int a;
cin >> a;
int sum;
char hoge[5];
sprintf(hoge, "%d", a);
for (int b = 0; b < 4; b++) {
if (hoge[b] == 2) {
sum++;
}
}
cout << sum;
} | #include <iostream>
using namespace std;
int main() {
int a;
cin >> a;
int sum = 0;
char hoge[5];
sprintf(hoge, "%d", a);
for (int b = 0; b < 4; b++) {
if (hoge[b] == '2') {
sum++;
}
}
cout << sum;
} | [
"variable_declaration.value.change",
"control_flow.branch.if.condition.change"
] | 990,079 | 990,080 | u544397444 | cpp |
p03192 | #include <algorithm>
#include <cstdint>
#include <iostream>
#include <string>
int main() {
std::string n;
std::getline(std::cin, n);
std::cout << std::count(n.begin(), n.end() - 1, '2');
} | #include <algorithm>
#include <cstdint>
#include <iostream>
#include <string>
int main() {
std::string n;
std::getline(std::cin, n);
std::cout << std::count(n.begin(), n.end(), '2');
} | [
"expression.operation.binary.remove"
] | 990,097 | 990,098 | u969319352 | cpp |
p03192 | #include <bits/stdc++.h>
using namespace std;
int main() {
char a;
int i, t = 0;
for (i = 0; i < 4; i++) {
scanf("%c", &a);
if (a == '2') {
t++;
}
}
printf("%d", &t);
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
char a;
int i, t = 0;
for (i = 0; i < 4; i++) {
scanf("%c", &a);
if (a == '2') {
t++;
}
}
printf("%d", t);
return 0;
} | [
"call.arguments.change"
] | 990,102 | 990,103 | u858741867 | cpp |
p03192 | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
int main() {
int n;
cin >> n;
int cnt = 0;
for (int i = 0; i < 3; i++) {
if (n % 10 == 2)
cnt++;
n = n / 10;
}
cout << cnt << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
int main() {
int n;
cin >> n;
int cnt = 0;
for (int i = 0; i < 4; i++) {
// cout<<n<<endl;
if (n % 10 == 2)
cnt++;
n = n / 10;
}
cout << cnt << endl;
return 0;
} | [
"literal.number.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 990,114 | 990,115 | u056802256 | cpp |
p03192 | #include <iostream>
using namespace std;
int main(void) {
int n;
int count = 0;
cin >> n;
for (int i = 0; i < 4; i++) {
if (n % 10 == 2) {
count++;
n = n / 10;
}
}
cout << count;
}
| #include <iostream>
using namespace std;
int main(void) {
int n;
int count = 0;
cin >> n;
for (int i = 0; i < 4; i++) {
if (n % 10 == 2) {
count++;
}
n = n / 10;
}
cout << count;
}
| [] | 990,116 | 990,117 | u584355627 | cpp |
p03192 | #include <iostream>
using namespace std;
int main(void) {
int n;
int count = 0;
cin >> n;
for (int i = 0; i < 3; i++) {
if (n % 10 == 2) {
count++;
n = n / 10;
}
}
cout << count;
}
| #include <iostream>
using namespace std;
int main(void) {
int n;
int count = 0;
cin >> n;
for (int i = 0; i < 4; i++) {
if (n % 10 == 2) {
count++;
}
n = n / 10;
}
cout << count;
}
| [
"literal.number.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 990,118 | 990,117 | u584355627 | cpp |
p03194 |
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = n; i >= m; i--)
#define REPO(i, n) for (int i = 1; i <= n; i++)
#define ll long long
#define INF 999999999
#define MINF -999999999
#define ALL(n) n.begin(), n.end()
#define MP make_pair
#define F first
#define S second
int main() {
ll n, a, c, ma = 0;
cin >> n >> a;
if (n == 1)
ma = n;
else {
for (ll i = 1; i < INF; i++) {
c = i;
if (c != 1) {
for (ll j = 1; j < n; j++) {
c = c * i;
if (c > a) {
c = -1;
break;
}
}
}
if (c > a)
c = -1;
if (c == -1)
break;
else if (a % c == 0)
ma = i;
}
}
cout << ma << endl;
}
|
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = n; i >= m; i--)
#define REPO(i, n) for (int i = 1; i <= n; i++)
#define ll long long
#define INF 999999999
#define MINF -999999999
#define ALL(n) n.begin(), n.end()
#define MP make_pair
#define F first
#define S second
int main() {
ll n, a, c, ma = 0;
cin >> n >> a;
if (n == 1)
ma = a;
else {
for (ll i = 1; i < INF; i++) {
c = i;
if (c != 1) {
for (ll j = 1; j < n; j++) {
c = c * i;
if (c > a) {
c = -1;
break;
}
}
}
if (c > a)
c = -1;
if (c == -1)
break;
else if (a % c == 0)
ma = i;
}
}
cout << ma << endl;
}
| [
"assignment.value.change",
"identifier.change"
] | 990,136 | 990,137 | u196497077 | cpp |
p03194 | #include <bits/stdc++.h>
#include <cstdlib>
using namespace std;
#define ll long long
typedef vector<vector<ll>> matrix;
#define pb push_back
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
const double PI = 3.141592653589793238463;
long long MOD = 1000000007;
int stringToInteger(string x) {
int gg = 0;
stringstream geek(x);
geek >> gg;
return gg;
}
ll powmod(ll a, ll b, ll m) {
ll ans = 1;
while (b > 0) {
if (b % 2) {
ans *= a;
ans %= m;
}
b /= 2;
a = a * a;
a = a % m;
}
return ans % m;
}
ll gcd(ll a, ll b) { return __gcd(a, b); }
ll mulmod(ll a, ll b, ll m) {
ll ans = 0;
a %= m;
while (b > 0) {
if (b & 1)
ans = (ans + a) % m;
a = (a * 2) % m;
b /= 2;
}
return ans % m;
}
ll f[2000001];
ll pow(ll a, ll b, ll MOD) {
ll x = 1, y = a;
while (b > 0) {
if (b % 2 == 1) {
x = (x * y);
if (x > MOD)
x %= MOD;
}
y = (y * y);
if (y > MOD)
y %= MOD;
b /= 2;
}
return x;
}
/* Modular Multiplicative Inverse
Using Euler's Theorem
a^(phi(m)) = 1 (mod m)
a^(-1) = a^(m-2) (mod m) */
ll InverseEuler(ll n, ll MOD) { return pow(n, MOD - 2, MOD); }
bool in(float x1, float y1, float x, float y, float r) {
if (abs(x1 - x) * abs(x1 - x) + abs(y1 - y) * abs(y1 - y) <= r * r)
return true;
return false;
}
bool cmp(pair<int, int> &a, pair<int, int> &b) { return (a.second < b.second); }
//
// vector<vector<int> >matrix;
matrix mul(matrix A, matrix B) {
matrix C(3, vector<ll>(3));
for (int i = 1; i <= 2; i++)
for (int j = 1; j <= 2; j++)
for (int k = 1; k <= 2; k++)
C[i][j] = (C[i][j] + A[i][k] * B[k][j]);
return C;
}
matrix pow(matrix A, int p) {
if (p == 1)
return A;
if (p % 2)
return mul(A, pow(A, p - 1));
matrix X = pow(A, p / 2);
return mul(X, X);
}
ll fib(int N) {
vector<ll> F1(3);
F1[1] = 1;
F1[2] = 1;
matrix T(3, vector<ll>(3));
T[1][1] = 0, T[1][2] = 1;
T[2][1] = 1, T[2][2] = 1;
if (N == 1)
return 1;
T = pow(T, N - 1);
ll res = 0;
for (int i = 1; i <= 2; i++)
res = (res + T[1][i] * F1[i]);
return res;
}
ll bit[10005] = {0};
ll sum(ll i) {
ll ans = 0;
while (i > 0) {
ans += bit[i];
i -= (i & (-i));
}
return ans;
}
ll update(ll n, ll i) {
while (i <= n) {
bit[i] += 1;
i += (i & (-i));
}
}
// int C[10005][1];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
ll p, n;
cin >> p >> n;
ll ans = 1;
map<ll, ll> mp;
while (n % 2 == 0) {
mp[2]++;
n = n / 2;
}
// n must be odd at this point. So we can skip
// one element (Note i = i +2)
for (int i = 3; i <= sqrt(n); i = i + 2) {
// While i divides n, print i and divide n
while (n % i == 0) {
mp[i]++;
n = n / i;
}
}
// This condition is to handle the case when n
// is a prime number greater than 2
if (n > 2)
mp[n]++;
for (map<ll, ll>::iterator it = mp.begin(); it != mp.end(); it++) {
if (((it->second) / p) > 0) { // cout<<it->first<<" "<<it->second;
ans = (ans * (it->first) * ((it->second) / p));
}
}
cout << ans;
}
// C[10005][10005];
| #include <bits/stdc++.h>
#include <cstdlib>
using namespace std;
#define ll long long
typedef vector<vector<ll>> matrix;
#define pb push_back
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
const double PI = 3.141592653589793238463;
long long MOD = 1000000007;
int stringToInteger(string x) {
int gg = 0;
stringstream geek(x);
geek >> gg;
return gg;
}
ll powmod(ll a, ll b, ll m) {
ll ans = 1;
while (b > 0) {
if (b % 2) {
ans *= a;
ans %= m;
}
b /= 2;
a = a * a;
a = a % m;
}
return ans % m;
}
ll gcd(ll a, ll b) { return __gcd(a, b); }
ll mulmod(ll a, ll b, ll m) {
ll ans = 0;
a %= m;
while (b > 0) {
if (b & 1)
ans = (ans + a) % m;
a = (a * 2) % m;
b /= 2;
}
return ans % m;
}
ll f[2000001];
ll pow(ll a, ll b, ll MOD) {
ll x = 1, y = a;
while (b > 0) {
if (b % 2 == 1) {
x = (x * y);
if (x > MOD)
x %= MOD;
}
y = (y * y);
if (y > MOD)
y %= MOD;
b /= 2;
}
return x;
}
/* Modular Multiplicative Inverse
Using Euler's Theorem
a^(phi(m)) = 1 (mod m)
a^(-1) = a^(m-2) (mod m) */
ll InverseEuler(ll n, ll MOD) { return pow(n, MOD - 2, MOD); }
bool in(float x1, float y1, float x, float y, float r) {
if (abs(x1 - x) * abs(x1 - x) + abs(y1 - y) * abs(y1 - y) <= r * r)
return true;
return false;
}
bool cmp(pair<int, int> &a, pair<int, int> &b) { return (a.second < b.second); }
//
// vector<vector<int> >matrix;
matrix mul(matrix A, matrix B) {
matrix C(3, vector<ll>(3));
for (int i = 1; i <= 2; i++)
for (int j = 1; j <= 2; j++)
for (int k = 1; k <= 2; k++)
C[i][j] = (C[i][j] + A[i][k] * B[k][j]);
return C;
}
matrix pow(matrix A, int p) {
if (p == 1)
return A;
if (p % 2)
return mul(A, pow(A, p - 1));
matrix X = pow(A, p / 2);
return mul(X, X);
}
ll fib(int N) {
vector<ll> F1(3);
F1[1] = 1;
F1[2] = 1;
matrix T(3, vector<ll>(3));
T[1][1] = 0, T[1][2] = 1;
T[2][1] = 1, T[2][2] = 1;
if (N == 1)
return 1;
T = pow(T, N - 1);
ll res = 0;
for (int i = 1; i <= 2; i++)
res = (res + T[1][i] * F1[i]);
return res;
}
ll bit[10005] = {0};
ll sum(ll i) {
ll ans = 0;
while (i > 0) {
ans += bit[i];
i -= (i & (-i));
}
return ans;
}
ll update(ll n, ll i) {
while (i <= n) {
bit[i] += 1;
i += (i & (-i));
}
}
// int C[10005][1];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
ll p, n;
cin >> p >> n;
ll ans = 1;
map<ll, ll> mp;
while (n % 2 == 0) {
mp[2]++;
n = n / 2;
}
// n must be odd at this point. So we can skip
// one element (Note i = i +2)
for (int i = 3; i <= sqrt(n); i = i + 2) {
// While i divides n, print i and divide n
while (n % i == 0) {
mp[i]++;
n = n / i;
}
}
// This condition is to handle the case when n
// is a prime number greater than 2
if (n > 2)
mp[n]++;
for (map<ll, ll>::iterator it = mp.begin(); it != mp.end(); it++) {
if (((it->second) / p) > 0) { // cout<<it->first<<" "<<it->second;
ans = (ans * pow((it->first), (it->second) / p, 100000000000000000));
}
}
cout << ans;
}
// C[10005][10005];
| [
"call.add",
"assignment.value.change",
"expression.operation.binary.change",
"call.arguments.add"
] | 990,149 | 990,150 | u069935888 | cpp |
p03194 | #include <cmath>
#include <iostream>
using namespace std;
int main() {
int n, i, k, cnt;
unsigned long long int p, ans;
cin >> n >> p;
if (n == 1) {
ans = p;
} else {
for (i = 2; i <= sqrt(p); i++) {
cnt = 0;
while (p % i == 0) {
p = p / i;
cnt++;
}
while (cnt >= n) {
ans = ans * i;
cnt = cnt - n;
}
}
}
cout << ans << endl;
return 0;
}
| #include <cmath>
#include <iostream>
using namespace std;
int main() {
int n, i, k, cnt;
unsigned long long int p, ans;
cin >> n >> p;
if (n == 1) {
ans = p;
} else {
ans = 1;
for (i = 2; i <= sqrt(p); i++) {
cnt = 0;
while (p % i == 0) {
p = p / i;
cnt++;
}
while (cnt >= n) {
ans = ans * i;
cnt = cnt - n;
}
}
}
cout << ans << endl;
return 0;
}
| [
"assignment.add"
] | 990,153 | 990,154 | u979960743 | cpp |
p03194 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll N, P;
cin >> N >> P;
ll i = 2;
ll p = P;
ll ans = 1;
while (i * i <= p) {
if (P == 1) {
break;
}
ll cnt = 0;
while (P % i == 0) {
P = P / i;
cnt++;
}
cnt = cnt / N;
for (int j = 0; j < cnt; j++) {
ans = ans * i;
}
i++;
}
if (N == 1) {
cout << P << endl;
} else {
cout << ans << endl;
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll N, P;
cin >> N >> P;
ll i = 2;
ll p = P;
ll ans = 1;
while (i * i <= p) {
if (P == 1) {
break;
}
ll cnt = 0;
while (P % i == 0) {
P = P / i;
cnt++;
}
cnt = cnt / N;
for (int j = 0; j < cnt; j++) {
ans = ans * i;
}
i++;
}
if (N == 1) {
cout << p << endl;
} else {
cout << ans << endl;
}
return 0;
}
| [
"identifier.change",
"io.output.change"
] | 990,157 | 990,158 | u077536797 | cpp |
p03194 | #include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdlib>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
const ll mod = 1000000007ll;
const ll inf = 1000000000000000ll;
const ll MAX_N = 1000;
ll N, pn;
map<ll, ll> mp;
void solve_mp(ll pn) {
for (ll i = 2; i <= ceil(sqrt(pn)); i++) {
while (pn % i == 0) {
mp[i]++;
pn /= i;
}
}
if (pn != 1)
mp[pn]++;
}
int main() {
cin >> N >> pn;
solve_mp(pn);
ll ans = 1;
for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
// cout<<itr->first<<", "<<itr->second<<", "<<(ll)(itr->second/N)<<endl;
if (floor(itr->second / N) >= 1)
ans *= itr->first * floor(itr->second / N);
}
cout << ans << endl;
return 0;
}
| #include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdlib>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
const ll mod = 1000000007ll;
const ll inf = 1000000000000000ll;
const ll MAX_N = 1000;
ll N, pn;
map<ll, ll> mp;
void solve_mp(ll pn) {
for (ll i = 2; i <= ceil(sqrt(pn)); i++) {
while (pn % i == 0) {
mp[i]++;
pn /= i;
}
}
if (pn != 1)
mp[pn]++;
}
int main() {
cin >> N >> pn;
solve_mp(pn);
ll ans = 1;
for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
// cout<<itr->first<<", "<<itr->second<<", "<<(ll)(itr->second/N)<<endl;
if (floor(itr->second / N) >= 1)
ans *= pow(itr->first, floor(itr->second / N));
}
cout << ans << endl;
return 0;
}
| [
"call.add",
"assignment.value.change",
"expression.operation.binary.change",
"call.arguments.change"
] | 990,161 | 990,162 | u200030766 | cpp |
p03194 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1e9;
const int MOD = 1e9 + 7;
// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};
map<ll, ll> mp;
int main() {
ll N, P;
cin >> N >> P;
// 割る数の初期値
ll a = 2;
// √n ≧ a ( n ≧ a * a ) の間ループ処理
while (P >= a * a) {
// a で割り切れたら、a は素因数
if (P % a == 0) {
mp[a]++;
P /= a;
} else {
a++;
}
}
// 最後に残った n は素因数
mp[P]++;
ll ans = 1;
for (map<ll, ll>::iterator it = mp.begin(); it != mp.end(); it++) {
// cout << it->first << ":" << it->second << endl;
if (it->second >= N)
ans *= (it->first * (it->second / N));
}
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1e9;
const int MOD = 1e9 + 7;
// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};
map<ll, ll> mp;
int main() {
ll N, P;
cin >> N >> P;
// 割る数の初期値
ll a = 2;
// √n ≧ a ( n ≧ a * a ) の間ループ処理
while (P >= a * a) {
// a で割り切れたら、a は素因数
if (P % a == 0) {
mp[a]++;
P /= a;
} else {
a++;
}
}
// 最後に残った n は素因数
mp[P]++;
ll ans = 1;
for (map<ll, ll>::iterator it = mp.begin(); it != mp.end(); it++) {
// cout << it->first << ":" << it->second << endl;
if (it->second >= N)
ans *= pow(it->first, it->second / N);
}
cout << ans << endl;
return 0;
}
| [
"call.add",
"assignment.value.change",
"expression.operation.binary.change"
] | 990,166 | 990,167 | u063020782 | cpp |
p03194 | #include <iostream>
#include <math.h>
#include <string>
using namespace std;
int main() {
long long n, p, ans = 1;
cin >> n >> p;
long long e = p;
for (int i = 2; i <= sqrt(e); i++) {
int x = 0;
while (p % i == 0) {
p = p / i;
x++;
}
ans = ans * pow(i, x / n);
}
if (n >= 2)
cout << ans;
else
cout << p;
} | #include <iostream>
#include <math.h>
#include <string>
using namespace std;
int main() {
long long n, p, ans = 1;
cin >> n >> p;
long long e = p;
for (int i = 2; i <= sqrt(e); i++) {
int x = 0;
while (p % i == 0) {
p = p / i;
x++;
}
ans = ans * pow(i, x / n);
}
if (n >= 2)
cout << ans;
else
cout << e;
} | [
"identifier.change",
"io.output.change"
] | 990,168 | 990,169 | u441296840 | cpp |
p03194 | #include <algorithm>
#include <array>
#include <cmath>
#include <cstring>
#include <iostream>
#include <list>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
const int MOD = 1000000007;
using namespace std;
typedef long long ll;
typedef tuple<ll, int, int> tup;
typedef vector<int> vi;
typedef vector<ll> vll;
const int INF = 1e9;
ll n, p;
vector<ll> divis;
string s;
int main(int argc, char const *argv[]) {
cin >> n >> p;
if (p == 1) {
cout << 1 << endl;
return 0;
}
if (n == 1) {
cout << p << endl;
return 0;
}
ll power = 1;
ll origin = 2;
ll preorigin;
while (1) {
power = 1;
if (p % origin == 0) {
for (int i = 0; i < n; i++) {
power *= origin;
if (power > p) {
cout << preorigin << endl;
return 0;
}
}
if (p % power == 0) {
preorigin = origin;
}
}
origin++;
}
return 0;
}
| #include <algorithm>
#include <array>
#include <cmath>
#include <cstring>
#include <iostream>
#include <list>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
const int MOD = 1000000007;
using namespace std;
typedef long long ll;
typedef tuple<ll, int, int> tup;
typedef vector<int> vi;
typedef vector<ll> vll;
const int INF = 1e9;
ll n, p;
vector<ll> divis;
string s;
int main(int argc, char const *argv[]) {
cin >> n >> p;
if (p == 1) {
cout << 1 << endl;
return 0;
}
if (n == 1) {
cout << p << endl;
return 0;
}
ll power = 1;
ll origin = 2;
ll preorigin = 1;
while (1) {
power = 1;
if (p % origin == 0) {
for (int i = 0; i < n; i++) {
power *= origin;
if (power > p) {
cout << preorigin << endl;
return 0;
}
}
if (p % power == 0) {
preorigin = origin;
}
}
origin++;
}
return 0;
}
| [
"variable_declaration.value.change"
] | 990,170 | 990,171 | u945017646 | cpp |
p03194 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int SZ = 100005;
int np[SZ];
vector<pair<ll, int>> v;
void myprime(ll n) {
for (ll i = 2; i < SZ; i++) {
if (np[i] == 1)
continue;
int aa = 0;
while (n % i == 0) {
n /= i;
aa++;
}
if (aa != 0)
v.push_back(make_pair(i, aa));
for (ll j = 2 * i; j * j < SZ; j += i) {
np[j] = 1;
}
}
if (n != 1)
v.push_back(make_pair(n, 1));
}
ll mypow(ll a, ll b) {
int aa = 1;
while (b) {
if (b % 2 == 1)
aa *= a;
a = a * a;
b /= 2;
}
return aa;
}
int main(void) {
ll n, p;
scanf("%lld %lld", &n, &p);
myprime(p);
ll ans = 1;
int l = v.size();
for (int i = 0; i < l; i++) {
// printf("AA %lld %lld\n",v[i].first,v[i].second);
if (v[i].second >= n)
ans *= mypow(v[i].first, v[i].second / n);
}
printf("%lld", ans);
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int SZ = 1000005;
int np[SZ];
vector<pair<ll, int>> v;
void myprime(ll n) {
for (ll i = 2; i < SZ; i++) {
if (np[i] == 1)
continue;
int aa = 0;
while (n % i == 0) {
n /= i;
aa++;
}
if (aa != 0)
v.push_back(make_pair(i, aa));
for (ll j = 2 * i; j * j < SZ; j += i) {
np[j] = 1;
}
}
if (n != 1)
v.push_back(make_pair(n, 1));
}
ll mypow(ll a, ll b) {
ll aa = 1;
while (b) {
if (b % 2 == 1)
aa *= a;
a = a * a;
b /= 2;
}
return aa;
}
int main(void) {
ll n, p;
scanf("%lld %lld", &n, &p);
myprime(p);
ll ans = 1;
int l = v.size();
for (int i = 0; i < l; i++) {
if (v[i].second >= n)
ans *= mypow(v[i].first, v[i].second / n);
}
printf("%lld", ans);
return 0;
} | [
"literal.number.change",
"variable_declaration.value.change",
"variable_declaration.type.change"
] | 990,172 | 990,173 | u225129981 | cpp |
p03194 | #include <algorithm>
#include <math.h>
#include <stdio.h>
using namespace std;
int main() {
long long n, p;
scanf("%lld %lld", &n, &p);
if (n == 1) {
printf("%lld\n", p);
return 0;
}
int ans = 0;
for (long long i = 2; pow(i, n) <= p; i++) {
if (p % i == 0) {
int tmpcnt = 0;
int tmp = p;
while (tmp % i == 0) {
tmp /= i;
tmpcnt++;
if (tmpcnt >= n)
break;
}
if (tmpcnt >= n)
ans = i;
}
}
if (ans == 0)
printf("1\n");
else
printf("%d\n", ans);
}
| #include <algorithm>
#include <math.h>
#include <stdio.h>
using namespace std;
int main() {
long long n, p;
scanf("%lld %lld", &n, &p);
if (n == 1) {
printf("%lld\n", p);
return 0;
}
long long ans = 0;
for (long long i = 2; pow(i, n) <= p; i++) {
if (p % i == 0) {
int tmpcnt = 0;
long long tmp = p;
while (tmp % i == 0) {
tmp /= i;
tmpcnt++;
if (tmpcnt >= n)
break;
}
if (tmpcnt >= n)
ans = i;
}
}
if (ans == 0)
printf("1\n");
else
printf("%lld\n", ans);
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change",
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 990,176 | 990,177 | u601968297 | cpp |
p03194 | #include <cmath>
#include <iostream>
using namespace std;
int main() {
long long n, p;
cin >> n >> p;
long long ans = 0;
for (long long i = int(pow(p, 1.0 / n)) + 3; i >= 1; i--) {
if (p % (long long)(pow(i, n)) == 0) {
ans = i;
break;
}
}
cout << ans << endl;
} | #include <cmath>
#include <iostream>
using namespace std;
int main() {
long long n, p;
cin >> n >> p;
long long ans = 0;
for (long long i = (long long)(pow(p, 1.0 / n)) + 3; i >= 1; i--) {
if (p % (long long)(pow(i, n)) == 0) {
ans = i;
break;
}
}
cout << ans << endl;
} | [
"control_flow.loop.for.initializer.change",
"expression.operation.binary.change"
] | 990,182 | 990,183 | u990764614 | cpp |
p03194 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define pr(num) cout << num << endl
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 100010
#define BLACK 0
#define WHITE 1
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;
Map prime;
void factrization(ll N) {
for (ll i = 2; i * i <= N; i++) {
while (N % i == 0) {
prime[i]++;
N /= i;
}
}
if (N != 1) {
prime[N]++;
}
}
int main(void) {
ll N, P;
cin >> N >> P;
ll ans = 1;
factrization(P);
for (auto itr = prime.begin(); itr != prime.end(); itr++) {
if (itr->second >= N) {
ans *= itr->first * (itr->second / N);
}
}
pr(ans);
}
| #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define pr(num) cout << num << endl
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 100010
#define BLACK 0
#define WHITE 1
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;
Map prime;
void factrization(ll N) {
for (ll i = 2; i * i <= N; i++) {
while (N % i == 0) {
prime[i]++;
N /= i;
}
}
if (N != 1) {
prime[N]++;
}
}
int main(void) {
ll N, P;
cin >> N >> P;
ll ans = 1;
factrization(P);
for (auto itr = prime.begin(); itr != prime.end(); itr++) {
if (itr->second >= N) {
ans *= pow(itr->first, itr->second / N);
}
}
pr(ans);
}
| [
"call.add",
"assignment.value.change",
"expression.operation.binary.change"
] | 990,192 | 990,193 | u768152935 | cpp |
p03194 | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int main() {
ll n, p;
scanf("%lld%lld", &n, &p);
if (n == 1) {
printf("%d\n", p);
return 0;
}
ll ans = 1ll;
ll cur = 2ll;
bool f = true;
while (true) {
ll tmp = 1ll;
for (int i = 0; i < n; i++) {
tmp *= cur;
if (tmp > p) {
f = false;
break;
}
}
if (p % tmp == 0)
ans = cur;
if (!f)
break;
++cur;
}
printf("%lld\n", ans);
return 0;
}
| #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int main() {
ll n, p;
scanf("%lld%lld", &n, &p);
if (n == 1) {
printf("%lld\n", p);
return 0;
}
ll ans = 1ll;
ll cur = 2ll;
bool f = true;
while (true) {
ll tmp = 1ll;
for (int i = 0; i < n; i++) {
tmp *= cur;
if (tmp > p) {
f = false;
break;
}
}
if (p % tmp == 0)
ans = cur;
if (!f)
break;
++cur;
}
printf("%lld\n", ans);
return 0;
}
| [
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 990,194 | 990,195 | u247119183 | cpp |
p03194 | #include <bits/stdc++.h>
#define start_routine \
cin.tie(0); \
cout.tie(0); \
ios_base::sync_with_stdio(false); \
int begtime = clock();
#define end_routine \
int endtime = clock(); \
cerr << endl \
<< "Time elapsed: " << (endtime - begtime) * 1000 / CLOCKS_PER_SEC \
<< " ms"; \
return 0;
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define int long long
#define mp make_pair
#define fr(i, a, b) for (i = a; i < b; i++)
#define mod 1000000007
#define FILEIO \
freopen("input.txt", "r", stdin); \
freopen("output.txt", "w", stdout);
using namespace std;
vector<int> v;
bool b[1000001] = {0};
void calculate() {
int i;
fr(i, 2, 1000001) {
if (b[i] == 0) {
v.pb(i);
int j;
for (j = i * i; j <= 1000000; j += i)
b[j] = 1;
}
}
}
signed main() {
// FILEIO
// start_routine
calculate();
int n, p;
cin >> n >> p;
int ans = 1;
int i;
fr(i, 0, v.size()) {
if (p % v[i] == 0) {
int temp = 0;
while (p % v[i] == 0) {
temp++;
p /= v[i];
}
int t = temp / n;
while (t--) {
ans *= v[i];
}
}
}
if (p != 1) {
if (n == 1)
return cout << p << "\n", 0;
else
cout << 1 << '\n';
return 0;
}
cout << ans << '\n';
// end_routine
}
| #include <bits/stdc++.h>
#define start_routine \
cin.tie(0); \
cout.tie(0); \
ios_base::sync_with_stdio(false); \
int begtime = clock();
#define end_routine \
int endtime = clock(); \
cerr << endl \
<< "Time elapsed: " << (endtime - begtime) * 1000 / CLOCKS_PER_SEC \
<< " ms"; \
return 0;
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define int long long
#define mp make_pair
#define fr(i, a, b) for (i = a; i < b; i++)
#define mod 1000000007
#define FILEIO \
freopen("input.txt", "r", stdin); \
freopen("output.txt", "w", stdout);
using namespace std;
vector<int> v;
bool b[1000001] = {0};
void calculate() {
int i;
fr(i, 2, 1000001) {
if (b[i] == 0) {
v.pb(i);
int j;
for (j = i * i; j <= 1000000; j += i)
b[j] = 1;
}
}
}
signed main() {
// FILEIO
// start_routine
calculate();
int n, p;
cin >> n >> p;
int ans = 1;
int i;
fr(i, 0, v.size()) {
if (p % v[i] == 0) {
int temp = 0;
while (p % v[i] == 0) {
temp++;
p /= v[i];
}
int t = temp / n;
while (t--) {
ans *= v[i];
}
}
}
if (p != 1) {
if (n == 1)
return cout << ans * p << "\n", 0;
else
cout << ans << '\n';
return 0;
}
cout << ans << '\n';
// end_routine
}
| [
"identifier.replace.add",
"literal.replace.remove",
"io.output.change"
] | 990,196 | 990,197 | u955177919 | cpp |
p03195 | #include <bits/stdc++.h>
using namespace std;
#define ll int64_t
//ライブラリ始まり
//定数
//円周率
const double PI = 3.1415926535897932384;
//天井
const int INF = 1000000000; // = 10^9
const ll LINF = 1000000000000000; // = 10^15
// ABC文字列
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZABC";
const string abc = "abcdefghijklmnopqrstuvwxyzabc";
//よくあるmodくん
const ll MOD = 1000000007; // = 10^9 + 7
//関数
// ctoi
int ctoi(char c) {
if (c == '0') {
return 0;
}
if (c == '1') {
return 1;
}
if (c == '2') {
return 2;
}
if (c == '3') {
return 3;
}
if (c == '4') {
return 4;
}
if (c == '5') {
return 5;
}
if (c == '6') {
return 6;
}
if (c == '7') {
return 7;
}
if (c == '8') {
return 8;
}
if (c == '9') {
return 9;
}
return -1;
}
//素数判定
bool PN(int x) {
if (x <= 1) {
return false;
}
if (x == 2) {
return true;
}
for (int i = 2; i < sqrt(x) + 1; i++) {
if (x % i == 0) {
return false;
}
}
return true;
}
//ライブラリ終わり
int main() {
int N;
cin >> N;
bool ok = false;
for (int i = 0; i < N; i++) {
int A;
if (A % 2 == 1) {
ok = true;
}
}
if (ok) {
cout << "first" << endl;
} else {
cout << "second" << endl;
}
}
| #include <bits/stdc++.h>
using namespace std;
#define ll int64_t
//ライブラリ始まり
//定数
//円周率
const double PI = 3.1415926535897932384;
//天井
const int INF = 1000000000; // = 10^9
const ll LINF = 1000000000000000; // = 10^15
// ABC文字列
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZABC";
const string abc = "abcdefghijklmnopqrstuvwxyzabc";
//よくあるmodくん
const ll MOD = 1000000007; // = 10^9 + 7
//関数
// ctoi
int ctoi(char c) {
if (c == '0') {
return 0;
}
if (c == '1') {
return 1;
}
if (c == '2') {
return 2;
}
if (c == '3') {
return 3;
}
if (c == '4') {
return 4;
}
if (c == '5') {
return 5;
}
if (c == '6') {
return 6;
}
if (c == '7') {
return 7;
}
if (c == '8') {
return 8;
}
if (c == '9') {
return 9;
}
return -1;
}
//素数判定
bool PN(int x) {
if (x <= 1) {
return false;
}
if (x == 2) {
return true;
}
for (int i = 2; i < sqrt(x) + 1; i++) {
if (x % i == 0) {
return false;
}
}
return true;
}
//ライブラリ終わり
int main() {
int N;
cin >> N;
bool ok = false;
for (int i = 0; i < N; i++) {
int A;
cin >> A;
if (A % 2 == 1) {
ok = true;
}
}
if (ok) {
cout << "first" << endl;
} else {
cout << "second" << endl;
}
} | [] | 990,198 | 990,199 | u453366189 | cpp |
p03195 | // I SELL YOU...!
#include <algorithm>
#include <functional>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
signed main() {
ll n, odc = 0;
cin >> n;
ll a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
if (a[i] % 2 == 1) {
odc++;
}
}
if (odc >= 1) {
cout << "First\n";
} else {
cout << "Second\n";
}
}
| // I SELL YOU...!
#include <algorithm>
#include <functional>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
signed main() {
ll n, odc = 0;
cin >> n;
ll a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
if (a[i] % 2 == 1) {
odc++;
}
}
if (odc >= 1) {
cout << "first\n";
} else {
cout << "second\n";
}
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 990,202 | 990,203 | u352248517 | cpp |
p03195 | #include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
bool ans = false;
for (int i = 0; i < n; i++) {
if (a[i] % 2 == 1) {
ans = true;
}
}
cout << (ans ? "First" : "Second") << endl;
} | #include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
bool ans = false;
for (int i = 0; i < n; i++) {
if (a[i] % 2 == 1) {
ans = true;
}
}
cout << (ans ? "first" : "second") << endl;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 990,211 | 990,212 | u179970156 | cpp |
p03195 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int i;
vector<int> a(n);
for (i = 0; i < n; i++) {
cin >> a.at(i);
}
int s = 0;
for (i = 0; i < n; i++) {
if (a.at(i) % 2 == i) {
s = 1;
break;
}
}
if (s == 1) {
cout << "first" << endl;
} else {
cout << "second" << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int i;
vector<int> a(n);
for (i = 0; i < n; i++) {
cin >> a.at(i);
}
int s = 0;
for (i = 0; i < n; i++) {
if (a.at(i) % 2 == 1) {
s = 1;
break;
}
}
if (s == 1) {
cout << "first" << endl;
} else {
cout << "second" << endl;
}
} | [
"identifier.replace.remove",
"literal.replace.add",
"control_flow.branch.if.condition.change"
] | 990,215 | 990,216 | u989336028 | cpp |
p03195 | #include <iostream>
using namespace std;
int n, m, ans = 1;
int main(void) {
cin >> n;
for (int i = 0; i < n; i++) {
cin >> m;
ans *= (m % 2 == 0);
}
if (ans)
cout << "Second" << endl;
else
cout << "First" << endl;
}
| #include <iostream>
using namespace std;
int n, m, ans = 1;
int main(void) {
cin >> n;
for (int i = 0; i < n; i++) {
cin >> m;
ans *= (m % 2 == 0);
}
if (ans)
cout << "second" << endl;
else
cout << "first" << endl;
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 990,221 | 990,222 | u050428930 | cpp |
p03195 | // Harlequin.cpp : This file contains the 'main' function. Program execution
// begins and ends there.
//
#include <iostream>
using namespace std;
int n, x;
int pos;
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
cin >> x;
if (x % 2 == 1) {
pos = false;
}
}
if (pos) {
cout << "second" << endl;
}
else {
cout << "first" << endl;
}
return 0;
}
// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu
// Tips for Getting Started:
// 1. Use the Solution Explorer window to add/manage files
// 2. Use the Team Explorer window to connect to source control
// 3. Use the Output window to see build output and other messages
// 4. Use the Error List window to view errors
// 5. Go to Project > Add New Item to create new code files, or Project > Add
// Existing Item to add existing code files to the project
// 6. In the future, to open this project again, go to File > Open > Project
// and select the .sln file
| // Harlequin.cpp : This file contains the 'main' function. Program execution
// begins and ends there.
//
#include <iostream>
using namespace std;
int n, x;
bool pos = true;
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
cin >> x;
if (x % 2 == 1) {
pos = false;
}
}
if (pos) {
cout << "second" << endl;
}
else {
cout << "first" << endl;
}
return 0;
}
// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu
// Tips for Getting Started:
// 1. Use the Solution Explorer window to add/manage files
// 2. Use the Team Explorer window to connect to source control
// 3. Use the Output window to see build output and other messages
// 4. Use the Error List window to view errors
// 5. Go to Project > Add New Item to create new code files, or Project > Add
// Existing Item to add existing code files to the project
// 6. In the future, to open this project again, go to File > Open > Project
// and select the .sln file
| [
"variable_declaration.type.primitive.change",
"variable_declaration.value.change"
] | 990,233 | 990,234 | u999447364 | cpp |
p03195 | #include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define PB push_back
#define MP make_pair
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define INF (1 << 29)
#define LLINF (1LL << 60)
#define MOD 1000000007
#define REP(i, n) for (int i = 0; i < n; i++)
using ll = long long;
using namespace std;
typedef pair<int, int> P;
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
int t;
cin >> t;
if (t % 2 != 0) {
cout << "second" << endl;
return 0;
}
}
cout << "first" << endl;
return 0;
}
| #include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define PB push_back
#define MP make_pair
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define INF (1 << 29)
#define LLINF (1LL << 60)
#define MOD 1000000007
#define REP(i, n) for (int i = 0; i < n; i++)
using ll = long long;
using namespace std;
typedef pair<int, int> P;
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
int t;
cin >> t;
if (t % 2 != 0) {
cout << "first" << endl;
return 0;
}
}
cout << "second" << endl;
return 0;
}
| [
"literal.string.change",
"io.output.change"
] | 990,241 | 990,242 | u257304866 | cpp |
p03195 | #include <bits/stdc++.h>
using namespace std;
int main(void) {
int n;
cin >> n;
int i = 0;
while (i < n) {
int a;
if (a % 2 == 1) {
cout << "first" << endl;
return 0;
}
i++;
}
cout << "second" << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main(void) {
int n;
cin >> n;
int i = 0;
while (i < n) {
int a;
cin >> a;
if (a % 2 == 1) {
cout << "first" << endl;
return 0;
}
i++;
}
cout << "second" << endl;
return 0;
} | [] | 990,252 | 990,253 | u369212307 | cpp |
p03195 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
int wo;
for (int i = 0; i < N; i++) {
cin >> wo;
if (wo %= 1) {
cout << "first" << endl;
return 0;
}
}
cout << "second" << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
int wo;
for (int i = 0; i < N; i++) {
cin >> wo;
if (wo % 2 == 1) {
cout << "first" << endl;
return 0;
}
}
cout << "second" << endl;
return 0;
}
| [
"assignment.compound.arithmetic.replace.remove",
"expression.operator.arithmetic.replace.add",
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change"
] | 990,257 | 990,258 | u071695942 | cpp |
p03195 | #include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
bool flag = true;
vector<long long> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
if (a[i] % 2 != 0)
flag = false;
}
cout << (flag ? "first" : "second") << endl;
}
| #include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
bool flag = true;
vector<long long> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
if (a[i] % 2 != 0)
flag = false;
}
cout << (flag ? "second" : "first") << endl;
}
| [
"literal.string.change",
"io.output.change"
] | 990,271 | 990,272 | u468811760 | cpp |
p03195 | #include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define endl '\n'
#define pb push_back
#define fst first
#define scd second
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
constexpr int MOD = 1000000007;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
template <class T = int> T in() {
T x;
cin >> x;
return (x);
}
template <class T = int> void out(T x) { cout << (x) << endl; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
// value
int N;
vi a;
void solve() {
cin >> N;
bool ans = false;
for (int i = 0; i < N; i++) {
int tmp;
cin >> tmp;
a.pb(tmp);
if (tmp % 2 != 0)
ans = true;
}
if (ans) {
cout << "second" << endl;
} else {
cout << "first" << endl;
}
return;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
solve();
return 0;
} | #include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define endl '\n'
#define pb push_back
#define fst first
#define scd second
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
constexpr int MOD = 1000000007;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
template <class T = int> T in() {
T x;
cin >> x;
return (x);
}
template <class T = int> void out(T x) { cout << (x) << endl; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
// value
int N;
vi a;
void solve() {
cin >> N;
bool ans = false;
for (int i = 0; i < N; i++) {
int tmp;
cin >> tmp;
a.pb(tmp);
if (tmp % 2 != 0)
ans = true;
}
if (ans) {
cout << "first" << endl;
} else {
cout << "second" << endl;
}
return;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
solve();
return 0;
} | [
"literal.string.change",
"io.output.change"
] | 990,277 | 990,278 | u381714561 | cpp |
p03195 | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define VRSORT(v) sort(v.rbegin(), v.rend()); // vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define OUT(x) cout << x << endl
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
int main() {
int n;
cin >> n;
bool add = false; //奇数が含まれるかどうか
REP(i, n) {
int a;
cin >> a;
if (a % 2 == 1)
add = true;
}
if (true)
cout << "first" << endl;
else
cout << "second" << endl;
}
| #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define VRSORT(v) sort(v.rbegin(), v.rend()); // vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define OUT(x) cout << x << endl
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
int main() {
int n;
cin >> n;
bool add = false; //奇数が含まれるかどうか
REP(i, n) {
int a;
cin >> a;
if (a % 2 == 1)
add = true;
}
if (add)
cout << "first" << endl;
else
cout << "second" << endl;
}
| [
"control_flow.branch.if.condition.change"
] | 990,279 | 990,280 | u493750228 | cpp |
p03195 | #include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <sstream>
#include <string>
#include <time.h>
#include <vector>
//#include "bits/stdc++.h"
using namespace std;
// using namespace std::vector;
#define rep(i, a, b) for (ll i = (a); i < (b); ++i)
#define huge 1000000007
typedef long long int ll;
ll gcd(ll a, ll b);
ll bur(ll N, ll X);
bool IsPrime(int num);
int main(void) {
ll N = 0;
ll A = 0;
ll B = 0;
ll C = 0;
ll D = 0;
ll P = 0;
// ll T = 0;
// ll M = 0;
ll h[1000] = {};
// ll b[100] = {};
// ll c[100] = {};
// ll d[100] = {};
// ll v[3] = {};
// ll *c, *s, *n;
string S[50], T[50], U[52];
ll count = 0;
ll count2 = 0;
float sum = 0;
ll min = 1000000000000;
ll max = 1;
ll smax = 0;
ll max2 = 0;
ll smax2 = 0;
int tmax = 0;
int tmax2 = 0;
// int flag = 0;
char temp, head;
// int is = 0;
bool flag = false;
// char p;
ll all = 0;
ll niku = 0;
ll state = 2;
bool down = true;
// cin >> S;
vector<pair<int, int>> ch(1000);
cin >> N;
vector<int> c(N);
rep(i, 0, N) { cin >> c[i]; }
rep(i, 0, N) {
if (c[i] % 2 != 0) {
cout << "second" << endl;
return 0;
}
}
cout << "first" << endl;
// x = (ll *)malloc((N+1) * sizeof(ll));
// c = (ll *)malloc((N) * sizeof(ll));
// cin >> D >> G;
// vector<pair<int,int>> tr(M);
// vector<pair<int,int>> qes(Q);
// sort(c.begin(), c.end());
// cout << c[2] - c[1] << endl;
/*A = N / 1000;
N %= 1000;
B = N / 100;
N %= 100;
C = N / 10;
N %= 10;
D = N;*/
// cin >> N >> M;
// vector<pair<int,int>> c(M);
////vector<pair<int, int>> e(M);
// vector<ll> d(M);
// rep(i, 0, M) {
// cin >> c[i].first >> c[i].second;
// //e[i].first = c[i].first;
// //e[i].second = c[i].second;
//}
////sort(c.begin(), c.end());
//
// rep(i, 0, M) {
//
//
// rep(j, 0, M) {
// if (c[i].first == c[j].first && c[j].second < c[i].second) {
// d[i]++;
// //cout << j << endl;
// }
// }
// cout << std::setfill('0') << std::right << std::setw(6) << c[i].first;
// cout << std::setfill('0') << std::right << std::setw(6) << d[i]+1 <<
//endl;
//}
return 0;
}
ll bur(ll N, ll X) {
ll pan = 1;
ll pat = 1;
ll burg = 0;
if (X > burg) {
if (N == 0)
return pat;
burg += pan;
burg += bur(N - 1, X);
burg += pat;
burg += bur(N - 1, X);
burg += pan;
}
return burg;
}
ll gcd(ll a, ll b) {
/* 自然数 a > b を確認・入替 */
if (a < b) {
ll tmp = a;
a = b;
b = tmp;
}
ll x = b;
ll y = a;
/* ユークリッドの互除法 */
ll r = a % b;
while (r != 0) {
a = b;
b = r;
r = a % b;
}
return y / b * x;
}
bool IsPrime(int num) {
if (num < 2)
return false;
else if (num == 2)
return true;
else if (num % 2 == 0)
return false; // 偶数はあらかじめ除く
double sqrtNum = sqrt(num);
for (int i = 3; i <= sqrtNum; i += 2) {
if (num % i == 0) {
// 素数ではない
return false;
}
}
// 素数である
return true;
} | #include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <sstream>
#include <string>
#include <time.h>
#include <vector>
//#include "bits/stdc++.h"
using namespace std;
// using namespace std::vector;
#define rep(i, a, b) for (ll i = (a); i < (b); ++i)
#define huge 1000000007
typedef long long int ll;
ll gcd(ll a, ll b);
ll bur(ll N, ll X);
bool IsPrime(int num);
int main(void) {
ll N = 0;
ll A = 0;
ll B = 0;
ll C = 0;
ll D = 0;
ll P = 0;
// ll T = 0;
// ll M = 0;
ll h[1000] = {};
// ll b[100] = {};
// ll c[100] = {};
// ll d[100] = {};
// ll v[3] = {};
// ll *c, *s, *n;
string S[50], T[50], U[52];
ll count = 0;
ll count2 = 0;
float sum = 0;
ll min = 1000000000000;
ll max = 1;
ll smax = 0;
ll max2 = 0;
ll smax2 = 0;
int tmax = 0;
int tmax2 = 0;
// int flag = 0;
char temp, head;
// int is = 0;
bool flag = false;
// char p;
ll all = 0;
ll niku = 0;
ll state = 2;
bool down = true;
// cin >> S;
vector<pair<int, int>> ch(1000);
cin >> N;
vector<int> c(N);
rep(i, 0, N) { cin >> c[i]; }
rep(i, 0, N) {
if (c[i] % 2 != 0) {
cout << "first" << endl;
return 0;
}
}
cout << "second" << endl;
// x = (ll *)malloc((N+1) * sizeof(ll));
// c = (ll *)malloc((N) * sizeof(ll));
// cin >> D >> G;
// vector<pair<int,int>> tr(M);
// vector<pair<int,int>> qes(Q);
// sort(c.begin(), c.end());
// cout << c[2] - c[1] << endl;
/*A = N / 1000;
N %= 1000;
B = N / 100;
N %= 100;
C = N / 10;
N %= 10;
D = N;*/
// cin >> N >> M;
// vector<pair<int,int>> c(M);
////vector<pair<int, int>> e(M);
// vector<ll> d(M);
// rep(i, 0, M) {
// cin >> c[i].first >> c[i].second;
// //e[i].first = c[i].first;
// //e[i].second = c[i].second;
//}
////sort(c.begin(), c.end());
//
// rep(i, 0, M) {
//
//
// rep(j, 0, M) {
// if (c[i].first == c[j].first && c[j].second < c[i].second) {
// d[i]++;
// //cout << j << endl;
// }
// }
// cout << std::setfill('0') << std::right << std::setw(6) << c[i].first;
// cout << std::setfill('0') << std::right << std::setw(6) << d[i]+1 <<
//endl;
//}
return 0;
}
ll bur(ll N, ll X) {
ll pan = 1;
ll pat = 1;
ll burg = 0;
if (X > burg) {
if (N == 0)
return pat;
burg += pan;
burg += bur(N - 1, X);
burg += pat;
burg += bur(N - 1, X);
burg += pan;
}
return burg;
}
ll gcd(ll a, ll b) {
/* 自然数 a > b を確認・入替 */
if (a < b) {
ll tmp = a;
a = b;
b = tmp;
}
ll x = b;
ll y = a;
/* ユークリッドの互除法 */
ll r = a % b;
while (r != 0) {
a = b;
b = r;
r = a % b;
}
return y / b * x;
}
bool IsPrime(int num) {
if (num < 2)
return false;
else if (num == 2)
return true;
else if (num % 2 == 0)
return false; // 偶数はあらかじめ除く
double sqrtNum = sqrt(num);
for (int i = 3; i <= sqrtNum; i += 2) {
if (num % i == 0) {
// 素数ではない
return false;
}
}
// 素数である
return true;
} | [
"literal.string.change",
"io.output.change"
] | 990,294 | 990,295 | u301409936 | cpp |
p03195 | #include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <sstream>
#include <string>
#include <time.h>
#include <vector>
//#include "bits/stdc++.h"
using namespace std;
// using namespace std::vector;
#define rep(i, a, b) for (ll i = (a); i < (b); ++i)
#define huge 1000000007
typedef long long int ll;
ll gcd(ll a, ll b);
ll bur(ll N, ll X);
bool IsPrime(int num);
int main(void) {
ll N = 0;
ll A = 0;
ll B = 0;
ll C = 0;
ll D = 0;
ll P = 0;
// ll T = 0;
// ll M = 0;
ll h[1000] = {};
// ll b[100] = {};
// ll c[100] = {};
// ll d[100] = {};
// ll v[3] = {};
// ll *c, *s, *n;
string S[50], T[50], U[52];
ll count = 0;
ll count2 = 0;
float sum = 0;
ll min = 1000000000000;
ll max = 1;
ll smax = 0;
ll max2 = 0;
ll smax2 = 0;
int tmax = 0;
int tmax2 = 0;
// int flag = 0;
char temp, head;
// int is = 0;
bool flag = false;
// char p;
ll all = 0;
ll niku = 0;
ll state = 2;
bool down = true;
// cin >> S;
vector<pair<int, int>> ch(1000);
cin >> N;
vector<int> c(N);
rep(i, 0, N) { cin >> c[i]; }
rep(i, 0, N) {
if (c[i] % 2 != 0) {
cout << "first" << endl;
break;
}
}
cout << "second" << endl;
// x = (ll *)malloc((N+1) * sizeof(ll));
// c = (ll *)malloc((N) * sizeof(ll));
// cin >> D >> G;
// vector<pair<int,int>> tr(M);
// vector<pair<int,int>> qes(Q);
// sort(c.begin(), c.end());
// cout << c[2] - c[1] << endl;
/*A = N / 1000;
N %= 1000;
B = N / 100;
N %= 100;
C = N / 10;
N %= 10;
D = N;*/
// cin >> N >> M;
// vector<pair<int,int>> c(M);
////vector<pair<int, int>> e(M);
// vector<ll> d(M);
// rep(i, 0, M) {
// cin >> c[i].first >> c[i].second;
// //e[i].first = c[i].first;
// //e[i].second = c[i].second;
//}
////sort(c.begin(), c.end());
//
// rep(i, 0, M) {
//
//
// rep(j, 0, M) {
// if (c[i].first == c[j].first && c[j].second < c[i].second) {
// d[i]++;
// //cout << j << endl;
// }
// }
// cout << std::setfill('0') << std::right << std::setw(6) << c[i].first;
// cout << std::setfill('0') << std::right << std::setw(6) << d[i]+1 <<
//endl;
//}
return 0;
}
ll bur(ll N, ll X) {
ll pan = 1;
ll pat = 1;
ll burg = 0;
if (X > burg) {
if (N == 0)
return pat;
burg += pan;
burg += bur(N - 1, X);
burg += pat;
burg += bur(N - 1, X);
burg += pan;
}
return burg;
}
ll gcd(ll a, ll b) {
/* 自然数 a > b を確認・入替 */
if (a < b) {
ll tmp = a;
a = b;
b = tmp;
}
ll x = b;
ll y = a;
/* ユークリッドの互除法 */
ll r = a % b;
while (r != 0) {
a = b;
b = r;
r = a % b;
}
return y / b * x;
}
bool IsPrime(int num) {
if (num < 2)
return false;
else if (num == 2)
return true;
else if (num % 2 == 0)
return false; // 偶数はあらかじめ除く
double sqrtNum = sqrt(num);
for (int i = 3; i <= sqrtNum; i += 2) {
if (num % i == 0) {
// 素数ではない
return false;
}
}
// 素数である
return true;
} | #include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <sstream>
#include <string>
#include <time.h>
#include <vector>
//#include "bits/stdc++.h"
using namespace std;
// using namespace std::vector;
#define rep(i, a, b) for (ll i = (a); i < (b); ++i)
#define huge 1000000007
typedef long long int ll;
ll gcd(ll a, ll b);
ll bur(ll N, ll X);
bool IsPrime(int num);
int main(void) {
ll N = 0;
ll A = 0;
ll B = 0;
ll C = 0;
ll D = 0;
ll P = 0;
// ll T = 0;
// ll M = 0;
ll h[1000] = {};
// ll b[100] = {};
// ll c[100] = {};
// ll d[100] = {};
// ll v[3] = {};
// ll *c, *s, *n;
string S[50], T[50], U[52];
ll count = 0;
ll count2 = 0;
float sum = 0;
ll min = 1000000000000;
ll max = 1;
ll smax = 0;
ll max2 = 0;
ll smax2 = 0;
int tmax = 0;
int tmax2 = 0;
// int flag = 0;
char temp, head;
// int is = 0;
bool flag = false;
// char p;
ll all = 0;
ll niku = 0;
ll state = 2;
bool down = true;
// cin >> S;
vector<pair<int, int>> ch(1000);
cin >> N;
vector<int> c(N);
rep(i, 0, N) { cin >> c[i]; }
rep(i, 0, N) {
if (c[i] % 2 != 0) {
cout << "first" << endl;
return 0;
}
}
cout << "second" << endl;
// x = (ll *)malloc((N+1) * sizeof(ll));
// c = (ll *)malloc((N) * sizeof(ll));
// cin >> D >> G;
// vector<pair<int,int>> tr(M);
// vector<pair<int,int>> qes(Q);
// sort(c.begin(), c.end());
// cout << c[2] - c[1] << endl;
/*A = N / 1000;
N %= 1000;
B = N / 100;
N %= 100;
C = N / 10;
N %= 10;
D = N;*/
// cin >> N >> M;
// vector<pair<int,int>> c(M);
////vector<pair<int, int>> e(M);
// vector<ll> d(M);
// rep(i, 0, M) {
// cin >> c[i].first >> c[i].second;
// //e[i].first = c[i].first;
// //e[i].second = c[i].second;
//}
////sort(c.begin(), c.end());
//
// rep(i, 0, M) {
//
//
// rep(j, 0, M) {
// if (c[i].first == c[j].first && c[j].second < c[i].second) {
// d[i]++;
// //cout << j << endl;
// }
// }
// cout << std::setfill('0') << std::right << std::setw(6) << c[i].first;
// cout << std::setfill('0') << std::right << std::setw(6) << d[i]+1 <<
//endl;
//}
return 0;
}
ll bur(ll N, ll X) {
ll pan = 1;
ll pat = 1;
ll burg = 0;
if (X > burg) {
if (N == 0)
return pat;
burg += pan;
burg += bur(N - 1, X);
burg += pat;
burg += bur(N - 1, X);
burg += pan;
}
return burg;
}
ll gcd(ll a, ll b) {
/* 自然数 a > b を確認・入替 */
if (a < b) {
ll tmp = a;
a = b;
b = tmp;
}
ll x = b;
ll y = a;
/* ユークリッドの互除法 */
ll r = a % b;
while (r != 0) {
a = b;
b = r;
r = a % b;
}
return y / b * x;
}
bool IsPrime(int num) {
if (num < 2)
return false;
else if (num == 2)
return true;
else if (num % 2 == 0)
return false; // 偶数はあらかじめ除く
double sqrtNum = sqrt(num);
for (int i = 3; i <= sqrtNum; i += 2) {
if (num % i == 0) {
// 素数ではない
return false;
}
}
// 素数である
return true;
} | [
"control_flow.break.remove",
"control_flow.return.add",
"function.return_value.change"
] | 990,296 | 990,295 | u301409936 | cpp |
p03195 | #include <algorithm>
#include <iostream>
#include <math.h>
#include <queue>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
typedef long int li;
int main(void) {
ll n;
ll od = 0;
ll ev = 0;
cin >> n;
ll a[n + 1];
for (ll i = 1; i < n + 1; i++)
cin >> a[i];
for (ll i = 1; i < n + 1; i++) {
if (a[i] % 2 == 0)
ev++;
if (a[i] % 2 == 1)
od++;
}
if (od == n) {
cout << "first" << endl;
} else if (ev == n) {
cout << "first" << endl;
} else if (od % 2 == 1 && ev % 2 == 1) {
cout << "first" << endl;
} else if (od % 2 == 0 && ev % 2 == 1) {
cout << "second" << endl;
} else if (od % 2 == 1 && ev % 2 == 0) {
cout << "first" << endl;
} else if (od % 2 == 0 && ev % 2 == 0) {
cout << "second" << endl;
}
return 0;
}
| #include <algorithm>
#include <iostream>
#include <math.h>
#include <queue>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
typedef long int li;
int main(void) {
ll n;
ll od = 0;
ll ev = 0;
cin >> n;
ll a[n + 1];
for (ll i = 1; i < n + 1; i++)
cin >> a[i];
for (ll i = 1; i < n + 1; i++) {
if (a[i] % 2 == 0)
ev++;
if (a[i] % 2 == 1)
od++;
}
if (od == n) {
cout << "first" << endl;
} else if (ev == n) {
cout << "second" << endl;
} else if (od % 2 == 1 && ev % 2 == 1) {
cout << "first" << endl;
} else if (od % 2 == 0 && ev % 2 == 1) {
cout << "first" << endl;
} else if (od % 2 == 1 && ev % 2 == 0) {
cout << "first" << endl;
} else if (od % 2 == 0 && ev % 2 == 0) {
cout << "first" << endl;
}
return 0;
}
| [
"literal.string.change",
"io.output.change"
] | 990,311 | 990,305 | u795009336 | cpp |
p03195 | #include <algorithm>
#include <iostream>
#include <math.h>
#include <queue>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
typedef long int li;
int main(void) {
ll n;
ll od = 0;
ll ev = 0;
cin >> n;
ll a[n + 1];
for (ll i = 1; i < n + 1; i++)
cin >> a[i];
for (ll i = 1; i < n + 1; i++) {
if (a[i] % 2 == 0)
ev++;
if (a[i] % 2 == 1)
od++;
}
if (od == n) {
cout << "first" << endl;
} else if (ev == n) {
cout << "second" << endl;
} else if (od % 2 == 1 && ev % 2 == 1) {
cout << "second" << endl;
} else if (od % 2 == 0 && ev % 2 == 1) {
cout << "second" << endl;
} else if (od % 2 == 1 && ev % 2 == 0) {
cout << "first" << endl;
} else if (od % 2 == 0 && ev % 2 == 0) {
cout << "second" << endl;
}
return 0;
}
| #include <algorithm>
#include <iostream>
#include <math.h>
#include <queue>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
typedef long int li;
int main(void) {
ll n;
ll od = 0;
ll ev = 0;
cin >> n;
ll a[n + 1];
for (ll i = 1; i < n + 1; i++)
cin >> a[i];
for (ll i = 1; i < n + 1; i++) {
if (a[i] % 2 == 0)
ev++;
if (a[i] % 2 == 1)
od++;
}
if (od == n) {
cout << "first" << endl;
} else if (ev == n) {
cout << "second" << endl;
} else if (od % 2 == 1 && ev % 2 == 1) {
cout << "first" << endl;
} else if (od % 2 == 0 && ev % 2 == 1) {
cout << "first" << endl;
} else if (od % 2 == 1 && ev % 2 == 0) {
cout << "first" << endl;
} else if (od % 2 == 0 && ev % 2 == 0) {
cout << "first" << endl;
}
return 0;
}
| [
"literal.string.change",
"io.output.change"
] | 990,312 | 990,305 | u795009336 | cpp |
p03195 | #include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>
using namespace std;
int n;
int read() {
int x = 0, f = 1;
char ch = getchar();
while ((ch < '0') || (ch > '9')) {
if (ch == '-')
f = -1;
ch = getchar();
}
while ((ch >= '0') && (ch <= '9')) {
x = x * 10 + (ch - '0');
ch = getchar();
}
return x * f;
}
int main() {
n = read();
int ans = 0, i;
for (i = 1; i <= n; i++) {
int x = read();
if (x % 2)
ans = 1;
}
if (ans)
cout << "frist";
else
cout << "second";
return 0;
}
| #include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>
using namespace std;
int n;
int read() {
int x = 0, f = 1;
char ch = getchar();
while ((ch < '0') || (ch > '9')) {
if (ch == '-')
f = -1;
ch = getchar();
}
while ((ch >= '0') && (ch <= '9')) {
x = x * 10 + (ch - '0');
ch = getchar();
}
return x * f;
}
int main() {
n = read();
int ans = 0, i;
for (i = 1; i <= n; i++) {
int x = read();
if (x % 2)
ans = 1;
}
if (ans)
cout << "first";
else
cout << "second";
return 0;
}
| [
"literal.string.change",
"io.output.change"
] | 990,326 | 990,327 | u473013083 | cpp |
p03195 | #include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define INF 1000000000
using namespace std;
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define LOOP(i, N) for (int i = 0; i < N; i++)
#define LOOP1(i, N) for (int i = 1; i <= N; i++)
typedef pair<int, int> P;
typedef pair<int, pair<int, int>> PP;
// #define int unsigned long long
#define MAN 200000
int main() {
int N;
int a[100000];
bool f = 0, s = 0;
cin >> N;
LOOP(i, N) {
cin >> a[i];
if (a[i] % 2)
f = 1;
else
s = 1;
}
if (s)
cout << "first" << endl;
else
cout << "second" << endl;
}
| #include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define INF 1000000000
using namespace std;
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define LOOP(i, N) for (int i = 0; i < N; i++)
#define LOOP1(i, N) for (int i = 1; i <= N; i++)
typedef pair<int, int> P;
typedef pair<int, pair<int, int>> PP;
// #define int unsigned long long
#define MAN 200000
int main() {
int N;
int a[100000];
bool f = 0, s = 0;
cin >> N;
LOOP(i, N) {
cin >> a[i];
if (a[i] % 2 == 0)
f = 1;
else
s = 1;
}
if (s)
cout << "first" << endl;
else
cout << "second" << endl;
}
| [
"control_flow.branch.if.condition.change"
] | 990,333 | 990,334 | u118951811 | cpp |
p03194 | #include <iostream>
using namespace std;
int main() {
long long N, num, ans = 1, was = 0, temp = 1, i, cnt = 0;
bool chk = false;
cin >> N >> num;
if (N == 1)
cout << num << endl;
return 0;
while (num != 0) {
for (i = 2; i <= num; i++) {
if (num % i == 0 && num != 2) {
chk = true;
break;
}
if (num / i < i || num == 2) {
chk = false;
break;
}
}
if (chk == true) {
if (was == i)
temp++;
else
temp = 1;
was = i;
if (temp >= N) {
ans *= i;
temp = 0;
}
} else {
if (was == num)
temp++;
if (temp >= N) {
ans *= num;
temp = 0;
}
break;
}
num = num / i;
cnt++;
}
cout << ans << endl;
} | #include <iostream>
using namespace std;
int main() {
long long N, num, ans = 1, was = 0, temp = 1, i, cnt = 0;
bool chk = false;
cin >> N >> num;
if (N == 1) {
cout << num << endl;
return 0;
}
while (num != 0) {
for (i = 2; i <= num; i++) {
if (num % i == 0 && num != 2) {
chk = true;
break;
}
if (num / i < i || num == 2) {
chk = false;
break;
}
}
if (chk == true) {
if (was == i)
temp++;
else
temp = 1;
was = i;
if (temp >= N) {
ans *= i;
temp = 0;
}
} else {
if (was == num)
temp++;
if (temp >= N) {
ans *= num;
temp = 0;
}
break;
}
num = num / i;
cnt++;
}
cout << ans << endl;
} | [] | 990,372 | 990,373 | u053038211 | cpp |
p03194 | #include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <unordered_set>
#include <vector>
using namespace std;
int sss(long long int x) {
long long int a = 2, sum = 0;
long long int mx = 0;
while (x >= a * a) {
if (x % a == 0) {
x /= a;
sum++;
mx = (mx, sum);
} else {
a++;
sum = 0;
}
}
return mx;
}
int main(void) {
long long int n, p;
cin >> n >> p;
long long int i;
long long int ans = 0;
long long int mx = 0;
if (n == 1) {
cout << p << endl;
return 0;
}
if (p == 1) {
cout << "1" << endl;
return 0;
}
for (i = 2; pow(i, n) <= p; i++) {
long long x = p / pow(i, n);
if (x == p / pow(i, n)) {
if (sss(x) < n) {
ans = i;
}
}
}
cout << ans << endl;
return 0;
} | #include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <unordered_set>
#include <vector>
using namespace std;
int sss(long long int x) {
long long int a = 2, sum = 0;
long long int mx = 0;
while (x >= a * a) {
if (x % a == 0) {
x /= a;
sum++;
mx = (mx, sum);
} else {
a++;
sum = 0;
}
}
return mx;
}
int main(void) {
long long int n, p;
cin >> n >> p;
long long int i;
long long int ans = 0;
long long int mx = 0;
if (n == 1) {
cout << p << endl;
return 0;
}
if (p == 1) {
cout << "1" << endl;
return 0;
}
for (i = 1; pow(i, n) <= p; i++) {
long long x = p / pow(i, n);
if (x == p / pow(i, n)) {
if (sss(x) < n) {
ans = i;
}
}
}
cout << ans << endl;
return 0;
} | [
"literal.number.change",
"assignment.value.change",
"control_flow.loop.for.initializer.change",
"expression.off_by_one"
] | 990,412 | 990,413 | u385617244 | cpp |
p03194 | #include <cmath>
#include <iostream>
#include <string>
#include <vector>
using std::cin;
using std::cout;
using std::endl;
using std::pair;
using std::string;
using std::vector;
// for(int32_t i = 0; i < N; i++)
int main(void) {
int64_t N, P;
cin >> N >> P;
// cout << "P:" << P << " ,N:" << N << endl;
int64_t max_yakusu = 1;
for (int64_t i = 2; i <= std::sqrt(P); i++) {
int64_t count = 0;
while (P % i == 0) {
// cout << "P:" << P << " ,i:" << i << endl;
P = P / i;
count++;
}
if (count >= N) {
max_yakusu *= i;
}
}
if (P != 1 && N == 1) {
max_yakusu *= P;
}
cout << max_yakusu << endl;
return 0;
}
| #include <cmath>
#include <iostream>
#include <string>
#include <vector>
using std::cin;
using std::cout;
using std::endl;
using std::pair;
using std::string;
using std::vector;
// for(int32_t i = 0; i < N; i++)
int main(void) {
int64_t N, P;
cin >> N >> P;
// cout << "P:" << P << " ,N:" << N << endl;
int64_t max_yakusu = 1;
for (int64_t i = 2; i <= std::sqrt(P); i++) {
int64_t count = 0;
while (P % i == 0) {
// cout << "P:" << P << " ,i:" << i << endl;
P = P / i;
count++;
}
while (count >= N) {
max_yakusu *= i;
count -= N;
}
}
if (P != 1 && N == 1) {
max_yakusu *= P;
}
cout << max_yakusu << endl;
return 0;
}
| [
"control_flow.branch.while.replace.add",
"control_flow.loop.if.replace.remove",
"assignment.add"
] | 990,414 | 990,415 | u668140376 | cpp |
p03194 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ll N, P;
cin >> N >> P;
ll i = 2, l = 1;
while (P != 1) {
if (P % i == 0) {
ll ni = 0;
while (P % i == 0) {
ni++;
P /= i;
}
l *= pow(i, ni / N);
} else if (i * i > P) {
if (N == 1)
l *= N;
break;
} else {
i++;
}
}
cout << l << endl;
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ll N, P;
cin >> N >> P;
ll i = 2, l = 1;
while (P != 1) {
if (P % i == 0) {
ll ni = 0;
while (P % i == 0) {
ni++;
P /= i;
}
l *= pow(i, ni / N);
} else if (i * i > P) {
if (N == 1)
l *= P;
break;
} else {
i++;
}
}
cout << l << endl;
} | [
"assignment.value.change",
"identifier.change"
] | 990,438 | 990,439 | u077337864 | cpp |
p03194 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
long long n, p;
cin >> n >> p;
long long jg = pow(p, 1.0 / n);
for (long long i = jg + 1;; i--) {
if (p % (long long)pow(i, n - 1) == 0) {
jg = i;
break;
}
}
printf("%lld\n", jg);
return 0;
} | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
long long n, p;
cin >> n >> p;
long long jg = pow(p, 1.0 / n);
for (long long i = jg + 1;; i--) {
if (p % (long long)pow(i, n) == 0) {
jg = i;
break;
}
}
printf("%lld\n", jg);
return 0;
} | [
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove"
] | 990,444 | 990,445 | u061597928 | cpp |
p03194 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, m;
cin >> n >> m;
long long maxn = 1;
if (n == 1 || n >= m) {
cout << m << endl;
return 0;
}
double ff = m, fff = n;
double f = pow(ff, 1.0 / fff);
// cout<<f<<endl;
for (long long i = f + 1; i >= 2; i--) {
long long sum = 1;
for (long long j = 0; j < n; j++) {
sum *= i;
if (sum > m)
break;
}
if (m % sum == 0) {
maxn = i;
break;
}
}
cout << maxn << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, m;
cin >> n >> m;
long long maxn = 1;
if (n == 1) {
cout << m << endl;
return 0;
}
double ff = m, fff = n;
double f = pow(ff, 1.0 / fff);
// cout<<f<<endl;
for (long long i = f + 1; i >= 2; i--) {
long long sum = 1;
for (long long j = 0; j < n; j++) {
sum *= i;
if (sum > m)
break;
}
if (m % sum == 0) {
maxn = i;
break;
}
}
cout << maxn << endl;
} | [
"expression.operation.binary.remove"
] | 990,453 | 990,454 | u269278772 | cpp |
p03194 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#define int long long
using namespace std;
int n, p, ans = 1, cnt;
int jl[10000009];
int prime[10000009], isp[10000009];
template <typename T> inline void in(T &x) {
T ch = getchar(), f = 1;
x = 0;
while (!isdigit(ch))
f = ch == '-' ? -1 : f, ch = getchar();
while (isdigit(ch))
x = x * 10 + ch - '0', ch = getchar();
x *= f;
}
int cal(int x, int y) {
int z = 1;
while (y) {
if (y & 1) {
// if(z > 2147483647 && x > 2147483647)
// return -1;
z *= x;
}
// if(x > 2147483647) return -1;
x *= x;
y >>= 1;
// if(z <= 0) return -1;
}
return z;
}
void pre() {
for (int i = 2; i <= ceil(sqrt(p)); i++) {
if (!isp[i]) {
isp[i] = i;
prime[++cnt] = i;
}
for (int j = 1; j <= cnt; j++) {
if (prime[j] > isp[i] || i * prime[j] > ceil(sqrt(p)))
break;
isp[i * prime[j]] = prime[j];
}
}
}
signed main() {
in(n), in(p);
if (n == 1) {
cout << 1;
return 0;
}
pre(); // int i = 2;
// while(1){
for (int i = 1; i <= cnt; i++) {
// cout<<prime[i]<<" "<<p<<endl;
if (p < prime[i])
break;
if (p % prime[i])
continue;
while (!(p % prime[i]))
jl[i]++, p /= prime[i];
ans *= cal(prime[i], jl[i] / n);
// if(p == 1) break;
// p /= i;
// i = 1;
}
// int x = cal(i, n);
// cout<<i<<" "<<x<<endl;
// if(x > p || x <= 0) break;
// if(p % x){
// i++;
// continue;
// }
// ans *= i;
// p /= x;
// }
// for(int i = 1; i <= 1000000; i++){
// if(jl[i] < n) continue;
// cout<<i<<" "<<jl[i]<<endl;
// ans *= cal(i, jl[i] / n);
// }
cout << ans;
return 0;
}
| #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#define int long long
using namespace std;
int n, p, ans = 1, cnt;
int jl[10000009];
int prime[10000009], isp[10000009];
template <typename T> inline void in(T &x) {
T ch = getchar(), f = 1;
x = 0;
while (!isdigit(ch))
f = ch == '-' ? -1 : f, ch = getchar();
while (isdigit(ch))
x = x * 10 + ch - '0', ch = getchar();
x *= f;
}
int cal(int x, int y) {
int z = 1;
while (y) {
if (y & 1) {
// if(z > 2147483647 && x > 2147483647)
// return -1;
z *= x;
}
// if(x > 2147483647) return -1;
x *= x;
y >>= 1;
// if(z <= 0) return -1;
}
return z;
}
void pre() {
for (int i = 2; i <= ceil(sqrt(p)); i++) {
if (!isp[i]) {
isp[i] = i;
prime[++cnt] = i;
}
for (int j = 1; j <= cnt; j++) {
if (prime[j] > isp[i] || i * prime[j] > ceil(sqrt(p)))
break;
isp[i * prime[j]] = prime[j];
}
}
}
signed main() {
in(n), in(p);
if (n == 1) {
cout << p;
return 0;
}
pre(); // int i = 2;
// while(1){
for (int i = 1; i <= cnt; i++) {
// cout<<prime[i]<<" "<<p<<endl;
if (p < prime[i])
break;
if (p % prime[i])
continue;
while (!(p % prime[i]))
jl[i]++, p /= prime[i];
ans *= cal(prime[i], jl[i] / n);
// if(p == 1) break;
// p /= i;
// i = 1;
}
// int x = cal(i, n);
// cout<<i<<" "<<x<<endl;
// if(x > p || x <= 0) break;
// if(p % x){
// i++;
// continue;
// }
// ans *= i;
// p /= x;
// }
// for(int i = 1; i <= 1000000; i++){
// if(jl[i] < n) continue;
// cout<<i<<" "<<jl[i]<<endl;
// ans *= cal(i, jl[i] / n);
// }
cout << ans;
return 0;
}
| [
"identifier.replace.add",
"literal.replace.remove",
"io.output.change"
] | 990,459 | 990,460 | u951877666 | cpp |
p03194 | #include <bits/stdc++.h>
using namespace std;
// Define
using ll = int64_t;
using ul = uint64_t;
using ld = long double;
const ll MOD = 1e9 + 7;
const ll INF = LONG_MAX;
const ul MAX = ULONG_MAX;
const char nl = '\n';
#define elif else if
#define def inline auto
#define run __attribute__((constructor)) def _
// Debug
#define debug(x) cerr << (x) << " (L:" << __LINE__ << ")" << '\n'
// 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) inc(i, 0, n)
#define be(c) begin(c), end(c)
// Stream
#define fout(n) cout << fixed << setprecision(n)
#define fasten cin.tie(0), ios::sync_with_stdio(0)
// Speed
run() { fasten, fout(10); }
#pragma GCC optimize("-O3")
#pragma GCC target("avx")
map<ll, ll> prime_factor(ll n) {
ll a = 2;
map<ll, ll> ans;
while (n >= a * a) {
if (n % a == 0) {
++ans[a];
n /= a;
} else {
a++;
}
}
if (n > 1)
++ans[n];
return ans;
}
signed main() {
ll N, P;
cin >> N >> P;
auto mp = prime_factor(P);
ll ans = 1;
for (auto &e : mp) {
ll s = e.second / N;
if (s >= 1) {
ans *= e.first * s;
}
}
cout << ans << nl;
}
| #include <bits/stdc++.h>
using namespace std;
// Define
using ll = int64_t;
using ul = uint64_t;
using ld = long double;
const ll MOD = 1e9 + 7;
const ll INF = LONG_MAX;
const ul MAX = ULONG_MAX;
const char nl = '\n';
#define elif else if
#define def inline auto
#define run __attribute__((constructor)) def _
// Debug
#define debug(x) cerr << (x) << " (L:" << __LINE__ << ")" << '\n'
// 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) inc(i, 0, n)
#define be(c) begin(c), end(c)
// Stream
#define fout(n) cout << fixed << setprecision(n)
#define fasten cin.tie(0), ios::sync_with_stdio(0)
// Speed
run() { fasten, fout(10); }
#pragma GCC optimize("-O3")
#pragma GCC target("avx")
map<ll, ll> prime_factor(ll n) {
ll a = 2;
map<ll, ll> ans;
while (n >= a * a) {
if (n % a == 0) {
++ans[a];
n /= a;
} else {
a++;
}
}
if (n > 1)
++ans[n];
return ans;
}
signed main() {
ll N, P;
cin >> N >> P;
auto mp = prime_factor(P);
ll ans = 1;
for (auto &e : mp) {
ll s = e.second / N;
if (s >= 1) {
ans *= pow(e.first, s);
}
}
cout << ans << nl;
}
| [
"call.add",
"assignment.value.change",
"expression.operation.binary.change",
"call.arguments.change"
] | 990,464 | 990,465 | u874039158 | cpp |
p03194 | #include <cmath>
#include <iostream>
using namespace std;
int main() {
long long n, p;
cin >> n >> p;
long long ans = 1;
for (long long i = 2; i < pow((long double)p, (long double)1 / n); i++) {
if (n == 1) {
ans = p;
break;
}
if (p % (long long)pow((long double)i, (long double)n) == 0)
ans = i;
}
cout << ans << endl;
} | #include <cmath>
#include <iostream>
using namespace std;
int main() {
long long n, p;
cin >> n >> p;
long long ans = 1;
for (long long i = 2; i <= pow((long double)p, (long double)1 / n); i++) {
if (n == 1) {
ans = p;
break;
}
if (p % (long long)pow((long double)i, (long double)n) == 0)
ans = i;
}
cout << ans << endl;
} | [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 990,504 | 990,505 | u636608553 | cpp |
p03196 | #include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
using namespace std;
int main() {
long long n, p;
cin >> n >> p;
long long num = p;
map<long long, long long> T;
for (long long i = 2; i * i <= sqrt(p); i++) {
if (num % i != 0) {
continue;
}
long long count = 0;
while (num % i == 0) {
count++;
num /= i;
}
T[i] = count;
}
if (num != 1) {
T[num] = 1;
}
map<long long, long long>::iterator it;
long long gcd = 1;
for (it = T.begin(); it != T.end(); it++) {
// printf("it->first %lld it->second %lld\n", it->first, it->second);
if (it->second >= n) {
gcd *= pow(it->first, it->second / n);
}
}
cout << gcd << endl;
return 0;
}
| #include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
using namespace std;
int main() {
long long n, p;
cin >> n >> p;
long long num = p;
map<long long, long long> T;
for (long long i = 2; i * i <= p; i++) {
if (num % i != 0) {
continue;
}
long long count = 0;
while (num % i == 0) {
count++;
num /= i;
}
T[i] = count;
}
if (num != 1) {
T[num] = 1;
}
map<long long, long long>::iterator it;
long long gcd = 1;
for (it = T.begin(); it != T.end(); it++) {
// printf("it->first %lld it->second %lld\n", it->first, it->second);
if (it->second >= n) {
gcd *= pow(it->first, it->second / n);
}
}
cout << gcd << endl;
return 0;
}
| [
"control_flow.loop.for.condition.change",
"call.remove",
"call.arguments.change"
] | 990,531 | 990,532 | u418879326 | cpp |
p03196 | #include <bits/stdc++.h>
using namespace std;
struct edge {
int to; // 辺の行き先
int weight; // 辺の重み
edge(int t, int w) : to(t), weight(w) {}
};
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define brep(n) for (int bit = 0; bit < (1 << n); bit++)
#define erep(i, container) for (auto i : container)
#define irep(i, n) for (int i = n - 1; i >= (int)0; i--)
#define rrep(i, m, n) for (int i = m; i < (int)(n); i++)
#define reprep(i, j, h, w) rep(i, h) rep(j, w)
#define all(x) (x).begin(), (x).end()
#define aall(x, n) (x).begin(), (x).begin() + (n)
#define VEC(type, name, n) \
std::vector<type> name(n); \
rep(i, n) std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define res resize
#define as assign
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum accumulate
#define keta fixed << setprecision
#define vvector(name, typ, m, n, a) \
vector<vector<typ>> name(m, vector<typ>(n, a))
#define vvvector(name, t, l, m, n, a) \
vector<vector<vector<t>>> name(l, vector<vector<t>>(m, vector<t>(n, a)));
#define vvvvector(name, t, k, l, m, n, a) \
vector<vector<vector<vector<t>>>> name( \
k, vector<vector<vector<t>>>(l, vector<vector<t>>(m, vector<t>(n, a))));
typedef long long ll;
const int INF = 2000000000;
const ll INF64 = 9223372036854775806ll;
const int mod = 1000000007ll;
const ll MOD = 1000000007LL;
//-0.4620981203755741
map<ll, int> prime_factor(ll n) { //素因数分解
map<ll, int> ret;
for (ll i = 2; i * i <= n; i++) {
while (n % i == 0) {
ret[i]++;
n /= i;
}
}
if (n != 1)
ret[n] = 1;
return ret;
}
int main() {
ll n, p;
std::cin >> n >> p;
std::map<ll, int> m = prime_factor(p);
ll ans = 1;
if (n == 1ll) {
std::cout << p << std::endl;
exit(0);
}
rep(i, sqrt(p) + 1) {
if (m[i] >= n)
ans *= i * (m[i] / n);
// std::cout << m[i] << std::endl;
}
std::cout << ans << std::endl;
} | #include <bits/stdc++.h>
using namespace std;
struct edge {
int to; // 辺の行き先
int weight; // 辺の重み
edge(int t, int w) : to(t), weight(w) {}
};
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define brep(n) for (int bit = 0; bit < (1 << n); bit++)
#define erep(i, container) for (auto i : container)
#define irep(i, n) for (int i = n - 1; i >= (int)0; i--)
#define rrep(i, m, n) for (int i = m; i < (int)(n); i++)
#define reprep(i, j, h, w) rep(i, h) rep(j, w)
#define all(x) (x).begin(), (x).end()
#define aall(x, n) (x).begin(), (x).begin() + (n)
#define VEC(type, name, n) \
std::vector<type> name(n); \
rep(i, n) std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define res resize
#define as assign
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum accumulate
#define keta fixed << setprecision
#define vvector(name, typ, m, n, a) \
vector<vector<typ>> name(m, vector<typ>(n, a))
#define vvvector(name, t, l, m, n, a) \
vector<vector<vector<t>>> name(l, vector<vector<t>>(m, vector<t>(n, a)));
#define vvvvector(name, t, k, l, m, n, a) \
vector<vector<vector<vector<t>>>> name( \
k, vector<vector<vector<t>>>(l, vector<vector<t>>(m, vector<t>(n, a))));
typedef long long ll;
const int INF = 2000000000;
const ll INF64 = 9223372036854775806ll;
const int mod = 1000000007ll;
const ll MOD = 1000000007LL;
//-0.4620981203755741
map<ll, int> prime_factor(ll n) { //素因数分解
map<ll, int> ret;
for (ll i = 2; i * i <= n; i++) {
while (n % i == 0) {
ret[i]++;
n /= i;
}
}
if (n != 1)
ret[n] = 1;
return ret;
}
int main() {
ll n, p;
std::cin >> n >> p;
std::map<ll, int> m = prime_factor(p);
ll ans = 1;
if (n == 1ll) {
std::cout << p << std::endl;
exit(0);
}
rep(i, sqrt(p) + 1) {
if (m[i] >= n)
ans *= pow(i, (m[i] / n));
// if(i==2)std::cout << m[i]/n << std::endl;
}
std::cout << ans << std::endl;
} | [
"call.add",
"assignment.value.change",
"expression.operation.binary.change",
"call.arguments.change"
] | 990,533 | 990,534 | u539011156 | cpp |
p03196 | #include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < n; ++i)
#define FOR(i, b, n) for (ll i = b; i < n; ++i)
using namespace std;
using ll = long long;
void solve(ll N, ll P) {
unordered_map<ll, ll> yakusu;
FOR(i, 2, sqrt(P)) {
while (P % i == 0) {
yakusu[i]++;
P /= i;
}
}
if (P != 1)
yakusu[P]++;
ll ans(1);
for (auto p : yakusu) {
// printf("%lld x %lld\n", p.first, p.second);
REP(i, p.second / N)
ans *= p.first;
}
cout << ans << endl;
}
int main() {
// int 3E4 long 2E9 ll 9E18
cin.tie(0);
ios::sync_with_stdio(false);
ll N, P;
cin >> N >> P;
solve(N, P);
return 0;
}
| #include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < n; ++i)
#define FOR(i, b, n) for (ll i = b; i <= n; ++i)
using namespace std;
using ll = long long;
void solve(ll N, ll P) {
unordered_map<ll, ll> yakusu;
FOR(i, 2, sqrt(P)) {
while (P % i == 0) {
yakusu[i]++;
P /= i;
}
}
if (P != 1)
yakusu[P]++;
ll ans(1);
for (auto p : yakusu) {
// printf("%lld x %lld\n", p.first, p.second);
REP(i, p.second / N)
ans *= p.first;
}
cout << ans << endl;
}
int main() {
// int 3E4 long 2E9 ll 9E18
cin.tie(0);
ios::sync_with_stdio(false);
ll N, P;
cin >> N >> P;
solve(N, P);
return 0;
}
| [
"expression.operator.compare.change",
"preprocessor.define.value.change"
] | 990,547 | 990,548 | u280941196 | cpp |
p03196 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
template <typename T> vector<pair<T, T>> prime_factor(T n) {
vector<pair<T, T>> ret;
for (T i = 2; i * i <= n; i++) {
T tmp = 0;
while (n % i == 0) {
tmp++;
n /= i;
}
ret.push_back(make_pair(i, tmp));
}
if (n != 1)
ret.push_back(make_pair(n, 1));
return ret;
}
int main() {
ll N, M;
cin >> N >> M;
vector<P> A = prime_factor(M);
long long ans = 1;
for (ll i = 0; i < A.size(); i++) {
if (A.at(i).second >= N)
ans *= A.at(i).first * (A.at(i).second / N);
}
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
template <typename T> vector<pair<T, T>> prime_factor(T n) {
vector<pair<T, T>> ret;
for (T i = 2; i * i <= n; i++) {
T tmp = 0;
while (n % i == 0) {
tmp++;
n /= i;
}
ret.push_back(make_pair(i, tmp));
}
if (n != 1)
ret.push_back(make_pair(n, 1));
return ret;
}
int main() {
ll N, M;
cin >> N >> M;
vector<P> A = prime_factor(M);
long long ans = 1;
for (ll i = 0; i < A.size(); i++) {
if (A.at(i).second >= N)
ans *= pow(A.at(i).first, (A.at(i).second / N));
}
cout << ans << endl;
}
| [
"call.add",
"assignment.value.change",
"expression.operation.binary.change",
"call.arguments.change"
] | 990,549 | 990,550 | u815026012 | cpp |
p03196 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define MOD 1000000007
const int INF = 1LL << 30;
vector<pair<long long, long long>> prime_factorize(long long n) {
vector<pair<long long, long long>> res;
for (long long p = 2; p * p <= n; ++p) {
if (n % p != 0)
continue;
int num = 0;
while (n % p == 0) {
++num;
n /= p;
}
res.push_back(make_pair(p, num));
}
if (n != 1)
res.push_back(make_pair(n, 1));
return res;
}
int main() {
ll n, p;
cin >> n >> p;
auto pf = prime_factorize(p);
ll ans = 1;
for (auto p : pf) {
ll tmp = p.second / n;
if (tmp > 0)
ans *= (p.first * tmp);
}
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define MOD 1000000007
const int INF = 1LL << 30;
vector<pair<long long, long long>> prime_factorize(long long n) {
vector<pair<long long, long long>> res;
for (long long p = 2; p * p <= n; ++p) {
if (n % p != 0)
continue;
int num = 0;
while (n % p == 0) {
++num;
n /= p;
}
res.push_back(make_pair(p, num));
}
if (n != 1)
res.push_back(make_pair(n, 1));
return res;
}
int main() {
ll n, p;
cin >> n >> p;
auto pf = prime_factorize(p);
ll ans = 1;
for (auto p : pf) {
ll tmp = p.second / n;
if (tmp > 0)
ans *= pow(p.first, tmp);
}
cout << ans << endl;
} | [
"call.add",
"assignment.value.change",
"expression.operation.binary.change"
] | 990,571 | 990,572 | u633967774 | cpp |
p03196 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define MOD 1000000007
const int INF = 1LL << 30;
vector<pair<long long, long long>> prime_factorize(long long n) {
vector<pair<long long, long long>> res;
for (long long p = 2; p * p <= n; ++p) {
if (n % p != 0)
continue;
int num = 0;
while (n % p == 0) {
++num;
n /= p;
}
res.push_back(make_pair(p, num));
}
if (n != 1)
res.push_back(make_pair(n, 1));
return res;
}
int main() {
ll n, p;
cin >> n >> p;
auto pf = prime_factorize(p);
ll ans = 1;
for (auto p : pf) {
ll tmp = p.second / n;
if (tmp > 0)
ans *= p.first * tmp;
}
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define MOD 1000000007
const int INF = 1LL << 30;
vector<pair<long long, long long>> prime_factorize(long long n) {
vector<pair<long long, long long>> res;
for (long long p = 2; p * p <= n; ++p) {
if (n % p != 0)
continue;
int num = 0;
while (n % p == 0) {
++num;
n /= p;
}
res.push_back(make_pair(p, num));
}
if (n != 1)
res.push_back(make_pair(n, 1));
return res;
}
int main() {
ll n, p;
cin >> n >> p;
auto pf = prime_factorize(p);
ll ans = 1;
for (auto p : pf) {
ll tmp = p.second / n;
if (tmp > 0)
ans *= pow(p.first, tmp);
}
cout << ans << endl;
} | [
"call.add",
"assignment.value.change",
"expression.operation.binary.change",
"call.arguments.change"
] | 990,573 | 990,572 | u633967774 | cpp |
p03196 | #include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, x, n) for (int i = x; i < (n); i++)
#define ALL(n) begin(n), end(n)
#define MOD (1000000007)
#define INF (2e9)
#define INFL (2e18)
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
using vint = vector<int>;
using vll = vector<ll>;
template <class T> using arr = vector<vector<T>>;
template <class T> int popcount(T &a) {
int c = 0;
rep(i, 8 * (int)sizeof(a)) {
if ((a >> i) & 1)
c++;
}
return c;
}
template <class T> void pr(T x) { cout << x << endl; }
template <class T> void prvec(vector<T> &a) {
rep(i, a.size() - 1) { cout << a[i] << " "; }
pr(a[a.size() - 1]);
}
template <class T> void prarr(arr<T> &a) {
rep(i, a.size()) if (a[i].empty()) pr("");
else prvec(a[i]);
}
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, const T &b) {
if (b < a) {
a = b;
return 1;
}
return 0;
}
template <class T> T gcd(T a, T b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
template <class T> T lcm(T a, T b) { return a * b / gcd(a, b); }
ll make(ll n, int k) {
map<ll, int> res;
if (n % 2 == 0) {
while (n != 1 && n % 2 == 0) {
res[2]++;
n /= 2;
}
}
for (ll i = 3; i * i <= n; i += 2) {
while (n != 1 && n % i == 0) {
res[i]++;
n /= i;
}
}
if (n != 1)
res[n]++;
ll ans = 1;
for (auto p : res) {
if (p.second >= k) {
int t = p.second / k;
ans *= (p.first * t);
}
// cout << p.first << " " << p.second << endl;
}
return ans;
}
int main() {
int n;
ll p;
cin >> n >> p;
pr(make(p, n));
return 0;
} | #include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, x, n) for (int i = x; i < (n); i++)
#define ALL(n) begin(n), end(n)
#define MOD (1000000007)
#define INF (2e9)
#define INFL (2e18)
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
using vint = vector<int>;
using vll = vector<ll>;
template <class T> using arr = vector<vector<T>>;
template <class T> int popcount(T &a) {
int c = 0;
rep(i, 8 * (int)sizeof(a)) {
if ((a >> i) & 1)
c++;
}
return c;
}
template <class T> void pr(T x) { cout << x << endl; }
template <class T> void prvec(vector<T> &a) {
rep(i, a.size() - 1) { cout << a[i] << " "; }
pr(a[a.size() - 1]);
}
template <class T> void prarr(arr<T> &a) {
rep(i, a.size()) if (a[i].empty()) pr("");
else prvec(a[i]);
}
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, const T &b) {
if (b < a) {
a = b;
return 1;
}
return 0;
}
template <class T> T gcd(T a, T b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
template <class T> T lcm(T a, T b) { return a * b / gcd(a, b); }
ll make(ll n, int k) {
map<ll, int> res;
if (n % 2 == 0) {
while (n != 1 && n % 2 == 0) {
res[2]++;
n /= 2;
}
}
for (ll i = 3; i * i <= n; i += 2) {
while (n != 1 && n % i == 0) {
res[i]++;
n /= i;
}
}
if (n != 1)
res[n]++;
ll ans = 1;
for (auto p : res) {
if (p.second >= k) {
int t = p.second / k;
ans *= (ll)pow(p.first, t);
}
// cout << p.first << " " << p.second << endl;
}
return ans;
}
int main() {
int n;
ll p;
cin >> n >> p;
pr(make(p, n));
return 0;
} | [
"assignment.value.change",
"expression.operation.binary.change"
] | 990,589 | 990,590 | u370785250 | cpp |
p03196 | #include <algorithm>
#include <cmath>
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Graph = vector<vector<int>>;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define rep(i, N) for (int i = 0; i < N; i++)
#define rep2(i, l, r) for (ll i = (ll)l; i < (ll)(r); i++)
#define INF 1000000000000000000
#define MAX 200001
const ll MOD = 1000000007;
template <typename T> inline string toString(const T &a) {
ostringstream oss;
oss << a;
return oss.str();
};
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>;
ll solve(ll N, ll P) {
ll res = 1;
for (ll i = 2; i * i <= P; i++) {
if (P / i < N)
break;
if (P % i != 0)
continue;
ll cnt = 0;
while (P % i == 0) {
P /= i;
cnt++;
}
if (cnt >= N)
res *= i * (cnt / N);
}
if (P != 1 && N == 1)
res *= P;
return res;
}
int main() {
ll N, P;
cin >> N >> P;
ll ans;
ans = solve(N, P);
cout << ans << endl;
} | #include <algorithm>
#include <cmath>
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Graph = vector<vector<int>>;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define rep(i, N) for (int i = 0; i < N; i++)
#define rep2(i, l, r) for (ll i = (ll)l; i < (ll)(r); i++)
#define INF 1000000000000000000
#define MAX 200001
const ll MOD = 1000000007;
template <typename T> inline string toString(const T &a) {
ostringstream oss;
oss << a;
return oss.str();
};
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>;
ll solve(ll N, ll P) {
ll res = 1;
for (ll i = 2; i * i <= P; i++) {
if (P / i < N)
break;
if (P % i != 0)
continue;
ll cnt = 0;
while (P % i == 0) {
P /= i;
cnt++;
}
if (cnt >= N)
res *= pow(i, (cnt / N));
}
if (P != 1 && N == 1)
res *= P;
return res;
}
int main() {
ll N, P;
cin >> N >> P;
ll ans;
ans = solve(N, P);
cout << ans << endl;
} | [
"call.add",
"assignment.value.change",
"expression.operation.binary.change",
"call.arguments.change"
] | 990,591 | 990,592 | u266874640 | cpp |
p03196 | #include <bits/stdc++.h>
using namespace std;
template <class T> vector<pair<T, T>> prime_factorization(T n) {
vector<pair<T, T>> ret;
for (T i = 2; i * i <= n; i++) {
T cnt = 0;
while (n % i == 0) {
n /= i;
cnt++;
}
if (cnt != 0)
ret.emplace_back(i, cnt);
}
if (n != 1)
ret.emplace_back(n, 1);
return ret;
}
int main() {
int64_t n, p, ans = 1;
cin >> n >> p;
auto a = prime_factorization(p);
for (auto &elm : a)
if (elm.second >= n)
ans *= elm.first * (elm.second / n);
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
template <class T> vector<pair<T, T>> prime_factorization(T n) {
vector<pair<T, T>> ret;
for (T i = 2; i * i <= n; i++) {
T cnt = 0;
while (n % i == 0) {
n /= i;
cnt++;
}
if (cnt != 0)
ret.emplace_back(i, cnt);
}
if (n != 1)
ret.emplace_back(n, 1);
return ret;
}
int main() {
int64_t n, p, ans = 1;
cin >> n >> p;
auto a = prime_factorization(p);
for (auto &elm : a)
if (elm.second >= n)
ans *= pow(elm.first, (elm.second / n));
cout << ans << endl;
return 0;
} | [
"call.add",
"assignment.value.change",
"expression.operation.binary.change",
"call.arguments.change"
] | 990,597 | 990,598 | u666049605 | cpp |
p03196 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
vector<pair<ll, ll>> prime_factorize(ll N) {
vector<pair<ll, ll>> ret;
for (ll a = 2; a * a <= N; a++) {
if (N % a != 0)
continue;
ll ex = 0;
while (N % a == 0) {
ex++;
N /= a;
}
ret.push_back({a, ex});
}
if (N != 1)
ret.push_back({N, 1});
return ret;
}
int main() {
ll n, p;
cin >> n >> p;
auto v = prime_factorize(p);
ll ans = 1;
bool f = false;
for (auto e : v) {
if (e.second >= n)
ans *= e.first * (e.second / n);
}
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
vector<pair<ll, ll>> prime_factorize(ll N) {
vector<pair<ll, ll>> ret;
for (ll a = 2; a * a <= N; a++) {
if (N % a != 0)
continue;
ll ex = 0;
while (N % a == 0) {
ex++;
N /= a;
}
ret.push_back({a, ex});
}
if (N != 1)
ret.push_back({N, 1});
return ret;
}
int main() {
ll n, p;
cin >> n >> p;
auto v = prime_factorize(p);
ll ans = 1;
bool f = false;
for (auto e : v) {
if (e.second >= n)
ans *= pow(e.first, (e.second / n));
}
cout << ans << endl;
return 0;
} | [
"call.add",
"assignment.value.change",
"expression.operation.binary.change",
"call.arguments.change"
] | 990,608 | 990,609 | u893584578 | cpp |
p03196 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long N, P;
cin >> N >> P;
map<long long, long long> mp;
for (long long i = 2; i * i < P; i++) {
while (P % i == 0) {
mp[i]++;
P /= i;
}
}
if (P != 1)
mp[P]++;
long long ans = 1;
for (auto it = mp.begin(); it != mp.end(); it++) {
while (it->second >= N) {
it->second -= N;
ans *= it->first;
}
}
cout << ans << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
long long N, P;
cin >> N >> P;
map<long long, long long> mp;
for (long long i = 2; i * i <= P; i++) {
while (P % i == 0) {
mp[i]++;
P /= i;
}
}
if (P != 1)
mp[P]++;
long long ans = 1;
for (auto it = mp.begin(); it != mp.end(); it++) {
while (it->second >= N) {
it->second -= N;
ans *= it->first;
}
}
cout << ans << endl;
}
| [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 990,623 | 990,624 | u987039629 | cpp |
p03196 | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define reps(i, n) for (int i = 1; i <= (int)n; i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define LB(a, x) lb(all(a), x) - a.begin()
#define UB(a, x) ub(all(a), x) - a.begin()
#define MOD 1000000007
#define itn int
#define enld endl
using namespace std;
typedef long long ll;
const double pi = 3.141592653589793;
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, const T &b) {
if (b < a) {
a = b;
return 1;
}
return 0;
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
std::fill((T *)array, (T *)(array + N), val);
}
vector<pair<long long, long long>> prime_factorize(long long N) {
vector<pair<long long, long long>> res;
for (long long a = 2; a * a <= N; ++a) {
if (N % a != 0)
continue;
long long ex = 0;
while (N % a == 0) {
++ex;
N /= a;
}
res.push_back({a, ex});
}
if (N != 1)
res.push_back({N, 1});
return res;
}
int main() {
ll N, P;
cin >> N >> P;
if (N == 1) {
cout << P << endl;
return 0;
}
ll ans = 1;
vector<pair<ll, ll>> v = prime_factorize(P);
// sort(allr(v));
for (auto itr = v.begin(); itr != v.end(); itr++) {
if (itr->second >= N) {
ans *= (itr->fs) * ((itr->second) / N);
}
}
cout << ans << endl;
return 0;
} | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define reps(i, n) for (int i = 1; i <= (int)n; i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define LB(a, x) lb(all(a), x) - a.begin()
#define UB(a, x) ub(all(a), x) - a.begin()
#define MOD 1000000007
#define itn int
#define enld endl
using namespace std;
typedef long long ll;
const double pi = 3.141592653589793;
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, const T &b) {
if (b < a) {
a = b;
return 1;
}
return 0;
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
std::fill((T *)array, (T *)(array + N), val);
}
vector<pair<long long, long long>> prime_factorize(long long N) {
vector<pair<long long, long long>> res;
for (long long a = 2; a * a <= N; ++a) {
if (N % a != 0)
continue;
long long ex = 0;
while (N % a == 0) {
++ex;
N /= a;
}
res.push_back({a, ex});
}
if (N != 1)
res.push_back({N, 1});
return res;
}
int main() {
ll N, P;
cin >> N >> P;
if (N == 1) {
cout << P << endl;
return 0;
}
ll ans = 1;
vector<pair<ll, ll>> v = prime_factorize(P);
// sort(allr(v));
for (auto itr = v.begin(); itr != v.end(); itr++) {
if (itr->second >= N) {
ans *= pow(itr->fs, (itr->second) / N);
}
}
cout << ans << endl;
return 0;
} | [
"call.add",
"assignment.value.change",
"expression.operation.binary.change",
"expression.operation.binary.remove"
] | 990,627 | 990,628 | u238205921 | cpp |
p03196 | // lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで
#include <bits/stdc++.h>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define REP(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
ll dx[4] = {1, 0, -1, 0};
ll dy[4] = {0, 1, 0, -1};
map<int64_t, int> prime_factor(int64_t n) {
map<int64_t, int> ret;
for (int64_t i = 2; i * i <= n; i++) {
while (n % i == 0) {
ret[i]++;
n /= i;
}
}
if (n != 1)
ret[n] = 1;
return ret;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
ll a, b, d, n, maxi = 0, f = 0, mini = INF, sum = 0;
string str;
cin >> a >> n;
set<ll> s;
map<ll, ll> m;
// cout << n << ":";
sum = 1;
for (auto p : prime_factor(n)) {
if (p.second >= a)
sum *= p.first * (p.second / a);
}
cout << sum << endl;
return 0;
}
| // lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで
#include <bits/stdc++.h>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define REP(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
ll dx[4] = {1, 0, -1, 0};
ll dy[4] = {0, 1, 0, -1};
map<int64_t, int> prime_factor(int64_t n) {
map<int64_t, int> ret;
for (int64_t i = 2; i * i <= n; i++) {
while (n % i == 0) {
ret[i]++;
n /= i;
}
}
if (n != 1)
ret[n] = 1;
return ret;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
ll a, b, d, n, maxi = 0, f = 0, mini = INF, sum = 0;
string str;
cin >> a >> n;
set<ll> s;
map<ll, ll> m;
// cout << n << ":";
sum = 1;
for (auto p : prime_factor(n)) {
while (p.second >= a) {
sum *= p.first;
(p.second -= a);
}
}
cout << sum << endl;
return 0;
}
| [
"control_flow.branch.while.replace.add",
"control_flow.loop.if.replace.remove",
"expression.operation.binary.change"
] | 990,643 | 990,644 | u683769494 | cpp |
p03196 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll n, p;
cin >> n >> p;
ll ans = 1;
ll div = 2;
if (n == 1) {
ans = p;
} else {
while (p > pow(div, n)) {
ll m = 0;
while (p % div == 0) {
m++;
p = p / div;
}
if (m >= n)
ans *= pow(div, m / n);
div++;
}
}
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll n, p;
cin >> n >> p;
ll ans = 1;
ll div = 2;
if (n == 1) {
ans = p;
} else {
while (p >= pow(div, n)) {
ll m = 0;
while (p % div == 0) {
m++;
p = p / div;
}
if (m >= n)
ans *= pow(div, m / n);
div++;
}
}
cout << ans << endl;
} | [
"expression.operator.compare.change",
"control_flow.loop.condition.change"
] | 990,645 | 990,646 | u732578115 | cpp |
p03196 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < int(n); i++)
#define vi vector<int>
#define all(x) (x).begin(), (x).end()
#define INF (1 << 30) - 1
using ll = long long;
using namespace std;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template <class T> inline bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, const T &b) {
if (b < a) {
a = b;
return 1;
}
return 0;
}
inline map<ll, int> sieve(ll n) {
map<ll, int> PrimeNumber;
for (ll i = 2; i * i <= n; i++) {
while (n % i == 0) {
PrimeNumber[i]++;
n /= i;
}
}
if (n != 1)
PrimeNumber[n] = 1;
return PrimeNumber;
}
int main() {
cin.tie(0), ios::sync_with_stdio(false);
ll n, p;
cin >> n >> p;
auto res = sieve(p);
ll ans = 1;
for (auto x : res) {
if (0 < x.second / n)
ans *= x.first * (x.second / n);
}
cout << ans;
cout << "\n";
return 0;
}
| #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < int(n); i++)
#define vi vector<int>
#define all(x) (x).begin(), (x).end()
#define INF (1 << 30) - 1
using ll = long long;
using namespace std;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template <class T> inline bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, const T &b) {
if (b < a) {
a = b;
return 1;
}
return 0;
}
inline map<ll, int> sieve(ll n) {
map<ll, int> PrimeNumber;
for (ll i = 2; i * i <= n; i++) {
while (n % i == 0) {
PrimeNumber[i]++;
n /= i;
}
}
if (n != 1)
PrimeNumber[n] = 1;
return PrimeNumber;
}
int main() {
cin.tie(0), ios::sync_with_stdio(false);
ll n, p;
cin >> n >> p;
auto res = sieve(p);
ll ans = 1;
for (auto x : res) {
if (0 < x.second / n)
ans *= pow(x.first, x.second / n);
}
cout << ans;
cout << "\n";
return 0;
}
| [
"call.add",
"assignment.value.change",
"expression.operation.binary.change"
] | 990,663 | 990,664 | u667375816 | cpp |
p03196 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < int(n); i++)
#define vi vector<int>
#define all(x) (x).begin(), (x).end()
#define INF (1 << 30) - 1
using ll = long long;
using namespace std;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template <class T> inline bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, const T &b) {
if (b < a) {
a = b;
return 1;
}
return 0;
}
inline map<ll, int> sieve(ll n) {
map<ll, int> PrimeNumber;
for (ll i = 2; i * i <= n; i++) {
while (n % i == 0) {
PrimeNumber[i]++;
n /= i;
}
}
if (n != 1)
PrimeNumber[n] = 1;
return PrimeNumber;
}
int main() {
cin.tie(0), ios::sync_with_stdio(false);
ll n, p;
cin >> n >> p;
auto res = sieve(p);
ll ans = 1;
for (auto x : res) {
if (0 < x.second / n)
ans *= x.first * (x.second / 4);
}
cout << ans;
cout << "\n";
return 0;
}
| #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < int(n); i++)
#define vi vector<int>
#define all(x) (x).begin(), (x).end()
#define INF (1 << 30) - 1
using ll = long long;
using namespace std;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template <class T> inline bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, const T &b) {
if (b < a) {
a = b;
return 1;
}
return 0;
}
inline map<ll, int> sieve(ll n) {
map<ll, int> PrimeNumber;
for (ll i = 2; i * i <= n; i++) {
while (n % i == 0) {
PrimeNumber[i]++;
n /= i;
}
}
if (n != 1)
PrimeNumber[n] = 1;
return PrimeNumber;
}
int main() {
cin.tie(0), ios::sync_with_stdio(false);
ll n, p;
cin >> n >> p;
auto res = sieve(p);
ll ans = 1;
for (auto x : res) {
if (0 < x.second / n)
ans *= pow(x.first, x.second / n);
}
cout << ans;
cout << "\n";
return 0;
}
| [
"call.add",
"assignment.value.change",
"expression.operation.binary.change",
"identifier.replace.add",
"literal.replace.remove"
] | 990,665 | 990,664 | u667375816 | cpp |
p03196 | #include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INFLL LLONG_MAX // 9223372036854775807
#define EPS 1e-9
#define rep(i, n) for (ll i = 0, i##_len = (ll)(n); i < i##_len; i++)
#define repf(i, n) for (ll i = 1, i##_len = (ll)(n + 1); i < i##_len; i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() \
std::ios::sync_with_stdio(false); \
std::cin.tie(0); \
std::cout << fixed << setprecision(15);
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;
// 素因数分解:nの素因数分解を{素数, 指数}の形で昇順に返す。
vector<pair<long long, long long>> primeFactorize(long long n) {
vector<pair<long long, long long>> ret;
for (long long i = 2; i * i <= n; i++) {
if (n % i != 0)
continue;
long long ex = 0;
while (n % i == 0) {
ex++;
n /= i;
}
ret.push_back({i, ex});
}
if (n != 1)
ret.push_back({n, 1});
return ret;
}
int main() {
Init();
ll n, p, ans = 1;
cin >> n >> p;
auto pFac = primeFactorize(p);
for (auto &num : pFac)
if (num.second >= n)
ans *= num.first * (ll)(1.0 * num.second / n);
cout << ans << endl;
} | #include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INFLL LLONG_MAX // 9223372036854775807
#define EPS 1e-9
#define rep(i, n) for (ll i = 0, i##_len = (ll)(n); i < i##_len; i++)
#define repf(i, n) for (ll i = 1, i##_len = (ll)(n + 1); i < i##_len; i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() \
std::ios::sync_with_stdio(false); \
std::cin.tie(0); \
std::cout << fixed << setprecision(15);
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;
// 素因数分解:nの素因数分解を{素数, 指数}の形で昇順に返す。
vector<pair<long long, long long>> primeFactorize(long long n) {
vector<pair<long long, long long>> ret;
for (long long i = 2; i * i <= n; i++) {
if (n % i != 0)
continue;
long long ex = 0;
while (n % i == 0) {
ex++;
n /= i;
}
ret.push_back({i, ex});
}
if (n != 1)
ret.push_back({n, 1});
return ret;
}
int main() {
Init();
ll n, p, ans = 1;
cin >> n >> p;
auto pFac = primeFactorize(p);
for (auto &num : pFac)
if (num.second >= n)
ans *= pow(num.first, (ll)(1.0 * num.second / n));
cout << ans << endl;
} | [
"call.add",
"assignment.value.change",
"expression.operation.binary.change",
"call.arguments.change"
] | 990,666 | 990,667 | u548791035 | cpp |
p03196 | #include <bits/stdc++.h>
using namespace std;
int main() {
int64_t N, P, p, tmp, res = 1;
cin >> N >> P;
if (N == 1) {
cout << P << endl;
return 0;
}
vector<pair<int, int>> D(0);
p = P;
for (int i = 2; i <= sqrt(P); i++) {
if (p == 1)
break;
if (p % i == 0) {
if (D.size() > 0 && D.at(D.size() - 1).first == i) {
D.at(D.size() - 1).second++;
} else {
D.push_back(make_pair(i, 1));
}
p /= i;
i--;
}
}
for (int i = 0; i < D.size(); i++) {
tmp = D.at(i).first * (D.at(i).second / N);
if (tmp != 0)
res *= tmp;
}
cout << res << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int64_t N, P, p, tmp, res = 1;
cin >> N >> P;
if (N == 1) {
cout << P << endl;
return 0;
}
vector<pair<int, int>> D(0);
p = P;
for (int i = 2; i <= sqrt(P); i++) {
if (p == 1)
break;
if (p % i == 0) {
if (D.size() > 0 && D.at(D.size() - 1).first == i) {
D.at(D.size() - 1).second++;
} else {
D.push_back(make_pair(i, 1));
}
p /= i;
i--;
}
}
for (int i = 0; i < D.size(); i++) {
tmp = pow(D.at(i).first, (D.at(i).second / N));
if (tmp != 0)
res *= tmp;
}
cout << res << endl;
}
| [
"call.add",
"assignment.value.change",
"expression.operation.binary.change",
"call.arguments.change"
] | 990,670 | 990,671 | u543466827 | cpp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.