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>
using namespace std;
const int N = 1e5 + 5;
int n, a[N], b[N];
bool flag = true;
vector<int> v;
int cal(int i) {
int ans = 0;
for (int j = i; j <= n; j++)
ans += b[j];
return ans;
}
int main() {
int res = 0;
scanf("%d", &n);
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]);
for (int i = n; i >= 1; i--) {
int x = cal(i);
if (x % 2 != a[i])
b[i] = 1, v.push_back(i);
}
if (!flag)
printf("-1\n");
else {
printf("%d\n", v.size());
sort(v.begin(), v.end());
for (int i = 0; i < v.size(); i++)
printf(i == v.size() - 1 ? "%d\n" : "%d ", v[i]);
}
}
| #include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n, a[N], b[N];
bool flag = true;
vector<int> v;
int cal(int i) {
int ans = 0;
for (int j = i; j <= n; j += i)
ans += b[j];
return ans;
}
int main() {
int res = 0;
scanf("%d", &n);
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]);
for (int i = n; i >= 1; i--) {
int x = cal(i);
if (x % 2 != a[i])
b[i] = 1, v.push_back(i);
}
if (!flag)
printf("-1\n");
else {
printf("%d\n", v.size());
sort(v.begin(), v.end());
for (int i = 0; i < v.size(); i++)
printf(i == v.size() - 1 ? "%d\n" : "%d ", v[i]);
}
}
| [
"literal.number.change",
"expression.operation.binary.change"
] | 779,749 | 779,750 | u061850718 | cpp |
p02972 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, a, n) for (int i = a; i < n; i++)
typedef long long ll;
void Main() {
int n;
cin >> n;
int a[200010];
rep(i, n) cin >> a[i + 1];
int res[200010];
int cnt = 0;
for (int i = n; i > 0; --i) {
int other = 0;
for (int j = 2; true; ++j) {
if (j * i > n) {
break;
}
if (res[j] == 1) {
++other;
}
}
if (a[i] == 0) {
if (other % 2 == 0) {
res[i] = 0;
} else {
res[i] = 1;
++cnt;
}
} else {
if (other % 2 == 0) {
res[i] = 1;
++cnt;
} else {
res[i] = 0;
}
}
}
cout << cnt << endl;
rep(i, n) {
if (res[i + 1] == 1) {
cout << (i + 1);
if (i == n - 1) {
cout << endl;
} else {
cout << " ";
}
}
}
}
int main() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
Main();
}
| #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, a, n) for (int i = a; i < n; i++)
typedef long long ll;
void Main() {
int n;
cin >> n;
int a[200010];
rep(i, n) cin >> a[i + 1];
int res[200010];
int cnt = 0;
for (int i = n; i > 0; --i) {
int other = 0;
for (int j = 2; true; ++j) {
if (j * i > n) {
break;
}
if (res[j * i] == 1) {
++other;
}
}
if (a[i] == 0) {
if (other % 2 == 0) {
res[i] = 0;
} else {
res[i] = 1;
++cnt;
}
} else {
if (other % 2 == 0) {
res[i] = 1;
++cnt;
} else {
res[i] = 0;
}
}
}
cout << cnt << endl;
rep(i, n) {
if (res[i + 1] == 1) {
cout << (i + 1);
if (i == n - 1) {
cout << endl;
} else {
cout << " ";
}
}
}
}
int main() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
Main();
}
| [
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change"
] | 779,754 | 779,755 | u215692812 | cpp |
p02972 | #include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <string>
#include <vector>
#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> ans;
vector<int> box(n + 1);
for (int i = n; i >= n / 2 + 1; i--)
if (a[i] != 0) {
ans.push_back(i);
box[i] = 1;
}
for (int i = n / 2 + 1; i >= 1; i--) {
int now = i;
int count = 0;
for (int j = 2; n >= now * j; j++)
count += box[now * j];
if (count % 2 != a[i]) {
ans.push_back(i);
box[i]++;
}
}
cout << ans.size() << endl;
rep(i, ans.size()) cout << ans[i] << endl;
return 0;
} | #include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <string>
#include <vector>
#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> ans;
vector<int> box(n + 1);
for (int i = n; i >= n / 2 + 1; i--)
if (a[i] == 1) {
ans.push_back(i);
box[i] = 1;
}
for (int i = n / 2; i >= 1; i--) {
int now = i;
int count = 0;
for (int j = 2; n >= now * j; j++)
count += box[now * j];
if (count % 2 != a[i]) {
ans.push_back(i);
box[i]++;
}
}
cout << ans.size() << endl;
rep(i, ans.size()) cout << ans[i] << endl;
return 0;
}
| [
"control_flow.loop.for.condition.change",
"control_flow.loop.for.initializer.change",
"expression.operation.binary.remove"
] | 779,758 | 779,759 | u480938608 | cpp |
p02972 | #include <algorithm>
#include <iostream>
#include <numeric>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long int ll;
const int INF = 1 << 30;
const long long LINF = 1LL << 60;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<int> a(n + 1);
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
int m = 0;
vector<int> c(n + 1), b;
for (int i = n; i >= 1; i--) {
int sum = 0;
int p = 2 * i;
while (p <= n) {
sum += a[p];
p += i;
}
int t = sum % 2;
if (t != a[i]) {
c[i] = 1;
b.emplace_back(i);
m++;
}
}
cout << m << endl;
if (m > 0) {
cout << b[0];
for (int i = 1; i < m; i++) {
cout << " " << b[i];
}
cout << endl;
}
return 0;
}
| #include <algorithm>
#include <iostream>
#include <numeric>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long int ll;
const int INF = 1 << 30;
const long long LINF = 1LL << 60;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<int> a(n + 1);
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
int m = 0;
vector<int> c(n + 1), b;
for (int i = n; i >= 1; i--) {
int sum = 0;
int p = 2 * i;
while (p <= n) {
sum += c[p];
p += i;
}
int t = sum % 2;
if (t != a[i]) {
c[i] = 1;
b.emplace_back(i);
m++;
}
}
cout << m << endl;
if (m > 0) {
cout << b[0];
for (int i = 1; i < m; i++) {
cout << " " << b[i];
}
cout << endl;
}
return 0;
}
| [
"assignment.value.change",
"identifier.change"
] | 779,766 | 779,767 | u480806810 | cpp |
p02972 | #include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1},
Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
int n;
int a[200001];
void divisor(int n, int c[]) {
for (int i = 1; i * i <= n; i++)
if (n % i == 0) {
c[i]++;
if (i != n / i)
c[n / i]++;
}
return;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
cin >> n;
int c[n + 1];
for (int i = 1; i <= n; i++) {
cin >> a[i];
c[n] = 0;
}
vector<int> ans;
int count = 0;
for (int i = n; i >= 1; i--) {
if (a[i] != c[i] % 2) {
count++;
ans.push_back(i);
divisor(i, c);
}
}
sort(ALL(ans));
cout << count << "\n";
if (ans.size() != 0) {
for (int i = 0; i < ans.size(); i++) {
cout << ans[i] << " ";
}
cout << "\n";
}
} | #include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1},
Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
int n;
int a[200001];
void divisor(int n, int c[]) {
for (int i = 1; i * i <= n; i++)
if (n % i == 0) {
c[i]++;
if (i != n / i)
c[n / i]++;
}
return;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
cin >> n;
int c[n + 1];
for (int i = 1; i <= n; i++) {
cin >> a[i];
c[i] = 0;
}
vector<int> ans;
int count = 0;
for (int i = n; i >= 1; i--) {
if (a[i] != c[i] % 2) {
count++;
ans.push_back(i);
divisor(i, c);
}
}
sort(ALL(ans));
cout << count << "\n";
if (ans.size() != 0) {
for (int i = 0; i < ans.size(); i++) {
cout << ans[i] << " ";
}
cout << "\n";
}
} | [
"assignment.variable.change",
"identifier.change",
"variable_access.subscript.index.change"
] | 779,768 | 779,769 | u155416173 | cpp |
p02972 | #include <algorithm>
#include <cstring>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <unordered_map>
#include <vector>
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
inline int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
inline int lcm(int a, int b) { return a * b / gcd(a, b); }
typedef long long ll;
typedef std::vector<int> VI;
typedef std::pair<int, int> PII;
using namespace std;
int main() {
int N;
cin >> N;
vector<int> A(N + 1);
vector<int> B(N + 1, 0);
int count = 0;
REP(i, N + 1) cin >> A[i + 1];
for (int i = N - 1; i > 0; i--) {
int t = 0;
for (int j = i * 2; j < N; j += i) {
if (B[j])
t = 1 - t;
}
if (A[i] != t) {
B[i] = 1;
count++;
}
}
int count2 = 0;
printf("%d\n", count);
for (int i = 1; i < N + 1; i++) {
if (B[i]) {
count2++;
if (count2 == count) {
printf("%d\n", i);
} else {
printf("%d ", i);
}
}
}
return 0;
}
| #include <algorithm>
#include <cstring>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <unordered_map>
#include <vector>
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
inline int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
inline int lcm(int a, int b) { return a * b / gcd(a, b); }
typedef long long ll;
typedef std::vector<int> VI;
typedef std::pair<int, int> PII;
using namespace std;
int main() {
int N;
cin >> N;
vector<int> A(N + 1);
vector<int> B(N + 1, 0);
int count = 0;
REP(i, N + 1) cin >> A[i + 1];
for (int i = N; i > 0; i--) {
int t = 0;
for (int j = i * 2; j <= N; j += i) {
if (B[j])
t = 1 - t;
}
if (A[i] != t) {
B[i] = 1;
count++;
}
}
int count2 = 0;
printf("%d\n", count);
for (int i = 1; i < N + 1; i++) {
if (B[i]) {
count2++;
if (count2 == count) {
printf("%d\n", i);
} else {
printf("%d ", i);
}
}
}
return 0;
}
| [
"control_flow.loop.for.initializer.change",
"expression.operation.binary.remove",
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 779,778 | 779,779 | u450733728 | cpp |
p02972 | #include <bits/stdc++.h>
#define N 200005
#define debug(x) cout << #x << ":" << x << endl;
using namespace std;
int n, m;
bool res;
bool A[N], B[N];
int ans[N];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", &A[i]);
}
for (int i = n; i; i--) {
bool res = 0;
for (int j = i + i; j <= n; j += i)
if (B[i])
res ^= 1;
if (res ^ A[i])
ans[++m] = i, B[i] = 1;
}
printf("%d\n", m);
for (int i = m; i; i--)
printf("%d ", ans[i]);
return 0;
}
| #include <bits/stdc++.h>
#define N 200005
#define debug(x) cout << #x << ":" << x << endl;
using namespace std;
int n, m;
bool res;
bool A[N], B[N];
int ans[N];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", &A[i]);
}
for (int i = n; i; i--) {
bool res = 0;
for (int j = i + i; j <= n; j += i)
if (B[j])
res ^= 1;
if (res ^ A[i])
ans[++m] = i, B[i] = 1;
}
printf("%d\n", m);
for (int i = m; i; i--)
printf("%d ", ans[i]);
return 0;
}
| [
"identifier.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change"
] | 779,782 | 779,783 | u392797842 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
int a[200005];
int ans[200005];
int x;
int main() {
int n;
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", &a[i]);
}
for (int i = n; i >= 1; i--) {
int cnt = 0;
for (int j = 2; j * i <= n; j++) {
if (ans[i * j] == 1)
cnt++;
}
if (cnt % 2 != a[i]) {
ans[i] = 1;
x++;
}
}
printf("%d\n", x);
for (int i = 1; i <= n; i++) {
if (ans[i] == 1) {
printf("%d ");
}
}
printf("\n");
}
| #include <bits/stdc++.h>
using namespace std;
int a[200005];
int ans[200005];
int x;
int main() {
int n;
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", &a[i]);
}
for (int i = n; i >= 1; i--) {
int cnt = 0;
for (int j = 2; j * i <= n; j++) {
if (ans[i * j] == 1)
cnt++;
}
if (cnt % 2 != a[i]) {
ans[i] = 1;
x++;
}
}
printf("%d\n", x);
for (int i = 1; i <= n; i++) {
if (ans[i] == 1) {
printf("%d ", i);
}
}
printf("\n");
}
| [
"call.arguments.add"
] | 779,784 | 779,785 | u818518063 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
int main() {
long n;
cin >> n;
vector<long> a(n);
for (long i = 0; i < n; ++i) {
cin >> a[i];
}
vector<long> ans;
for (long i = n - 1; i >= n / 2 + 1; --i) {
ans.push_back(a[i]);
}
for (long i = n / 2; i >= 0; --i) {
long sum = 0;
for (long j = i + 1 + i + 1; j <= n; j += i + 1) {
sum += ans[j - 1];
}
ans.push_back((sum + a[i]) % 2);
}
long sum = accumulate(ans.begin(), ans.end(), 0L);
cout << sum << endl;
if (sum != 0) {
long last_1;
for (long i = n - 1; i >= 0; --i) {
if (ans[i] == 1) {
last_1 = i;
break;
}
}
for (long i = 0; i < last_1; ++i) {
if (ans[i] == 1) {
cout << n - i;
cout << ' ';
}
}
cout << n - last_1 << endl;
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long n;
cin >> n;
vector<long> a(n);
for (long i = 0; i < n; ++i) {
cin >> a[i];
}
vector<long> ans;
for (long i = n - 1; i >= n / 2 + 1; --i) {
ans.push_back(a[i]);
}
for (long i = n / 2; i >= 0; --i) {
long sum = 0;
for (long j = i + 1 + i + 1; j <= n; j += i + 1) {
sum += ans[n - j];
}
ans.push_back((sum + a[i]) % 2);
}
long sum = accumulate(ans.begin(), ans.end(), 0L);
cout << sum << endl;
if (sum != 0) {
long last_1;
for (long i = n - 1; i >= 0; --i) {
if (ans[i] == 1) {
last_1 = i;
break;
}
}
for (long i = 0; i < last_1; ++i) {
if (ans[i] == 1) {
cout << n - i;
cout << ' ';
}
}
cout << n - last_1 << endl;
}
return 0;
} | [
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change",
"expression.operation.binary.change",
"identifier.replace.add",
"literal.replace.remove"
] | 779,789 | 779,790 | u002386242 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
int main() {
long n;
cin >> n;
vector<long> a(n);
for (long i = 0; i < n; ++i) {
cin >> a[i];
}
vector<long> ans;
for (long i = n - 1; i >= n / 2 + 1; --i) {
ans.push_back(a[i]);
}
for (long i = n / 2; i >= 0; --i) {
long sum = 0;
for (long j = i + 1 + i + 1; j <= n; j += i + 1) {
sum += a[j - 1];
}
ans.push_back((sum + a[i]) % 2);
}
long sum = accumulate(ans.begin(), ans.end(), 0L);
cout << sum << endl;
if (sum != 0) {
long last_1;
for (long i = n - 1; i >= 0; --i) {
if (ans[i] == 1) {
last_1 = i;
break;
}
}
for (long i = 0; i < last_1; ++i) {
if (ans[i] == 1) {
cout << n - i;
cout << ' ';
}
}
cout << n - last_1 << endl;
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long n;
cin >> n;
vector<long> a(n);
for (long i = 0; i < n; ++i) {
cin >> a[i];
}
vector<long> ans;
for (long i = n - 1; i >= n / 2 + 1; --i) {
ans.push_back(a[i]);
}
for (long i = n / 2; i >= 0; --i) {
long sum = 0;
for (long j = i + 1 + i + 1; j <= n; j += i + 1) {
sum += ans[n - j];
}
ans.push_back((sum + a[i]) % 2);
}
long sum = accumulate(ans.begin(), ans.end(), 0L);
cout << sum << endl;
if (sum != 0) {
long last_1;
for (long i = n - 1; i >= 0; --i) {
if (ans[i] == 1) {
last_1 = i;
break;
}
}
for (long i = 0; i < last_1; ++i) {
if (ans[i] == 1) {
cout << n - i;
cout << ' ';
}
}
cout << n - last_1 << endl;
}
return 0;
} | [
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change",
"expression.operation.binary.change",
"identifier.replace.add",
"literal.replace.remove"
] | 779,791 | 779,790 | u002386242 | cpp |
p02972 | #include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
#define fi first
#define se second
#define pb push_back
#define pii pair<int, int>
#define ll long long
#define pll pair<ll, ll>
#define rep(i, from, to) for (int i = from; i < to; i++)
#define repd(i, from, till) for (int i = from; i >= till; i--)
#define waste \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL)
#define inf 1e9 + 1
#define mod 1e9 + 7
#define inf1 1e18 + 1
#define pie 3.14159265358979323846
#define N 100005
using namespace std;
int solve() {
int n;
cin >> n;
int a[n + 1], cnt = 0, ans[n + 1] = {0};
rep(i, 1, n + 1) cin >> a[i];
repd(i, n, 1) {
int p = i, t = a[i];
while (p <= n) {
p += i;
if (p > n)
break;
if (a[p] == 1 && t == 0)
t = 1;
else if (a[p] == 1 && t == 1)
t = 0;
}
if (t == 0)
ans[i] = 0;
else
ans[i] = 1;
if (ans[i] == 1)
cnt++;
}
cout << cnt << endl;
rep(i, 1, n + 1) if (ans[i] == 1) cout << i << " ";
return 0;
}
int main() {
waste;
int t;
// cin>>t;
t = 1;
while (t--) {
solve();
}
}
| #include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
#define fi first
#define se second
#define pb push_back
#define pii pair<int, int>
#define ll long long
#define pll pair<ll, ll>
#define rep(i, from, to) for (int i = from; i < to; i++)
#define repd(i, from, till) for (int i = from; i >= till; i--)
#define waste \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL)
#define inf 1e9 + 1
#define mod 1e9 + 7
#define inf1 1e18 + 1
#define pie 3.14159265358979323846
#define N 100005
using namespace std;
int solve() {
int n;
cin >> n;
int a[n + 1], cnt = 0, ans[n + 1] = {0};
rep(i, 1, n + 1) cin >> a[i];
repd(i, n, 1) {
int p = i, t = a[i];
while (p <= n) {
// cout<<i<<" "<<p<<" "<<t<<endl;
p += i;
if (p > n)
break;
if (ans[p] == 1 && t == 0)
t = 1;
else if (ans[p] == 1 && t == 1)
t = 0;
}
if (t == 0)
ans[i] = 0;
else
ans[i] = 1;
if (ans[i] == 1)
cnt++;
}
cout << cnt << endl;
rep(i, 1, n + 1) if (ans[i] == 1) cout << i << " ";
return 0;
}
int main() {
waste;
int t;
// cin>>t;
t = 1;
while (t--) {
solve();
}
}
| [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 779,795 | 779,796 | u352350187 | cpp |
p02972 | #include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
#define fi first
#define se second
#define pb push_back
#define pii pair<int, int>
#define ll long long
#define pll pair<ll, ll>
#define rep(i, from, to) for (int i = from; i < to; i++)
#define repd(i, from, till) for (int i = from; i >= till; i--)
#define waste \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL)
#define inf 1e9 + 1
#define mod 1e9 + 7
#define inf1 1e18 + 1
#define pie 3.14159265358979323846
#define N 100005
using namespace std;
int solve() {
int n;
cin >> n;
int a[n + 1], cnt = 0, ans[n + 1] = {0};
rep(i, 1, n + 1) cin >> a[i];
repd(i, n, 1) {
int p = i, t = a[i];
while (p <= n) {
p += i;
if (p < n)
break;
if (a[p] == 1 && t == 0)
t = 1;
else if (a[p] == 1 && t == 1)
t = 0;
}
if (t == 0)
ans[i] = 0;
else
ans[i] = 1;
if (ans[i] == 1)
cnt++;
// cout<<cnt<<endl;
}
cout << cnt << endl;
rep(i, 1, n + 1) if (ans[i] == 1) cout << i << " ";
return 0;
}
int main() {
waste;
int t;
// cin>>t;
t = 1;
while (t--) {
solve();
}
}
| #include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
#define fi first
#define se second
#define pb push_back
#define pii pair<int, int>
#define ll long long
#define pll pair<ll, ll>
#define rep(i, from, to) for (int i = from; i < to; i++)
#define repd(i, from, till) for (int i = from; i >= till; i--)
#define waste \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL)
#define inf 1e9 + 1
#define mod 1e9 + 7
#define inf1 1e18 + 1
#define pie 3.14159265358979323846
#define N 100005
using namespace std;
int solve() {
int n;
cin >> n;
int a[n + 1], cnt = 0, ans[n + 1] = {0};
rep(i, 1, n + 1) cin >> a[i];
repd(i, n, 1) {
int p = i, t = a[i];
while (p <= n) {
// cout<<i<<" "<<p<<" "<<t<<endl;
p += i;
if (p > n)
break;
if (ans[p] == 1 && t == 0)
t = 1;
else if (ans[p] == 1 && t == 1)
t = 0;
}
if (t == 0)
ans[i] = 0;
else
ans[i] = 1;
if (ans[i] == 1)
cnt++;
}
cout << cnt << endl;
rep(i, 1, n + 1) if (ans[i] == 1) cout << i << " ";
return 0;
}
int main() {
waste;
int t;
// cin>>t;
t = 1;
while (t--) {
solve();
}
}
| [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"identifier.change"
] | 779,797 | 779,796 | u352350187 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
#define int long long
int N, a[2 * 100000 + 10], M = 0, num[2 * 100000 + 10];
vector<int> ans;
signed main() {
cin >> N;
for (int i = 1; i <= N; i++)
cin >> a[i];
int i;
for (i = N; i >= N / 2 + 1; i--) {
if (a[i] == 0)
;
else {
M++;
ans.push_back(i);
num[i]++;
}
}
for (i = N / 2; i >= 1; i--) {
int j = 2;
int sum = 0;
while (i * j < N) {
sum += num[i * j];
j++;
}
if (sum % 2 == a[i])
;
else {
M++;
ans.push_back(i);
num[i]++;
}
}
cout << M << endl;
if (M == 0)
return 0;
for (int k = 0; k < ans.size() - 1; k++)
cout << ans[k] << " ";
cout << ans[ans.size() - 1] << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define int long long
int N, a[2 * 100000 + 10], M = 0, num[2 * 100000 + 10];
vector<int> ans;
signed main() {
cin >> N;
for (int i = 1; i <= N; i++)
cin >> a[i];
int i;
for (i = N; i >= N / 2 + 1; i--) {
if (a[i] == 0)
;
else {
M++;
ans.push_back(i);
num[i]++;
}
}
for (i = N / 2; i >= 1; i--) {
int j = 2;
int sum = 0;
while (i * j <= N) {
sum += num[i * j];
j++;
}
if (sum % 2 == a[i])
;
else {
M++;
ans.push_back(i);
num[i]++;
}
}
cout << M << endl;
if (M == 0)
return 0;
for (int k = 0; k < ans.size() - 1; k++)
cout << ans[k] << " ";
cout << ans[ans.size() - 1] << endl;
return 0;
}
| [
"expression.operator.compare.change",
"control_flow.loop.condition.change"
] | 779,800 | 779,801 | u577926181 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
#define int long long
int N, a[2 * 100000 + 10], M = 0, num[2 * 100000 + 10];
vector<int> ans;
signed main() {
cin >> N;
for (int i = 1; i <= N; i++)
cin >> a[i];
int i;
for (i = N; i >= N / 2 + 1; i--) {
if (a[i] == 0)
;
else {
M++;
ans.push_back(i);
num[i]++;
}
}
for (i = N / 2; i >= 1; i--) {
int j = 2;
int sum = 0;
while (i * j > N) {
sum += num[i * j];
j++;
}
if (sum % 2 == a[i])
;
else {
M++;
ans.push_back(i);
num[i]++;
}
}
cout << M << endl;
if (M == 0)
return 0;
for (int k = 0; k < ans.size() - 1; k++)
cout << ans[k] << " ";
cout << ans[ans.size() - 1] << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define int long long
int N, a[2 * 100000 + 10], M = 0, num[2 * 100000 + 10];
vector<int> ans;
signed main() {
cin >> N;
for (int i = 1; i <= N; i++)
cin >> a[i];
int i;
for (i = N; i >= N / 2 + 1; i--) {
if (a[i] == 0)
;
else {
M++;
ans.push_back(i);
num[i]++;
}
}
for (i = N / 2; i >= 1; i--) {
int j = 2;
int sum = 0;
while (i * j <= N) {
sum += num[i * j];
j++;
}
if (sum % 2 == a[i])
;
else {
M++;
ans.push_back(i);
num[i]++;
}
}
cout << M << endl;
if (M == 0)
return 0;
for (int k = 0; k < ans.size() - 1; k++)
cout << ans[k] << " ";
cout << ans[ans.size() - 1] << endl;
return 0;
}
| [
"expression.operator.compare.change",
"control_flow.loop.condition.change"
] | 779,802 | 779,801 | u577926181 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
#define int long long
int N, a[2 * 100000 + 10], M = 0, num[2 * 100000 + 10];
vector<int> ans;
signed main() {
cin >> N;
for (int i = 1; i <= N; i++)
cin >> a[i];
int i;
for (i = N; i >= N / 2 + 1; i--) {
if (a[i] == 0)
;
else {
M++;
ans.push_back(i);
num[i]++;
}
}
for (i = N / 2; i >= 1; i--) {
int j = 2;
int sum = 0;
while (i * j > N) {
sum += num[N / 2 * j];
j++;
}
if (sum % 2 == a[i])
;
else {
M++;
ans.push_back(i);
num[i]++;
}
}
cout << M << endl;
if (M == 0)
return 0;
for (int k = 0; k < ans.size() - 1; k++)
cout << ans[k] << " ";
cout << ans[ans.size() - 1] << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define int long long
int N, a[2 * 100000 + 10], M = 0, num[2 * 100000 + 10];
vector<int> ans;
signed main() {
cin >> N;
for (int i = 1; i <= N; i++)
cin >> a[i];
int i;
for (i = N; i >= N / 2 + 1; i--) {
if (a[i] == 0)
;
else {
M++;
ans.push_back(i);
num[i]++;
}
}
for (i = N / 2; i >= 1; i--) {
int j = 2;
int sum = 0;
while (i * j <= N) {
sum += num[i * j];
j++;
}
if (sum % 2 == a[i])
;
else {
M++;
ans.push_back(i);
num[i]++;
}
}
cout << M << endl;
if (M == 0)
return 0;
for (int k = 0; k < ans.size() - 1; k++)
cout << ans[k] << " ";
cout << ans[ans.size() - 1] << endl;
return 0;
}
| [
"expression.operator.compare.change",
"control_flow.loop.condition.change",
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change",
"expression.operation.binary.change",
"expression.operation.binary.remove"
] | 779,803 | 779,801 | u577926181 | cpp |
p02972 | #include <iostream>
using namespace std;
int a[200000];
int b[200000];
int main() {
int N, n;
cin >> N;
for (int i = 0; i < N; i++)
cin >> a[i];
for (int i = N - 1; i >= 0; i--) {
n = i + 1;
b[i] = a[i];
for (int j = 2; j * n <= N; j++) {
b[i] ^= a[j * n - 1];
}
}
n = 0;
for (int i = 0; i < N; i++)
n += b[i];
cout << n << endl;
if (n != 0) {
bool f = false;
for (int i = 0; i < N; i++) {
if (b[i]) {
if (f) {
cout << " ";
}
cout << i + 1;
f = true;
}
}
cout << endl;
}
return 0;
} | #include <iostream>
using namespace std;
int a[200000];
int b[200000];
int main() {
int N, n;
cin >> N;
for (int i = 0; i < N; i++)
cin >> a[i];
for (int i = N - 1; i >= 0; i--) {
n = i + 1;
b[i] = a[i];
for (int j = 2; j * n <= N; j++) {
b[i] ^= b[j * n - 1];
}
}
n = 0;
for (int i = 0; i < N; i++)
n += b[i];
cout << n << endl;
if (n != 0) {
bool f = false;
for (int i = 0; i < N; i++) {
if (b[i]) {
if (f) {
cout << " ";
}
cout << i + 1;
f = true;
}
}
cout << endl;
}
return 0;
} | [
"assignment.value.change",
"identifier.change"
] | 779,804 | 779,805 | u705230587 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
template <class T> using V = vector<T>;
template <class S, class T> using P = pair<S, T>;
using ll = long long;
using ull = unsigned long long;
using vll = V<ll>;
using vvll = V<vll>;
using vvvll = V<vvll>;
using pl = P<ll, ll>;
using vpl = V<pl>;
using vvpl = V<vpl>;
using vs = V<string>;
using qll = queue<ll>;
using qpl = queue<pl>;
using mapll = map<ll, ll>;
using setll = set<ll>;
using pqll = priority_queue<ll>;
#define int ll
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pob pop_back()
#define pf push_front
#define pof pop_front()
#define sz size()
#define bgn begin()
#define en end()
#define emp empty()
#define fr front()
#define bk back()
#define res resize
#define tp top()
#define p_q priority_queue
#define inv inverse()
#define FOR(i, a, b) for (ll i = (a); i <= (ll)(b); i++)
#define rFOR(i, a, b) for (ll i = (b); i >= (ll)(a); i--)
#define REP(i, a) FOR((i), 0, (ll)(a)-1)
#define REP0(i, a) FOR((i), 0, (ll)(a))
#define REP1(i, a) FOR((i), 1, (ll)(a))
#define rREP(i, a) rFOR((i), 0, (ll)(a)-1)
#define rREP0(i, a) rFOR((i), 0, (ll)(a))
#define rREP1(i, a) rFOR((i), 1, (ll)(a))
#define IOTA(a, n) iota((a).bgn, (a).en, (n))
#define SORT(a) sort((a).bgn, (a).en)
#define rSORT(a) sort((a).rbegin(), (a).rend())
#define UNIQUE(a) (a).erase(unique((a).bgn, (a).en), (a).en)
#define BINS(a, b) binary_search((a).bgn, (a).en, (b))
#define LOWB(a, b) (lower_bound((a).bgn, (a).en, (b)) - (a).bgn)
#define UPB(a, b) (upper_bound((a).bgn, (a).en, (b)) - (a).bgn)
#define CNT(a, b) count((a).bgn, (a).en, b)
#define SUM(a) accumulate((a).bgn, (a).en, 0)
#define REV(a) reverse((a).bgn, (a).en)
#define yn(a) cout << ((a) ? "yes" : "no") << "\n";
#define Yn(a) cout << ((a) ? "Yes" : "No") << "\n";
#define YN(a) cout << ((a) ? "YES" : "NO") << "\n";
#define imp(a) cout << ((a) ? "possible" : "impossible") << "\n";
#define Imp(a) cout << ((a) ? "Possible" : "Impossible") << "\n";
#define IMP(a) cout << ((a) ? "POSSIBLE" : "IMPOSSIBLE") << "\n";
#define dbg(a) cerr << (#a) << ": " << (a) << "\n";
#define DigN2(a) ((llabs(a) == 0) ? (1) : ((ll)(log2(double(llabs(a)))) + 1))
#define DigN10(a) ((llabs(a) == 0) ? (1) : ((ll)(log10(double(llabs(a)))) + 1))
#define Dig2(a, b) (((a) >> (b)) & 1)
#define Dig10(a, b) (ll)(((a) / ((ll)(pow(10.0, (double)(b))))) % 10)
#define Pow2(a) ((ll)(1) << (a))
#define Pow10(a) ((ll)(pow(10.0, double(a))))
#define powll(a, b) (ll)(pow((double)(a), (double)(b)))
#define li(...) \
ll __VA_ARGS__; \
Input(__VA_ARGS__);
#define si(...) \
string __VA_ARGS__; \
Input(__VA_ARGS__);
#define vli(size, ...) \
vll __VA_ARGS__; \
vInput(size, __VA_ARGS__);
#define vsi(size, ...) \
vs __VA_ARGS__; \
vInput(size, __VA_ARGS__);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
// const ll MOD = 924844033;
// const ll MOD = 9007199254740881;
const ll INF = 1LL << 60; // 1.15e18
const double PI = acos(-1.0);
const string alp = "abcdefghijklmnopqrstuvwxyz";
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
void Input() {}
template <class Var, class... Args> void Input(Var &var, Args &...args) {
cin >> var;
Input(args...);
}
void vInit(ll size) {}
template <class T, class... Args> void vInit(ll size, V<T> &v, Args &...args) {
v.res(size);
vInit(size, args...);
}
void vInputNum(ll num) {}
template <class T, class... Args>
void vInputNum(ll num, V<T> &v, Args &...args) {
cin >> v[num];
vInputNum(num, args...);
}
void vInput(ll size) {}
template <class... Args> void vInput(ll size, Args &...args) {
vInit(size, args...);
REP(i, size) vInputNum(i, args...);
}
template <class S, class T>
ostream &operator<<(ostream &out, const P<S, T> &p) {
return out << "[" << p.fi << ", " << p.se << "]";
}
template <class T> ostream &operator<<(ostream &out, V<T> &v) {
if (v.emp)
return out << "{}";
else {
auto itr = v.bgn;
out << "{" << *itr;
itr++;
while (itr != v.en) {
out << ", " << *itr;
itr++;
}
out << "}";
return out;
}
}
template <class S, class T>
ostream &operator<<(ostream &out, const map<S, T> &m) {
if (m.emp)
return out << "<[]>";
else {
auto itr = m.bgn;
out << "< [" << (itr->fi) << ": " << (itr->se);
itr++;
while (itr != m.en) {
out << "], [" << (itr->fi) << ": " << (itr->se);
itr++;
}
out << "] >";
return out;
}
}
template <class T> ostream &operator<<(ostream &out, const set<T> &s) {
if (s.emp)
return out << "<>";
else {
auto itr = s.bgn;
out << "<" << *itr;
itr++;
while (itr != s.en) {
out << ", " << *itr;
itr++;
}
out << ">";
return out;
}
}
ll gcd(ll a, ll b) {
if (a < b) {
a ^= b;
b ^= a;
a ^= b;
}
return b ? gcd(b, a % b) : a;
}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
struct UFT {
public:
ll tsize;
ll mode;
vll par;
vll rank;
UFT() {}
UFT(const UFT &uft) {}
UFT(ll tsizeget, ll modeget = 0) {
tsize = tsizeget;
mode = modeget;
par.assign(tsize, -1);
if (!mode)
rank.res(tsize, 0);
}
ll root(ll x) { return par[x] < 0 ? x : par[x] = root(par[x]); }
bool isRoot(ll x) { return x == root(x); }
bool same(ll x, ll y) { return root(x) == root(y); }
void merge(ll x, ll y) {
x = root(x);
y = root(y);
if (x == y)
return;
if (mode) {
par[x] += par[y];
par[y] = x;
} else {
if (rank[x] < rank[y]) {
par[y] += par[x];
par[x] = y;
} else {
par[x] += par[y];
par[y] = x;
if (rank[x] == rank[y])
rank[x]++;
}
}
}
ll size(ll x) { return -par[root(x)]; }
};
ll isP(ll n) {
if (n <= 1)
return 0;
FOR(i, 2, (ll)sqrt(n) + 1) {
if (n % i == 0)
return 0;
}
return 1;
}
vvll CombMemo(1000, vll(1000, -1));
ll Comb(ll n, ll k) {
if ((n < 0) || (k < 0))
return 0;
if (CombMemo[n][k] == -1) {
if (n < k)
CombMemo[n][k] = 0;
else {
if (n == 0)
CombMemo[n][k] = 1;
else if (k == 0)
CombMemo[n][k] = 1;
else if (n == k)
CombMemo[n][k] = 1;
else
CombMemo[n][k] = Comb(n - 1, k - 1) + Comb(n - 1, k);
}
}
return CombMemo[n][k];
}
void Solve();
signed main() {
cin.tie(0);
ios::sync_with_stdio(false);
cout << setprecision(20) << fixed;
Solve();
}
void Solve() {
li(n);
vli(n, a);
vll r(n, 0);
rREP1(i, n) {
rFOR(j, 2, n / i) {
// if (i==3) cout << j*i;
r[i - 1] += r[j * i];
}
r[i - 1] += a[i - 1];
r[i - 1] %= 2;
}
// return;
ll c = 0;
REP(i, n) {
if (r[i])
c++;
}
cout << c << endl;
REP(i, n) {
if (r[i])
cout << i + 1 << " ";
}
}
| #include <bits/stdc++.h>
using namespace std;
template <class T> using V = vector<T>;
template <class S, class T> using P = pair<S, T>;
using ll = long long;
using ull = unsigned long long;
using vll = V<ll>;
using vvll = V<vll>;
using vvvll = V<vvll>;
using pl = P<ll, ll>;
using vpl = V<pl>;
using vvpl = V<vpl>;
using vs = V<string>;
using qll = queue<ll>;
using qpl = queue<pl>;
using mapll = map<ll, ll>;
using setll = set<ll>;
using pqll = priority_queue<ll>;
#define int ll
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pob pop_back()
#define pf push_front
#define pof pop_front()
#define sz size()
#define bgn begin()
#define en end()
#define emp empty()
#define fr front()
#define bk back()
#define res resize
#define tp top()
#define p_q priority_queue
#define inv inverse()
#define FOR(i, a, b) for (ll i = (a); i <= (ll)(b); i++)
#define rFOR(i, a, b) for (ll i = (b); i >= (ll)(a); i--)
#define REP(i, a) FOR((i), 0, (ll)(a)-1)
#define REP0(i, a) FOR((i), 0, (ll)(a))
#define REP1(i, a) FOR((i), 1, (ll)(a))
#define rREP(i, a) rFOR((i), 0, (ll)(a)-1)
#define rREP0(i, a) rFOR((i), 0, (ll)(a))
#define rREP1(i, a) rFOR((i), 1, (ll)(a))
#define IOTA(a, n) iota((a).bgn, (a).en, (n))
#define SORT(a) sort((a).bgn, (a).en)
#define rSORT(a) sort((a).rbegin(), (a).rend())
#define UNIQUE(a) (a).erase(unique((a).bgn, (a).en), (a).en)
#define BINS(a, b) binary_search((a).bgn, (a).en, (b))
#define LOWB(a, b) (lower_bound((a).bgn, (a).en, (b)) - (a).bgn)
#define UPB(a, b) (upper_bound((a).bgn, (a).en, (b)) - (a).bgn)
#define CNT(a, b) count((a).bgn, (a).en, b)
#define SUM(a) accumulate((a).bgn, (a).en, 0)
#define REV(a) reverse((a).bgn, (a).en)
#define yn(a) cout << ((a) ? "yes" : "no") << "\n";
#define Yn(a) cout << ((a) ? "Yes" : "No") << "\n";
#define YN(a) cout << ((a) ? "YES" : "NO") << "\n";
#define imp(a) cout << ((a) ? "possible" : "impossible") << "\n";
#define Imp(a) cout << ((a) ? "Possible" : "Impossible") << "\n";
#define IMP(a) cout << ((a) ? "POSSIBLE" : "IMPOSSIBLE") << "\n";
#define dbg(a) cerr << (#a) << ": " << (a) << "\n";
#define DigN2(a) ((llabs(a) == 0) ? (1) : ((ll)(log2(double(llabs(a)))) + 1))
#define DigN10(a) ((llabs(a) == 0) ? (1) : ((ll)(log10(double(llabs(a)))) + 1))
#define Dig2(a, b) (((a) >> (b)) & 1)
#define Dig10(a, b) (ll)(((a) / ((ll)(pow(10.0, (double)(b))))) % 10)
#define Pow2(a) ((ll)(1) << (a))
#define Pow10(a) ((ll)(pow(10.0, double(a))))
#define powll(a, b) (ll)(pow((double)(a), (double)(b)))
#define li(...) \
ll __VA_ARGS__; \
Input(__VA_ARGS__);
#define si(...) \
string __VA_ARGS__; \
Input(__VA_ARGS__);
#define vli(size, ...) \
vll __VA_ARGS__; \
vInput(size, __VA_ARGS__);
#define vsi(size, ...) \
vs __VA_ARGS__; \
vInput(size, __VA_ARGS__);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
// const ll MOD = 924844033;
// const ll MOD = 9007199254740881;
const ll INF = 1LL << 60; // 1.15e18
const double PI = acos(-1.0);
const string alp = "abcdefghijklmnopqrstuvwxyz";
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
void Input() {}
template <class Var, class... Args> void Input(Var &var, Args &...args) {
cin >> var;
Input(args...);
}
void vInit(ll size) {}
template <class T, class... Args> void vInit(ll size, V<T> &v, Args &...args) {
v.res(size);
vInit(size, args...);
}
void vInputNum(ll num) {}
template <class T, class... Args>
void vInputNum(ll num, V<T> &v, Args &...args) {
cin >> v[num];
vInputNum(num, args...);
}
void vInput(ll size) {}
template <class... Args> void vInput(ll size, Args &...args) {
vInit(size, args...);
REP(i, size) vInputNum(i, args...);
}
template <class S, class T>
ostream &operator<<(ostream &out, const P<S, T> &p) {
return out << "[" << p.fi << ", " << p.se << "]";
}
template <class T> ostream &operator<<(ostream &out, V<T> &v) {
if (v.emp)
return out << "{}";
else {
auto itr = v.bgn;
out << "{" << *itr;
itr++;
while (itr != v.en) {
out << ", " << *itr;
itr++;
}
out << "}";
return out;
}
}
template <class S, class T>
ostream &operator<<(ostream &out, const map<S, T> &m) {
if (m.emp)
return out << "<[]>";
else {
auto itr = m.bgn;
out << "< [" << (itr->fi) << ": " << (itr->se);
itr++;
while (itr != m.en) {
out << "], [" << (itr->fi) << ": " << (itr->se);
itr++;
}
out << "] >";
return out;
}
}
template <class T> ostream &operator<<(ostream &out, const set<T> &s) {
if (s.emp)
return out << "<>";
else {
auto itr = s.bgn;
out << "<" << *itr;
itr++;
while (itr != s.en) {
out << ", " << *itr;
itr++;
}
out << ">";
return out;
}
}
ll gcd(ll a, ll b) {
if (a < b) {
a ^= b;
b ^= a;
a ^= b;
}
return b ? gcd(b, a % b) : a;
}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
struct UFT {
public:
ll tsize;
ll mode;
vll par;
vll rank;
UFT() {}
UFT(const UFT &uft) {}
UFT(ll tsizeget, ll modeget = 0) {
tsize = tsizeget;
mode = modeget;
par.assign(tsize, -1);
if (!mode)
rank.res(tsize, 0);
}
ll root(ll x) { return par[x] < 0 ? x : par[x] = root(par[x]); }
bool isRoot(ll x) { return x == root(x); }
bool same(ll x, ll y) { return root(x) == root(y); }
void merge(ll x, ll y) {
x = root(x);
y = root(y);
if (x == y)
return;
if (mode) {
par[x] += par[y];
par[y] = x;
} else {
if (rank[x] < rank[y]) {
par[y] += par[x];
par[x] = y;
} else {
par[x] += par[y];
par[y] = x;
if (rank[x] == rank[y])
rank[x]++;
}
}
}
ll size(ll x) { return -par[root(x)]; }
};
ll isP(ll n) {
if (n <= 1)
return 0;
FOR(i, 2, (ll)sqrt(n) + 1) {
if (n % i == 0)
return 0;
}
return 1;
}
vvll CombMemo(1000, vll(1000, -1));
ll Comb(ll n, ll k) {
if ((n < 0) || (k < 0))
return 0;
if (CombMemo[n][k] == -1) {
if (n < k)
CombMemo[n][k] = 0;
else {
if (n == 0)
CombMemo[n][k] = 1;
else if (k == 0)
CombMemo[n][k] = 1;
else if (n == k)
CombMemo[n][k] = 1;
else
CombMemo[n][k] = Comb(n - 1, k - 1) + Comb(n - 1, k);
}
}
return CombMemo[n][k];
}
void Solve();
signed main() {
cin.tie(0);
ios::sync_with_stdio(false);
cout << setprecision(20) << fixed;
Solve();
}
void Solve() {
li(n);
vli(n, a);
vll r(n, 0);
rREP1(i, n) {
rFOR(j, 2, n / i) {
r[i - 1] += r[j * i - 1];
// if (i==3) cout << r[i-1] << " ";
}
r[i - 1] += a[i - 1];
r[i - 1] %= 2;
}
// cout <<
// return;
ll c = 0;
REP(i, n) {
if (r[i])
c++;
}
cout << c << endl;
REP(i, n) {
if (r[i])
cout << i + 1 << " ";
}
}
| [
"assignment.change"
] | 779,808 | 779,809 | u172929647 | cpp |
p02972 | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pii pair<int, int>
#define all(x) (x).begin(), (x).end()
#define forn(i, n) for (int i = 0; i < (int)(n); i++)
#define for1(i, n) for (int i = 1; i <= (int)(n); i++)
#define debug(x) cout << '>' << #x << ':' << x << endl;
const int MOD = 1e9 + 7;
int mpow(int a, int b, int p = MOD) {
a = a % p;
int res = 1;
while (b > 0) {
if (b & 1)
res = (res * a) % p;
a = (a * a) % p;
b = b >> 1;
}
return res % p;
}
typedef tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
int a[n + 1];
for (int i = 1; i <= n; i++)
cin >> a[i];
int an[n + 1];
for (int i = 1; i <= n; i++)
an[i] = 0;
for (int i = n; i >= 1; i--) {
int cnt = 0;
for (int j = i; j <= n; j += i) {
cnt += an[i];
}
if (cnt % 2 != a[i]) {
an[i] ^= 1;
}
}
for (int i = 1; i <= n; i++) {
int cnt = 0;
for (int j = i; j <= n; j += i) {
cnt += an[i];
}
if (cnt % 2 != a[i]) {
cout << "-1";
return 0;
}
}
vector<int> ans;
for (int i = 1; i <= n; i++) {
if (an[i] == 1)
ans.pb(i);
}
cout << ans.size() << "\n";
for (auto x : ans)
cout << x << " ";
}
// I never lose. I either win or I learn | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pii pair<int, int>
#define all(x) (x).begin(), (x).end()
#define forn(i, n) for (int i = 0; i < (int)(n); i++)
#define for1(i, n) for (int i = 1; i <= (int)(n); i++)
#define debug(x) cout << '>' << #x << ':' << x << endl;
const int MOD = 1e9 + 7;
int mpow(int a, int b, int p = MOD) {
a = a % p;
int res = 1;
while (b > 0) {
if (b & 1)
res = (res * a) % p;
a = (a * a) % p;
b = b >> 1;
}
return res % p;
}
typedef tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
int a[n + 1];
for (int i = 1; i <= n; i++)
cin >> a[i];
int an[n + 1];
for (int i = 1; i <= n; i++)
an[i] = 0;
for (int i = n; i >= 1; i--) {
int cnt = 0;
for (int j = i; j <= n; j += i) {
cnt += an[j];
}
if (cnt % 2 != a[i]) {
// cout<<i<<" "<<cnt<<"\n";
an[i] ^= 1;
}
}
// for(int i=1;i<=n;i++) cout<<an[i]<<" ";
for (int i = 1; i <= n; i++) {
int cnt = 0;
for (int j = i; j <= n; j += i) {
cnt += an[j];
}
if (cnt % 2 != a[i]) {
// assert(false);
cout << "-1";
return 0;
}
}
vector<int> ans;
for (int i = 1; i <= n; i++) {
if (an[i] == 1)
ans.pb(i);
}
cout << ans.size() << "\n";
for (auto x : ans)
cout << x << " ";
}
/*
4
0 1 0 1
1 0 0 1
*/
// I never lose. I either win or I learn | [
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change"
] | 779,810 | 779,811 | u862316882 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
int Ai;
vector<int> A;
vector<int> dp(N, 0);
for (int i = 0; i < N; i++) {
cin >> Ai;
A.push_back(Ai);
}
for (int i = N - 1; i >= 0; i--) {
int tmp = 0;
for (int j = 2; (i + 1) * j < N; j++) {
if (dp[(i + 1) * j - 1])
tmp ^= 1;
}
dp[i] = (A[i] ^ tmp);
}
vector<int> res;
for (int i = 0; i < N; i++) {
if (dp[i])
res.push_back(i);
}
cout << res.size() << endl;
for (auto v : res)
cout << (v + 1) << " ";
if (res.size() > 0)
cout << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
int Ai;
vector<int> A;
vector<int> dp(N, 0);
for (int i = 0; i < N; i++) {
cin >> Ai;
A.push_back(Ai);
}
for (int i = N - 1; i >= 0; i--) {
int tmp = 0;
for (int j = 2; (i + 1) * j <= N; j++) {
if (dp[(i + 1) * j - 1])
tmp ^= 1;
}
dp[i] = (A[i] ^ tmp);
}
vector<int> res;
for (int i = 0; i < N; i++) {
if (dp[i])
res.push_back(i);
}
cout << res.size() << endl;
for (auto v : res)
cout << (v + 1) << " ";
if (res.size() > 0)
cout << endl;
return 0;
} | [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 779,819 | 779,820 | u235057691 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m = 0;
cin >> n;
vector<int> a(n), b(n);
for (int i = 0; i < n; i++)
cin >> a.at(i);
for (int i = n - 1; i >= 0; i--) {
b.at(i) = (a.at(i) + b.at(i)) % 2;
m += b.at(i);
if (b.at(i) == 0)
continue;
for (int j = 1; j * j <= i + 1 && j <= i; j++) {
if ((i + 1) % j == 0) {
b.at(j - 1)++;
if (j > 1 && j * j < i + 1) {
b.at((i + 1) / j - 1)++;
}
}
}
}
int balls = 0;
cout << m << endl;
if (m == 0)
return 0;
for (int i = 0; i < n - 1; i++) {
if (b.at(i) == 1) {
cout << i + 1;
balls++;
if (balls == m) {
cout << endl;
} else {
cout << " ";
}
}
}
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m = 0;
cin >> n;
vector<int> a(n), b(n);
for (int i = 0; i < n; i++)
cin >> a.at(i);
for (int i = n - 1; i >= 0; i--) {
b.at(i) = (a.at(i) + b.at(i)) % 2;
m += b.at(i);
if (b.at(i) == 0)
continue;
for (int j = 1; j * j <= i + 1 && j <= i; j++) {
if ((i + 1) % j == 0) {
b.at(j - 1)++;
if (j > 1 && j * j < i + 1) {
b.at((i + 1) / j - 1)++;
}
}
}
}
int balls = 0;
cout << m << endl;
if (m == 0)
return 0;
for (int i = 0; i < n; i++) {
if (b.at(i) == 1) {
cout << i + 1;
balls++;
if (balls == m) {
cout << endl;
} else {
cout << " ";
}
}
}
}
| [
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove"
] | 779,821 | 779,822 | u697658632 | cpp |
p02972 | #include <iostream>
#include <vector>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; ++i)
cin >> a[i];
vector<int> il(n + 1);
int odp = 0;
for (int i = n; i >= 1; --i) {
int ile = 0;
for (int j = 2 * i; j <= n; j += i)
ile += il[j];
if (ile % 2 == 0) {
if (a[i - 1] == 0)
il[i] = 0;
else {
il[i] = 1;
++odp;
}
} else {
if (a[i - 1] == 1)
il[i] = 0;
else {
il[i] = 1;
++odp;
}
}
}
cout << odp << endl;
for (int i = 1; i < n; ++i)
if (il[i] == 1)
cout << i << " ";
return 0;
}
| #include <iostream>
#include <vector>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; ++i)
cin >> a[i];
vector<int> il(n + 1);
int odp = 0;
for (int i = n; i >= 1; --i) {
int ile = 0;
for (int j = 2 * i; j <= n; j += i)
ile += il[j];
if (ile % 2 == 0) {
if (a[i - 1] == 0)
il[i] = 0;
else {
il[i] = 1;
++odp;
}
} else {
if (a[i - 1] == 1)
il[i] = 0;
else {
il[i] = 1;
++odp;
}
}
}
cout << odp << endl;
for (int i = 1; i <= n; ++i)
if (il[i] == 1)
cout << i << " ";
return 0;
}
| [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 779,823 | 779,824 | u535773602 | cpp |
p02972 | #include <iostream>
#include <vector>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; ++i)
cin >> a[i];
vector<int> il(n + 1);
int odp = 0;
for (int i = n; i >= 1; --i) {
int ile = 0;
for (int j = 2 * i; j <= n; j += i)
ile += il[j];
if (ile % 2 == 0) {
if (a[i - 1] == 0)
il[i] = 0;
else {
il[i] = 1;
++odp;
}
} else {
if (a[i - 1] == 1)
il[i] = 0;
else {
il[i] = 1;
++odp;
}
}
}
cout << odp << endl;
for (int i = 0; i < n; ++i)
if (il[i] == 1)
cout << i << " ";
return 0;
}
| #include <iostream>
#include <vector>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; ++i)
cin >> a[i];
vector<int> il(n + 1);
int odp = 0;
for (int i = n; i >= 1; --i) {
int ile = 0;
for (int j = 2 * i; j <= n; j += i)
ile += il[j];
if (ile % 2 == 0) {
if (a[i - 1] == 0)
il[i] = 0;
else {
il[i] = 1;
++odp;
}
} else {
if (a[i - 1] == 1)
il[i] = 0;
else {
il[i] = 1;
++odp;
}
}
}
cout << odp << endl;
for (int i = 1; i <= n; ++i)
if (il[i] == 1)
cout << 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"
] | 779,825 | 779,824 | u535773602 | cpp |
p02972 | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n + 1);
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
vector<int> b(n + 1);
int count = 0;
for (int i = n; i >= 1; i--) {
int total = 0;
for (int j = i + i; j <= n; j += i) {
total += a[j];
}
b[i] = (total + a[i]) % 2;
if (b[i] == 1)
count++;
}
cout << count << endl;
for (int i = 1; i <= n; i++) {
if (b[i] == 1)
cout << i << " ";
}
if (count > 0) {
cout << endl;
}
return 0;
} | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n + 1);
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
vector<int> b(n + 1);
int count = 0;
for (int i = n; i >= 1; i--) {
int total = 0;
for (int j = i + i; j <= n; j += i) {
total += b[j];
}
b[i] = (a[i] + total) % 2;
if (b[i] == 1)
count++;
}
cout << count << endl;
for (int i = 1; i <= n; i++) {
if (b[i] == 1)
cout << i << " ";
}
if (count > 0) {
cout << endl;
}
return 0;
} | [
"assignment.value.change",
"identifier.change",
"expression.operation.binary.remove",
"assignment.change"
] | 779,826 | 779,827 | u389009751 | cpp |
p02972 | #include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
int main(void) {
// Your code here!
long long n;
vector<long long> x;
cin >> n;
for (long long i = 0; i < n; i++) {
long long temp;
cin >> temp;
x.push_back(temp);
}
long long output_count = 0;
vector<long long> output(n, 0);
for (long long i = n; 1 <= i; i--) {
long long temp = 2;
vector<long long> r;
while (i * temp <= n) {
r.push_back(i * temp);
temp++;
}
long long count = 0;
for (auto j : r)
count += x[j - 1];
output[i - 1] = x[i - 1] ^ (count % 2);
output_count += output[i - 1];
}
cout << output_count << endl;
for (long long i = 0; i < n; i++)
if (output[i] == 1)
cout << i + 1 << ' ';
return 0;
}
| #include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
int main(void) {
// Your code here!
long long n;
vector<long long> x;
cin >> n;
for (long long i = 0; i < n; i++) {
long long temp;
cin >> temp;
x.push_back(temp);
}
long long output_count = 0;
vector<long long> output(n, 0);
for (long long i = n; 1 <= i; i--) {
long long temp = 2;
vector<long long> r;
while (i * temp <= n) {
r.push_back(i * temp);
temp++;
}
long long count = 0;
for (auto j : r)
count += output[j - 1];
output[i - 1] = x[i - 1] ^ (count % 2);
output_count += output[i - 1];
}
cout << output_count << endl;
for (long long i = 0; i < n; i++)
if (output[i] == 1)
cout << i + 1 << ' ';
return 0;
}
| [
"assignment.value.change",
"identifier.change"
] | 779,830 | 779,831 | u528005130 | cpp |
p02972 | #include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
int main(void) {
// Your code here!
long long n;
vector<long long> x;
cin >> n;
for (long long i = 0; i < n; i++) {
long long temp;
cin >> temp;
x.push_back(temp);
}
long long output_count = 0;
vector<long long> output(n, 0);
for (long long i = n; 1 <= i; i--) {
long long temp = 2;
vector<long long> r;
while (i * temp <= n) {
r.push_back(i * temp);
temp++;
}
long long count = 0;
for (auto j : r)
count += x[j - 1];
output[i - 1] = x[i - 1] ^ (count % 2);
output_count += output[i - 1];
}
cout << output_count << endl;
for (long long i = 0; i < n; i++)
if (output[i] == 1)
cout << output[i] << ' ';
return 0;
}
| #include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
int main(void) {
// Your code here!
long long n;
vector<long long> x;
cin >> n;
for (long long i = 0; i < n; i++) {
long long temp;
cin >> temp;
x.push_back(temp);
}
long long output_count = 0;
vector<long long> output(n, 0);
for (long long i = n; 1 <= i; i--) {
long long temp = 2;
vector<long long> r;
while (i * temp <= n) {
r.push_back(i * temp);
temp++;
}
long long count = 0;
for (auto j : r)
count += output[j - 1];
output[i - 1] = x[i - 1] ^ (count % 2);
output_count += output[i - 1];
}
cout << output_count << endl;
for (long long i = 0; i < n; i++)
if (output[i] == 1)
cout << i + 1 << ' ';
return 0;
}
| [
"assignment.value.change",
"identifier.change",
"io.output.change"
] | 779,832 | 779,831 | u528005130 | cpp |
p02972 | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <time.h>
#include <tuple>
#include <vector>
//#include "bits/stdc++.h"
using namespace std;
// using namespace std::vector;
#define rep(i, a, b) for (ll i = (a); i < (b); ++i)
//#define M_PI 3.1415926535
#define huge 1000000007
typedef long long int ll;
ll gcd(ll a, ll b);
ll lcm(ll x, ll y);
ll bur(ll N, ll X);
long long comb(int n, int r);
bool IsPrime(int num);
bool dp[110][10010];
class UnionFind;
// UF木
class UnionFind {
public:
//親
vector<int> Parent;
//初期状態
UnionFind(int N) { Parent = vector<int>(N, -1); }
int root(int A) {
if (Parent[A] < 0)
return A;
return Parent[A] = root(Parent[A]);
}
//サイズ確認
int size(int A) { return -Parent[root(A)]; }
int connect(int A, int B) {
// root同氏をくっつける
A = root(A);
B = root(B);
//結合済み
if (A == B) {
return false;
}
//大きいほうに小さいほうをくっつける
if (size(A) < size(B))
swap(A, B);
// Aのサイズ更新
Parent[A] += Parent[B];
// Bの親をAに
Parent[B] = A;
return true;
}
};
int main(void) {
int N = 0;
ll A = 0;
ll B = 0;
ll C = 0;
ll D = 0;
ll E = 0;
ll W = 0;
ll H = 0;
// ll T = 0;
// ll M = 0;
// ll h[400][400] = {};
ll b[9] = {1, 7, 4, 5, 3, 2, 9, 6, 8}; //順番の配列
// ll b2[9] = { 2,3,4,5,5,5,6,6,7 };//順番の配列
// ll aa[20][20] = {};//sortaf
// ll c2[9] = {};
ll d[10] = {}; //要素数
// ll v[3] = {};
// ll *c, *s, *n;
string S, T, U[52];
char fi[50], fv[50];
ll count = 0;
double count2 = 0;
ll min = 3000;
ll max = 1;
ll dist1 = 0;
ll dist2 = 0;
ll dist3 = 0;
ll now = 0;
int tmax = 10000;
int tmax2 = 0;
// int flag = 0;
// char temp, head, state;
// int is = 0;
bool start = false;
// char p;
float all = 0, all2 = 0, all3 = 0;
ll amr = 0;
ll first = 0;
ll second = 0;
// ll keep = 0;
// ll head = 0;
// ll tail = 0;
// ll lgh = 10000;
// ll state = 0;
char col = NULL;
// ll aa[3] = {10000,10000,10000}, bb[3] = { 10000,10000,10000 }, cc[3] = {
// 10000,10000,10000 }; ll an[3] = { 10000,10000,10000 }, bn[3] = {
// 10000,10000,10000 }, cn[3] = { 10000,10000,10000 };
cin >> N;
// vector<ll> mo(A+1);
vector<ll> dam(N + 1);
vector<ll> dam2(N);
rep(i, 0, N) { cin >> dam[i + 1]; }
for (int i = N; i > 0; --i) {
amr = i;
while (amr + i <= N) {
amr += i;
if (dam2[amr] == 1)
first++;
}
if (first % 2 != dam[i]) {
dam2[i] = 1;
dist1++;
} else
dam2[i] = 0;
// cout << first << " " << dam[i] <<endl;
first = 0;
}
cout << dist1 << endl;
if (dist1 == 0)
return 0;
rep(i, 1, N + 1) {
if (dam2[i] == 1) {
cout << i << " ";
}
}
cout << endl;
// cout << first << " " << second << endl;
// cout << min << endl;
/*if (amr % count == 0)
cout << "Yes" << endl;
else
cout << "No" << endl;*/
return 0;
}
ll bur(ll N, ll X) {
ll pan = 1;
ll pat = 1;
ll burg = 0;
if (X > burg) {
if (N == 0)
return pat;
burg += pan;
burg += bur(N - 1, X);
burg += pat;
burg += bur(N - 1, X);
burg += pan;
}
return burg;
}
ll gcd(ll a, ll b) {
/* 自然数 a > b を確認・入替 */
if (a < b) {
ll tmp = a;
a = b;
b = tmp;
}
ll x = b;
ll y = a;
/* ユークリッドの互除法 */
ll r = a % b;
while (r != 0) {
a = b;
b = r;
r = a % b;
}
return y / b * x;
}
bool IsPrime(int num) {
if (num < 2)
return false;
else if (num == 2)
return true;
else if (num % 2 == 0)
return false; // 偶数はあらかじめ除く
double sqrtNum = sqrt(num);
for (int i = 3; i <= sqrtNum; i += 2) {
if (num % i == 0) {
// 素数ではない
return false;
}
}
// 素数である
return true;
}
// 最大公約数を求める関数
ll lcm(ll x, ll y) {
if (x == 0 || y == 0) // 引数チェック
{
// fprintf(stderr, "引数エラーです。\n");
return 0;
}
return (x * y / gcd(x, y));
}
// combination
long long comb(int n, int r) {
std::vector<std::vector<long long>> v(n + 1,
std::vector<long long>(n + 1, 0));
for (int i = 0; i < v.size(); i++) {
v[i][0] = 1;
v[i][i] = 1;
}
for (int j = 1; j < v.size(); j++) {
for (int k = 1; k < j; k++) {
v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
}
}
return v[n][r];
} | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <time.h>
#include <tuple>
#include <vector>
//#include "bits/stdc++.h"
using namespace std;
// using namespace std::vector;
#define rep(i, a, b) for (ll i = (a); i < (b); ++i)
//#define M_PI 3.1415926535
#define huge 1000000007
typedef long long int ll;
ll gcd(ll a, ll b);
ll lcm(ll x, ll y);
ll bur(ll N, ll X);
long long comb(int n, int r);
bool IsPrime(int num);
bool dp[110][10010];
class UnionFind;
// UF木
class UnionFind {
public:
//親
vector<int> Parent;
//初期状態
UnionFind(int N) { Parent = vector<int>(N, -1); }
int root(int A) {
if (Parent[A] < 0)
return A;
return Parent[A] = root(Parent[A]);
}
//サイズ確認
int size(int A) { return -Parent[root(A)]; }
int connect(int A, int B) {
// root同氏をくっつける
A = root(A);
B = root(B);
//結合済み
if (A == B) {
return false;
}
//大きいほうに小さいほうをくっつける
if (size(A) < size(B))
swap(A, B);
// Aのサイズ更新
Parent[A] += Parent[B];
// Bの親をAに
Parent[B] = A;
return true;
}
};
int main(void) {
int N = 0;
ll A = 0;
ll B = 0;
ll C = 0;
ll D = 0;
ll E = 0;
ll W = 0;
ll H = 0;
// ll T = 0;
// ll M = 0;
// ll h[400][400] = {};
ll b[9] = {1, 7, 4, 5, 3, 2, 9, 6, 8}; //順番の配列
// ll b2[9] = { 2,3,4,5,5,5,6,6,7 };//順番の配列
// ll aa[20][20] = {};//sortaf
// ll c2[9] = {};
ll d[10] = {}; //要素数
// ll v[3] = {};
// ll *c, *s, *n;
string S, T, U[52];
char fi[50], fv[50];
ll count = 0;
double count2 = 0;
ll min = 3000;
ll max = 1;
ll dist1 = 0;
ll dist2 = 0;
ll dist3 = 0;
ll now = 0;
int tmax = 10000;
int tmax2 = 0;
// int flag = 0;
// char temp, head, state;
// int is = 0;
bool start = false;
// char p;
float all = 0, all2 = 0, all3 = 0;
ll amr = 0;
ll first = 0;
ll second = 0;
// ll keep = 0;
// ll head = 0;
// ll tail = 0;
// ll lgh = 10000;
// ll state = 0;
char col = NULL;
// ll aa[3] = {10000,10000,10000}, bb[3] = { 10000,10000,10000 }, cc[3] = {
// 10000,10000,10000 }; ll an[3] = { 10000,10000,10000 }, bn[3] = {
// 10000,10000,10000 }, cn[3] = { 10000,10000,10000 };
cin >> N;
// vector<ll> mo(A+1);
vector<ll> dam(N + 1);
vector<ll> dam2(N + 1);
rep(i, 0, N) { cin >> dam[i + 1]; }
for (int i = N; i > 0; --i) {
amr = i;
while (amr + i <= N) {
amr += i;
if (dam2[amr] == 1)
first++;
}
if (first % 2 != dam[i]) {
dam2[i] = 1;
dist1++;
} else
dam2[i] = 0;
// cout << first << " " << dam[i] <<endl;
first = 0;
}
cout << dist1 << endl;
if (dist1 == 0)
return 0;
rep(i, 1, N + 1) {
if (dam2[i] == 1) {
cout << i << " ";
}
}
cout << endl;
// cout << first << " " << second << endl;
// cout << min << endl;
/*if (amr % count == 0)
cout << "Yes" << endl;
else
cout << "No" << endl;*/
return 0;
}
ll bur(ll N, ll X) {
ll pan = 1;
ll pat = 1;
ll burg = 0;
if (X > burg) {
if (N == 0)
return pat;
burg += pan;
burg += bur(N - 1, X);
burg += pat;
burg += bur(N - 1, X);
burg += pan;
}
return burg;
}
ll gcd(ll a, ll b) {
/* 自然数 a > b を確認・入替 */
if (a < b) {
ll tmp = a;
a = b;
b = tmp;
}
ll x = b;
ll y = a;
/* ユークリッドの互除法 */
ll r = a % b;
while (r != 0) {
a = b;
b = r;
r = a % b;
}
return y / b * x;
}
bool IsPrime(int num) {
if (num < 2)
return false;
else if (num == 2)
return true;
else if (num % 2 == 0)
return false; // 偶数はあらかじめ除く
double sqrtNum = sqrt(num);
for (int i = 3; i <= sqrtNum; i += 2) {
if (num % i == 0) {
// 素数ではない
return false;
}
}
// 素数である
return true;
}
// 最大公約数を求める関数
ll lcm(ll x, ll y) {
if (x == 0 || y == 0) // 引数チェック
{
// fprintf(stderr, "引数エラーです。\n");
return 0;
}
return (x * y / gcd(x, y));
}
// combination
long long comb(int n, int r) {
std::vector<std::vector<long long>> v(n + 1,
std::vector<long long>(n + 1, 0));
for (int i = 0; i < v.size(); i++) {
v[i][0] = 1;
v[i][i] = 1;
}
for (int j = 1; j < v.size(); j++) {
for (int k = 1; k < j; k++) {
v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
}
}
return v[n][r];
} | [
"assignment.change"
] | 779,840 | 779,841 | u301409936 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
using lli = int_fast64_t;
using ulli = uint_fast64_t;
#define debug(x) cerr << #x << " : " << x << endl
#define debugv(x) \
cerr << #x << " : {"; \
for (auto value_of_x : x) { \
cerr << value_of_x << ", "; \
} \
cerr << endl
#define debugst(x) \
auto xt = x; \
cerr << #x << " : {"; \
for (int i = 0; i < x.size(); i++) { \
cerr << xt.top() << ", "; \
xt.pop(); \
} \
cerr << endl
#define debugvp(x) \
cerr << #x << " : {"; \
for (auto value_of_x : x) { \
cerr << value_of_x.first << " : " << value_of_x.second << ", "; \
} \
cerr << endl
const lli MOD = 1000000007;
const lli LIMIT = 1000000000000000000 * 5;
const int tenfive = 100000;
int main() {
int N;
cin >> N;
vector<int> v(N + 1);
for (int i = 0; i < N; i++) {
cin >> v[i + 1];
}
vector<int> ball(N + 1, 0);
vector<bool> ans(N + 1, false);
int counter = 0;
for (int i = N; i > 0; i--) {
if (ball[i] % 2 != v[i]) {
ball[i]++;
ans[i] = true;
counter++;
for (int j = 1; j * j < i; j++) {
if (i % j == 0) {
ball[j]++;
if (j != 1 && j * j != i) {
ball[i / j]++;
}
}
}
}
}
cout << counter << endl;
for (int i = 1; i <= N; i++) {
if (ans[i]) {
cout << i;
counter--;
if (counter == 0) {
cout << endl;
break;
} else {
cout << " ";
}
}
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
using lli = int_fast64_t;
using ulli = uint_fast64_t;
#define debug(x) cerr << #x << " : " << x << endl
#define debugv(x) \
cerr << #x << " : {"; \
for (auto value_of_x : x) { \
cerr << value_of_x << ", "; \
} \
cerr << endl
#define debugst(x) \
auto xt = x; \
cerr << #x << " : {"; \
for (int i = 0; i < x.size(); i++) { \
cerr << xt.top() << ", "; \
xt.pop(); \
} \
cerr << endl
#define debugvp(x) \
cerr << #x << " : {"; \
for (auto value_of_x : x) { \
cerr << value_of_x.first << " : " << value_of_x.second << ", "; \
} \
cerr << endl
const lli MOD = 1000000007;
const lli LIMIT = 1000000000000000000 * 5;
const int tenfive = 100000;
int main() {
int N;
cin >> N;
vector<int> v(N + 1);
for (int i = 0; i < N; i++) {
cin >> v[i + 1];
}
vector<int> ball(N + 1, 0);
vector<bool> ans(N + 1, false);
int counter = 0;
for (int i = N; i > 0; i--) {
if (ball[i] % 2 != v[i]) {
ball[i]++;
ans[i] = true;
counter++;
for (int j = 1; j * j <= i; j++) {
if (i % j == 0) {
ball[j]++;
if (j != 1 && j * j != i) {
ball[i / j]++;
}
}
}
}
}
cout << counter << endl;
for (int i = 1; i <= N; i++) {
if (ans[i]) {
cout << i;
counter--;
if (counter == 0) {
cout << endl;
break;
} else {
cout << " ";
}
}
}
return 0;
}
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 779,842 | 779,843 | u031593168 | cpp |
p02972 | #include <iostream>
using namespace std;
long long head[200001];
long long save[200001][1000];
int main() {
long long N;
long long a[200001];
long long b[200001];
long long size = 0;
cin >> N;
for (int i = 1; i <= N; i++)
cin >> a[i];
for (int i = 1; i <= N; i++) {
for (int j = 2; i * j <= N; j++) {
save[i * j][head[i * j]] = i;
head[i * j]++;
}
}
for (int i = N; i >= 1; i--) {
b[i] = a[i];
if (b[i] == 1)
size++;
for (int jh = 0; jh < head[i]; jh++) {
a[save[i][jh]] ^= b[i];
}
}
cout << size << endl;
for (int i = 1; i <= N; i++) {
if (b[i] == 1) {
cout << i;
size--;
if (size > 0)
cout << " ";
else
cout << endl;
}
}
return 0;
}
| #include <iostream>
using namespace std;
int head[200001];
int save[200001][200];
int main() {
long long N;
long long a[200001];
long long b[200001];
long long size = 0;
cin >> N;
for (int i = 1; i <= N; i++)
cin >> a[i];
for (int i = 1; i <= N; i++) {
for (int j = 2; i * j <= N; j++) {
save[i * j][head[i * j]] = i;
head[i * j]++;
}
}
for (int i = N; i >= 1; i--) {
b[i] = a[i];
if (b[i] == 1)
size++;
for (int jh = 0; jh < head[i]; jh++) {
a[save[i][jh]] ^= b[i];
}
}
cout << size << endl;
for (int i = 1; i <= N; i++) {
if (b[i] == 1) {
cout << i;
size--;
if (size > 0)
cout << " ";
else
cout << endl;
}
}
return 0;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.narrow.change",
"literal.number.change",
"variable_declaration.array_dimensions.change"
] | 779,844 | 779,845 | u721980697 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define f(i, x, n) for (int i = x; i < n; i++)
#define all(c) c.begin(), c.end()
#define print(x) cerr << (#x) << "is " << x << "\n"
using ll = long long;
using pii = pair<int, int>;
const int MOD = 1e9 + 7, N = 2e5 + 10;
ll sum[N], a[N];
vector<ll> factor[N];
int32_t main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
f(i, 1, n + 1) { cin >> a[i]; }
vector<int> res;
f(i, 1, n + 1) {
for (int j = i; j <= n; j++) {
factor[j].pb(i);
}
}
// f(i,1,n+1){
// for(auto &el : factor[i]){
// cout << el << " ";
// }
// cout << "\n";
// }
for (int i = n; i >= 1; i--) {
if (sum[i] % 2 != a[i] % 2) {
res.pb(i);
for (auto &el : factor[i]) {
sum[el]++;
}
}
}
f(i, 1, n + 1) {
if (sum[i] % 2 != a[i] % 2) {
cout << "-1\n";
return 0;
}
}
sort(all(res));
cout << (int)res.size() << '\n';
for (auto &el : res) {
cout << el << ' ';
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define f(i, x, n) for (int i = x; i < n; i++)
#define all(c) c.begin(), c.end()
#define print(x) cerr << (#x) << "is " << x << "\n"
using ll = long long;
using pii = pair<int, int>;
const int MOD = 1e9 + 7, N = 2e5 + 10;
ll sum[N], a[N];
vector<ll> factor[N];
int32_t main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
f(i, 1, n + 1) { cin >> a[i]; }
vector<int> res;
f(i, 1, n + 1) {
for (int j = i; j <= n; j += i) {
factor[j].pb(i);
}
}
// f(i,1,n+1){
// for(auto &el : factor[i]){
// cout << el << " ";
// }
// cout << "\n";
// }
for (int i = n; i >= 1; i--) {
if (sum[i] % 2 != a[i] % 2) {
res.pb(i);
for (auto &el : factor[i]) {
sum[el]++;
}
}
}
f(i, 1, n + 1) {
if (sum[i] % 2 != a[i] % 2) {
cout << "-1\n";
return 0;
}
}
sort(all(res));
cout << (int)res.size() << '\n';
for (auto &el : res) {
cout << el << ' ';
}
return 0;
} | [] | 779,848 | 779,849 | u194208056 | cpp |
p02972 | #include <algorithm>
#include <chrono>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
using lli = long long int;
using Vint = std::vector<int>;
using Vlli = std::vector<lli>;
using Wint = std::vector<Vint>;
using Wlli = std::vector<Vlli>;
using Vbool = std::vector<bool>;
using Wbool = std::vector<Vbool>;
using pii = std::pair<int, int>;
using pll = std::pair<lli, lli>;
template <class T> using Vec = std::vector<T>;
template <class T> using Wec = Vec<Vec<T>>;
constexpr int MOD = 1e9 + 7;
constexpr int INFi = 2e9 + 1;
constexpr lli INFl = (lli)(9e18) + 1;
const std::vector<std::pair<int, int>> DXDY = {
{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
constexpr char BR = '\n';
#define DEBUG(x) std::cerr << #x << " = " << x << '\n';
#define FOR(i, a, b) for (int(i) = (a); (i) < (b); ++(i))
#define FOReq(i, a, b) for (int(i) = (a); (i) <= (b); ++(i))
#define rFOR(i, a, b) for (int(i) = (b); (i) >= (a); --(i))
#define FORstep(i, a, b, step) for (int(i) = (a); i < (b); i += (step))
#define REP(i, n) FOR(i, 0, n)
#define rREP(i, n) rFOR(i, 0, (n - 1))
#define vREP(ele, vec) for (auto &(ele) : (vec))
#define vREPcopy(ele, vec) for (auto(ele) : (vec))
#define SORT(A) std::sort((A).begin(), (A).end())
#define RSORT(A) std::sort((A).rbegin(), (A).rend())
#define ALL(A) (A).begin(), (A).end()
// 座標圧縮 (for vector) : ソートしてから使うのが一般的 ; SORT(A) =>
// COORDINATE_COMPRESSION(A)
#define COORDINATE_COMPRESSION(A) \
(A).erase(unique((A).begin(), (A).end()), (A).end())
template <class T> inline int argmin(std::vector<T> &vec) {
return min_element(vec.begin(), vec.end()) - vec.begin();
}
template <class T> inline int argmax(std::vector<T> &vec) {
return max_element(vec.begin(), vec.end()) - vec.begin();
}
template <class S, class T> inline void chmax(S &a, T b) {
if (a < b)
a = b;
}
template <class S, class T> inline void chmin(S &a, T b) {
if (a > b)
a = b;
}
template <class T> inline void reverseSORT(Vec<T> &Array) {
std::sort(Array.begin(), Array.end(), std::greater<T>());
}
inline int BitI(int k) { return 1 << k; }
inline lli BitL(int k) { return 1LL << k; }
inline void putsDouble(double d) { printf("%.16lf\n", d); }
template <class T> inline std::string toString(T n) {
if (n == 0)
return "0";
std::string res;
if (n < 0) {
n = -n;
while (n != 0) {
res += (char)(n % 10 + '0');
n /= 10;
}
std::reverse(res.begin(), res.end());
return '-' + res;
}
while (n != 0) {
res += (char)(n % 10 + '0');
n /= 10;
}
std::reverse(res.begin(), res.end());
return res;
}
namespace MyFunc {
using LLi = long long int;
using ULLi = unsigned long long int;
// GCD(a, b) ; a, bの最大公約数を求める関数
inline LLi gcd(LLi a, LLi b) {
while (b != 0) {
a %= b;
std::swap(a, b);
}
return a;
}
// LCM(a, b) ; a, bの最小公倍数を求める関数
inline LLi lcm(LLi a, LLi b) { return (a * b) / MyFunc::gcd(a, b); }
// 累乗を求める関数
inline LLi power(LLi a, LLi n) {
LLi res = 1LL, waiting = a;
while (n != 0LL) {
if ((n & 1LL) != 0LL)
res *= waiting;
waiting *= waiting;
n >>= 1;
}
return res;
}
// 累乗の余りを求める関数
inline LLi power_mod(LLi a, LLi n, LLi mod_number___ = 1e9 + 7) {
LLi res = 1LL, waiting = a;
while (n != 0LL) {
if ((n & 1LL) != 0LL) {
res *= waiting;
res %= mod_number___;
}
waiting *= waiting;
waiting %= mod_number___;
n >>= 1;
}
return res;
}
// Z/pZ上の逆元を求める関数 (フェルマーの小定理)
inline LLi inverse_mod(LLi a, LLi mod_number___ = 1e9 + 7) {
return MyFunc::power_mod(a, mod_number___ - 2);
}
inline LLi inverse_mod_euclid(LLi a, LLi mod_number___ = 1e9 + 7) {
LLi b = mod_number___, u = 1, v = 0;
while (b != 0) {
LLi t = a / b;
a -= t * b;
std::swap(a, b);
u -= t * v;
std::swap(u, v);
}
u %= mod_number___;
if (u < 0)
u += mod_number___;
return u;
}
// 素数であるかを判定する関数
template <typename Integer_type> inline bool isPrime(Integer_type n) {
if (n < 2)
return false;
if (n == 2)
return true;
if (n % 2 == 0)
return false;
for (Integer_type x = 3; x * x <= n; ++++x)
if (n % x == 0)
return false;
return true;
}
// 素数であるかの真偽表を返す : n ≥ 1
inline std::vector<bool> primeTable(int n) {
std::vector<bool> res(n + 1, true);
res[0] = false;
res[1] = false;
for (int x = 2; x * x <= n; ++x)
if (res[x]) {
for (int i = 2 * x; i <= n; i += x) {
res[i] = false;
}
}
return std::move(res);
}
// 素因数分解したベクトルを返す ; {素因数, 指数}
template <typename Integer_type>
inline std::vector<std::pair<Integer_type, int>>
prime_factorization(Integer_type n) {
std::vector<std::pair<Integer_type, int>> res(0);
if (n <= 0)
return std::move(res); // 例外処理 : nが 0 以下
if (n % 2 == 0) {
n /= 2;
int cnt = 1;
while (n % 2 == 0) {
n /= 2;
cnt++;
}
res.emplace_back(make_pair(2, cnt));
}
Integer_type x = 3;
while (x * x <= n) {
if (n % x == 0) {
n /= x;
int cnt = 1;
while (n % x == 0) {
n /= x;
cnt++;
}
res.emplace_back(make_pair(x, cnt));
}
++++x;
}
if (n > 1)
res.emplace_back(make_pair(n, 1));
return std::move(res);
}
// unsigned long 符号なし64bit整数で平方数かを判定する関数 O(log(N))
inline bool is_square_unsigned(ULLi n) {
// 0 は 平方数
if (n == 0)
return true;
// 平方数の可能性としては 2^32 - 1 が最大 : (2^32)^2 - 1
static ULLi MAX_LONG_SQRT__ = (1UL << 32) - 1;
if (MAX_LONG_SQRT__ * MAX_LONG_SQRT__ < n)
return false;
if (MAX_LONG_SQRT__ * MAX_LONG_SQRT__ == n)
return true;
// 二分探索
ULLi smaller = 0, bigger = MAX_LONG_SQRT__;
while (bigger - smaller > 1) {
ULLi m = (smaller + bigger) >> 1;
if (m * m == n)
return true;
if (m * m < n)
smaller = m;
else
bigger = m;
}
return false;
}
// 符号付き64bit整数で平方数か判定する関数
inline bool is_square(LLi n) {
if (n < 0)
return false;
// 平方数を4で割った余りは 0 か 1 に限る
if ((n & 0b11) > 0b01)
return false;
return is_square_unsigned(n);
}
} // namespace MyFunc
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Vint A, B;
Vbool Done;
int n;
int solve(int k) {
if (Done[k])
return B[k];
for (int x = 2 * k; x <= n; x += k)
B[k] += solve(x);
Done[k] = false;
return B[k] %= 2;
}
int main(void) {
scanf("%d", &n);
A.resize(n + 1);
REP(i, n) scanf("%d", &A[i + 1]);
Done.resize(n + 1, true);
B = A;
solve(1);
std::queue<int> Q;
REP(i, n) if (B[i + 1] == 1) { Q.push(i + 1); }
printf("%lu\n", Q.size());
while (not Q.empty()) {
printf("%d", Q.front());
Q.pop();
putchar(Q.empty() ? '\n' : ' ');
}
return 0;
} | #include <algorithm>
#include <chrono>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
using lli = long long int;
using Vint = std::vector<int>;
using Vlli = std::vector<lli>;
using Wint = std::vector<Vint>;
using Wlli = std::vector<Vlli>;
using Vbool = std::vector<bool>;
using Wbool = std::vector<Vbool>;
using pii = std::pair<int, int>;
using pll = std::pair<lli, lli>;
template <class T> using Vec = std::vector<T>;
template <class T> using Wec = Vec<Vec<T>>;
constexpr int MOD = 1e9 + 7;
constexpr int INFi = 2e9 + 1;
constexpr lli INFl = (lli)(9e18) + 1;
const std::vector<std::pair<int, int>> DXDY = {
{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
constexpr char BR = '\n';
#define DEBUG(x) std::cerr << #x << " = " << x << '\n';
#define FOR(i, a, b) for (int(i) = (a); (i) < (b); ++(i))
#define FOReq(i, a, b) for (int(i) = (a); (i) <= (b); ++(i))
#define rFOR(i, a, b) for (int(i) = (b); (i) >= (a); --(i))
#define FORstep(i, a, b, step) for (int(i) = (a); i < (b); i += (step))
#define REP(i, n) FOR(i, 0, n)
#define rREP(i, n) rFOR(i, 0, (n - 1))
#define vREP(ele, vec) for (auto &(ele) : (vec))
#define vREPcopy(ele, vec) for (auto(ele) : (vec))
#define SORT(A) std::sort((A).begin(), (A).end())
#define RSORT(A) std::sort((A).rbegin(), (A).rend())
#define ALL(A) (A).begin(), (A).end()
// 座標圧縮 (for vector) : ソートしてから使うのが一般的 ; SORT(A) =>
// COORDINATE_COMPRESSION(A)
#define COORDINATE_COMPRESSION(A) \
(A).erase(unique((A).begin(), (A).end()), (A).end())
template <class T> inline int argmin(std::vector<T> &vec) {
return min_element(vec.begin(), vec.end()) - vec.begin();
}
template <class T> inline int argmax(std::vector<T> &vec) {
return max_element(vec.begin(), vec.end()) - vec.begin();
}
template <class S, class T> inline void chmax(S &a, T b) {
if (a < b)
a = b;
}
template <class S, class T> inline void chmin(S &a, T b) {
if (a > b)
a = b;
}
template <class T> inline void reverseSORT(Vec<T> &Array) {
std::sort(Array.begin(), Array.end(), std::greater<T>());
}
inline int BitI(int k) { return 1 << k; }
inline lli BitL(int k) { return 1LL << k; }
inline void putsDouble(double d) { printf("%.16lf\n", d); }
template <class T> inline std::string toString(T n) {
if (n == 0)
return "0";
std::string res;
if (n < 0) {
n = -n;
while (n != 0) {
res += (char)(n % 10 + '0');
n /= 10;
}
std::reverse(res.begin(), res.end());
return '-' + res;
}
while (n != 0) {
res += (char)(n % 10 + '0');
n /= 10;
}
std::reverse(res.begin(), res.end());
return res;
}
namespace MyFunc {
using LLi = long long int;
using ULLi = unsigned long long int;
// GCD(a, b) ; a, bの最大公約数を求める関数
inline LLi gcd(LLi a, LLi b) {
while (b != 0) {
a %= b;
std::swap(a, b);
}
return a;
}
// LCM(a, b) ; a, bの最小公倍数を求める関数
inline LLi lcm(LLi a, LLi b) { return (a * b) / MyFunc::gcd(a, b); }
// 累乗を求める関数
inline LLi power(LLi a, LLi n) {
LLi res = 1LL, waiting = a;
while (n != 0LL) {
if ((n & 1LL) != 0LL)
res *= waiting;
waiting *= waiting;
n >>= 1;
}
return res;
}
// 累乗の余りを求める関数
inline LLi power_mod(LLi a, LLi n, LLi mod_number___ = 1e9 + 7) {
LLi res = 1LL, waiting = a;
while (n != 0LL) {
if ((n & 1LL) != 0LL) {
res *= waiting;
res %= mod_number___;
}
waiting *= waiting;
waiting %= mod_number___;
n >>= 1;
}
return res;
}
// Z/pZ上の逆元を求める関数 (フェルマーの小定理)
inline LLi inverse_mod(LLi a, LLi mod_number___ = 1e9 + 7) {
return MyFunc::power_mod(a, mod_number___ - 2);
}
inline LLi inverse_mod_euclid(LLi a, LLi mod_number___ = 1e9 + 7) {
LLi b = mod_number___, u = 1, v = 0;
while (b != 0) {
LLi t = a / b;
a -= t * b;
std::swap(a, b);
u -= t * v;
std::swap(u, v);
}
u %= mod_number___;
if (u < 0)
u += mod_number___;
return u;
}
// 素数であるかを判定する関数
template <typename Integer_type> inline bool isPrime(Integer_type n) {
if (n < 2)
return false;
if (n == 2)
return true;
if (n % 2 == 0)
return false;
for (Integer_type x = 3; x * x <= n; ++++x)
if (n % x == 0)
return false;
return true;
}
// 素数であるかの真偽表を返す : n ≥ 1
inline std::vector<bool> primeTable(int n) {
std::vector<bool> res(n + 1, true);
res[0] = false;
res[1] = false;
for (int x = 2; x * x <= n; ++x)
if (res[x]) {
for (int i = 2 * x; i <= n; i += x) {
res[i] = false;
}
}
return std::move(res);
}
// 素因数分解したベクトルを返す ; {素因数, 指数}
template <typename Integer_type>
inline std::vector<std::pair<Integer_type, int>>
prime_factorization(Integer_type n) {
std::vector<std::pair<Integer_type, int>> res(0);
if (n <= 0)
return std::move(res); // 例外処理 : nが 0 以下
if (n % 2 == 0) {
n /= 2;
int cnt = 1;
while (n % 2 == 0) {
n /= 2;
cnt++;
}
res.emplace_back(make_pair(2, cnt));
}
Integer_type x = 3;
while (x * x <= n) {
if (n % x == 0) {
n /= x;
int cnt = 1;
while (n % x == 0) {
n /= x;
cnt++;
}
res.emplace_back(make_pair(x, cnt));
}
++++x;
}
if (n > 1)
res.emplace_back(make_pair(n, 1));
return std::move(res);
}
// unsigned long 符号なし64bit整数で平方数かを判定する関数 O(log(N))
inline bool is_square_unsigned(ULLi n) {
// 0 は 平方数
if (n == 0)
return true;
// 平方数の可能性としては 2^32 - 1 が最大 : (2^32)^2 - 1
static ULLi MAX_LONG_SQRT__ = (1UL << 32) - 1;
if (MAX_LONG_SQRT__ * MAX_LONG_SQRT__ < n)
return false;
if (MAX_LONG_SQRT__ * MAX_LONG_SQRT__ == n)
return true;
// 二分探索
ULLi smaller = 0, bigger = MAX_LONG_SQRT__;
while (bigger - smaller > 1) {
ULLi m = (smaller + bigger) >> 1;
if (m * m == n)
return true;
if (m * m < n)
smaller = m;
else
bigger = m;
}
return false;
}
// 符号付き64bit整数で平方数か判定する関数
inline bool is_square(LLi n) {
if (n < 0)
return false;
// 平方数を4で割った余りは 0 か 1 に限る
if ((n & 0b11) > 0b01)
return false;
return is_square_unsigned(n);
}
} // namespace MyFunc
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Vint A, B;
Vbool Done;
int n;
int solve(int k) {
if (not Done[k])
return B[k];
for (int x = 2 * k; x <= n; x += k)
B[k] += solve(x);
Done[k] = false;
return B[k] %= 2;
}
int main(void) {
scanf("%d", &n);
A.resize(n + 1);
REP(i, n) scanf("%d", &A[i + 1]);
Done.resize(n + 1, true);
B = A;
solve(1);
std::queue<int> Q;
REP(i, n) if (B[i + 1] == 1) { Q.push(i + 1); }
printf("%lu\n", Q.size());
while (not Q.empty()) {
printf("%d", Q.front());
Q.pop();
putchar(Q.empty() ? '\n' : ' ');
}
return 0;
} | [
"control_flow.branch.if.condition.change"
] | 779,850 | 779,851 | u394853232 | cpp |
p02972 | #include <algorithm>
#include <chrono>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
using lli = long long int;
using Vint = std::vector<int>;
using Vlli = std::vector<lli>;
using Wint = std::vector<Vint>;
using Wlli = std::vector<Vlli>;
using Vbool = std::vector<bool>;
using Wbool = std::vector<Vbool>;
using pii = std::pair<int, int>;
using pll = std::pair<lli, lli>;
template <class T> using Vec = std::vector<T>;
template <class T> using Wec = Vec<Vec<T>>;
constexpr int MOD = 1e9 + 7;
constexpr int INFi = 2e9 + 1;
constexpr lli INFl = (lli)(9e18) + 1;
const std::vector<std::pair<int, int>> DXDY = {
{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
constexpr char BR = '\n';
#define DEBUG(x) std::cerr << #x << " = " << x << '\n';
#define FOR(i, a, b) for (int(i) = (a); (i) < (b); ++(i))
#define FOReq(i, a, b) for (int(i) = (a); (i) <= (b); ++(i))
#define rFOR(i, a, b) for (int(i) = (b); (i) >= (a); --(i))
#define FORstep(i, a, b, step) for (int(i) = (a); i < (b); i += (step))
#define REP(i, n) FOR(i, 0, n)
#define rREP(i, n) rFOR(i, 0, (n - 1))
#define vREP(ele, vec) for (auto &(ele) : (vec))
#define vREPcopy(ele, vec) for (auto(ele) : (vec))
#define SORT(A) std::sort((A).begin(), (A).end())
#define RSORT(A) std::sort((A).rbegin(), (A).rend())
#define ALL(A) (A).begin(), (A).end()
// 座標圧縮 (for vector) : ソートしてから使うのが一般的 ; SORT(A) =>
// COORDINATE_COMPRESSION(A)
#define COORDINATE_COMPRESSION(A) \
(A).erase(unique((A).begin(), (A).end()), (A).end())
template <class T> inline int argmin(std::vector<T> &vec) {
return min_element(vec.begin(), vec.end()) - vec.begin();
}
template <class T> inline int argmax(std::vector<T> &vec) {
return max_element(vec.begin(), vec.end()) - vec.begin();
}
template <class S, class T> inline void chmax(S &a, T b) {
if (a < b)
a = b;
}
template <class S, class T> inline void chmin(S &a, T b) {
if (a > b)
a = b;
}
template <class T> inline void reverseSORT(Vec<T> &Array) {
std::sort(Array.begin(), Array.end(), std::greater<T>());
}
inline int BitI(int k) { return 1 << k; }
inline lli BitL(int k) { return 1LL << k; }
inline void putsDouble(double d) { printf("%.16lf\n", d); }
template <class T> inline std::string toString(T n) {
if (n == 0)
return "0";
std::string res;
if (n < 0) {
n = -n;
while (n != 0) {
res += (char)(n % 10 + '0');
n /= 10;
}
std::reverse(res.begin(), res.end());
return '-' + res;
}
while (n != 0) {
res += (char)(n % 10 + '0');
n /= 10;
}
std::reverse(res.begin(), res.end());
return res;
}
namespace MyFunc {
using LLi = long long int;
using ULLi = unsigned long long int;
// GCD(a, b) ; a, bの最大公約数を求める関数
inline LLi gcd(LLi a, LLi b) {
while (b != 0) {
a %= b;
std::swap(a, b);
}
return a;
}
// LCM(a, b) ; a, bの最小公倍数を求める関数
inline LLi lcm(LLi a, LLi b) { return (a * b) / MyFunc::gcd(a, b); }
// 累乗を求める関数
inline LLi power(LLi a, LLi n) {
LLi res = 1LL, waiting = a;
while (n != 0LL) {
if ((n & 1LL) != 0LL)
res *= waiting;
waiting *= waiting;
n >>= 1;
}
return res;
}
// 累乗の余りを求める関数
inline LLi power_mod(LLi a, LLi n, LLi mod_number___ = 1e9 + 7) {
LLi res = 1LL, waiting = a;
while (n != 0LL) {
if ((n & 1LL) != 0LL) {
res *= waiting;
res %= mod_number___;
}
waiting *= waiting;
waiting %= mod_number___;
n >>= 1;
}
return res;
}
// Z/pZ上の逆元を求める関数 (フェルマーの小定理)
inline LLi inverse_mod(LLi a, LLi mod_number___ = 1e9 + 7) {
return MyFunc::power_mod(a, mod_number___ - 2);
}
inline LLi inverse_mod_euclid(LLi a, LLi mod_number___ = 1e9 + 7) {
LLi b = mod_number___, u = 1, v = 0;
while (b != 0) {
LLi t = a / b;
a -= t * b;
std::swap(a, b);
u -= t * v;
std::swap(u, v);
}
u %= mod_number___;
if (u < 0)
u += mod_number___;
return u;
}
// 素数であるかを判定する関数
template <typename Integer_type> inline bool isPrime(Integer_type n) {
if (n < 2)
return false;
if (n == 2)
return true;
if (n % 2 == 0)
return false;
for (Integer_type x = 3; x * x <= n; ++++x)
if (n % x == 0)
return false;
return true;
}
// 素数であるかの真偽表を返す : n ≥ 1
inline std::vector<bool> primeTable(int n) {
std::vector<bool> res(n + 1, true);
res[0] = false;
res[1] = false;
for (int x = 2; x * x <= n; ++x)
if (res[x]) {
for (int i = 2 * x; i <= n; i += x) {
res[i] = false;
}
}
return std::move(res);
}
// 素因数分解したベクトルを返す ; {素因数, 指数}
template <typename Integer_type>
inline std::vector<std::pair<Integer_type, int>>
prime_factorization(Integer_type n) {
std::vector<std::pair<Integer_type, int>> res(0);
if (n <= 0)
return std::move(res); // 例外処理 : nが 0 以下
if (n % 2 == 0) {
n /= 2;
int cnt = 1;
while (n % 2 == 0) {
n /= 2;
cnt++;
}
res.emplace_back(make_pair(2, cnt));
}
Integer_type x = 3;
while (x * x <= n) {
if (n % x == 0) {
n /= x;
int cnt = 1;
while (n % x == 0) {
n /= x;
cnt++;
}
res.emplace_back(make_pair(x, cnt));
}
++++x;
}
if (n > 1)
res.emplace_back(make_pair(n, 1));
return std::move(res);
}
// unsigned long 符号なし64bit整数で平方数かを判定する関数 O(log(N))
inline bool is_square_unsigned(ULLi n) {
// 0 は 平方数
if (n == 0)
return true;
// 平方数の可能性としては 2^32 - 1 が最大 : (2^32)^2 - 1
static ULLi MAX_LONG_SQRT__ = (1UL << 32) - 1;
if (MAX_LONG_SQRT__ * MAX_LONG_SQRT__ < n)
return false;
if (MAX_LONG_SQRT__ * MAX_LONG_SQRT__ == n)
return true;
// 二分探索
ULLi smaller = 0, bigger = MAX_LONG_SQRT__;
while (bigger - smaller > 1) {
ULLi m = (smaller + bigger) >> 1;
if (m * m == n)
return true;
if (m * m < n)
smaller = m;
else
bigger = m;
}
return false;
}
// 符号付き64bit整数で平方数か判定する関数
inline bool is_square(LLi n) {
if (n < 0)
return false;
// 平方数を4で割った余りは 0 か 1 に限る
if ((n & 0b11) > 0b01)
return false;
return is_square_unsigned(n);
}
} // namespace MyFunc
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Vint A, B;
Vbool Done;
int n;
int solve(int k) {
if (Done[k])
return B[k];
for (int x = 2 * k; k <= n; k += x)
B[k] += solve(x);
Done[k] = false;
return B[k] %= 2;
}
int main(void) {
scanf("%d", &n);
A.resize(n + 1);
REP(i, n) scanf("%d", &A[i + 1]);
Done.resize(n + 1, true);
B = A;
solve(1);
std::queue<int> Q;
REP(i, n) if (B[i + 1] == 1) { Q.push(i + 1); }
printf("%lu\n", Q.size());
while (not Q.empty()) {
printf("%d", Q.front());
Q.pop();
putchar(Q.empty() ? '\n' : ' ');
}
return 0;
} | #include <algorithm>
#include <chrono>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
using lli = long long int;
using Vint = std::vector<int>;
using Vlli = std::vector<lli>;
using Wint = std::vector<Vint>;
using Wlli = std::vector<Vlli>;
using Vbool = std::vector<bool>;
using Wbool = std::vector<Vbool>;
using pii = std::pair<int, int>;
using pll = std::pair<lli, lli>;
template <class T> using Vec = std::vector<T>;
template <class T> using Wec = Vec<Vec<T>>;
constexpr int MOD = 1e9 + 7;
constexpr int INFi = 2e9 + 1;
constexpr lli INFl = (lli)(9e18) + 1;
const std::vector<std::pair<int, int>> DXDY = {
{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
constexpr char BR = '\n';
#define DEBUG(x) std::cerr << #x << " = " << x << '\n';
#define FOR(i, a, b) for (int(i) = (a); (i) < (b); ++(i))
#define FOReq(i, a, b) for (int(i) = (a); (i) <= (b); ++(i))
#define rFOR(i, a, b) for (int(i) = (b); (i) >= (a); --(i))
#define FORstep(i, a, b, step) for (int(i) = (a); i < (b); i += (step))
#define REP(i, n) FOR(i, 0, n)
#define rREP(i, n) rFOR(i, 0, (n - 1))
#define vREP(ele, vec) for (auto &(ele) : (vec))
#define vREPcopy(ele, vec) for (auto(ele) : (vec))
#define SORT(A) std::sort((A).begin(), (A).end())
#define RSORT(A) std::sort((A).rbegin(), (A).rend())
#define ALL(A) (A).begin(), (A).end()
// 座標圧縮 (for vector) : ソートしてから使うのが一般的 ; SORT(A) =>
// COORDINATE_COMPRESSION(A)
#define COORDINATE_COMPRESSION(A) \
(A).erase(unique((A).begin(), (A).end()), (A).end())
template <class T> inline int argmin(std::vector<T> &vec) {
return min_element(vec.begin(), vec.end()) - vec.begin();
}
template <class T> inline int argmax(std::vector<T> &vec) {
return max_element(vec.begin(), vec.end()) - vec.begin();
}
template <class S, class T> inline void chmax(S &a, T b) {
if (a < b)
a = b;
}
template <class S, class T> inline void chmin(S &a, T b) {
if (a > b)
a = b;
}
template <class T> inline void reverseSORT(Vec<T> &Array) {
std::sort(Array.begin(), Array.end(), std::greater<T>());
}
inline int BitI(int k) { return 1 << k; }
inline lli BitL(int k) { return 1LL << k; }
inline void putsDouble(double d) { printf("%.16lf\n", d); }
template <class T> inline std::string toString(T n) {
if (n == 0)
return "0";
std::string res;
if (n < 0) {
n = -n;
while (n != 0) {
res += (char)(n % 10 + '0');
n /= 10;
}
std::reverse(res.begin(), res.end());
return '-' + res;
}
while (n != 0) {
res += (char)(n % 10 + '0');
n /= 10;
}
std::reverse(res.begin(), res.end());
return res;
}
namespace MyFunc {
using LLi = long long int;
using ULLi = unsigned long long int;
// GCD(a, b) ; a, bの最大公約数を求める関数
inline LLi gcd(LLi a, LLi b) {
while (b != 0) {
a %= b;
std::swap(a, b);
}
return a;
}
// LCM(a, b) ; a, bの最小公倍数を求める関数
inline LLi lcm(LLi a, LLi b) { return (a * b) / MyFunc::gcd(a, b); }
// 累乗を求める関数
inline LLi power(LLi a, LLi n) {
LLi res = 1LL, waiting = a;
while (n != 0LL) {
if ((n & 1LL) != 0LL)
res *= waiting;
waiting *= waiting;
n >>= 1;
}
return res;
}
// 累乗の余りを求める関数
inline LLi power_mod(LLi a, LLi n, LLi mod_number___ = 1e9 + 7) {
LLi res = 1LL, waiting = a;
while (n != 0LL) {
if ((n & 1LL) != 0LL) {
res *= waiting;
res %= mod_number___;
}
waiting *= waiting;
waiting %= mod_number___;
n >>= 1;
}
return res;
}
// Z/pZ上の逆元を求める関数 (フェルマーの小定理)
inline LLi inverse_mod(LLi a, LLi mod_number___ = 1e9 + 7) {
return MyFunc::power_mod(a, mod_number___ - 2);
}
inline LLi inverse_mod_euclid(LLi a, LLi mod_number___ = 1e9 + 7) {
LLi b = mod_number___, u = 1, v = 0;
while (b != 0) {
LLi t = a / b;
a -= t * b;
std::swap(a, b);
u -= t * v;
std::swap(u, v);
}
u %= mod_number___;
if (u < 0)
u += mod_number___;
return u;
}
// 素数であるかを判定する関数
template <typename Integer_type> inline bool isPrime(Integer_type n) {
if (n < 2)
return false;
if (n == 2)
return true;
if (n % 2 == 0)
return false;
for (Integer_type x = 3; x * x <= n; ++++x)
if (n % x == 0)
return false;
return true;
}
// 素数であるかの真偽表を返す : n ≥ 1
inline std::vector<bool> primeTable(int n) {
std::vector<bool> res(n + 1, true);
res[0] = false;
res[1] = false;
for (int x = 2; x * x <= n; ++x)
if (res[x]) {
for (int i = 2 * x; i <= n; i += x) {
res[i] = false;
}
}
return std::move(res);
}
// 素因数分解したベクトルを返す ; {素因数, 指数}
template <typename Integer_type>
inline std::vector<std::pair<Integer_type, int>>
prime_factorization(Integer_type n) {
std::vector<std::pair<Integer_type, int>> res(0);
if (n <= 0)
return std::move(res); // 例外処理 : nが 0 以下
if (n % 2 == 0) {
n /= 2;
int cnt = 1;
while (n % 2 == 0) {
n /= 2;
cnt++;
}
res.emplace_back(make_pair(2, cnt));
}
Integer_type x = 3;
while (x * x <= n) {
if (n % x == 0) {
n /= x;
int cnt = 1;
while (n % x == 0) {
n /= x;
cnt++;
}
res.emplace_back(make_pair(x, cnt));
}
++++x;
}
if (n > 1)
res.emplace_back(make_pair(n, 1));
return std::move(res);
}
// unsigned long 符号なし64bit整数で平方数かを判定する関数 O(log(N))
inline bool is_square_unsigned(ULLi n) {
// 0 は 平方数
if (n == 0)
return true;
// 平方数の可能性としては 2^32 - 1 が最大 : (2^32)^2 - 1
static ULLi MAX_LONG_SQRT__ = (1UL << 32) - 1;
if (MAX_LONG_SQRT__ * MAX_LONG_SQRT__ < n)
return false;
if (MAX_LONG_SQRT__ * MAX_LONG_SQRT__ == n)
return true;
// 二分探索
ULLi smaller = 0, bigger = MAX_LONG_SQRT__;
while (bigger - smaller > 1) {
ULLi m = (smaller + bigger) >> 1;
if (m * m == n)
return true;
if (m * m < n)
smaller = m;
else
bigger = m;
}
return false;
}
// 符号付き64bit整数で平方数か判定する関数
inline bool is_square(LLi n) {
if (n < 0)
return false;
// 平方数を4で割った余りは 0 か 1 に限る
if ((n & 0b11) > 0b01)
return false;
return is_square_unsigned(n);
}
} // namespace MyFunc
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Vint A, B;
Vbool Done;
int n;
int solve(int k) {
if (not Done[k])
return B[k];
for (int x = 2 * k; x <= n; x += k)
B[k] += solve(x);
Done[k] = false;
return B[k] %= 2;
}
int main(void) {
scanf("%d", &n);
A.resize(n + 1);
REP(i, n) scanf("%d", &A[i + 1]);
Done.resize(n + 1, true);
B = A;
solve(1);
std::queue<int> Q;
REP(i, n) if (B[i + 1] == 1) { Q.push(i + 1); }
printf("%lu\n", Q.size());
while (not Q.empty()) {
printf("%d", Q.front());
Q.pop();
putchar(Q.empty() ? '\n' : ' ');
}
return 0;
} | [
"control_flow.branch.if.condition.change",
"identifier.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change",
"control_flow.loop.for.update.change",
"assignment.change"
] | 779,853 | 779,851 | u394853232 | cpp |
p02972 | //#define NDEBUG
#include <cstddef>
#include <cstdint>
#include <iostream>
#include <vector>
namespace n91 {
using i8 = std::int_fast8_t;
using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
using u8 = std::uint_fast8_t;
using u32 = std::uint_fast32_t;
using u64 = std::uint_fast64_t;
using isize = std::ptrdiff_t;
using usize = std::size_t;
constexpr usize operator"" _z(unsigned long long x) noexcept {
return static_cast<usize>(x);
}
class rep {
const usize f, l;
public:
class itr {
friend rep;
usize i;
constexpr itr(const usize x) noexcept : i(x) {}
public:
void operator++() noexcept { ++i; }
constexpr usize operator*() const noexcept { return i; }
constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
};
constexpr rep(const usize first, const usize last) noexcept
: f(first), l(last) {}
constexpr itr begin() const noexcept { return itr(f); }
constexpr itr end() const noexcept { return itr(l); }
};
class revrep {
const usize f, l;
public:
class itr {
friend revrep;
usize i;
constexpr itr(usize x) noexcept : i(x) {}
public:
void operator++() noexcept { --i; }
constexpr usize operator*() const noexcept { return i; }
constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
};
constexpr revrep(usize first, usize last) noexcept : f(--first), l(--last) {}
constexpr itr begin() const noexcept { return itr(l); }
constexpr itr end() const noexcept { return itr(f); }
};
template <class T> using vec_alias = std::vector<T>;
template <class T> auto md_vec(const usize n, const T &value) {
return std::vector<T>(n, value);
}
template <class... Args> auto md_vec(const usize n, Args... args) {
return std::vector<decltype(md_vec(args...))>(n, md_vec(args...));
}
template <class T> constexpr T difference(const T &a, const T &b) {
return a < b ? b - a : a - b;
}
template <class T> T scan() {
T ret;
std::cin >> ret;
return ret;
}
} // namespace n91
#include <algorithm>
#include <iostream>
#include <iterator>
#include <set>
#include <utility>
namespace n91 {
void main_() {
const auto n = scan<usize>();
std::vector<usize> a;
a.reserve(n + 1_z);
a.emplace_back();
std::copy_n(std::istream_iterator<usize>(std::cin), n, std::back_inserter(a));
std::set<usize> b;
for (const auto i : revrep(1_z, n + 1_z)) {
bool f = a[i] == 1_z;
for (usize j = i + i; j <= n; j += i) {
if (b.find(i) != b.end()) {
f = !f;
}
}
if (f) {
b.insert(i);
}
}
std::cout << b.size() << std::endl;
for (const auto e : b) {
std::cout << e << " ";
}
}
} // namespace n91
int main() {
n91::main_();
return 0;
}
| //#define NDEBUG
#include <cstddef>
#include <cstdint>
#include <iostream>
#include <vector>
namespace n91 {
using i8 = std::int_fast8_t;
using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
using u8 = std::uint_fast8_t;
using u32 = std::uint_fast32_t;
using u64 = std::uint_fast64_t;
using isize = std::ptrdiff_t;
using usize = std::size_t;
constexpr usize operator"" _z(unsigned long long x) noexcept {
return static_cast<usize>(x);
}
class rep {
const usize f, l;
public:
class itr {
friend rep;
usize i;
constexpr itr(const usize x) noexcept : i(x) {}
public:
void operator++() noexcept { ++i; }
constexpr usize operator*() const noexcept { return i; }
constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
};
constexpr rep(const usize first, const usize last) noexcept
: f(first), l(last) {}
constexpr itr begin() const noexcept { return itr(f); }
constexpr itr end() const noexcept { return itr(l); }
};
class revrep {
const usize f, l;
public:
class itr {
friend revrep;
usize i;
constexpr itr(usize x) noexcept : i(x) {}
public:
void operator++() noexcept { --i; }
constexpr usize operator*() const noexcept { return i; }
constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
};
constexpr revrep(usize first, usize last) noexcept : f(--first), l(--last) {}
constexpr itr begin() const noexcept { return itr(l); }
constexpr itr end() const noexcept { return itr(f); }
};
template <class T> using vec_alias = std::vector<T>;
template <class T> auto md_vec(const usize n, const T &value) {
return std::vector<T>(n, value);
}
template <class... Args> auto md_vec(const usize n, Args... args) {
return std::vector<decltype(md_vec(args...))>(n, md_vec(args...));
}
template <class T> constexpr T difference(const T &a, const T &b) {
return a < b ? b - a : a - b;
}
template <class T> T scan() {
T ret;
std::cin >> ret;
return ret;
}
} // namespace n91
#include <algorithm>
#include <iostream>
#include <iterator>
#include <set>
#include <utility>
namespace n91 {
void main_() {
const auto n = scan<usize>();
std::vector<usize> a;
a.reserve(n + 1_z);
a.emplace_back();
std::copy_n(std::istream_iterator<usize>(std::cin), n, std::back_inserter(a));
std::set<usize> b;
for (const auto i : revrep(1_z, n + 1_z)) {
bool f = a[i] == 1_z;
for (usize j = i + i; j <= n; j += i) {
if (b.find(j) != b.end()) {
f = !f;
}
}
if (f) {
b.insert(i);
}
}
std::cout << b.size() << std::endl;
for (const auto e : b) {
std::cout << e << " ";
}
}
} // namespace n91
int main() {
n91::main_();
return 0;
}
| [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 779,866 | 779,867 | u708618797 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
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 ones = 0;
for (int i = n; i >= 1; i--) {
int parity = 0;
// int num = i+1;
for (int j = i + i; j < n; j += i) {
if (b[i] == 1)
parity = (1 - parity);
}
// cout << "parity: "<< parity << " | expected: "<<a[i] << endl;
if (parity != a[i]) {
b[i] = 1;
ones++;
}
}
// if(ones == 0){
// cout << ones << endl;
// return 0;
// }
cout << ones << endl;
int i = 1, j = 0;
while (i < n && j < ones) {
if (b[i] == 1) {
cout << i;
j++;
i++;
break;
}
i++;
}
for (; i <= n; i++) {
if (b[i] == 1) {
cout << " " << i;
}
}
if (ones > 0)
cout << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
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 ones = 0;
for (int i = n; i >= 1; i--) {
int parity = 0;
// int num = i+1;
for (int j = i + i; j <= n; j += i) {
if (b[j] == 1)
parity = (1 - parity);
}
// cout << "parity: "<< parity << " | expected: "<<a[i] << endl;
if (parity != a[i]) {
b[i] = 1;
ones++;
}
}
// if(ones == 0){
// cout << ones << endl;
// return 0;
// }
cout << ones << endl;
int i = 1, j = 0;
while (i <= n && j < ones) {
if (b[i] == 1) {
cout << i;
j++;
i++;
break;
}
i++;
}
for (; i <= n; i++) {
if (b[i] == 1) {
cout << " " << i;
}
}
if (ones > 0)
cout << endl;
return 0;
} | [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change",
"identifier.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change",
"control_flow.loop.condition.change"
] | 779,868 | 779,869 | u147913071 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
#define reg register
#define ll long long
inline ll read() {
ll x = 0, w = 0;
char ch = getchar();
while (!isdigit(ch))
w |= ch == '-', ch = getchar();
while (isdigit(ch))
x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
return w ? -x : x;
}
int a[1000000], b[1000000];
int main() {
int n = read();
int m = 0;
reg int i, gs, j;
for (i = 1; i <= n; ++i)
a[i] = read();
for (i = n; i >= 1; --i) {
gs = 0;
for (j = 2; j * i <= n; ++j)
gs += b[j];
gs %= 2;
if (a[i]) {
if (gs == 0)
b[i] = 1;
} else {
if (gs)
b[i] = 1;
}
}
for (i = 1; i <= n; ++i)
m += b[i];
cout << m << "\n";
for (i = 1; i <= n; ++i)
if (b[i])
cout << i << " ";
cout << "\n";
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define reg register
#define ll long long
inline ll read() {
ll x = 0, w = 0;
char ch = getchar();
while (!isdigit(ch))
w |= ch == '-', ch = getchar();
while (isdigit(ch))
x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
return w ? -x : x;
}
int a[1000000], b[1000000];
int main() {
int n = read();
int m = 0;
reg int i, gs, j;
for (i = 1; i <= n; ++i)
a[i] = read();
for (i = n; i >= 1; --i) {
gs = 0;
for (j = 2; j * i <= n; ++j)
gs += b[j * i];
gs %= 2;
if (a[i]) {
if (gs == 0)
b[i] = 1;
} else {
if (gs)
b[i] = 1;
}
}
for (i = 1; i <= n; ++i)
m += b[i];
cout << m << "\n";
for (i = 1; i <= n; ++i)
if (b[i])
cout << i << " ";
cout << "\n";
return 0;
}
| [
"assignment.change"
] | 779,870 | 779,871 | u962361946 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
#define reg register
#define ll long long
inline ll read() {
ll x = 0, w = 0;
char ch = getchar();
while (!isdigit(ch))
w |= ch == '-', ch = getchar();
while (isdigit(ch))
x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
return w ? -x : x;
}
int a[1000000], b[1000000];
int main() {
int n = read();
int m = 0;
reg int i, gs, j;
for (i = 1; i <= n; ++i)
a[i] = read();
for (i = n; i >= 1; --i) {
for (j = 2; j * i <= n; ++j)
gs += b[j];
gs %= 2;
if (a[i]) {
if (gs == 0)
b[i] = 1;
} else {
if (gs)
b[i] = 1;
}
}
for (i = 1; i <= n; ++i)
m += b[i];
cout << m << "\n";
for (i = 1; i <= n; ++i)
if (b[i])
cout << i << " ";
cout << "\n";
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define reg register
#define ll long long
inline ll read() {
ll x = 0, w = 0;
char ch = getchar();
while (!isdigit(ch))
w |= ch == '-', ch = getchar();
while (isdigit(ch))
x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
return w ? -x : x;
}
int a[1000000], b[1000000];
int main() {
int n = read();
int m = 0;
reg int i, gs, j;
for (i = 1; i <= n; ++i)
a[i] = read();
for (i = n; i >= 1; --i) {
gs = 0;
for (j = 2; j * i <= n; ++j)
gs += b[j * i];
gs %= 2;
if (a[i]) {
if (gs == 0)
b[i] = 1;
} else {
if (gs)
b[i] = 1;
}
}
for (i = 1; i <= n; ++i)
m += b[i];
cout << m << "\n";
for (i = 1; i <= n; ++i)
if (b[i])
cout << i << " ";
cout << "\n";
return 0;
}
| [
"assignment.add",
"assignment.change"
] | 779,872 | 779,871 | u962361946 | cpp |
p02972 | /* Dsingh_24 */
#include <bits/stdc++.h>
#define ll int
#define pb push_back
#define endl '\n'
#define pii pair<ll int, ll int>
#define vi vector<int>
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define sz(x) (ll int)x.size()
#define hell 1000000007
#define rep(i, a, b) for (ll int i = a; i < b; i++)
#define lbnd lower_bound
#define ubnd upper_bound
#define bs binary_search
#define mp make_pair
#define ios \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
using namespace std;
#define N 100005
int main() {
ios ll n, i, j;
cin >> n;
ll a[n + 1], b[n + 1] = {0};
for (i = 1; i <= n; i++)
cin >> a[i];
for (i = n; i > 0; i--) {
ll sum = 0;
for (j = i; j <= n; j += i)
sum += b[i];
if (sum % 2 != a[i])
b[i] = 1;
}
vi ans;
for (i = 1; i <= n; i++)
if (b[i] == 1)
ans.pb(i);
cout << ans.size() << "\n";
for (i = 0; i < ans.size(); i++)
cout << ans[i] << "\n";
return 0;
} | /* Dsingh_24 */
#include <bits/stdc++.h>
#define ll int
#define pb push_back
#define endl '\n'
#define pii pair<ll int, ll int>
#define vi vector<int>
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define sz(x) (ll int)x.size()
#define hell 1000000007
#define rep(i, a, b) for (ll int i = a; i < b; i++)
#define lbnd lower_bound
#define ubnd upper_bound
#define bs binary_search
#define mp make_pair
#define ios \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
using namespace std;
#define N 100005
int main() {
ios ll n, i, j;
cin >> n;
ll a[n + 1], b[n + 1] = {0};
for (i = 1; i <= n; i++)
cin >> a[i];
for (i = n; i > 0; i--) {
ll sum = 0;
for (j = i; j <= n; j += i)
sum += b[j];
if (sum % 2 != a[i])
b[i] = 1;
}
vi ans;
for (i = 1; i <= n; i++)
if (b[i] == 1)
ans.pb(i);
cout << ans.size() << "\n";
for (i = 0; i < ans.size(); i++)
cout << ans[i] << " ";
return 0;
} | [
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change",
"literal.string.change",
"io.output.change"
] | 779,873 | 779,874 | u535413433 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, s, n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define BiSearchRangeNum(x, y, z) \
lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y)
vector<int> divisor(int n) {
vector<int> ret;
for (int i = 1; i * i <= n; i++) {
if (n % i == 0) {
ret.push_back(i);
if (i * i != n)
ret.push_back(n / i);
}
}
return (ret);
}
int main() {
int N;
cin >> N;
vector<int> A(N);
rep(i, 0, N) { cin >> A[i]; }
vector<int> counter(N + 1, 0);
int M = 0;
vector<int> ans;
bool flag = true;
for (int i = N; i > 0; i--) {
int ai = A[i - 1];
int tmp = counter[i];
if (ai == 1) {
if (tmp % 2 == 0) {
ans.pb(i);
M++;
for (int j = 1; j * j <= i; j++) {
if (i * j == 0) {
counter[j]++;
if (j * j != i)
counter[i / j]++;
}
}
} else if (tmp % 2 == 1) {
continue;
}
} else if (ai == 0) {
if (tmp % 2 == 0) {
continue;
} else if (tmp % 2 == 1) {
ans.pb(i);
M++;
for (int j = 1; j * j <= i; j++) {
if (i * j == 0) {
counter[j]++;
if (j * j != i)
counter[i / j]++;
}
}
}
}
}
cout << M << endl;
if (M > 0) {
rep(i, 0, ans.size()) { cout << ans[i] << endl; }
}
};
| #include <bits/stdc++.h>
using namespace std;
#define rep(i, s, n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define BiSearchRangeNum(x, y, z) \
lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y)
vector<int> divisor(int n) {
vector<int> ret;
for (int i = 1; i * i <= n; i++) {
if (n % i == 0) {
ret.push_back(i);
if (i * i != n)
ret.push_back(n / i);
}
}
return (ret);
}
int main() {
int N;
cin >> N;
vector<int> A(N);
rep(i, 0, N) { cin >> A[i]; }
vector<int> counter(N + 1, 0);
int M = 0;
vector<int> ans;
bool flag = true;
for (int i = N; i > 0; i--) {
int ai = A[i - 1];
int tmp = counter[i];
if (ai == 1) {
if (tmp % 2 == 0) {
ans.pb(i);
M++;
for (int j = 1; j * j <= i; j++) {
if (i % j == 0) {
counter[j]++;
if (j * j != i)
counter[i / j]++;
}
}
} else if (tmp % 2 == 1) {
continue;
}
} else if (ai == 0) {
if (tmp % 2 == 0) {
continue;
} else if (tmp % 2 == 1) {
ans.pb(i);
M++;
for (int j = 1; j * j <= i; j++) {
if (i % j == 0) {
counter[j]++;
if (j * j != i)
counter[i / j]++;
}
}
}
}
}
cout << M << endl;
if (M > 0) {
rep(i, 0, ans.size()) { cout << ans[i] << endl; }
}
};
| [
"expression.operator.arithmetic.change",
"control_flow.branch.if.condition.change"
] | 779,875 | 779,876 | u987594251 | cpp |
p02972 | #include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
typedef long long ll;
using namespace std;
int main() {
int N;
cin >> N;
int a[N + 1];
for (int i = 1; i <= N; i++)
cin >> a[i];
int cnt[N + 1];
fill(cnt, cnt + N + 1, 0);
vector<int> ans;
for (int i = N; i >= 1; i--) {
cnt[i] %= 2;
if (cnt[i] != a[i]) {
ans.push_back(i);
for (int j = 1; j * j <= i; j++) {
if (i % j == 0) {
if (i != j) {
cnt[i]++;
cnt[i / j]++;
} else {
cnt[i]++;
}
}
}
}
}
cout << ans.size() << endl;
for (int i = 0; i < ans.size(); i++) {
cout << ans[i] << " ";
}
cout << endl;
return 0;
}
| #include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
typedef long long ll;
using namespace std;
int main() {
int N;
cin >> N;
int a[N + 1];
for (int i = 1; i <= N; i++)
cin >> a[i];
int cnt[N + 1];
fill(cnt, cnt + N + 1, 0);
vector<int> ans;
for (int i = N; i >= 1; i--) {
// cout << "cnt" << i << " " << cnt[i] << endl;
cnt[i] %= 2;
if (cnt[i] != a[i]) {
ans.push_back(i);
for (int j = 1; j * j <= i; j++) {
if (i % j == 0) {
if (j != i / j) {
cnt[j]++;
cnt[i / j]++;
} else {
cnt[j]++;
}
}
}
}
}
cout << ans.size() << endl;
for (int i = 0; i < ans.size(); i++) {
cout << ans[i] << " ";
}
cout << endl;
return 0;
}
| [
"identifier.change",
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change"
] | 779,877 | 779,878 | u492131209 | cpp |
p02972 | #include <bits/stdc++.h>
#define loop(n, i) for (int i = 0; i < n; i++)
#define loop1(n, i) for (int i = 1; i <= n; i++)
#define rloop(n, i) for (int i = n; i; i++)
#define HERE cout << "HERE: " << __LINE__ << endl;
#define INSP(v) cout << v << " at " << __LINE__ << endl;
using namespace std;
using ll = long long;
template <class T> using V = vector<T>;
int main() {
int n;
cin >> n;
V<int> A(n);
loop(n, i) cin >> A[i];
V<int> ans(n);
loop(n, i) {
int j = n - i;
ans[j - 1] = A[j - 1];
for (int k = j * 2; k < n; k += j) {
ans[j - 1] ^= ans[k - 1];
}
}
int os = 0;
V<int> ot;
loop(n, i) {
if (ans[i]) {
os++;
ot.push_back(i + 1);
}
}
cout << os << endl;
if (os) {
cout << ot[0];
loop(os - 1, i) { cout << " " << ot[i + 1]; }
cout << endl;
}
return 0;
}
| #include <bits/stdc++.h>
#define loop(n, i) for (int i = 0; i < n; i++)
#define loop1(n, i) for (int i = 1; i <= n; i++)
#define rloop(n, i) for (int i = n; i; i++)
#define HERE cout << "HERE: " << __LINE__ << endl;
#define INSP(v) cout << v << " at " << __LINE__ << endl;
using namespace std;
using ll = long long;
template <class T> using V = vector<T>;
int main() {
int n;
cin >> n;
V<int> A(n);
loop(n, i) cin >> A[i];
V<int> ans(n);
loop(n, i) {
int j = n - i;
ans[j - 1] = A[j - 1];
for (int k = j * 2; k <= n; k += j) {
ans[j - 1] ^= ans[k - 1];
}
}
int os = 0;
V<int> ot;
loop(n, i) {
if (ans[i]) {
os++;
ot.push_back(i + 1);
}
}
cout << os << endl;
if (os) {
cout << ot[0];
loop(os - 1, i) { cout << " " << ot[i + 1]; }
cout << endl;
}
return 0;
}
| [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 779,881 | 779,882 | u581122825 | cpp |
p02972 | #include <algorithm>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
#define MOD (long long int)(1e9 + 7)
#define ll long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n) for (int i = 1; i <= (int)(n); i++)
#define REP(i, n) for (int i = n - 1; i >= 0; i--)
#define REPS(i, n) for (int i = n; i > 0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a) < (b)) ? (b) : (a))
#define chmin(a, b) a = (((a) > (b)) ? (b) : (a))
#define all(v) v.begin(), v.end()
ll mpow(ll a, ll b) {
if (b == 0) {
return 1;
} else if (b % 2 == 0) {
ll memo = mpow(a, b / 2);
return memo * memo % MOD;
} else {
return mpow(a, b - 1) * a % MOD;
}
}
ll gcd(ll a, ll b) {
if (b == 0) {
return a;
} else {
return gcd(b, a % b);
}
}
int main(void) {
int n;
cin >> n;
int a;
vector<int> A;
A.push_back(0);
rep(i, n) {
cin >> a;
A.push_back(a);
}
vector<int> B;
B.push_back(0);
reps(i, n) { B.push_back(A[i]); }
REPS(i, n) {
int count = 0;
int bi = i * 2;
while (bi < n) {
count += B[bi];
count %= 2;
bi += i;
}
B[i] += count;
B[i] %= 2;
}
int m = 0;
reps(i, n) {
if (B[i] == 1) {
m++;
}
}
cout << m << endl;
reps(i, n) {
if (B[i] == 1) {
cout << i << endl;
}
}
return 0;
}
| #include <algorithm>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
#define MOD (long long int)(1e9 + 7)
#define ll long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n) for (int i = 1; i <= (int)(n); i++)
#define REP(i, n) for (int i = n - 1; i >= 0; i--)
#define REPS(i, n) for (int i = n; i > 0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a) < (b)) ? (b) : (a))
#define chmin(a, b) a = (((a) > (b)) ? (b) : (a))
#define all(v) v.begin(), v.end()
ll mpow(ll a, ll b) {
if (b == 0) {
return 1;
} else if (b % 2 == 0) {
ll memo = mpow(a, b / 2);
return memo * memo % MOD;
} else {
return mpow(a, b - 1) * a % MOD;
}
}
ll gcd(ll a, ll b) {
if (b == 0) {
return a;
} else {
return gcd(b, a % b);
}
}
int main(void) {
int n;
cin >> n;
int a;
vector<int> A;
A.push_back(0);
rep(i, n) {
cin >> a;
A.push_back(a);
}
vector<int> B;
B.push_back(0);
reps(i, n) { B.push_back(A[i]); }
REPS(i, n) {
int count = 0;
int bi = i * 2;
while (bi <= n) {
count += B[bi];
count %= 2;
bi += i;
}
B[i] += count;
B[i] %= 2;
}
int m = 0;
reps(i, n) {
if (B[i] == 1) {
m++;
}
}
cout << m << endl;
reps(i, n) {
if (B[i] == 1) {
cout << i << endl;
}
}
return 0;
}
| [
"expression.operator.compare.change",
"control_flow.loop.condition.change"
] | 779,888 | 779,889 | u838742270 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
//関数
const long INF = 1000000000000000;
int main(void) {
long N;
cin >> N;
vector<long> a(N + 1);
for (int i = 1; i <= N; i++)
cin >> a.at(i);
vector<long> b(N + 1, 0);
long M = 0;
for (int n = N; n >= 1; n--) {
long bit = a.at(n);
for (int i = 1; i * n <= N; i++) {
bit += b.at(i * n);
}
b.at(n) = (a.at(n) % 2);
M += b.at(n);
}
cout << M << endl;
for (int i = 1; i <= N; i++) {
if (b.at(i) == 1)
cout << i << " ";
}
cout << endl;
}
| #include <bits/stdc++.h>
using namespace std;
//関数
const long INF = 1000000000000000;
int main(void) {
long N;
cin >> N;
vector<long> a(N + 1);
for (int i = 1; i <= N; i++)
cin >> a.at(i);
// cout<<a.at(3)<<endl;
vector<long> b(N + 1, 0);
long M = 0;
for (int n = N; n >= 1; n--) {
long bit = a.at(n);
for (int i = 1; i * n <= N; i++) {
bit += b.at(i * n);
}
// cout<<n<<" "<<bit<<endl;
b.at(n) = (bit % 2);
M += b.at(n);
}
cout << M << endl;
for (int i = 1; i <= N; i++) {
if (b.at(i) == 1)
cout << i << " ";
}
cout << endl;
}
| [
"assignment.value.change",
"expression.operation.binary.change",
"call.remove"
] | 779,890 | 779,891 | u968365254 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e6 + 7;
const int inf = INT_MAX;
const ll inff = 1e18;
const ll mod = 1e9 + 7;
#define pii pair<int, int>
#define mkp make_pair
#define F first
#define S second
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define IOS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
//#define int ll
//#define endl '\n'
int n;
int a[maxn];
int ans[maxn];
int32_t main() {
IOS cin >> n;
for (int i = 1; i <= n; i++)
cin >> a[i];
for (int i = n; i >= 1; i--) {
int sum = 0;
for (int j = i * 2; j <= n; j += i)
sum ^= ans[i];
ans[i] = (sum ^ a[i]);
}
vector<int> v;
for (int i = 1; i <= n; i++)
if (ans[i] == 1)
v.pb(i);
cout << sz(v) << endl;
for (int i : v)
cout << i << ' ';
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e6 + 7;
const int inf = INT_MAX;
const ll inff = 1e18;
const ll mod = 1e9 + 7;
#define pii pair<int, int>
#define mkp make_pair
#define F first
#define S second
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define IOS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
//#define int ll
//#define endl '\n'
int n;
int a[maxn];
int ans[maxn];
int32_t main() {
IOS cin >> n;
for (int i = 1; i <= n; i++)
cin >> a[i];
for (int i = n; i >= 1; i--) {
int sum = 0;
for (int j = i * 2; j <= n; j += i)
sum ^= ans[j];
ans[i] = (sum ^ a[i]);
}
vector<int> v;
for (int i = 1; i <= n; i++)
if (ans[i] == 1)
v.pb(i);
cout << sz(v) << endl;
for (int i : v)
cout << i << ' ';
}
| [
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change"
] | 779,892 | 779,893 | u175665488 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define pp pair<int, int>
#define ll long long
#define ld long double
int inf = 100000000;
ll INF = 4000000000000000000;
ll MOD = 1000000007;
int main() {
int n;
cin >> n;
vector<int> a(n + 1), b(0), c(n + 1, 0);
for (int i = 1; i < n + 1; i++)
cin >> a.at(i);
for (int i = n; i > 0; i--) {
int t = 0;
for (int j = 2; j < n + 10; j++) {
if (i * j >= n + 1)
break;
if (c.at(i * j) == 1)
t = t - 1;
}
if (a.at(i) != t) {
b.push_back(i);
c.at(i) = 1;
}
}
cout << b.size() << endl;
if (b.size() == 0)
return 0;
rep(i, b.size() - 1) { cout << b.at(i) << " "; }
cout << b.at(b.size() - 1) << endl;
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define pp pair<int, int>
#define ll long long
#define ld long double
int inf = 100000000;
ll INF = 4000000000000000000;
ll MOD = 1000000007;
int main() {
int n;
cin >> n;
vector<int> a(n + 1), b(0), c(n + 1, 0);
for (int i = 1; i < n + 1; i++)
cin >> a.at(i);
for (int i = n; i > 0; i--) {
int t = 0;
for (int j = 2; j < n + 10; j++) {
if (i * j >= n + 1)
break;
if (c.at(i * j) == 1)
t = 1 - t;
}
if (a.at(i) != t) {
b.push_back(i);
c.at(i) = 1;
}
}
cout << b.size() << endl;
if (b.size() == 0)
return 0;
rep(i, b.size() - 1) { cout << b.at(i) << " "; }
cout << b.at(b.size() - 1) << endl;
} | [
"expression.operation.binary.remove",
"assignment.change"
] | 779,896 | 779,897 | u112775098 | cpp |
p02972 | #include <algorithm>
#include <algorithm> // sort
#include <cmath>
#include <cstring>
#include <iostream>
#include <map> // pair
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, const T &b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
#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 all(x) (x).begin(), (x).end()
const ll mod = 1e9 + 7;
const int INF = 1e9;
const ll INFLONG = 1e18;
vector<pair<ll, ll>> vec[100000];
int main() {
ll n;
cin >> n;
ll a[n + 1];
ll b[n + 1];
rep(i, n) { cin >> a[i + 1]; }
ll tmp;
for (int i = n; i > 0; i--) {
tmp = 0;
for (int j = 2 * i; j <= n; j += i) {
tmp += a[j];
}
b[i] = (tmp + a[i]) % 2;
}
ll sum = 0;
rep(i, n) { sum += b[i + 1]; }
cout << sum << endl;
rep(i, n) {
if (b[i + 1]) {
cout << i + 1 << " ";
}
}
}
| #include <algorithm>
#include <algorithm> // sort
#include <cmath>
#include <cstring>
#include <iostream>
#include <map> // pair
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, const T &b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
#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 all(x) (x).begin(), (x).end()
const ll mod = 1e9 + 7;
const int INF = 1e9;
const ll INFLONG = 1e18;
vector<pair<ll, ll>> vec[100000];
int main() {
ll n;
cin >> n;
ll a[n + 1];
ll b[n + 1];
rep(i, n) { cin >> a[i + 1]; }
ll tmp;
for (int i = n; i > 0; i--) {
tmp = 0;
for (int j = 2 * i; j <= n; j += i) {
tmp += b[j];
}
b[i] = (tmp + a[i]) % 2;
// cout << tmp << " " << a[i] << endl;
}
ll sum = 0;
rep(i, n) { sum += b[i + 1]; }
cout << sum << endl;
rep(i, n) {
if (b[i + 1]) {
cout << i + 1 << " ";
}
// cout << a[i+1] << " ";
}
}
| [
"assignment.value.change",
"identifier.change"
] | 779,900 | 779,901 | u276796245 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n, cont = 0;
cin >> n;
vector<int> a(n + 1), ans(n + 1);
for (int i = 0; i < n; i++) {
cin >> a[i + 1];
if (i + 1 > n / 2) {
ans[i + 1] = a[i + 1];
if (a[i + 1])
cont++;
}
}
for (int i = n / 2; i > 0; i--) {
int sum = 0;
for (int j = 2; i * j < n; j++) {
sum += ans[i * j];
}
if ((sum % 2 && a[i]) || (!(sum % 2) && !a[i])) {
ans[i] = 0;
} else {
ans[i] = 1;
cont++;
}
}
cout << cont << endl;
for (int i = 0; i < n; i++) {
if (ans[i + 1])
cout << i + 1 << endl;
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n, cont = 0;
cin >> n;
vector<int> a(n + 1), ans(n + 1);
for (int i = 0; i < n; i++) {
cin >> a[i + 1];
if (i + 1 > n / 2) {
ans[i + 1] = a[i + 1];
if (a[i + 1])
cont++;
}
}
for (int i = n / 2; i > 0; i--) {
int sum = 0;
for (int j = 2; i * j <= n; j++) {
sum += ans[i * j];
}
if ((sum % 2 && a[i]) || (!(sum % 2) && !a[i])) {
ans[i] = 0;
} else {
ans[i] = 1;
cont++;
}
}
cout << cont << endl;
for (int i = 0; i < n; i++) {
if (ans[i + 1])
cout << i + 1 << endl;
}
return 0;
}
| [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 779,902 | 779,903 | u905270643 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
int n, sum, tot, a[200005], b[200005];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", &a[i]);
}
for (int i = n; i >= 1; i--) {
if (i * 2 > n) {
b[i] = a[i];
} else {
for (int j = 2 * i; j <= n; j += i) {
sum = (sum + b[j]) % 2;
}
b[i] = sum ^ a[i];
}
}
for (int i = 1; i <= n; ++i) {
tot += b[i];
}
printf("%d\n", tot);
for (int i = 1; i <= n; ++i) {
if (b[i]) {
printf("%d ", i);
}
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int n, sum, tot, a[200005], b[200005];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", &a[i]);
}
for (int i = n; i >= 1; i--) {
if (i * 2 > n) {
b[i] = a[i];
} else {
sum = 0;
for (int j = 2 * i; j <= n; j += i) {
sum = (sum + b[j]) % 2;
}
b[i] = sum ^ a[i];
}
}
for (int i = 1; i <= n; ++i) {
tot += b[i];
}
printf("%d\n", tot);
for (int i = 1; i <= n; ++i) {
if (b[i]) {
printf("%d ", i);
}
}
return 0;
}
| [
"assignment.add"
] | 779,906 | 779,907 | u803118370 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pll pair<ll, ll>
#define speed_up \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
#define mod 1000000007
#define F first
#define S second
#define vl vector<ll>
#define ld long double
#define fix(n) cout << fixed << setprecision(n)
#define rep(i, a, b) for (ll i = a; i < b; i++)
#define pi 3.14159265358979323
const int N = 2e5 + 5;
ll can[N];
ll a[N];
void solve() {
ll n;
cin >> n;
rep(i, 1, n + 1) cin >> a[i];
ll ans = 0;
for (ll i = n; i > 0; i--) {
ll par = 0;
for (ll j = 2 * i; j <= n; j += i)
par += can[j];
if (a[i] == 0) {
if (par & 1)
can[i] = 1;
} else if (a[i] == 1) {
if (par % 2 == 0)
can[i] = 1;
}
ans += can[i];
}
cout << ans << endl;
for (ll i = 1; i <= n; i++)
if (can[i])
cout << can[i] << endl;
}
int main() {
int T = 1;
// pre();
speed_up
// cin>>T;
while (T--) solve();
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pll pair<ll, ll>
#define speed_up \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
#define mod 1000000007
#define F first
#define S second
#define vl vector<ll>
#define ld long double
#define fix(n) cout << fixed << setprecision(n)
#define rep(i, a, b) for (ll i = a; i < b; i++)
#define pi 3.14159265358979323
const int N = 2e5 + 5;
ll can[N];
ll a[N];
void solve() {
ll n;
cin >> n;
rep(i, 1, n + 1) cin >> a[i];
ll ans = 0;
for (ll i = n; i > 0; i--) {
ll par = 0;
for (ll j = 2 * i; j <= n; j += i)
par += can[j];
if (a[i] == 0) {
if (par & 1)
can[i] = 1;
} else if (a[i] == 1) {
if (par % 2 == 0)
can[i] = 1;
}
ans += can[i];
}
cout << ans << endl;
for (ll i = 1; i <= n; i++)
if (can[i])
cout << i << endl;
}
int main() {
int T = 1;
// pre();
speed_up
// cin>>T;
while (T--) solve();
return 0;
}
| [] | 779,910 | 779,911 | u005899600 | cpp |
p02972 | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int
const int INF = 2147483647;
using namespace std;
int main() {
int n;
int a[200000];
cin >> n;
REP(i, n) { cin >> a[i]; }
int ans[200000] = {};
int box = 0;
for (int i = n - 1; i >= 0; i--) {
int m = i + 1;
int rep = 1;
int sum = 0;
while (rep * m <= n) {
sum += ans[rep * m - 1];
rep++;
}
if (sum % 2 == a[i]) {
ans[i] = 0;
} else {
ans[i] = 1;
box++;
}
}
cout << box << endl;
REP(i, n) {
if (a[i] == 1) {
cout << i + 1;
if (i != n - 1) {
cout << " ";
}
}
}
if (box != 0) {
cout << endl;
}
}
| #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int
const int INF = 2147483647;
using namespace std;
int main() {
int n;
int a[200000];
cin >> n;
REP(i, n) { cin >> a[i]; }
int ans[200000] = {};
int box = 0;
for (int i = n - 1; i >= 0; i--) {
int m = i + 1;
int rep = 2;
int sum = 0;
while (rep * m <= n) {
sum += ans[rep * m - 1];
rep++;
}
if (sum % 2 == a[i]) {
ans[i] = 0;
} else {
ans[i] = 1;
box++;
}
}
cout << box << endl;
REP(i, n) {
if (ans[i] == 1) {
cout << i + 1;
if (i != n - 1) {
cout << " ";
}
}
}
if (box != 0) {
cout << endl;
}
}
| [
"literal.number.change",
"variable_declaration.value.change",
"identifier.change",
"control_flow.branch.if.condition.change"
] | 779,916 | 779,917 | u620059302 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
scanf("%d", &n);
vector<int> a(n + 1);
for (int i = 1; i <= n; ++i) {
scanf("%d", &a[i]);
}
vector<int> b(n + 1), ans;
for (int i = n; i >= 1; --i) {
int s = 0;
for (int j = i + i; j <= n; j += i) {
s ^= b[j];
}
if (s != a[i]) {
a[i] = 1;
ans.push_back(i);
}
}
printf("%d\n", int(ans.size()));
for (size_t i = 0; i < ans.size(); ++i)
printf("%d%c", ans[i], " \n"[i + 1 == ans.size()]);
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
scanf("%d", &n);
vector<int> a(n + 1);
for (int i = 1; i <= n; ++i) {
scanf("%d", &a[i]);
}
vector<int> b(n + 1), ans;
for (int i = n; i >= 1; --i) {
int s = 0;
for (int j = i + i; j <= n; j += i) {
s ^= b[j];
}
if (s != a[i]) {
b[i] = 1;
ans.push_back(i);
}
}
printf("%d\n", int(ans.size()));
for (size_t i = 0; i < ans.size(); ++i)
printf("%d%c", ans[i], " \n"[i + 1 == ans.size()]);
return 0;
}
| [
"assignment.variable.change",
"identifier.change"
] | 779,918 | 779,919 | u129325320 | cpp |
p02972 | #include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define dofloat cout << fixed << setprecision(8)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount __builtin_popcount
#define all(vec) vec.begin(), vec.end()
#define rall(vec) vec.rbegin(), vec.rend()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long, long long> pll;
typedef vector<pair<long long, long long>> vll;
typedef vector<pair<int, int>> vii;
typedef vector<int> vi;
typedef pair<int, int> ii;
const long long MOD = 1000000007;
const long long MAX = 100005;
const long double PI = 3.14159265359;
const long double G = 9.807;
const long long INF = 1e18;
const long double EPS = 1e-6;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
bool isprime(ll a) {
if (a == 2)
return 1;
if (!(a & 1))
return 0;
for (ll i = 3; i * i <= a; i += 2)
if (a % i == 0)
return 0;
return 1;
}
ll mpow(ll base, ll exponent, ll modulus) {
if (modulus == 1)
return 0;
long long result = 1;
base = base % modulus;
while (exponent) {
if (exponent % 2 == 1)
result = (result * base) % modulus;
exponent = exponent >> 1;
base = (base * base) % modulus;
}
return result;
}
ll minv(ll a, ll mod) {
ll _gcd = gcd(a, mod);
assert(_gcd == 1);
return mpow(a, mod - 2, mod);
}
/*
ll ncr(ll N,ll K){
if(N<K)return 0;
if(K==0)return 1;
if(N==0)return 0;
ll den=1;
for(ll i=1;i<=K;i++)den*=i;
ll num=1;
while(K--){
num*=N;
if(num%den==0){
num/=den;
den=1;
}
N--;
}
return num;
}
*/
ll n;
ll a[2 * MAX];
ll b[2 * MAX];
vl ans;
int main() {
FAST;
cin >> n;
for (ll i = 1; i <= n; i++) {
cin >> a[i];
}
for (ll i = n; i >= 1; i--) {
ll sum = 0;
for (ll j = i + i; j <= n; j += i) {
sum += b[i];
}
sum %= 2;
if (a[i] == sum) {
b[i] = 0;
} else {
b[i] = 1;
ans.pb(i);
}
}
sort(all(ans));
cout << ans.size() << '\n';
for (auto it : ans)
cout << it << ' ';
return 0;
} | #include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define dofloat cout << fixed << setprecision(8)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount __builtin_popcount
#define all(vec) vec.begin(), vec.end()
#define rall(vec) vec.rbegin(), vec.rend()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long, long long> pll;
typedef vector<pair<long long, long long>> vll;
typedef vector<pair<int, int>> vii;
typedef vector<int> vi;
typedef pair<int, int> ii;
const long long MOD = 1000000007;
const long long MAX = 100005;
const long double PI = 3.14159265359;
const long double G = 9.807;
const long long INF = 1e18;
const long double EPS = 1e-6;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
bool isprime(ll a) {
if (a == 2)
return 1;
if (!(a & 1))
return 0;
for (ll i = 3; i * i <= a; i += 2)
if (a % i == 0)
return 0;
return 1;
}
ll mpow(ll base, ll exponent, ll modulus) {
if (modulus == 1)
return 0;
long long result = 1;
base = base % modulus;
while (exponent) {
if (exponent % 2 == 1)
result = (result * base) % modulus;
exponent = exponent >> 1;
base = (base * base) % modulus;
}
return result;
}
ll minv(ll a, ll mod) {
ll _gcd = gcd(a, mod);
assert(_gcd == 1);
return mpow(a, mod - 2, mod);
}
/*
ll ncr(ll N,ll K){
if(N<K)return 0;
if(K==0)return 1;
if(N==0)return 0;
ll den=1;
for(ll i=1;i<=K;i++)den*=i;
ll num=1;
while(K--){
num*=N;
if(num%den==0){
num/=den;
den=1;
}
N--;
}
return num;
}
*/
ll n;
ll a[2 * MAX];
ll b[2 * MAX];
vl ans;
int main() {
FAST;
cin >> n;
for (ll i = 1; i <= n; i++) {
cin >> a[i];
}
for (ll i = n; i >= 1; i--) {
ll sum = 0;
for (ll j = i + i; j <= n; j += i) {
sum += b[j];
}
sum %= 2;
if (a[i] == sum) {
b[i] = 0;
} else {
b[i] = 1;
ans.pb(i);
}
}
sort(all(ans));
cout << ans.size() << '\n';
for (auto it : ans)
cout << it << ' ';
return 0;
} | [
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change"
] | 779,924 | 779,925 | u091650402 | cpp |
p02972 | #include <algorithm>
#include <complex>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#define REP(i, m, n) for (int i = int(m); i < int(n); i++)
#define RREP(i, m, n) for (int i = int(n) - 1; i >= int(m); --i)
#define EACH(i, c) for (auto &(i) : c)
#define all(c) begin(c), end(c)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort(begin(c), end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x) cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) \
do { \
} while (0)
#define dump(x) \
do { \
} while (0)
#define BR
#endif
using namespace std;
using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int, int>;
using VP = vector<PII>;
// struct edge {int from, to, cost;};
constexpr double EPS = 1e-10;
// constexpr double PI = acos(-1.0);
// constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
// inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}
template <class T> inline T sqr(T x) { return x * x; }
void solve() {
int n;
cin >> n;
VI a(n);
REP(i, 0, n) cin >> a[i];
VI b(n);
int cnt = 0;
RREP(i, 1, n + 1) {
int sum = 0;
for (int j = i + i; j <= n; j += i) {
sum += b[j - 1];
}
sum %= 2;
if (a[i - 1] != sum) {
b[i - 1] = 1;
++cnt;
}
// dump(b[i-1]);
}
REP(i, 0, n) {
int sum = 0;
for (int j = i; j < n; j += i + 1) {
sum += b[j];
}
if (sum % 2 != a[i]) {
// dump(i);
// dump(b[i]);
std::cout << -1 << endl;
return;
}
}
bool isf = true;
std::cout << b.size() << endl;
REP(i, 0, n) {
if (b[i] == 0)
continue;
if (!isf)
std::cout << " ";
std::cout << i + 1;
isf = false;
}
std::cout << endl;
}
int main() {
solve();
return 0;
} | #include <algorithm>
#include <complex>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#define REP(i, m, n) for (int i = int(m); i < int(n); i++)
#define RREP(i, m, n) for (int i = int(n) - 1; i >= int(m); --i)
#define EACH(i, c) for (auto &(i) : c)
#define all(c) begin(c), end(c)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort(begin(c), end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x) cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) \
do { \
} while (0)
#define dump(x) \
do { \
} while (0)
#define BR
#endif
using namespace std;
using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int, int>;
using VP = vector<PII>;
// struct edge {int from, to, cost;};
constexpr double EPS = 1e-10;
// constexpr double PI = acos(-1.0);
// constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
// inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}
template <class T> inline T sqr(T x) { return x * x; }
void solve() {
int n;
cin >> n;
VI a(n);
REP(i, 0, n) cin >> a[i];
VI b(n);
int cnt = 0;
RREP(i, 1, n + 1) {
int sum = 0;
for (int j = i + i; j <= n; j += i) {
sum += b[j - 1];
}
sum %= 2;
if (a[i - 1] != sum) {
b[i - 1] = 1;
++cnt;
}
// dump(b[i-1]);
}
REP(i, 0, n) {
int sum = 0;
for (int j = i; j < n; j += i + 1) {
sum += b[j];
}
if (sum % 2 != a[i]) {
// dump(i);
// dump(b[i]);
std::cout << -1 << endl;
return;
}
}
bool isf = true;
std::cout << cnt << endl;
REP(i, 0, n) {
if (b[i] == 0)
continue;
if (!isf)
std::cout << " ";
std::cout << i + 1;
isf = false;
}
std::cout << endl;
}
int main() {
solve();
return 0;
} | [
"expression.operation.binary.change",
"call.remove"
] | 779,928 | 779,929 | u608965386 | cpp |
p02972 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <string>
#include <vector>
using namespace std;
int main() {
int n;
vector<int> arr, sol;
int i, j;
int input;
int res;
arr.push_back(0);
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d", &input);
arr.push_back(input);
}
for (i = n / 2; i >= 1; i--) {
res = 0;
for (j = n / i; j > 1; j--) {
res = res && !arr[j * i] || !res && arr[j * i];
}
arr[j] = !res;
}
for (i = 1; i <= n; i++) {
if (arr[i]) {
sol.push_back(i);
}
}
printf("%d\n", sol.size());
for (i = 0; i < sol.size(); i++) {
printf("%d ", sol[i]);
}
printf("\n");
return 0;
} | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <string>
#include <vector>
using namespace std;
int main() {
int n;
vector<int> arr, sol;
int i, j;
int input;
int res;
arr.push_back(0);
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d", &input);
arr.push_back(input);
}
for (i = n / 2; i >= 1; i--) {
res = 0;
for (j = n / i; j >= 1; j--) {
res = res && !arr[j * i] || !res && arr[j * i];
}
arr[i] = res;
}
for (i = 1; i <= n; i++) {
if (arr[i]) {
sol.push_back(i);
}
}
printf("%d\n", sol.size());
for (i = 0; i < sol.size(); i++) {
printf("%d ", sol[i]);
}
printf("\n");
return 0;
} | [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change",
"assignment.variable.change",
"identifier.change",
"variable_access.subscript.index.change",
"expression.operation.unary.logical.remove"
] | 779,930 | 779,931 | u619248223 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i, s, n) for (int i = (s); i < (n); i++)
#define RFOR(i, s, n) for (int i = (n)-1; i >= (s); i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define ALL(a) a.begin(), a.end()
#define IN(a, x, b) (a <= x && x < b)
const long long MOD = 1e9 + 7, INF = 1e18;
template <class T> inline bool CHMAX(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool CHMIN(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
// auto f = [&](int n)->int{return n;};
// auto a = [&](auto&&b){b(b)};
signed main() {
int N;
cin >> N;
vector<int> a(N + 1);
vector<int> cnt(N + 1, 0);
FOR(i, 1, N + 1) cin >> a[i];
RFOR(i, 1, N + 1) {
int sum = 0;
for (int j = i * 2; j <= N; j += i) {
if (cnt[j])
sum++;
}
if (a[i] != sum % 2) {
cnt[i]++;
}
}
vector<int> ans;
FOR(i, 1, N + 1) if (a[i]) ans.push_back(i);
cout << ans.size() << endl;
REP(i, ans.size()) { cout << ans[i] << endl; }
} | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i, s, n) for (int i = (s); i < (n); i++)
#define RFOR(i, s, n) for (int i = (n)-1; i >= (s); i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define ALL(a) a.begin(), a.end()
#define IN(a, x, b) (a <= x && x < b)
const long long MOD = 1e9 + 7, INF = 1e18;
template <class T> inline bool CHMAX(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool CHMIN(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
// auto f = [&](int n)->int{return n;};
// auto a = [&](auto&&b){b(b)};
signed main() {
int N;
cin >> N;
vector<int> a(N + 1);
vector<int> cnt(N + 1, 0);
FOR(i, 1, N + 1) cin >> a[i];
RFOR(i, 1, N + 1) {
int sum = 0;
for (int j = i * 2; j <= N; j += i) {
if (cnt[j])
sum++;
}
if (a[i] != sum % 2) {
cnt[i]++;
}
}
vector<int> ans;
FOR(i, 1, N + 1) if (cnt[i]) ans.push_back(i);
cout << ans.size() << endl;
REP(i, ans.size()) { cout << ans[i] << endl; }
} | [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 779,932 | 779,933 | u693027786 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i, s, n) for (int i = (s); i < (n); i++)
#define RFOR(i, s, n) for (int i = (n)-1; i >= (s); i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define ALL(a) a.begin(), a.end()
#define IN(a, x, b) (a <= x && x < b)
const long long MOD = 1e9 + 7, INF = 1e18;
template <class T> inline bool CHMAX(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool CHMIN(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
// auto f = [&](int n)->int{return n;};
// auto a = [&](auto&&b){b(b)};
signed main() {
int N;
cin >> N;
vector<int> a(N + 1);
vector<int> cnt(N + 1, 0);
FOR(i, 1, N + 1) cin >> a[i];
RFOR(i, 1, N + 1) {
int sum = 0;
for (int j = i * 2; j <= N; j += i) {
if (cnt[j])
sum++;
}
if (a[i] != sum % 2) {
cnt[a[i]]++;
}
}
vector<int> ans;
FOR(i, 1, N + 1) if (a[i]) ans.push_back(i);
cout << ans.size() << endl;
REP(i, ans.size()) { cout << ans[i] << endl; }
} | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i, s, n) for (int i = (s); i < (n); i++)
#define RFOR(i, s, n) for (int i = (n)-1; i >= (s); i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define ALL(a) a.begin(), a.end()
#define IN(a, x, b) (a <= x && x < b)
const long long MOD = 1e9 + 7, INF = 1e18;
template <class T> inline bool CHMAX(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool CHMIN(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
// auto f = [&](int n)->int{return n;};
// auto a = [&](auto&&b){b(b)};
signed main() {
int N;
cin >> N;
vector<int> a(N + 1);
vector<int> cnt(N + 1, 0);
FOR(i, 1, N + 1) cin >> a[i];
RFOR(i, 1, N + 1) {
int sum = 0;
for (int j = i * 2; j <= N; j += i) {
if (cnt[j])
sum++;
}
if (a[i] != sum % 2) {
cnt[i]++;
}
}
vector<int> ans;
FOR(i, 1, N + 1) if (cnt[i]) ans.push_back(i);
cout << ans.size() << endl;
REP(i, ans.size()) { cout << ans[i] << endl; }
} | [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 779,934 | 779,933 | u693027786 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i, s, n) for (int i = (s); i < (n); i++)
#define RFOR(i, s, n) for (int i = (n)-1; i >= (s); i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define ALL(a) a.begin(), a.end()
#define IN(a, x, b) (a <= x && x < b)
const long long MOD = 1e9 + 7, INF = 1e18;
template <class T> inline bool CHMAX(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool CHMIN(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
// auto f = [&](int n)->int{return n;};
// auto a = [&](auto&&b){b(b)};
signed main() {
int N;
cin >> N;
vector<int> a(N + 1);
vector<int> cnt(N + 1, 0);
FOR(i, 1, N + 1) cin >> a[i];
RFOR(i, 1, N + 1) {
int sum = 0;
for (int j = i * 2; j <= N; j += i) {
if (a[j])
sum++;
}
if (a[i] != sum % 2) {
cnt[a[i]]++;
}
}
vector<int> ans;
FOR(i, 1, N + 1) if (a[i]) ans.push_back(i);
cout << ans.size() << endl;
REP(i, ans.size()) { cout << ans[i] << endl; }
} | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i, s, n) for (int i = (s); i < (n); i++)
#define RFOR(i, s, n) for (int i = (n)-1; i >= (s); i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define ALL(a) a.begin(), a.end()
#define IN(a, x, b) (a <= x && x < b)
const long long MOD = 1e9 + 7, INF = 1e18;
template <class T> inline bool CHMAX(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool CHMIN(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
// auto f = [&](int n)->int{return n;};
// auto a = [&](auto&&b){b(b)};
signed main() {
int N;
cin >> N;
vector<int> a(N + 1);
vector<int> cnt(N + 1, 0);
FOR(i, 1, N + 1) cin >> a[i];
RFOR(i, 1, N + 1) {
int sum = 0;
for (int j = i * 2; j <= N; j += i) {
if (cnt[j])
sum++;
}
if (a[i] != sum % 2) {
cnt[i]++;
}
}
vector<int> ans;
FOR(i, 1, N + 1) if (cnt[i]) ans.push_back(i);
cout << ans.size() << endl;
REP(i, ans.size()) { cout << ans[i] << endl; }
} | [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 779,935 | 779,933 | u693027786 | cpp |
p02972 | #include <algorithm>
#include <complex>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdio.h>
#include <string.h>
#include <string>
#include <time.h>
#include <vector>
using namespace std;
typedef long long int llint;
typedef pair<int, int> pint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<llint, llint>> vpllint;
#define rep(i, n) for (int i = 0; i < n; i++)
#define drep(i, n) for (int i = n - 1; 0 <= i; i--)
#define yes(ans) \
if (ans) \
cout << "yes" << endl; \
else \
cout << "no" << endl;
#define Yes(ans) \
if (ans) \
cout << "Yes" << endl; \
else \
cout << "No" << endl;
#define YES(ans) \
if (ans) \
cout << "YES" << endl; \
else \
cout << "NO" << endl;
#define POSSIBLE(ans) \
if (ans) \
cout << "POSSIBLE" << endl; \
else \
cout << "IMPOSSIBLE" << endl;
class UnionFind {
public:
//親の番号を格納する。親だった場合は-(その集合のサイズ)
vector<int> Parent;
//作るときはParentの値を全て-1にする
//こうすると全てバラバラになる
UnionFind(int N) { Parent = vector<int>(N, -1); }
// Aがどのグループに属しているか調べる
int root(int A) {
if (Parent[A] < 0)
return A;
return Parent[A] = root(Parent[A]);
}
//自分のいるグループの頂点数を調べる
int size(int A) {
return -Parent[root(A)]; //親をとってきたい
}
// AとBをくっ付ける
bool connect(int A, int B) {
// AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
A = root(A);
B = root(B);
if (A == B) {
//すでにくっついてるからくっ付けない
return false;
}
//大きい方(A)に小さいほう(B)をくっ付けたい
//大小が逆だったらひっくり返しちゃう。
if (size(A) < size(B))
swap(A, B);
// Aのサイズを更新する
Parent[A] += Parent[B];
// Bの親をAに変更する
Parent[B] = A;
return true;
}
};
// aとbの最大公約数を求めるよ
long long GCD(long long a, long long b) {
if (b == 0)
return a;
else
return GCD(b, a % b);
}
// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long &x, long long &y) {
if (b == 0) {
x = 1;
y = 0;
return a;
}
long long d = extGCD(b, a % b, y, x);
y -= a / b * x;
return d;
}
bool check(pair<int, int> a, pair<int, int> b) { return a < b; }
// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
long long b = m, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
u %= m;
if (u < 0)
u += m;
return u;
}
// aCbを1000000007で割った余りを求める
llint convination(llint a, llint b) {
llint ans = 1;
for (llint i = 0; i < b; i++) {
ans *= a - i;
ans %= 1000000007;
}
for (llint i = 1; i <= b; i++) {
ans *= modinv(i, 1000000007);
ans %= 1000000007;
}
return ans;
}
int main() {
int n;
cin >> n;
vint a(n);
rep(i, n) { cin >> a[i]; }
vint b(n, -1);
drep(i, n) {
if (i > n / 2) {
b[i] = a[i];
} else {
int tmp = (i + 1) * (n / (i + 1));
int cnt = 0;
for (int j = tmp; 1 <= j; j -= i + 1) {
if (b[j - 1] != -1) {
cnt += b[j - 1];
cnt %= 2;
} else {
if (cnt == a[i]) {
b[j - 1] = 0;
} else {
b[j - 1] = 1;
}
}
}
}
}
int cnt = 0;
rep(i, n) { cnt += b[i]; }
cout << cnt << endl;
rep(i, n) {
if (b[i] == 1) {
cout << b[i] << " ";
}
}
cout << endl;
return 0;
} | #include <algorithm>
#include <complex>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdio.h>
#include <string.h>
#include <string>
#include <time.h>
#include <vector>
using namespace std;
typedef long long int llint;
typedef pair<int, int> pint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<llint, llint>> vpllint;
#define rep(i, n) for (int i = 0; i < n; i++)
#define drep(i, n) for (int i = n - 1; 0 <= i; i--)
#define yes(ans) \
if (ans) \
cout << "yes" << endl; \
else \
cout << "no" << endl;
#define Yes(ans) \
if (ans) \
cout << "Yes" << endl; \
else \
cout << "No" << endl;
#define YES(ans) \
if (ans) \
cout << "YES" << endl; \
else \
cout << "NO" << endl;
#define POSSIBLE(ans) \
if (ans) \
cout << "POSSIBLE" << endl; \
else \
cout << "IMPOSSIBLE" << endl;
class UnionFind {
public:
//親の番号を格納する。親だった場合は-(その集合のサイズ)
vector<int> Parent;
//作るときはParentの値を全て-1にする
//こうすると全てバラバラになる
UnionFind(int N) { Parent = vector<int>(N, -1); }
// Aがどのグループに属しているか調べる
int root(int A) {
if (Parent[A] < 0)
return A;
return Parent[A] = root(Parent[A]);
}
//自分のいるグループの頂点数を調べる
int size(int A) {
return -Parent[root(A)]; //親をとってきたい
}
// AとBをくっ付ける
bool connect(int A, int B) {
// AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
A = root(A);
B = root(B);
if (A == B) {
//すでにくっついてるからくっ付けない
return false;
}
//大きい方(A)に小さいほう(B)をくっ付けたい
//大小が逆だったらひっくり返しちゃう。
if (size(A) < size(B))
swap(A, B);
// Aのサイズを更新する
Parent[A] += Parent[B];
// Bの親をAに変更する
Parent[B] = A;
return true;
}
};
// aとbの最大公約数を求めるよ
long long GCD(long long a, long long b) {
if (b == 0)
return a;
else
return GCD(b, a % b);
}
// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long &x, long long &y) {
if (b == 0) {
x = 1;
y = 0;
return a;
}
long long d = extGCD(b, a % b, y, x);
y -= a / b * x;
return d;
}
bool check(pair<int, int> a, pair<int, int> b) { return a < b; }
// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
long long b = m, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
u %= m;
if (u < 0)
u += m;
return u;
}
// aCbを1000000007で割った余りを求める
llint convination(llint a, llint b) {
llint ans = 1;
for (llint i = 0; i < b; i++) {
ans *= a - i;
ans %= 1000000007;
}
for (llint i = 1; i <= b; i++) {
ans *= modinv(i, 1000000007);
ans %= 1000000007;
}
return ans;
}
int main() {
int n;
cin >> n;
vint a(n);
rep(i, n) { cin >> a[i]; }
vint b(n, -1);
drep(i, n) {
if (i > n / 2) {
b[i] = a[i];
} else {
int tmp = (i + 1) * (n / (i + 1));
int cnt = 0;
for (int j = tmp; 1 <= j; j -= i + 1) {
if (b[j - 1] != -1) {
cnt += b[j - 1];
cnt %= 2;
} else {
if (cnt == a[i]) {
b[j - 1] = 0;
} else {
b[j - 1] = 1;
}
}
}
}
}
int cnt = 0;
rep(i, n) { cnt += b[i]; }
cout << cnt << endl;
rep(i, n) {
if (b[i] == 1) {
cout << i + 1 << " ";
}
}
cout << endl;
return 0;
} | [
"io.output.change"
] | 779,938 | 779,939 | u376082984 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll mod = 1e9 + 7;
#define N 200005
queue<int> q;
int a[N], b[N] = {0};
int main() {
int n;
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 += j) {
sum += b[j];
}
if (sum % 2 != a[i])
b[i] = 1, q.push(i);
}
cout << q.size() << endl;
while (q.size()) {
printf("%d\n", q.front());
q.pop();
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll mod = 1e9 + 7;
#define N 200005
queue<int> q;
int a[N], b[N] = {0};
int main() {
int n;
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 += b[j];
}
if (sum % 2 != a[i])
b[i] = 1, sum++, q.push(i);
}
cout << q.size() << endl;
while (q.size()) {
printf("%d\n", q.front());
q.pop();
}
return 0;
}
| [
"assignment.value.change",
"identifier.change"
] | 779,946 | 779,947 | u689939934 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, N) for (int i = 0, i##_max = (N); i < i##_max; ++i)
#define repp(i, l, r) for (int i = (l), i##_max = (r); i < i##_max; ++i)
#define per(i, N) for (int i = (N)-1; i >= 0; --i)
#define perr(i, l, r) for (int i = r - 1, i##_min(l); i >= i##_min; --i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP \
cin.tie(0); \
ios::sync_with_stdio(false);
#define MAX_I INT_MAX // 1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX // 1e9
#define MAX_LL LLONG_MAX // 1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX // 1e19
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<char, char> PCC;
typedef pair<ll, ll> PLL;
typedef pair<char, int> PCI;
typedef pair<int, char> PIC;
typedef pair<ll, int> PLI;
typedef pair<int, ll> PIL;
typedef pair<ll, char> PLC;
typedef pair<char, ll> PCL;
inline void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
inline void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
inline void Yay(bool b) { cout << (b ? "Yay!" : ":(") << endl; }
vector<int> multiple(int n, int N) {
vector<int> v;
for (int i = 2; i * n < N; i++)
v.push_back(i * n);
return v;
}
int main(void) {
SPEEDUP
cout << setprecision(15);
int N;
cin >> N;
vector<int> v(N);
vector<int> ans;
rep(i, N) cin >> v[i];
perr(n, 1, N + 1) {
vector<int> m = multiple(n, N);
for (int &s : m)
v[n - 1] ^= v[s - 1];
if (v[n - 1] == 1)
ans.push_back(n);
}
sort(all(ans));
cout << ans.size() << endl;
for (int &s : ans)
cout << s << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define rep(i, N) for (int i = 0, i##_max = (N); i < i##_max; ++i)
#define repp(i, l, r) for (int i = (l), i##_max = (r); i < i##_max; ++i)
#define per(i, N) for (int i = (N)-1; i >= 0; --i)
#define perr(i, l, r) for (int i = r - 1, i##_min(l); i >= i##_min; --i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP \
cin.tie(0); \
ios::sync_with_stdio(false);
#define MAX_I INT_MAX // 1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX // 1e9
#define MAX_LL LLONG_MAX // 1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX // 1e19
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<char, char> PCC;
typedef pair<ll, ll> PLL;
typedef pair<char, int> PCI;
typedef pair<int, char> PIC;
typedef pair<ll, int> PLI;
typedef pair<int, ll> PIL;
typedef pair<ll, char> PLC;
typedef pair<char, ll> PCL;
inline void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
inline void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
inline void Yay(bool b) { cout << (b ? "Yay!" : ":(") << endl; }
vector<int> multiple(int n, int N) {
vector<int> v;
for (int i = 2; i * n <= N; i++)
v.push_back(i * n);
return v;
}
int main(void) {
SPEEDUP
cout << setprecision(15);
int N;
cin >> N;
vector<int> v(N);
vector<int> ans;
rep(i, N) cin >> v[i];
perr(n, 1, N + 1) {
vector<int> m = multiple(n, N);
for (int &s : m)
v[n - 1] ^= v[s - 1];
if (v[n - 1] == 1)
ans.push_back(n);
}
sort(all(ans));
cout << ans.size() << endl;
for (int &s : ans)
cout << s << endl;
return 0;
}
| [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 779,948 | 779,949 | u069450081 | cpp |
p02972 | // Utkarsh.25dec
#include <bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define rep(i, n) for (ll i = 0; i < n; i++)
#define loop(i, a, b) for (ll i = a; i <= b; i++)
#define vi vector<int>
#define vs vector<string>
#define vc vector<char>
#define vl vector<ll>
#define all(c) (c).begin(), (c).end()
#define max3(a, b, c) max(max(a, b), c)
#define min3(a, b, c) min(min(a, b), c)
using namespace std;
const int N = 500023;
bool vis[N];
vector<int> adj[N];
void solve() {
ll n;
cin >> n;
vl v;
v.pb(0);
ll ans[n + 1] = {0};
rep(i, n) {
ll c;
cin >> c;
v.pb(c);
}
vl pos;
for (int i = n; i >= 1; i--) {
ll count = 0;
for (int j = 2 * i; j <= n; j++) {
if (ans[j] == 1)
count++;
}
if (count % 2 == v[i])
ans[i] = 0;
else {
ans[i] = 1;
pos.pb(i);
}
}
cout << pos.size() << '\n';
for (int i = 0; i < pos.size(); i++) {
cout << pos[i] << ' ';
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int T = 1;
// cin>>T;
int t = 0;
while (t++ < T) {
// cout<<"Case #"<<t<<":"<<' ';
solve();
// cout<<'\n';
}
} | // Utkarsh.25dec
#include <bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define rep(i, n) for (ll i = 0; i < n; i++)
#define loop(i, a, b) for (ll i = a; i <= b; i++)
#define vi vector<int>
#define vs vector<string>
#define vc vector<char>
#define vl vector<ll>
#define all(c) (c).begin(), (c).end()
#define max3(a, b, c) max(max(a, b), c)
#define min3(a, b, c) min(min(a, b), c)
using namespace std;
const int N = 500023;
bool vis[N];
vector<int> adj[N];
void solve() {
ll n;
cin >> n;
vl v;
v.pb(0);
ll ans[n + 1] = {0};
rep(i, n) {
ll c;
cin >> c;
v.pb(c);
}
vl pos;
for (int i = n; i >= 1; i--) {
ll count = 0;
for (int j = 2 * i; j <= n; j += i) {
if (ans[j] == 1)
count++;
}
if (count % 2 == v[i])
ans[i] = 0;
else {
ans[i] = 1;
pos.pb(i);
}
}
cout << pos.size() << '\n';
for (int i = 0; i < pos.size(); i++) {
cout << pos[i] << ' ';
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int T = 1;
// cin>>T;
int t = 0;
while (t++ < T) {
// cout<<"Case #"<<t<<":"<<' ';
solve();
// cout<<'\n';
}
} | [] | 779,950 | 779,951 | u596750443 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize( \
"-fno-defer-pop") // to pop argument of function as soon as it returns
#define all(a) a.begin(), a.end()
#define ll long long int
#define ld long double
ll power(ll a, ll b, ll m) {
if (b == 0)
return 1;
if (b == 1)
return a % m;
ll t = power(a, b / 2, m) % m;
t = (t * t) % m;
if (b & 1)
t = ((t % m) * (a % m)) % m;
return t;
}
ll modInverse(ll a, ll m) { return power(a, m - 2, m); }
#define ps push_back
#define fs first
#define takeline cin.ignore();
#define sc second
#define N 3000005
#define endl "\n"
#define mod 1000000007
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
ll i, j, k, l, n;
cin >> n;
ll ar[n + 1];
for (i = 1; i <= n; i++) {
cin >> ar[i];
}
ll flg = 1, pt[n + 1] = {0};
for (i = n; i >= 1; i--) {
ll c = 0;
for (j = i; j <= n; j += i) {
c += pt[i];
}
if (c % 2 == 0) {
if (ar[i] == 0)
pt[i] = 0;
else
pt[i] = 1;
} else {
if (ar[i] == 0)
pt[i] = 1;
else
pt[i] = 0;
}
}
vector<ll> vc;
for (i = 1; i <= n; i++) {
if (pt[i]) {
vc.ps(i);
}
}
cout << vc.size() << endl;
for (auto it : vc) {
cout << it << " ";
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize( \
"-fno-defer-pop") // to pop argument of function as soon as it returns
#define all(a) a.begin(), a.end()
#define ll long long int
#define ld long double
ll power(ll a, ll b, ll m) {
if (b == 0)
return 1;
if (b == 1)
return a % m;
ll t = power(a, b / 2, m) % m;
t = (t * t) % m;
if (b & 1)
t = ((t % m) * (a % m)) % m;
return t;
}
ll modInverse(ll a, ll m) { return power(a, m - 2, m); }
#define ps push_back
#define fs first
#define takeline cin.ignore();
#define sc second
#define N 3000005
#define endl "\n"
#define mod 1000000007
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
ll i, j, k, l, n;
cin >> n;
ll ar[n + 1];
for (i = 1; i <= n; i++) {
cin >> ar[i];
}
ll flg = 1, pt[n + 1] = {0};
for (i = n; i >= 1; i--) {
ll c = 0;
for (j = i; j <= n; j += i) {
c += pt[j];
}
if (c % 2 == 0) {
if (ar[i] == 0)
pt[i] = 0;
else
pt[i] = 1;
} else {
if (ar[i] == 0)
pt[i] = 1;
else
pt[i] = 0;
}
}
vector<ll> vc;
for (i = 1; i <= n; i++) {
if (pt[i]) {
vc.ps(i);
}
}
cout << vc.size() << endl;
for (auto it : vc) {
cout << it << " ";
}
return 0;
} | [
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change"
] | 779,952 | 779,953 | u838261804 | cpp |
p02972 | #include <cstdio>
#define M 200005
int A[M], B[M];
int main() {
int n;
scanf("%d", &n);
for (int i = 1; i <= n; i++)
scanf("%d", &A[i]);
int cnt = 0;
for (int i = n; i >= 1; i--) {
for (int j = i + i; j <= n; j += i) {
A[i] ^= A[j];
}
if (A[i])
cnt++;
}
printf("%d\n", cnt);
for (int i = 1; i <= n; i++) {
if (A[i])
printf("%d ", A[i]);
}
return 0;
} | #include <cstdio>
#define M 200005
int A[M], B[M];
int main() {
int n;
scanf("%d", &n);
for (int i = 1; i <= n; i++)
scanf("%d", &A[i]);
int cnt = 0;
for (int i = n; i >= 1; i--) {
for (int j = i + i; j <= n; j += i) {
A[i] ^= A[j];
}
if (A[i])
cnt++;
}
printf("%d\n", cnt);
for (int i = 1; i <= n; i++) {
if (A[i])
printf("%d ", i);
}
return 0;
} | [
"call.arguments.change"
] | 779,956 | 779,957 | u934118424 | cpp |
p02972 | #include <bits/stdc++.h> //Written by ThiDaiLoc
using namespace std; // Team Three Wolves
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<ll> vi;
typedef pair<ll, ll> pll;
typedef pair<ll, pll> triple;
#define fu(i, a, b) for (ll i = a; i <= b; i++)
#define f1(i, n) for (ll i = 1; i <= n; i++)
#define fs(i, s) for (ll i = 0; i + 1 <= s.length(); i++)
#define fd(i, b, a) for (ll i = b; i >= a; i--)
#define fuv(i, a) for (ll i = 0; i < a.size(); i++)
#define fdv(i, a) for (ll i = (ll)a.size() - 1; i >= 0; i--)
#define ms(a, x) memset(a, x, sizeof a)
#define prec(n) fixed << setprecision(n)
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb(i) push_back(i)
#define popb() pop_back()
#define sc(a) cin >> a
#define sc2(a, b) cin >> a >> b
#define pr(a) cout << a << endl
#define pr2(a, b) cout << a << " " << b << endl
#define rpr(a) return cout << a << endl, 0
#define prY cout << "YES" << endl
#define prN cout << "NO" << endl
#define bit(n, i) (((n) >> (i)) & 1)
#define lowb(a, n, x) lower_bound(a, a + n, x) - a
#define lowb2(a, x) lower_bound(all(a), x) - a.begin()
#define all(x) (x).begin(), (x).end()
#define sz(a) (ll) a.size()
#define le(s) (ll) s.length()
#define ast(x, a, b) assert(x >= a and x <= b)
#define re return
#define mp(a, b) make_pair(a, b)
#define se second
#define fi first
#define debug(x) cerr << #x << " = " << x << endl
#define INPUT freopen("locin.txt", "r", stdin)
#define OUTPUT freopen("locout.txt", "w", stdout)
inline ll isqrt(ll k) {
ll r = sqrt(k) + 1;
while (r * r > k)
r--;
return r;
}
inline ll icbrt(ll k) {
ll r = cbrt(k) + 1;
while (r * r * r > k)
r--;
return r;
}
inline ll mnz(ll &a, ll b) { return a = (a > b ? b : a); }
inline ll mxz(ll &a, ll b) { return a = (a < b ? b : a); }
inline string toString(ll n) {
stringstream ss;
ss << n;
return ss.str();
}
double const eps = 1e-6;
ll const Base = 1e9 + 7, oo = 1e17, MAXN = 1e6;
ll A[MAXN + 5], B[MAXN + 5];
ll Solves() {
ll n, m, k, cnt = 0, ans = 0, x, y, q, c, sum = 0, v, t;
// PROCESS IN HERE
sc(n);
f1(i, n) sc(A[i]);
fd(i, n, 1) {
c = 0;
for (ll j = i + i; j <= n; j++)
c ^= B[j];
if (c ^ A[i])
B[i] = 1, ans++;
}
pr(ans);
f1(i, n) if (B[i]) cout << i << " ";
re 0;
// Hack it if you can :)
}
int main() {
// INPUT;
ll JUDGE_ONLINE = 1;
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll test = 1;
// sc(test);
fu(T, 1, test) {
// cout<<"Case #"<<T<<": ";
Solves();
}
if (!JUDGE_ONLINE)
cout << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
} | #include <bits/stdc++.h> //Written by ThiDaiLoc
using namespace std; // Team Three Wolves
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<ll> vi;
typedef pair<ll, ll> pll;
typedef pair<ll, pll> triple;
#define fu(i, a, b) for (ll i = a; i <= b; i++)
#define f1(i, n) for (ll i = 1; i <= n; i++)
#define fs(i, s) for (ll i = 0; i + 1 <= s.length(); i++)
#define fd(i, b, a) for (ll i = b; i >= a; i--)
#define fuv(i, a) for (ll i = 0; i < a.size(); i++)
#define fdv(i, a) for (ll i = (ll)a.size() - 1; i >= 0; i--)
#define ms(a, x) memset(a, x, sizeof a)
#define prec(n) fixed << setprecision(n)
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb(i) push_back(i)
#define popb() pop_back()
#define sc(a) cin >> a
#define sc2(a, b) cin >> a >> b
#define pr(a) cout << a << endl
#define pr2(a, b) cout << a << " " << b << endl
#define rpr(a) return cout << a << endl, 0
#define prY cout << "YES" << endl
#define prN cout << "NO" << endl
#define bit(n, i) (((n) >> (i)) & 1)
#define lowb(a, n, x) lower_bound(a, a + n, x) - a
#define lowb2(a, x) lower_bound(all(a), x) - a.begin()
#define all(x) (x).begin(), (x).end()
#define sz(a) (ll) a.size()
#define le(s) (ll) s.length()
#define ast(x, a, b) assert(x >= a and x <= b)
#define re return
#define mp(a, b) make_pair(a, b)
#define se second
#define fi first
#define debug(x) cerr << #x << " = " << x << endl
#define INPUT freopen("locin.txt", "r", stdin)
#define OUTPUT freopen("locout.txt", "w", stdout)
inline ll isqrt(ll k) {
ll r = sqrt(k) + 1;
while (r * r > k)
r--;
return r;
}
inline ll icbrt(ll k) {
ll r = cbrt(k) + 1;
while (r * r * r > k)
r--;
return r;
}
inline ll mnz(ll &a, ll b) { return a = (a > b ? b : a); }
inline ll mxz(ll &a, ll b) { return a = (a < b ? b : a); }
inline string toString(ll n) {
stringstream ss;
ss << n;
return ss.str();
}
double const eps = 1e-6;
ll const Base = 1e9 + 7, oo = 1e17, MAXN = 1e6;
ll A[MAXN + 5], B[MAXN + 5];
ll Solves() {
ll n, m, k, cnt = 0, ans = 0, x, y, q, c, sum = 0, v, t;
// PROCESS IN HERE
sc(n);
f1(i, n) sc(A[i]);
fd(i, n, 1) {
c = 0;
for (ll j = i + i; j <= n; j += i)
c ^= B[j];
if (c ^ A[i])
B[i] = 1, ans++;
}
pr(ans);
f1(i, n) if (B[i]) cout << i << " ";
re 0;
// Hack it if you can :)
}
int main() {
// INPUT;
ll JUDGE_ONLINE = 1;
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll test = 1;
// sc(test);
fu(T, 1, test) {
// cout<<"Case #"<<T<<": ";
Solves();
}
if (!JUDGE_ONLINE)
cout << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
} | [] | 779,960 | 779,961 | u104888333 | cpp |
p02972 | #include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int(i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for (int(i) = (a)-1; (i) >= 0; (i)--)
#define FORR(i, a, b) for (int(i) = (a)-1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template <typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define EB emplace_back
#define GREATER(T) T, VT<T> greater<T>
template <typename T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <typename T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;
// 約数列挙
// (O√n)
std::vector<long long> divisor(const long long n, const bool to_sort) {
std::vector<long long> ret;
if (n > 1)
for (long long i = 1; i * i <= n; i++) {
if (n % i == 0) {
ret.emplace_back(i);
if (i != n / i && i != 1) {
ret.emplace_back(n / i);
}
}
}
if (to_sort) {
std::sort(std::begin(ret), std::end(ret));
}
return ret;
}
const int MAX = 2e5 + 10;
int N;
int a[MAX], cnt[MAX];
int ans[MAX];
int main(void) {
cin >> N;
REP(i, N) { cin >> a[i]; }
RREP(i, N) {
const int need = a[i];
if (cnt[i] % 2 != need) {
ans[i] = 1;
cnt[i]++;
auto divs = divisor(i + 1, true);
FORE(e, divs) { cnt[e]++; }
}
}
VI anses;
REP(i, N) if (ans[i]) { anses.EB(i + 1); }
cout << anses.size() << endl;
FORE(e, anses) cout << e << endl;
}
| #include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int(i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for (int(i) = (a)-1; (i) >= 0; (i)--)
#define FORR(i, a, b) for (int(i) = (a)-1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template <typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define EB emplace_back
#define GREATER(T) T, VT<T> greater<T>
template <typename T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <typename T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;
// 約数列挙
// (O√n)
std::vector<long long> divisor(const long long n, const bool to_sort) {
std::vector<long long> ret;
if (n > 1)
for (long long i = 1; i * i <= n; i++) {
if (n % i == 0) {
ret.emplace_back(i);
if (i != n / i && i != 1) {
ret.emplace_back(n / i);
}
}
}
if (to_sort) {
std::sort(std::begin(ret), std::end(ret));
}
return ret;
}
const int MAX = 2e5 + 10;
int N;
int a[MAX], cnt[MAX];
int ans[MAX];
int main(void) {
cin >> N;
REP(i, N) { cin >> a[i]; }
RREP(i, N) {
const int need = a[i];
if (cnt[i] % 2 != need) {
ans[i] = 1;
cnt[i]++;
auto divs = divisor(i + 1, true);
FORE(e, divs) { cnt[e - 1]++; }
}
}
VI anses;
REP(i, N) if (ans[i]) { anses.EB(i + 1); }
cout << anses.size() << endl;
FORE(e, anses) cout << e << endl;
}
| [
"expression.operation.binary.add"
] | 779,962 | 779,963 | u443010331 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
#define _for(i, j, N) for (int i = (j); i < (N); i++)
#define _rep(i, j, N) for (int i = (j); i <= (N); i++)
#define _dec(i, N, j) for (int i = (N - 1); i >= (j); i--)
#define _rec(i, N, j) for (int i = (N); i >= (j); i--)
#define ALL(x) x.begin(), x.end()
#define MEM(a, n) memset(a, n, sizeof(a))
#define fst first
#define scd second
#define PB push_back
#define MP make_pair
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
int get_int() {
int x;
scanf("%d", &x);
return x;
}
LL get_ll() {
LL x;
scanf("%lld", &x);
return x;
}
double get_db() {
double x;
scanf("%lf", &x);
return x;
}
template <typename T> int chmin(T &a, T &b) {
if (a > b) {
a = b;
return 1;
} else
return 0;
}
template <typename T> int chmax(T &a, T &b) {
if (a < b) {
a = b;
return 1;
} else
return 0;
}
template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) {
_for(i, 0, v.size()) os << v[i] << " ";
return os;
}
template <typename T> ostream &operator<<(ostream &os, const set<T> &v) {
for (auto a : v)
os << a << " ";
return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &v) {
os << v.fst << " " << v.scd << " ";
return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const map<T1, T2> &v) {
for (auto a : v)
cout << a << endl;
return os;
}
static const int dx[8] = {1, 0, -1, 0, 1, -1, 1, -1};
static const int dy[8] = {0, 1, 0, -1, 1, -1, -1, 1};
const double pi = acos(-1.0);
const double eps = 1e-8;
const LL INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
int N;
const int maxn = 2e5 + 5;
int B[maxn];
int A[maxn];
int main() {
cin >> N;
_rep(i, 1, N) cin >> B[i];
int k = 0;
for (int i = N; i >= 1; i--) {
int sum = 0;
for (int j = i * 2; j <= N; j += i) {
sum += B[j];
}
sum %= 2;
A[i] = sum ^ B[i];
if (A[i])
k++;
}
cout << k << endl;
int first = true;
_rep(i, 1, N) {
if (!first)
printf(" ");
else
first = false;
if (A[i])
printf("%d", i);
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define _for(i, j, N) for (int i = (j); i < (N); i++)
#define _rep(i, j, N) for (int i = (j); i <= (N); i++)
#define _dec(i, N, j) for (int i = (N - 1); i >= (j); i--)
#define _rec(i, N, j) for (int i = (N); i >= (j); i--)
#define ALL(x) x.begin(), x.end()
#define MEM(a, n) memset(a, n, sizeof(a))
#define fst first
#define scd second
#define PB push_back
#define MP make_pair
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
int get_int() {
int x;
scanf("%d", &x);
return x;
}
LL get_ll() {
LL x;
scanf("%lld", &x);
return x;
}
double get_db() {
double x;
scanf("%lf", &x);
return x;
}
template <typename T> int chmin(T &a, T &b) {
if (a > b) {
a = b;
return 1;
} else
return 0;
}
template <typename T> int chmax(T &a, T &b) {
if (a < b) {
a = b;
return 1;
} else
return 0;
}
template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) {
_for(i, 0, v.size()) os << v[i] << " ";
return os;
}
template <typename T> ostream &operator<<(ostream &os, const set<T> &v) {
for (auto a : v)
os << a << " ";
return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &v) {
os << v.fst << " " << v.scd << " ";
return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const map<T1, T2> &v) {
for (auto a : v)
cout << a << endl;
return os;
}
static const int dx[8] = {1, 0, -1, 0, 1, -1, 1, -1};
static const int dy[8] = {0, 1, 0, -1, 1, -1, -1, 1};
const double pi = acos(-1.0);
const double eps = 1e-8;
const LL INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
int N;
const int maxn = 2e5 + 5;
int B[maxn];
int A[maxn];
int main() {
cin >> N;
_rep(i, 1, N) cin >> B[i];
int k = 0;
for (int i = N; i >= 1; i--) {
int sum = 0;
for (int j = i * 2; j <= N; j += i) {
sum += A[j];
}
sum %= 2;
A[i] = sum ^ B[i];
if (A[i])
k++;
}
cout << k << endl;
int first = true;
_rep(i, 1, N) {
if (!first)
printf(" ");
else
first = false;
if (A[i])
printf("%d", i);
}
return 0;
}
| [
"assignment.value.change",
"identifier.change"
] | 779,964 | 779,965 | u066651036 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
#define _for(i, j, N) for (int i = (j); i < (N); i++)
#define _rep(i, j, N) for (int i = (j); i <= (N); i++)
#define _dec(i, N, j) for (int i = (N - 1); i >= (j); i--)
#define _rec(i, N, j) for (int i = (N); i >= (j); i--)
#define ALL(x) x.begin(), x.end()
#define MEM(a, n) memset(a, n, sizeof(a))
#define fst first
#define scd second
#define PB push_back
#define MP make_pair
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
int get_int() {
int x;
scanf("%d", &x);
return x;
}
LL get_ll() {
LL x;
scanf("%lld", &x);
return x;
}
double get_db() {
double x;
scanf("%lf", &x);
return x;
}
template <typename T> int chmin(T &a, T &b) {
if (a > b) {
a = b;
return 1;
} else
return 0;
}
template <typename T> int chmax(T &a, T &b) {
if (a < b) {
a = b;
return 1;
} else
return 0;
}
template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) {
_for(i, 0, v.size()) os << v[i] << " ";
return os;
}
template <typename T> ostream &operator<<(ostream &os, const set<T> &v) {
for (auto a : v)
os << a << " ";
return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &v) {
os << v.fst << " " << v.scd << " ";
return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const map<T1, T2> &v) {
for (auto a : v)
cout << a << endl;
return os;
}
static const int dx[8] = {1, 0, -1, 0, 1, -1, 1, -1};
static const int dy[8] = {0, 1, 0, -1, 1, -1, -1, 1};
const double pi = acos(-1.0);
const double eps = 1e-8;
const LL INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
int N;
const int maxn = 1e5 + 5;
int B[maxn];
int A[maxn];
int main() {
cin >> N;
_rep(i, 1, N) cin >> B[i];
int k = 0;
for (int i = N; i >= 1; i--) {
int sum = 0;
for (int j = i * 2; j <= N; j += i) {
sum += B[j];
}
sum %= 2;
A[i] = sum ^ B[i];
if (A[i])
k++;
}
cout << k << endl;
int first = true;
_rep(i, 1, N) {
if (!first)
printf(" ");
else
first = false;
if (A[i])
printf("%d", i);
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define _for(i, j, N) for (int i = (j); i < (N); i++)
#define _rep(i, j, N) for (int i = (j); i <= (N); i++)
#define _dec(i, N, j) for (int i = (N - 1); i >= (j); i--)
#define _rec(i, N, j) for (int i = (N); i >= (j); i--)
#define ALL(x) x.begin(), x.end()
#define MEM(a, n) memset(a, n, sizeof(a))
#define fst first
#define scd second
#define PB push_back
#define MP make_pair
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
int get_int() {
int x;
scanf("%d", &x);
return x;
}
LL get_ll() {
LL x;
scanf("%lld", &x);
return x;
}
double get_db() {
double x;
scanf("%lf", &x);
return x;
}
template <typename T> int chmin(T &a, T &b) {
if (a > b) {
a = b;
return 1;
} else
return 0;
}
template <typename T> int chmax(T &a, T &b) {
if (a < b) {
a = b;
return 1;
} else
return 0;
}
template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) {
_for(i, 0, v.size()) os << v[i] << " ";
return os;
}
template <typename T> ostream &operator<<(ostream &os, const set<T> &v) {
for (auto a : v)
os << a << " ";
return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &v) {
os << v.fst << " " << v.scd << " ";
return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const map<T1, T2> &v) {
for (auto a : v)
cout << a << endl;
return os;
}
static const int dx[8] = {1, 0, -1, 0, 1, -1, 1, -1};
static const int dy[8] = {0, 1, 0, -1, 1, -1, -1, 1};
const double pi = acos(-1.0);
const double eps = 1e-8;
const LL INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
int N;
const int maxn = 2e5 + 5;
int B[maxn];
int A[maxn];
int main() {
cin >> N;
_rep(i, 1, N) cin >> B[i];
int k = 0;
for (int i = N; i >= 1; i--) {
int sum = 0;
for (int j = i * 2; j <= N; j += i) {
sum += A[j];
}
sum %= 2;
A[i] = sum ^ B[i];
if (A[i])
k++;
}
cout << k << endl;
int first = true;
_rep(i, 1, N) {
if (!first)
printf(" ");
else
first = false;
if (A[i])
printf("%d", i);
}
return 0;
}
| [
"literal.number.change",
"expression.operation.binary.change",
"assignment.value.change",
"identifier.change"
] | 779,966 | 779,965 | u066651036 | cpp |
p02972 | #include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using ll = int64_t;
using ull = uint64_t;
constexpr ll INF = numeric_limits<ll>::max() / 4;
namespace utils {
template <class T, class Compare>
using p_queue = priority_queue<T, vector<T>, Compare>;
template <class T> using min_queue = p_queue<T, greater<T>>;
template <class T> using max_queue = p_queue<T, less<T>>;
template <class T> bool min_update(T &X, const T &A) {
if (X > A) {
X = A;
return true;
}
return false;
}
template <class T> bool max_update(T &X, const T &A) {
if (X < A) {
X = A;
return true;
}
return false;
}
using V_Set = unordered_set<int>;
using E_Set = unordered_map<int, V_Set>;
#define ALL(x) begin(x), end(x)
#define rALL(x) rbegin(x), rend(x)
} // namespace utils
using namespace utils;
void sub_main(istream &is) {
ll N;
is >> N;
if (!is)
return;
vector<int> A(N);
for (auto &&a : A) {
is >> a;
} // end a
vector<int> in(N);
int sum = 0;
for (int i = N; i > 0; i--) {
int parity = 0;
for (int j = i + i; j < N; j += i) {
parity = parity ^ in[j - 1];
} // end j
if (parity ^ A[i - 1]) {
in[i - 1] = 1;
sum++;
}
} // end i
cout << sum << endl;
for (int k = 0; k < N; ++k) {
if (in[k] == 1)
cout << k + 1 << " ";
} // end k
cout << endl;
}
int main(int argc, char *argv[]) {
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << setprecision(16) << scientific;
#ifdef DEBUG
string test_cases = "test_D.txt";
cerr << "DEBUG MODE" << endl;
cerr << test_cases << " -->" << endl;
auto fs = fstream(test_cases, fstream::in);
int lp = 0;
while (fs) {
lp++;
cout << lp << "#------\n";
sub_main(fs);
}
cout << "------#" << endl;
if (lp <= 1)
sub_main(cin);
#else
sub_main(cin);
#endif
return 0;
}
| #include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using ll = int64_t;
using ull = uint64_t;
constexpr ll INF = numeric_limits<ll>::max() / 4;
namespace utils {
template <class T, class Compare>
using p_queue = priority_queue<T, vector<T>, Compare>;
template <class T> using min_queue = p_queue<T, greater<T>>;
template <class T> using max_queue = p_queue<T, less<T>>;
template <class T> bool min_update(T &X, const T &A) {
if (X > A) {
X = A;
return true;
}
return false;
}
template <class T> bool max_update(T &X, const T &A) {
if (X < A) {
X = A;
return true;
}
return false;
}
using V_Set = unordered_set<int>;
using E_Set = unordered_map<int, V_Set>;
#define ALL(x) begin(x), end(x)
#define rALL(x) rbegin(x), rend(x)
} // namespace utils
using namespace utils;
void sub_main(istream &is) {
ll N;
is >> N;
if (!is)
return;
vector<int> A(N);
for (auto &&a : A) {
is >> a;
} // end a
vector<int> in(N);
int sum = 0;
for (int i = N; i > 0; i--) {
int parity = 0;
for (int j = i + i; j <= N; j += i) {
parity = parity ^ in[j - 1];
} // end j
if (parity ^ A[i - 1]) {
in[i - 1] = 1;
sum++;
}
} // end i
cout << sum << endl;
for (int k = 0; k < N; ++k) {
if (in[k] == 1)
cout << k + 1 << " ";
} // end k
cout << endl;
}
int main(int argc, char *argv[]) {
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << setprecision(16) << scientific;
#ifdef DEBUG
string test_cases = "test_D.txt";
cerr << "DEBUG MODE" << endl;
cerr << test_cases << " -->" << endl;
auto fs = fstream(test_cases, fstream::in);
int lp = 0;
while (fs) {
lp++;
cout << lp << "#------\n";
sub_main(fs);
}
cout << "------#" << endl;
if (lp <= 1)
sub_main(cin);
#else
sub_main(cin);
#endif
return 0;
}
| [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 779,967 | 779,968 | u896838289 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
#define REP(i, n, m) for (ll i = n; i < (ll)m; ++i)
#define IREP(i, n, m) for (ll i = n - 1; i >= m; --i)
#define rep(i, n) REP(i, 0, n)
#define irep(i, n) IREP(i, n, 0)
#define all(v) v.begin(), v.end()
int main() {
ll N;
cin >> N;
vll a(N + 1);
rep(i, N) { cin >> a[i + 1]; }
vll b(N + 1, -1);
IREP(i, N + 1, 1) {
ll count = 0;
for (ll j = i + i; j <= N; j += i) {
count += b[j];
}
b[i] = (count + a[i]) % 2;
}
ll count = 0;
rep(i, N) { count += b[i + 1]; }
cout << count << endl;
rep(i, N) {
if (b[i + 1] > 0)
cout << b[i + 1] << endl;
}
}
| #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
#define REP(i, n, m) for (ll i = n; i < (ll)m; ++i)
#define IREP(i, n, m) for (ll i = n - 1; i >= m; --i)
#define rep(i, n) REP(i, 0, n)
#define irep(i, n) IREP(i, n, 0)
#define all(v) v.begin(), v.end()
int main() {
ll N;
cin >> N;
vll a(N + 1);
rep(i, N) { cin >> a[i + 1]; }
vll b(N + 1, -1);
IREP(i, N + 1, 1) {
ll count = 0;
for (ll j = i + i; j <= N; j += i) {
count += b[j];
}
b[i] = (count + a[i]) % 2;
}
ll count = 0;
rep(i, N) { count += b[i + 1]; }
cout << count << endl;
rep(i, N) {
if (b[i + 1] > 0)
cout << (i + 1) << endl;
}
}
| [
"io.output.change"
] | 779,969 | 779,970 | u059082716 | cpp |
p02972 | #define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <string>
#include <time.h>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
int N, a[212345], c[212345];
vector<int64_t> divisor(int64_t n) {
vector<int64_t> ret;
for (int64_t i = 1; i * i <= n; i++) {
if (n % i == 0) {
ret.push_back(i);
if (i * i != n)
ret.push_back(n / i);
}
}
sort(begin(ret), end(ret));
return (ret);
}
int main() {
scanf("%d", &N);
rep(i, N) scanf("%d", &a[i]);
vector<int> ans;
rep(i, N) {
if (c[N - 1 - i] != a[N - 1 - i]) {
ans.push_back(N - i);
auto d = divisor(N - i);
for (auto dd : d) {
c[dd]++;
}
}
}
printf("%d\n", ans.size());
for (auto aa : ans)
printf("%d ", aa);
return 0;
}
| #define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <string>
#include <time.h>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
int N, a[212345], c[212345];
vector<int64_t> divisor(int64_t n) {
vector<int64_t> ret;
for (int64_t i = 1; i * i <= n; i++) {
if (n % i == 0) {
ret.push_back(i);
if (i * i != n)
ret.push_back(n / i);
}
}
sort(begin(ret), end(ret));
return (ret);
}
int main() {
scanf("%d", &N);
rep(i, N) scanf("%d", &a[i]);
vector<int> ans;
rep(i, N) {
if ((c[N - 1 - i] % 2) != a[N - 1 - i]) {
ans.push_back(N - i);
auto d = divisor(N - i);
for (auto dd : d) {
c[dd - 1]++;
}
}
}
printf("%d\n", ans.size());
for (auto aa : ans)
printf("%d ", aa);
return 0;
}
| [
"control_flow.branch.if.condition.change"
] | 779,973 | 779,972 | u810616694 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
#define rep(i, x, y) \
for (i64 i = i64(x), i##_max_for_repmacro = i64(y); \
i < i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif
constexpr int inf = 1.01e9;
constexpr i64 inf64 = 4.01e18;
constexpr double eps = 1e-9;
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
os << "(" << p.first << ", " << p.second << ")";
return os;
}
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {
os << "[";
for (const auto &v : vec) {
os << v << ",";
}
os << "]";
return os;
}
template <typename T> bool chmin(T &a, const T &b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <typename T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <typename A, typename T, size_t size>
void fill(A (&ary)[size], const T &val) {
fill((T *)ary, (T *)(ary + size), val);
}
void solve() {
// constexpr i64 mod = 1'000'000'007;
i64 N;
cin >> N;
vector<i64> a(N);
rep(i, 0, N) cin >> a[i];
vector<i64> b(N, -1);
for (i64 i = N - 1; i >= 0; --i) {
print(i);
print(b);
i64 j = i + 1, box = -1, sum = 0;
rep(k, 1, N + 1) {
i64 l = j * k;
if (l - 1 >= N)
break;
print(l - 1);
if (b[l - 1] == -1) {
box = l - 1;
continue;
}
sum += b[l - 1];
}
print(box);
print(sum);
if (box != -1)
b[box] = (sum + a[i]) % 2;
else if (sum % 2 != a[i]) {
cout << -1 << endl;
return;
}
}
vector<i64> ans;
rep(i, 0, N) {
if (b[i] != 0)
ans.emplace_back(b[i]);
}
i64 M = ans.size();
cout << ans.size() << endl;
rep(i, 0, M) {
cout << ans[i];
if (i == M - 1)
cout << endl;
else
cout << " ";
}
}
int main() {
std::cin.tie(0);
std::ios::sync_with_stdio(false);
cout.setf(ios::fixed);
cout.precision(16);
solve();
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
#define rep(i, x, y) \
for (i64 i = i64(x), i##_max_for_repmacro = i64(y); \
i < i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif
constexpr int inf = 1.01e9;
constexpr i64 inf64 = 4.01e18;
constexpr double eps = 1e-9;
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
os << "(" << p.first << ", " << p.second << ")";
return os;
}
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {
os << "[";
for (const auto &v : vec) {
os << v << ",";
}
os << "]";
return os;
}
template <typename T> bool chmin(T &a, const T &b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <typename T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <typename A, typename T, size_t size>
void fill(A (&ary)[size], const T &val) {
fill((T *)ary, (T *)(ary + size), val);
}
void solve() {
// constexpr i64 mod = 1'000'000'007;
i64 N;
cin >> N;
vector<i64> a(N);
rep(i, 0, N) cin >> a[i];
vector<i64> b(N, -1);
for (i64 i = N - 1; i >= 0; --i) {
print(i);
print(b);
i64 j = i + 1, box = -1, sum = 0;
rep(k, 1, N + 1) {
i64 l = j * k;
if (l - 1 >= N)
break;
print(l - 1);
if (b[l - 1] == -1) {
box = l - 1;
continue;
}
sum += b[l - 1];
}
print(box);
print(sum);
if (box != -1)
b[box] = (sum + a[i]) % 2;
else if (sum % 2 != a[i]) {
cout << -1 << endl;
return;
}
}
vector<i64> ans;
rep(i, 0, N) {
if (b[i] != 0)
ans.emplace_back(i + 1);
}
i64 M = ans.size();
cout << ans.size() << endl;
rep(i, 0, M) {
cout << ans[i];
if (i == M - 1)
cout << endl;
else
cout << " ";
}
}
int main() {
std::cin.tie(0);
std::ios::sync_with_stdio(false);
cout.setf(ios::fixed);
cout.precision(16);
solve();
return 0;
}
| [
"call.arguments.change"
] | 779,976 | 779,977 | u759266806 | cpp |
p02972 | #include <bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr << " " << (hoge) << endl;
#define DBG cerr << "!" << endl;
#define BITLE(n) (1LL << ((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s, f, t) ((s).substr((f)-1, (t) - (f) + 1))
#define ALL(a) (a).begin(), (a).end()
using namespace std;
int hoge[222222];
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
ll n;
cin >> n;
vi A(n);
for (auto &a : A)
cin >> a;
vi ans;
for (int i = n; i >= 1; i--) {
if (i > n / 2) {
if (A[i - 1] == 1) {
ans.pb(i);
hoge[i] = 1;
}
} else {
ll cnt = 0;
for (int j = i * 2; j <= n; j += i) {
cnt += hoge[i];
}
if (A[i - 1] == 1) {
if (cnt % 2 == 0) {
ans.pb(i);
hoge[i] = 1;
}
} else {
if (cnt % 2 == 1) {
ans.pb(i);
hoge[i] = 1;
}
}
}
}
cout << ans.size() << endl;
for (auto a : ans)
cout << a << " ";
cout << endl;
return 0;
}
| #include <bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr << " " << (hoge) << endl;
#define DBG cerr << "!" << endl;
#define BITLE(n) (1LL << ((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s, f, t) ((s).substr((f)-1, (t) - (f) + 1))
#define ALL(a) (a).begin(), (a).end()
using namespace std;
int hoge[222222];
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
ll n;
cin >> n;
vi A(n);
for (auto &a : A)
cin >> a;
vi ans;
for (int i = n; i >= 1; i--) {
if (i > n / 2) {
if (A[i - 1] == 1) {
ans.pb(i);
hoge[i] = 1;
}
} else {
ll cnt = 0;
for (int j = i * 2; j <= n; j += i) {
cnt += hoge[j];
}
// cout<<cnt<<" "<<i<<endl;
if (A[i - 1] == 1) {
if (cnt % 2 == 0) {
ans.pb(i);
hoge[i] = 1;
}
} else {
if (cnt % 2 == 1) {
ans.pb(i);
hoge[i] = 1;
}
}
}
}
cout << ans.size() << endl;
for (auto a : ans)
cout << a << " ";
cout << endl;
return 0;
}
| [
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change"
] | 779,980 | 779,981 | u905715926 | cpp |
p02972 | #include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
const ll LINF = 1e18;
using namespace std;
#define rep(i, n) for (int(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (int i = (a); i < (b); i++)
#define rrrep(i, a, b) for (int i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define Cerr(x) cerr << (x) << endl
#define fi first
#define se second
#define P pair<ll, ll>
#define m_p make_pair
#define V vector<ll>
#define U_MAP unordered_map<ll, ll>
ll n, cnt, a[ohara], b, c, d, tmp, tmpp, m, h, w, x, y, sum, pos, k;
ld doua;
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};
// int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
bool fl;
struct edge {
int to, cost;
};
ll cou[ohara];
V ans;
//-------------------------↓↓↓↓↓↓------------------------
//------ 自分を天才だと信じる ------
std::vector<ll> enum_div(ll n) // nの約数を列挙
{
std::vector<ll> ret;
for (ll i = 1; i * i <= n; ++i) {
if (n % i == 0) {
ret.push_back(i);
if (i != 1 && i * i != n) {
ret.push_back(n / i);
}
}
}
return ret;
}
int main(void) {
cin.tie(0);
cout.tie(0);
ios::sync_with_stdio(false);
cin >> n;
rep(i, n) cin >> a[i];
rrrep(i, n, 1) {
if (cou[i] % 2 == a[i - 1] % 2)
continue;
std::vector<ll> r = enum_div(n);
for (auto i : r) {
cou[i]++;
}
ans.push_back(i);
}
sort(all(ans));
Cout(Size(ans));
rep(i, Size(ans)) Cout(ans[i]);
return 0;
}
| #include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
const ll LINF = 1e18;
using namespace std;
#define rep(i, n) for (int(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (int i = (a); i < (b); i++)
#define rrrep(i, a, b) for (int i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define Cerr(x) cerr << (x) << endl
#define fi first
#define se second
#define P pair<ll, ll>
#define m_p make_pair
#define V vector<ll>
#define U_MAP unordered_map<ll, ll>
ll n, cnt, a[ohara], b, c, d, tmp, tmpp, m, h, w, x, y, sum, pos, k;
ld doua;
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};
// int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
bool fl;
struct edge {
int to, cost;
};
ll cou[ohara];
V ans;
//-------------------------↓↓↓↓↓↓------------------------
//------ 自分を天才だと信じる ------
std::vector<ll> enum_div(ll n) // nの約数を列挙
{
std::vector<ll> ret;
for (ll i = 1; i * i <= n; ++i) {
if (n % i == 0) {
ret.push_back(i);
if (i != 1 && i * i != n) {
ret.push_back(n / i);
}
}
}
return ret;
}
int main(void) {
cin.tie(0);
cout.tie(0);
ios::sync_with_stdio(false);
cin >> n;
rep(i, n) cin >> a[i];
rrrep(i, n, 1) {
if (cou[i] % 2 == a[i - 1] % 2)
continue;
std::vector<ll> r = enum_div(i);
for (auto j : r) {
cou[j]++;
}
ans.push_back(i);
}
sort(all(ans));
Cout(Size(ans));
rep(i, Size(ans)) Cout(ans[i]);
return 0;
}
| [
"identifier.change",
"call.arguments.change",
"variable_access.subscript.index.change"
] | 779,986 | 779,987 | u876335718 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
using int32 = int_fast32_t;
using int64 = int_fast64_t;
const int32 INF = 1e9;
const int32 MOD = 1e9 + 7;
const int64 LLINF = 1e18;
#define YES(n) cout << ((n) ? "YES\n" : "NO\n")
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n")
#define ANS(n) cout << (n) << "\n"
#define REP(i, n) for (int64 i = 0; i < (n); ++i)
#define FOR(i, a, b) for (int64 i = (a); i < (b); i++)
#define FORR(i, a, b) for (int64 i = (a); i >= (b); i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define pii pair<int32, int32>
#define pll pair<int64, int64>
#define pb(a) push_back(a)
#define mp make_pair
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int32 n;
cin >> n;
int32 a[n + 1];
REP(i, n) cin >> a[i + 1];
bool ans[n + 1];
int32 m = 0;
FORR(i, n, 1) {
int32 sum = 0;
FOR(j, 2, n) {
if (i * j > n)
break;
sum += ((ans[i * j]) ? 1 : 0);
}
sum %= 2;
if (sum == a[i]) {
ans[i] = false;
} else {
ans[i] = true;
m++;
}
}
cout << m << endl;
FOR(i, 1, n + 1) {
if (ans[i])
cout << i << " ";
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
using int32 = int_fast32_t;
using int64 = int_fast64_t;
const int32 INF = 1e9;
const int32 MOD = 1e9 + 7;
const int64 LLINF = 1e18;
#define YES(n) cout << ((n) ? "YES\n" : "NO\n")
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n")
#define ANS(n) cout << (n) << "\n"
#define REP(i, n) for (int64 i = 0; i < (n); ++i)
#define FOR(i, a, b) for (int64 i = (a); i < (b); i++)
#define FORR(i, a, b) for (int64 i = (a); i >= (b); i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define pii pair<int32, int32>
#define pll pair<int64, int64>
#define pb(a) push_back(a)
#define mp make_pair
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int32 n;
cin >> n;
int32 a[n + 1];
REP(i, n) cin >> a[i + 1];
bool ans[n + 1];
int32 m = 0;
FORR(i, n, 1) {
int32 sum = 0;
FOR(j, 2, n + 1) {
if (i * j > n)
break;
sum += ((ans[i * j]) ? 1 : 0);
}
sum %= 2;
if (sum == a[i]) {
ans[i] = false;
} else {
ans[i] = true;
m++;
}
}
cout << m << endl;
FOR(i, 1, n + 1) {
if (ans[i])
cout << i << " ";
}
return 0;
} | [
"expression.operation.binary.add"
] | 779,990 | 779,991 | u694731294 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
using int32 = int_fast32_t;
using int64 = int_fast64_t;
const int32 INF = 1e9;
const int32 MOD = 1e9 + 7;
const int64 LLINF = 1e18;
#define YES(n) cout << ((n) ? "YES\n" : "NO\n")
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n")
#define ANS(n) cout << (n) << "\n"
#define REP(i, n) for (int64 i = 0; i < (n); ++i)
#define FOR(i, a, b) for (int64 i = (a); i < (b); i++)
#define FORR(i, a, b) for (int64 i = (a); i >= (b); i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define pii pair<int32, int32>
#define pll pair<int64, int64>
#define pb(a) push_back(a)
#define mp make_pair
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int32 n;
cin >> n;
int32 a[n + 1];
REP(i, n) cin >> a[i + 1];
bool ans[n + 1];
int32 m = 0;
FORR(i, n, 1) {
int32 sum = 0;
FOR(j, 2, n) {
if (i * j > n)
break;
sum += ((ans[i * j]) ? 1 : 0);
}
sum /= 2;
if (sum == a[i]) {
ans[i] = false;
} else {
ans[i] = true;
m++;
}
}
cout << m << endl;
FOR(i, 1, n + 1) {
if (ans[i])
cout << i << " ";
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
using int32 = int_fast32_t;
using int64 = int_fast64_t;
const int32 INF = 1e9;
const int32 MOD = 1e9 + 7;
const int64 LLINF = 1e18;
#define YES(n) cout << ((n) ? "YES\n" : "NO\n")
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n")
#define ANS(n) cout << (n) << "\n"
#define REP(i, n) for (int64 i = 0; i < (n); ++i)
#define FOR(i, a, b) for (int64 i = (a); i < (b); i++)
#define FORR(i, a, b) for (int64 i = (a); i >= (b); i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define pii pair<int32, int32>
#define pll pair<int64, int64>
#define pb(a) push_back(a)
#define mp make_pair
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int32 n;
cin >> n;
int32 a[n + 1];
REP(i, n) cin >> a[i + 1];
bool ans[n + 1];
int32 m = 0;
FORR(i, n, 1) {
int32 sum = 0;
FOR(j, 2, n + 1) {
if (i * j > n)
break;
sum += ((ans[i * j]) ? 1 : 0);
}
sum %= 2;
if (sum == a[i]) {
ans[i] = false;
} else {
ans[i] = true;
m++;
}
}
cout << m << endl;
FOR(i, 1, n + 1) {
if (ans[i])
cout << i << " ";
}
return 0;
} | [
"expression.operator.change"
] | 779,992 | 779,991 | u694731294 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
#define Int long long
//#define int long long
// TEMPLATE
// START---------------8<---------------8<---------------8<---------------8<---------------//
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<bool> vb;
typedef vector<ld> vld;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int>> vvi;
const int INF = (0x7FFFFFFFL);
const ll INFF = (0x7FFFFFFFFFFFFFFFL);
const string ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const int MOD = 1e9 + 7;
const int MODD = 998244353;
const string alphabet = "abcdefghijklmnopqrstuvwxyz";
const double PI = acos(-1.0);
const double EPS = 1e-9;
const string Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
int dx[9] = {1, 0, -1, 0, 1, -1, -1, 1, 0};
int dy[9] = {0, 1, 0, -1, -1, -1, 1, 1, 0};
#define ln '\n'
#define scnaf scanf
#define sacnf scanf
#define sancf scanf
#define SS(type, ...) \
type __VA_ARGS__; \
MACRO_VAR_Scan(__VA_ARGS__);
template <typename T> void MACRO_VAR_Scan(T &t) { cin >> t; }
template <typename First, typename... Rest>
void MACRO_VAR_Scan(First &first, Rest &...rest) {
cin >> first;
MACRO_VAR_Scan(rest...);
}
#define SV(type, c, n) \
vector<type> c(n); \
for (auto &i : c) \
cin >> i;
#define SVV(type, c, n, m) \
vector<vector<type>> c(n, vector<type>(m)); \
for (auto &r : c) \
for (auto &i : r) \
cin >> i;
template <class T, class U>
ostream &operator<<(ostream &o, const pair<T, U> &j) {
o << "{" << j.first << ", " << j.second << "}";
return o;
}
template <class T, class U>
ostream &operator<<(ostream &o, const map<T, U> &j) {
o << "{";
for (auto t = j.begin(); t != j.end(); ++t)
o << (t != j.begin() ? ", " : "") << *t;
o << "}";
return o;
}
template <class T> ostream &operator<<(ostream &o, const set<T> &j) {
o << "{";
for (auto t = j.begin(); t != j.end(); ++t)
o << (t != j.begin() ? ", " : "") << *t;
o << "}";
return o;
}
template <class T> ostream &operator<<(ostream &o, const vector<T> &j) {
o << "{";
for (int i = 0; i < (int)j.size(); ++i)
o << (i > 0 ? ", " : "") << j[i];
o << "}";
return o;
}
inline int print(void) {
cout << endl;
return 0;
}
template <class Head> int print(Head &&head) {
cout << head;
print();
return 0;
}
template <class Head, class... Tail> int print(Head &&head, Tail &&...tail) {
cout << head << " ";
print(forward<Tail>(tail)...);
return 0;
}
inline int debug(void) {
cerr << endl;
return 0;
}
template <class Head> int debug(Head &&head) {
cerr << head;
debug();
return 0;
}
template <class Head, class... Tail> int debug(Head &&head, Tail &&...tail) {
cerr << head << " ";
debug(forward<Tail>(tail)...);
return 0;
}
template <typename T> void PA(T &a) {
int ASIZE = sizeof(a) / sizeof(a[0]);
for (int ii = 0; ii < ASIZE; ++ii) {
cout << a[ii] << " \n"[ii == ASIZE - 1];
}
}
template <typename T> void PV(T &v) {
int VSIZE = v.size();
for (int ii = 0; ii < VSIZE; ++ii) {
cout << v[ii] << " \n"[ii == VSIZE - 1];
}
}
#define ER(x) cerr << #x << " = " << (x) << endl;
#define ERV(v) \
{ \
cerr << #v << " : "; \
for (const auto &xxx : v) { \
cerr << xxx << " "; \
} \
cerr << "\n"; \
}
inline int YES(bool x) {
cout << ((x) ? "YES" : "NO") << endl;
return 0;
}
inline int Yes(bool x) {
cout << ((x) ? "Yes" : "No") << endl;
return 0;
}
inline int yes(bool x) {
cout << ((x) ? "yes" : "no") << endl;
return 0;
}
inline int yES(bool x) {
cout << ((x) ? "yES" : "nO") << endl;
return 0;
}
inline int Yay(bool x) {
cout << ((x) ? "Yay!" : ":(") << endl;
return 0;
}
template <typename A, typename B> void sankou(bool x, A a, B b) {
cout << ((x) ? (a) : (b)) << endl;
}
#define _overload3(_1, _2, _3, name, ...) name
#define _REP(i, n) REPI(i, 0, n)
#define REPI(i, a, b) for (ll i = ll(a); i < ll(b); ++i)
#define REP(...) _overload3(__VA_ARGS__, REPI, _REP, )(__VA_ARGS__)
#define _RREP(i, n) RREPI(i, n, 0)
#define RREPI(i, a, b) for (ll i = ll(a); i >= ll(b); --i)
#define RREP(...) _overload3(__VA_ARGS__, RREPI, _RREP, )(__VA_ARGS__)
#define EACH(e, v) for (auto &e : v)
#define PERM(v) \
sort((v).begin(), (v).end()); \
for (bool c##p = 1; c##p; c##p = next_permutation((v).begin(), (v).end()))
#define ADD(a, b) a = (a + ll(b)) % MOD
#define MUL(a, b) a = (a * ll(b)) % MOD
inline ll MOP(ll x, ll n, ll m = MOD) {
ll r = 1;
while (n > 0) {
if (n & 1)
(r *= x) %= m;
(x *= x) %= m;
n >>= 1;
}
return r;
}
inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
inline ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
inline ll POW(ll a, ll b) {
ll c = 1ll;
do {
if (b & 1)
c *= 1ll * a;
a *= 1ll * a;
} while (b >>= 1);
return c;
}
template <typename T, typename A, typename B>
inline bool between(T x, A a, B b) {
return ((a <= x) && (x < b));
}
template <class T> inline T sqr(T x) { return x * x; }
template <typename A, typename B> inline bool chmax(A &a, const B &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <typename A, typename B> inline bool chmin(A &a, const B &b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
#define tmax(x, y, z) max((x), max((y), (z)))
#define tmin(x, y, z) min((x), min((y), (z)))
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define EXIST(s, e) (find((s).begin(), (s).end(), (e)) != (s).end())
#define EXISTST(s, c) (((s).find(c)) != string::npos)
#define POSL(x, val) (lower_bound(x.begin(), x.end(), val) - x.begin())
#define POSU(x, val) (upper_bound(x.begin(), x.end(), val) - x.begin())
#define GEQ(x, val) (int)(x).size() - POSL((x), (val))
#define GREATER(x, val) (int)(x).size() - POSU((x), (val))
#define LEQ(x, val) POSU((x), (val))
#define LESS(x, val) POSL((x), (val))
#define SZV(a) int((a).size())
#define SZA(a) sizeof(a) / sizeof(a[0])
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define MEMINF(a) memset(a, 0x3f, sizeof(a))
#define FILL(a, b) memset(a, b, sizeof(a))
#define UNIQUE(v) \
sort((v).begin(), (v).end()); \
(v).erase(unique((v).begin(), (v).end()), (v).end())
struct abracadabra {
abracadabra() {
cin.tie(0);
ios::sync_with_stdio(0);
cout << fixed << setprecision(20);
cerr << fixed << setprecision(5);
};
} ABRACADABRA;
// TEMPLATE
// END---------------8<---------------8<---------------8<---------------8<---------------//
signed main() {
SS(int, N);
SV(int, A, N);
vi B(N, 0);
// 間隔
for (int i = N - 1; i >= 0; i--) {
// REP(i, N) {
// 間隔は i + 1
int k = i + 1;
int sm = 0;
for (int j = 2 * i; j < N; j += k) {
sm += B[j];
// cerr << j + 1 << ' ';
}
if (sm % 2 != A[i] % 2) {
B[i] = 1;
} else {
B[i] = 0;
}
// cerr << endl;
}
// print(B);
// return 0z;
vi res;
REP(i, N) {
if (B[i] == 1) {
res.PB(i + 1);
}
}
print(res.size());
EACH(e, res) print(e);
} | #include <bits/stdc++.h>
using namespace std;
#define Int long long
//#define int long long
// TEMPLATE
// START---------------8<---------------8<---------------8<---------------8<---------------//
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<bool> vb;
typedef vector<ld> vld;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int>> vvi;
const int INF = (0x7FFFFFFFL);
const ll INFF = (0x7FFFFFFFFFFFFFFFL);
const string ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const int MOD = 1e9 + 7;
const int MODD = 998244353;
const string alphabet = "abcdefghijklmnopqrstuvwxyz";
const double PI = acos(-1.0);
const double EPS = 1e-9;
const string Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
int dx[9] = {1, 0, -1, 0, 1, -1, -1, 1, 0};
int dy[9] = {0, 1, 0, -1, -1, -1, 1, 1, 0};
#define ln '\n'
#define scnaf scanf
#define sacnf scanf
#define sancf scanf
#define SS(type, ...) \
type __VA_ARGS__; \
MACRO_VAR_Scan(__VA_ARGS__);
template <typename T> void MACRO_VAR_Scan(T &t) { cin >> t; }
template <typename First, typename... Rest>
void MACRO_VAR_Scan(First &first, Rest &...rest) {
cin >> first;
MACRO_VAR_Scan(rest...);
}
#define SV(type, c, n) \
vector<type> c(n); \
for (auto &i : c) \
cin >> i;
#define SVV(type, c, n, m) \
vector<vector<type>> c(n, vector<type>(m)); \
for (auto &r : c) \
for (auto &i : r) \
cin >> i;
template <class T, class U>
ostream &operator<<(ostream &o, const pair<T, U> &j) {
o << "{" << j.first << ", " << j.second << "}";
return o;
}
template <class T, class U>
ostream &operator<<(ostream &o, const map<T, U> &j) {
o << "{";
for (auto t = j.begin(); t != j.end(); ++t)
o << (t != j.begin() ? ", " : "") << *t;
o << "}";
return o;
}
template <class T> ostream &operator<<(ostream &o, const set<T> &j) {
o << "{";
for (auto t = j.begin(); t != j.end(); ++t)
o << (t != j.begin() ? ", " : "") << *t;
o << "}";
return o;
}
template <class T> ostream &operator<<(ostream &o, const vector<T> &j) {
o << "{";
for (int i = 0; i < (int)j.size(); ++i)
o << (i > 0 ? ", " : "") << j[i];
o << "}";
return o;
}
inline int print(void) {
cout << endl;
return 0;
}
template <class Head> int print(Head &&head) {
cout << head;
print();
return 0;
}
template <class Head, class... Tail> int print(Head &&head, Tail &&...tail) {
cout << head << " ";
print(forward<Tail>(tail)...);
return 0;
}
inline int debug(void) {
cerr << endl;
return 0;
}
template <class Head> int debug(Head &&head) {
cerr << head;
debug();
return 0;
}
template <class Head, class... Tail> int debug(Head &&head, Tail &&...tail) {
cerr << head << " ";
debug(forward<Tail>(tail)...);
return 0;
}
template <typename T> void PA(T &a) {
int ASIZE = sizeof(a) / sizeof(a[0]);
for (int ii = 0; ii < ASIZE; ++ii) {
cout << a[ii] << " \n"[ii == ASIZE - 1];
}
}
template <typename T> void PV(T &v) {
int VSIZE = v.size();
for (int ii = 0; ii < VSIZE; ++ii) {
cout << v[ii] << " \n"[ii == VSIZE - 1];
}
}
#define ER(x) cerr << #x << " = " << (x) << endl;
#define ERV(v) \
{ \
cerr << #v << " : "; \
for (const auto &xxx : v) { \
cerr << xxx << " "; \
} \
cerr << "\n"; \
}
inline int YES(bool x) {
cout << ((x) ? "YES" : "NO") << endl;
return 0;
}
inline int Yes(bool x) {
cout << ((x) ? "Yes" : "No") << endl;
return 0;
}
inline int yes(bool x) {
cout << ((x) ? "yes" : "no") << endl;
return 0;
}
inline int yES(bool x) {
cout << ((x) ? "yES" : "nO") << endl;
return 0;
}
inline int Yay(bool x) {
cout << ((x) ? "Yay!" : ":(") << endl;
return 0;
}
template <typename A, typename B> void sankou(bool x, A a, B b) {
cout << ((x) ? (a) : (b)) << endl;
}
#define _overload3(_1, _2, _3, name, ...) name
#define _REP(i, n) REPI(i, 0, n)
#define REPI(i, a, b) for (ll i = ll(a); i < ll(b); ++i)
#define REP(...) _overload3(__VA_ARGS__, REPI, _REP, )(__VA_ARGS__)
#define _RREP(i, n) RREPI(i, n, 0)
#define RREPI(i, a, b) for (ll i = ll(a); i >= ll(b); --i)
#define RREP(...) _overload3(__VA_ARGS__, RREPI, _RREP, )(__VA_ARGS__)
#define EACH(e, v) for (auto &e : v)
#define PERM(v) \
sort((v).begin(), (v).end()); \
for (bool c##p = 1; c##p; c##p = next_permutation((v).begin(), (v).end()))
#define ADD(a, b) a = (a + ll(b)) % MOD
#define MUL(a, b) a = (a * ll(b)) % MOD
inline ll MOP(ll x, ll n, ll m = MOD) {
ll r = 1;
while (n > 0) {
if (n & 1)
(r *= x) %= m;
(x *= x) %= m;
n >>= 1;
}
return r;
}
inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
inline ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
inline ll POW(ll a, ll b) {
ll c = 1ll;
do {
if (b & 1)
c *= 1ll * a;
a *= 1ll * a;
} while (b >>= 1);
return c;
}
template <typename T, typename A, typename B>
inline bool between(T x, A a, B b) {
return ((a <= x) && (x < b));
}
template <class T> inline T sqr(T x) { return x * x; }
template <typename A, typename B> inline bool chmax(A &a, const B &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <typename A, typename B> inline bool chmin(A &a, const B &b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
#define tmax(x, y, z) max((x), max((y), (z)))
#define tmin(x, y, z) min((x), min((y), (z)))
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define EXIST(s, e) (find((s).begin(), (s).end(), (e)) != (s).end())
#define EXISTST(s, c) (((s).find(c)) != string::npos)
#define POSL(x, val) (lower_bound(x.begin(), x.end(), val) - x.begin())
#define POSU(x, val) (upper_bound(x.begin(), x.end(), val) - x.begin())
#define GEQ(x, val) (int)(x).size() - POSL((x), (val))
#define GREATER(x, val) (int)(x).size() - POSU((x), (val))
#define LEQ(x, val) POSU((x), (val))
#define LESS(x, val) POSL((x), (val))
#define SZV(a) int((a).size())
#define SZA(a) sizeof(a) / sizeof(a[0])
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define MEMINF(a) memset(a, 0x3f, sizeof(a))
#define FILL(a, b) memset(a, b, sizeof(a))
#define UNIQUE(v) \
sort((v).begin(), (v).end()); \
(v).erase(unique((v).begin(), (v).end()), (v).end())
struct abracadabra {
abracadabra() {
cin.tie(0);
ios::sync_with_stdio(0);
cout << fixed << setprecision(20);
cerr << fixed << setprecision(5);
};
} ABRACADABRA;
// TEMPLATE
// END---------------8<---------------8<---------------8<---------------8<---------------//
signed main() {
SS(int, N);
SV(int, A, N);
vi B(N, 0);
// 間隔
for (int i = N - 1; i >= 0; i--) {
// REP(i, N) {
// 間隔は i + 1
int k = i + 1;
int sm = 0;
for (int j = 2 * i + 1; j < N; j += k) {
// print(i, j, k);
sm += B[j];
// cerr << j + 1 << ' ';
}
if (sm % 2 != A[i] % 2) {
B[i] = 1;
} else {
B[i] = 0;
}
// cerr << endl;
}
// print(B);
// return 0;
vi res;
REP(i, N) {
if (B[i] == 1) {
res.PB(i + 1);
}
}
print(res.size());
EACH(e, res) print(e);
} | [
"control_flow.loop.for.initializer.change"
] | 779,993 | 779,994 | u832039789 | cpp |
p02972 | #include <bits/stdc++.h>
#define ll long long
#define fornum(A, B, C) for (A = B; A < C; A++)
#define mp make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
using namespace std;
/////////////////////////////////////////////////////
ll N, A[202020], M, B[202020];
ll i, j, ans;
int main() {
scanf("%lld", &N);
fornum(i, 0, N) { scanf("%lld", &A[i + 1]); }
for (i = N; 1 <= i; i--) {
ll a = 0;
for (j = i * 2; j < N; j += i) {
a += B[j];
}
if ((a + A[i]) % 2 == 1) {
B[i] = 1;
M++;
}
}
printf("%lld\n", M);
fornum(i, 0, N) {
if (B[i + 1] == 1)
printf("%lld ", i + 1);
}
return 0;
} | #include <bits/stdc++.h>
#define ll long long
#define fornum(A, B, C) for (A = B; A < C; A++)
#define mp make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
using namespace std;
/////////////////////////////////////////////////////
ll N, A[202020], M, B[202020];
ll i, j, ans;
int main() {
scanf("%lld", &N);
fornum(i, 0, N) { scanf("%lld", &A[i + 1]); }
for (i = N; 1 <= i; i--) {
ll a = 0;
for (j = i * 2; j <= N; j += i) {
a += B[j];
}
if ((a + A[i]) % 2 == 1) {
B[i] = 1;
M++;
}
}
printf("%lld\n", M);
fornum(i, 0, N) {
if (B[i + 1] == 1)
printf("%lld ", i + 1);
}
return 0;
} | [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 779,995 | 779,996 | u259396003 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
#define M 200005
int a[M], b[M];
int main() {
int n, ans = 0;
scanf("%d", &n);
for (int i = 1; i <= n; ++i)
scanf("%d", &a[i]);
for (int i = n; i >= 1; --i) {
int v = 0;
for (int j = i + i; j <= n; ++j)
v ^= b[j];
b[i] = v ^ a[i];
if (b[i])
++ans;
}
printf("%d\n", ans);
for (int i = 1; i <= n; ++i)
if (b[i])
printf("%d ", i);
} | #include <bits/stdc++.h>
using namespace std;
#define M 200005
int a[M], b[M];
int main() {
int n, ans = 0;
scanf("%d", &n);
for (int i = 1; i <= n; ++i)
scanf("%d", &a[i]);
for (int i = n; i >= 1; --i) {
int v = 0;
for (int j = i + i; j <= n; j += i)
v ^= b[j];
b[i] = v ^ a[i];
if (b[i])
++ans;
}
printf("%d\n", ans);
for (int i = 1; i <= n; ++i)
if (b[i])
printf("%d ", i);
} | [
"control_flow.loop.for.update.change",
"assignment.change"
] | 779,999 | 780,000 | u455656648 | cpp |
p02972 | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#define int long long
#define mod 1000000007
using namespace std;
int n, a[234567], b[234567], ans = 0;
signed main() {
cin >> n;
for (int i = 1; i <= n; i++)
cin >> a[i];
for (int i = n; i >= 1; i--) {
int sum = 0;
for (int j = i * 2; j <= n; j++) {
sum += b[i];
}
sum %= 2;
b[i] = (a[i] != sum);
ans += b[i];
}
cout << ans << endl;
ans = 0;
for (int i = 1; i <= n; i++) {
if (b[i]) {
if (ans)
cout << ' ';
cout << i;
ans = 1;
}
}
if (ans)
cout << endl;
} | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#define int long long
#define mod 1000000007
using namespace std;
int n, a[234567], b[234567], ans = 0;
signed main() {
cin >> n;
for (int i = 1; i <= n; i++)
cin >> a[i];
for (int i = n; i >= 1; i--) {
int sum = 0;
for (int j = i * 2; j <= n; j += i)
sum += b[j];
sum %= 2;
b[i] = (a[i] != sum);
ans += b[i];
}
cout << ans << endl;
ans = 0;
for (int i = 1; i <= n; i++) {
if (b[i]) {
if (ans)
cout << ' ';
cout << i;
ans = 1;
}
}
if (ans)
cout << endl;
} | [
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change"
] | 780,001 | 780,002 | u141968173 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
struct Fast {
Fast() {
std::cin.tie(0);
ios::sync_with_stdio(false);
cout.precision(20);
}
} fast;
/* define */
#define FOR(I, X, Y) for (long long(I) = (X); (I) < (Y); (I)++)
#define REP(I, X, Y) for (long long(I) = (Y)-1; (I) >= (X); (I)--)
#define ALL(X) (X).begin(), (X).end()
#define pb push_back
#define COUNT(V, X) \
(upper_bound((V).begin(), (V).end(), X) - \
lower_bound((V).begin(), (V).end(), X))
#define debug(x) cerr << #x << ':' << x << endl;
#define DEBUG(v) \
{ \
cerr << #v << ':'; \
for (auto xv : v) \
cerr << xv << ' '; \
cerr << endl; \
}
#define Yes(X) cout << (X ? "Yes" : "No") << endl;
#define YES(X) cout << (X ? "YES" : "NO") << endl;
#define ctoi(C) (C - '0')
#define pow2(x) ((long long)((long long)1 << x))
/* alias */
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using pi = pair<int, int>;
using pl = pair<long long, long long>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;
/* const */
const long long dx[] = {1, 0, -1, 0};
const long long dy[] = {0, 1, 0, -1};
const long long dx8[] = {1, 1, 0, -1, -1, -1, 0, 1};
const long long dy8[] = {0, 1, 1, 1, 0, -1, -1, -1};
const long long dx9[] = {1, 1, 0, -1, -1, -1, 0, 1, 0};
const long long dy9[] = {0, 1, 1, 1, 0, -1, -1, -1, 0};
const int INF = 1000000007;
const long long LINF = 1000000000000000007;
/* func */
template <typename T1, typename T2> inline bool chmin(T1 &a, const T2 &b) {
if (a > b)
a = b;
return a > b;
}
template <typename T1, typename T2> inline bool chmax(T1 &a, const T2 &b) {
if (a < b)
a = b;
return a < b;
}
long long max(long long x, int y) { return max(x, (long long)y); }
long long max(int x, long long y) { return max((long long)x, y); }
long long min(long long x, int y) { return min(x, (long long)y); }
long long min(int x, long long y) { return min((long long)x, y); }
/* library */
/* main */
signed main() {
ll N;
cin >> N;
vl A(N + 1);
FOR(i, 1, N + 1) { cin >> A[i]; }
bool ball[N + 1] = {};
REP(i, 1, N + 1) {
ll sum = 0;
for (int j = i + i; j <= N; j += i) {
sum += ball[i];
}
ball[i] = ((sum % (ll)2) != A[i]);
}
vl ans;
REP(i, 1, N + 1) {
ll sum = 0;
for (int j = i; j <= N; j += i) {
sum += ball[j];
}
if (sum % 2 != A[i]) {
cout << -1 << endl;
return 0;
}
if (ball[i]) {
ans.push_back(i);
}
}
cout << ans.size() << endl;
FOR(i, 0, ans.size()) {
cout << ans[i] << (i == ans.size() - 1 ? "\n" : " ");
}
} | #include <bits/stdc++.h>
using namespace std;
struct Fast {
Fast() {
std::cin.tie(0);
ios::sync_with_stdio(false);
cout.precision(20);
}
} fast;
/* define */
#define FOR(I, X, Y) for (long long(I) = (X); (I) < (Y); (I)++)
#define REP(I, X, Y) for (long long(I) = (Y)-1; (I) >= (X); (I)--)
#define ALL(X) (X).begin(), (X).end()
#define pb push_back
#define COUNT(V, X) \
(upper_bound((V).begin(), (V).end(), X) - \
lower_bound((V).begin(), (V).end(), X))
#define debug(x) cerr << #x << ':' << x << endl;
#define DEBUG(v) \
{ \
cerr << #v << ':'; \
for (auto xv : v) \
cerr << xv << ' '; \
cerr << endl; \
}
#define Yes(X) cout << (X ? "Yes" : "No") << endl;
#define YES(X) cout << (X ? "YES" : "NO") << endl;
#define ctoi(C) (C - '0')
#define pow2(x) ((long long)((long long)1 << x))
/* alias */
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using pi = pair<int, int>;
using pl = pair<long long, long long>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;
/* const */
const long long dx[] = {1, 0, -1, 0};
const long long dy[] = {0, 1, 0, -1};
const long long dx8[] = {1, 1, 0, -1, -1, -1, 0, 1};
const long long dy8[] = {0, 1, 1, 1, 0, -1, -1, -1};
const long long dx9[] = {1, 1, 0, -1, -1, -1, 0, 1, 0};
const long long dy9[] = {0, 1, 1, 1, 0, -1, -1, -1, 0};
const int INF = 1000000007;
const long long LINF = 1000000000000000007;
/* func */
template <typename T1, typename T2> inline bool chmin(T1 &a, const T2 &b) {
if (a > b)
a = b;
return a > b;
}
template <typename T1, typename T2> inline bool chmax(T1 &a, const T2 &b) {
if (a < b)
a = b;
return a < b;
}
long long max(long long x, int y) { return max(x, (long long)y); }
long long max(int x, long long y) { return max((long long)x, y); }
long long min(long long x, int y) { return min(x, (long long)y); }
long long min(int x, long long y) { return min((long long)x, y); }
/* library */
/* main */
signed main() {
ll N;
cin >> N;
vl A(N + 1);
FOR(i, 1, N + 1) { cin >> A[i]; }
bool ball[N + 1] = {};
REP(i, 1, N + 1) {
ll sum = 0;
for (int j = i + i; j <= N; j += i) {
sum += ball[j];
}
ball[i] = ((sum % (ll)2) != A[i]);
}
vl ans;
REP(i, 1, N + 1) {
ll sum = 0;
for (int j = i; j <= N; j += i) {
sum += ball[j];
}
if (sum % 2 != A[i]) {
cout << -1 << endl;
return 0;
}
if (ball[i]) {
ans.push_back(i);
}
}
cout << ans.size() << endl;
FOR(i, 0, ans.size()) {
cout << ans[i] << (i == ans.size() - 1 ? "\n" : " ");
}
} | [
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change"
] | 780,005 | 780,006 | u205561862 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
struct Fast {
Fast() {
std::cin.tie(0);
ios::sync_with_stdio(false);
cout.precision(20);
}
} fast;
/* define */
#define FOR(I, X, Y) for (long long(I) = (X); (I) < (Y); (I)++)
#define REP(I, X, Y) for (long long(I) = (Y)-1; (I) >= (X); (I)--)
#define ALL(X) (X).begin(), (X).end()
#define pb push_back
#define COUNT(V, X) \
(upper_bound((V).begin(), (V).end(), X) - \
lower_bound((V).begin(), (V).end(), X))
#define debug(x) cerr << #x << ':' << x << endl;
#define DEBUG(v) \
{ \
cerr << #v << ':'; \
for (auto xv : v) \
cerr << xv << ' '; \
cerr << endl; \
}
#define Yes(X) cout << (X ? "Yes" : "No") << endl;
#define YES(X) cout << (X ? "YES" : "NO") << endl;
#define ctoi(C) (C - '0')
#define pow2(x) ((long long)((long long)1 << x))
/* alias */
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using pi = pair<int, int>;
using pl = pair<long long, long long>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;
/* const */
const long long dx[] = {1, 0, -1, 0};
const long long dy[] = {0, 1, 0, -1};
const long long dx8[] = {1, 1, 0, -1, -1, -1, 0, 1};
const long long dy8[] = {0, 1, 1, 1, 0, -1, -1, -1};
const long long dx9[] = {1, 1, 0, -1, -1, -1, 0, 1, 0};
const long long dy9[] = {0, 1, 1, 1, 0, -1, -1, -1, 0};
const int INF = 1000000007;
const long long LINF = 1000000000000000007;
/* func */
template <typename T1, typename T2> inline bool chmin(T1 &a, const T2 &b) {
if (a > b)
a = b;
return a > b;
}
template <typename T1, typename T2> inline bool chmax(T1 &a, const T2 &b) {
if (a < b)
a = b;
return a < b;
}
long long max(long long x, int y) { return max(x, (long long)y); }
long long max(int x, long long y) { return max((long long)x, y); }
long long min(long long x, int y) { return min(x, (long long)y); }
long long min(int x, long long y) { return min((long long)x, y); }
/* library */
/* main */
signed main() {
ll N;
cin >> N;
vl A(N + 1);
FOR(i, 1, N + 1) { cin >> A[i]; }
bool ball[N + 1] = {};
REP(i, 1, N + 1) {
ll sum = 0;
for (int j = i + i; j <= N; j += i) {
sum += ball[i];
}
ball[i] = ((sum % (ll)2) != A[i]);
}
vl ans;
REP(i, 1, N + 1) {
ll sum = 0;
for (int j = i; j <= N; j += i) {
sum += ball[i];
}
if (sum % 2 != A[i]) {
cout << -1 << endl;
return 0;
}
if (ball[i]) {
ans.push_back(i);
}
}
cout << ans.size() << endl;
FOR(i, 0, ans.size()) {
cout << ans[i] << (i == ans.size() - 1 ? "\n" : " ");
}
} | #include <bits/stdc++.h>
using namespace std;
struct Fast {
Fast() {
std::cin.tie(0);
ios::sync_with_stdio(false);
cout.precision(20);
}
} fast;
/* define */
#define FOR(I, X, Y) for (long long(I) = (X); (I) < (Y); (I)++)
#define REP(I, X, Y) for (long long(I) = (Y)-1; (I) >= (X); (I)--)
#define ALL(X) (X).begin(), (X).end()
#define pb push_back
#define COUNT(V, X) \
(upper_bound((V).begin(), (V).end(), X) - \
lower_bound((V).begin(), (V).end(), X))
#define debug(x) cerr << #x << ':' << x << endl;
#define DEBUG(v) \
{ \
cerr << #v << ':'; \
for (auto xv : v) \
cerr << xv << ' '; \
cerr << endl; \
}
#define Yes(X) cout << (X ? "Yes" : "No") << endl;
#define YES(X) cout << (X ? "YES" : "NO") << endl;
#define ctoi(C) (C - '0')
#define pow2(x) ((long long)((long long)1 << x))
/* alias */
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using pi = pair<int, int>;
using pl = pair<long long, long long>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;
/* const */
const long long dx[] = {1, 0, -1, 0};
const long long dy[] = {0, 1, 0, -1};
const long long dx8[] = {1, 1, 0, -1, -1, -1, 0, 1};
const long long dy8[] = {0, 1, 1, 1, 0, -1, -1, -1};
const long long dx9[] = {1, 1, 0, -1, -1, -1, 0, 1, 0};
const long long dy9[] = {0, 1, 1, 1, 0, -1, -1, -1, 0};
const int INF = 1000000007;
const long long LINF = 1000000000000000007;
/* func */
template <typename T1, typename T2> inline bool chmin(T1 &a, const T2 &b) {
if (a > b)
a = b;
return a > b;
}
template <typename T1, typename T2> inline bool chmax(T1 &a, const T2 &b) {
if (a < b)
a = b;
return a < b;
}
long long max(long long x, int y) { return max(x, (long long)y); }
long long max(int x, long long y) { return max((long long)x, y); }
long long min(long long x, int y) { return min(x, (long long)y); }
long long min(int x, long long y) { return min((long long)x, y); }
/* library */
/* main */
signed main() {
ll N;
cin >> N;
vl A(N + 1);
FOR(i, 1, N + 1) { cin >> A[i]; }
bool ball[N + 1] = {};
REP(i, 1, N + 1) {
ll sum = 0;
for (int j = i + i; j <= N; j += i) {
sum += ball[j];
}
ball[i] = ((sum % (ll)2) != A[i]);
}
vl ans;
REP(i, 1, N + 1) {
ll sum = 0;
for (int j = i; j <= N; j += i) {
sum += ball[j];
}
if (sum % 2 != A[i]) {
cout << -1 << endl;
return 0;
}
if (ball[i]) {
ans.push_back(i);
}
}
cout << ans.size() << endl;
FOR(i, 0, ans.size()) {
cout << ans[i] << (i == ans.size() - 1 ? "\n" : " ");
}
} | [
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change"
] | 780,007 | 780,006 | u205561862 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
#define int long long
typedef int ll;
typedef long double ld;
const ll N = 100005;
char en = '\n';
ll inf = 1e16;
ll mod = 1000000007;
ll power(ll x, ll n, ll mod) {
ll res = 1;
x %= mod;
while (n) {
if (n & 1)
res = (res * x) % mod;
x = (x * x) % mod;
n >>= 1;
}
return res;
}
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n;
cin >> n;
ll arr[n + 5];
ll val[n + 5];
memset(val, 0, sizeof(val));
for (ll i = 1; i <= n; i++)
cin >> arr[i];
ll res = 0;
for (ll i = n; i >= 1; i--) {
ll val1 = 0;
for (ll j = 2 * i; j <= n; j += i)
val1 += val[j];
val1 &= 1;
val[i] = (arr[i] - val1 + 2) % 2;
res += val[i];
}
cout << res << en;
for (ll i = 1; i <= n; i++) {
if (val[i])
cout << val[i] << " ";
}
cout << en;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define int long long
typedef int ll;
typedef long double ld;
const ll N = 100005;
char en = '\n';
ll inf = 1e16;
ll mod = 1000000007;
ll power(ll x, ll n, ll mod) {
ll res = 1;
x %= mod;
while (n) {
if (n & 1)
res = (res * x) % mod;
x = (x * x) % mod;
n >>= 1;
}
return res;
}
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n;
cin >> n;
ll arr[n + 5];
ll val[n + 5];
memset(val, 0, sizeof(val));
for (ll i = 1; i <= n; i++)
cin >> arr[i];
ll res = 0;
for (ll i = n; i >= 1; i--) {
ll val1 = 0;
for (ll j = 2 * i; j <= n; j += i)
val1 += val[j];
val1 &= 1;
val[i] = (arr[i] - val1 + 2) % 2;
res += val[i];
}
cout << res << en;
for (ll i = 1; i <= n; i++) {
if (val[i])
cout << i << " ";
}
cout << en;
return 0;
} | [] | 780,008 | 780,009 | u401416019 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
#define int long long
typedef int ll;
typedef long double ld;
const ll N = 100005;
char en = '\n';
ll inf = 1e16;
ll mod = 1000000007;
ll power(ll x, ll n, ll mod) {
ll res = 1;
x %= mod;
while (n) {
if (n & 1)
res = (res * x) % mod;
x = (x * x) % mod;
n >>= 1;
}
return res;
}
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n;
cin >> n;
ll arr[n + 5];
ll val[n + 5];
memset(val, 0, sizeof(val));
for (ll i = 1; i <= n; i++)
cin >> arr[i];
ll res = 0;
for (ll i = n; i >= 1; i--) {
ll val1 = 0;
for (ll j = 2 * i; j <= n; j += i)
val1 += arr[j];
val1 &= 1;
val[i] = (arr[i] - val1 + 2) % 2;
res += val[i];
}
cout << res << en;
for (ll i = 1; i <= n; i++) {
if (val[i])
cout << val[i] << " ";
}
cout << en;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define int long long
typedef int ll;
typedef long double ld;
const ll N = 100005;
char en = '\n';
ll inf = 1e16;
ll mod = 1000000007;
ll power(ll x, ll n, ll mod) {
ll res = 1;
x %= mod;
while (n) {
if (n & 1)
res = (res * x) % mod;
x = (x * x) % mod;
n >>= 1;
}
return res;
}
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n;
cin >> n;
ll arr[n + 5];
ll val[n + 5];
memset(val, 0, sizeof(val));
for (ll i = 1; i <= n; i++)
cin >> arr[i];
ll res = 0;
for (ll i = n; i >= 1; i--) {
ll val1 = 0;
for (ll j = 2 * i; j <= n; j += i)
val1 += val[j];
val1 &= 1;
val[i] = (arr[i] - val1 + 2) % 2;
res += val[i];
}
cout << res << en;
for (ll i = 1; i <= n; i++) {
if (val[i])
cout << i << " ";
}
cout << en;
return 0;
} | [
"assignment.value.change",
"identifier.change"
] | 780,010 | 780,009 | u401416019 | cpp |
p02972 | #include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#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 FORR(i, m, n) for (int i = m; i >= n; i--)
#define REPO(i, n) for (ll i = 1; i <= n; i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(), n.end()
#define MOD (ll)1000000007
#define P pair<ll, ll>
ll n, s[210000];
vector<ll> ans;
int main() {
cin >> n;
REPO(i, n) { cin >> s[i]; }
FORR(i, n, 1) {
if (s[i] == 1) {
ans.push_back(i);
for (int j = 1; j <= sqrt(n); j++) {
if (i % j == 0) {
s[j] = 1 - s[j];
if (i / j != j)
s[i / j] = 1 - s[i / j];
}
}
}
}
sort(ALL(ans));
cout << ans.size() << endl;
REP(i, ans.size()) {
if (i != 0)
cout << " ";
cout << ans[i];
}
cout << endl;
}
| #include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#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 FORR(i, m, n) for (int i = m; i >= n; i--)
#define REPO(i, n) for (ll i = 1; i <= n; i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(), n.end()
#define MOD (ll)1000000007
#define P pair<ll, ll>
ll n, s[210000];
vector<ll> ans;
int main() {
cin >> n;
REPO(i, n) { cin >> s[i]; }
FORR(i, n, 1) {
if (s[i] == 1) {
ans.push_back(i);
for (int j = 1; j <= sqrt(i); j++) {
if (i % j == 0) {
s[j] = 1 - s[j];
if (i / j != j)
s[i / j] = 1 - s[i / j];
}
}
}
}
sort(ALL(ans));
cout << ans.size() << endl;
REP(i, ans.size()) {
if (i != 0)
cout << " ";
cout << ans[i];
}
cout << endl;
}
| [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 780,011 | 780,012 | u196497077 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
#define N 200005
int n, A[N], AN[N], an;
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++)
scanf("%d", &A[i]);
for (int i = n; i; i--) {
if (A[i]) {
AN[++an] = i;
for (int z = 1; z * z <= i; z++) {
if (i % z == 0) {
A[z] ^= 1;
if (z * z != A[i])
A[i / z] ^= 1;
}
}
}
}
printf("%d\n", an);
for (int i = an; i; i--) {
printf("%d ", AN[i]);
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define N 200005
int n, A[N], AN[N], an;
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++)
scanf("%d", &A[i]);
for (int i = n; i; i--) {
if (A[i]) {
AN[++an] = i;
for (int z = 1; z * z <= i; z++) {
if (i % z == 0) {
A[z] ^= 1;
if (z * z != i)
A[i / z] ^= 1;
}
}
}
}
printf("%d\n", an);
for (int i = an; i; i--)
printf("%d ", AN[i]);
return 0;
} | [
"control_flow.loop.for.condition.change",
"control_flow.branch.if.condition.change"
] | 780,013 | 780,014 | u867285555 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 212345;
int a[MAXN], v[MAXN];
vector<int> ans;
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; ++i)
scanf("%d", a + i);
for (int i = n; i > 0; --i) {
int put = a[i];
for (int j = i + i; j < n; j += i) {
put ^= v[j];
}
v[i] = put;
if (put)
ans.push_back(i);
}
cout << ans.size() << endl;
for (int i = 0; i < ans.size(); ++i)
printf("%d%c", ans[i], " \n"[i == ans.size() - 1]);
return 0;
} | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 212345;
int a[MAXN], v[MAXN];
vector<int> ans;
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; ++i)
scanf("%d", a + i);
for (int i = n; i > 0; --i) {
int put = a[i];
for (int j = i + i; j <= n; j += i) {
put ^= v[j];
}
v[i] = put;
if (put)
ans.push_back(i);
}
cout << ans.size() << endl;
for (int i = 0; i < ans.size(); ++i)
printf("%d%c", ans[i], " \n"[i == ans.size() - 1]);
return 0;
} | [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 780,015 | 780,016 | u932299059 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
#define int long long
const int MAX = 2001;
const int MOD = 1000000007;
signed main() {
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++)
cin >> a[i];
int m = 0, k[n] = {};
for (int i = n - 1; i >= 0; i--) {
k[i] = a[i];
for (int j = 2 * (i + 1) - 1; j < n; j += i + 1) {
k[i] = (k[i] + a[j]) % 2;
}
m += k[i];
}
cout << m << endl;
for (int i = 0; i < n; i++) {
if (k[i] != 0)
cout << i + 1 << ' ';
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define int long long
const int MAX = 2001;
const int MOD = 1000000007;
signed main() {
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++)
cin >> a[i];
int m = 0, k[n] = {};
for (int i = n - 1; i >= 0; i--) {
k[i] = a[i];
for (int j = 2 * (i + 1) - 1; j < n; j += i + 1) {
k[i] = (k[i] + k[j]) % 2;
}
m += k[i];
}
cout << m << endl;
for (int i = 0; i < n; i++) {
if (k[i] != 0)
cout << i + 1 << ' ';
}
return 0;
} | [
"assignment.value.change",
"identifier.change",
"expression.operation.binary.change"
] | 780,019 | 780,020 | u651317892 | cpp |
p02972 | #include <bits/stdc++.h>
#define int long long
#define P pair<int, int>
#define PP pair<P, int>
#define F first
#define S second
#define f(i, n) for (int i = 0; i < (n); i++)
#define INF LLONG_MAX / 3
#define eps LDBL_EPSILON
#define mod (int)(1000000007)
#define pie 3.141592653589793238462643383279
#define Bpri priority_queue
#define Spri priority_queue<P, vector<P>, greater<P>>
using namespace std;
int x[200000], y[200000];
signed main() {
int n, ans = 0;
cin >> n;
f(i, n) { cin >> x[i + 1]; }
for (int i = n; i >= 1; i--) {
int cnt = 0;
for (int j = i; j <= n; j += i) {
cnt ^= y[j];
}
y[i] = x[i] ^ cnt;
ans += y[i];
}
cout << ans << endl;
bool bo = false;
f(i, n) {
if (bo)
cout << " ";
if (y[i + 1]) {
cout << y[i + 1];
bo = true;
}
}
}
| #include <bits/stdc++.h>
#define int long long
#define P pair<int, int>
#define PP pair<P, int>
#define F first
#define S second
#define f(i, n) for (int i = 0; i < (n); i++)
#define INF LLONG_MAX / 3
#define eps LDBL_EPSILON
#define mod (int)(1000000007)
#define pie 3.141592653589793238462643383279
#define Bpri priority_queue
#define Spri priority_queue<P, vector<P>, greater<P>>
using namespace std;
int x[200000], y[200000];
signed main() {
int n, ans = 0;
cin >> n;
f(i, n) { cin >> x[i + 1]; }
for (int i = n; i >= 1; i--) {
int cnt = 0;
for (int j = i; j <= n; j += i) {
cnt ^= y[j];
}
y[i] = x[i] ^ cnt;
ans += y[i];
}
cout << ans << endl;
bool bo = false;
f(i, n) {
if (bo)
cout << " ";
if (y[i + 1]) {
cout << i + 1;
bo = true;
}
}
}
| [] | 780,021 | 780,022 | u259210975 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
int main() {
#ifdef ARTHUR_LOCAL
ifstream cin("input.txt");
#endif
int n;
cin >> n;
vector<int> A = {-1};
for (int i = 0; i < n; i++) {
int a;
cin >> a;
A.push_back(a);
}
vector<int> ans(n + 1);
int ones = 0;
for (int i = n; i >= 1; i--) {
int cur_ind = i + i;
int cur_res = 0;
while (cur_ind < n) {
cur_res += ans[cur_ind];
cur_ind += i;
}
if (cur_res % 2 != A[i]) {
ans[i] = 1;
ones++;
}
}
cout << ones << "\n";
for (int i = 1; i <= n; i++) {
if (ans[i] == 1)
cout << i << " ";
}
if (ones > 0)
cout << "\n";
} | #include <bits/stdc++.h>
using namespace std;
int main() {
#ifdef ARTHUR_LOCAL
ifstream cin("input.txt");
#endif
int n;
cin >> n;
vector<int> A = {-1};
for (int i = 0; i < n; i++) {
int a;
cin >> a;
A.push_back(a);
}
vector<int> ans(n + 1);
int ones = 0;
for (int i = n; i >= 1; i--) {
int cur_ind = i + i;
int cur_res = 0;
while (cur_ind <= n) {
cur_res += ans[cur_ind];
cur_ind += i;
}
if (cur_res % 2 != A[i]) {
ans[i] = 1;
ones++;
}
}
cout << ones << "\n";
for (int i = 1; i <= n; i++) {
if (ans[i] == 1)
cout << i << " ";
}
if (ones > 0)
cout << "\n";
} | [
"expression.operator.compare.change",
"control_flow.loop.condition.change"
] | 780,025 | 780,026 | u263542246 | cpp |
p02972 | #include <algorithm>
#include <assert.h>
#include <bitset>
#include <chrono>
#include <cmath>
#include <complex>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define ll long long
#define rep2(i, a, b) for (ll i = a; i <= b; ++i)
#define rep(i, n) for (ll i = 0; i < n; i++)
#define rep3(i, a, b) for (ll i = a; i >= b; i--)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pq priority_queue<int>
#define pqg priority_queue<int, vector<int>, greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c), end(c)
using namespace std;
int in() {
int x;
scanf("%d", &x);
return x;
}
ll lin() {
ll x;
scanf("%lld", &x);
return x;
}
#define INF 1e9 + 7
#define LLINF 1e18 + 7
#define N 250000
ll MOD = 1e9 + 7;
main() {
int n = in();
int a[N];
rep(i, n) cin >> a[i + 1];
int b[N] = {};
rep3(i, n, 1) {
int tmp = 0;
rep3(j, n / i, 2) { tmp += b[j * i]; }
b[i] = (tmp + a[i]) % 2;
}
int m = 0;
rep2(i, 1, n) m += b[i];
cout << m << endl;
rep2(i, 1, n) if (b[i]) cout << b[i] << endl;
}
| #include <algorithm>
#include <assert.h>
#include <bitset>
#include <chrono>
#include <cmath>
#include <complex>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define ll long long
#define rep2(i, a, b) for (ll i = a; i <= b; ++i)
#define rep(i, n) for (ll i = 0; i < n; i++)
#define rep3(i, a, b) for (ll i = a; i >= b; i--)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pq priority_queue<int>
#define pqg priority_queue<int, vector<int>, greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c), end(c)
using namespace std;
int in() {
int x;
scanf("%d", &x);
return x;
}
ll lin() {
ll x;
scanf("%lld", &x);
return x;
}
#define INF 1e9 + 7
#define LLINF 1e18 + 7
#define N 250000
ll MOD = 1e9 + 7;
main() {
int n = in();
int a[N];
rep(i, n) cin >> a[i + 1];
int b[N] = {};
rep3(i, n, 1) {
int tmp = 0;
rep3(j, n / i, 2) {
tmp += b[j * i];
// cout<<i<<" "<<tmp<<endl;
}
b[i] = (tmp + a[i]) % 2;
}
int m = 0;
rep2(i, 1, n) m += b[i];
cout << m << endl;
rep2(i, 1, n) if (b[i]) cout << i << endl;
}
| [] | 780,027 | 780,028 | u495699318 | cpp |
p02972 | #include <iostream>
using namespace std;
int b[200001];
int main() {
int N;
int cnt = 0;
cin >> N;
int a[200001];
for (int i = 1; i <= N; i++)
cin >> a[i];
for (int i = N; i >= 1; i--) {
int sum = 0;
for (int j = 2; j * i <= N; j++) {
sum += b[j * i];
}
sum %= 2;
if (sum != a[i]) {
b[i] = 1;
cnt++;
}
}
cout << cnt << endl;
for (int i = 1; i <= N; i++) {
if (b[i] != 0)
cout << b[i] << endl;
}
} | #include <iostream>
using namespace std;
int b[200001];
int main() {
int N;
int cnt = 0;
cin >> N;
int a[200001];
for (int i = 1; i <= N; i++)
cin >> a[i];
for (int i = N; i >= 1; i--) {
int sum = 0;
for (int j = 2; j * i <= N; j++) {
sum += b[j * i];
}
sum %= 2;
if (sum != a[i]) {
b[i] = 1;
cnt++;
}
}
cout << cnt << endl;
for (int i = 1; i <= N; i++) {
if (b[i] != 0)
cout << i << endl;
}
} | [] | 780,037 | 780,038 | u693133807 | cpp |
p02972 | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("-O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#define fi first
#define se second
#define p_b push_back
#define pll pair<ll, ll>
#define pii pair<int, int>
#define m_p make_pair
#define all(x) x.begin(), x.end()
#define sset ordered_set
#define sqr(x) (x) * (x)
#define pw(x) (1ll << x)
#define delete _delete
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
const ll MAXN = 1123456;
const ll N = 1e6;
const ll mod = 1e9 + 7;
mt19937_64 rnd(chrono::system_clock::now().time_since_epoch().count());
template <typename T>
using ordered_set =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T> void vout(T s) {
cout << s << endl;
exit(0);
}
int main() {
ios_base ::sync_with_stdio(0);
cin.tie(0);
ll n;
cin >> n;
vector<ll> a(n + 1), b(n + 1);
for (int i = 1; i <= n; i++)
cin >> a[i];
vector<ll> ans;
for (int i = n; i > 0; i--) {
ll sc = 0;
for (int j = 2 * i; j <= n; j += i)
sc += b[j];
if (sc % 2 != a[i])
b[i] = 1;
if (b[i])
ans.p_b(1ll);
}
cout << ans.size() << "\n";
for (auto i : ans)
cout << i << " ";
cout << "\n";
cerr << "Time execute: " << clock() / (double)CLOCKS_PER_SEC << " sec"
<< endl;
return 0;
}
| #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("-O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#define fi first
#define se second
#define p_b push_back
#define pll pair<ll, ll>
#define pii pair<int, int>
#define m_p make_pair
#define all(x) x.begin(), x.end()
#define sset ordered_set
#define sqr(x) (x) * (x)
#define pw(x) (1ll << x)
#define delete _delete
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
const ll MAXN = 1123456;
const ll N = 1e6;
const ll mod = 1e9 + 7;
mt19937_64 rnd(chrono::system_clock::now().time_since_epoch().count());
template <typename T>
using ordered_set =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T> void vout(T s) {
cout << s << endl;
exit(0);
}
int main() {
ios_base ::sync_with_stdio(0);
cin.tie(0);
ll n;
cin >> n;
vector<ll> a(n + 1), b(n + 1);
for (int i = 1; i <= n; i++)
cin >> a[i];
vector<ll> ans;
for (int i = n; i > 0; i--) {
ll sc = 0;
for (int j = 2 * i; j <= n; j += i)
sc += b[j];
if (sc % 2 != a[i])
b[i] = 1;
if (b[i])
ans.p_b(i);
}
cout << ans.size() << "\n";
for (auto i : ans)
cout << i << " ";
cout << "\n";
cerr << "Time execute: " << clock() / (double)CLOCKS_PER_SEC << " sec"
<< endl;
return 0;
}
| [
"identifier.replace.add",
"literal.replace.remove",
"call.arguments.change"
] | 780,039 | 780,040 | u884914117 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char *s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B> string to_string(pair<A, B> p) {
return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A> string to_string(A v) {
bool first = true;
string res = "{";
for (const auto &x : v) {
if (!first) {
res += ", ";
}
first = false;
res += to_string(x);
}
res += "}";
return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
cerr << " " << to_string(H);
debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
void test_case() {
int n;
cin >> n;
vector<int> A(n + 1);
for (int i = 1; i <= n; ++i) {
cin >> A[i];
}
vector<int> take(n + 1);
for (int i = n; i >= 1; --i) {
int nxt = 0;
for (int j = i; j <= n; j += i) {
nxt += take[i];
}
nxt %= 2;
take[i] = (nxt != A[i]);
}
cout << accumulate(take.begin() + 1, take.end(), 0) << "\n";
for (int i = 1; i <= n; ++i) {
if (take[i]) {
cout << i << " ";
}
}
cout << "\n";
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
test_case();
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char *s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B> string to_string(pair<A, B> p) {
return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A> string to_string(A v) {
bool first = true;
string res = "{";
for (const auto &x : v) {
if (!first) {
res += ", ";
}
first = false;
res += to_string(x);
}
res += "}";
return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
cerr << " " << to_string(H);
debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
void test_case() {
int n;
cin >> n;
vector<int> A(n + 1);
for (int i = 1; i <= n; ++i) {
cin >> A[i];
}
vector<int> take(n + 1);
for (int i = n; i >= 1; --i) {
int nxt = 0;
for (int j = 2 * i; j <= n; j += i) {
nxt += take[j];
}
nxt %= 2;
take[i] = (nxt != A[i]);
}
cout << accumulate(take.begin() + 1, take.end(), 0) << "\n";
for (int i = 1; i <= n; ++i) {
if (take[i]) {
cout << i << " ";
}
}
cout << "\n";
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
test_case();
return 0;
}
| [
"control_flow.loop.for.initializer.change",
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change"
] | 780,041 | 780,042 | u774906517 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// const ll mod = 1000000007;
int N;
int a[205000];
int ans[205000];
int main() {
// cout.precision(10);
cin.tie(0);
ios::sync_with_stdio(false);
cin >> N;
int num = 0;
for (int i = 1; i <= N; i++)
cin >> a[i];
for (int i = N; i >= 1; i--) {
int now = 0;
for (int j = i; j <= N; j += i) {
now ^= a[j];
}
ans[i] = now;
if (ans[i])
num++;
}
cout << num << endl;
if (num == 0)
return 0;
for (int i = 1; i <= N; i++) {
if (ans[i])
cout << i << " ";
}
cout << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// const ll mod = 1000000007;
int N;
int a[205000];
int ans[205000];
int main() {
// cout.precision(10);
cin.tie(0);
ios::sync_with_stdio(false);
cin >> N;
int num = 0;
for (int i = 1; i <= N; i++)
cin >> a[i];
for (int i = N; i >= 1; i--) {
int now = a[i];
for (int j = i; j <= N; j += i) {
now ^= ans[j];
}
ans[i] = now;
if (ans[i])
num++;
}
cout << num << endl;
if (num == 0)
return 0;
for (int i = 1; i <= N; i++) {
if (ans[i])
cout << i << " ";
}
cout << endl;
return 0;
}
| [
"identifier.replace.add",
"literal.replace.remove",
"assignment.value.change",
"identifier.change"
] | 780,043 | 780,044 | u980655160 | cpp |
p02972 | #include <bits/stdc++.h>
//#pragma GCC target("avx,avx2,sse4.2")
#define rep(q, a, b) for (int q = a, q##_end_ = b; q <= q##_end_; ++q)
#define dep(q, a, b) for (int q = a, q##_end_ = b; q >= q##_end_; --q)
#define mem(a, b) memset(a, b, sizeof a)
#define debug(a) cerr << #a << ' ' << a << "___" << endl
using namespace std;
// char buf[10000000], *p1 = buf, *p2 = buf;
#define Getchar() \
getchar() // p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 10000000, stdin), p1
// == p2) ? EOF : *p1++
void in(int &r) {
static char c;
r = 0;
while (c = Getchar(), c < 48)
;
;
do
r = (r << 1) + (r << 3) + (c ^ 48);
while (c = Getchar(), c > 47);
}
const int mn = 200005;
int val[mn], ans[mn];
int main() {
int n;
in(n);
rep(q, 1, n) in(val[q]);
dep(q, n, 1) {
int tot = 0;
for (int w = q + q; w <= n; w += q)
tot += ans[q];
tot &= 1;
ans[q] = tot ^ val[q];
}
int v = 0;
rep(q, 1, n) if (ans[q])++ v;
cout << v << endl;
rep(q, 1, n) if (ans[q]) printf("%d ", q);
return 0;
} | #include <bits/stdc++.h>
//#pragma GCC target("avx,avx2,sse4.2")
#define rep(q, a, b) for (int q = a, q##_end_ = b; q <= q##_end_; ++q)
#define dep(q, a, b) for (int q = a, q##_end_ = b; q >= q##_end_; --q)
#define mem(a, b) memset(a, b, sizeof a)
#define debug(a) cerr << #a << ' ' << a << "___" << endl
using namespace std;
// char buf[10000000], *p1 = buf, *p2 = buf;
#define Getchar() \
getchar() // p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 10000000, stdin), p1
// == p2) ? EOF : *p1++
void in(int &r) {
static char c;
r = 0;
while (c = Getchar(), c < 48)
;
;
do
r = (r << 1) + (r << 3) + (c ^ 48);
while (c = Getchar(), c > 47);
}
const int mn = 200005;
int val[mn], ans[mn];
int main() {
int n;
in(n);
rep(q, 1, n) in(val[q]);
dep(q, n, 1) {
int tot = 0;
for (int w = q + q; w <= n; w += q)
tot += ans[w];
tot &= 1;
ans[q] = tot ^ val[q];
}
int v = 0;
rep(q, 1, n) if (ans[q])++ v;
cout << v << endl;
rep(q, 1, n) if (ans[q]) printf("%d ", q);
return 0;
} | [
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change"
] | 780,045 | 780,046 | u063024444 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
#define N 200010
int n, a[N], b[N];
bool ok() {
for (int i = 1; i <= n; ++i) {
int tot = 0;
for (int j = i; j <= n; j += i) {
tot = tot + b[j];
tot %= 2;
}
if (tot ^ b[i])
return 0;
}
return 1;
}
int main() {
while (scanf("%d", &n) != EOF) {
for (int i = 1; i <= n; ++i)
scanf("%d", a + i);
for (int i = n; i >= 1; --i) {
int now = 0;
for (int j = i + i; j <= n; j += i) {
now += b[j];
now %= 2;
}
b[i] = now ^ a[i];
}
if (ok()) {
vector<int> vec;
for (int i = 1; i <= n; ++i)
if (b[i])
vec.push_back(i);
int sze = (int)vec.size();
printf("%d\n", sze);
for (int i = 0; i < sze; ++i)
printf("%d%c", vec[i], " \n"[i == sze - 1]);
} else
puts("-1");
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define N 200010
int n, a[N], b[N];
bool ok() {
for (int i = 1; i <= n; ++i) {
int tot = 0;
for (int j = i; j <= n; j += i) {
tot = tot + b[j];
tot %= 2;
}
if (tot ^ a[i])
return 0;
}
return 1;
}
int main() {
while (scanf("%d", &n) != EOF) {
for (int i = 1; i <= n; ++i)
scanf("%d", a + i);
for (int i = n; i >= 1; --i) {
int now = 0;
for (int j = i + i; j <= n; j += i) {
now += b[j];
now %= 2;
}
b[i] = now ^ a[i];
}
if (ok()) {
vector<int> vec;
for (int i = 1; i <= n; ++i)
if (b[i])
vec.push_back(i);
int sze = (int)vec.size();
printf("%d\n", sze);
for (int i = 0; i < sze; ++i)
printf("%d%c", vec[i], " \n"[i == sze - 1]);
} else
puts("-1");
}
return 0;
}
| [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 780,049 | 780,050 | u717168969 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
#define N 200010
int n, a[N], b[N];
bool ok() {
for (int i = 1; i <= n; ++i) {
int tot = 0;
for (int j = i; j <= n; j += i) {
tot = tot + b[j];
tot %= 2;
}
if (tot ^ b[i])
return 0;
}
return 1;
}
int main() {
while (scanf("%d", &n) != EOF) {
for (int i = 1; i <= n; ++i)
scanf("%d", a + i);
for (int i = n; i >= 1; --i) {
int now = 0;
for (int j = i + i; j <= n; j += i) {
now += b[j];
}
b[i] = now ^ a[i];
}
if (ok()) {
vector<int> vec;
for (int i = 1; i <= n; ++i)
if (b[i])
vec.push_back(i);
int sze = (int)vec.size();
printf("%d\n", sze);
for (int i = 0; i < sze; ++i)
printf("%d%c", vec[i], " \n"[i == sze - 1]);
} else
puts("-1");
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define N 200010
int n, a[N], b[N];
bool ok() {
for (int i = 1; i <= n; ++i) {
int tot = 0;
for (int j = i; j <= n; j += i) {
tot = tot + b[j];
tot %= 2;
}
if (tot ^ a[i])
return 0;
}
return 1;
}
int main() {
while (scanf("%d", &n) != EOF) {
for (int i = 1; i <= n; ++i)
scanf("%d", a + i);
for (int i = n; i >= 1; --i) {
int now = 0;
for (int j = i + i; j <= n; j += i) {
now += b[j];
now %= 2;
}
b[i] = now ^ a[i];
}
if (ok()) {
vector<int> vec;
for (int i = 1; i <= n; ++i)
if (b[i])
vec.push_back(i);
int sze = (int)vec.size();
printf("%d\n", sze);
for (int i = 0; i < sze; ++i)
printf("%d%c", vec[i], " \n"[i == sze - 1]);
} else
puts("-1");
}
return 0;
}
| [
"identifier.change",
"control_flow.branch.if.condition.change",
"assignment.add"
] | 780,051 | 780,050 | u717168969 | cpp |
p02972 | #include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <vector>
using namespace std;
int main() {
int n, tmp, sz = 0;
vector<int> v, ans;
cin >> n;
v.resize(n + 1);
ans.resize(n + 1);
for (int i = 1; i < n + 1; i++)
cin >> v[i];
for (int i = 1; i < n + 1; i++)
ans[i] = 0;
for (int i = n; i > 0; i--) {
tmp = v[i];
for (int j = i * 2; j <= n; j += i) {
if (ans[j])
tmp++;
}
if (tmp % 2 == 1) {
ans[i] = 1;
sz++;
}
}
cout << sz << endl;
for (int i = 1; i <= sz; i++) {
if (ans[i])
cout << i << " ";
}
cout << endl;
} | #include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <vector>
using namespace std;
int main() {
int n, tmp, sz = 0;
vector<int> v, ans;
cin >> n;
v.resize(n + 1);
ans.resize(n + 1);
for (int i = 1; i < n + 1; i++)
cin >> v[i];
for (int i = 1; i < n + 1; i++)
ans[i] = 0;
for (int i = n; i > 0; i--) {
tmp = v[i];
for (int j = i * 2; j <= n; j += i) {
if (ans[j])
tmp++;
}
if (tmp % 2 == 1) {
ans[i] = 1;
sz++;
// cout<< "eee" << i <<endl;
}
}
cout << sz << endl;
for (int i = 1; i <= n; i++) {
if (ans[i])
cout << i << " ";
}
cout << endl;
} | [
"identifier.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change"
] | 780,052 | 780,053 | u672995180 | cpp |
p02972 | #include <bits/stdc++.h>
#define itn int
#define REP(i, n) for (int i = 0; i < n; i++)
#define IREP(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(a, b) for (int i = a; i < b + 1; i++)
using namespace std;
typedef long long ll;
int main() {
int n;
cin >> n;
vector<int> v;
vector<bool> vv(n);
int ans = 0;
REP(i, n) {
int a;
cin >> a;
v.push_back(a);
}
IREP(i, n) {
if (i + 1 > n / 2) {
if (v[i] == 0) {
vv[i] = false;
} else {
vv[i] = true;
ans++;
}
} else {
int tmp = 0;
for (int j = (i + 1) * 2; j <= n - (n % (i + 1)); j += i + 1) {
if (vv[j - 1] == true) {
tmp++;
}
}
if (tmp % 2 == 1 && v[i] == 0) {
vv[i] = true;
ans++;
} else if (tmp % 2 == 0 && v[i] == 1) {
vv[i] = true;
ans++;
} else {
vv[i] = false;
}
}
}
cout << ans << endl;
int ans2 = 0;
REP(i, n) {
if (vv[i] == true) {
cout << vv[i];
ans2++;
if (ans2 == ans) {
cout << endl;
} else {
cout << " ";
}
}
}
} | #include <bits/stdc++.h>
#define itn int
#define REP(i, n) for (int i = 0; i < n; i++)
#define IREP(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(a, b) for (int i = a; i < b + 1; i++)
using namespace std;
typedef long long ll;
int main() {
int n;
cin >> n;
vector<int> v;
vector<bool> vv(n);
int ans = 0;
REP(i, n) {
int a;
cin >> a;
v.push_back(a);
}
IREP(i, n) {
if (i + 1 > n / 2) {
if (v[i] == 0) {
vv[i] = false;
} else {
vv[i] = true;
ans++;
}
} else {
int tmp = 0;
for (int j = (i + 1) * 2; j <= n - (n % (i + 1)); j += i + 1) {
if (vv[j - 1] == true) {
tmp++;
}
}
if (tmp % 2 == 1 && v[i] == 0) {
vv[i] = true;
ans++;
} else if (tmp % 2 == 0 && v[i] == 1) {
vv[i] = true;
ans++;
} else {
vv[i] = false;
}
}
}
cout << ans << endl;
int ans2 = 0;
REP(i, n) {
if (vv[i] == true) {
cout << i + 1;
ans2++;
if (ans2 == ans) {
cout << endl;
} else {
cout << " ";
}
}
}
} | [
"io.output.change"
] | 780,054 | 780,055 | u118875091 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
int n, ans;
int a[MAXN], f[MAXN];
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 = (sum + f[i]) % 2;
f[i] = a[i] ^ sum;
if (f[i])
ans++;
}
printf("%d\n", ans);
for (int i = 1; i <= n; i++)
if (f[i])
printf("%d ", i);
if (ans)
printf("\n");
// system("pause");
} | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
int n, ans;
int a[MAXN], f[MAXN];
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 = (sum + f[j]) % 2;
f[i] = a[i] ^ sum;
// printf("sum : %d a: %d f: %d\n", sum, a[i], f[i]);
if (f[i])
ans++;
}
printf("%d\n", ans);
for (int i = 1; i <= n; i++)
if (f[i])
printf("%d ", i);
if (ans)
printf("\n");
// system("pause");
} | [
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change",
"expression.operation.binary.change"
] | 780,058 | 780,059 | u462461621 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define all(a) (a).begin(), (a).end()
#define endl "\n"
#define rep(i, a, b) for (auto i = (a); i < (b); ++i)
#define rrep(i, a, b) for (auto i = (a); i > (b); --i)
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end())
typedef long long ll;
typedef unsigned long long ull;
#ifdef LOCAL_DEFINE
struct InitInput {
InitInput() {
FILE *stream1;
stream1 = freopen("in.txt", "r", stdin);
assert(stream1 != nullptr);
cerr << "This problem is not interactive" << endl;
}
} LOCAL_INPUT;
struct LOCAL_OUTPUT {
LOCAL_OUTPUT() {
FILE *stream2;
const char *outputfile = "out.txt";
stream2 = freopen(outputfile, "w", stdout);
assert(stream2 != nullptr);
cerr << "output [ " << outputfile << " ]" << endl;
}
} /*LOCAL_OUTPUT*/;
#define show(x) \
cerr << #x << " = " << (x) << " (line " << __LINE__ << ")" << endl
#define showA(a, n) \
do { \
for (int i = 0; i < (n); i++) \
cerr << "(" << i << " = " << (a)[i] << ") "; \
cerr << endl; \
} while (0)
#define showA2(a, n, m) \
do { \
for (int i = 0; i < (n); i++) { \
for (int j = 0; j < (m); j++) { \
cerr << "(" << i << ", " << j << " = " << (a)[i][j] << ") "; \
} \
cerr << endl; \
} \
cerr << endl; \
} while (0)
#else
#define show(x)
#define showA(a, n)
#define showA2(a, n, m)
#endif
struct InitAim {
InitAim() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.precision(12);
cout << fixed;
#ifdef LOCAL_DEFINE
cerr << "This problem is not interactive" << endl;
#endif
}
} aim_cpo;
///////////////////////////////////////////////////////////////////////////////////
// TEMPLATE(data structure)
///////////////////////////////////////////////////////////////////////////////////
template <typename T> bool chmin(T &a, T b) {
return a > b ? (a = b, true) : false;
}
template <typename T> bool chmax(T &a, T b) {
return a < b ? (a = b, true) : false;
}
template <typename T> void ln(T i, T n) { cout << (i == n - 1 ? "\n" : " "); }
template <typename T, typename S>
ostream &operator<<(ostream &out, const pair<T, S> &pair1) {
out << '(' << pair1.fi << ", " << pair1.se << ')';
return out;
}
template <typename T>
ostream &operator<<(ostream &out, const vector<T> &vector1) {
out << '[';
for (unsigned int i = 0; i < vector1.size(); i++) {
out << vector1[i];
if (i == vector1.size() - 1)
out << "]";
else
out << ", ";
}
return out;
}
#define GCD(a, b) __gcd(a, b)
template <typename T> T LCM(T a, T b) { return a / GCD(a, b) * b; }
template <typename T> T EXTGCD(T a, T b, T &x, T &y) {
T d = a;
if (b != 0) {
d = EXTGCD(b, a % b, y, x);
y -= (a / b) * x;
} else
x = 1, y = 0;
return d;
}
template <typename T> bool is_prime(T a) {
for (int i = 2; i * i <= a; i++)
if (a % i == 0)
return true;
return false;
}
template <typename T, typename S> T Pow(T a, S b) {
T res = 1, now = a;
while (b) {
if (b & 1)
res *= now;
b >>= 1;
now *= now;
}
return res;
}
/* MOD */
ll MOD = 1000000000LL + 7LL;
class Mint {
public:
ll x;
Mint() : x(0) {}
Mint(const int x) { this->x = (MOD + x % MOD) % MOD; }
Mint(const ll x) { this->x = (MOD + x % MOD) % MOD; }
Mint(const Mint &c) { this->x = c.x; }
Mint &operator=(const int c) {
this->x = (MOD + c % MOD) % MOD;
return *this;
}
Mint &operator=(const ll c) {
this->x = (MOD + c % MOD) % MOD;
return *this;
}
Mint &operator=(const Mint c) {
this->x = c.x;
return *this;
}
bool operator==(const Mint &b) { return x == b.x; }
bool operator!=(const Mint &b) { return !(x == b.x); }
bool operator<(const Mint &b) { return x < b.x; }
bool operator>(const Mint &b) { return x > b.x; }
};
ostream &operator<<(ostream &out, const Mint &mint) {
out << mint.x;
return out;
}
istream &operator>>(istream &in, const Mint &mint) {
in >> mint.x;
return in;
}
Mint add(const Mint a, const Mint b) {
const ll x = (a.x + b.x) % MOD;
return Mint(x);
}
Mint mul(const Mint a, const Mint b) {
ll x = (a.x * b.x) % MOD;
return Mint(x);
}
template <typename T> Mint ModPow(Mint a, T b) {
assert(b >= 0);
Mint res = 1;
while (b) {
if (b & 1)
res = mul(res, a);
b >>= 1;
a = mul(a, a);
}
return res;
}
inline Mint ModInverse(const Mint x) {
ll a = x.x, b = MOD, u = 1, v = 0;
while (b) {
ll t = a / b;
swap(a -= t * b, b);
swap(u -= t * v, v);
}
Mint res(u);
return res;
}
Mint operator-(const Mint x) { return Mint(-x.x); }
Mint operator+(const Mint a, const Mint b) { return add(a, b); }
Mint operator*(const Mint a, const Mint b) { return mul(a, b); }
Mint operator-(const Mint a, const Mint b) { return add(a, -b); }
template <typename T> Mint operator+(const Mint a, const T b) {
return add(a, Mint(b));
}
template <typename T> Mint operator*(const Mint a, const T b) {
return mul(a, Mint(b));
}
template <typename T> Mint operator-(const Mint a, const T b) {
return add(a, Mint(-b));
}
template <typename T> Mint operator/(const Mint a, const T b) {
return mul(a, ModInverse(Mint(b)));
}
template <typename T> Mint operator^(const Mint a, const T b) {
return ModPow(a, b);
}
template <typename T> Mint operator+=(Mint &a, const T b) {
a = a + b;
return a;
}
template <typename T> Mint operator-=(Mint &a, const T b) {
a = a - b;
return a;
}
template <typename T> Mint operator*=(Mint &a, const T b) {
a = a * b;
return a;
}
template <typename T> Mint operator/=(Mint &a, const T b) {
a = a / b;
return a;
}
template <typename T> T EulerTotient(T a) {
vector<pair<int, int>> v;
for (T i = 2; i * i <= a; i++) {
int cnt = 0;
while (a % i == 0) {
cnt++;
a /= i;
}
if (cnt != 0)
v.emplace_back(i, cnt);
}
if (a != 1)
v.emplace_back(a, 1);
// showV(v, (int) v.size());
T res = 1;
for (int i = 0; i < (int)v.size(); i++) {
if (v[i].se == 1) {
res *= v[i].fi - 1;
} else {
res *= Pow(v[i].fi, v[i].se) - Pow(v[i].fi, v[i].se - 1);
}
}
return res;
}
template <typename T, typename S> Mint comb(T a, S b) {
chmin(b, a - b);
Mint res = 1LL, now = a;
for (ll i = 1; i <= b; i++) {
res *= now;
res /= i;
now -= 1;
}
return res;
}
template <typename T> class BIT {
public:
BIT(int size) { BITTable.assign(++size, 0); }
T sum(int k) {
T res = 0;
for (++k; k > 0; k -= k & -k) {
res += BITTable[k];
}
return res;
}
T sum(int l, int r) {
if (l == 0)
return sum(r);
return sum(r) - sum(l - 1);
}
void update(int k, T x) { // b[k] += x;
for (++k; k < (int)BITTable.size(); k += k & -k)
BITTable[k] += x;
}
private:
vector<T> BITTable;
};
template <typename T> class IntervalTree {
using F = function<T(T, T)>;
public:
IntervalTree(int n, const F func, const T init) : func(func), init(init) {
size = 1;
while ((int)size < n)
size <<= 1;
table.assign(2 * size, init);
}
void set(int k, T &x) { table[size + k] = x; }
void build() {
for (int i = size - 1; i >= 0; --i) {
table[i] = func(table[i * 2], table[i * 2 + 1]);
}
}
void update(int k, const T &x) {
k += size;
table[k] = x;
while (k >>= 1) {
table[k] = func(table[k * 2], table[k * 2 + 1]);
}
}
T query(int a, int b) {
T L = init, R = init;
for (a += size, b += size; a < b; a >>= 1, b >>= 1) {
if (a & 1)
L = func(L, table[a++]);
if (b & 1)
R = func(table[--b], R);
}
return func(L, R);
}
T operator[](const int k) const { return table[k + size]; }
private:
unsigned int size;
vector<T> table;
const F func;
const T init;
};
class UnionFind {
public:
explicit UnionFind(int _n) : n(_n) {
par.resize(static_cast<unsigned long>(_n));
rank.resize(static_cast<unsigned long>(_n));
sizes.resize(static_cast<unsigned long>(_n));
for (int i = 0; i < _n; i++) {
par[i] = i;
rank[i] = 0;
sizes[i] = 1;
}
}
int find(int a) {
if (par[a] == a)
return a;
return par[a] = find(par[a]);
}
bool same(int a, int b) { return find(a) == find(b); }
void unite(int a, int b) { link(find(a), find(b)); }
int size(int a) { return sizes[find(a)]; }
void view() {
for (int i = 0; i < n; i++) {
cout << " par"
<< "[" << i << "]=" << par[i] << ((i == n - 1) ? "\n" : ",");
}
for (int i = 0; i < n; i++) {
cout << "size"
<< "[" << i << "]=" << sizes[i] << ((i == n - 1) ? "\n" : ",");
}
cout << endl;
}
private:
void link(int a, int b) {
if (same(a, b))
return;
if (rank[a] > rank[b]) {
par[b] = a;
sizes[a] += sizes[b];
sizes[b] = 0;
} else {
par[a] = b;
if (rank[a] == rank[b])
rank[b]++;
sizes[b] += sizes[a];
sizes[a] = 0;
}
}
int n;
vector<int> par;
vector<int> rank;
vector<int> sizes;
};
template <typename T> class Dinic {
public:
Dinic(int SIZE) : SIZE(SIZE) {
v = vector<vector<tuple<int, T, int>>>(SIZE + 10);
}
void AddEdge(int from, int to, T cap) {
v[from].push_back(make_tuple(to, cap, v[to].size()));
v[to].push_back(make_tuple(from, 0, v[from].size() - 1));
}
void bfs(int s) {
level = vector<int>(SIZE + 10, -1);
queue<int> q;
level[s] = 0;
q.push(s);
while (!q.empty()) {
int now = q.front();
q.pop();
for (int i = 0; i < (int)v[now].size(); i++) {
int next, nextrv;
T nextc;
tie(next, nextc, nextrv) = v[now][i];
if (nextc > 0 && level[next] < 0) {
level[next] = level[now] + 1;
q.push(next);
}
}
}
}
T dfs(int now, int t, T f) {
if (now == t)
return f;
for (int &i = iter[now]; i < (int)v[now].size(); i++) {
int next, nextrv;
T nextc;
tie(next, nextc, nextrv) = v[now][i];
if (nextc > 0 && level[now] < level[next]) {
T d = dfs(next, t, min(f, nextc));
if (d > 0) {
get<1>(v[now][i]) -= d;
get<1>(v[next][nextrv]) += d;
return d;
}
}
}
return 0;
}
T max_flow(int s, int t) {
T flow = 0;
for (;;) {
bfs(s);
if (level[t] < 0)
return flow;
iter = vector<int>(SIZE + 10, 0);
int f;
while ((f = dfs(s, t, INT_MAX)) > 0) {
flow += f;
}
}
}
private:
int SIZE;
vector<vector<tuple<int, T, int>>> v;
vector<int> level, iter;
};
template <typename flow_t, typename cost_t> struct PrimalDual {
const cost_t INF;
struct edge {
int to;
flow_t cap;
cost_t cost;
int rev;
bool isrev;
};
vector<vector<edge>> graph;
vector<cost_t> potential, min_cost;
vector<int> prevv, preve;
PrimalDual(int V) : graph(V), INF(numeric_limits<cost_t>::max()) {}
void add_edge(int from, int to, flow_t cap, cost_t cost) {
graph[from].emplace_back(
(edge){to, cap, cost, (int)graph[to].size(), false});
graph[to].emplace_back(
(edge){from, 0, -cost, (int)graph[from].size() - 1, true});
}
cost_t min_cost_flow(int s, int t, flow_t f) {
int V = (int)graph.size();
cost_t ret = 0;
using Pi = pair<cost_t, int>;
priority_queue<Pi, vector<Pi>, greater<Pi>> que;
potential.assign(V, 0);
preve.assign(V, -1);
prevv.assign(V, -1);
while (f > 0) {
min_cost.assign(V, INF);
que.emplace(0, s);
min_cost[s] = 0;
while (!que.empty()) {
Pi p = que.top();
que.pop();
if (min_cost[p.second] < p.first)
continue;
for (int i = 0; i < graph[p.second].size(); i++) {
edge &e = graph[p.second][i];
cost_t nextCost = min_cost[p.second] + e.cost + potential[p.second] -
potential[e.to];
if (e.cap > 0 && min_cost[e.to] > nextCost) {
min_cost[e.to] = nextCost;
prevv[e.to] = p.second, preve[e.to] = i;
que.emplace(min_cost[e.to], e.to);
}
}
}
if (min_cost[t] == INF)
return -1;
for (int v = 0; v < V; v++)
potential[v] += min_cost[v];
flow_t addflow = f;
for (int v = t; v != s; v = prevv[v]) {
addflow = min(addflow, graph[prevv[v]][preve[v]].cap);
}
f -= addflow;
ret += addflow * potential[t];
for (int v = t; v != s; v = prevv[v]) {
edge &e = graph[prevv[v]][preve[v]];
e.cap -= addflow;
graph[v][e.rev].cap += addflow;
}
}
return ret;
}
void output() {
for (int i = 0; i < graph.size(); i++) {
for (auto &e : graph[i]) {
if (e.isrev)
continue;
auto &rev_e = graph[e.to][e.rev];
cout << i << "->" << e.to << " (flow: " << rev_e.cap << "/"
<< rev_e.cap + e.cap << ")" << endl;
}
}
}
};
template <typename T> using Matrix = vector<vector<T>>;
template <typename T> void init(int h, int w, Matrix<T> &matrix) {
matrix = vector<vector<T>>(h, vector<T>(w));
/*for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
cin >> matrix[i][j];
}
}*/
}
template <typename T>
Matrix<T> &operator*(Matrix<T> &matrix, Matrix<T> &matrix1) {
int height = (int)matrix.size();
int width = (int)matrix[0].size();
int height2 = (int)matrix1.size();
int width2 = (int)matrix1[0].size();
assert(width == height2);
Matrix<T> res;
res = vector<vector<T>>(height, vector<T>(width2, 0));
for (int i = 0; i < height; i++) {
for (int j = 0; j < width2; j++) {
for (int k = 0; k < width; k++) {
res[i][j] += matrix[i][k] * matrix1[k][j];
}
}
}
matrix.swap(res);
return matrix;
}
template <typename T> Matrix<T> Pow(Matrix<T> matrix, ll x) {
Matrix<T> res = vector<vector<T>>(matrix.size(), vector<T>(matrix.size(), 0));
for (int i = 0; i < (int)matrix.size(); i++) {
res[i][i] = 1;
}
while (x) {
if (x & 1) {
res = res * matrix;
}
matrix = matrix * matrix;
x >>= 1;
}
return res;
}
///////////////////////////////////////////////////////////////////////////////////
// MAIN
///////////////////////////////////////////////////////////////////////////////////
// 735134400 約数が1344個ある高度合成数(<= 1e9)
// 897612484786617600 約数が103680個ある高度合成数(<= 1e18)
// 苦手分野 重複順列
// LLの数値をつかう時は最後にLLをつける癖をつけよう
// Mintの数値にしたいときは、Mint(i)みたいにキャストしてね
int n;
bool a[200001];
bool b[200001];
int main() {
cin >> n;
rep(i, 0, n) { cin >> a[i]; }
rrep(i, n, 0) {
bool now = a[i - 1];
for (int j = i * 2; j <= n; j += i) {
now ^= b[j - 1];
}
b[i - 1] = now;
}
showA(b, n);
int m = 0;
rep(i, 0, n) if (b[i]) m++;
cout << m << endl;
rep(i, 0, n) if (b[i]) { cout << 1 << " "; }
#ifdef LOCAL_DEFINE
cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s." << endl;
show(MOD);
#endif
return 0;
}
///////////////////////////////////////////////////////////////////////////////////
// NOTE
///////////////////////////////////////////////////////////////////////////////////
/*
*/ | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define all(a) (a).begin(), (a).end()
#define endl "\n"
#define rep(i, a, b) for (auto i = (a); i < (b); ++i)
#define rrep(i, a, b) for (auto i = (a); i > (b); --i)
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end())
typedef long long ll;
typedef unsigned long long ull;
#ifdef LOCAL_DEFINE
struct InitInput {
InitInput() {
FILE *stream1;
stream1 = freopen("in.txt", "r", stdin);
assert(stream1 != nullptr);
cerr << "This problem is not interactive" << endl;
}
} LOCAL_INPUT;
struct LOCAL_OUTPUT {
LOCAL_OUTPUT() {
FILE *stream2;
const char *outputfile = "out.txt";
stream2 = freopen(outputfile, "w", stdout);
assert(stream2 != nullptr);
cerr << "output [ " << outputfile << " ]" << endl;
}
} /*LOCAL_OUTPUT*/;
#define show(x) \
cerr << #x << " = " << (x) << " (line " << __LINE__ << ")" << endl
#define showA(a, n) \
do { \
for (int i = 0; i < (n); i++) \
cerr << "(" << i << " = " << (a)[i] << ") "; \
cerr << endl; \
} while (0)
#define showA2(a, n, m) \
do { \
for (int i = 0; i < (n); i++) { \
for (int j = 0; j < (m); j++) { \
cerr << "(" << i << ", " << j << " = " << (a)[i][j] << ") "; \
} \
cerr << endl; \
} \
cerr << endl; \
} while (0)
#else
#define show(x)
#define showA(a, n)
#define showA2(a, n, m)
#endif
struct InitAim {
InitAim() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.precision(12);
cout << fixed;
#ifdef LOCAL_DEFINE
cerr << "This problem is not interactive" << endl;
#endif
}
} aim_cpo;
///////////////////////////////////////////////////////////////////////////////////
// TEMPLATE(data structure)
///////////////////////////////////////////////////////////////////////////////////
template <typename T> bool chmin(T &a, T b) {
return a > b ? (a = b, true) : false;
}
template <typename T> bool chmax(T &a, T b) {
return a < b ? (a = b, true) : false;
}
template <typename T> void ln(T i, T n) { cout << (i == n - 1 ? "\n" : " "); }
template <typename T, typename S>
ostream &operator<<(ostream &out, const pair<T, S> &pair1) {
out << '(' << pair1.fi << ", " << pair1.se << ')';
return out;
}
template <typename T>
ostream &operator<<(ostream &out, const vector<T> &vector1) {
out << '[';
for (unsigned int i = 0; i < vector1.size(); i++) {
out << vector1[i];
if (i == vector1.size() - 1)
out << "]";
else
out << ", ";
}
return out;
}
#define GCD(a, b) __gcd(a, b)
template <typename T> T LCM(T a, T b) { return a / GCD(a, b) * b; }
template <typename T> T EXTGCD(T a, T b, T &x, T &y) {
T d = a;
if (b != 0) {
d = EXTGCD(b, a % b, y, x);
y -= (a / b) * x;
} else
x = 1, y = 0;
return d;
}
template <typename T> bool is_prime(T a) {
for (int i = 2; i * i <= a; i++)
if (a % i == 0)
return true;
return false;
}
template <typename T, typename S> T Pow(T a, S b) {
T res = 1, now = a;
while (b) {
if (b & 1)
res *= now;
b >>= 1;
now *= now;
}
return res;
}
/* MOD */
ll MOD = 1000000000LL + 7LL;
class Mint {
public:
ll x;
Mint() : x(0) {}
Mint(const int x) { this->x = (MOD + x % MOD) % MOD; }
Mint(const ll x) { this->x = (MOD + x % MOD) % MOD; }
Mint(const Mint &c) { this->x = c.x; }
Mint &operator=(const int c) {
this->x = (MOD + c % MOD) % MOD;
return *this;
}
Mint &operator=(const ll c) {
this->x = (MOD + c % MOD) % MOD;
return *this;
}
Mint &operator=(const Mint c) {
this->x = c.x;
return *this;
}
bool operator==(const Mint &b) { return x == b.x; }
bool operator!=(const Mint &b) { return !(x == b.x); }
bool operator<(const Mint &b) { return x < b.x; }
bool operator>(const Mint &b) { return x > b.x; }
};
ostream &operator<<(ostream &out, const Mint &mint) {
out << mint.x;
return out;
}
istream &operator>>(istream &in, const Mint &mint) {
in >> mint.x;
return in;
}
Mint add(const Mint a, const Mint b) {
const ll x = (a.x + b.x) % MOD;
return Mint(x);
}
Mint mul(const Mint a, const Mint b) {
ll x = (a.x * b.x) % MOD;
return Mint(x);
}
template <typename T> Mint ModPow(Mint a, T b) {
assert(b >= 0);
Mint res = 1;
while (b) {
if (b & 1)
res = mul(res, a);
b >>= 1;
a = mul(a, a);
}
return res;
}
inline Mint ModInverse(const Mint x) {
ll a = x.x, b = MOD, u = 1, v = 0;
while (b) {
ll t = a / b;
swap(a -= t * b, b);
swap(u -= t * v, v);
}
Mint res(u);
return res;
}
Mint operator-(const Mint x) { return Mint(-x.x); }
Mint operator+(const Mint a, const Mint b) { return add(a, b); }
Mint operator*(const Mint a, const Mint b) { return mul(a, b); }
Mint operator-(const Mint a, const Mint b) { return add(a, -b); }
template <typename T> Mint operator+(const Mint a, const T b) {
return add(a, Mint(b));
}
template <typename T> Mint operator*(const Mint a, const T b) {
return mul(a, Mint(b));
}
template <typename T> Mint operator-(const Mint a, const T b) {
return add(a, Mint(-b));
}
template <typename T> Mint operator/(const Mint a, const T b) {
return mul(a, ModInverse(Mint(b)));
}
template <typename T> Mint operator^(const Mint a, const T b) {
return ModPow(a, b);
}
template <typename T> Mint operator+=(Mint &a, const T b) {
a = a + b;
return a;
}
template <typename T> Mint operator-=(Mint &a, const T b) {
a = a - b;
return a;
}
template <typename T> Mint operator*=(Mint &a, const T b) {
a = a * b;
return a;
}
template <typename T> Mint operator/=(Mint &a, const T b) {
a = a / b;
return a;
}
template <typename T> T EulerTotient(T a) {
vector<pair<int, int>> v;
for (T i = 2; i * i <= a; i++) {
int cnt = 0;
while (a % i == 0) {
cnt++;
a /= i;
}
if (cnt != 0)
v.emplace_back(i, cnt);
}
if (a != 1)
v.emplace_back(a, 1);
// showV(v, (int) v.size());
T res = 1;
for (int i = 0; i < (int)v.size(); i++) {
if (v[i].se == 1) {
res *= v[i].fi - 1;
} else {
res *= Pow(v[i].fi, v[i].se) - Pow(v[i].fi, v[i].se - 1);
}
}
return res;
}
template <typename T, typename S> Mint comb(T a, S b) {
chmin(b, a - b);
Mint res = 1LL, now = a;
for (ll i = 1; i <= b; i++) {
res *= now;
res /= i;
now -= 1;
}
return res;
}
template <typename T> class BIT {
public:
BIT(int size) { BITTable.assign(++size, 0); }
T sum(int k) {
T res = 0;
for (++k; k > 0; k -= k & -k) {
res += BITTable[k];
}
return res;
}
T sum(int l, int r) {
if (l == 0)
return sum(r);
return sum(r) - sum(l - 1);
}
void update(int k, T x) { // b[k] += x;
for (++k; k < (int)BITTable.size(); k += k & -k)
BITTable[k] += x;
}
private:
vector<T> BITTable;
};
template <typename T> class IntervalTree {
using F = function<T(T, T)>;
public:
IntervalTree(int n, const F func, const T init) : func(func), init(init) {
size = 1;
while ((int)size < n)
size <<= 1;
table.assign(2 * size, init);
}
void set(int k, T &x) { table[size + k] = x; }
void build() {
for (int i = size - 1; i >= 0; --i) {
table[i] = func(table[i * 2], table[i * 2 + 1]);
}
}
void update(int k, const T &x) {
k += size;
table[k] = x;
while (k >>= 1) {
table[k] = func(table[k * 2], table[k * 2 + 1]);
}
}
T query(int a, int b) {
T L = init, R = init;
for (a += size, b += size; a < b; a >>= 1, b >>= 1) {
if (a & 1)
L = func(L, table[a++]);
if (b & 1)
R = func(table[--b], R);
}
return func(L, R);
}
T operator[](const int k) const { return table[k + size]; }
private:
unsigned int size;
vector<T> table;
const F func;
const T init;
};
class UnionFind {
public:
explicit UnionFind(int _n) : n(_n) {
par.resize(static_cast<unsigned long>(_n));
rank.resize(static_cast<unsigned long>(_n));
sizes.resize(static_cast<unsigned long>(_n));
for (int i = 0; i < _n; i++) {
par[i] = i;
rank[i] = 0;
sizes[i] = 1;
}
}
int find(int a) {
if (par[a] == a)
return a;
return par[a] = find(par[a]);
}
bool same(int a, int b) { return find(a) == find(b); }
void unite(int a, int b) { link(find(a), find(b)); }
int size(int a) { return sizes[find(a)]; }
void view() {
for (int i = 0; i < n; i++) {
cout << " par"
<< "[" << i << "]=" << par[i] << ((i == n - 1) ? "\n" : ",");
}
for (int i = 0; i < n; i++) {
cout << "size"
<< "[" << i << "]=" << sizes[i] << ((i == n - 1) ? "\n" : ",");
}
cout << endl;
}
private:
void link(int a, int b) {
if (same(a, b))
return;
if (rank[a] > rank[b]) {
par[b] = a;
sizes[a] += sizes[b];
sizes[b] = 0;
} else {
par[a] = b;
if (rank[a] == rank[b])
rank[b]++;
sizes[b] += sizes[a];
sizes[a] = 0;
}
}
int n;
vector<int> par;
vector<int> rank;
vector<int> sizes;
};
template <typename T> class Dinic {
public:
Dinic(int SIZE) : SIZE(SIZE) {
v = vector<vector<tuple<int, T, int>>>(SIZE + 10);
}
void AddEdge(int from, int to, T cap) {
v[from].push_back(make_tuple(to, cap, v[to].size()));
v[to].push_back(make_tuple(from, 0, v[from].size() - 1));
}
void bfs(int s) {
level = vector<int>(SIZE + 10, -1);
queue<int> q;
level[s] = 0;
q.push(s);
while (!q.empty()) {
int now = q.front();
q.pop();
for (int i = 0; i < (int)v[now].size(); i++) {
int next, nextrv;
T nextc;
tie(next, nextc, nextrv) = v[now][i];
if (nextc > 0 && level[next] < 0) {
level[next] = level[now] + 1;
q.push(next);
}
}
}
}
T dfs(int now, int t, T f) {
if (now == t)
return f;
for (int &i = iter[now]; i < (int)v[now].size(); i++) {
int next, nextrv;
T nextc;
tie(next, nextc, nextrv) = v[now][i];
if (nextc > 0 && level[now] < level[next]) {
T d = dfs(next, t, min(f, nextc));
if (d > 0) {
get<1>(v[now][i]) -= d;
get<1>(v[next][nextrv]) += d;
return d;
}
}
}
return 0;
}
T max_flow(int s, int t) {
T flow = 0;
for (;;) {
bfs(s);
if (level[t] < 0)
return flow;
iter = vector<int>(SIZE + 10, 0);
int f;
while ((f = dfs(s, t, INT_MAX)) > 0) {
flow += f;
}
}
}
private:
int SIZE;
vector<vector<tuple<int, T, int>>> v;
vector<int> level, iter;
};
template <typename flow_t, typename cost_t> struct PrimalDual {
const cost_t INF;
struct edge {
int to;
flow_t cap;
cost_t cost;
int rev;
bool isrev;
};
vector<vector<edge>> graph;
vector<cost_t> potential, min_cost;
vector<int> prevv, preve;
PrimalDual(int V) : graph(V), INF(numeric_limits<cost_t>::max()) {}
void add_edge(int from, int to, flow_t cap, cost_t cost) {
graph[from].emplace_back(
(edge){to, cap, cost, (int)graph[to].size(), false});
graph[to].emplace_back(
(edge){from, 0, -cost, (int)graph[from].size() - 1, true});
}
cost_t min_cost_flow(int s, int t, flow_t f) {
int V = (int)graph.size();
cost_t ret = 0;
using Pi = pair<cost_t, int>;
priority_queue<Pi, vector<Pi>, greater<Pi>> que;
potential.assign(V, 0);
preve.assign(V, -1);
prevv.assign(V, -1);
while (f > 0) {
min_cost.assign(V, INF);
que.emplace(0, s);
min_cost[s] = 0;
while (!que.empty()) {
Pi p = que.top();
que.pop();
if (min_cost[p.second] < p.first)
continue;
for (int i = 0; i < graph[p.second].size(); i++) {
edge &e = graph[p.second][i];
cost_t nextCost = min_cost[p.second] + e.cost + potential[p.second] -
potential[e.to];
if (e.cap > 0 && min_cost[e.to] > nextCost) {
min_cost[e.to] = nextCost;
prevv[e.to] = p.second, preve[e.to] = i;
que.emplace(min_cost[e.to], e.to);
}
}
}
if (min_cost[t] == INF)
return -1;
for (int v = 0; v < V; v++)
potential[v] += min_cost[v];
flow_t addflow = f;
for (int v = t; v != s; v = prevv[v]) {
addflow = min(addflow, graph[prevv[v]][preve[v]].cap);
}
f -= addflow;
ret += addflow * potential[t];
for (int v = t; v != s; v = prevv[v]) {
edge &e = graph[prevv[v]][preve[v]];
e.cap -= addflow;
graph[v][e.rev].cap += addflow;
}
}
return ret;
}
void output() {
for (int i = 0; i < graph.size(); i++) {
for (auto &e : graph[i]) {
if (e.isrev)
continue;
auto &rev_e = graph[e.to][e.rev];
cout << i << "->" << e.to << " (flow: " << rev_e.cap << "/"
<< rev_e.cap + e.cap << ")" << endl;
}
}
}
};
template <typename T> using Matrix = vector<vector<T>>;
template <typename T> void init(int h, int w, Matrix<T> &matrix) {
matrix = vector<vector<T>>(h, vector<T>(w));
/*for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
cin >> matrix[i][j];
}
}*/
}
template <typename T>
Matrix<T> &operator*(Matrix<T> &matrix, Matrix<T> &matrix1) {
int height = (int)matrix.size();
int width = (int)matrix[0].size();
int height2 = (int)matrix1.size();
int width2 = (int)matrix1[0].size();
assert(width == height2);
Matrix<T> res;
res = vector<vector<T>>(height, vector<T>(width2, 0));
for (int i = 0; i < height; i++) {
for (int j = 0; j < width2; j++) {
for (int k = 0; k < width; k++) {
res[i][j] += matrix[i][k] * matrix1[k][j];
}
}
}
matrix.swap(res);
return matrix;
}
template <typename T> Matrix<T> Pow(Matrix<T> matrix, ll x) {
Matrix<T> res = vector<vector<T>>(matrix.size(), vector<T>(matrix.size(), 0));
for (int i = 0; i < (int)matrix.size(); i++) {
res[i][i] = 1;
}
while (x) {
if (x & 1) {
res = res * matrix;
}
matrix = matrix * matrix;
x >>= 1;
}
return res;
}
///////////////////////////////////////////////////////////////////////////////////
// MAIN
///////////////////////////////////////////////////////////////////////////////////
// 735134400 約数が1344個ある高度合成数(<= 1e9)
// 897612484786617600 約数が103680個ある高度合成数(<= 1e18)
// 苦手分野 重複順列
// LLの数値をつかう時は最後にLLをつける癖をつけよう
// Mintの数値にしたいときは、Mint(i)みたいにキャストしてね
int n;
bool a[200001];
bool b[200001];
int main() {
cin >> n;
rep(i, 0, n) { cin >> a[i]; }
rrep(i, n, 0) {
bool now = a[i - 1];
for (int j = i * 2; j <= n; j += i) {
now ^= b[j - 1];
}
b[i - 1] = now;
}
showA(b, n);
int m = 0;
rep(i, 0, n) if (b[i]) m++;
cout << m << endl;
rep(i, 0, n) if (b[i]) { cout << i + 1 << " "; }
#ifdef LOCAL_DEFINE
cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s." << endl;
show(MOD);
#endif
return 0;
}
///////////////////////////////////////////////////////////////////////////////////
// NOTE
///////////////////////////////////////////////////////////////////////////////////
/*
*/ | [
"expression.operation.binary.add"
] | 780,062 | 780,063 | u817774241 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define MOD 1000000007
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T> void print(T x) { std::cout << x << '\n'; }
// typedef long long ll;
#define TENNINE 1000000005
#define TENFIVE 100005
//#define int long long
int N;
vector<int> a;
std::vector<int> enum_div(int n) // nの約数を列挙
{
std::vector<int> ret;
for (int i = 1; i * i <= n; ++i) {
if (n % i == 0) {
ret.push_back(i);
if (i != 1 && i * i != n) {
ret.push_back(n / i);
}
}
}
return ret;
}
signed main() {
cin >> N;
a.resize(N + 1);
rep(i, N) { cin >> a[i + 1]; }
int cnt = 0;
vector<int> ans;
for (int i = 0; i < N; i++) {
if (a[N - i] == 0) {
continue;
} else if (a[N - i] == 1) {
for (auto x : enum_div(N - i)) {
if (a[x] == 1) {
a[x]--;
} else if (a[x] == 0) {
a[x]++;
}
cnt++;
ans.pb(N - i);
}
}
else {
cout << -1 << endl;
}
}
cout << cnt << endl;
if (cnt > 0) {
for (auto x : ans) {
cout << x << endl;
}
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define int long long
#define MOD 1000000007
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T> void print(T x) { std::cout << x << '\n'; }
// typedef long long ll;
#define TENNINE 1000000005
#define TENFIVE 100005
//#define int long long
int N;
vector<int> a;
std::vector<int> enum_div(int n) // nの約数を列挙
{
std::vector<int> ret;
for (int i = 1; i * i <= n; ++i) {
if (n % i == 0) {
ret.push_back(i);
if (i != 1 && i * i != n) {
ret.push_back(n / i);
}
}
}
return ret;
}
signed main() {
cin >> N;
a.resize(N + 1);
rep(i, N) { cin >> a[i + 1]; }
int cnt = 0;
vector<int> ans;
for (int i = 0; i < N; i++) {
if (a[N - i] == 0) {
continue;
} else if (a[N - i] == 1) {
for (auto x : enum_div(N - i)) {
if (a[x] == 1) {
a[x]--;
} else if (a[x] == 0) {
a[x]++;
}
}
cnt++;
ans.pb(N - i);
}
else {
cout << -1 << endl;
}
}
cout << cnt << endl;
if (cnt > 0) {
for (auto x : ans) {
cout << x << endl;
}
}
return 0;
}
| [] | 780,067 | 780,068 | u888717396 | cpp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.