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 |
|---|---|---|---|---|---|---|---|
p02972 | #include <bits/stdc++.h>
#define N 200010
using namespace std;
int n, m = 0;
int a[N];
int f[N];
int main() {
memset(f, 0, sizeof(f));
scanf("%d", &n);
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]);
for (int i = n; i >= 1; i--) {
int tot = 0;
for (int j = 1; j <= n; j += i)
tot += f[j];
if (tot % 2 != a[i])
f[i] = 1;
}
for (int i = 1; i <= n; i++)
m += f[i];
printf("%d\n", m);
for (int i = 1; i <= n; i++)
if (f[i])
printf("%d ", i);
return 0;
} | #include <bits/stdc++.h>
#define N 200010
using namespace std;
int n, m = 0;
int a[N];
int f[N];
int main() {
memset(f, 0, sizeof(f));
scanf("%d", &n);
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]);
for (int i = n; i >= 1; i--) {
int tot = 0;
for (int j = i; j <= n; j += i)
tot += f[j];
if (tot % 2 != a[i])
f[i] = 1;
}
for (int i = 1; i <= n; i++)
m += f[i];
printf("%d\n", m);
for (int i = 1; i <= n; i++)
if (f[i])
printf("%d ", i);
return 0;
} | [
"variable_declaration.value.change",
"identifier.replace.add",
"literal.replace.remove",
"control_flow.loop.for.initializer.change"
] | 778,699 | 778,700 | u091286840 | cpp |
p02972 | #include <bits/stdc++.h>
#define N 200010
using namespace std;
int n, m = 0;
int a[N];
int f[N];
int main() {
memset(f, 0, sizeof(f));
scanf("%d", &n);
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]);
for (int i = n; i >= 1; i--) {
int tot = 0;
for (int j = i; j <= n; j += i)
tot += f[i];
if (tot % 2 != a[i])
f[i] = 1;
}
for (int i = 1; i <= n; i++)
m += f[i];
printf("%d\n", m);
for (int i = 1; i <= n; i++)
if (f[i])
printf("%d ", i);
return 0;
} | #include <bits/stdc++.h>
#define N 200010
using namespace std;
int n, m = 0;
int a[N];
int f[N];
int main() {
memset(f, 0, sizeof(f));
scanf("%d", &n);
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]);
for (int i = n; i >= 1; i--) {
int tot = 0;
for (int j = i; j <= n; j += i)
tot += f[j];
if (tot % 2 != a[i])
f[i] = 1;
}
for (int i = 1; i <= n; i++)
m += f[i];
printf("%d\n", m);
for (int i = 1; i <= n; i++)
if (f[i])
printf("%d ", i);
return 0;
} | [
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change"
] | 778,701 | 778,700 | u091286840 | cpp |
p02972 | #include <bits/stdc++.h>
#define N 200010
using namespace std;
int n, m = 0;
int a[N];
int f[N];
int main() {
memset(f, 0, sizeof(f));
scanf("%d", &n);
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]);
for (int i = n; i >= 1; i--) {
int tot = 0;
for (int j = i; j <= n; j += i)
tot += (int)f[i];
if (tot % 2 != a[i])
f[i] = 1;
}
for (int i = 1; i <= n; i++)
m += f[i];
printf("%d\n", m);
for (int i = 1; i <= n; i++)
if (f[i])
printf("%d ", i);
return 0;
} | #include <bits/stdc++.h>
#define N 200010
using namespace std;
int n, m = 0;
int a[N];
int f[N];
int main() {
memset(f, 0, sizeof(f));
scanf("%d", &n);
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]);
for (int i = n; i >= 1; i--) {
int tot = 0;
for (int j = i; j <= n; j += i)
tot += f[j];
if (tot % 2 != a[i])
f[i] = 1;
}
for (int i = 1; i <= n; i++)
m += f[i];
printf("%d\n", m);
for (int i = 1; i <= n; i++)
if (f[i])
printf("%d ", i);
return 0;
} | [
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change"
] | 778,702 | 778,700 | u091286840 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
int n, m = 0, a[200010], b[200010];
int main() {
cin >> n;
for (int i = 1; i <= n; i++)
scanf("%d", a + i);
for (int i = n; i >= 1; i--) {
int s = 0;
for (int j = i; j <= n; j += i)
s += b[i];
s %= 2;
if (s != a[i])
b[i] = 1, m++;
}
cout << m << endl;
for (int i = 1; i <= n; i++)
if (b[i])
cout << i << " ";
}
| #include <bits/stdc++.h>
using namespace std;
int n, m = 0, a[200010], b[200010];
int main() {
cin >> n;
for (int i = 1; i <= n; i++)
scanf("%d", a + i);
for (int i = n; i >= 1; i--) {
int s = 0;
for (int j = i; j <= n; j += i)
s += b[j];
s &= 1;
if (s != a[i])
b[i] = 1, m++;
}
cout << m << endl;
for (int i = 1; i <= n; i++)
if (b[i])
cout << i << " ";
} | [
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change",
"assignment.change"
] | 778,708 | 778,709 | u709966987 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
int n, m = 0, a[200010], b[200010] = {0};
int main() {
cin >> n;
for (int i = 1; i <= n; i++)
scanf("%d", a + i);
for (int i = n; i >= 1; i--) {
int s = 0;
for (int j = i; j <= n; j += i)
s += b[i];
s &= 1;
if (s != a[i])
b[i] = 1, m++;
}
cout << m << endl;
for (int i = 1; i <= n; i++)
if (b[i])
cout << i << " ";
}
| #include <bits/stdc++.h>
using namespace std;
int n, m = 0, a[200010], b[200010];
int main() {
cin >> n;
for (int i = 1; i <= n; i++)
scanf("%d", a + i);
for (int i = n; i >= 1; i--) {
int s = 0;
for (int j = i; j <= n; j += i)
s += b[j];
s &= 1;
if (s != a[i])
b[i] = 1, m++;
}
cout << m << endl;
for (int i = 1; i <= n; i++)
if (b[i])
cout << i << " ";
} | [
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change"
] | 778,710 | 778,709 | u709966987 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
int n, m = 0, a[200010], b[200010];
int main() {
cin >> n;
for (int i = 1; i <= n; i++)
scanf("%d", a + i);
for (int i = n; i >= 1; i--) {
int s = 0;
for (int j = i; j <= n; j += i)
s += b[i];
s &= 1;
if (s != a[i])
b[i] = 1, m++;
}
cout << m << endl;
for (int i = 1; i <= n; i++)
if (b[i])
cout << i << " ";
} | #include <bits/stdc++.h>
using namespace std;
int n, m = 0, a[200010], b[200010];
int main() {
cin >> n;
for (int i = 1; i <= n; i++)
scanf("%d", a + i);
for (int i = n; i >= 1; i--) {
int s = 0;
for (int j = i; j <= n; j += i)
s += b[j];
s &= 1;
if (s != a[i])
b[i] = 1, m++;
}
cout << m << endl;
for (int i = 1; i <= n; i++)
if (b[i])
cout << i << " ";
} | [
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change"
] | 778,711 | 778,709 | u709966987 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
int N;
cin >> N;
vector<int> a(N + 1);
for (int i = 1; i <= N; i++) {
cin >> a[i];
}
vector<int> cnt(N + 1);
for (int i = N; i >= 1; i--) {
int c = 0;
for (int j = i * 2; j <= N; j += i) {
c += cnt[i];
}
if (c % 2 != a[i]) {
cnt[i] = 1;
}
}
vector<int> ans;
for (int i = 1; i <= N; i++) {
if (cnt[i] == 1)
ans.push_back(i);
}
cout << ans.size() << endl;
for (int i = 0; i < ans.size(); i++) {
cout << ans[i] << ' ';
}
cout << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
int N;
cin >> N;
vector<int> a(N + 1);
for (int i = 1; i <= N; i++) {
cin >> a[i];
}
vector<int> cnt(N + 1);
for (int i = N; i >= 1; i--) {
int c = 0;
for (int j = i * 2; j <= N; j += i) {
c += cnt[j];
}
if (c % 2 != a[i]) {
cnt[i] = 1;
}
}
vector<int> ans;
for (int i = 1; i <= N; i++) {
if (cnt[i] == 1)
ans.push_back(i);
}
cout << ans.size() << endl;
for (int i = 0; i < ans.size(); i++) {
cout << ans[i] << ' ';
}
cout << endl;
return 0;
}
| [
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change"
] | 778,712 | 778,713 | u738450435 | cpp |
p02972 | /*
1. I'm the Future Red Coder :)
2. Hopefully, I'll be Yellow Soon.
*/
#include <bits/stdc++.h>
#define mod 998244353 // 1000000007
#define lim 1000000000000000007
#define lim1 18446744073709551615 // Unsigned
#define sq(a) ((a) * (a))
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define mms(v, i) memset(v, i, sizeof(v))
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define REP(i, a, b) for (int i = a; i <= b; i++)
#define REPN(i, a, b) for (int i = a; i >= b; i--)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> PL;
typedef pair<ll, int> PLI;
typedef pair<int, ll> PIL;
typedef pair<int, pair<int, int>> pii;
ll power(ll a, ll b, ll m = mod) {
if (b == 0)
return 1;
ll c = power(a, b >> 1, m);
c = (c * c) % m;
if (b & 1)
return (c * a) % m;
return c;
}
ll gcdll(ll a, ll b) {
if (b == 0)
return a;
return gcdll(b, a % b);
}
int gcd(int a, int b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
/*struct node {
int l,r,nq;
};
bool compare(const node& a,const node& b) {
if (a.r != b.r) return a.r<b.r;
return a.l<b.l;
}*/
/* ******* DSU START ****** */
/*
const int dsusize = (int)1e5+5;
struct node {
int data;
int rk,pn;
}dsu[dsusize];
//ll fans;
void initialize(int n) {
REP(i,1,n) {
dsu[i].data = 1;
dsu[i].rk = 0;
dsu[i].pn = i;
}
}
int fnd(int i) {
if (dsu[i].pn != i) dsu[i].pn = fnd(dsu[i].pn);
return dsu[i].pn;
}
void unn(int i,int j) {
i = fnd(i);
j = fnd(j);
if (i!=j) {
//fans -= dsu[i].data*dsu[j].data;
if (dsu[i].rk>dsu[j].rk) {
dsu[j].pn = i;
dsu[i].data += dsu[j].data;
}
else {
dsu[i].pn = j;
dsu[j].data += dsu[i].data;
if (dsu[i].rk==dsu[j].rk) {
dsu[j].rk++;
}
}
}
}
*/
/* ******* DSU END****** */
const int N = (int)2e5 + 5;
const int Q = 250;
int a[N];
vector<int> v;
void solve() {
int n;
cin >> n;
REP(i, 1, n) { cin >> a[i]; }
REPN(i, n, 1) {
int cnt = 0;
for (int j = 2 * i; j <= n; j += i) {
cnt += (a[i] == 1);
}
a[i] = (cnt % 2 != a[i] % 2);
if (a[i] == 1)
v.pb(i);
}
reverse(all(v));
cout << v.size() << "\n";
for (auto it : v) {
cout << it << " ";
}
}
int main() {
// freopen("class_treasurer.txt","r",stdin);
// freopen("output.txt","w",stdout);
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int T = 1;
// cin>>T;
REP(TC, 1, T) {
// cout<<"Case #"<<TC<<": ";
solve();
cout << "\n";
}
}
| /*
1. I'm the Future Red Coder :)
2. Hopefully, I'll be Yellow Soon.
*/
#include <bits/stdc++.h>
#define mod 998244353 // 1000000007
#define lim 1000000000000000007
#define lim1 18446744073709551615 // Unsigned
#define sq(a) ((a) * (a))
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define mms(v, i) memset(v, i, sizeof(v))
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define REP(i, a, b) for (int i = a; i <= b; i++)
#define REPN(i, a, b) for (int i = a; i >= b; i--)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> PL;
typedef pair<ll, int> PLI;
typedef pair<int, ll> PIL;
typedef pair<int, pair<int, int>> pii;
ll power(ll a, ll b, ll m = mod) {
if (b == 0)
return 1;
ll c = power(a, b >> 1, m);
c = (c * c) % m;
if (b & 1)
return (c * a) % m;
return c;
}
ll gcdll(ll a, ll b) {
if (b == 0)
return a;
return gcdll(b, a % b);
}
int gcd(int a, int b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
/*struct node {
int l,r,nq;
};
bool compare(const node& a,const node& b) {
if (a.r != b.r) return a.r<b.r;
return a.l<b.l;
}*/
/* ******* DSU START ****** */
/*
const int dsusize = (int)1e5+5;
struct node {
int data;
int rk,pn;
}dsu[dsusize];
//ll fans;
void initialize(int n) {
REP(i,1,n) {
dsu[i].data = 1;
dsu[i].rk = 0;
dsu[i].pn = i;
}
}
int fnd(int i) {
if (dsu[i].pn != i) dsu[i].pn = fnd(dsu[i].pn);
return dsu[i].pn;
}
void unn(int i,int j) {
i = fnd(i);
j = fnd(j);
if (i!=j) {
//fans -= dsu[i].data*dsu[j].data;
if (dsu[i].rk>dsu[j].rk) {
dsu[j].pn = i;
dsu[i].data += dsu[j].data;
}
else {
dsu[i].pn = j;
dsu[j].data += dsu[i].data;
if (dsu[i].rk==dsu[j].rk) {
dsu[j].rk++;
}
}
}
}
*/
/* ******* DSU END****** */
const int N = (int)2e5 + 5;
const int Q = 250;
int a[N];
vector<int> v;
void solve() {
int n;
cin >> n;
REP(i, 1, n) { cin >> a[i]; }
REPN(i, n, 1) {
int cnt = 0;
for (int j = 2 * i; j <= n; j += i) {
cnt += (a[j] == 1);
}
a[i] = (cnt % 2 != a[i] % 2);
if (a[i] == 1)
v.pb(i);
}
reverse(all(v));
cout << v.size() << "\n";
for (auto it : v) {
cout << it << " ";
}
}
int main() {
// freopen("class_treasurer.txt","r",stdin);
// freopen("output.txt","w",stdout);
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int T = 1;
// cin>>T;
REP(TC, 1, T) {
// cout<<"Case #"<<TC<<": ";
solve();
cout << "\n";
}
}
| [
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change",
"expression.operation.binary.change"
] | 778,714 | 778,715 | u921940646 | cpp |
p02972 | #include <iostream>
#include <vector>
using namespace std;
int main() {
int n, t;
cin >> n;
int a[200005], b[200005] = {0};
vector<int> ans;
int cnt = 0;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
for (int i = n; i >= 1; i--) {
t = 0;
for (int j = 2 * i; j <= n; j += i) {
if (b[j]) {
t++;
}
}
if (b[i] % 2 != a[i]) {
b[i] = 1;
ans.push_back(i);
}
}
cout << ans.size() << endl;
vector<int>::iterator it = ans.begin();
if (!ans.empty()) {
cout << *it;
for (it++; it != ans.end(); it++) {
cout << " " << *it;
}
cout << endl;
}
return 0;
} | #include <iostream>
#include <vector>
using namespace std;
int main() {
int n, t;
cin >> n;
int a[200005], b[200005] = {0};
vector<int> ans;
int cnt = 0;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
for (int i = n; i >= 1; i--) {
t = 0;
for (int j = 2 * i; j <= n; j += i) {
if (b[j]) {
t++;
}
}
if (t % 2 != a[i]) {
b[i] = 1;
ans.push_back(i);
}
}
cout << ans.size() << endl;
vector<int>::iterator it = ans.begin();
if (!ans.empty()) {
cout << *it;
for (it++; it != ans.end(); it++) {
cout << " " << *it;
}
cout << endl;
}
return 0;
} | [
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change"
] | 778,716 | 778,717 | u754325138 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 9;
const int MOD = 2;
int n;
int a[N], b[N];
int main() {
cin >> n;
for (int i = 1; i <= n; i++)
cin >> a[i];
for (int i = n; i >= 1; i--) {
b[i] = a[i];
for (int j = 2 * i; j < n; j += i) {
b[i] -= b[j];
b[i] = (b[i] + MOD) % MOD;
}
}
vector<int> ans;
for (int i = 1; i <= n; i++)
if (b[i] == 1)
ans.push_back(i);
cout << ans.size() << endl;
for (int i = 0; i < ans.size(); i++)
cout << ans[i] << (i == ans.size() - 1 ? "\n" : " ");
} | #include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 9;
const int MOD = 2;
int n;
int a[N], b[N];
int main() {
cin >> n;
for (int i = 1; i <= n; i++)
cin >> a[i];
for (int i = n; i >= 1; i--) {
b[i] = a[i];
for (int j = 2 * i; j <= n; j += i) {
b[i] -= b[j];
b[i] = (b[i] + MOD) % MOD;
}
}
vector<int> ans;
for (int i = 1; i <= n; i++)
if (b[i] == 1)
ans.push_back(i);
cout << ans.size() << endl;
for (int i = 0; i < ans.size(); i++)
cout << ans[i] << (i == ans.size() - 1 ? "\n" : " ");
} | [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 778,718 | 778,719 | u194268736 | cpp |
p02972 | #include <iostream>
#include <vector>
using namespace std;
int main(void) {
int n;
cin >> n;
vector<int> a(n, 0);
vector<int> ret(n, 0);
for (int i = 0; i < n; i++)
cin >> a[i];
int k = n;
while (k > 1) {
int l = k;
k = k / 2 + 1;
for (int i = k; i <= l; i++) {
int bit = 0;
for (int j = 2 * i; j <= n; j += i) {
bit = (bit + ret[j - 1]) % 2;
}
ret[i - 1] = (bit + a[i - 1]) % 2;
}
k--;
}
int bit = 0;
int num = 0;
for (int i = 0; i < n; i++) {
if (ret[i] == 1)
num++;
bit = (bit + ret[i]) % 2;
}
if (bit == a[0])
ret[0] = 0;
else {
num++;
ret[0] = 1;
}
cout << num << endl;
for (int i = 0; i < n; i++) {
if (ret[i] == 1)
cout << ret[i] << (i == n - 1 ? "" : " ");
}
cout << endl;
} | #include <iostream>
#include <vector>
using namespace std;
int main(void) {
int n;
cin >> n;
vector<int> a(n, 0);
vector<int> ret(n, 0);
for (int i = 0; i < n; i++)
cin >> a[i];
int k = n;
while (k > 1) {
int l = k;
k = k / 2 + 1;
for (int i = k; i <= l; i++) {
int bit = 0;
for (int j = 2 * i; j <= n; j += i) {
bit = (bit + ret[j - 1]) % 2;
}
ret[i - 1] = (bit + a[i - 1]) % 2;
}
k--;
}
int bit = 0;
int num = 0;
for (int i = 0; i < n; i++) {
if (ret[i] == 1)
num++;
bit = (bit + ret[i]) % 2;
}
if (bit == a[0])
ret[0] = 0;
else {
num++;
ret[0] = 1;
}
cout << num << endl;
for (int i = 0; i < n; i++) {
if (ret[i] == 1)
cout << i + 1 << (i == n - 1 ? "" : " ");
}
cout << endl;
} | [
"io.output.change"
] | 778,724 | 778,725 | u755121033 | cpp |
p02972 | #include <iostream>
#include <vector>
using namespace std;
int main(void) {
int n;
cin >> n;
vector<int> a(n, 0);
vector<int> ret(n, 0);
for (int i = 0; i < n; i++)
cin >> a[i];
int k = n;
while (k > 0) {
int l = k;
k = k / 2 + 1;
for (int i = k; i <= l; i++) {
int bit = 0;
for (int j = 2 * i; j <= n; j += i) {
bit = (bit + ret[j - 1]) % 2;
}
ret[i - 1] = (bit + a[i - 1]) % 2;
}
k--;
}
int bit = 0;
int num = 0;
for (int i = 1; i < n; i++) {
if (ret[i] == 1)
num++;
bit = (bit + ret[i]) % 2;
}
if (bit == a[0])
ret[0] = 0;
else {
num++;
ret[0] = 1;
}
cout << num << endl;
for (int i = 0; i < n; i++) {
if (ret[i] == 1)
cout << ret[i] << (i == n - 1 ? "" : " ");
}
cout << endl;
} | #include <iostream>
#include <vector>
using namespace std;
int main(void) {
int n;
cin >> n;
vector<int> a(n, 0);
vector<int> ret(n, 0);
for (int i = 0; i < n; i++)
cin >> a[i];
int k = n;
while (k > 1) {
int l = k;
k = k / 2 + 1;
for (int i = k; i <= l; i++) {
int bit = 0;
for (int j = 2 * i; j <= n; j += i) {
bit = (bit + ret[j - 1]) % 2;
}
ret[i - 1] = (bit + a[i - 1]) % 2;
}
k--;
}
int bit = 0;
int num = 0;
for (int i = 0; i < n; i++) {
if (ret[i] == 1)
num++;
bit = (bit + ret[i]) % 2;
}
if (bit == a[0])
ret[0] = 0;
else {
num++;
ret[0] = 1;
}
cout << num << endl;
for (int i = 0; i < n; i++) {
if (ret[i] == 1)
cout << i + 1 << (i == n - 1 ? "" : " ");
}
cout << endl;
} | [
"literal.number.change",
"control_flow.loop.condition.change",
"variable_declaration.value.change",
"control_flow.loop.for.initializer.change",
"expression.off_by_one",
"io.output.change"
] | 778,726 | 778,725 | u755121033 | cpp |
p02972 | #include <bits/stdc++.h>
#define syosu(x) fixed << setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int, P> pip;
typedef vector<pip> vip;
const int inf = 1 << 30;
const ll INF = 1ll << 60;
const double pi = acos(-1);
const double eps = 1e-8;
const ll mod = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, -1, 0, 1};
int n;
vi a, b, c;
int main() {
cin >> n;
a = b = vi(n);
for (auto &i : a)
cin >> i;
for (int i = n - 1; i >= 0; i--) {
int t = 0;
for (int j = i; j < n; j += i + 1)
t += b[j];
if (t != a[i]) {
b[i]++;
c.push_back(i + 1);
}
}
int S = c.size();
cout << S << endl;
for (int i = 0; i < S; i++)
cout << b[i] << " \n"[i == S - 1];
} | #include <bits/stdc++.h>
#define syosu(x) fixed << setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int, P> pip;
typedef vector<pip> vip;
const int inf = 1 << 30;
const ll INF = 1ll << 60;
const double pi = acos(-1);
const double eps = 1e-8;
const ll mod = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, -1, 0, 1};
int n;
vi a, b, c;
int main() {
cin >> n;
a = b = vi(n);
for (auto &i : a)
cin >> i;
for (int i = n - 1; i >= 0; i--) {
int t = 0;
for (int j = i; j < n; j += i + 1)
t += b[j];
if (t % 2 != a[i]) {
b[i]++;
c.push_back(i + 1);
}
}
int S = c.size();
cout << S << endl;
for (int i = 0; i < S; i++)
cout << c[i] << " \n"[i == S - 1];
} | [
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change",
"identifier.change",
"io.output.change"
] | 778,742 | 778,741 | u434747175 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int a[200000];
for (int i = 0; i < n; i++)
cin >> a[i];
int ball[200000] = {0};
vector<int> b;
for (int i = n; i >= 1; i--) {
int r = 0;
for (int j = i * 2; j < n; j += i)
r = (r + ball[j - 1]) % 2;
if (a[i - 1] != r) {
ball[i - 1] = 1;
b.push_back(i);
}
}
cout << b.size() << endl;
if (b.size() == 0)
return 0;
bool first = true;
for (auto it = b.begin(); it != b.end(); it++) {
if (first)
first = false;
else
cout << " ";
cout << *it;
}
cout << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int a[200000];
for (int i = 0; i < n; i++)
cin >> a[i];
int ball[200000] = {0};
vector<int> b;
for (int i = n; i >= 1; i--) {
int r = 0;
for (int j = i * 2; j <= n; j += i)
r = (r + ball[j - 1]) % 2;
if (a[i - 1] != r) {
ball[i - 1] = 1;
b.push_back(i);
}
}
cout << b.size() << endl;
if (b.size() == 0)
return 0;
bool first = true;
for (auto it = b.begin(); it != b.end(); it++) {
if (first)
first = false;
else
cout << " ";
cout << *it;
}
cout << endl;
return 0;
}
| [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 778,746 | 778,747 | u347579043 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define rep(i, j, k) for (int i = j; i < k; i++)
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
bool hako[200100];
bool hakoa[200100];
vector<int> res;
int resnum;
int main() {
int n;
cin >> n;
rep(i, 0, n) {
int a;
cin >> a;
hako[i + 1] = a == 1;
}
for (int i = n; i > 0; i--) {
bool a = false;
for (int j = i + i; j <= n; j += i) {
a ^= hakoa[j];
}
if (a != hako[i]) {
resnum++;
res.push_back(i);
hakoa[a] = true;
}
}
cout << resnum << endl;
if (resnum == 0)
return 0;
for (int i = 0; i < res.size(); i++) {
cout << res[i] << " ";
}
cout << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define rep(i, j, k) for (int i = j; i < k; i++)
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
bool hako[200100];
bool hakoa[200100];
vector<int> res;
int resnum;
int main() {
int n;
cin >> n;
rep(i, 0, n) {
int a;
cin >> a;
hako[i + 1] = a == 1;
}
for (int i = n; i > 0; i--) {
bool a = false;
for (int j = i + i; j <= n; j += i) {
a ^= hakoa[j];
}
if (a != hako[i]) {
resnum++;
res.push_back(i);
hakoa[i] = true;
}
}
cout << resnum << endl;
if (resnum == 0)
return 0;
for (int i = 0; i < res.size(); i++) {
cout << res[i] << " ";
}
cout << endl;
return 0;
}
| [
"assignment.variable.change",
"identifier.change",
"variable_access.subscript.index.change"
] | 778,757 | 778,758 | u400497478 | cpp |
p02972 | #include <bits/stdc++.h>
#define mp make_pair
#define fst first
#define snd second
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define forn1(i, n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
template <typename T> T id(T b) { return b; };
template <class It> bool all(It f, It l) { return std::all_of(f, l, id<bool>); }
template <class It> bool any(It f, It l) { return std::any_of(f, l, id<bool>); }
template <typename T> void chmax(T &x, T y) {
if (x < y)
x = y;
}
template <typename T> void chmin(T &x, T y) {
if (x > y)
x = y;
}
const int MAX_N = 200000;
int n;
int a[MAX_N + 1];
int b[MAX_N + 1];
int main() {
#ifdef FASTIO
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
#endif
cin >> n;
forn1(i, n) { cin >> a[i]; }
vi ans;
for (int i = n; i >= 1; i--) {
int c = 0;
for (int j = i * 2; j <= n; j += i)
c += b[i];
if (c % 2 != a[i]) {
b[i] = 1;
ans.push_back(i);
}
}
cout << ans.size() << endl;
for (int x : ans)
cout << x << " ";
cout << endl;
return 0;
}
| #include <bits/stdc++.h>
#define mp make_pair
#define fst first
#define snd second
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define forn1(i, n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
template <typename T> T id(T b) { return b; };
template <class It> bool all(It f, It l) { return std::all_of(f, l, id<bool>); }
template <class It> bool any(It f, It l) { return std::any_of(f, l, id<bool>); }
template <typename T> void chmax(T &x, T y) {
if (x < y)
x = y;
}
template <typename T> void chmin(T &x, T y) {
if (x > y)
x = y;
}
const int MAX_N = 200000;
int n;
int a[MAX_N + 1];
int b[MAX_N + 1];
int main() {
#ifdef FASTIO
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
#endif
cin >> n;
forn1(i, n) { cin >> a[i]; }
vi ans;
for (int i = n; i >= 1; i--) {
int c = 0;
for (int j = i * 2; j <= n; j += i)
c += b[j];
if (c % 2 != a[i]) {
b[i] = 1;
ans.push_back(i);
}
}
cout << ans.size() << endl;
for (int x : ans)
cout << x << " ";
cout << endl;
return 0;
}
| [
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change"
] | 778,765 | 778,766 | u806601169 | cpp |
p02972 | #include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
using i32 = int;
using i64 = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using pii = pair<i32, i32>;
#define rep(i, n) for (i32 i = 0; i < (n); ++i)
#define repr(i, n) for (i32 i = ((n)-1); i >= 0; --i)
#define urep(i, n) for (u32 i = 0; i < (n); ++i)
#define urepr(i, n) for (u32 i = ((n)-1); i >= 0 && i < (n); --i)
#define all(v) v.begin(), v.end()
int a[200000 + 1];
unordered_set<int> res;
int main() {
int N;
cin >> N;
rep(i, N) { cin >> a[i]; }
repr(i, N) {
if ((i + 1) * 2 > N) {
if (a[i])
res.insert(i + 1);
continue;
}
// printf("check %d\n", i + 1);
int n = 0;
for (int x = i + 1; x < N; x += i + 1) {
n += res.find(x) != res.end();
}
// for (auto& e : res) {
// if (e % (i + 1) == 0) {
// n++;
// //printf(" ok %d\n", e);
// }
//}
// printf("result %d = %d\n", i + 1, n);
if (n % 2 != a[i])
res.insert(i + 1);
}
printf("%d\n", res.size());
for (auto &e : res) {
printf("%d ", e);
}
puts("");
return 0;
}
| #include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
using i32 = int;
using i64 = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using pii = pair<i32, i32>;
#define rep(i, n) for (i32 i = 0; i < (n); ++i)
#define repr(i, n) for (i32 i = ((n)-1); i >= 0; --i)
#define urep(i, n) for (u32 i = 0; i < (n); ++i)
#define urepr(i, n) for (u32 i = ((n)-1); i >= 0 && i < (n); --i)
#define all(v) v.begin(), v.end()
int a[200000 + 1];
unordered_set<int> res;
int main() {
int N;
cin >> N;
rep(i, N) { cin >> a[i]; }
repr(i, N) {
if ((i + 1) * 2 > N) {
if (a[i])
res.insert(i + 1);
continue;
}
// printf("check %d\n", i + 1);
int n = 0;
for (int x = i + 1; x <= N; x += i + 1) {
// printf(" how about %d\n", x);
n += res.find(x) != res.end();
}
// for (auto& e : res) {
// if (e % (i + 1) == 0) {
// n++;
// //printf(" ok %d\n", e);
// }
//}
// printf("result %d = %d\n", i + 1, n);
if (n % 2 != a[i])
res.insert(i + 1);
}
printf("%d\n", res.size());
for (auto &e : res) {
printf("%d ", e);
}
puts("");
return 0;
}
| [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 778,767 | 778,768 | u782480355 | cpp |
p02972 | #include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
int n, a[200005], b[200005];
vector<int> ans;
inline void dd() {
for (int i = 1; i <= n; ++i)
printf("%d ", b[i]);
}
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; ++i)
scanf("%d", &a[i]);
for (int i = n; i >= 1; --i) {
int t = 0;
for (int j = i; j >= 1; j += i) {
t += b[j];
}
if ((t % 2) != a[i]) {
b[i] = 1;
ans.push_back(i);
}
}
printf("%d\n", ans.size());
for (int i = 0; i < ans.size(); ++i)
printf("%d ", ans[i]);
return 0;
} | #include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
int n, a[200005], b[200005];
vector<int> ans;
inline void dd() {
for (int i = 1; i <= n; ++i)
printf("%d ", b[i]);
}
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; ++i)
scanf("%d", &a[i]);
for (int i = n; i >= 1; --i) {
int t = 0;
for (int j = i; j <= n; j += i) {
t += b[j];
}
if ((t % 2) != a[i]) {
b[i] = 1;
ans.push_back(i);
}
}
printf("%d\n", ans.size());
for (int i = 0; i < ans.size(); ++i)
printf("%d ", ans[i]);
return 0;
} | [
"control_flow.loop.for.condition.change"
] | 778,769 | 778,770 | u315350841 | cpp |
p02972 | #include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
int n, a[200005], b[200005];
vector<int> ans;
inline void dd() {
for (int i = 1; i <= n; ++i)
printf("%d ", b[i]);
}
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; ++i)
scanf("%d", &a[i]);
for (int i = n; i >= 1; --i) {
int t = 0;
for (int j = i; j >= 1; j -= i) {
t += b[j];
}
if ((t % 2) != a[i]) {
b[i] = 1;
ans.push_back(i);
}
}
printf("%d\n", ans.size());
for (int i = 0; i < ans.size(); ++i)
printf("%d ", ans[i]);
return 0;
} | #include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
int n, a[200005], b[200005];
vector<int> ans;
inline void dd() {
for (int i = 1; i <= n; ++i)
printf("%d ", b[i]);
}
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; ++i)
scanf("%d", &a[i]);
for (int i = n; i >= 1; --i) {
int t = 0;
for (int j = i; j <= n; j += i) {
t += b[j];
}
if ((t % 2) != a[i]) {
b[i] = 1;
ans.push_back(i);
}
}
printf("%d\n", ans.size());
for (int i = 0; i < ans.size(); ++i)
printf("%d ", ans[i]);
return 0;
} | [
"control_flow.loop.for.condition.change",
"expression.operator.change"
] | 778,771 | 778,770 | u315350841 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1);
typedef long long ll;
typedef pair<int64_t, int64_t> pll;
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};
#define INF (2147483647)
#define mod (1000000007)
#define limit (7368791)
#define rep(i, a, b) for (int64_t i = (a); i < (b); i++)
#define REP(i, n) rep(i, 0, n)
#define ALL(a) begin(a), end(a)
#define sz(s) (s).size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
void solve() {
int n;
cin >> n;
vector<int> a(n + 1);
for (int i = 1; i <= n; i++)
cin >> a[i];
vector<int> b(n + 1, 0);
int s = 0;
for (int i = n; i > 0; i--) {
int sum = 0;
for (int j = i + i; j <= n; j += i) {
sum += b[j];
}
sum %= 2;
if (sum != a[i])
b[i] = 1;
}
for (int i = 1; i <= n; i++)
s += b[i];
cout << s << endl;
for (int i = 1; i <= s; i++)
if (b[i])
cout << i << " ";
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
solve();
return 0;
} | #include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1);
typedef long long ll;
typedef pair<int64_t, int64_t> pll;
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};
#define INF (2147483647)
#define mod (1000000007)
#define limit (7368791)
#define rep(i, a, b) for (int64_t i = (a); i < (b); i++)
#define REP(i, n) rep(i, 0, n)
#define ALL(a) begin(a), end(a)
#define sz(s) (s).size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
void solve() {
int n;
cin >> n;
vector<int> a(n + 1);
for (int i = 1; i <= n; i++)
cin >> a[i];
vector<int> b(n + 1, 0);
int s = 0;
for (int i = n; i > 0; i--) {
int sum = 0;
for (int j = i + i; j <= n; j += i) {
sum += b[j];
}
sum %= 2;
if (sum != a[i])
b[i] = 1;
}
for (int i = 1; i <= n; i++)
s += b[i];
cout << s << endl;
for (int i = 1; i <= n; i++)
if (b[i])
cout << i << " ";
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
solve();
return 0;
} | [
"identifier.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change"
] | 778,776 | 778,777 | u973991908 | cpp |
p02972 | #include <bits/stdc++.h>
#include <iostream>
#define IOS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define ll long long
#define pii std::pair<int, int>
#define pli std::pair<ll, int>
#define pil std::pair<int, ll>
#define psi std::pair<string, int>
#define pll std::pair<ll, ll>
#define pci std::pair<char, int>
#define sll(x) scanf("%lld", &x)
#define prll(x) printf("%lld ", x)
#define pri(x) printf("%d ", x)
#define si(x) scanf("%d", &x)
#define pb push_back
#define vll std::vector<ll>
#define vpi std::vector<std::pair<int, int>>
#define vi std::vector<int>
#define vvi std::vector<std::vector<int>>
#define vvpil std::vector<std::vector<std::pair<int, ll>>>
#define vlpii std::vector<std::list<pii>>
#define vlpil std::vector<std::list<pil>>
#define li std::list<int>
#define lpil std::list<pil>
#define Endl printf("\n")
#define vli vector<list<int>>
#define vvll vector<vector<ll>>
#define mp make_pair
#define x first
#define y second
#define ma 100000000
#define imie(...) "[" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
const ll INF = 10000000000000;
const ll mod = 1000000007;
using namespace std;
void add(ll &x, ll y) {
x += y;
if (x >= mod)
x -= mod;
}
ll mul(ll x, ll y) { return (x * y) % mod; }
ll Pow(ll x, ll y) {
if (y == 0)
return 1;
ll z = Pow(x, y / 2);
if (y % 2)
return (((z * z) % mod) * x) % mod;
return (z * z) % mod;
}
bool f(string x, string y) {
string c = x + y;
string d = y + x;
vll h(c.size(), 0);
h[0] = (c[0] == 'h');
for (int i = 1; i < (int)c.size(); i++) {
h[i] = h[i - 1] + (c[i] == 'h');
}
vll h1(c.size(), 0);
h1[0] = (d[0] == 'h');
for (int i = 1; i < (int)c.size(); i++) {
h1[i] = h1[i - 1] + (d[i] == 'h');
}
ll ans1 = 0;
for (int i = 0; i < (int)c.size(); i++) {
if (c[i] == 's')
ans1 += h[(int)c.size() - 1] - h[i];
}
ll ans2 = 0;
for (int i = 0; i < (int)c.size(); i++) {
if (d[i] == 's')
ans2 += h1[(int)c.size() - 1] - h1[i];
}
return ans1 > ans2;
}
// Before submit=>
/// *check for integer overflow,array bounds
/// *check for n=1
int main() {
IOS;
int n;
cin >> n;
vi a(n + 1);
for (int i = 1; i <= n; i++)
cin >> a[i];
vi ans(n + 1, 0);
vi res;
for (int i = n; i >= 1; i--) {
int nb = 0;
for (int j = 2 * i; j <= n; j += i)
nb += ans[j];
if (nb % 2 != a[i]) {
ans[i] = 1;
res.pb(i);
}
}
for (int i = 1; i <= n; i++) {
int nb = 0;
for (int j = i; j <= n; j += i)
nb += ans[i];
if (nb % 2 != a[i])
return cout << -1 << "\n", 0;
}
cout << res.size() << endl;
for (int i = 0; i < (int)res.size(); i++)
cout << res[i] << "\n";
return 0;
}
| #include <bits/stdc++.h>
#include <iostream>
#define IOS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define ll long long
#define pii std::pair<int, int>
#define pli std::pair<ll, int>
#define pil std::pair<int, ll>
#define psi std::pair<string, int>
#define pll std::pair<ll, ll>
#define pci std::pair<char, int>
#define sll(x) scanf("%lld", &x)
#define prll(x) printf("%lld ", x)
#define pri(x) printf("%d ", x)
#define si(x) scanf("%d", &x)
#define pb push_back
#define vll std::vector<ll>
#define vpi std::vector<std::pair<int, int>>
#define vi std::vector<int>
#define vvi std::vector<std::vector<int>>
#define vvpil std::vector<std::vector<std::pair<int, ll>>>
#define vlpii std::vector<std::list<pii>>
#define vlpil std::vector<std::list<pil>>
#define li std::list<int>
#define lpil std::list<pil>
#define Endl printf("\n")
#define vli vector<list<int>>
#define vvll vector<vector<ll>>
#define mp make_pair
#define x first
#define y second
#define ma 100000000
#define imie(...) "[" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
const ll INF = 10000000000000;
const ll mod = 1000000007;
using namespace std;
void add(ll &x, ll y) {
x += y;
if (x >= mod)
x -= mod;
}
ll mul(ll x, ll y) { return (x * y) % mod; }
ll Pow(ll x, ll y) {
if (y == 0)
return 1;
ll z = Pow(x, y / 2);
if (y % 2)
return (((z * z) % mod) * x) % mod;
return (z * z) % mod;
}
bool f(string x, string y) {
string c = x + y;
string d = y + x;
vll h(c.size(), 0);
h[0] = (c[0] == 'h');
for (int i = 1; i < (int)c.size(); i++) {
h[i] = h[i - 1] + (c[i] == 'h');
}
vll h1(c.size(), 0);
h1[0] = (d[0] == 'h');
for (int i = 1; i < (int)c.size(); i++) {
h1[i] = h1[i - 1] + (d[i] == 'h');
}
ll ans1 = 0;
for (int i = 0; i < (int)c.size(); i++) {
if (c[i] == 's')
ans1 += h[(int)c.size() - 1] - h[i];
}
ll ans2 = 0;
for (int i = 0; i < (int)c.size(); i++) {
if (d[i] == 's')
ans2 += h1[(int)c.size() - 1] - h1[i];
}
return ans1 > ans2;
}
// Before submit=>
/// *check for integer overflow,array bounds
/// *check for n=1
/// *check mod
/// *check input file
int main() {
IOS;
int n;
cin >> n;
vi a(n + 1);
for (int i = 1; i <= n; i++)
cin >> a[i];
vi ans(n + 1, 0);
vi res;
for (int i = n; i >= 1; i--) {
int nb = 0;
for (int j = 2 * i; j <= n; j += i)
nb += ans[j];
if (nb % 2 != a[i]) {
ans[i] = 1;
res.pb(i);
}
}
for (int i = 1; i <= n; i++) {
int nb = 0;
for (int j = i; j <= n; j += i)
nb += ans[j];
if (nb % 2 != a[i])
return cout << -1 << "\n", 0;
}
cout << res.size() << endl;
for (int i = 0; i < (int)res.size(); i++)
cout << res[i] << "\n";
return 0;
}
| [
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change"
] | 778,783 | 778,784 | u752814744 | cpp |
p02972 | #include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define INF 1000000000
#define LLINF 2000000000000000
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 long long
signed main() {
int n;
cin >> n;
int a[n + 1];
LOOP(i, n) { cin >> a[i + 1]; }
int res[n + 1];
int resc = 0;
for (int i = n; i >= 1; i--) {
int cnt = 0;
int j = i * 2;
while (j <= n) {
if (a[j])
cnt++;
j += i;
}
if (cnt % 2 == a[i]) {
res[i] = 0;
} else {
res[i] = 1;
resc++;
}
}
cout << resc << endl;
LOOP(i, n) {
if (res[i + 1] == 1)
cout << i + 1 << endl;
}
}
| #include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define INF 1000000000
#define LLINF 2000000000000000
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 long long
signed main() {
int n;
cin >> n;
int a[n + 1];
LOOP(i, n) { cin >> a[i + 1]; }
int res[n + 1];
int resc = 0;
for (int i = n; i >= 1; i--) {
int cnt = 0;
int j = i * 2;
while (j <= n) {
if (res[j])
cnt++;
j += i;
}
if (cnt % 2 == a[i]) {
res[i] = 0;
} else {
res[i] = 1;
resc++;
}
}
cout << resc << endl;
LOOP(i, n) {
if (res[i + 1] == 1)
cout << i + 1 << endl;
}
}
| [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 778,785 | 778,786 | u118951811 | cpp |
p02972 | #include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define INF 1000000000
#define LLINF 2000000000000000
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 long long
signed main() {
int n;
cin >> n;
int a[n + 1];
LOOP(i, n) { cin >> a[i + 1]; }
int res[n + 1];
int resc = 0;
for (int i = n; i >= 1; i--) {
int cnt = 0;
int j = i * 2;
while (j <= n) {
if (a[j])
cnt++;
j += i;
}
if (cnt % 2 == a[i]) {
res[i] = 0;
} else {
res[i] = 1;
resc = 1;
}
}
cout << resc << endl;
LOOP(i, n) {
if (res[i + 1] == 1)
cout << i + 1 << endl;
}
}
| #include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define INF 1000000000
#define LLINF 2000000000000000
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 long long
signed main() {
int n;
cin >> n;
int a[n + 1];
LOOP(i, n) { cin >> a[i + 1]; }
int res[n + 1];
int resc = 0;
for (int i = n; i >= 1; i--) {
int cnt = 0;
int j = i * 2;
while (j <= n) {
if (res[j])
cnt++;
j += i;
}
if (cnt % 2 == a[i]) {
res[i] = 0;
} else {
res[i] = 1;
resc++;
}
}
cout << resc << endl;
LOOP(i, n) {
if (res[i + 1] == 1)
cout << i + 1 << endl;
}
}
| [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 778,787 | 778,786 | u118951811 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
using int64 = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<int> rs(n + 1);
for (int i = 1; i <= n; i++)
cin >> rs[i];
vector<int> xs(n + 1);
for (int k = n; k >= 1; k--) {
int current = 0;
for (int i = 2; i * k <= n; i++) {
current += rs[i * k];
}
xs[k] = abs(current - rs[k]) % 2;
}
vector<int> answers;
for (int i = 1; i <= n; i++) {
if (xs[i] == 1)
answers.push_back(i);
}
cout << answers.size() << endl;
for (int i = 0; i < answers.size(); i++) {
if (i > 0)
cout << " ";
cout << answers[i];
}
cout << endl;
}
| #include <bits/stdc++.h>
using namespace std;
using int64 = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<int> rs(n + 1);
for (int i = 1; i <= n; i++)
cin >> rs[i];
vector<int> xs(n + 1);
for (int k = n; k >= 1; k--) {
int current = 0;
for (int i = 2; i * k <= n; i++) {
current += xs[i * k];
}
xs[k] = abs(current - rs[k]) % 2;
}
vector<int> answers;
for (int i = 1; i <= n; i++) {
if (xs[i] == 1)
answers.push_back(i);
}
cout << answers.size() << endl;
for (int i = 0; i < answers.size(); i++) {
if (i > 0)
cout << " ";
cout << answers[i];
}
cout << endl;
}
| [
"assignment.value.change",
"identifier.change"
] | 778,788 | 778,789 | u771276542 | cpp |
p02972 | #include <bits/stdc++.h>
int ri() {
int n;
scanf("%d", &n);
return n;
}
int64_t rll() {
long long n;
scanf("%lld", &n);
return n;
}
int main() {
int n = ri();
int a[n];
for (int i = 0; i < n; i++)
a[i] = ri();
int res[n];
for (int i = n - 1; i >= 0; i--) {
int step = i + 1;
int cnt = 0;
for (int j = i; j < n; j += step)
if (j < i)
cnt += res[j];
res[i] = (cnt & 1) ^ a[i];
}
std::set<int> st;
for (int i = 0; i < n; i++)
if (res[i])
st.insert(i);
std::cout << st.size() << std::endl;
for (auto i : st)
std::cout << i + 1 << std::endl;
return 0;
}
| #include <bits/stdc++.h>
int ri() {
int n;
scanf("%d", &n);
return n;
}
int64_t rll() {
long long n;
scanf("%lld", &n);
return n;
}
int main() {
int n = ri();
int a[n];
for (int i = 0; i < n; i++)
a[i] = ri();
int res[n];
for (int i = n - 1; i >= 0; i--) {
int step = i + 1;
int cnt = 0;
for (int j = i; j < n; j += step)
if (j > i)
cnt += res[j];
res[i] = (cnt & 1) ^ a[i];
}
std::set<int> st;
for (int i = 0; i < n; i++)
if (res[i])
st.insert(i);
std::cout << st.size() << std::endl;
for (auto i : st)
std::cout << i + 1 << std::endl;
return 0;
}
| [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 778,790 | 778,791 | u040490988 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using P = pair<int, int>;
using PL = pair<ll, ll>;
using vp = vector<P>;
using vpl = vector<PL>;
template <typename T> constexpr auto inf = numeric_limits<T>::max() / 2;
constexpr int INF = inf<int>, MOD = 1000000007;
constexpr ll LINF = inf<ll>;
#define _ol3(_1, _2, _3, name, ...) name
#define _rep(i, n) _repi(i, 0, n)
#define _repi(i, a, b) for (int i = a, i##_l = (b); i < i##_l; ++i)
#define REP(...) _ol3(__VA_ARGS__, _repi, _rep, )(__VA_ARGS__)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define REPA(i, v) REP(i, v.size())
#define all(v) (v).begin(), (v).end()
#define bit(n) (1ll << (n))
#define uniq(v) \
sort(all(v)); \
v.erase(unique(all(v)), v.end())
#define F first
#define S second
#define endl '\n'
#define cho(n, a, b) cout << ((n) ? a : b) << endl
void YES(int n) { cho(n, "YES", "NO"); }
void Yes(int n) { cho(n, "Yes", "No"); }
void Poss(int n) { cho(n, "Possible", "Impossible"); }
#ifndef LOCAL
struct osd {
template <class T> osd &operator<(const T &t) { return *this; }
template <class T> osd &operator<<(const T &t) { return *this; }
};
osd cer_;
template <class... T> void _print(osd &a, T &&...t) {}
#define cerr cer_
#endif
template <class T> ostream &operator<(ostream &o, const T &t) { return o << t; }
template <class T> istream &operator>(istream &i, T &t) { return i >> t; }
void _print(ostream &s) {}
template <class T, class... U> void _print(ostream &s, T &&t, U &&...u) {
s < t < (sizeof...(u) ? ' ' : '\n');
_print(s, u...);
}
template <class... T> void print(T &&...t) { _print(cout, t...); }
template <class... T> void dprint(T &&...t) { _print(cerr, t...); }
template <class T> void chmax(T &a, const T &b) {
if (a < b)
a = b;
}
template <class T> void chmin(T &a, const T &b) {
if (a > b)
a = b;
}
template <class T> ostream &operator<<(ostream &o, const vector<T> &v) {
for (auto &&i : v)
o < i < ' ';
return o;
}
template <class T> istream &operator>>(istream &i, vector<T> &v) {
for (T &j : v)
i > j;
return i;
}
template <class T, class U>
ostream &operator<<(ostream &o, const pair<T, U> &p) {
return o < p.F < ' ' < p.S;
}
template <class T, class U> istream &operator>>(istream &i, pair<T, U> &p) {
return i > p.F > p.S;
}
template <class T> ostream &operator<<(ostream &o, const set<T> &v) {
for (auto &&i : v)
o < i < ' ';
return o;
}
template <class T> vector<T> &operator<<(vector<T> &v, const T &t) {
v.push_back(t);
return v;
}
template <class T> queue<T> &operator<<(queue<T> &q, const T &t) {
q.push(t);
return q;
}
template <class T> queue<T> &operator<<(T &t, queue<T> &q) {
t = q.front();
q.pop();
return q;
}
template <class T> deque<T> &operator>>(const T &t, deque<T> &q) {
q.push_front(t);
return q;
}
template <class T> deque<T> &operator<<(T &t, deque<T> &q) {
t = q.front();
q.pop_front();
return q;
}
template <class T> deque<T> &operator<<(deque<T> &q, const T &t) {
q.push_back(t);
return q;
}
template <class T> deque<T> &operator>>(deque<T> &q, T &t) {
t = q.back(t);
q.pop_back();
return q;
}
template <class T> stack<T> &operator<<(stack<T> &s, const T &t) {
s.push(t);
return s;
}
template <class T> stack<T> &operator>>(stack<T> &s, T &t) {
t = s.top();
s.pop();
return s;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(0);
int n;
cin > n;
vi a(n);
cin > a;
set<int> c;
REPR(i, n) {
bool x = a[i];
for (int j = i + 1; j <= n; j += i + 1)
x ^= (c.find(j - 1) != c.end());
if (x)
c.insert(i + 1);
}
cout < c.size() < endl;
cout < c < endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using P = pair<int, int>;
using PL = pair<ll, ll>;
using vp = vector<P>;
using vpl = vector<PL>;
template <typename T> constexpr auto inf = numeric_limits<T>::max() / 2;
constexpr int INF = inf<int>, MOD = 1000000007;
constexpr ll LINF = inf<ll>;
#define _ol3(_1, _2, _3, name, ...) name
#define _rep(i, n) _repi(i, 0, n)
#define _repi(i, a, b) for (int i = a, i##_l = (b); i < i##_l; ++i)
#define REP(...) _ol3(__VA_ARGS__, _repi, _rep, )(__VA_ARGS__)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define REPA(i, v) REP(i, v.size())
#define all(v) (v).begin(), (v).end()
#define bit(n) (1ll << (n))
#define uniq(v) \
sort(all(v)); \
v.erase(unique(all(v)), v.end())
#define F first
#define S second
#define endl '\n'
#define cho(n, a, b) cout << ((n) ? a : b) << endl
void YES(int n) { cho(n, "YES", "NO"); }
void Yes(int n) { cho(n, "Yes", "No"); }
void Poss(int n) { cho(n, "Possible", "Impossible"); }
#ifndef LOCAL
struct osd {
template <class T> osd &operator<(const T &t) { return *this; }
template <class T> osd &operator<<(const T &t) { return *this; }
};
osd cer_;
template <class... T> void _print(osd &a, T &&...t) {}
#define cerr cer_
#endif
template <class T> ostream &operator<(ostream &o, const T &t) { return o << t; }
template <class T> istream &operator>(istream &i, T &t) { return i >> t; }
void _print(ostream &s) {}
template <class T, class... U> void _print(ostream &s, T &&t, U &&...u) {
s < t < (sizeof...(u) ? ' ' : '\n');
_print(s, u...);
}
template <class... T> void print(T &&...t) { _print(cout, t...); }
template <class... T> void dprint(T &&...t) { _print(cerr, t...); }
template <class T> void chmax(T &a, const T &b) {
if (a < b)
a = b;
}
template <class T> void chmin(T &a, const T &b) {
if (a > b)
a = b;
}
template <class T> ostream &operator<<(ostream &o, const vector<T> &v) {
for (auto &&i : v)
o < i < ' ';
return o;
}
template <class T> istream &operator>>(istream &i, vector<T> &v) {
for (T &j : v)
i > j;
return i;
}
template <class T, class U>
ostream &operator<<(ostream &o, const pair<T, U> &p) {
return o < p.F < ' ' < p.S;
}
template <class T, class U> istream &operator>>(istream &i, pair<T, U> &p) {
return i > p.F > p.S;
}
template <class T> ostream &operator<<(ostream &o, const set<T> &v) {
for (auto &&i : v)
o < i < ' ';
return o;
}
template <class T> vector<T> &operator<<(vector<T> &v, const T &t) {
v.push_back(t);
return v;
}
template <class T> queue<T> &operator<<(queue<T> &q, const T &t) {
q.push(t);
return q;
}
template <class T> queue<T> &operator<<(T &t, queue<T> &q) {
t = q.front();
q.pop();
return q;
}
template <class T> deque<T> &operator>>(const T &t, deque<T> &q) {
q.push_front(t);
return q;
}
template <class T> deque<T> &operator<<(T &t, deque<T> &q) {
t = q.front();
q.pop_front();
return q;
}
template <class T> deque<T> &operator<<(deque<T> &q, const T &t) {
q.push_back(t);
return q;
}
template <class T> deque<T> &operator>>(deque<T> &q, T &t) {
t = q.back(t);
q.pop_back();
return q;
}
template <class T> stack<T> &operator<<(stack<T> &s, const T &t) {
s.push(t);
return s;
}
template <class T> stack<T> &operator>>(stack<T> &s, T &t) {
t = s.top();
s.pop();
return s;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(0);
int n;
cin > n;
vi a(n);
cin > a;
set<int> c;
REPR(i, n) {
bool x = a[i];
for (int j = i + 1; j <= n; j += i + 1)
x ^= (c.find(j) != c.end());
if (x)
c.insert(i + 1);
}
cout < c.size() < endl;
cout < c < endl;
return 0;
}
| [
"expression.operation.binary.remove"
] | 778,792 | 778,793 | u502709453 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
int n, a[200010], cnt, ans[200010];
int main() {
cin >> n;
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]);
for (int i = n; i >= 1; i--) {
cnt = 0;
for (int j = 2; j < n / i; j++)
cnt += ans[j * i];
if (cnt % 2 != a[i])
ans[i] = 1;
}
cnt = 0;
for (int i = 1; i <= n; i++)
cnt += ans[i];
printf("%d\n", cnt);
for (int i = 1; i <= n; i++)
if (ans[i])
printf("%d ", i);
} | #include <bits/stdc++.h>
using namespace std;
int n, a[200010], cnt, ans[200010];
int main() {
cin >> n;
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]);
for (int i = n; i >= 1; i--) {
cnt = 0;
for (int j = 1; j <= n / i; j++)
cnt += ans[j * i];
if (cnt % 2 != a[i])
ans[i] = 1;
}
cnt = 0;
for (int i = 1; i <= n; i++)
cnt += ans[i];
printf("%d\n", cnt);
for (int i = 1; i <= n; i++)
if (ans[i])
printf("%d ", i);
return 0;
} | [
"literal.number.change",
"variable_declaration.value.change",
"control_flow.loop.for.initializer.change",
"expression.off_by_one",
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change",
"control_flow.return.add",
"control_flow.return.0.add"
] | 778,811 | 778,812 | u727652622 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;
typedef vector<vl> mt;
typedef unordered_map<ll, unordered_map<ll, ll>> graph;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;
typedef vector<string> vs;
typedef vector<vs> table;
const ll e5 = 1 << 20;
const ll mod = 1000000007;
const ll e3 = 1 << 13;
const ll INF = 1ll << 50;
ll n;
vl a;
vl b;
int main() {
cin >> n;
a = vl(n + 1);
b = vl(n + 1);
for (ll i = 1; i <= n; i++)
cin >> a.at(i);
for (ll i = n; i >= 1; i--) {
ll cnt = 0;
for (ll j = 1; j * i <= n; j++) {
cnt += b.at(j);
}
if (cnt % 2 == a.at(i))
continue;
else
b.at(i) = 1;
}
cout << accumulate(b.begin(), b.end(), 0ll) << endl;
for (ll i = 1; i <= n; i++) {
if (b[i] == 1)
cout << i << " ";
}
cout << endl;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;
typedef vector<vl> mt;
typedef unordered_map<ll, unordered_map<ll, ll>> graph;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;
typedef vector<string> vs;
typedef vector<vs> table;
const ll e5 = 1 << 20;
const ll mod = 1000000007;
const ll e3 = 1 << 13;
const ll INF = 1ll << 50;
ll n;
vl a;
vl b;
int main() {
cin >> n;
a = vl(n + 1);
b = vl(n + 1);
for (ll i = 1; i <= n; i++)
cin >> a.at(i);
for (ll i = n; i >= 1; i--) {
ll cnt = 0;
for (ll j = 1; j * i <= n; j++) {
cnt += b.at(j * i);
}
if (cnt % 2 == a.at(i))
continue;
else
b.at(i) = 1;
}
cout << accumulate(b.begin(), b.end(), 0ll) << endl;
for (ll i = 1; i <= n; i++) {
if (b[i] == 1)
cout << i << " ";
}
cout << endl;
}
| [
"assignment.change"
] | 778,815 | 778,816 | u842401785 | cpp |
p02972 | //↓template↓
#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n) n.begin(), n.end()
#define rall(n) n.rbegin(), n.rend()
typedef long long ll;
// typedef complex<double>P;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const double EPS = 1e-10;
const double pi = acos(-1); // 3.1415926535897932384626433832795028...
const ll SIZE = 1 << 17;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1}, alp[30];
ll fac[200005], finv[200005], inv[200005];
vector<ll> dij;
struct edge {
ll to, cost;
};
vector<vector<edge>> G;
ll mod_pow(ll a, ll b) {
ll res = 1, mul = a;
for (int i = 0; i < 31; ++i) {
if (b >> i & 1) {
res *= mul;
res %= MOD;
}
mul = (mul * mul) % MOD;
}
return res;
}
void addedge(int from, int to, int cost) {
G[from].push_back({to, cost});
G[to].push_back({from, cost});
}
template <typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) {
return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) {
t = v;
}
template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) {
for (auto &e : t)
fill_v(e, v);
}
template <typename T> void outp(vector<T> v) {
for (int i = 0; i < v.size(); ++i) {
cout << v[i];
if (i != v.size() - 1) {
cout << " ";
}
}
}
double add(double a, double b) {
if (abs(a + b) < EPS * (abs(a) + abs(b))) {
return 0;
}
return a + b;
}
//↑template↑
ll n, k[200005], ans[200005];
vector<int> v;
int main() {
cin >> n;
for (int i = 1; i < n; ++i) {
cin >> k[i];
}
for (int i = n; i > 0; --i) {
ll mon = 0;
for (int j = 2 * i; j <= n; j += i) {
mon += ans[j];
}
if (mon % 2 != k[i]) {
++ans[i];
}
}
for (int i = 1; i <= n; ++i) {
if (ans[i]) {
v.push_back(i);
}
}
cout << v.size() << endl;
for (auto i : v) {
cout << i << " ";
}
cout << endl;
} | //↓template↓
#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n) n.begin(), n.end()
#define rall(n) n.rbegin(), n.rend()
typedef long long ll;
// typedef complex<double>P;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const double EPS = 1e-10;
const double pi = acos(-1); // 3.1415926535897932384626433832795028...
const ll SIZE = 1 << 17;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1}, alp[30];
ll fac[200005], finv[200005], inv[200005];
vector<ll> dij;
struct edge {
ll to, cost;
};
vector<vector<edge>> G;
ll mod_pow(ll a, ll b) {
ll res = 1, mul = a;
for (int i = 0; i < 31; ++i) {
if (b >> i & 1) {
res *= mul;
res %= MOD;
}
mul = (mul * mul) % MOD;
}
return res;
}
void addedge(int from, int to, int cost) {
G[from].push_back({to, cost});
G[to].push_back({from, cost});
}
template <typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) {
return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) {
t = v;
}
template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) {
for (auto &e : t)
fill_v(e, v);
}
template <typename T> void outp(vector<T> v) {
for (int i = 0; i < v.size(); ++i) {
cout << v[i];
if (i != v.size() - 1) {
cout << " ";
}
}
}
double add(double a, double b) {
if (abs(a + b) < EPS * (abs(a) + abs(b))) {
return 0;
}
return a + b;
}
//↑template↑
ll n, k[200005], ans[200005];
vector<int> v;
int main() {
cin >> n;
for (int i = 1; i <= n; ++i) {
cin >> k[i];
}
for (int i = n; i > 0; --i) {
ll mon = 0;
for (int j = 2 * i; j <= n; j += i) {
mon += ans[j];
}
if (mon % 2 != k[i]) {
ans[i] = 1;
}
}
for (int i = 1; i <= n; ++i) {
if (ans[i]) {
v.push_back(i);
}
}
cout << v.size() << endl;
for (auto i : v) {
cout << i << " ";
}
cout << endl;
} | [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change",
"assignment.change"
] | 778,822 | 778,823 | u539402331 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
#define MP make_pair
#define PB push_back
#define ALL(x) (x).begin(), (x).end()
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REP1(i, n) for (int i = 1; i < (n); i++)
#define REP2(i, d, n) for (int i = (d); i < (n); i++)
#define RREP(i, n) for (int i = (n); i >= 0; i--)
#define CLR(a) memset((a), 0, sizeof(a))
#define MCLR(a) memset((a), -1, sizeof(a))
#define RANGE(x, y, maxX, maxY) \
(0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int, int> PII;
const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;
const int DX[] = {1, 0, -1, 0}, DY[] = {0, -1, 0, 1};
const LL MOD = 2;
void solve(long long N, std::vector<long long> a) {
VLL memo(N + 1, 0);
VI boxIdx;
for (int i = N; i > 0; i--) {
int idx = i;
int sum = 0;
while (idx < N) {
sum += memo[idx];
idx += i;
}
if (a[i - 1] != sum % 2) {
memo[i] = 1;
boxIdx.PB(i);
}
}
cout << boxIdx.size() << endl;
REP(i, boxIdx.size())
cout << boxIdx[i] << (i + 1 == boxIdx.size() ? "\n" : " ");
}
int main() {
long long N;
scanf("%lld", &N);
std::vector<long long> a(N);
for (int i = 0; i < N; i++) {
scanf("%lld", &a[i]);
}
solve(N, std::move(a));
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define MP make_pair
#define PB push_back
#define ALL(x) (x).begin(), (x).end()
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REP1(i, n) for (int i = 1; i < (n); i++)
#define REP2(i, d, n) for (int i = (d); i < (n); i++)
#define RREP(i, n) for (int i = (n); i >= 0; i--)
#define CLR(a) memset((a), 0, sizeof(a))
#define MCLR(a) memset((a), -1, sizeof(a))
#define RANGE(x, y, maxX, maxY) \
(0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int, int> PII;
const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;
const int DX[] = {1, 0, -1, 0}, DY[] = {0, -1, 0, 1};
const LL MOD = 2;
void solve(long long N, std::vector<long long> a) {
VLL memo(N + 1, 0);
VI boxIdx;
for (int i = N; i > 0; i--) {
int idx = i;
int sum = 0;
while (idx <= N) {
sum += memo[idx];
idx += i;
}
if (a[i - 1] != sum % 2) {
memo[i] = 1;
boxIdx.PB(i);
}
}
cout << boxIdx.size() << endl;
REP(i, boxIdx.size())
cout << boxIdx[i] << (i + 1 == boxIdx.size() ? "\n" : " ");
}
int main() {
long long N;
scanf("%lld", &N);
std::vector<long long> a(N);
for (int i = 0; i < N; i++) {
scanf("%lld", &a[i]);
}
solve(N, std::move(a));
return 0;
}
| [
"expression.operator.compare.change",
"control_flow.loop.condition.change"
] | 778,824 | 778,825 | u250996767 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> v;
for (int i = 0; i < N; i++) {
int a;
cin >> a;
v.push_back(a);
}
vector<int> ans(N + 1);
int count = 0;
stringstream ss;
for (int i = v.size() - 1; i >= 0; i--) {
int sum = 0;
for (int j = i; j < N; j += i + 1)
sum += ans[j];
if (v.at(i) == sum % 2)
continue;
ans[i + 1]++;
count++;
ss << i + 1 << " ";
}
cout << count << endl;
cout << ss.str() << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> v;
for (int i = 0; i < N; i++) {
int a;
cin >> a;
v.push_back(a);
}
vector<int> ans(N);
int count = 0;
stringstream ss;
for (int i = v.size() - 1; i >= 0; i--) {
int sum = 0;
for (int j = i; j < N; j += i + 1)
sum += ans[j];
if (v.at(i) == sum % 2)
continue;
ans[i]++;
count++;
ss << i + 1 << " ";
}
cout << count << endl;
cout << ss.str() << endl;
}
| [
"expression.operation.binary.remove"
] | 778,831 | 778,832 | u598710706 | cpp |
p02972 | /*
Rohit645
Rohit Kumar
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using pll = pair<ll, ll>;
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void __f(const char *name, Arg1 &&arg1) {
cerr << name << " : " << arg1 << std ::endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&...args) {
const char *comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << " : " << arg1 << " | ";
__f(comma + 1, args...);
}
#else
#define trace(...)
#endif
#define pb push_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define fastIo() \
ios_base ::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
const int MOD = 1e9 + 7, INF = INT_MAX, N = 1e5 + 10;
int main() {
fastIo();
ll n;
cin >> n;
vector<ll> vec(n + 1, 0);
vector<ll> ans_vec(n + 1, 0);
for (ll i = 1; i <= n; i++) {
ll a;
cin >> a;
vec[i] = a;
}
for (ll i = n; i >= 1; i--) {
ll sum = 0;
for (ll j = 2 * i; j <= n; j += i) {
sum += vec[j];
}
ans_vec[i] = vec[i] ^ (sum % 2);
}
ll ans = accumulate(ans_vec.begin(), ans_vec.end(), 0);
cout << ans << endl;
for (ll i = 1; i <= n; i++) {
if (ans_vec[i] == 1) {
cout << i << " ";
}
}
return 0;
} | /*
Rohit645
Rohit Kumar
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using pll = pair<ll, ll>;
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void __f(const char *name, Arg1 &&arg1) {
cerr << name << " : " << arg1 << std ::endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&...args) {
const char *comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << " : " << arg1 << " | ";
__f(comma + 1, args...);
}
#else
#define trace(...)
#endif
#define pb push_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define fastIo() \
ios_base ::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
const int MOD = 1e9 + 7, INF = INT_MAX, N = 1e5 + 10;
int main() {
fastIo();
ll n;
cin >> n;
vector<ll> vec(n + 1, 0);
vector<ll> ans_vec(n + 1, 0);
for (ll i = 1; i <= n; i++) {
ll a;
cin >> a;
vec[i] = a;
}
for (ll i = n; i >= 1; i--) {
ll sum = 0;
for (ll j = 2 * i; j <= n; j += i) {
sum += ans_vec[j];
}
ans_vec[i] = vec[i] ^ (sum % 2);
}
ll ans = accumulate(ans_vec.begin(), ans_vec.end(), 0);
cout << ans << endl;
for (ll i = 1; i <= n; i++) {
if (ans_vec[i] == 1) {
cout << i << " ";
}
}
return 0;
} | [
"assignment.value.change",
"identifier.change"
] | 778,840 | 778,841 | u206390872 | cpp |
p02972 | /*
Rohit645
Rohit Kumar
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using pll = pair<ll, ll>;
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void __f(const char *name, Arg1 &&arg1) {
cerr << name << " : " << arg1 << std ::endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&...args) {
const char *comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << " : " << arg1 << " | ";
__f(comma + 1, args...);
}
#else
#define trace(...)
#endif
#define pb push_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define fastIo() \
ios_base ::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
const int MOD = 1e9 + 7, INF = INT_MAX, N = 1e5 + 10;
int main() {
fastIo();
ll n;
cin >> n;
vector<ll> vec(n + 1, 0);
vector<ll> ans_vec(n + 1, 0);
for (ll i = 1; i <= n; i++) {
ll a;
cin >> a;
vec[i] = a;
}
for (ll i = n; i >= 1; i--) {
ll sum = 0;
for (ll j = 2 * i; j <= n; j += i) {
sum += vec[j];
}
ans_vec[i] = vec[i] ^ (sum % 2);
}
ll ans = accumulate(ans_vec.begin(), ans_vec.end(), 0);
cout << ans << endl;
for (ll i = 1; i < n; i++) {
if (ans_vec[i] == 1) {
cout << i << " ";
}
}
return 0;
} | /*
Rohit645
Rohit Kumar
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using pll = pair<ll, ll>;
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void __f(const char *name, Arg1 &&arg1) {
cerr << name << " : " << arg1 << std ::endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&...args) {
const char *comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << " : " << arg1 << " | ";
__f(comma + 1, args...);
}
#else
#define trace(...)
#endif
#define pb push_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define fastIo() \
ios_base ::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
const int MOD = 1e9 + 7, INF = INT_MAX, N = 1e5 + 10;
int main() {
fastIo();
ll n;
cin >> n;
vector<ll> vec(n + 1, 0);
vector<ll> ans_vec(n + 1, 0);
for (ll i = 1; i <= n; i++) {
ll a;
cin >> a;
vec[i] = a;
}
for (ll i = n; i >= 1; i--) {
ll sum = 0;
for (ll j = 2 * i; j <= n; j += i) {
sum += ans_vec[j];
}
ans_vec[i] = vec[i] ^ (sum % 2);
}
ll ans = accumulate(ans_vec.begin(), ans_vec.end(), 0);
cout << ans << endl;
for (ll i = 1; i <= n; i++) {
if (ans_vec[i] == 1) {
cout << i << " ";
}
}
return 0;
} | [
"assignment.value.change",
"identifier.change",
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 778,842 | 778,841 | u206390872 | cpp |
p02972 | #include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define ll long long
#define INF 1000000000000000001
#define MOD 1000000007
using namespace std;
int main() {
int N;
cin >> N;
int a[200001];
a[0] = 0;
for (int i = 1; i <= N; i++) {
cin >> a[i];
}
int M = 0;
int ball[200001] = {};
for (int i = N; i >= 1; i--) {
int temp = 0;
for (int j = i * 2; j <= N; j += i) {
temp = (temp ^ ball[j]);
}
ball[i] = (temp ^ a[i]);
if (ball[i] == 1) {
M++;
}
}
cout << M << endl;
if (M == 0) {
return 0;
}
for (int i = 1; i <= N; i++) {
if (ball[i] == 1) {
cout << i;
}
M--;
if (M > 0) {
cout << " ";
} else {
cout << endl;
break;
}
}
return 0;
}
| #include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define ll long long
#define INF 1000000000000000001
#define MOD 1000000007
using namespace std;
int main() {
int N;
cin >> N;
int a[200001];
a[0] = 0;
for (int i = 1; i <= N; i++) {
cin >> a[i];
}
int M = 0;
int ball[200001] = {};
for (int i = N; i >= 1; i--) {
int temp = 0;
for (int j = i * 2; j <= N; j += i) {
temp = (temp ^ ball[j]);
}
ball[i] = (temp ^ a[i]);
if (ball[i] == 1) {
M++;
}
}
cout << M << endl;
if (M == 0) {
return 0;
}
for (int i = 1; i <= N; i++) {
if (ball[i] == 1) {
cout << i;
} else {
continue;
}
M--;
if (M > 0) {
cout << " ";
} else {
cout << endl;
break;
}
}
return 0;
}
| [
"control_flow.branch.else.add"
] | 778,852 | 778,853 | u251433890 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int N, M = 0, temp = 0;
cin >> N;
vector<int> a(N + 1);
for (int i = 0; i < N; i++) {
cin >> a[i + 1];
}
vector<int> res(N + 1, 0);
for (int i = N; i > 0; i--) {
temp = 0;
for (int j = 1; i * j <= N; j++) {
temp ^= res[i * j + 1];
}
if (res[i] = temp ^ a[i])
M++;
}
cout << M << endl;
for (int i = 1; i <= N; i++) {
if (res[i])
cout << i << " ";
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int N, M = 0, temp = 0;
cin >> N;
vector<int> a(N + 1);
for (int i = 0; i < N; i++) {
cin >> a[i + 1];
}
vector<int> res(N + 1, 0);
for (int i = N; i > 0; i--) {
temp = 0;
for (int j = 1; i * j <= N; j++) {
temp ^= res[i * j];
}
if (res[i] = temp ^ a[i])
M++;
}
cout << M << endl;
for (int i = 1; i <= N; i++) {
if (res[i])
cout << i << " ";
}
return 0;
} | [
"expression.operation.binary.remove"
] | 778,856 | 778,857 | u703503553 | cpp |
p02972 | #include "algorithm"
#include "bitset"
#include "cassert"
#include "climits"
#include "cmath"
#include "cstdio"
#include "functional"
#include "iomanip"
#include "iostream"
#include "list"
#include "map"
#include "numeric"
#include "queue"
#include "random"
#include "set"
#include "stack"
#include "string"
#include "unordered_map"
#include "unordered_set"
using namespace std;
// constexpr long long int MOD = 1000000007;
// constexpr int MOD = 1000000007;
constexpr int MOD = 998244353;
// constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;
// int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> N;
vector<int> v(N + 1);
for (int i = 1; i <= N; i++)
cin >> v[i];
vector<int> p(N + 1);
vector<int> ans;
for (int i = N; i >= 1; i--) {
int num = 0;
for (int j = i; j <= N; j += i)
num += p[i];
num &= 1;
if (v[i] != num) {
p[i]++;
ans.push_back(i);
}
}
cout << ans.size() << endl;
for (auto i : ans)
cout << i << " ";
cout << endl;
} | #include "algorithm"
#include "bitset"
#include "cassert"
#include "climits"
#include "cmath"
#include "cstdio"
#include "functional"
#include "iomanip"
#include "iostream"
#include "list"
#include "map"
#include "numeric"
#include "queue"
#include "random"
#include "set"
#include "stack"
#include "string"
#include "unordered_map"
#include "unordered_set"
using namespace std;
// constexpr long long int MOD = 1000000007;
// constexpr int MOD = 1000000007;
constexpr int MOD = 998244353;
// constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;
// int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> N;
vector<int> v(N + 1);
for (int i = 1; i <= N; i++)
cin >> v[i];
vector<int> p(N + 1);
vector<int> ans;
for (int i = N; i >= 1; i--) {
int num = 0;
for (int j = i; j <= N; j += i) {
// cout << i << " " << j << endl;
num += p[j];
}
// cout << i << " " << num << endl;
num &= 1;
// cout <<i<<" "<< num << endl;
if (v[i] != num) {
// cout << "i " << i << endl;
p[i]++;
ans.push_back(i);
}
}
// for (auto i : p)cout << i << endl;
cout << ans.size() << endl;
for (auto i : ans)
cout << i << " ";
cout << endl;
} | [
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change"
] | 778,858 | 778,859 | u468700753 | cpp |
p02972 | #include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
vector<int> box(n, 0);
vector<int> res;
for (int i = n; i > 0; --i) {
int s = 0;
for (int j = i; j <= n; j += i) {
s += box[j - 1];
}
if (s % 2 != a[i - 1]) {
a[i - 1] = 1;
res.push_back(i);
}
}
cout << res.size() << endl;
for (auto i : res) {
cout << i << " ";
}
cout << endl;
}
| #include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
vector<int> box(n, 0);
vector<int> res;
for (int i = n; i > 0; --i) {
int s = 0;
for (int j = i; j <= n; j += i) {
s += box[j - 1];
}
if (s % 2 != a[i - 1]) {
box[i - 1] = 1;
res.push_back(i);
}
}
cout << res.size() << endl;
for (auto i : res) {
cout << i << " ";
}
cout << endl;
}
| [
"assignment.variable.change",
"identifier.change"
] | 778,860 | 778,861 | u305396672 | cpp |
p02972 | #include <bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = []() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
return 0;
}();
int main() {
int n;
cin >> n;
vector<int> A(n + 1, 0);
for (int i = 1; i <= n; i++) {
cin >> A[i];
}
vector<int> ans(n + 1, 0);
for (int i = n; i >= 1; i--) {
int cnt = 0;
for (int j = i; j <= n; j += i) {
cnt += ans[j];
}
if (cnt % 2 != A[i])
ans[i] = 1;
}
cout << accumulate(ans.begin(), ans.end(), 0) << endl;
for (int i = 1; i <= n; i++)
if (ans[i] != 0)
cout << ans[i] << " ";
cout << endl;
return 0;
}
| #include <bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = []() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
return 0;
}();
int main() {
int n;
cin >> n;
vector<int> A(n + 1, 0);
for (int i = 1; i <= n; i++) {
cin >> A[i];
}
vector<int> ans(n + 1, 0);
for (int i = n; i >= 1; i--) {
int cnt = 0;
for (int j = i; j <= n; j += i) {
cnt += ans[j];
}
if ((cnt % 2) != A[i])
ans[i] = 1;
}
cout << accumulate(ans.begin(), ans.end(), 0) << endl;
for (int i = 1; i <= n; i++)
if (ans[i] != 0)
cout << i << " ";
cout << endl;
return 0;
}
| [
"control_flow.branch.if.condition.change"
] | 778,864 | 778,865 | u067694854 | cpp |
p02972 | #include "bits/stdc++.h"
using namespace std;
#define int long long
#define ll long long
typedef pair<int, int> P;
#define mod 998244353
#define INF (1LL << 60)
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define YES puts("YES\n")
#define Yes puts("Yes\n")
#define NO puts("NO\n")
#define No puts("No\n")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
signed main() {
int N;
cin >> N;
vector<int> a(N + 1);
for (int i = 1; i <= N; i++)
cin >> a[i];
vector<bool> b(N + 1, false);
for (int i = N; i >= 1; i--) {
int cnt = 0;
for (int m = 2 * i; m <= N; m += i) {
if (b[m])
cnt++;
}
if (cnt % 2 != a[i])
b[i] = true;
}
int ans = 0;
for (int i = 1; i <= N; i++)
if (b[i])
ans++;
cout << ans << endl;
for (int i = 1; i <= N; i++)
if (b[i])
cout << b[i] << " ";
return 0;
} | #include "bits/stdc++.h"
using namespace std;
#define int long long
#define ll long long
typedef pair<int, int> P;
#define mod 998244353
#define INF (1LL << 60)
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define YES puts("YES\n")
#define Yes puts("Yes\n")
#define NO puts("NO\n")
#define No puts("No\n")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
signed main() {
int N;
cin >> N;
vector<int> a(N + 1);
for (int i = 1; i <= N; i++)
cin >> a[i];
vector<bool> b(N + 1, false);
for (int i = N; i >= 1; i--) {
int cnt = 0;
for (int m = 2 * i; m <= N; m += i) {
if (b[m])
cnt++;
}
if (cnt % 2 != a[i])
b[i] = true;
}
int ans = 0;
for (int i = 1; i <= N; i++)
if (b[i])
ans++;
cout << ans << endl;
for (int i = 1; i <= N; i++)
if (b[i])
cout << i << " ";
return 0;
} | [] | 778,868 | 778,869 | u592610268 | cpp |
p02972 | #include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
int cnt = 0;
vector<bool> in(n + 1, false);
for (int i = n; i > 0; i--) {
int sum = 0;
for (int j = i + i; j < n; j += i) {
if (in[j])
sum++;
}
if (sum % 2 != a[i - 1])
in[i] = true, cnt++;
}
cout << cnt << endl;
for (int i = 1; i <= n && cnt; i++) {
if (in[i]) {
if (cnt > 1)
cout << i << " ";
else
cout << i << endl;
cnt--;
}
}
}
| #include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
int cnt = 0;
vector<bool> in(n + 1, false);
for (int i = n; i > 0; i--) {
int sum = 0;
for (int j = i + i; j <= n; j += i) {
if (in[j])
sum++;
}
if (sum % 2 != a[i - 1])
in[i] = true, cnt++;
}
cout << cnt << endl;
for (int i = 1; i <= n && cnt; i++) {
if (in[i]) {
if (cnt > 1)
cout << i << " ";
else
cout << i << endl;
cnt--;
}
}
}
| [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 778,879 | 778,880 | u770509135 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
#define SORT(x) sort(x.begin(), x.end())
#define ALL(x) x.begin(), x.end()
#define rep(i, n) for (int i = 0; i < n; i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
#define No cout << "No" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define YES cout << "YES" << endl;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int main() {
int n;
cin >> n;
int a[n + 1];
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
int b[n + 1] = {};
for (int i = n; i > 0; i--) {
b[i] = a[i];
for (int j = i + i; j <= n; j += j) {
b[i] += b[j];
}
b[i] = b[i] % 2;
}
int ans = 0;
for (int i = 1; i <= n; i++) {
if (b[i] > 0) {
ans++;
}
}
cout << ans << endl;
for (int i = 1; i <= n; i++) {
if (b[i] > 0) {
cout << i << endl;
}
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define SORT(x) sort(x.begin(), x.end())
#define ALL(x) x.begin(), x.end()
#define rep(i, n) for (int i = 0; i < n; i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
#define No cout << "No" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define YES cout << "YES" << endl;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int main() {
int n;
cin >> n;
int a[n + 1];
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
int b[n + 1] = {};
for (int i = n; i > 0; i--) {
b[i] = a[i];
for (int j = i + i; j <= n; j += i) {
b[i] += b[j];
}
b[i] = b[i] % 2;
}
int ans = 0;
for (int i = 1; i <= n; i++) {
if (b[i] > 0) {
ans++;
}
}
cout << ans << endl;
for (int i = 1; i <= n; i++) {
if (b[i] > 0) {
cout << i << endl;
}
}
return 0;
}
| [
"assignment.value.change",
"identifier.change"
] | 778,881 | 778,882 | u022832318 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, M = 0, tmp = 0;
cin >> N;
vector<int> a(2 * N), b(2 * N);
for (int i = 1; i <= N; i++) {
cin >> a[i];
}
for (int i = N; i > 0; i--) {
tmp = a[i];
for (int j = 2 * i; j <= N; j += i) {
tmp ^= a[j];
}
b[i] = tmp;
if (b[i] == 1)
M++;
}
cout << M << endl;
for (int i = 1; i <= N; i++) {
if (b[i] == 1)
cout << i << " ";
}
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int N, M = 0, tmp = 0;
cin >> N;
vector<int> a(2 * N), b(2 * N);
for (int i = 1; i <= N; i++) {
cin >> a[i];
}
for (int i = N; i > 0; i--) {
tmp = a[i];
for (int j = 2 * i; j <= N; j += i) {
tmp ^= b[j];
}
b[i] = tmp;
if (b[i] == 1)
M++;
}
cout << M << endl;
for (int i = 1; i <= N; i++) {
if (b[i] == 1)
cout << i << " ";
}
}
| [
"assignment.value.change",
"identifier.change"
] | 778,885 | 778,886 | u074306398 | cpp |
p02972 | #include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <string>
#include <utility>
#include <vector>
#define rep(i, a, n) for (int(i) = (a); (i) < (n); (i)++)
#define rrep(i, a, n) for (int(i) = (a); (i) >= (n); (i)--)
#define INF 1000000000
#define MOD 1000000007
typedef long long ll;
using namespace std;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
double euclid_distance(double a, double b) { return sqrt(a * a + b * b); }
ll gcd(ll a, ll b) {
ll r;
if (a < b) {
ll tmp;
tmp = a;
a = b;
b = tmp;
}
while (r = a % b) {
a = b;
b = r;
}
return b;
}
void Integer_factorization(long long int b, long long int n) {
long long int a = 2;
long long int count = 0;
long long int ans = 1;
long long int ndash = n;
if (b == 1)
cout << n << endl;
else {
while (ndash >= a * a) {
if (n % a == 0) {
count++;
n /= a;
if (count % b == 0) {
ans *= a;
}
} else {
a++;
count = 0;
}
}
cout << ans << endl;
}
}
ll r_fuct[2000];
ll fuct[2000];
// MOD逆元
void conb(ll n, ll k) {
fuct[0] = 1;
for (int i = 1; i < k + 1; i++) {
fuct[i] *= fuct[i - 1] % MOD;
ll b = MOD, u = 1, v = 0;
ll value = fuct[i];
while (b) {
ll t = value / b;
value -= t * b;
swap(value, b);
u -= t * v;
swap(u, v);
}
u %= MOD;
if (u < 0)
u += MOD;
r_fuct[i] = u;
}
}
void solve() {
ll n;
cin >> n;
ll a[n + 1], b[n + 1], ans[n + 1];
for (int i = 1; i < n + 1; i++) {
cin >> a[i];
b[i] = 0;
ans[i] = 0;
}
ll sum = 0;
for (int i = n; i >= 1; i--) {
if (i * 2 > n) {
if (a[i] == 1) {
ans[i] = 1;
sum++;
}
} else {
ll tmp = 0;
for (ll j = 2 * i; j <= n; j += i) {
if (ans[i] == 1)
tmp++;
}
if (a[i] != tmp % 2) {
ans[i] = 1;
sum++;
}
}
}
cout << sum << endl;
if (sum != 0) {
for (int i = 1; i < n + 1; i++) {
if (ans[i] == 1)
cout << i << endl;
}
}
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
solve();
return 0;
}
| #include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <string>
#include <utility>
#include <vector>
#define rep(i, a, n) for (int(i) = (a); (i) < (n); (i)++)
#define rrep(i, a, n) for (int(i) = (a); (i) >= (n); (i)--)
#define INF 1000000000
#define MOD 1000000007
typedef long long ll;
using namespace std;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
double euclid_distance(double a, double b) { return sqrt(a * a + b * b); }
ll gcd(ll a, ll b) {
ll r;
if (a < b) {
ll tmp;
tmp = a;
a = b;
b = tmp;
}
while (r = a % b) {
a = b;
b = r;
}
return b;
}
void Integer_factorization(long long int b, long long int n) {
long long int a = 2;
long long int count = 0;
long long int ans = 1;
long long int ndash = n;
if (b == 1)
cout << n << endl;
else {
while (ndash >= a * a) {
if (n % a == 0) {
count++;
n /= a;
if (count % b == 0) {
ans *= a;
}
} else {
a++;
count = 0;
}
}
cout << ans << endl;
}
}
ll r_fuct[2000];
ll fuct[2000];
// MOD逆元
void conb(ll n, ll k) {
fuct[0] = 1;
for (int i = 1; i < k + 1; i++) {
fuct[i] *= fuct[i - 1] % MOD;
ll b = MOD, u = 1, v = 0;
ll value = fuct[i];
while (b) {
ll t = value / b;
value -= t * b;
swap(value, b);
u -= t * v;
swap(u, v);
}
u %= MOD;
if (u < 0)
u += MOD;
r_fuct[i] = u;
}
}
void solve() {
ll n;
cin >> n;
ll a[n + 1], b[n + 1], ans[n + 1];
for (int i = 1; i < n + 1; i++) {
cin >> a[i];
b[i] = 0;
ans[i] = 0;
}
ll sum = 0;
for (int i = n; i >= 1; i--) {
if (i * 2 > n) {
if (a[i] == 1) {
ans[i] = 1;
sum++;
}
} else {
ll tmp = 0;
for (ll j = 2 * i; j <= n; j += i) {
if (ans[j] == 1)
tmp++;
}
if (a[i] != tmp % 2) {
ans[i] = 1;
sum++;
}
}
}
cout << sum << endl;
if (sum != 0) {
for (int i = 1; i < n + 1; i++) {
if (ans[i] == 1)
cout << i << endl;
}
}
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
solve();
return 0;
}
| [
"identifier.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change"
] | 778,891 | 778,892 | u677400065 | cpp |
p02972 |
#include <algorithm>
#include <bitset>
#include <cctype>
#include <climits>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <typeinfo>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
template <typename T>
using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1LL << 60;
#define all(x) (x).begin(), (x).end()
#define puts(x) cout << x << endl
#define rep(i, m, n) for (ll i = m; i < n; ++i)
#define pb push_back
#define fore(i, a) for (auto &i : a)
#define rrep(i, m, n) for (ll i = m; i >= n; --i)
#define INF INT_MAX / 2
vector<ll> dv;
void divisor(ll n) {
dv.clear();
for (ll i = 1; i * i <= n; i++) {
if (n % i == 0) {
if (i == n / i) {
dv.push_back(i);
} else {
dv.push_back(i);
dv.push_back(n / i);
}
}
}
}
int main() {
ll n;
cin >> n;
vector<ll> a(n + 1);
rep(i, 0, n) cin >> a[i + 1];
vector<ll> ans(n + 1);
vector<ll> sum(n + 1);
for (ll i = n; i >= 1; i--) {
ans[i] = ((sum[i] % 2) == a[i]) ? 0 : 1;
divisor(i);
fore(x, dv) sum[x] += ans[i];
}
vector<ll> b;
rep(i, 0, n) if (ans[i]) b.pb(i);
puts(b.size());
rep(i, 0, b.size()) { cout << b[i] << " "; }
if (b.size())
puts("");
return 0;
} |
#include <algorithm>
#include <bitset>
#include <cctype>
#include <climits>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <typeinfo>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
template <typename T>
using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1LL << 60;
#define all(x) (x).begin(), (x).end()
#define puts(x) cout << x << endl
#define rep(i, m, n) for (ll i = m; i < n; ++i)
#define pb push_back
#define fore(i, a) for (auto &i : a)
#define rrep(i, m, n) for (ll i = m; i >= n; --i)
#define INF INT_MAX / 2
vector<ll> dv;
void divisor(ll n) {
dv.clear();
for (ll i = 1; i * i <= n; i++) {
if (n % i == 0) {
if (i == n / i) {
dv.push_back(i);
} else {
dv.push_back(i);
dv.push_back(n / i);
}
}
}
}
int main() {
ll n;
cin >> n;
vector<ll> a(n + 1);
rep(i, 0, n) cin >> a[i + 1];
vector<ll> ans(n + 1);
vector<ll> sum(n + 1);
for (ll i = n; i >= 1; i--) {
ans[i] = ((sum[i] % 2) == a[i]) ? 0 : 1;
divisor(i);
fore(x, dv) { sum[x] += ans[i]; }
}
vector<int> b;
rep(i, 1, n + 1) if (ans[i]) b.pb(i);
puts(b.size());
rep(i, 0, b.size()) { cout << b[i] << " "; }
if (b.size())
puts("");
return 0;
}
| [
"literal.number.change",
"call.arguments.change"
] | 778,893 | 778,894 | u724732842 | cpp |
p02972 | #include <algorithm>
#include <cmath>
#include <iostream>
#include <queue>
#include <string>
using namespace std;
using ll = long long;
int N;
vector<ll> a(200001);
vector<ll> b(200001);
int sumball;
int main() {
cin >> N;
for (int i = 0; i < N; i++) {
cin >> a[i + 1];
}
for (int i = N; i >= 1; i--) {
int k = i * 2, cnt = 0;
while (k < N) {
if (b[k] == 1)
cnt++;
k += i;
}
if (cnt % 2 == a[i])
continue;
else {
b[i] = 1;
sumball++;
}
}
cout << sumball << endl;
for (int i = 1; i <= N; i++) {
if (b[i] == 1)
cout << i << endl;
}
return 0;
} | #include <algorithm>
#include <cmath>
#include <iostream>
#include <queue>
#include <string>
using namespace std;
using ll = long long;
int N;
vector<ll> a(200001);
vector<ll> b(200001);
int sumball;
int main() {
cin >> N;
for (int i = 0; i < N; i++) {
cin >> a[i + 1];
}
for (int i = N; i >= 1; i--) {
int k = i * 2, cnt = 0;
while (k <= N) {
if (b[k] == 1)
cnt++;
k += i;
}
if (cnt % 2 == a[i])
continue;
else {
b[i] = 1;
sumball++;
}
}
cout << sumball << endl;
for (int i = 1; i <= N; i++) {
if (b[i] == 1)
cout << i << endl;
}
return 0;
} | [
"expression.operator.compare.change",
"control_flow.loop.condition.change"
] | 778,895 | 778,896 | u378155378 | cpp |
p02972 | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define mkp make_pair
#define pb push_back
#define ff first
#define ss second
#define debug1(a) cout << a << endl;
#define debug2(a, b) cout << a << ' ' << b << endl;
#define debug3(a, b, c) cout << a < ' ' << b << ' ' << c << endl;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, a, b) for (int i = a; i < b; i++)
#define repre(i, a, b) for (int i = a; i <= b; i++)
#define pi pair<int, int>
#define pii pair<int, pi>
#define sortV(v) v.begin(), v.end()
//#define mp map<int,int>
//#define ump unordered_map<int,int>
#define st set<int>
#define mst multiset<int>
#define pq priority_queue
#define mpq priority_queue<int, vector<int>, greater<int>>
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update>
orderedSet;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag,
tree_order_statistics_node_update>
orderedMSet;
//*p.find_by_order(index) return value at index
// p.order_of_key(key) return index
int32_t main() {
fastio int n;
cin >> n;
int arr[n + 1];
repre(i, 1, n) cin >> arr[i];
int res = 0;
int ans[n + 1] = {0};
int temp = n / 2;
for (int i = temp + 1; i <= n; i++) {
if (arr[i] == 1) {
ans[i] = 1;
res++;
}
}
for (int i = temp; i >= 1; i--) {
int sum = 0;
for (int j = temp; j <= n; j += temp)
sum += ans[j];
int curr = sum % 2;
if (curr == arr[i])
ans[i] = 0;
else {
ans[i] = 1;
res++;
}
}
cout << res << endl;
repre(i, 1, n) {
if (ans[i] != 0)
cout << i << " ";
}
return 0;
}
| #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define mkp make_pair
#define pb push_back
#define ff first
#define ss second
#define debug1(a) cout << a << endl;
#define debug2(a, b) cout << a << ' ' << b << endl;
#define debug3(a, b, c) cout << a < ' ' << b << ' ' << c << endl;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, a, b) for (int i = a; i < b; i++)
#define repre(i, a, b) for (int i = a; i <= b; i++)
#define pi pair<int, int>
#define pii pair<int, pi>
#define sortV(v) v.begin(), v.end()
//#define mp map<int,int>
//#define ump unordered_map<int,int>
#define st set<int>
#define mst multiset<int>
#define pq priority_queue
#define mpq priority_queue<int, vector<int>, greater<int>>
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update>
orderedSet;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag,
tree_order_statistics_node_update>
orderedMSet;
//*p.find_by_order(index) return value at index
// p.order_of_key(key) return index
int32_t main() {
fastio int n;
cin >> n;
int arr[n + 1];
repre(i, 1, n) cin >> arr[i];
int res = 0;
int ans[n + 1] = {0};
int temp = n / 2;
for (int i = temp + 1; i <= n; i++) {
if (arr[i] == 1) {
ans[i] = 1;
res++;
}
}
for (int i = temp; i >= 1; i--) {
int sum = 0;
for (int j = i; j <= n; j += i)
sum += ans[j];
int curr = sum % 2;
if (curr == arr[i])
ans[i] = 0;
else {
ans[i] = 1;
res++;
}
}
cout << res << endl;
repre(i, 1, n) {
if (ans[i] != 0)
cout << i << " ";
}
return 0;
}
| [
"variable_declaration.value.change",
"identifier.change",
"control_flow.loop.for.initializer.change",
"assignment.value.change"
] | 778,897 | 778,898 | u754112329 | cpp |
p02972 | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define mkp make_pair
#define pb push_back
#define ff first
#define ss second
#define debug1(a) cout << a << endl;
#define debug2(a, b) cout << a << ' ' << b << endl;
#define debug3(a, b, c) cout << a < ' ' << b << ' ' << c << endl;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, a, b) for (int i = a; i < b; i++)
#define repre(i, a, b) for (int i = a; i <= b; i++)
#define pi pair<int, int>
#define pii pair<int, pi>
#define sortV(v) v.begin(), v.end()
//#define mp map<int,int>
//#define ump unordered_map<int,int>
#define st set<int>
#define mst multiset<int>
#define pq priority_queue
#define mpq priority_queue<int, vector<int>, greater<int>>
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update>
orderedSet;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag,
tree_order_statistics_node_update>
orderedMSet;
//*p.find_by_order(index) return value at index
// p.order_of_key(key) return index
int32_t main() {
fastio int n;
cin >> n;
int arr[n + 1];
repre(i, 1, n) cin >> arr[i];
int res = 0;
int ans[n + 1] = {0};
int temp = n / 2;
for (int i = temp + 1; i <= n; i++) {
if (arr[i] == 1) {
ans[i] = 1;
res++;
}
}
for (int i = temp; i >= 1; i--) {
int sum = 0;
for (int j = temp; j <= n; j += temp)
sum += ans[i];
int curr = sum % 2;
if (curr == arr[i])
ans[i] = 0;
else {
ans[i] = 1;
res++;
}
}
cout << res << endl;
repre(i, 1, n) {
if (ans[i] != 0)
cout << i << " ";
}
return 0;
}
| #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define mkp make_pair
#define pb push_back
#define ff first
#define ss second
#define debug1(a) cout << a << endl;
#define debug2(a, b) cout << a << ' ' << b << endl;
#define debug3(a, b, c) cout << a < ' ' << b << ' ' << c << endl;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, a, b) for (int i = a; i < b; i++)
#define repre(i, a, b) for (int i = a; i <= b; i++)
#define pi pair<int, int>
#define pii pair<int, pi>
#define sortV(v) v.begin(), v.end()
//#define mp map<int,int>
//#define ump unordered_map<int,int>
#define st set<int>
#define mst multiset<int>
#define pq priority_queue
#define mpq priority_queue<int, vector<int>, greater<int>>
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update>
orderedSet;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag,
tree_order_statistics_node_update>
orderedMSet;
//*p.find_by_order(index) return value at index
// p.order_of_key(key) return index
int32_t main() {
fastio int n;
cin >> n;
int arr[n + 1];
repre(i, 1, n) cin >> arr[i];
int res = 0;
int ans[n + 1] = {0};
int temp = n / 2;
for (int i = temp + 1; i <= n; i++) {
if (arr[i] == 1) {
ans[i] = 1;
res++;
}
}
for (int i = temp; i >= 1; i--) {
int sum = 0;
for (int j = i; j <= n; j += i)
sum += ans[j];
int curr = sum % 2;
if (curr == arr[i])
ans[i] = 0;
else {
ans[i] = 1;
res++;
}
}
cout << res << endl;
repre(i, 1, n) {
if (ans[i] != 0)
cout << i << " ";
}
return 0;
}
| [
"variable_declaration.value.change",
"identifier.change",
"control_flow.loop.for.initializer.change",
"assignment.value.change",
"variable_access.subscript.index.change"
] | 778,899 | 778,898 | u754112329 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
namespace {
#define DUMPOUT cerr
#ifndef DEBUG_
#define dump(...)
#else
#define dump(...) \
DUMPOUT << " "; \
DUMPOUT << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ << "]" \
<< endl; \
DUMPOUT << " "; \
dump_func(__VA_ARGS__)
#endif
void dump_func() { DUMPOUT << endl; }
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&...tail) {
DUMPOUT << head;
if (sizeof...(Tail) == 0) {
DUMPOUT << " ";
} else {
DUMPOUT << ", ";
}
dump_func(std::move(tail)...);
}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
for (auto i = begin(v); i != end(v); ++i)
os << *i << (i == end(v) - 1 ? "" : " ");
return os;
}
template <class T> void out2Dvector(vector<T> v) {
for (const auto &vv : v)
cout << vv << endl;
}
template <class T> istream &operator>>(istream &is, vector<T> &v) {
for (auto i = begin(v); i != end(v); ++i)
is >> *i;
return is;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
os << "(" << pair_var.first << ", " << pair_var.second << ")";
return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
os << "{";
for (auto itr = map_var.begin(); itr != map_var.end(); itr++) {
os << "(" << itr->first << ", " << itr->second << ")";
itr++;
if (itr != map_var.end())
os << ", ";
itr--;
}
os << "}";
return os;
}
template <typename T> ostream &operator<<(ostream &os, set<T> &set_var) {
os << "{";
for (auto itr = set_var.begin(); itr != set_var.end(); itr++) {
os << *itr;
++itr;
if (itr != set_var.end())
os << ", ";
itr--;
}
os << "}";
return os;
}
} // namespace
namespace {
using ull = unsigned long long;
using ll = long long;
using ld = long double;
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REPR(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define even(x) (x) % 2 == 0
#define odd(x) (x) % 2 != 0
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define inp(t, x) \
t x; \
cin >> x;
#define ithBit(n, i) ((n) >> (i)&1)
#define INIT() \
cin.tie(0); \
ios::sync_with_stdio(0); \
cout << fixed << setprecision(20)
// these functions return the position of result of Binary Search.
#define LB(s, t, x) (int)(lower_bound(s, t, x) - s)
#define UB(s, t, x) (int)(upper_bound(s, t, x) - s)
#define M_PI 3.14159265358979323846
ll qp(ll a, ll b, int mo) {
ll ans = 1;
do {
if (b & 1)
ans = 1ll * ans * a % mo;
a = 1ll * a * a % mo;
} while (b >>= 1);
return ans;
}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) {
ll temp = gcd(a, b);
return temp ? (a / temp * b) : 0;
}
int mDays[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dx8[] = {1, -1, 0, 0, 1, 1, -1, -1}, dy8[] = {0, 0, -1, 1, -1, 1, -1, 1};
template <typename F>
class
#if defined(__has_cpp_attribute) && __has_cpp_attribute(nodiscard)
[[nodiscard]]
#elif defined(__GNUC__) && __GNUC_PREREQ(3, 4)
__attribute__((warn_unused_result))
#endif // defined(__has_cpp_attribute) && __has_cpp_attribute(nodiscard)
FixPoint : F {
public:
explicit constexpr FixPoint(F &&f) noexcept : F(std::forward<F>(f)) {}
template <typename... Args>
constexpr decltype(auto) operator()(Args &&...args) const {
return F::operator()(*this, std::forward<Args>(args)...);
} // namespace
}; // class FixPoint
template <typename F>
static inline constexpr decltype(auto) makeFixPoint(F &&f) noexcept {
return FixPoint<F>{std::forward<F>(f)};
}
template <typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts>
auto make_v(size_t a, size_t b, Ts... ts) {
return vector<decltype(make_v<T>(b, ts...))>(a, make_v<T>(b, ts...));
}
template <typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value != 0>::type fill_v(U &u, const V... v) {
u = U(v...);
}
template <typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value == 0>::type fill_v(U &u, const V... v) {
for (auto &e : u)
fill_v<T>(e, v...);
}
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;
}
inline bool rangeCheck2D(int nx, int ny, int Width, int Height) {
return nx >= 0 and nx < Width and ny >= 0 and ny < Height;
}
int i_query(int a, int b) {
cout << "? " << a << " " << b << endl;
fflush(stdout);
ll ret;
cin >> ret;
return ret;
}
void i_answer(vector<ll> ans) {
cout << "! " << ans << endl;
fflush(stdout);
}
} // namespace
/*
tuple binding
auto [x, y] = make_tuple(0, 0);
for pair
auto [a, b] = pair<int, int>({v1, v2});
bitset<N> bs(ini_val); // N must be constant
bs.reset(); // reset all
*/
int main(void) {
INIT(); // comment out for Interective Problem
inp(ll, N);
vector<ll> a(N);
cin >> a;
vector<ll> ans;
vector<int> fill(N + 1);
for (int i = N; i >= 1; --i) {
ll cnt = 0;
for (ll j = 2 * i; j < N; j += i) {
cnt += fill[j];
}
if (a[i - 1] != (cnt % 2)) {
fill[i] = true;
ans.push_back(i);
}
}
cout << ans.size() << endl << ans << endl;
return 0;
}
//*/
| #include <bits/stdc++.h>
using namespace std;
namespace {
#define DUMPOUT cerr
#ifndef DEBUG_
#define dump(...)
#else
#define dump(...) \
DUMPOUT << " "; \
DUMPOUT << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ << "]" \
<< endl; \
DUMPOUT << " "; \
dump_func(__VA_ARGS__)
#endif
void dump_func() { DUMPOUT << endl; }
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&...tail) {
DUMPOUT << head;
if (sizeof...(Tail) == 0) {
DUMPOUT << " ";
} else {
DUMPOUT << ", ";
}
dump_func(std::move(tail)...);
}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
for (auto i = begin(v); i != end(v); ++i)
os << *i << (i == end(v) - 1 ? "" : " ");
return os;
}
template <class T> void out2Dvector(vector<T> v) {
for (const auto &vv : v)
cout << vv << endl;
}
template <class T> istream &operator>>(istream &is, vector<T> &v) {
for (auto i = begin(v); i != end(v); ++i)
is >> *i;
return is;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
os << "(" << pair_var.first << ", " << pair_var.second << ")";
return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
os << "{";
for (auto itr = map_var.begin(); itr != map_var.end(); itr++) {
os << "(" << itr->first << ", " << itr->second << ")";
itr++;
if (itr != map_var.end())
os << ", ";
itr--;
}
os << "}";
return os;
}
template <typename T> ostream &operator<<(ostream &os, set<T> &set_var) {
os << "{";
for (auto itr = set_var.begin(); itr != set_var.end(); itr++) {
os << *itr;
++itr;
if (itr != set_var.end())
os << ", ";
itr--;
}
os << "}";
return os;
}
} // namespace
namespace {
using ull = unsigned long long;
using ll = long long;
using ld = long double;
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REPR(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define even(x) (x) % 2 == 0
#define odd(x) (x) % 2 != 0
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define inp(t, x) \
t x; \
cin >> x;
#define ithBit(n, i) ((n) >> (i)&1)
#define INIT() \
cin.tie(0); \
ios::sync_with_stdio(0); \
cout << fixed << setprecision(20)
// these functions return the position of result of Binary Search.
#define LB(s, t, x) (int)(lower_bound(s, t, x) - s)
#define UB(s, t, x) (int)(upper_bound(s, t, x) - s)
#define M_PI 3.14159265358979323846
ll qp(ll a, ll b, int mo) {
ll ans = 1;
do {
if (b & 1)
ans = 1ll * ans * a % mo;
a = 1ll * a * a % mo;
} while (b >>= 1);
return ans;
}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) {
ll temp = gcd(a, b);
return temp ? (a / temp * b) : 0;
}
int mDays[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dx8[] = {1, -1, 0, 0, 1, 1, -1, -1}, dy8[] = {0, 0, -1, 1, -1, 1, -1, 1};
template <typename F>
class
#if defined(__has_cpp_attribute) && __has_cpp_attribute(nodiscard)
[[nodiscard]]
#elif defined(__GNUC__) && __GNUC_PREREQ(3, 4)
__attribute__((warn_unused_result))
#endif // defined(__has_cpp_attribute) && __has_cpp_attribute(nodiscard)
FixPoint : F {
public:
explicit constexpr FixPoint(F &&f) noexcept : F(std::forward<F>(f)) {}
template <typename... Args>
constexpr decltype(auto) operator()(Args &&...args) const {
return F::operator()(*this, std::forward<Args>(args)...);
} // namespace
}; // class FixPoint
template <typename F>
static inline constexpr decltype(auto) makeFixPoint(F &&f) noexcept {
return FixPoint<F>{std::forward<F>(f)};
}
template <typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts>
auto make_v(size_t a, size_t b, Ts... ts) {
return vector<decltype(make_v<T>(b, ts...))>(a, make_v<T>(b, ts...));
}
template <typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value != 0>::type fill_v(U &u, const V... v) {
u = U(v...);
}
template <typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value == 0>::type fill_v(U &u, const V... v) {
for (auto &e : u)
fill_v<T>(e, v...);
}
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;
}
inline bool rangeCheck2D(int nx, int ny, int Width, int Height) {
return nx >= 0 and nx < Width and ny >= 0 and ny < Height;
}
int i_query(int a, int b) {
cout << "? " << a << " " << b << endl;
fflush(stdout);
ll ret;
cin >> ret;
return ret;
}
void i_answer(vector<ll> ans) {
cout << "! " << ans << endl;
fflush(stdout);
}
} // namespace
/*
tuple binding
auto [x, y] = make_tuple(0, 0);
for pair
auto [a, b] = pair<int, int>({v1, v2});
bitset<N> bs(ini_val); // N must be constant
bs.reset(); // reset all
*/
int main(void) {
INIT(); // comment out for Interective Problem
inp(ll, N);
vector<ll> a(N);
cin >> a;
vector<ll> ans;
vector<int> fill(N + 1);
for (int i = N; i >= 1; --i) {
ll cnt = 0;
for (ll j = 2 * i; j <= N; j += i) {
cnt += fill[j];
}
if (a[i - 1] != (cnt % 2)) {
fill[i] = true;
ans.push_back(i);
}
}
cout << ans.size() << endl << ans << endl;
return 0;
}
//*/
| [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 778,902 | 778,903 | u300752229 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const ll mo = 1000000007;
const ll INF = 1LL << 59; // MAX 9223372036854775807
int main() {
ll n;
cin >> n;
ll ans[n + 1] = {};
ll t[n + 1] = {};
rep(i, n) { cin >> t[i + 1]; }
for (ll i = n; i > 0; i--) {
ll ch = i;
ll now = ch;
ll sum = 0;
while (now <= n) {
sum += ans[now];
now += ch;
}
if ((sum % 2) ^ t[i])
ans[i] = 1;
else
ans[i] = 0;
}
ll m = 0;
rep(i, n) {
if (ans[i])
m++;
}
cout << m << endl;
bool aaa = 0;
rep(i, n) {
if (ans[i + 1]) {
if (aaa) {
cout << " ";
}
cout << i + 1;
aaa = 1;
}
}
if (aaa)
cout << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const ll mo = 1000000007;
const ll INF = 1LL << 59; // MAX 9223372036854775807
int main() {
ll n;
cin >> n;
ll ans[n + 1] = {};
ll t[n + 1] = {};
rep(i, n) { cin >> t[i + 1]; }
for (ll i = n; i > 0; i--) {
ll ch = i;
ll now = ch * 2;
ll sum = 0;
while (now <= n) {
sum += ans[now];
now += ch;
}
if ((sum % 2) ^ t[i])
ans[i] = 1;
else
ans[i] = 0;
}
ll m = 0;
rep(i, n + 1) {
if (ans[i])
m++;
}
cout << m << endl;
bool aaa = 0;
rep(i, n) {
if (ans[i + 1]) {
if (aaa) {
cout << " ";
}
cout << i + 1;
aaa = 1;
}
}
if (aaa)
cout << endl;
return 0;
}
| [
"assignment.change",
"expression.operation.binary.add"
] | 778,912 | 778,913 | u419307948 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
#define MAX 200000
int main() {
int N, a[MAX], b[MAX];
int count = 0;
cin >> N;
for (int i = 0; i < N; i++) {
cin >> a[i];
}
for (int i = N; i > 0; i--) {
int A = a[i - 1];
if (i > N / 2)
b[i - 1] = A;
else {
int sum = 0;
for (int j = 2; j * i <= N; j++) {
sum += b[j * i - 1];
}
sum %= 2;
if (sum == A)
b[i - 1] = 0;
else
b[i - 1] = 1;
}
count += b[i - 1];
}
cout << count << endl;
for (int i = 0; i < N; i++)
if (b[i] == 1)
printf("%d ", b[i]);
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define MAX 200000
int main() {
int N, a[MAX], b[MAX];
int count = 0;
cin >> N;
for (int i = 0; i < N; i++) {
cin >> a[i];
}
for (int i = N; i > 0; i--) {
int A = a[i - 1];
if (i > N / 2)
b[i - 1] = A;
else {
int sum = 0;
for (int j = 2; j * i <= N; j++) {
sum += b[j * i - 1];
}
sum %= 2;
if (sum == A)
b[i - 1] = 0;
else
b[i - 1] = 1;
}
count += b[i - 1];
}
cout << count << endl;
for (int i = 0; i < N; i++)
if (b[i] == 1)
printf("%d ", i + 1);
return 0;
} | [
"call.arguments.change",
"io.output.change"
] | 778,914 | 778,915 | u776086908 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
vector<int> a(n + 1);
for (int i = 0; i < n; i++)
cin >> a[i + 1];
vector<int> b(n + 1);
for (int i = n; i >= 1; i--) {
int sum = 0;
for (int j = i + i; j <= n; j += i) {
sum ^= b[j];
}
b[i] = sum ^ a[i];
}
vector<int> ans;
for (int i = 1; i <= n; i++) {
if (b[i])
ans.push_back(i);
}
cout << ans.size() << endl;
for (int i = 1; i < ans.size(); i++) {
if (i + 1 == ans.size())
cout << ans[i] << endl;
else
cout << ans[i] << ' ';
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
vector<int> a(n + 1);
for (int i = 0; i < n; i++)
cin >> a[i + 1];
vector<int> b(n + 1);
for (int i = n; i >= 1; i--) {
int sum = 0;
for (int j = i + i; j <= n; j += i) {
sum ^= b[j];
}
b[i] = sum ^ a[i];
}
vector<int> ans;
for (int i = 1; i <= n; i++) {
if (b[i])
ans.push_back(i);
}
cout << ans.size() << endl;
for (int i = 0; i < ans.size(); i++) {
if (i + 1 == ans.size())
cout << ans[i] << endl;
else
cout << ans[i] << ' ';
}
return 0;
} | [
"literal.number.change",
"variable_declaration.value.change",
"control_flow.loop.for.initializer.change",
"expression.off_by_one"
] | 778,920 | 778,921 | u525137785 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
vector<int> a(n + 1);
for (int i = 0; i < n; i++)
cin >> a[i + 1];
vector<int> b(n + 1);
for (int i = n; i >= 1; i--) {
int sum = 0;
for (int j = i + i; j <= n; j += i) {
sum ^= b[j];
}
b[i] = sum ^ a[i];
}
vector<int> ans;
for (int i = 1; i <= n; i++) {
if (b[i])
ans.push_back(i);
}
cout << ans.size() << endl;
for (int i = 1; i < ans.size(); i++) {
if (i == ans.size())
cout << ans[i] << endl;
else
cout << ans[i + 1] << ' ';
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
vector<int> a(n + 1);
for (int i = 0; i < n; i++)
cin >> a[i + 1];
vector<int> b(n + 1);
for (int i = n; i >= 1; i--) {
int sum = 0;
for (int j = i + i; j <= n; j += i) {
sum ^= b[j];
}
b[i] = sum ^ a[i];
}
vector<int> ans;
for (int i = 1; i <= n; i++) {
if (b[i])
ans.push_back(i);
}
cout << ans.size() << endl;
for (int i = 0; i < ans.size(); i++) {
if (i + 1 == ans.size())
cout << ans[i] << endl;
else
cout << ans[i] << ' ';
}
return 0;
} | [
"literal.number.change",
"variable_declaration.value.change",
"control_flow.loop.for.initializer.change",
"expression.off_by_one",
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change",
"misc.off_by_one",
"expression.operation.binary.remove"
] | 778,922 | 778,921 | u525137785 | cpp |
p02972 | #include <cstdio>
int n;
int a[200005];
int box[200005];
int ans[200005];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", a + i);
}
for (int i = n; i >= 1; i--) {
int sum = 0;
for (int j = i; j <= n; j += i) {
sum += box[j];
}
if (sum % 2 != a[i]) {
int upper = n / i * i;
int flag = 0;
for (int j = upper; j >= 1; j -= i) {
if (box[i] == 0) {
box[i] = 1;
flag = 1;
break;
}
}
if (!flag) {
printf("-1\n");
return 0;
}
}
}
int m = 0;
for (int i = 1; i <= n; i++) {
if (box[i]) {
ans[m++] = 1;
}
}
printf("%d\n", m);
for (int i = 0; i < m; i++) {
printf("%d ", ans[i]);
}
return 0;
} | #include <cstdio>
int n;
int a[200005];
int box[200005];
int ans[200005];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", a + i);
}
for (int i = n; i >= 1; i--) {
int sum = 0;
for (int j = i; j <= n; j += i) {
sum += box[j];
}
if (sum % 2 != a[i]) {
int upper = n / i * i;
int flag = 0;
for (int j = upper; j >= 1; j -= i) {
if (box[i] == 0) {
box[i] = 1;
flag = 1;
break;
}
}
if (!flag) {
printf("-1\n");
return 0;
}
}
}
int m = 0;
for (int i = 1; i <= n; i++) {
if (box[i]) {
ans[m++] = i;
}
}
printf("%d\n", m);
for (int i = 0; i < m; i++) {
printf("%d ", ans[i]);
}
return 0;
} | [
"assignment.value.change",
"identifier.replace.add",
"literal.replace.remove"
] | 778,923 | 778,924 | u358689692 | cpp |
p02972 | #include <cstdio>
int n;
int a[200005];
int box[200005];
int ans[200005];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", a + i);
}
for (int i = n; i >= 1; i--) {
int sum = 0;
for (int j = 2 * i; j <= n; j += i) {
sum += box[j];
}
box[i] = (a[i] - sum % 2) % 2;
}
int m = 0;
for (int i = 1; i <= n; i++) {
if (box[i]) {
ans[m++] = 1;
}
}
printf("%d\n", m);
for (int i = 0; i < m; i++) {
printf("%d ", ans[i]);
}
return 0;
} | #include <cstdio>
int n;
int a[200005];
int box[200005];
int ans[200005];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", a + i);
}
for (int i = n; i >= 1; i--) {
int sum = 0;
for (int j = 2 * i; j <= n; j += i) {
sum += box[j];
}
box[i] = (a[i] - sum % 2) % 2;
}
int m = 0;
for (int i = 1; i <= n; i++) {
if (box[i]) {
ans[m++] = i; // not ans[m++] = 1
}
}
printf("%d\n", m);
for (int i = 0; i < m; i++) {
printf("%d ", ans[i]);
}
return 0;
} | [
"assignment.value.change",
"identifier.replace.add",
"literal.replace.remove"
] | 778,925 | 778,926 | u358689692 | cpp |
p02972 | #include <cstdio>
int n;
int a[200005];
int box[200005];
int ans[200005];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", a + i);
}
for (int i = n; i >= 1; i--) {
int sum = 0;
for (int j = 2 * i; j <= n; j += i) {
sum += box[j];
}
box[i] = (a[i] - sum) % 2;
}
int m = 0;
for (int i = 1; i <= n; i++) {
if (box[i]) {
ans[m++] = 1;
}
}
printf("%d\n", m);
for (int i = 0; i < m; i++) {
printf("%d ", ans[i]);
}
return 0;
} | #include <cstdio>
int n;
int a[200005];
int box[200005];
int ans[200005];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", a + i);
}
for (int i = n; i >= 1; i--) {
int sum = 0;
for (int j = 2 * i; j <= n; j += i) {
sum += box[j];
}
box[i] = (a[i] - sum % 2) % 2;
}
int m = 0;
for (int i = 1; i <= n; i++) {
if (box[i]) {
ans[m++] = i; // not ans[m++] = 1
}
}
printf("%d\n", m);
for (int i = 0; i < m; i++) {
printf("%d ", ans[i]);
}
return 0;
} | [
"assignment.change",
"assignment.value.change",
"identifier.replace.add",
"literal.replace.remove"
] | 778,927 | 778,926 | u358689692 | cpp |
p02972 | #include <cstdio>
int n;
int a[200005];
int box[200005];
int ans[200005];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", a + i);
}
for (int i = n; i >= 1; i--) {
int sum = 0;
for (int j = 2 * i; j <= n; j += i) {
sum += box[j];
}
box[i] = a[i] - sum % 2;
}
int m = 0;
for (int i = 1; i <= n; i++) {
if (box[i]) {
ans[m++] = 1;
}
}
printf("%d\n", m);
for (int i = 0; i < m; i++) {
printf("%d ", ans[i]);
}
return 0;
} | #include <cstdio>
int n;
int a[200005];
int box[200005];
int ans[200005];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", a + i);
}
for (int i = n; i >= 1; i--) {
int sum = 0;
for (int j = 2 * i; j <= n; j += i) {
sum += box[j];
}
box[i] = (a[i] - sum % 2) % 2;
}
int m = 0;
for (int i = 1; i <= n; i++) {
if (box[i]) {
ans[m++] = i; // not ans[m++] = 1
}
}
printf("%d\n", m);
for (int i = 0; i < m; i++) {
printf("%d ", ans[i]);
}
return 0;
} | [
"assignment.value.change",
"identifier.replace.add",
"literal.replace.remove"
] | 778,928 | 778,926 | u358689692 | cpp |
p02972 | #include <algorithm>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
#include <limits.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
using lll = long long;
using ull = unsigned long long;
using namespace std;
int main() {
lll ii, jj, kk;
lll n, sum;
vector<lll> a, b, c;
cin >> n;
a.resize(n + 1);
c.resize(n + 1);
// b.resize(n);
for (ii = 1; ii <= n; ii++) {
cin >> a[ii];
}
sum = 0;
// cout << " prev for " << endl;
for (ii = n; ii >= 1; ii--) {
sum = a[ii];
jj = 2;
while (ii * jj <= n) {
sum += c[ii];
jj++;
}
if (sum % 2 == 1) {
b.push_back(ii);
c[ii] = 1;
}
}
cout << b.size() << endl;
for (ii = 0; ii < b.size(); ii++) {
cout << b[ii] << " ";
}
cout << endl;
// cout << "-1" << endl;
return 0;
}
| #include <algorithm>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
#include <limits.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
using lll = long long;
using ull = unsigned long long;
using namespace std;
int main() {
lll ii, jj, kk;
lll n, sum;
vector<lll> a, b, c;
cin >> n;
a.resize(n + 1);
c.resize(n + 1);
// b.resize(n);
for (ii = 1; ii <= n; ii++) {
cin >> a[ii];
}
sum = 0;
// cout << " prev for " << endl;
for (ii = n; ii >= 1; ii--) {
sum = a[ii];
jj = 2;
while (ii * jj <= n) {
sum += c[ii * jj];
jj++;
}
if (sum % 2 == 1) {
b.push_back(ii);
c[ii] = 1;
}
}
cout << b.size() << endl;
for (ii = 0; ii < b.size(); ii++) {
cout << b[ii] << " ";
}
cout << endl;
// cout << "-1" << endl;
return 0;
}
| [
"assignment.change"
] | 778,929 | 778,930 | u146847434 | cpp |
p02972 | #include <iostream>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef long long ll;
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<int> a(n + 1);
rep(i, n) cin >> a[i + 1];
vector<int> b(n);
for (int i = n; i >= 1; i--) {
int sum = 0;
for (int j = i + i; j <= n; j += i) {
sum ^= b[j];
}
b[i] = sum ^ a[i];
}
vector<int> ans;
for (int i = 1; i <= n; i++) {
if (b[i] == 1)
ans.push_back(b[i]);
}
cout << b.size() << '\n';
rep(i, ans.size()) { cout << ans[i] << (i == ans.size() - 1 ? "\n" : " "); }
return 0;
}
| #include <iostream>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef long long ll;
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<int> a(n + 1);
rep(i, n) cin >> a[i + 1];
vector<int> b(n + 1);
for (int i = n; i >= 1; i--) {
int sum = 0;
for (int j = i + i; j <= n; j += i) {
sum ^= b[j];
}
b[i] = sum ^ a[i];
}
vector<int> ans;
for (int i = 1; i <= n; i++) {
if (b[i] == 1)
ans.push_back(i);
}
cout << ans.size() << '\n';
rep(i, ans.size()) { cout << ans[i] << (i == ans.size() - 1 ? "\n" : " "); }
return 0;
}
| [
"call.arguments.change",
"identifier.change",
"io.output.change"
] | 778,935 | 778,936 | u539199630 | cpp |
p02972 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n + 1);
rep(i, n) cin >> a[i + 1];
vector<int> b(n + 1);
for (int i = n; i >= 1; --i) {
int sum = 0;
for (int j = i + i; j <= n; j += i) {
sum ^= b[j];
}
b[i] = sum ^ a[i];
}
vector<int> ans;
for (int i = 1; i <= n; ++i) {
if (b[i])
ans.push_back(i);
}
cout << ans.size() << endl;
rep(i, ans.size()) {
printf("%d%c", ans[i], i + 1 == ans.size() ? "\n" : " ");
}
return 0;
} | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n + 1);
rep(i, n) cin >> a[i + 1];
vector<int> b(n + 1);
for (int i = n; i >= 1; --i) {
int sum = 0;
for (int j = i + i; j <= n; j += i) {
sum ^= b[j];
}
b[i] = sum ^ a[i];
}
vector<int> ans;
for (int i = 1; i <= n; ++i) {
if (b[i])
ans.push_back(i);
}
cout << ans.size() << endl;
rep(i, ans.size()) {
printf("%d%c", ans[i], i + 1 == ans.size() ? '\n' : ' ');
}
return 0;
} | [
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 778,941 | 778,942 | u562935282 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
#define FOR(i, j, k) for (int i = j; i < k; i++)
#define REP(i, j) FOR(i, 0, j)
#define fst first
#define snd second
#define pb push_back
#define eb emplace_back
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, const T &b) {
if (b < a) {
a = b;
return 1;
}
return 0;
}
template <typename T> istream &operator>>(istream &is, vector<T> &vec) {
for (T &x : vec) {
is >> x;
}
return is;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.precision(10);
cout << fixed;
int n;
cin >> n;
vi a(n);
cin >> a;
vi b(n);
for (int i = n; i > 0; i--) {
for (int j = i * 2; j <= n; j += i) {
b[i - 1] ^= b[j - 1];
}
b[i - 1] ^= a[i - 1];
}
vi c;
REP(i, n) {
if (b[i] > 0) {
c.push_back(b[i]);
}
}
cout << c.size() << endl;
REP(i, c.size()) { cout << c[i] << " "; }
cout << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define FOR(i, j, k) for (int i = j; i < k; i++)
#define REP(i, j) FOR(i, 0, j)
#define fst first
#define snd second
#define pb push_back
#define eb emplace_back
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, const T &b) {
if (b < a) {
a = b;
return 1;
}
return 0;
}
template <typename T> istream &operator>>(istream &is, vector<T> &vec) {
for (T &x : vec) {
is >> x;
}
return is;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.precision(10);
cout << fixed;
int n;
cin >> n;
vi a(n);
cin >> a;
vi b(n);
for (int i = n; i > 0; i--) {
for (int j = i * 2; j <= n; j += i) {
b[i - 1] ^= b[j - 1];
}
b[i - 1] ^= a[i - 1];
}
vi c;
REP(i, n) {
if (b[i] > 0) {
c.push_back(i + 1);
}
}
cout << c.size() << endl;
REP(i, c.size()) { cout << c[i] << " "; }
cout << endl;
return 0;
}
| [
"call.arguments.change"
] | 778,943 | 778,944 | u463697306 | cpp |
p02972 | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef double db;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
#define pb push_back
#define mp make_pair
#define MAX 1000000
#define mod 1000000007
#define all(_) _.begin(), _.end()
#define F first
#define S second
#define ordered_set \
tree<int, null_type, less<int>, rb_tree_tag, \
tree_order_statistics_node_update>
int main() {
ios_base ::sync_with_stdio(false);
cin.tie(NULL), cout.tie(NULL);
ll n, i;
cin >> n;
vll a(n + 1), b(n + 1, 0), c;
for (i = 1; i <= n; i++)
cin >> a[i];
for (i = n; i >= 1; i--) {
ll sum = 0;
for (ll j = 2 * i; j <= n; j++)
sum += b[j];
if (sum % 2 != a[i])
c.pb(i), b[i] = 1;
}
cout << c.size() << endl;
for (auto x : c)
cout << x << ' ';
cout << endl;
return 0;
} | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef double db;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
#define pb push_back
#define mp make_pair
#define MAX 1000000
#define mod 1000000007
#define all(_) _.begin(), _.end()
#define F first
#define S second
#define ordered_set \
tree<int, null_type, less<int>, rb_tree_tag, \
tree_order_statistics_node_update>
int main() {
ios_base ::sync_with_stdio(false);
cin.tie(NULL), cout.tie(NULL);
ll n, i;
cin >> n;
vll a(n + 1), b(n + 1, 0), c;
for (i = 1; i <= n; i++)
cin >> a[i];
for (i = n; i >= 1; i--) {
ll sum = 0;
for (ll j = 2 * i; j <= n; j += i)
sum += b[j];
if (sum % 2 != a[i])
c.pb(i), b[i] = 1;
}
cout << c.size() << endl;
for (auto x : c)
cout << x << ' ';
cout << endl;
return 0;
} | [] | 778,945 | 778,946 | u868281230 | cpp |
p02972 | #include <bits/stdc++.h>
//#include<tr1/unordered_map>
#pragma GCC optimize("Ofast")
#define ll long long
#define pll pair<long long, long long>
#define pii pair<int, int>
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define Forn(i, n) for (int i = 1; i <= int(n); i++)
using namespace std;
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#include<ext/pb_ds/priority_queue.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/trie_policy.hpp>
using namespace __gnu_pbds;
typedef tree<pll, null_type, less<pll>, rb_tree_tag,
tree_order_statistics_node_update> ordered_multiset;*/
int n;
int req[200010];
int a[200010];
int cnt;
int main() {
cin.tie(0);
ios_base::sync_with_stdio(false);
// freopen("connect_the_dots.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
cin >> n;
Forn(i, n) {
int x;
cin >> x;
req[i] = x;
}
for (int i = n; i >= 1; i--) {
int sum = 0;
for (int j = i * 2; j < n; j += i)
sum += a[j];
if (sum % 2 != req[i]) {
a[i] = 1;
cnt++;
}
}
cout << cnt << endl;
forn(i, n) if (a[i]) cout << i << " ";
cout << endl;
}
| #include <bits/stdc++.h>
//#include<tr1/unordered_map>
#pragma GCC optimize("Ofast")
#define ll long long
#define pll pair<long long, long long>
#define pii pair<int, int>
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define Forn(i, n) for (int i = 1; i <= int(n); i++)
using namespace std;
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#include<ext/pb_ds/priority_queue.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/trie_policy.hpp>
using namespace __gnu_pbds;
typedef tree<pll, null_type, less<pll>, rb_tree_tag,
tree_order_statistics_node_update> ordered_multiset;*/
int n;
int req[200010];
int a[200010];
int cnt;
int main() {
cin.tie(0);
ios_base::sync_with_stdio(false);
// freopen("connect_the_dots.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
cin >> n;
Forn(i, n) {
int x;
cin >> x;
req[i] = x;
}
for (int i = n; i >= 1; i--) {
int sum = 0;
for (int j = i * 2; j <= n; j += i)
sum += a[j];
if (sum % 2 != req[i]) {
a[i] = 1;
cnt++;
}
}
cout << cnt << endl;
Forn(i, n) if (a[i]) cout << i << " ";
cout << endl;
}
| [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change",
"identifier.change",
"call.function.change"
] | 778,951 | 778,952 | u475019197 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
int main() {
int64_t n;
cin >> n;
vector<int64_t> as(n + 1, 0);
for (int64_t i = 1; i <= n; i++) {
cin >> as[i];
}
vector<int64_t> puni(n + 1, 0);
for (int64_t i = n; 1 <= i; i--) {
int64_t cnt = 0;
for (int64_t j = 2 * i; j <= n; j += i) {
cnt += puni[j];
}
puni[i] = (cnt % 2) == as[i];
}
vector<int64_t> ans;
for (int64_t i = 1; i <= n; i++) {
if (puni[i]) {
ans.emplace_back(i);
}
}
cout << ans.size() << endl;
for (auto &a : ans) {
cout << a << ' ';
}
cout << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int64_t n;
cin >> n;
vector<int64_t> as(n + 1, 0);
for (int64_t i = 1; i <= n; i++) {
cin >> as[i];
}
vector<int64_t> puni(n + 1, 0);
for (int64_t i = n; 1 <= i; i--) {
int64_t cnt = 0;
for (int64_t j = 2 * i; j <= n; j += i) {
cnt += puni[j];
}
puni[i] = (cnt % 2) != as[i];
}
vector<int64_t> ans;
for (int64_t i = 1; i <= n; i++) {
if (puni[i]) {
ans.emplace_back(i);
}
}
cout << ans.size() << endl;
for (auto &a : ans) {
cout << a << ' ';
}
cout << endl;
return 0;
}
| [
"misc.opposites",
"expression.operator.compare.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 778,953 | 778,954 | u017167684 | cpp |
p02972 | #include <bits/stdc++.h>
#define All(v) v.begin(), v.end()
using namespace std;
typedef long long lint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
const int MAX_N = (int)2e5 + 5;
int A[MAX_N], ans[MAX_N];
int main() {
ios::sync_with_stdio(false), cin.tie(nullptr);
int N;
cin >> N;
for (int i = 1; i <= N; i++)
cin >> A[i];
for (int i = N; 0 < i; i--) {
int s = 0;
for (int j = 2 * i; j <= N; j += i) {
s ^= ans[i];
}
ans[i] = A[i] ^ s;
}
vector<int> b;
for (int i = 1; i <= N; i++) {
if (ans[i])
b.push_back(i);
}
cout << b.size() << endl;
for (auto u : b)
cout << u << ' ';
cout << endl;
return 0;
} | #include <bits/stdc++.h>
#define All(v) v.begin(), v.end()
using namespace std;
typedef long long lint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
const int MAX_N = (int)2e5 + 5;
int A[MAX_N], ans[MAX_N];
int main() {
ios::sync_with_stdio(false), cin.tie(nullptr);
int N;
cin >> N;
for (int i = 1; i <= N; i++)
cin >> A[i];
for (int i = N; 0 < i; i--) {
int s = 0;
for (int j = 2 * i; j <= N; j += i) {
s ^= ans[j];
}
ans[i] = A[i] ^ s;
}
vector<int> b;
for (int i = 1; i <= N; i++) {
if (ans[i])
b.push_back(i);
}
cout << b.size() << endl;
for (auto u : b)
cout << u << ' ';
cout << endl;
return 0;
} | [
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change"
] | 778,957 | 778,958 | u354638986 | cpp |
p02972 | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, n) for (int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
const int NMAX = 200005;
const int k = 200000;
static const int INF = 1 << 29;
string s, t, ans;
int dp[3001][3001];
ll gcd(ll a, ll b) {
if (a < b)
swap(a, b);
if (b == 0)
return a;
return gcd(b, a % b);
}
int main() {
cin.tie(0);
ios::sync_with_stdio(0); //この2行はより速度を向上させる
// 追加2, 以降 cin の入力元が 'input.txt' になる
//提出時に消す!!
int n, A[NMAX], B[NMAX];
cin >> n;
rep2(i, n) cin >> A[i];
for (int i = n; i >= 1; --i) {
int sum = 0;
for (int j = 2 * i; j <= n; j += i) { //倍数判定
sum ^= B[j]; //ビット排他的論理和演算子
}
B[i] = sum ^ A[i]; //双方が0か1なら1を格納。それ以外は0を格納。
}
vector<int> ans;
rep2(i, n) if (B[i]) ans.push_back(i);
cout << ans.size() << endl;
for (int i = 0; i < ans.size(); ++i) {
cout << ans[i];
if (i + 1 != ans.size())
cout << " ";
}
cout << endl;
return 0;
} | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, n) for (int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
const int NMAX = 200005;
const int k = 200000;
static const int INF = 1 << 29;
string s, t, ans;
int dp[3001][3001];
ll gcd(ll a, ll b) {
if (a < b)
swap(a, b);
if (b == 0)
return a;
return gcd(b, a % b);
}
int main() {
cin.tie(0);
ios::sync_with_stdio(0); //この2行はより速度を向上させる
// 追加2, 以降 cin の入力元が 'input.txt' になる
int n, A[NMAX], B[NMAX];
cin >> n;
rep(i, n) cin >> A[i + 1];
for (int i = n; i >= 1; --i) {
int sum = 0;
for (int j = 2 * i; j <= n; j += i) { //倍数判定
sum ^= B[j]; //ビット排他的論理和演算子
}
B[i] = sum ^ A[i]; //双方が0か1なら1を格納。それ以外は0を格納。
}
vector<int> ans;
rep2(i, n) {
if (B[i])
ans.push_back(i);
}
cout << ans.size() << endl;
for (int i = 0; i < ans.size(); ++i) {
cout << ans[i];
if (i + 1 != ans.size())
cout << " ";
}
cout << endl;
return 0;
} | [
"identifier.change",
"call.function.change"
] | 778,961 | 778,962 | u904131314 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int a[n + 1];
for (int i = 1; i <= n; i++)
cin >> a[i];
vector<int> b;
long long b_num[n + 1];
for (int i = 0; i <= n; i++)
b_num[i] = 0;
for (int i = n; i > n / 2; i--) {
if (a[i] == 1) {
b.push_back(i);
for (int j = 1; j <= sqrt(i); j++) {
if (i % j == 0) {
++b_num[j];
if (j * j != i) {
++b_num[i / j];
}
}
}
}
}
for (int i = n / 2; i > 0; i--) {
if (a[i] == 1 && b_num[i] % 2 == 1) {
continue;
} else if (a[i] == 0 && b_num[i] % 2 == 0) {
continue;
}
b.push_back(i);
for (int j = 1; j < sqrt(i) + 1; j++) {
if (i % j == 0) {
++b_num[j];
if (j * j != i) {
++b_num[i / j];
}
}
}
}
reverse(b.begin(), b.end());
cout << b.size() << endl;
if (b.size() == 0) {
return 0;
}
cout << b[0];
for (int i = 1; i < b.size(); i++) {
cout << " " << b[i];
}
cout << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int a[n + 1];
for (int i = 1; i <= n; i++)
cin >> a[i];
vector<int> b;
long long b_num[n + 1];
for (int i = 0; i <= n; i++)
b_num[i] = 0;
for (int i = n; i > n / 2; i--) {
if (a[i] == 1) {
b.push_back(i);
for (int j = 1; j <= sqrt(i); j++) {
if (i % j == 0) {
++b_num[j];
if (j * j != i) {
++b_num[i / j];
}
}
}
}
}
for (int i = n / 2; i > 0; i--) {
if (a[i] == 1 && b_num[i] % 2 == 1) {
continue;
} else if (a[i] == 0 && b_num[i] % 2 == 0) {
continue;
}
b.push_back(i);
for (int j = 1; j <= sqrt(i); j++) {
if (i % j == 0) {
++b_num[j];
if (j * j != i) {
++b_num[i / j];
}
}
}
}
reverse(b.begin(), b.end());
cout << b.size() << endl;
if (b.size() == 0) {
return 0;
}
cout << b[0];
for (int i = 1; i < b.size(); i++) {
cout << " " << b[i];
}
cout << endl;
} | [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change",
"expression.operation.binary.remove"
] | 778,963 | 778,964 | u313766957 | cpp |
p02972 | // JSD
#include <iostream>
#include <map>
#include <vector>
#define ll long long
using namespace std;
int main() {
int n;
cin >> n;
ll sum = 0;
int a[n + 1], b[n + 1];
for (int i = 1; i <= n; i++)
cin >> a[i], b[i] = a[i];
for (int i = n; i >= 1; i--) {
ll ans = 0;
for (int j = 2; j * i <= n; j++) {
ans += b[j];
}
ans = ans % 2;
if (a[i] == 1) {
if (ans == 1)
b[i] = 0;
else
b[i] = 1;
} else {
if (ans == 1)
b[i] = 1;
else
b[i] = 0;
}
}
vector<int> v;
for (int i = 1; i <= n; i++) {
if (b[i] == 1)
v.push_back(i);
}
cout << v.size() << "\n";
for (int i = 0; i < v.size(); i++)
cout << v[i] << " ";
return 0;
}
| // JSD
#include <iostream>
#include <map>
#include <vector>
#define ll long long
using namespace std;
int main() {
int n;
cin >> n;
ll sum = 0;
int a[n + 1], b[n + 1];
for (int i = 1; i <= n; i++)
cin >> a[i], b[i] = a[i];
for (int i = n / 2; i >= 1; i--) {
ll ans = 0;
for (int j = 2; j * i <= n; j++) {
ans += b[j * i];
}
ans = ans % 2;
if (a[i] == 1) {
if (ans == 1)
b[i] = 0;
else
b[i] = 1;
} else {
if (ans == 1)
b[i] = 1;
else
b[i] = 0;
}
}
vector<int> v;
for (int i = 1; i <= n; i++) {
if (b[i] == 1)
v.push_back(i);
}
cout << v.size() << "\n";
for (int i = 0; i < v.size(); i++)
cout << v[i] << " ";
return 0;
} | [
"control_flow.loop.for.initializer.change",
"assignment.change"
] | 778,965 | 778,966 | u436019023 | cpp |
p02972 | // JSD
#include <iostream>
#include <map>
#include <vector>
#define ll long long
using namespace std;
int main() {
int n;
cin >> n;
ll sum = 0;
int a[n + 1], b[n + 1];
for (int i = 1; i <= n; i++)
cin >> a[i], b[i] = a[i];
for (int i = n / 2; i >= 1; i--) {
ll ans = 0;
for (int j = 2; j * i <= n; j++) {
ans += b[j];
}
ans = ans % 2;
if (a[i] == 1) {
if (ans == 1)
b[i] = 0;
else
b[i] = 1;
} else {
if (ans == 1)
b[i] = 1;
else
b[i] = 0;
}
}
vector<int> v;
for (int i = 1; i <= n; i++) {
if (b[i] == 1)
v.push_back(i);
}
cout << v.size() << "\n";
for (int i = 0; i < v.size(); i++)
cout << v[i] << " ";
return 0;
} | // JSD
#include <iostream>
#include <map>
#include <vector>
#define ll long long
using namespace std;
int main() {
int n;
cin >> n;
ll sum = 0;
int a[n + 1], b[n + 1];
for (int i = 1; i <= n; i++)
cin >> a[i], b[i] = a[i];
for (int i = n / 2; i >= 1; i--) {
ll ans = 0;
for (int j = 2; j * i <= n; j++) {
ans += b[j * i];
}
ans = ans % 2;
if (a[i] == 1) {
if (ans == 1)
b[i] = 0;
else
b[i] = 1;
} else {
if (ans == 1)
b[i] = 1;
else
b[i] = 0;
}
}
vector<int> v;
for (int i = 1; i <= n; i++) {
if (b[i] == 1)
v.push_back(i);
}
cout << v.size() << "\n";
for (int i = 0; i < v.size(); i++)
cout << v[i] << " ";
return 0;
} | [
"assignment.change"
] | 778,967 | 778,966 | u436019023 | cpp |
p02972 | // JSD
#include <iostream>
#include <map>
#include <vector>
#define ll long long
using namespace std;
int main() {
int n;
cin >> n;
ll sum = 0;
int a[n + 1], b[n + 1];
for (int i = 1; i <= n; i++)
cin >> a[i], b[i] = a[i];
for (int i = n / 2 - 1; i >= 1; i--) {
ll ans = 0;
for (int j = 2; j * i <= n; j++) {
ans += b[j];
}
ans = ans % 2;
if (a[i] == 1) {
if (ans == 1)
b[i] = 0;
else
b[i] = 1;
} else {
if (ans == 1)
b[i] = 1;
else
b[i] = 0;
}
}
vector<int> v;
for (int i = 1; i <= n; i++) {
if (b[i] == 1)
v.push_back(i);
}
cout << v.size() << "\n";
for (int i = 0; i < v.size(); i++)
cout << v[i] << " ";
return 0;
} | // JSD
#include <iostream>
#include <map>
#include <vector>
#define ll long long
using namespace std;
int main() {
int n;
cin >> n;
ll sum = 0;
int a[n + 1], b[n + 1];
for (int i = 1; i <= n; i++)
cin >> a[i], b[i] = a[i];
for (int i = n / 2; i >= 1; i--) {
ll ans = 0;
for (int j = 2; j * i <= n; j++) {
ans += b[j * i];
}
ans = ans % 2;
if (a[i] == 1) {
if (ans == 1)
b[i] = 0;
else
b[i] = 1;
} else {
if (ans == 1)
b[i] = 1;
else
b[i] = 0;
}
}
vector<int> v;
for (int i = 1; i <= n; i++) {
if (b[i] == 1)
v.push_back(i);
}
cout << v.size() << "\n";
for (int i = 0; i < v.size(); i++)
cout << v[i] << " ";
return 0;
} | [
"control_flow.loop.for.initializer.change",
"expression.operation.binary.remove",
"assignment.change"
] | 778,968 | 778,966 | u436019023 | cpp |
p02972 | #include "bits/stdc++.h"
#define REP(i, n, N) for (ll i = (n); i < (N); i++)
#define RREP(i, n, N) for (ll i = (N - 1); i >= (n); i--)
#define LREP(lst, itr) for (auto itr = lst.begin(); itr != lst.end(); ++itr)
#define CK(n, a, b) ((a) <= (n) && (n) < (b))
#define ALL(v) (v).begin(), (v).end()
#define MCP(a, b) memcpy(b, a, sizeof(b))
#define P(s) cout << (s) << endl
#define P2(a, b) cout << (a) << " " << (b) << endl
#define V2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
int main() {
int n;
cin >> n;
vector<int> input(n + 1);
vector<int> output(n + 1);
REP(i, 1, n + 1) cin >> input[i];
REP(i, n / 2 + 1, n + 1) output[i] = input[i]; //後ろ半分は入力と同じ
RREP(i, 1, n / 2 + 1) {
int mul = 2;
int sum = 0;
while (i * mul <= n) {
sum ^= input[i * mul];
mul++;
}
output[i] = sum ^ input[i];
}
vector<int> ans;
REP(i, 1, n + 1) {
if (output[i] == 1) {
ans.push_back(i);
}
}
P(ans.size());
if (ans.size() != 0) {
REP(i, 0, ans.size()) {
cout << ans[i];
if (ans.size() - 1 != i)
cout << " ";
}
}
cout << endl;
} | #include "bits/stdc++.h"
#define REP(i, n, N) for (ll i = (n); i < (N); i++)
#define RREP(i, n, N) for (ll i = (N - 1); i >= (n); i--)
#define LREP(lst, itr) for (auto itr = lst.begin(); itr != lst.end(); ++itr)
#define CK(n, a, b) ((a) <= (n) && (n) < (b))
#define ALL(v) (v).begin(), (v).end()
#define MCP(a, b) memcpy(b, a, sizeof(b))
#define P(s) cout << (s) << endl
#define P2(a, b) cout << (a) << " " << (b) << endl
#define V2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
int main() {
int n;
cin >> n;
vector<int> input(n + 1);
vector<int> output(n + 1);
REP(i, 1, n + 1) cin >> input[i];
REP(i, n / 2 + 1, n + 1) output[i] = input[i]; //後ろ半分は入力と同じ
RREP(i, 1, n / 2 + 1) {
int mul = 2;
int sum = 0;
while (i * mul <= n) {
sum ^= output[i * mul];
mul++;
}
output[i] = sum ^ input[i];
}
vector<int> ans;
REP(i, 1, n + 1) {
if (output[i] == 1) {
ans.push_back(i);
}
}
P(ans.size());
if (ans.size() != 0) {
REP(i, 0, ans.size()) {
cout << ans[i];
if (ans.size() - 1 != i)
cout << " ";
}
}
cout << endl;
} | [
"assignment.value.change",
"identifier.change"
] | 778,969 | 778,970 | u379951749 | cpp |
p02972 | #include <iostream>
using namespace std;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl;
int main() {
int N;
cin >> N;
int a[N + 1], box[N + 1] = {0};
for (int i = 1; i <= N; i++) {
cin >> a[i];
}
for (int i = N; i >= 1; i--) {
int sum = 0;
for (int j = 1; j <= N / i; j++) {
if (box[i * j] == 1)
sum += 1;
}
if (sum % 2 != a[i])
box[i] = 1;
}
int M = 0;
for (int i = 1; i <= N; i++) {
if (box[i] == 1)
M += 1;
}
OP(M)
for (int i = 1; i <= M; i++) {
if (box[i] == 1)
OP(box[i])
}
return 0;
} | #include <iostream>
using namespace std;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl;
int main() {
int N;
cin >> N;
int a[N + 1], box[N + 1] = {0};
for (int i = 1; i <= N; i++) {
cin >> a[i];
}
for (int i = N; i >= 1; i--) {
int sum = 0;
for (int j = 1; j <= N / i; j++) {
if (box[i * j] == 1)
sum += 1;
}
if (sum % 2 != a[i])
box[i] = 1;
}
int M = 0;
for (int i = 1; i <= N; i++) {
if (box[i] == 1)
M += 1;
}
OP(M)
for (int i = 1; i <= N; i++) {
if (box[i] == 1)
OP(i)
}
return 0;
} | [
"identifier.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change",
"call.arguments.change"
] | 778,973 | 778,974 | u016189984 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
int n;
int a[200001];
int b[200001];
int flag[200001];
int main() {
scanf("%d", &n);
int ans = 0;
memset(b, 0, sizeof b);
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]);
for (int i = n; i >= 1; i--) {
int s = 0;
for (int j = i; j <= n; j = j + i)
s += b[j];
if (s % 2 != a[i]) {
b[i] = 1;
flag[++ans] = i;
}
}
printf("%d\n", ans);
if (ans) {
for (int i = 1; i < ans; i++)
printf("%d ", b[i]);
printf("%d\n", b[ans]);
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int n;
int a[200001];
int b[200001];
int flag[200001];
int main() {
scanf("%d", &n);
int ans = 0;
memset(b, 0, sizeof b);
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]);
for (int i = n; i >= 1; i--) {
int s = 0;
for (int j = i; j <= n; j = j + i)
s += b[j];
if (s % 2 != a[i]) {
b[i] = 1;
flag[++ans] = i;
}
}
printf("%d\n", ans);
if (ans) {
for (int i = 1; i < ans; i++)
printf("%d ", flag[i]);
printf("%d\n", flag[ans]);
}
return 0;
}
| [
"identifier.change",
"call.arguments.change",
"io.output.change"
] | 778,978 | 778,979 | u433665020 | cpp |
p02972 | #pragma region include
#include "bits/stdc++.h"
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPR(i, n) for (int i = (int)(n); i >= 0; i--)
#define FOR(i, n, m) for (int i = (int)(n); i < int(m); i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll LLINF = 4e18;
void input() {}
template <typename... R> void input(int &f, R &...r) {
scanf("%d", &f);
input(r...);
}
template <typename... R> void input(double &f, R &...r) {
scanf("%lf", &f);
input(r...);
}
template <typename... R> void input(ll &f, R &...r) {
scanf("%lld", &f);
input(r...);
}
template <typename... R> void input(char &f, R &...r) {
scanf("%c", &f);
input(r...);
}
template <typename T, typename... R> void input(vector<T> &f, R &...r) {
REP(i, f.size()) input(f[i]);
input(r...);
}
#pragma endregion
int main() {
int n;
input(n);
vector<int> a(n);
input(a);
vector<bool> ans(n, false);
for (int i = n; i >= 1; i--) {
int c = 0;
for (int j = i * 2; j <= n; j += i) {
if (ans[j - 1])
c++;
}
if (c % 2 != a[i - 1])
ans[i - 1] = true;
}
int cnt = 0;
REP(i, n) {
if (a[i])
cnt++;
}
cout << cnt << endl;
REP(i, n) {
if (a[i])
cout << i + 1 << endl;
}
getchar();
getchar();
} | #pragma region include
#include "bits/stdc++.h"
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPR(i, n) for (int i = (int)(n); i >= 0; i--)
#define FOR(i, n, m) for (int i = (int)(n); i < int(m); i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll LLINF = 4e18;
void input() {}
template <typename... R> void input(int &f, R &...r) {
scanf("%d", &f);
input(r...);
}
template <typename... R> void input(double &f, R &...r) {
scanf("%lf", &f);
input(r...);
}
template <typename... R> void input(ll &f, R &...r) {
scanf("%lld", &f);
input(r...);
}
template <typename... R> void input(char &f, R &...r) {
scanf("%c", &f);
input(r...);
}
template <typename T, typename... R> void input(vector<T> &f, R &...r) {
REP(i, f.size()) input(f[i]);
input(r...);
}
#pragma endregion
int main() {
int n;
input(n);
vector<int> a(n);
input(a);
vector<bool> ans(n, false);
for (int i = n; i >= 1; i--) {
int c = 0;
for (int j = i * 2; j <= n; j += i) {
if (ans[j - 1])
c++;
}
if (c % 2 != a[i - 1])
ans[i - 1] = true;
}
int cnt = 0;
REP(i, n) {
if (ans[i])
cnt++;
}
cout << cnt << endl;
REP(i, n) {
if (ans[i])
cout << i + 1 << endl;
}
getchar();
getchar();
} | [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 778,980 | 778,981 | u165374901 | cpp |
p02972 | #include "bits/stdc++.h"
using namespace std;
using ll = int64_t;
int main() {
ll N;
cin >> N;
vector<ll> a(N);
for (ll i = 0; i < N; i++) {
cin >> a[i];
}
vector<ll> num(N + 1, 0);
vector<ll> ans;
for (ll i = N - 1; i >= 0; i--) {
ll sum = 0;
for (ll j = i + 1; j <= N; j += i + 1) {
sum += num[j - 1];
}
if (sum % 2 != a[i]) {
ans.push_back(i + 1);
num[i + 1]++;
}
}
sort(ans.begin(), ans.end());
cout << ans.size() << endl;
for (ll i = 0; i < ans.size(); i++) {
cout << ans[i] << " \n"[i == ans.size() - 1];
}
} | #include "bits/stdc++.h"
using namespace std;
using ll = int64_t;
int main() {
ll N;
cin >> N;
vector<ll> a(N);
for (ll i = 0; i < N; i++) {
cin >> a[i];
}
vector<ll> num(N + 1, 0);
vector<ll> ans;
for (ll i = N - 1; i >= 0; i--) {
ll sum = 0;
for (ll j = i + 1; j <= N; j += i + 1) {
sum += num[j];
}
if (sum % 2 != a[i]) {
ans.push_back(i + 1);
num[i + 1]++;
}
}
sort(ans.begin(), ans.end());
cout << ans.size() << endl;
for (ll i = 0; i < ans.size(); i++) {
cout << ans[i] << " \n"[i == ans.size() - 1];
}
} | [
"expression.operation.binary.remove"
] | 778,988 | 778,989 | u456065785 | cpp |
p02972 | #include <iostream>
#include <sstream>
using namespace std;
int main() {
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; ++i)
cin >> a[i];
int b[n];
for (int i = n - 1; i > -1; --i) {
b[i] = a[i];
if ((i + 1) * 2 - 1 >= n)
continue;
for (int j = (i + 1) * 2; j < n; j += (i + 1))
b[i] ^= b[j];
}
stringstream sout;
int tot = 0;
for (int i = 0; i < n; ++i)
if (b[i]) {
++tot;
sout << i + 1 << ' ';
}
cout << tot << endl;
while (sout >> tot)
cout << tot << ' ';
return 0;
} | #include <iostream>
#include <sstream>
using namespace std;
int main() {
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; ++i)
cin >> a[i];
int b[n];
for (int i = n - 1; i > -1; --i) {
b[i] = a[i];
if ((i + 1) * 2 - 1 >= n)
continue;
for (int j = (i + 1) * 2 - 1; j < n; j += (i + 1))
b[i] ^= b[j];
}
stringstream sout;
int tot = 0;
for (int i = 0; i < n; ++i)
if (b[i]) {
++tot;
sout << i + 1 << ' ';
}
cout << tot << endl;
while (sout >> tot)
cout << tot << ' ';
return 0;
} | [
"control_flow.loop.for.initializer.change"
] | 778,992 | 778,993 | u146240825 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
// conversion
//------------------------------------------
inline int toInt(string s) {
int v;
istringstream sin(s);
sin >> v;
return v;
}
template <class T> inline string toString(T x) {
ostringstream sout;
sout << x;
return sout.str();
}
// math
//-------------------------------------------
template <class T> inline T sqr(T x) { return x * x; }
// typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
// container util
//------------------------------------------
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i, c) \
for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())
// repetition
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
// constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
// clear memory
#define CLR(a) memset((a), 0, sizeof(a))
// debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) \
cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
<< " " << __FILE__ << endl;
int main(void) {
int n;
cin >> n;
VI a(n + 1);
REP(i, n) cin >> a.at(i + 1);
VI b(n + 1);
for (int i = n; i >= 1; --i) {
int sum = 0;
for (int j = i + i; j <= n; j += i) {
sum ^= b[j];
}
b[i] = sum ^ a[i];
}
VI ans;
REP(i, n){dump(a[i + 1])} REP(i, n) {
if (b.at(i + 1))
ans.push_back(b.at(i + 1));
}
cout << ans.size() << endl;
REP(i, ans.size()) { cout << ans.at(i) << endl; }
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
// conversion
//------------------------------------------
inline int toInt(string s) {
int v;
istringstream sin(s);
sin >> v;
return v;
}
template <class T> inline string toString(T x) {
ostringstream sout;
sout << x;
return sout.str();
}
// math
//-------------------------------------------
template <class T> inline T sqr(T x) { return x * x; }
// typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
// container util
//------------------------------------------
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i, c) \
for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())
// repetition
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
// constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
// clear memory
#define CLR(a) memset((a), 0, sizeof(a))
// debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) \
cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
<< " " << __FILE__ << endl;
int main(void) {
int n;
cin >> n;
VI a(n + 1);
REP(i, n) cin >> a.at(i + 1);
VI b(n + 1);
for (int i = n; i >= 1; --i) {
int sum = 0;
for (int j = i + i; j <= n; j += i) {
sum ^= b[j];
}
b[i] = sum ^ a[i];
}
VI ans;
REP(i, n){dump(a[i + 1])} REP(i, n) {
if (b.at(i + 1))
ans.push_back(i + 1);
}
cout << ans.size() << endl;
REP(i, ans.size()) { cout << ans.at(i) << endl; }
return 0;
}
| [
"call.arguments.change"
] | 778,994 | 778,995 | u187052933 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
vector<int> b(n, 0);
for (int i = n - 1; i >= 0; i--) {
int sum = 0;
for (int j = 2 * i + 1; j < n; j++) {
sum += b[j];
}
if (sum % 2 == a[i])
b[i] = 0;
else
b[i] = 1;
}
vector<int> ans;
for (int i = 0; i < n; i++) {
if (b[i] == 1) {
ans.push_back(i + 1);
}
}
cout << ans.size() << endl;
for (int i = 0; i < ans.size(); i++) {
cout << ans[i] << ' ';
}
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
vector<int> b(n, 0);
for (int i = n - 1; i >= 0; i--) {
int sum = 0;
for (int j = 2 * i + 1; j < n; j += i + 1) {
sum += b[j];
}
if (sum % 2 == a[i])
b[i] = 0;
else
b[i] = 1;
}
vector<int> ans;
for (int i = 0; i < n; i++) {
if (b[i] == 1) {
ans.push_back(i + 1);
}
}
cout << ans.size() << endl;
for (int i = 0; i < ans.size(); i++) {
cout << ans[i] << ' ';
}
} | [
"control_flow.loop.for.update.change",
"assignment.change"
] | 779,008 | 779,009 | u629314247 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n + 1);
vector<int> b(n + 1);
for (int i = 1; i < n; i++)
cin >> a[i];
int m = 0;
for (int i = n; i > 0; i--) {
int sum = 0;
for (int j = 2 * i; j < n + 1; j += i) {
sum += b[j];
}
if (sum % 2 != a[i]) {
b[i] = 1;
m++;
}
}
cout << m << endl;
for (int i = 1; i < n + 1; i++) {
if (b[i] == 1)
cout << i << " ";
}
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n + 1);
vector<int> b(n + 1);
for (int i = 1; i < n + 1; i++)
cin >> a[i];
int m = 0;
for (int i = n; i > 0; i--) {
int sum = 0;
for (int j = 2 * i; j < n + 1; j += i) {
sum += b[j];
}
if (sum % 2 != a[i]) {
b[i] = 1;
m++;
}
}
cout << m << endl;
for (int i = 1; i < n + 1; i++) {
if (b[i] == 1)
cout << i << " ";
}
}
| [
"control_flow.loop.for.condition.change",
"misc.off_by_one"
] | 779,012 | 779,013 | u117348081 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
int n;
void solve() {
int i, j;
string str;
cin >> n;
vector<int> a(n);
for (i = 0; i < n; i++) {
cin >> a[i];
}
vector<int> b(n);
for (i = n - 1; i >= 0; i--) {
int s = 0;
for (j = 2 * (i + 1); j < n; j += i + 1) {
s += b[j - 1];
}
if (s % 2 != a[i])
b[i] = 1;
else
b[i] = 0;
}
long long ans = 0;
for (i = 0; i < n; i++)
if (b[i] == 1)
ans++;
cout << ans << endl;
for (i = 0; i < n; i++)
if (b[i] == 1)
cout << i + 1 << endl;
}
int main() { solve(); }
| #include <bits/stdc++.h>
using namespace std;
int n;
void solve() {
int i, j;
string str;
cin >> n;
vector<int> a(n);
for (i = 0; i < n; i++) {
cin >> a[i];
}
vector<int> b(n);
for (i = n - 1; i >= 0; i--) {
int s = 0;
for (j = 2 * (i + 1); j <= n; j += i + 1) {
s += b[j - 1];
}
if (s % 2 != a[i])
b[i] = 1;
else
b[i] = 0;
}
long long ans = 0;
for (i = 0; i < n; i++)
if (b[i] == 1)
ans++;
cout << ans << endl;
for (i = 0; i < n; i++)
if (b[i] == 1)
cout << i + 1 << endl;
}
int main() { solve(); }
| [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 779,017 | 779,018 | u309112964 | cpp |
p02972 | #ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
// o(╥﹏╥)o
#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <type_traits>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
#define ld long double
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vi>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define vpll vector<pair<long long, long long>>
#define fill(a, val) memset(a, val, sizeof(a))
#define sort_unique(c) \
(sort(c.begin(), c.end()), \
c.resize(distance(c.begin(), unique(c.begin(), c.end()))))
#define mp make_pair
#define pb push_back
#define f first
#define se second
#define all(cont) cont.begin(), cont.end()
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define MAX 1e9
#define MIN -1e9
typedef map<int, int> mpi;
typedef set<int> seti;
typedef multiset<int> mseti;
typedef priority_queue<int> pq;
typedef tuple<int, int, int> tup;
#define fio \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL)
#define rep(i, n) for (long long int i = 0; i < (n); ++i)
#define repA(i, a, n) for (ll i = a; i <= (n); ++i)
#define repD(i, a, n) for (ll i = a; i >= (n); --i)
#define trav(a, x) for (auto &a : x)
#define tr(c, i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
#define repn(i, begin, end) \
for (__typeof(end) i = (begin) - ((begin) > (end)); \
i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define PI 3.14159265
#define mod 1000000007
struct node {
ll val;
};
struct Interval {
int start, end;
};
bool compare(struct node n1, struct node n2) { return (n1.val < n2.val); }
const ll INF = 1e15 + 3;
const ll inf = 1e11 + 5;
const ll maxn = 1e6 + 2;
int main() {
ll n;
cin >> n;
ll a[n];
rep(i, n) cin >> a[i];
ll beg = n / 2;
++beg;
ll b[n + 1];
rep(i, n + 1) b[i] = -1;
repA(i, beg, n) b[i] = a[i - 1];
// repA(i,1,n)
// cout<<b[i]<<" ";
repD(i, beg - 1, 1) {
ll c = 2;
ll tr = 0;
while (c * i <= n) {
tr += b[c * i];
++c;
}
if ((tr % 2 == 1 && a[i - 1] == 1) || (tr % 2 == 0 && a[i - 1] == 0))
b[i] = 0;
else
b[i] = 1;
}
ll sum = 0;
repA(i, 1, n) { sum += b[i]; }
cout << sum << endl;
repA(i, 1, n) {
if (b[i] > 0)
cout << i + 1 << endl;
}
return 0;
}
| #ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
// o(╥﹏╥)o
#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <type_traits>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
#define ld long double
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vi>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define vpll vector<pair<long long, long long>>
#define fill(a, val) memset(a, val, sizeof(a))
#define sort_unique(c) \
(sort(c.begin(), c.end()), \
c.resize(distance(c.begin(), unique(c.begin(), c.end()))))
#define mp make_pair
#define pb push_back
#define f first
#define se second
#define all(cont) cont.begin(), cont.end()
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define MAX 1e9
#define MIN -1e9
typedef map<int, int> mpi;
typedef set<int> seti;
typedef multiset<int> mseti;
typedef priority_queue<int> pq;
typedef tuple<int, int, int> tup;
#define fio \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL)
#define rep(i, n) for (long long int i = 0; i < (n); ++i)
#define repA(i, a, n) for (ll i = a; i <= (n); ++i)
#define repD(i, a, n) for (ll i = a; i >= (n); --i)
#define trav(a, x) for (auto &a : x)
#define tr(c, i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
#define repn(i, begin, end) \
for (__typeof(end) i = (begin) - ((begin) > (end)); \
i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define PI 3.14159265
#define mod 1000000007
struct node {
ll val;
};
struct Interval {
int start, end;
};
bool compare(struct node n1, struct node n2) { return (n1.val < n2.val); }
const ll INF = 1e15 + 3;
const ll inf = 1e11 + 5;
const ll maxn = 1e6 + 2;
int main() {
ll n;
cin >> n;
ll a[n];
rep(i, n) cin >> a[i];
ll beg = n / 2;
++beg;
ll b[n + 1];
rep(i, n + 1) b[i] = -1;
repA(i, beg, n) b[i] = a[i - 1];
// repA(i,1,n)
// cout<<b[i]<<" ";
repD(i, beg - 1, 1) {
ll c = 2;
ll tr = 0;
while (c * i <= n) {
tr += b[c * i];
++c;
}
if ((tr % 2 == 1 && a[i - 1] == 1) || (tr % 2 == 0 && a[i - 1] == 0))
b[i] = 0;
else
b[i] = 1;
}
ll sum = 0;
repA(i, 1, n) { sum += b[i]; }
cout << sum << endl;
repA(i, 1, n) {
if (b[i] > 0)
cout << i << endl;
}
return 0;
}
| [
"expression.operation.binary.remove"
] | 779,021 | 779,022 | u627347690 | cpp |
p02972 | #ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
// o(╥﹏╥)o
#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <type_traits>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
#define ld long double
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vi>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define vpll vector<pair<long long, long long>>
#define fill(a, val) memset(a, val, sizeof(a))
#define sort_unique(c) \
(sort(c.begin(), c.end()), \
c.resize(distance(c.begin(), unique(c.begin(), c.end()))))
#define mp make_pair
#define pb push_back
#define f first
#define se second
#define all(cont) cont.begin(), cont.end()
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define MAX 1e9
#define MIN -1e9
typedef map<int, int> mpi;
typedef set<int> seti;
typedef multiset<int> mseti;
typedef priority_queue<int> pq;
typedef tuple<int, int, int> tup;
#define fio \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL)
#define rep(i, n) for (long long int i = 0; i < (n); ++i)
#define repA(i, a, n) for (ll i = a; i <= (n); ++i)
#define repD(i, a, n) for (ll i = a; i >= (n); --i)
#define trav(a, x) for (auto &a : x)
#define tr(c, i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
#define repn(i, begin, end) \
for (__typeof(end) i = (begin) - ((begin) > (end)); \
i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define PI 3.14159265
#define mod 1000000007
struct node {
ll val;
};
struct Interval {
int start, end;
};
bool compare(struct node n1, struct node n2) { return (n1.val < n2.val); }
const ll INF = 1e15 + 3;
const ll inf = 1e11 + 5;
const ll maxn = 1e6 + 2;
int main() {
ll n;
cin >> n;
ll a[n];
rep(i, n) cin >> a[i];
ll beg = n / 2;
++beg;
ll b[n + 1];
rep(i, n + 1) b[i] = -1;
repA(i, beg, n) b[i] = a[i - 1];
// repA(i,1,n)
// cout<<b[i]<<" ";
repD(i, beg - 1, 1) {
ll c = 2;
ll tr = 0;
while (c * i <= n) {
tr += b[c * i];
++c;
}
if ((tr % 2 == 1 && a[i - 1] == 1) || (tr % 2 == 0 && a[i - 1] == 0))
b[i] = 0;
else
b[i] = 1;
}
ll sum = 0;
repA(i, 1, n) { sum += b[i]; }
cout << sum << endl;
repA(i, 1, n) {
if (b[i] > 0)
cout << b[i] << endl;
}
return 0;
}
| #ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
// o(╥﹏╥)o
#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <type_traits>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
#define ld long double
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vi>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define vpll vector<pair<long long, long long>>
#define fill(a, val) memset(a, val, sizeof(a))
#define sort_unique(c) \
(sort(c.begin(), c.end()), \
c.resize(distance(c.begin(), unique(c.begin(), c.end()))))
#define mp make_pair
#define pb push_back
#define f first
#define se second
#define all(cont) cont.begin(), cont.end()
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define MAX 1e9
#define MIN -1e9
typedef map<int, int> mpi;
typedef set<int> seti;
typedef multiset<int> mseti;
typedef priority_queue<int> pq;
typedef tuple<int, int, int> tup;
#define fio \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL)
#define rep(i, n) for (long long int i = 0; i < (n); ++i)
#define repA(i, a, n) for (ll i = a; i <= (n); ++i)
#define repD(i, a, n) for (ll i = a; i >= (n); --i)
#define trav(a, x) for (auto &a : x)
#define tr(c, i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
#define repn(i, begin, end) \
for (__typeof(end) i = (begin) - ((begin) > (end)); \
i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define PI 3.14159265
#define mod 1000000007
struct node {
ll val;
};
struct Interval {
int start, end;
};
bool compare(struct node n1, struct node n2) { return (n1.val < n2.val); }
const ll INF = 1e15 + 3;
const ll inf = 1e11 + 5;
const ll maxn = 1e6 + 2;
int main() {
ll n;
cin >> n;
ll a[n];
rep(i, n) cin >> a[i];
ll beg = n / 2;
++beg;
ll b[n + 1];
rep(i, n + 1) b[i] = -1;
repA(i, beg, n) b[i] = a[i - 1];
// repA(i,1,n)
// cout<<b[i]<<" ";
repD(i, beg - 1, 1) {
ll c = 2;
ll tr = 0;
while (c * i <= n) {
tr += b[c * i];
++c;
}
if ((tr % 2 == 1 && a[i - 1] == 1) || (tr % 2 == 0 && a[i - 1] == 0))
b[i] = 0;
else
b[i] = 1;
}
ll sum = 0;
repA(i, 1, n) { sum += b[i]; }
cout << sum << endl;
repA(i, 1, n) {
if (b[i] > 0)
cout << i << endl;
}
return 0;
}
| [] | 779,023 | 779,022 | u627347690 | cpp |
p02972 | #include <algorithm>
#include <array>
#include <climits>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
int main(int, char **) {
long N, M;
cin >> N;
vector<long> a(N), box(N), sums(N, 0);
for (long i = 0; i < N; ++i) {
cin >> a[i];
}
M = 0;
for (long i = N - 1; i >= 0; --i) {
for (long j = i + 1; j < N; j += (i + 1)) {
sums[i] += box[j];
}
box[i] = (sums[i] % 2 == a[i]) ? 0 : 1;
sums[i] += box[i];
if (sums[i] % 2 != a[i]) {
cout << -1 << endl;
return 0;
}
if (box[i] == 1)
++M;
}
cout << M << endl;
for (long i = 0; i < N; ++i) {
if (box[i] == 1) {
--M;
cout << i + 1;
if (M != 0) {
cout << " ";
}
cout << endl;
}
}
return 0;
}
| #include <algorithm>
#include <array>
#include <climits>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
int main(int, char **) {
long N, M;
cin >> N;
vector<long> a(N), box(N), sums(N, 0);
for (long i = 0; i < N; ++i) {
cin >> a[i];
}
M = 0;
for (long i = N - 1; i >= 0; --i) {
for (long j = i + (i + 1); j < N; j += (i + 1)) {
sums[i] += box[j];
}
box[i] = (sums[i] % 2 == a[i]) ? 0 : 1;
sums[i] += box[i];
if (sums[i] % 2 != a[i]) {
cout << -1 << endl;
return 0;
}
if (box[i] == 1)
++M;
}
cout << M << endl;
for (long i = 0; i < N; ++i) {
if (box[i] == 1) {
--M;
cout << i + 1;
if (M != 0) {
cout << " ";
}
cout << endl;
}
}
return 0;
}
| [
"control_flow.loop.for.initializer.change"
] | 779,032 | 779,033 | u298497862 | cpp |
p02972 | #include <bits/stdc++.h>
#define int long long
using namespace std;
main() {
int n;
cin >> n;
int a[n + 5];
for (int i = 1; i <= n; i++)
cin >> a[i];
int flag = 1;
int dp[n + 10] = {0};
int count = 0;
vector<int> ans;
for (int i = n; i >= 2; i--) {
if (dp[i] != a[i])
count++, dp[i]++, dp[i] %= 2, ans.push_back(i);
for (int j = 1; j <= sqrt(i); j++) {
if (i % j == 0) {
dp[j]++;
dp[j] %= 2;
if (j * j != i && i % (i / j) == 0) {
dp[i / j]++;
dp[i / j] %= 2;
}
}
}
}
if (dp[1] != a[1])
dp[1]++, dp[1] %= 2, count++, ans.push_back(1);
cout << count << "\n";
for (auto x : ans)
cout << x << " ";
} | #include <bits/stdc++.h>
#define int long long
using namespace std;
main() {
int n;
cin >> n;
int a[n + 5];
for (int i = 1; i <= n; i++)
cin >> a[i];
int flag = 1;
int dp[n + 10] = {0};
int count = 0;
vector<int> ans;
for (int i = n; i >= 2; i--) {
if (dp[i] != a[i]) {
count++, dp[i]++, dp[i] %= 2, ans.push_back(i);
for (int j = 1; j <= sqrt(i); j++) {
if (i % j == 0) {
dp[j]++;
dp[j] %= 2;
if (j * j != i && i % (i / j) == 0) {
dp[i / j]++;
dp[i / j] %= 2;
}
}
}
}
}
if (dp[1] != a[1])
dp[1]++, dp[1] %= 2, count++, ans.push_back(1);
cout << count << "\n";
for (auto x : ans)
cout << x << " ";
} | [] | 779,036 | 779,037 | u124375339 | cpp |
p02972 | // C++ includes
#include <bits/stdc++.h>
// 俳句
using namespace std;
// alias templates
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
// alias declaration
using ll = long long;
using str = string;
using vll = V<ll>;
using vvll = V<vll>;
using vs = V<str>;
// loops
#define FOR(i, a, b) for (ll i = (a); i <= (ll)(b); i++) // [a,b]
#define rFOR(i, a, b) for (ll i = (b); i >= (ll)(a); i--) // [b,a]
#define REP(i, a) FOR((i), 0, (ll)(a)-1) // [0,a-1]
// for debug
#define dbg(a) cerr << " " << (#a) << ": " << (a) << "\n";
// procon common constants
const ll MOD_BIG = 1e9 + 7;
int main(void) {
ll N;
cin >> N;
vll a(N + 1), b(N + 1);
a[0] = 0;
b[0] = 0;
bool f;
FOR(i, 1, N) { cin >> a[i]; }
if (N > 2) {
// b[N/2+1] ~ b[N]は確定
FOR(i, N / 2 + 1, N) { b[i] = a[i]; }
rFOR(i, N / 2, 1) {
f = 0;
FOR(j, 2, N / i) { f ^= b[j * i]; }
//
b[i] = f ^ a[i];
}
} else if (N == 1) {
b[1] = a[1];
} else {
b[2] = a[2];
b[1] = a[1] ^ a[2];
}
ll balls = count(b.begin(), b.end(), 1);
cout << balls << endl;
if (balls > 0) {
FOR(i, 1, N) {
if (b[i] == 1) {
cout << i << endl;
}
}
}
} | // C++ includes
#include <bits/stdc++.h>
// 俳句
using namespace std;
// alias templates
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
// alias declaration
using ll = long long;
using str = string;
using vll = V<ll>;
using vvll = V<vll>;
using vs = V<str>;
// loops
#define FOR(i, a, b) for (ll i = (a); i <= (ll)(b); i++) // [a,b]
#define rFOR(i, a, b) for (ll i = (b); i >= (ll)(a); i--) // [b,a]
#define REP(i, a) FOR((i), 0, (ll)(a)-1) // [0,a-1]
// for debug
#define dbg(a) cerr << " " << (#a) << ": " << (a) << "\n";
// procon common constants
const ll MOD_BIG = 1e9 + 7;
int main(void) {
ll N;
cin >> N;
vll a(N + 1), b(N + 1);
a[0] = 0;
b[0] = 0;
bool f;
FOR(i, 1, N) { cin >> a[i]; }
if (N > 2) {
// b[N/2+1] ~ b[N]は確定
FOR(i, N / 2 + 1, N) { b[i] = a[i]; }
// puts("a");
rFOR(i, 1, N / 2) {
f = 0;
FOR(j, 2, N / i) { f ^= b[j * i]; }
b[i] = f ^ a[i];
// cout << "b[" << i << "]=" << b[i] << endl;;
}
} else if (N == 1) {
b[1] = a[1];
} else { // N==2
b[2] = a[2];
b[1] = a[1] ^ a[2];
}
ll balls = count(b.begin(), b.end(), 1);
cout << balls << endl;
if (balls > 0) {
FOR(i, 1, N) {
if (b[i] == 1) {
cout << i << endl;
}
}
}
} | [
"call.arguments.add",
"call.arguments.change"
] | 779,038 | 779,039 | u510283765 | cpp |
p02972 | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> inputVec;
for (int i = 1; i <= n; i++) {
int num;
cin >> num;
inputVec.push_back(num);
}
vector<int> ansVec(n, 0);
vector<int> ansNum;
for (int i = n; i >= 1; i--) {
int issum = 0;
for (int j = 2; j < n; j++) {
if (i * j > n)
break;
else if (ansVec[i * j - 1] == 1)
issum++;
}
if (issum % 2 == inputVec[i - 1])
ansVec[i - 1] = 0;
else {
ansVec[i - 1] = 1;
ansNum.push_back(i);
}
}
cout << ansNum.size() << endl;
for (int i = 0; i < ansNum.size(); i++) {
if (i != ansNum.size() - 1) {
cout << ansNum[i] << " ";
} else {
cout << ansNum[i];
}
}
return 0;
} | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> inputVec;
for (int i = 1; i <= n; i++) {
int num;
cin >> num;
inputVec.push_back(num);
}
vector<int> ansVec(n, 0);
vector<int> ansNum;
for (int i = n; i >= 1; i--) {
int issum = 0;
for (int j = 2; j <= n; j++) {
if (i * j > n)
break;
else if (ansVec[i * j - 1] == 1)
issum++;
}
if (issum % 2 == inputVec[i - 1])
ansVec[i - 1] = 0;
else {
ansVec[i - 1] = 1;
ansNum.push_back(i);
}
}
cout << ansNum.size() << endl;
for (int i = 0; i < ansNum.size(); i++) {
if (i != ansNum.size() - 1) {
cout << ansNum[i] << " ";
} else {
cout << ansNum[i];
}
}
return 0;
} | [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 779,042 | 779,043 | u509420256 | cpp |
p02972 | #include <algorithm>
#include <iostream>
#include <map>
#include <unordered_map>
#include <vector>
using namespace std;
typedef long long ll;
ll mod = 1e9 + 7;
int main() {
int n;
cin >> n;
int boader = n / 2;
if (n % 2 == 0) {
boader -= 1;
}
vector<int> a(n), ans(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
if (i > boader) {
ans[i] = a[i];
}
}
for (int i = boader; i > 0; i--) {
int x = 0, mul = i * 2;
while (mul < n) {
x += ans[mul - 1];
mul += i;
}
if (a[i - 1] == 0) {
if (x % 2 == 0) {
ans[i - 1] = 0;
} else {
ans[i - 1] = 1;
}
} else {
if (x % 2 == 0) {
ans[i - 1] = 1;
} else {
ans[i - 1] = 0;
}
}
}
int m = 0;
for (int i = 0; i < n; i++) {
if (ans[i] == 1) {
m += 1;
}
}
cout << m << endl;
for (int i = 0; i < n; i++) {
if (ans[i] == 1) {
cout << i + 1 << endl;
}
}
} | #include <algorithm>
#include <iostream>
#include <map>
#include <unordered_map>
#include <vector>
using namespace std;
typedef long long ll;
ll mod = 1e9 + 7;
int main() {
int n;
cin >> n;
int boader = n / 2;
if (n % 2 == 1) {
boader += 1;
}
vector<int> a(n), ans(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
if (i >= boader) {
ans[i] = a[i];
}
}
for (int i = boader; i > 0; i--) {
int x = 0, mul = i * 2;
while (mul <= n) {
x += ans[mul - 1];
mul += i;
}
if (a[i - 1] == 0) {
if (x % 2 == 0) {
ans[i - 1] = 0;
} else {
ans[i - 1] = 1;
}
} else {
if (x % 2 == 0) {
ans[i - 1] = 1;
} else {
ans[i - 1] = 0;
}
}
}
int m = 0;
for (int i = 0; i < n; i++) {
if (ans[i] == 1) {
m += 1;
}
}
cout << m << endl;
for (int i = 0; i < n; i++) {
if (ans[i] == 1) {
cout << i + 1 << endl;
}
}
} | [
"literal.number.change",
"control_flow.branch.if.condition.change",
"expression.operator.change",
"expression.operator.compare.change",
"control_flow.loop.condition.change"
] | 779,051 | 779,050 | u807028974 | cpp |
p02972 | #include <iostream>
using namespace std;
int main() {
int n, i, j, mul, num, m = 0;
cin >> n;
int a[n];
int ans[n];
for (i = 0; i < n; i++) {
cin >> a[i];
}
for (i = 0; i < n; i++) {
ans[i] = 0;
}
for (i = n; i >= 1; i--) {
mul = n / i;
num = 0;
for (j = 2; j <= mul; j++) {
num = num + ans[i * j - 1];
}
if (num % 2 == a[i - 1]) {
ans[i - 1] = 0;
} else if (num % 2 != a[i - 1]) {
ans[i - 1] = 1;
m++;
}
}
cout << m << "\n";
for (i = 0; i < n; i++) {
if (ans[i] == 1) {
cout << ans[i] << " ";
}
}
return 0;
}
| #include <iostream>
using namespace std;
int main() {
int n, i, j, mul, num, m = 0;
cin >> n;
int a[n];
int ans[n];
for (i = 0; i < n; i++) {
cin >> a[i];
}
for (i = 0; i < n; i++) {
ans[i] = 0;
}
for (i = n; i >= 1; i--) {
mul = n / i;
num = 0;
for (j = 2; j <= mul; j++) {
num = num + ans[i * j - 1];
}
if (num % 2 == a[i - 1]) {
ans[i - 1] = 0;
} else if (num % 2 != a[i - 1]) {
ans[i - 1] = 1;
m++;
}
}
cout << m << "\n";
for (i = 0; i < n; i++) {
if (ans[i] == 1) {
cout << i + 1 << " ";
}
}
return 0;
}
| [
"io.output.change"
] | 779,053 | 779,054 | u709752172 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main() {
int n;
cin >> n;
vector<ll> v(n + 1);
for (int i = 1; i <= n; i++)
cin >> v[i];
int cnt = 0;
vector<ll> ans(n + 1);
for (int i = n; i > 0; i--) {
int c = 0;
for (int j = 2 * i; j <= n; j += i) {
if (ans[j])
c++;
}
if (c % 2 == v[i])
ans[i] = 0;
else {
ans[i] = 1;
cnt++;
}
}
cout << cnt << endl;
for (int i = 1; i <= n; i++) {
// cout<<ans[i]<<" ";
if (ans[i])
cout << v[i] << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main() {
int n;
cin >> n;
vector<int> v(n + 1);
for (int i = 1; i <= n; i++)
cin >> v[i];
int cnt = 0;
vector<int> ans(n + 1);
for (int i = n; i > 0; i--) {
int c = 0;
for (int j = 2 * i; j <= n; j += i) {
if (ans[j])
c++;
}
if (c % 2 == v[i])
ans[i] = 0;
else {
ans[i] = 1;
cnt++;
}
}
cout << cnt << endl;
for (int i = 1; i <= n; i++) {
// cout<<ans[i]<<" ";
if (ans[i])
cout << i << endl;
}
} | [] | 779,055 | 779,056 | u366445643 | cpp |
p02972 | #include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(void) {
int N;
vector<bool> A;
vector<int> NUM;
vector<bool> TAMA;
int temp;
int num = 0;
A.push_back(0);
TAMA.push_back(0);
cin >> N;
for (int i = 0; i < N; i++) {
cin >> temp;
A.push_back(temp);
TAMA.push_back(0);
}
if (N == 1) {
if (A[1] == 0) {
cout << "0";
} else if (A[1] == 1) {
cout << "1" << endl;
cout << "1";
}
return 0;
}
int k = N / 2;
if (N % 2 != 0)
k++;
for (int i = N; i > k - 1; i--) {
TAMA[i] = A[i];
if (A[i] == 1)
num++;
}
for (int i = k; i > 0; i--) {
int j = i + i;
bool amari = 0;
while (1) {
if (j >= N + 1)
break;
else if (TAMA[j] == 1) {
if (amari == 1)
amari = 0;
else
amari = 1;
}
j += i;
// cout<< i << " " << j << " "<< amari << endl;
}
if (A[i] == 0 && amari == 1) {
TAMA[i] = 1;
num++;
} else if (A[i] == 1 && amari == 0) {
TAMA[i] = 1;
num++;
} else
TAMA[i] = 0;
}
if (num == 0) {
cout << "0";
return 0;
}
cout << num << endl;
for (int i = 1; i < N + 1; i++) {
if (TAMA[i] == 1) {
cout << i << " ";
}
}
return 0;
} | #include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(void) {
int N;
vector<bool> A;
vector<int> NUM;
vector<bool> TAMA;
int temp;
int num = 0;
A.push_back(0);
TAMA.push_back(0);
cin >> N;
for (int i = 0; i < N; i++) {
cin >> temp;
A.push_back(temp);
TAMA.push_back(0);
}
if (N == 1) {
if (A[1] == 0) {
cout << "0";
} else if (A[1] == 1) {
cout << "1" << endl;
cout << "1";
}
return 0;
}
int k = N / 2;
if (N % 2 != 0)
k++;
for (int i = N; i > k; i--) {
TAMA[i] = A[i];
if (A[i] == 1)
num++;
}
for (int i = k; i > 0; i--) {
int j = i + i;
bool amari = 0;
while (1) {
if (j >= N + 1)
break;
else if (TAMA[j] == 1) {
if (amari == 1)
amari = 0;
else
amari = 1;
}
j += i;
// cout<< i << " " << j << " "<< amari << endl;
}
if (A[i] == 0 && amari == 1) {
TAMA[i] = 1;
num++;
} else if (A[i] == 1 && amari == 0) {
TAMA[i] = 1;
num++;
} else
TAMA[i] = 0;
}
if (num == 0) {
cout << "0";
return 0;
}
cout << num << endl;
for (int i = 1; i < N + 1; i++) {
if (TAMA[i] == 1) {
cout << i << " ";
}
}
return 0;
} | [
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove"
] | 779,059 | 779,060 | u787146631 | cpp |
p02972 | #include <iostream>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
int main() {
long long n;
cin >> n;
vector<int> a;
a.resize(n + 1, 0);
for (long long i = 1; i <= n; ++i) {
cin >> a[i];
}
long long countb = 0;
vector<int> b;
b.resize(n + 1, 0);
for (long long i = n; 0 < i; --i) {
if (n < i * 2) {
if (a[i] == 1) {
b[i] = 1;
++countb;
}
continue;
}
int count = 0;
long long temp = i;
while (n < temp) {
count += b[temp];
temp += i;
}
if (count % 2 == 1) {
if (a[i] == 0) {
b[i] = 1;
++countb;
}
} else {
if (a[i] == 1) {
b[i] = 1;
++countb;
}
}
}
cout << countb << endl;
string s;
for (long long i = 1; i <= n; ++i) {
if (b[i] == 1) {
ostringstream oss;
oss << i;
s += oss.str();
s += " ";
}
}
if (!s.empty()) {
s.pop_back();
cout << s << endl;
}
return 0;
} | #include <iostream>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
int main() {
long long n;
cin >> n;
vector<int> a;
a.resize(n + 1, 0);
for (long long i = 1; i <= n; ++i) {
cin >> a[i];
}
long long countb = 0;
vector<int> b;
b.resize(n + 1, 0);
for (long long i = n; 0 < i; --i) {
if (n < i * 2) {
if (a[i] == 1) {
b[i] = 1;
++countb;
}
continue;
}
int count = 0;
long long temp = i;
while (temp <= n) {
count += b[temp];
temp += i;
}
if (count % 2 == 1) {
if (a[i] == 0) {
b[i] = 1;
++countb;
}
} else {
if (a[i] == 1) {
b[i] = 1;
++countb;
}
}
}
cout << countb << endl;
string s;
for (long long i = 1; i <= n; ++i) {
if (b[i] == 1) {
ostringstream oss;
oss << i;
s += oss.str();
s += " ";
}
}
if (!s.empty()) {
s.pop_back();
cout << s << endl;
}
return 0;
} | [
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove",
"control_flow.loop.condition.change"
] | 779,065 | 779,066 | u611571299 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
int main() {
int ans = 0, sum = 0;
int n;
cin >> n;
int a[n];
int box[n];
int anslist[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = n; i >= 1; i--) {
int k = 2;
int bit = a[i - 1];
while (k * i <= n) {
bit ^= a[k * i - 1];
k++;
}
box[i - 1] = bit;
}
for (int i = 0; i < n; i++) {
if (box[i] == 1) {
anslist[ans] = i + 1;
ans++;
}
}
cout << ans << endl;
for (int i = 0; i < ans; i++) {
cout << anslist[i] << '\n';
}
// cout <<fixed<<setprecision(16)<< << endl;
// cout << ans << endl;
// if(flag==1)cout << "Yes" <<endl;
// else cout << "No" <<endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int ans = 0, sum = 0;
int n;
cin >> n;
int a[n];
int box[n];
int anslist[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = n; i >= 1; i--) {
int k = 2;
int bit = a[i - 1];
while (k * i <= n) {
bit ^= box[k * i - 1];
k++;
}
box[i - 1] = bit;
}
for (int i = 0; i < n; i++) {
if (box[i] == 1) {
anslist[ans] = i + 1;
ans++;
}
}
cout << ans << endl;
for (int i = 0; i < ans; i++) {
cout << anslist[i] << '\n';
}
// cout <<fixed<<setprecision(16)<< << endl;
// cout << ans << endl;
// if(flag==1)cout << "Yes" <<endl;
// else cout << "No" <<endl;
return 0;
}
| [
"assignment.value.change",
"identifier.change"
] | 779,067 | 779,068 | u355424600 | cpp |
p02972 | #include "bits/stdc++.h"
/************* Using *************/
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using graph_t = vector<vector<ll>>;
/*********** Constants ***********/
const auto INF = static_cast<int>(1e10);
const auto INFL = static_cast<ll>(1e18);
const auto MOD = static_cast<ll>(1e9 + 7);
const auto NIL = nullptr;
/*********** Variables ***********/
ll N, M;
vector<ll> A, B;
/************* Utils *************/
/*********** Functions ***********/
bool init() {
cin >> N;
A.resize(N + 1, 0);
B.resize(N + 1, 0);
for (ll i = 1; i <= N; i++) {
cin >> A[i];
}
return true;
}
void solve() {
for (ll i = N; i > 0; i--) {
ll tmp = 0;
for (ll j = i * 2; j <= N; j += i) {
tmp += B[i];
}
if (A[i] == 1 && tmp % 2 == 0) {
B[i] = 1;
} else if (A[i] == 0 && tmp % 2 == 1) {
B[i] = 1;
}
}
}
void output() {
M = count(B.begin(), B.end(), 1);
cout << M << endl;
if (M > 0) {
bool first = true;
for (ll i = 1; i <= N; i++) {
if (B[i] == 0) {
continue;
}
if (first) {
cout << i;
first = false;
} else {
cout << " " << i;
}
}
cout << endl;
}
}
int main() {
init();
solve();
output();
return 0;
}
| #include "bits/stdc++.h"
/************* Using *************/
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using graph_t = vector<vector<ll>>;
/*********** Constants ***********/
const auto INF = static_cast<int>(1e10);
const auto INFL = static_cast<ll>(1e18);
const auto MOD = static_cast<ll>(1e9 + 7);
const auto NIL = nullptr;
/*********** Variables ***********/
ll N, M;
vector<ll> A, B;
/************* Utils *************/
/*********** Functions ***********/
bool init() {
cin >> N;
A.resize(N + 1, 0);
B.resize(N + 1, 0);
for (ll i = 1; i <= N; i++) {
cin >> A[i];
}
return true;
}
void solve() {
for (ll i = N; i > 0; i--) {
ll tmp = 0;
for (ll j = i * 2; j <= N; j += i) {
tmp += B[j];
}
if (A[i] == 1 && tmp % 2 == 0) {
B[i] = 1;
} else if (A[i] == 0 && tmp % 2 == 1) {
B[i] = 1;
}
}
}
void output() {
M = count(B.begin(), B.end(), 1);
cout << M << endl;
if (M > 0) {
bool first = true;
for (ll i = 1; i <= N; i++) {
if (B[i] == 0) {
continue;
}
if (first) {
cout << i;
first = false;
} else {
cout << " " << i;
}
}
cout << endl;
}
}
int main() {
init();
solve();
output();
return 0;
}
| [
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change"
] | 779,069 | 779,070 | u634208461 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ll n;
cin >> n;
vector<ll> a(n + 1);
for (ll i = 1; i < n + 1; i++) {
cin >> a[i];
}
vector<ll> b(n + 1);
for (ll i = n / 2 + 1; i < n + 1; i++) {
if (a[i] == 1)
b[i] = 1;
else
b[i] = 0;
}
for (ll i = n / 2; i > 0; i--) {
ll count = 1;
ll sum = 0;
b[i] = 0;
for (ll j = i; j < n + 1; j = j * count) {
sum += b[j];
count++;
}
if (sum % 2 != a[i])
b[i] = 1;
}
ll ans1 = 0;
for (ll i = 1; i < n + 1; i++) {
if (b[i] == 1)
ans1++;
}
cout << ans1 << endl;
for (ll i = 1; i < n + 1; i++) {
if (b[i] == 1)
cout << i << " ";
}
}
| #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ll n;
cin >> n;
vector<ll> a(n + 1);
for (ll i = 1; i < n + 1; i++) {
cin >> a[i];
}
vector<ll> b(n + 1);
for (ll i = n / 2 + 1; i < n + 1; i++) {
if (a[i] == 1)
b[i] = 1;
else
b[i] = 0;
}
for (ll i = n / 2; i > 0; i--) {
ll count = 1;
ll sum = 0;
b[i] = 0;
for (ll j = i; j < n + 1; j = i * count) {
sum += b[j];
count++;
}
if (sum % 2 != a[i])
b[i] = 1;
}
ll ans1 = 0;
for (ll i = 1; i < n + 1; i++) {
if (b[i] == 1)
ans1++;
}
cout << ans1 << endl;
for (ll i = 1; i < n + 1; i++) {
if (b[i] == 1)
cout << i << " ";
}
} | [
"assignment.value.change",
"identifier.change",
"expression.operation.binary.change"
] | 779,071 | 779,072 | u330689597 | cpp |
p02972 | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <numeric>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> A = vector<int>(N + 1);
vector<int> B = vector<int>(N + 1);
for (int i = 1; i <= N; i++) {
cin >> A[i];
}
for (int i = N; i >= 1; i--) {
int j = i;
int sum = 0;
while (j + i <= N) {
j += i;
sum ^= A[j];
}
B[i] = sum ^ A[i];
// if (sum != A[i]) {
// cout << -1 << endl;
// return 0;
// }
}
int s = accumulate(B.begin() + 1, B.end(), 0);
cout << s << endl;
for (int i = 1; i <= N; i++) {
if (B[i] == 1) {
cout << i << " ";
}
}
if (s != 0) {
putchar('\n');
}
return 0;
} | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <numeric>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> A = vector<int>(N + 1);
vector<int> B = vector<int>(N + 1);
for (int i = 1; i <= N; i++) {
cin >> A[i];
}
for (int i = N; i >= 1; i--) {
int j = i;
int sum = 0;
while (j + i <= N) {
j += i;
sum ^= B[j];
}
B[i] = sum ^ A[i];
// if (sum != A[i]) {
// cout << -1 << endl;
// return 0;
// }
}
int s = accumulate(B.begin() + 1, B.end(), 0);
cout << s << endl;
for (int i = 1; i <= N; i++) {
if (B[i] == 1) {
cout << i << " ";
}
}
if (s != 0) {
putchar('\n');
}
return 0;
} | [
"assignment.value.change",
"identifier.change"
] | 779,089 | 779,090 | u783428243 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
vector<int> a(N);
for (int i = 0; i < N; ++i) {
cin >> a[i];
}
vector<int> b(N, 0);
for (int i = N - 1; i >= 0; --i) {
int sum = 0;
for (int j = 2; j < 2e6; ++j) {
if ((i + 1) * j - 1 < N)
sum += b[(i + 1) * j - 1];
else
break;
}
b[i] = (sum + a[i]) % 2;
}
int M = 0;
for (int i = 0; i < N; ++i) {
if (b[i] > 0)
M++;
}
cout << M << endl;
int cnt = 0;
for (int i = 0; i < N; ++i) {
if (b[i] > 0) {
cnt++;
cout << b[i] << (cnt == M ? "\n" : " ");
}
}
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
vector<int> a(N);
for (int i = 0; i < N; ++i) {
cin >> a[i];
}
vector<int> b(N, 0);
for (int i = N - 1; i >= 0; --i) {
int sum = 0;
for (int j = 2; j < 2e6; ++j) {
if ((i + 1) * j - 1 < N)
sum += b[(i + 1) * j - 1];
else
break;
}
b[i] = (sum + a[i]) % 2;
}
int M = 0;
for (int i = 0; i < N; ++i) {
if (b[i] > 0)
M++;
}
cout << M << endl;
int cnt = 0;
for (int i = 0; i < N; ++i) {
if (b[i] > 0) {
cnt++;
cout << i + 1 << (cnt == M ? "\n" : " ");
}
}
} | [
"io.output.change"
] | 779,091 | 779,092 | u679366464 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
vector<int> a(N);
for (int i = 0; i < N; ++i) {
cin >> a[i];
}
vector<int> b(N, 0);
for (int i = N - 1; i >= 0; --i) {
int sum = 0;
for (int j = 2; j < 2e6; ++j) {
if ((i + 1) * j - 1 < N)
sum += a[(i + 1) * j - 1];
else
break;
}
b[i] = (sum + a[i]) % 2;
}
int M = 0;
for (int i = 0; i < N; ++i) {
if (b[i] > 0)
M++;
}
cout << M << endl;
int cnt = 0;
for (int i = 0; i < N; ++i) {
if (b[i] > 0) {
cnt++;
cout << b[i] << (cnt == M ? "\n" : " ");
}
}
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
vector<int> a(N);
for (int i = 0; i < N; ++i) {
cin >> a[i];
}
vector<int> b(N, 0);
for (int i = N - 1; i >= 0; --i) {
int sum = 0;
for (int j = 2; j < 2e6; ++j) {
if ((i + 1) * j - 1 < N)
sum += b[(i + 1) * j - 1];
else
break;
}
b[i] = (sum + a[i]) % 2;
}
int M = 0;
for (int i = 0; i < N; ++i) {
if (b[i] > 0)
M++;
}
cout << M << endl;
int cnt = 0;
for (int i = 0; i < N; ++i) {
if (b[i] > 0) {
cnt++;
cout << i + 1 << (cnt == M ? "\n" : " ");
}
}
} | [
"assignment.value.change",
"identifier.change",
"io.output.change"
] | 779,093 | 779,092 | u679366464 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int arr[200005];
int box[200005];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin >> n;
vector<int> ans;
for (int i = 1; i <= n; i++) {
cin >> arr[i];
}
for (int i = n; i >= 1; i--) {
ll sum = 0;
for (int j = n * 2; j <= n; j += i) {
sum += box[j];
}
sum = sum % 2;
if (arr[i] == sum) {
box[i] = 0;
} else {
box[i] = 1;
ans.push_back(i);
}
}
sort(ans.begin(), ans.end());
cout << ans.size() << endl;
for (int i = 0; i < ans.size(); i++) {
if (i != 0)
cout << " ";
cout << ans[i];
}
cout << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int arr[200005];
int box[200005];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin >> n;
vector<int> ans;
for (int i = 1; i <= n; i++) {
cin >> arr[i];
}
for (int i = n; i >= 1; i--) {
ll sum = 0;
for (int j = i * 2; j <= n; j += i) {
sum += box[j];
}
sum = sum % 2;
if (arr[i] == sum) {
box[i] = 0;
} else {
box[i] = 1;
ans.push_back(i);
}
}
sort(ans.begin(), ans.end());
cout << ans.size() << endl;
for (int i = 0; i < ans.size(); i++) {
if (i != 0)
cout << " ";
cout << ans[i];
}
cout << endl;
return 0;
}
| [
"identifier.change",
"control_flow.loop.for.initializer.change",
"expression.operation.binary.change"
] | 779,094 | 779,095 | u599785147 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, i, j;
cin >> n;
int a[n + 1];
int b[n + 1];
for (i = 1; i <= n; i++) {
cin >> a[i];
}
int t = 0;
for (i = n; i > 0; i--) {
int c = 0;
for (j = i * 2; j <= n; j++) {
c += a[j];
}
b[i] = (c + a[i]) % 2;
if (b[i] == 1)
t++;
}
cout << t << endl;
for (i = 1; i <= n; i++) {
if (b[i] == 1) {
cout << i << " ";
}
}
cout << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, i, j;
cin >> n;
int a[n + 1];
int b[n + 1];
for (i = 1; i <= n; i++) {
cin >> a[i];
}
int t = 0;
for (i = n; i > 0; i--) {
int c = 0;
for (j = i * 2; j <= n; j += i) {
c += b[j];
}
b[i] = (c + a[i]) % 2;
if (b[i] == 1)
t++;
}
cout << t << endl;
for (i = 1; i <= n; i++) {
if (b[i] == 1) {
cout << i << " ";
}
}
cout << endl;
} | [
"assignment.value.change",
"identifier.change"
] | 779,096 | 779,097 | u898143674 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, i, j;
cin >> n;
int a[n + 1];
int b[n + 1];
for (i = 1; i <= n; i++) {
cin >> a[i];
}
int t = 0;
for (i = n; i > 0; i--) {
int c = 0;
for (j = i * 2; j < n; j++) {
c += a[j];
}
b[i] = (c + a[i]) % 2;
if (b[i] == 1)
t++;
}
cout << t << endl;
for (i = 1; i <= n; i++) {
if (b[i] == 1) {
cout << i << " ";
}
}
cout << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, i, j;
cin >> n;
int a[n + 1];
int b[n + 1];
for (i = 1; i <= n; i++) {
cin >> a[i];
}
int t = 0;
for (i = n; i > 0; i--) {
int c = 0;
for (j = i * 2; j <= n; j += i) {
c += b[j];
}
b[i] = (c + a[i]) % 2;
if (b[i] == 1)
t++;
}
cout << t << endl;
for (i = 1; i <= n; i++) {
if (b[i] == 1) {
cout << i << " ";
}
}
cout << endl;
} | [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change",
"assignment.value.change",
"identifier.change"
] | 779,098 | 779,097 | u898143674 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> a(N);
for (int i = 0; i < N; ++i) {
cin >> a.at(i);
}
int cnt1 = 0;
vector<int> b(N);
for (int i = N - 1; i >= 0; --i) {
if (N / (i + 1) == 1) {
b.at(i) = a.at(i);
if (a.at(i) == 1)
cnt1++;
} else {
int cnt = 0;
for (int j = 0; j < N / (i + 1); j++) {
cnt += b.at((i + 1) * (j + 1) - 1);
}
if (cnt / 2 == a.at(i)) {
b.at(i) = 0;
} else {
b.at(i) = 1;
cnt1++;
}
}
}
cout << cnt1 << endl;
for (int i = 0; i < N; ++i) {
if (b.at(i) == 1)
cout << i + 1 << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> a(N);
for (int i = 0; i < N; ++i) {
cin >> a.at(i);
}
int cnt1 = 0;
vector<int> b(N);
for (int i = N - 1; i >= 0; --i) {
if (N / (i + 1) == 1) {
b.at(i) = a.at(i);
if (a.at(i) == 1)
cnt1++;
} else {
int cnt = 0;
for (int j = 0; j < N / (i + 1); j++) {
cnt += b.at((i + 1) * (j + 1) - 1);
}
if (cnt % 2 == a.at(i)) {
b.at(i) = 0;
} else {
b.at(i) = 1;
cnt1++;
}
}
}
cout << cnt1 << endl;
for (int i = 0; i < N; ++i) {
if (b.at(i) == 1)
cout << i + 1 << endl;
}
} | [
"expression.operator.arithmetic.change",
"control_flow.branch.if.condition.change"
] | 779,101 | 779,102 | u495461806 | cpp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.