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;
#define LL long long
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define ALL(x) (x).begin(), (x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL mod = 1e9 + 7;
int main() {
int N;
cin >> N;
int a[N + 1];
for (int i = 1; i <= N; i++) {
cin >> a[i];
}
int M = 0;
for (int i = N; 0 < i; i--) {
int x = 0;
for (int j = 2 * i; j <= N; j += i) {
x += a[j];
}
a[i] = (a[i] + x) % 2;
if ((a[i] + x) % 2) {
M++;
}
}
cout << M << endl;
for (int i = 1; i <= N; i++) {
if (a[i]) {
cout << i << " ";
}
}
if (M != 0) {
cout << endl;
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define LL long long
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define ALL(x) (x).begin(), (x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL mod = 1e9 + 7;
int main() {
int N;
cin >> N;
int a[N + 1];
for (int i = 1; i <= N; i++) {
cin >> a[i];
}
int M = 0;
for (int i = N; 0 < i; i--) {
int x = 0;
for (int j = 2 * i; j <= N; j += i) {
x += a[j];
}
a[i] = (a[i] + x) % 2;
if (a[i]) {
M++;
}
}
cout << M << endl;
for (int i = 1; i <= N; i++) {
if (a[i]) {
cout << i << " ";
}
}
if (M != 0) {
cout << endl;
}
return 0;
}
| [
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove"
] | 780,069 | 780,070 | u697421413 | cpp |
p02972 | #include <iostream>
#include <vector>
using namespace std;
int main(void) {
int n;
cin >> n;
vector<int> a(n + 1, 0);
for (int i = 1; i < n + 1; i++) {
cin >> a[i];
}
vector<int> ans(n + 1, 0);
for (int i = n; i > n / 2; i--) {
ans[i] = a[i];
}
for (int i = n / 2; i >= 1; i--) {
int sum = 0;
for (int j = i * 2; j <= n; j = j + i) {
sum += ans[i];
}
ans[i] = (sum % 2 + a[i]) % 2;
}
int count = 0;
for (int i = 1; i < n + 1; i++) {
if (ans[i] == 1)
count++;
}
cout << count << endl;
for (int i = 1; i < n + 1; i++) {
if (ans[i] == 1)
cout << i << " ";
}
cout << endl;
return 0;
}
| #include <iostream>
#include <vector>
using namespace std;
int main(void) {
int n;
cin >> n;
vector<int> a(n + 1, 0);
for (int i = 1; i < n + 1; i++) {
cin >> a[i];
}
vector<int> ans(n + 1, 0);
for (int i = n; i > n / 2; i--) {
ans[i] = a[i];
}
for (int i = n / 2; i >= 1; i--) {
int sum = 0;
for (int j = i * 2; j <= n; j = j + i) {
sum += ans[j];
}
ans[i] = (sum % 2 + a[i]) % 2;
}
int count = 0;
for (int i = 1; i < n + 1; i++) {
if (ans[i] == 1)
count++;
}
cout << count << endl;
for (int i = 1; i < n + 1; i++) {
if (ans[i] == 1)
cout << i << " ";
}
cout << endl;
return 0;
}
| [
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change"
] | 780,076 | 780,077 | u407416173 | cpp |
p02972 | #include <algorithm>
#include <cmath>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
int main() {
int N;
cin >> N;
vi a(N);
for (int i = 0; i < N; i++) {
cin >> a[i];
}
vi b(N, 0);
int count = 0;
int sum;
for (int i = N; i > 0; i--) {
sum = 0;
for (int j = i + i; j < N; j += i) {
sum += b[j - 1];
}
if (sum % 2 == a[i - 1]) {
b[i - 1] = 0;
} else {
b[i - 1] = 1;
count++;
}
}
cout << count << endl;
for (int i = 0; i < N; i++) {
if (b[i] == 1) {
cout << i + 1;
}
}
cout << endl;
return 0;
} | #include <algorithm>
#include <cmath>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
int main() {
int N;
cin >> N;
vi a(N);
for (int i = 0; i < N; i++) {
cin >> a[i];
}
vi b(N, 0);
int count = 0;
int sum;
for (int i = N; i > 0; i--) {
sum = 0;
for (int j = i + i; j <= N; j += i) {
sum += b[j - 1];
}
if (sum % 2 == a[i - 1]) {
b[i - 1] = 0;
} else {
b[i - 1] = 1;
count++;
}
}
cout << count << endl;
for (int i = 0; i < N; i++) {
if (b[i] == 1) {
cout << i + 1 << " ";
}
}
cout << endl;
return 0;
} | [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change",
"io.output.change"
] | 780,080 | 780,079 | u420528322 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define fst first
#define snd second
#define pf push_front
#define pb push_back
#define eb emplace_back
#define ALL(obj) (obj).begin(), (obj).end()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
//#define int long long int
const int MOD = 1000000007;
const ll LINF = (ll)1e18 - 1;
const int INF = 1e9 - 1;
const double EPS = 0.000000001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
VI a(n), b(n, 0);
rep(i, n) { cin >> a[i]; }
bool ans = true;
int count = 0;
int k;
n % 2 == 0 ? k = n / 2 + 1 : k = (n + 1) / 2;
for (int i = n; i >= k; i--) {
b[i - 1] = a[i - 1];
count += b[i - 1];
}
for (int i = k - 1; i >= 1; i--) {
for (int j = 2; j * i <= k; j++) {
a[i - 1] = a[i - 1] ^ b[j * i - 1];
}
b[i - 1] = a[i - 1];
count += b[i - 1];
}
out(count);
int c = 0;
rep(i, n) {
if (b[i])
cout << i + 1 << " ";
c++;
}
if (c)
cout << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define fst first
#define snd second
#define pf push_front
#define pb push_back
#define eb emplace_back
#define ALL(obj) (obj).begin(), (obj).end()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
//#define int long long int
const int MOD = 1000000007;
const ll LINF = (ll)1e18 - 1;
const int INF = 1e9 - 1;
const double EPS = 0.000000001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
VI a(n), b(n, 0);
rep(i, n) { cin >> a[i]; }
bool ans = true;
int count = 0;
int k;
n % 2 == 0 ? k = n / 2 + 1 : k = (n + 1) / 2;
for (int i = n; i >= k; i--) {
b[i - 1] = a[i - 1];
count += b[i - 1];
}
for (int i = k - 1; i >= 1; i--) {
for (int j = 2; j * i <= n; j++) {
a[i - 1] = a[i - 1] ^ b[j * i - 1];
}
b[i - 1] = a[i - 1];
count += b[i - 1];
}
out(count);
int c = 0;
rep(i, n) {
if (b[i])
cout << i + 1 << " ";
c++;
}
if (c)
cout << endl;
return 0;
}
| [
"identifier.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change"
] | 780,083 | 780,084 | u019780057 | cpp |
p02972 | #include <stdio.h>
using namespace std;
int main() {
int n;
int a[212345];
int b[212345];
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", a + i);
}
int m = 0;
for (int i = n; i >= 1; i--) {
b[i] = a[i];
for (int j = i * 2; j < n; j += i) {
b[i] += b[j];
}
b[i] = b[i] % 2;
if (b[i] == 1) {
m++;
}
}
printf("%d\n", m);
int spaced = false;
for (int i = 1; i <= n; i++) {
if (b[i] == 1) {
if (spaced == false) {
spaced = true;
} else {
printf(" ");
}
printf("%d", i);
}
}
printf("\n");
return 0;
} | #include <stdio.h>
using namespace std;
int main() {
int n;
int a[212345];
int b[212345];
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", a + i);
}
int m = 0;
for (int i = n; i >= 1; i--) {
b[i] = a[i];
for (int j = i * 2; j <= n; j += i) {
b[i] += b[j];
}
b[i] = b[i] % 2;
if (b[i] == 1) {
m++;
}
}
printf("%d\n", m);
int spaced = false;
for (int i = 1; i <= n; i++) {
if (b[i] == 1) {
if (spaced == false) {
spaced = true;
} else {
printf(" ");
}
printf("%d", i);
}
}
printf("\n");
return 0;
} | [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 780,085 | 780,086 | u236990712 | cpp |
p02972 | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 999999999
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
int a[200000];
int v[200000];
int main() {
int n, count, count2 = 0;
cin >> n;
REP(i, n) { cin >> a[i]; }
REPR(i, n - 1) {
count = 0;
FOR(j, 2, n + 1) {
if ((i + 1) * j > n)
break;
count += a[(i + 1) * j - 1];
}
v[i] = abs(a[i] - count) % 2;
count2 += v[i];
}
cout << count2 << endl;
REP(i, n) {
if (v[i]) {
cout << i + 1 << endl;
}
}
return 0;
} | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 999999999
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
int a[200000];
int v[200000];
int main() {
int n, count, count2 = 0;
cin >> n;
REP(i, n) { cin >> a[i]; }
REPR(i, n - 1) {
count = 0;
FOR(j, 2, n + 1) {
if ((i + 1) * j > n)
break;
count += v[(i + 1) * j - 1];
}
v[i] = abs(a[i] - count) % 2;
count2 += v[i];
}
cout << count2 << endl;
REP(i, n) {
if (v[i]) {
cout << i + 1 << endl;
}
}
return 0;
} | [
"assignment.value.change",
"identifier.change"
] | 780,087 | 780,088 | u477561431 | cpp |
p02972 | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 999999999
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
int a[200000];
int v[200000];
int main() {
int n, count, count2 = 0;
cin >> n;
REP(i, n) { cin >> a[i]; }
REPR(i, n - 1) {
count = 0;
FOR(j, 2, n) {
if ((i + 1) * j > n)
break;
count += a[(i + 1) * j - 1];
}
v[i] = abs(a[i] - count) % 2;
count2 += v[i];
}
cout << count2 << endl;
REP(i, n) {
if (v[i]) {
cout << i + 1 << endl;
}
}
return 0;
} | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 999999999
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
int a[200000];
int v[200000];
int main() {
int n, count, count2 = 0;
cin >> n;
REP(i, n) { cin >> a[i]; }
REPR(i, n - 1) {
count = 0;
FOR(j, 2, n + 1) {
if ((i + 1) * j > n)
break;
count += v[(i + 1) * j - 1];
}
v[i] = abs(a[i] - count) % 2;
count2 += v[i];
}
cout << count2 << endl;
REP(i, n) {
if (v[i]) {
cout << i + 1 << endl;
}
}
return 0;
} | [
"assignment.value.change",
"identifier.change"
] | 780,089 | 780,088 | u477561431 | cpp |
p02972 | #include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <string>
#include <tuple>
#include <vector>
#define int long
using namespace std;
signed main() {
int N;
cin >> N;
vector<int> vec(N);
for (int i = 0; i < N; i++) {
cin >> vec.at(i);
}
vector<int> cnt(N);
for (int i = N - 1; i >= 0; i--) {
if (i >= N / 2) {
cnt.at(i) = vec.at(i);
} else {
int count = 0;
for (int j = i + i + 1; j < N; j = j + i + 1) {
count += cnt.at(i);
}
if (count % 2 == vec.at(i)) {
cnt.at(i) = 0;
} else {
cnt.at(i) = 1;
}
}
}
int M = 0;
for (int i = 0; i < N; i++) {
if (cnt.at(i) == 1) {
M++;
}
}
cout << M << endl;
for (int i = 0; i < N; i++) {
if (cnt.at(i) == 1) {
cout << i + 1 << " ";
}
}
cout << endl;
}
| #include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <string>
#include <tuple>
#include <vector>
#define int long
using namespace std;
signed main() {
int N;
cin >> N;
vector<int> vec(N);
for (int i = 0; i < N; i++) {
cin >> vec.at(i);
}
vector<int> cnt(N);
for (int i = N - 1; i >= 0; i--) {
if (i >= N / 2) {
cnt.at(i) = vec.at(i);
} else {
int count = 0;
for (int j = i * 2 + 1; j < N; j += i + 1) {
count += cnt.at(j);
}
if (count % 2 == vec.at(i)) {
cnt.at(i) = 0;
} else {
cnt.at(i) = 1;
}
}
}
int M = 0;
for (int i = 0; i < N; i++) {
if (cnt.at(i) == 1) {
M++;
}
}
cout << M << endl;
for (int i = 0; i < N; i++) {
if (cnt.at(i) == 1) {
cout << i + 1 << " ";
}
}
cout << endl;
}
| [
"control_flow.loop.for.initializer.change",
"assignment.value.change",
"control_flow.loop.for.update.change",
"expression.operation.binary.remove",
"identifier.change",
"call.arguments.change"
] | 780,090 | 780,091 | u322714721 | cpp |
p02972 | #include <algorithm>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <numeric>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const bool DEBAG = false;
int main() {
ll N;
cin >> N;
vector<int> a(N + 1);
for (int i = 1; i <= N; i++)
cin >> a[i];
vector<int> v(N + 1);
for (int i = N; i >= 1; i--) {
if (i + i > N) {
v[i] = a[i];
} else {
int sum = 0;
for (int j = i + i; j + i <= N; j += i) {
sum += v[j];
}
v[i] = (sum + a[i]) % 2;
}
}
ll ans = 0;
for (int i = 1; i <= N; i++) {
if (v[i])
ans++;
}
cout << ans << endl;
if (ans > 0) {
bool f = false;
for (int i = 1; i <= N; i++) {
if (v[i] && !f) {
cout << i;
f = true;
} else if (v[i] && f) {
cout << " " << i;
}
}
cout << endl;
}
/*
for(int i = 1; i <= N; i++){
v[i] = a[i];
if(v[i]){
for(int j = i + i; j <= N; j+=i ){
a[j] = (a[i] + v[i]) % 2;
}
}
}
for(int i = 1; i <= N; i++){
cout << v[i] << endl ;
}
*/
} | #include <algorithm>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <numeric>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const bool DEBAG = false;
int main() {
ll N;
cin >> N;
vector<int> a(N + 1);
for (int i = 1; i <= N; i++)
cin >> a[i];
vector<int> v(N + 1);
for (int i = N; i >= 1; i--) {
if (i + i > N) {
v[i] = a[i];
} else {
int sum = 0;
for (int j = i + i; j <= N; j += i) {
sum += v[j];
}
v[i] = (sum + a[i]) % 2;
}
}
ll ans = 0;
for (int i = 1; i <= N; i++) {
if (v[i])
ans++;
}
cout << ans << endl;
if (ans > 0) {
bool f = false;
for (int i = 1; i <= N; i++) {
if (v[i] && !f) {
cout << i;
f = true;
} else if (v[i] && f) {
cout << " " << i;
}
}
cout << endl;
}
/*
for(int i = 1; i <= N; i++){
v[i] = a[i];
if(v[i]){
for(int j = i + i; j <= N; j+=i ){
a[j] = (a[i] + v[i]) % 2;
}
}
}
for(int i = 1; i <= N; i++){
cout << v[i] << endl ;
}
*/
} | [
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove"
] | 780,095 | 780,096 | u412550879 | cpp |
p02972 | #include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>
// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP
typedef std::int_fast64_t i64;
typedef std::uint_fast64_t u64;
typedef std::int_fast32_t i32;
typedef std::uint_fast32_t u32;
namespace tools {
template <typename T>
void read(std::vector<T> &vector,
const typename std::vector<T>::size_type size) {
vector.reserve(size);
std::copy_n(std::istream_iterator<T>(std::cin), size,
std::back_inserter(vector));
}
template <typename T, std::size_t N> void read(std::array<T, N> &array) {
std::copy_n(std::istream_iterator<T>(std::cin), N, array.begin());
}
} // namespace tools
#endif
// main.cpp
i64 get(const std::vector<i64> &vector, const i64 i) { return vector[i - 1]; }
void set(std::vector<i64> &vector, const i64 i, const i64 value) {
vector[i - 1] = value;
}
int main() {
i64 N;
std::cin >> N;
std::vector<i64> a;
tools::read(a, N);
std::vector<i64> boxes(N, 0);
for (i64 i = N; i > 0; --i) {
i64 sum = 0;
for (i64 j = i * 2; j <= N; ++j) {
sum += get(boxes, j);
}
set(boxes, i, (sum + get(a, i)) % 2);
}
std::vector<i64> answers;
for (i64 i = 1; i <= N; ++i) {
if (get(boxes, i) == 1)
answers.push_back(i);
}
std::cout << answers.size() << std::endl;
if (!answers.empty()) {
std::string delimiter = "";
for (const i64 &answer : answers) {
std::cout << delimiter << answer;
delimiter = " ";
}
std::cout << std::endl;
}
return 0;
} | #include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>
// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP
typedef std::int_fast64_t i64;
typedef std::uint_fast64_t u64;
typedef std::int_fast32_t i32;
typedef std::uint_fast32_t u32;
namespace tools {
template <typename T>
void read(std::vector<T> &vector,
const typename std::vector<T>::size_type size) {
vector.reserve(size);
std::copy_n(std::istream_iterator<T>(std::cin), size,
std::back_inserter(vector));
}
template <typename T, std::size_t N> void read(std::array<T, N> &array) {
std::copy_n(std::istream_iterator<T>(std::cin), N, array.begin());
}
} // namespace tools
#endif
// main.cpp
i64 get(const std::vector<i64> &vector, const i64 i) { return vector[i - 1]; }
void set(std::vector<i64> &vector, const i64 i, const i64 value) {
vector[i - 1] = value;
}
int main() {
i64 N;
std::cin >> N;
std::vector<i64> a;
tools::read(a, N);
std::vector<i64> boxes(N, 0);
for (i64 i = N; i > 0; --i) {
i64 sum = 0;
for (i64 j = i * 2; j <= N; j += i) {
sum += get(boxes, j);
}
set(boxes, i, (sum + get(a, i)) % 2);
}
std::vector<i64> answers;
for (i64 i = 1; i <= N; ++i) {
if (get(boxes, i) == 1)
answers.push_back(i);
}
std::cout << answers.size() << std::endl;
if (!answers.empty()) {
std::string delimiter = "";
for (const i64 &answer : answers) {
std::cout << delimiter << answer;
delimiter = " ";
}
std::cout << std::endl;
}
return 0;
} | [
"control_flow.loop.for.update.change",
"assignment.change"
] | 780,097 | 780,098 | u758799884 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(int argc, char *argv[]) {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n;
cin >> n;
std::vector<int> v(n + 1);
for (int i = 1; i <= n; i++) {
cin >> v[i];
}
std::vector<int> res(n + 1);
for (int i = n; i >= 1; i--) {
int p = 0;
for (int j = i * 2; j <= n; j += i) {
p += res[i];
}
if (v[i] % 2 == p % 2)
res[i] = 0;
else
res[i] = 1;
}
int m = 0;
for (int i = 1; i <= n; i++) {
m += res[i];
// cout<<res[i]<<endl;
}
cout << m << endl;
if (m > 0) {
int a = 0;
for (int i = 1; i <= n; i++) {
if (res[i]) {
if (a)
cout << ' ';
cout << i;
a++;
}
}
cout << endl;
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(int argc, char *argv[]) {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n;
cin >> n;
std::vector<int> v(n + 1);
for (int i = 1; i <= n; i++) {
cin >> v[i];
}
std::vector<int> res(n + 1);
for (int i = n; i >= 1; i--) {
int p = 0;
for (int j = i * 2; j <= n; j += i) {
p += res[j];
}
// cout<<"A: "<<i<<':'<<p<<':'<<res[6]<<endl;
if (v[i] == (p % 2))
res[i] = 0;
else
res[i] = 1;
}
int m = 0;
for (int i = 1; i <= n; i++) {
m += res[i];
// cout<<res[i]<<endl;
}
cout << m << endl;
if (m > 0) {
int a = 0;
for (int i = 1; i <= n; i++) {
if (res[i]) {
if (a)
cout << ' ';
cout << i;
a++;
}
}
cout << endl;
}
return 0;
}
| [
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 780,099 | 780,100 | u440032761 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 7;
const int mod = 1e9 + 7;
typedef long long ll;
int n, m;
int ar[maxn], cnt[maxn];
int main() {
vector<int> ans;
scanf("%d", &n);
for (int i = 1; i <= n; i++)
scanf("%d", &ar[i]);
for (int i = n; i >= 1; i--) {
int ins = 0;
for (int j = i * 2; j <= n; j += i) {
ins += cnt[i];
}
if (ins % 2 == ar[i])
;
else {
cnt[i] = 1;
ans.push_back(i);
}
}
printf("%d\n", ans.size());
for (int i = 0; i < ans.size(); i++) {
printf("%d%c", ans[i], i == ans.size() - 1 ? '\n' : ' ');
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 7;
const int mod = 1e9 + 7;
typedef long long ll;
int n, m;
int ar[maxn], cnt[maxn];
int main() {
vector<int> ans;
scanf("%d", &n);
for (int i = 1; i <= n; i++)
scanf("%d", &ar[i]);
for (int i = n; i >= 1; i--) {
int ins = 0;
for (int j = i * 2; j <= n; j += i) {
ins += cnt[j];
}
if (ins % 2 == ar[i])
;
else {
cnt[i] = 1;
ans.push_back(i);
}
}
printf("%d\n", ans.size());
for (int i = 0; i < ans.size(); i++) {
printf("%d%c", ans[i], i == ans.size() - 1 ? '\n' : ' ');
}
return 0;
}
| [
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change"
] | 780,103 | 780,102 | u662513110 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> A(N);
for (int &k : A)
cin >> k;
vector<int> ans(N, 0);
int M = 0;
for (int i = N; i > 0; i--) {
int sum = 0;
int count = i;
while (count < N) {
sum += ans[count - 1];
count += i;
}
if (sum % 2 != A[i - 1]) {
ans[i - 1] = 1;
M++;
}
}
cout << M << endl;
for (int i = 0; i < N; i++) {
if (ans[i]) {
cout << i + 1;
if (i != N - 1)
cout << " ";
}
}
if (M)
cout << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> A(N);
for (int &k : A)
cin >> k;
vector<int> ans(N, 0);
int M = 0;
for (int i = N; i > 0; i--) { //配列のポインタのみ 0-origined
int sum = 0;
int count = i;
while (count <= N) {
sum += ans[count - 1];
count += i;
}
if (sum % 2 != A[i - 1]) {
ans[i - 1] = 1;
M++;
}
}
cout << M << endl;
for (int i = 0; i < N; i++) {
if (ans[i]) {
cout << i + 1; //出力のみ 1-origined
if (i != N - 1)
cout << " ";
}
}
if (M)
cout << endl;
} | [
"expression.operator.compare.change",
"control_flow.loop.condition.change"
] | 780,106 | 780,107 | u507188501 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define lf long double
typedef vector<ll> vi;
typedef pair<ll, ll> ii;
typedef vector<pair<int, int>> vii;
typedef vector<vector<ll>> vv;
typedef vector<string> vs;
ll mod = 1000000007;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
ll n;
cin >> n;
vi a(n + 1);
for (ll i = 1; i <= n; i++) {
cin >> a[i];
}
vi b(n + 1, 0);
for (ll i = n; i >= 1; i--) {
ll sum = 0;
ll num = i;
while (num <= n) {
sum += b[num];
num += i;
}
if (a[i] % 2 == 1) {
if (sum % 2 == 0) {
b[i] = 1;
} else
b[i] = 0;
} else if (a[i] == 0) {
if (sum % 2 == 1)
b[i] = 1;
else
b[i] = 0;
}
}
vi o;
for (ll i = 0; i < n; i++) {
if (b[i]) {
o.pb(i);
}
}
cout << o.size() << endl;
for (ll i = 0; i < o.size(); i++) {
cout << o[i] << " ";
}
if (o.size())
cout << endl;
}
| #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define lf long double
typedef vector<ll> vi;
typedef pair<ll, ll> ii;
typedef vector<pair<int, int>> vii;
typedef vector<vector<ll>> vv;
typedef vector<string> vs;
ll mod = 1000000007;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
ll n;
cin >> n;
vi a(n + 1);
for (ll i = 1; i <= n; i++) {
cin >> a[i];
}
vi b(n + 1, 0);
for (ll i = n; i >= 1; i--) {
ll sum = 0;
ll num = i;
while (num <= n) {
sum += b[num];
num += i;
}
if (a[i] % 2 == 1) {
if (sum % 2 == 0) {
b[i] = 1;
} else
b[i] = 0;
} else if (a[i] == 0) {
if (sum % 2 == 1)
b[i] = 1;
else
b[i] = 0;
}
}
vi o;
for (ll i = 0; i <= n; i++) {
if (b[i]) {
o.pb(i);
}
}
cout << o.size() << endl;
for (ll i = 0; i < o.size(); i++) {
cout << o[i] << " ";
}
if (o.size())
cout << endl;
}
| [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 780,108 | 780,109 | u666014704 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define vi vector<int>
#define vii vector<pair<int, int>>
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repD(i, a, b) for (int i = a; i > b; i--)
#define pb push_back
#define pii pair<int, int>
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define MOD 1000000007
#define PI 3.14159265359
#define deb(x) \
{ x }
#ifndef local
#define deb(x) ;
#endif
///----------------------------------------------------------------------------------
int n, arr[200005];
vi fac[200005];
int test[200005];
void fun(int r) {
if (r == 0)
return;
rep(i, r / 2 + 1, r + 1) {
test[i] = arr[i];
if (arr[i]) {
for (auto x : fac[i])
arr[i] ^= 1;
}
}
fun(r / 2);
}
void solve() {
rep(i, 1, 200005) {
for (int j = i; j < 200005; j += i)
fac[j].pb(i);
}
cin >> n;
rep(i, 1, n + 1) { cin >> arr[i]; }
memset(test, 0, sizeof test);
fun(n);
vi op;
rep(i, 1, n + 1) if (test[i]) op.pb(i);
cout << op.size() << "\n";
for (auto x : op)
cout << x << " ";
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
#ifdef local
/// freopen("input.txt","r",stdin);
/// freopen("output.txt","w",stdout);
clock_t qwertyuiop = clock();
#endif
int t = 1;
// cin>>t;
rep(a, 0, t) {
/// cout<<"Case #"<<a+1<<": ";
solve();
}
#ifdef local
{
qwertyuiop = clock() - qwertyuiop;
double time_taken = ((double)qwertyuiop) / CLOCKS_PER_SEC;
cerr << fixed << setprecision(5) << "\n\nTime Taken : " << time_taken
<< " seconds\n";
}
#endif
} | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define vi vector<int>
#define vii vector<pair<int, int>>
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repD(i, a, b) for (int i = a; i > b; i--)
#define pb push_back
#define pii pair<int, int>
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define MOD 1000000007
#define PI 3.14159265359
#define deb(x) \
{ x }
#ifndef local
#define deb(x) ;
#endif
///----------------------------------------------------------------------------------
int n, arr[200005];
vi fac[200005];
int test[200005];
void fun(int r) {
if (r == 0)
return;
rep(i, r / 2 + 1, r + 1) {
test[i] = arr[i];
if (arr[i]) {
for (auto x : fac[i])
arr[x] ^= 1;
}
}
fun(r / 2);
}
void solve() {
rep(i, 1, 200005) {
for (int j = i; j < 200005; j += i)
fac[j].pb(i);
}
cin >> n;
rep(i, 1, n + 1) { cin >> arr[i]; }
memset(test, 0, sizeof test);
fun(n);
vi op;
rep(i, 1, n + 1) if (test[i]) op.pb(i);
cout << op.size() << "\n";
for (auto x : op)
cout << x << " ";
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
#ifdef local
/// freopen("input.txt","r",stdin);
/// freopen("output.txt","w",stdout);
clock_t qwertyuiop = clock();
#endif
int t = 1;
// cin>>t;
rep(a, 0, t) {
/// cout<<"Case #"<<a+1<<": ";
solve();
}
#ifdef local
{
qwertyuiop = clock() - qwertyuiop;
double time_taken = ((double)qwertyuiop) / CLOCKS_PER_SEC;
cerr << fixed << setprecision(5) << "\n\nTime Taken : " << time_taken
<< " seconds\n";
}
#endif
} | [
"assignment.variable.change",
"identifier.change",
"variable_access.subscript.index.change"
] | 780,114 | 780,115 | u953587543 | cpp |
p02972 | #include <iostream>
#include <map>
#include <vector>
using namespace std;
int main() {
int N;
bool tmp;
cin >> N;
vector<bool> arr;
for (int i = 0; i < N; i++) {
cin >> tmp;
arr.push_back(tmp);
}
map<int, bool> table;
vector<int> ans;
for (int i = N - 1; i >= 0; i--) {
bool prev_i = false;
for (int j = 2; j <= N / (i + 1); j++) {
prev_i ^= table[(i + 1) * j];
}
prev_i ^= arr[i];
table[i] = (int)prev_i;
if (prev_i) {
ans.push_back(i + 1);
}
}
cout << ans.size() << endl;
for (int i : ans) {
cout << i << " ";
}
cout << endl;
return 0;
} | #include <iostream>
#include <map>
#include <vector>
using namespace std;
int main() {
int N;
bool tmp;
cin >> N;
vector<bool> arr;
for (int i = 0; i < N; i++) {
cin >> tmp;
arr.push_back(tmp);
}
map<int, bool> table;
vector<int> ans;
for (int i = N - 1; i >= 0; i--) {
bool prev_i = false;
for (int j = 2; j <= N / (i + 1); j++) {
prev_i ^= table[(i + 1) * j];
}
prev_i ^= arr[i];
table[i + 1] = (int)prev_i;
if (prev_i) {
ans.push_back(i + 1);
}
}
cout << ans.size() << endl;
for (int i : ans) {
cout << i << " ";
}
cout << endl;
return 0;
} | [
"assignment.change"
] | 780,120 | 780,121 | u816580121 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
const int M = 200001;
int n, A[M], m, B[M];
int main() {
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 = i + i; j <= n; j += i)
cnt += B[j];
if (cnt % 2 != A[i])
B[i] = 1;
}
for (int i = 1; i <= n; i++)
if (B[i])
m++;
printf("%d\n", m);
for (int i = 1; i <= m; i++)
if (B[i])
printf("%d ", i);
} | #include <bits/stdc++.h>
using namespace std;
const int M = 200001;
int n, A[M], m, B[M];
int main() {
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 = i + i; j <= n; j += i)
cnt += B[j];
if (cnt % 2 != A[i])
B[i] = 1;
}
for (int i = 1; i <= n; i++)
if (B[i])
m++;
printf("%d\n", m);
for (int i = 1; i <= n; i++)
if (B[i])
printf("%d ", i);
} | [
"identifier.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change"
] | 780,122 | 780,123 | u420892802 | cpp |
p02972 | #include <bits/stdc++.h>
#define lowbit(a) ((a) & (-(a)))
using namespace std;
void file(bool opt) {
if (opt && fopen("in.txt", "r")) {
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
}
}
int n;
bool a[200000 + 5];
bool p[200000 + 5];
vector<int> ans;
int 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 k = i; k <= n; k += i)
sum += p[i];
if (sum % 2 == a[i])
p[i] = 0;
else {
ans.push_back(i);
p[i] = 1;
}
}
printf("%d\n", ans.size());
for (int i = 0; i < ans.size(); i++)
printf("%d%c", ans[i], i == ans.size() - 1 ? '\n' : ' ');
return 0;
} | #include <bits/stdc++.h>
#define lowbit(a) ((a) & (-(a)))
using namespace std;
void file(bool opt) {
if (opt && fopen("in.txt", "r")) {
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
}
}
int n;
int a[200000 + 5];
int p[200000 + 5];
vector<int> ans;
int 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 k = i; k <= n; k += i)
sum += p[k];
if ((sum % 2) == a[i])
p[i] = 0;
else {
ans.push_back(i);
p[i] = 1;
}
}
printf("%d\n", ans.size());
for (int i = 0; i < ans.size(); i++)
printf("%d%c", ans[i], i == ans.size() - 1 ? '\n' : ' ');
return 0;
} | [
"variable_declaration.type.primitive.change",
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change"
] | 780,127 | 780,128 | u066917439 | cpp |
p02972 | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <iterator>
#include <set>
using namespace std;
using namespace __gnu_pbds;
#define f first
#define s second
#define pb push_back
#define all(x) x.begin(), x.end()
#define ll long long int
#define vi vector<int>
#define vii vector<pair<int, int>>
#define pii pair<int, int>
#define plii pair<pair<ll, int>, int>
#define piii pair<pii, int>
#define viii vector<pair<pii, int>>
#define vl vector<ll>
#define vll vector<pair<ll, ll>>
#define pll pair<ll, ll>
#define pli pair<ll, int>
#define mp make_pair
#define ms(x, v) memset(x, v, sizeof x)
#define pr_vec(v) \
for (int i = 0; i < v.size(); i++) \
cout << v[i] << " ";
#define f_in(st) freopen(st, "r", stdin)
#define f_out(st) freopen(st, "w", stdout)
#define INF INT_MAX
#define matrix vector<vector<ll>>
#define fr(i, a, b) for (i = a; i <= b; i++)
#define fb(i, a, b) for (i = a; i >= b; i--)
#define ASST(x, l, r) assert(x <= r && x >= l)
#define maxbits 9
#define maxmask (1ll << maxbits)
typedef tree<pll, null_type, less<pll>, rb_tree_tag,
tree_order_statistics_node_update>
new_data_set;
const int N = 100000 + 10, M = (ll)1e9 + 1;
const int mod = 998244353, sz = 5;
void work() {
ll n;
cin >> n;
vl a(n + 1);
for (ll i = 1; i <= n; i++)
cin >> a[i];
vl b(n + 1, 0);
for (ll i = n; i > 0; --i) {
ll s = 0;
for (ll j = 2; i * j <= n; j++)
s += b[i * j];
if (a[i]) {
if (s % 2 == 0)
b[i] = 1;
} else {
if (s & 1)
b[i] = 1;
}
}
vl ans;
for (ll i = 0; i < n; i++)
if (b[i])
ans.pb(i);
cout << ans.size() << endl;
for (ll i = 0; i < ans.size(); i++)
cout << ans[i] << " ";
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
ll t;
// cin >> t;
t = 1;
while (t--) {
work();
}
return 0;
}
| #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <iterator>
#include <set>
using namespace std;
using namespace __gnu_pbds;
#define f first
#define s second
#define pb push_back
#define all(x) x.begin(), x.end()
#define ll long long int
#define vi vector<int>
#define vii vector<pair<int, int>>
#define pii pair<int, int>
#define plii pair<pair<ll, int>, int>
#define piii pair<pii, int>
#define viii vector<pair<pii, int>>
#define vl vector<ll>
#define vll vector<pair<ll, ll>>
#define pll pair<ll, ll>
#define pli pair<ll, int>
#define mp make_pair
#define ms(x, v) memset(x, v, sizeof x)
#define pr_vec(v) \
for (int i = 0; i < v.size(); i++) \
cout << v[i] << " ";
#define f_in(st) freopen(st, "r", stdin)
#define f_out(st) freopen(st, "w", stdout)
#define INF INT_MAX
#define matrix vector<vector<ll>>
#define fr(i, a, b) for (i = a; i <= b; i++)
#define fb(i, a, b) for (i = a; i >= b; i--)
#define ASST(x, l, r) assert(x <= r && x >= l)
#define maxbits 9
#define maxmask (1ll << maxbits)
typedef tree<pll, null_type, less<pll>, rb_tree_tag,
tree_order_statistics_node_update>
new_data_set;
const int N = 100000 + 10, M = (ll)1e9 + 1;
const int mod = 998244353, sz = 5;
void work() {
ll n;
cin >> n;
vl a(n + 1);
for (ll i = 1; i <= n; i++)
cin >> a[i];
vl b(n + 1, 0);
for (ll i = n; i > 0; --i) {
ll s = 0;
for (ll j = 2; i * j <= n; j++)
s += b[i * j];
if (a[i]) {
if (s % 2 == 0)
b[i] = 1;
} else {
if (s & 1)
b[i] = 1;
}
}
vl ans;
for (ll i = 1; i <= n; i++)
if (b[i])
ans.pb(i);
cout << ans.size() << endl;
for (ll i = 0; i < ans.size(); i++)
cout << ans[i] << " ";
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
ll t;
// cin >> t;
t = 1;
while (t--) {
work();
}
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"
] | 780,129 | 780,130 | u888735570 | cpp |
p02972 | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <iterator>
#include <set>
using namespace std;
using namespace __gnu_pbds;
#define f first
#define s second
#define pb push_back
#define all(x) x.begin(), x.end()
#define ll long long int
#define vi vector<int>
#define vii vector<pair<int, int>>
#define pii pair<int, int>
#define plii pair<pair<ll, int>, int>
#define piii pair<pii, int>
#define viii vector<pair<pii, int>>
#define vl vector<ll>
#define vll vector<pair<ll, ll>>
#define pll pair<ll, ll>
#define pli pair<ll, int>
#define mp make_pair
#define ms(x, v) memset(x, v, sizeof x)
#define pr_vec(v) \
for (int i = 0; i < v.size(); i++) \
cout << v[i] << " ";
#define f_in(st) freopen(st, "r", stdin)
#define f_out(st) freopen(st, "w", stdout)
#define INF INT_MAX
#define matrix vector<vector<ll>>
#define fr(i, a, b) for (i = a; i <= b; i++)
#define fb(i, a, b) for (i = a; i >= b; i--)
#define ASST(x, l, r) assert(x <= r && x >= l)
#define maxbits 9
#define maxmask (1ll << maxbits)
typedef tree<pll, null_type, less<pll>, rb_tree_tag,
tree_order_statistics_node_update>
new_data_set;
const int N = 100000 + 10, M = (ll)1e9 + 1;
const int mod = 998244353, sz = 5;
void work() {
ll n;
cin >> n;
vl a(n + 1);
for (ll i = 1; i <= n; i++)
cin >> a[i];
vl b(n);
for (ll i = n; i > 0; --i) {
ll s = 0;
for (ll j = 2; i * j <= n; j++)
s += b[i * j];
if (a[i]) {
if (s % 2 == 0)
b[i] = 1;
} else {
if (s & 1)
b[i] = 1;
}
}
vl ans;
for (ll i = 0; i < n; i++)
if (b[i])
ans.pb(i);
cout << ans.size() << endl;
for (ll i = 0; i < ans.size(); i++)
cout << ans[i] << " ";
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
ll t;
// cin >> t;
t = 1;
while (t--) {
work();
}
return 0;
}
| #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <iterator>
#include <set>
using namespace std;
using namespace __gnu_pbds;
#define f first
#define s second
#define pb push_back
#define all(x) x.begin(), x.end()
#define ll long long int
#define vi vector<int>
#define vii vector<pair<int, int>>
#define pii pair<int, int>
#define plii pair<pair<ll, int>, int>
#define piii pair<pii, int>
#define viii vector<pair<pii, int>>
#define vl vector<ll>
#define vll vector<pair<ll, ll>>
#define pll pair<ll, ll>
#define pli pair<ll, int>
#define mp make_pair
#define ms(x, v) memset(x, v, sizeof x)
#define pr_vec(v) \
for (int i = 0; i < v.size(); i++) \
cout << v[i] << " ";
#define f_in(st) freopen(st, "r", stdin)
#define f_out(st) freopen(st, "w", stdout)
#define INF INT_MAX
#define matrix vector<vector<ll>>
#define fr(i, a, b) for (i = a; i <= b; i++)
#define fb(i, a, b) for (i = a; i >= b; i--)
#define ASST(x, l, r) assert(x <= r && x >= l)
#define maxbits 9
#define maxmask (1ll << maxbits)
typedef tree<pll, null_type, less<pll>, rb_tree_tag,
tree_order_statistics_node_update>
new_data_set;
const int N = 100000 + 10, M = (ll)1e9 + 1;
const int mod = 998244353, sz = 5;
void work() {
ll n;
cin >> n;
vl a(n + 1);
for (ll i = 1; i <= n; i++)
cin >> a[i];
vl b(n + 1, 0);
for (ll i = n; i > 0; --i) {
ll s = 0;
for (ll j = 2; i * j <= n; j++)
s += b[i * j];
if (a[i]) {
if (s % 2 == 0)
b[i] = 1;
} else {
if (s & 1)
b[i] = 1;
}
}
vl ans;
for (ll i = 1; i <= n; i++)
if (b[i])
ans.pb(i);
cout << ans.size() << endl;
for (ll i = 0; i < ans.size(); i++)
cout << ans[i] << " ";
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
ll t;
// cin >> t;
t = 1;
while (t--) {
work();
}
return 0;
}
| [
"call.arguments.add",
"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"
] | 780,131 | 780,130 | u888735570 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, a, b) for (int i = a; i >= b; i--)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define sz(x) ((int)x.size())
#define rd(type, ...) \
type __VA_ARGS__; \
sc(__VA_ARGS__)
#define rdv(type, v, n) \
vector<type> v(n); \
rep(__ii, 0, n) cin >> v[__ii]
#define rdm(type, v, h, w) \
vector<vector<type>>(h, vector<type>(w)) v; \
rep(__ii, 0, h) rep(__jj, 0, w) cin >> v[__ii][__jj]
typedef long long ll;
void solve();
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout << fixed;
cout.precision(12);
solve();
return 0;
}
template <typename T> void prv(vector<T> v) {
rep(__ii, 0, sz(v)) {
if (__ii)
cout << ' ';
cout << v[__ii];
}
cout << '\n';
}
template <typename T> void prm(vector<vector<T>> v) {
rep(__ii, 0, sz(v)) {
rep(__jj, 0, v[__ii].size()) {
if (__jj)
cout << ' ';
cout << v[__ii][__jj];
}
cout << '\n';
}
}
template <typename T> void sc(T &x) { cin >> x; }
template <typename Head, typename... Tail> void sc(Head &head, Tail &...tail) {
cin >> head;
sc(tail...);
}
template <typename T> void pr(const T &x) { cout << x << '\n'; }
template <typename Head, typename... Tail>
void pr(const Head &head, const Tail &...tail) {
cout << head << ' ';
pr(tail...);
}
template <typename... T> void err(const T &...cod) {
pr(cod...);
exit(0);
}
const int N = 1e5 + 10;
int a[N], b[N];
void solve() {
rd(int, n);
rep(i, 1, n + 1) cin >> a[i];
per(i, n, n / 2 + 1) b[i] = a[i];
per(i, n / 2, 1) {
int sum = 0;
for (int j = i; j < n; j += i)
sum += b[i];
sum %= 2;
if (a[i])
b[i] = (sum ? 0 : 1);
else
b[i] = (sum ? 1 : 0);
}
vector<int> ans;
rep(i, 1, n + 1) if (b[i]) ans.pb(i);
pr(sz(ans));
prv(ans);
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, a, b) for (int i = a; i >= b; i--)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define sz(x) ((int)x.size())
#define rd(type, ...) \
type __VA_ARGS__; \
sc(__VA_ARGS__)
#define rdv(type, v, n) \
vector<type> v(n); \
rep(__ii, 0, n) cin >> v[__ii]
#define rdm(type, v, h, w) \
vector<vector<type>>(h, vector<type>(w)) v; \
rep(__ii, 0, h) rep(__jj, 0, w) cin >> v[__ii][__jj]
typedef long long ll;
void solve();
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout << fixed;
cout.precision(12);
solve();
return 0;
}
template <typename T> void prv(vector<T> v) {
rep(__ii, 0, sz(v)) {
if (__ii)
cout << ' ';
cout << v[__ii];
}
cout << '\n';
}
template <typename T> void prm(vector<vector<T>> v) {
rep(__ii, 0, sz(v)) {
rep(__jj, 0, v[__ii].size()) {
if (__jj)
cout << ' ';
cout << v[__ii][__jj];
}
cout << '\n';
}
}
template <typename T> void sc(T &x) { cin >> x; }
template <typename Head, typename... Tail> void sc(Head &head, Tail &...tail) {
cin >> head;
sc(tail...);
}
template <typename T> void pr(const T &x) { cout << x << '\n'; }
template <typename Head, typename... Tail>
void pr(const Head &head, const Tail &...tail) {
cout << head << ' ';
pr(tail...);
}
template <typename... T> void err(const T &...cod) {
pr(cod...);
exit(0);
}
const int N = 2e5 + 10;
int a[N], b[N];
void solve() {
rd(int, n);
rep(i, 1, n + 1) cin >> a[i];
per(i, n, n / 2 + 1) b[i] = a[i];
per(i, n / 2, 1) {
int sum = 0;
for (int j = i + i; j <= n; j += i)
sum += b[j];
sum %= 2;
if (a[i])
b[i] = (sum ? 0 : 1);
else
b[i] = (sum ? 1 : 0);
}
vector<int> ans;
rep(i, 1, n + 1) if (b[i]) ans.pb(i);
pr(sz(ans));
prv(ans);
} | [
"literal.number.change",
"expression.operation.binary.change",
"control_flow.loop.for.initializer.change",
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change"... | 780,136 | 780,135 | u153798346 | cpp |
p02972 | //{{{
#include <algorithm>
#include <cmath>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <sys/time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include "rprint2.hpp"
#else
#define FUNC(name) \
template <ostream &out = cout, class... T> void name(T &&...) {}
FUNC(prints)
FUNC(printw) FUNC(printwe) FUNC(printb) FUNC(printbe) FUNC(printd) FUNC(printde)
FUNC(printdu);
#endif
template <class S, class T> istream &operator>>(istream &in, pair<S, T> &p) {
return in >> p.first >> p.second;
}
template <class T> istream &operator>>(istream &in, vector<T> &v) {
for (auto &e : v) {
in >> e;
}
return in;
}
//}}}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
vector<int> as(n);
cin >> as;
vector<int> nums(n);
int end = n;
while (end) {
int idx = end / 2;
printde(end, idx);
for (int i = idx; i < end; i++) {
int acc = 0;
for (int j = i + 1; j <= n; j *= 2) {
acc ^= nums[j - 1];
}
if (acc != as[i]) {
nums[i] = 1;
}
}
end = idx;
printde(nums);
}
cout << accumulate(nums.begin(), nums.end(), 0ll) << '\n';
for (int i = 0; i < n; i++) {
if (nums[i]) {
cout << i + 1 << ' ';
}
}
}
| //{{{
#include <algorithm>
#include <cmath>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <sys/time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include "rprint2.hpp"
#else
#define FUNC(name) \
template <ostream &out = cout, class... T> void name(T &&...) {}
FUNC(prints)
FUNC(printw) FUNC(printwe) FUNC(printb) FUNC(printbe) FUNC(printd) FUNC(printde)
FUNC(printdu);
#endif
template <class S, class T> istream &operator>>(istream &in, pair<S, T> &p) {
return in >> p.first >> p.second;
}
template <class T> istream &operator>>(istream &in, vector<T> &v) {
for (auto &e : v) {
in >> e;
}
return in;
}
//}}}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
vector<int> as(n);
cin >> as;
vector<int> nums(n);
int end = n;
while (end) {
int idx = end / 2;
printde(end, idx);
for (int i = idx; i < end; i++) {
int acc = 0;
for (int j = i + 1; j <= n; j += (i + 1)) {
acc ^= nums[j - 1];
}
if (acc != as[i]) {
nums[i] = 1;
}
}
end = idx;
printde(nums);
}
cout << accumulate(nums.begin(), nums.end(), 0ll) << '\n';
for (int i = 0; i < n; i++) {
if (nums[i]) {
cout << i + 1 << ' ';
}
}
}
| [
"control_flow.loop.for.update.change",
"assignment.change"
] | 780,141 | 780,142 | u817722036 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
int count(int i, int N, vector<int> &B) {
int sum = 0;
for (int j = i; j < N; j += i) {
if (B.at(j - 1) == 1)
sum++;
}
return sum;
}
int main() {
int N, in = 0;
cin >> N;
vector<int> A(N), B(N);
for (int i = 0; i < N; i++)
cin >> A.at(i);
for (int i = N; i >= 1; i--) {
if (count(i, N, B) % 2 != A.at(i - 1)) {
B.at(i - 1) = 1;
in++;
} else
B.at(i - 1) = 0;
}
cout << in << endl;
for (int i = 0; i < N; i++) {
if (B.at(i))
cout << i + 1 << " ";
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int count(int i, int N, vector<int> &B) {
int sum = 0;
for (int j = i; j <= N; j += i) {
if (B.at(j - 1) == 1)
sum++;
}
return sum;
}
int main() {
int N, in = 0;
cin >> N;
vector<int> A(N), B(N);
for (int i = 0; i < N; i++)
cin >> A.at(i);
for (int i = N; i >= 1; i--) {
if (count(i, N, B) % 2 != A.at(i - 1)) {
B.at(i - 1) = 1;
in++;
} else
B.at(i - 1) = 0;
}
cout << in << endl;
for (int i = 0; i < N; i++) {
if (B.at(i))
cout << i + 1 << " ";
}
return 0;
}
| [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 780,143 | 780,144 | u122034453 | cpp |
p02972 | #include <iostream>
#include <vector>
int main() {
int N;
std::cin >> N;
bool a[N];
for (int i = 0; i < N; i++)
scanf(" %d", &a[i]);
bool ans[N];
for (int i = N - 1; i >= 0; i--) {
if (i >= N / 2) {
ans[i] = a[i];
continue;
}
int j = 2 * i + 1;
bool sum = 0;
while (j < N) {
sum ^= a[j];
j += i + 1;
}
ans[i] = sum ^ a[i];
}
std::vector<int> b;
for (int i = 0; i < N; i++) {
if (a[i] == true)
b.push_back(i);
}
std::cout << b.size() << std::endl;
for (auto &&itr = b.begin(); itr != b.end(); itr++)
printf("%d ", (*itr) + 1);
if (!b.empty())
std::cout << std::endl;
} | #include <iostream>
#include <vector>
int main() {
int N;
std::cin >> N;
bool a[N];
for (int i = 0; i < N; i++)
scanf(" %d", &a[i]);
bool ans[N];
for (int i = N - 1; i >= 0; i--) {
if (i >= N / 2) {
ans[i] = a[i];
continue;
}
int j = 2 * i + 1;
bool sum = 0;
while (j < N) {
sum ^= ans[j];
// printf("%d %d %d\n", i, j, sum);
j += i + 1;
}
ans[i] = sum ^ a[i];
// printf("ans = %d\n", ans[i]);
}
std::vector<int> b;
for (int i = 0; i < N; i++) {
if (ans[i] == true)
b.push_back(i);
}
std::cout << b.size() << std::endl;
for (auto &&itr = b.begin(); itr != b.end(); itr++)
printf("%d ", (*itr) + 1);
if (!b.empty())
std::cout << std::endl;
} | [
"assignment.value.change",
"identifier.change",
"control_flow.branch.if.condition.change"
] | 780,145 | 780,146 | u440312135 | cpp |
p02972 | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update>
tree_set;
typedef long long ll;
typedef long double ld;
void fast() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
ll mod = 1e9 + 7;
int main() {
fast();
ll n;
cin >> n;
ll arr[n + 1];
for (ll i = 1; i <= n; i++)
cin >> arr[i];
vector<ll> ans(n + 1, 0);
ll cnt = 0;
for (ll i = n; i >= 1; i--) {
ll sum = 0;
for (ll j = 2 * i; j <= n; j += i)
sum += ans[j];
if ((sum % 2 == 0 && arr[i] == 1) || (sum % 2 == 1 && arr[i] == 0)) {
ans[i] = 1;
cnt++;
}
}
cout << cnt << endl;
for (ll i = 1; i <= n; i++) {
if (ans[i] == 1)
cout << arr[i] << " ";
}
}
| #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update>
tree_set;
typedef long long ll;
typedef long double ld;
void fast() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
ll mod = 1e9 + 7;
int main() {
fast();
ll n;
cin >> n;
ll arr[n + 1];
for (ll i = 1; i <= n; i++)
cin >> arr[i];
vector<ll> ans(n + 1, 0);
ll cnt = 0;
for (ll i = n; i >= 1; i--) {
ll sum = 0;
for (ll j = 2 * i; j <= n; j += i)
sum += ans[j];
if ((sum % 2 == 0 && arr[i] == 1) || (sum % 2 == 1 && arr[i] == 0)) {
ans[i] = 1;
cnt++;
}
}
cout << cnt << endl;
for (ll i = 1; i <= n; i++) {
if (ans[i] == 1)
cout << i << " ";
}
}
| [] | 780,147 | 780,148 | u811604715 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
int a[maxn], b[maxn];
bool check(int n) {
int ans = 0;
for (int i = n; i >= 1; i--) {
int tmp = 0;
for (int j = i + i; j <= n; j += i)
tmp += b[j];
if (tmp % 2 != a[i]) {
b[i] = 1;
ans++;
}
}
printf("%d\n", ans);
for (int i = 1; i <= n; i++)
if (b[i])
printf("%d ", b[i]);
return 1;
}
int main() {
int n;
scanf("%d", &n);
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]);
if (!check(n))
printf("-1\n");
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
int a[maxn], b[maxn];
bool check(int n) {
int ans = 0;
for (int i = n; i >= 1; i--) {
int tmp = 0;
for (int j = i + i; j <= n; j += i)
tmp += b[j];
if (tmp % 2 != a[i]) {
b[i] = 1;
ans++;
}
}
printf("%d\n", ans);
for (int i = 1; i <= n; i++)
if (b[i])
printf("%d ", i);
return 1;
}
int main() {
int n;
scanf("%d", &n);
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]);
if (!check(n))
printf("-1\n");
return 0;
} | [
"call.arguments.change"
] | 780,149 | 780,150 | u559470386 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
typedef pair<int, int> pii;
typedef unsigned long long ull;
typedef long long ll;
typedef double db;
const int N = 2e5 + 10;
int n, a[N], b[N], tag;
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 == n)
b[i] = a[i];
else {
int cnt = 0;
for (int j = i + i; j <= n; j += i) {
cnt += b[j];
}
cnt &= 1;
if (cnt == a[i])
b[i] = 0;
else
b[i] = 1;
}
}
for (int i = 1; i <= n; i++)
tag += b[i];
printf("%d\n", tag);
for (int i = 1; i <= n; i++)
if (b[i])
printf("%d ", b[i]);
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
typedef pair<int, int> pii;
typedef unsigned long long ull;
typedef long long ll;
typedef double db;
const int N = 2e5 + 10;
int n, a[N], b[N], tag;
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 == n)
b[i] = a[i];
else {
int cnt = 0;
for (int j = i + i; j <= n; j += i) {
cnt += b[j];
}
cnt &= 1;
if (cnt == a[i])
b[i] = 0;
else
b[i] = 1;
}
}
for (int i = 1; i <= n; i++)
tag += b[i];
printf("%d\n", tag);
for (int i = 1; i <= n; i++)
if (b[i])
printf("%d ", i);
return 0;
}
| [
"call.arguments.change"
] | 780,151 | 780,152 | u976942563 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
int main() {
long N;
long M = 0;
int A[200002];
int dp[200002];
cin >> N;
for (long i = 1; i <= N; i++)
cin >> A[i];
for (long i = N; i >= 1; i--) {
long counter = 0;
long j = i;
long coeff = 2;
while (j * coeff <= N) {
counter += dp[j * coeff];
coeff++;
}
dp[i] = (counter % 2) ^ A[i];
if (dp[i] == 1)
M++;
}
cout << M << endl;
if (M == 0)
return 0;
for (long i = 1; i <= N; i++) {
if (dp[i] == 1) {
cout << dp[i] << " ";
}
}
cout << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long N;
long M = 0;
int A[200002];
int dp[200002];
cin >> N;
for (long i = 1; i <= N; i++)
cin >> A[i];
for (long i = N; i >= 1; i--) {
long counter = 0;
long j = i;
long coeff = 2;
while (j * coeff <= N) {
counter += dp[j * coeff];
coeff++;
}
dp[i] = (counter % 2) ^ A[i];
if (dp[i] == 1)
M++;
}
cout << M << endl;
if (M == 0)
return 0;
for (long i = 1; i <= N; i++) {
if (dp[i] == 1) {
cout << i << " ";
}
}
cout << endl;
return 0;
} | [] | 780,155 | 780,156 | u028681952 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
int main() {
long N;
long M = 0;
int A[200002];
int dp[200002];
cin >> N;
for (long i = 1; i <= N; i++)
cin >> A[i];
for (long i = N; i >= 1; i--) {
long counter = 0;
long j = i;
long coeff = 2;
while (j * coeff < N) {
counter += dp[j * coeff];
coeff++;
}
dp[i] = (counter % 2) ^ A[i];
if (dp[i] == 1)
M++;
}
cout << M << endl;
if (M == 0)
return 0;
for (long i = 1; i <= N; i++) {
if (dp[i] == 1) {
cout << dp[i] << " ";
}
}
cout << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long N;
long M = 0;
int A[200002];
int dp[200002];
cin >> N;
for (long i = 1; i <= N; i++)
cin >> A[i];
for (long i = N; i >= 1; i--) {
long counter = 0;
long j = i;
long coeff = 2;
while (j * coeff <= N) {
counter += dp[j * coeff];
coeff++;
}
dp[i] = (counter % 2) ^ A[i];
if (dp[i] == 1)
M++;
}
cout << M << endl;
if (M == 0)
return 0;
for (long i = 1; i <= N; i++) {
if (dp[i] == 1) {
cout << i << " ";
}
}
cout << endl;
return 0;
} | [
"expression.operator.compare.change",
"control_flow.loop.condition.change"
] | 780,157 | 780,156 | u028681952 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void enum_divisor(ll n, map<int, ll> &mp) {
for (ll i = 1; i * i <= n; i++) {
if (n % i == 0) {
mp[i]++;
if (i * i != n)
mp[n / i]++;
}
}
}
int main() {
int n;
cin >> n;
vector<int> a(n);
map<int, ll> mp;
bool isp = true;
vector<int> b;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = n; i >= 1; i--) {
if (a[i - 1] + mp[i]) {
b.push_back(i);
enum_divisor(i, mp);
}
}
sort(b.begin(), b.end());
cout << b.size() << endl;
for (int i = 0; i < b.size(); i++) {
cout << b[i] << endl;
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void enum_divisor(ll n, map<int, ll> &mp) {
for (ll i = 1; i * i <= n; i++) {
if (n % i == 0) {
mp[i]++;
if (i * i != n)
mp[n / i]++;
}
}
}
int main() {
int n;
cin >> n;
vector<int> a(n);
map<int, ll> mp;
bool isp = true;
vector<int> b;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = n; i >= 1; i--) {
if (a[i - 1] % 2 != mp[i] % 2) {
b.push_back(i);
enum_divisor(i, mp);
}
}
sort(b.begin(), b.end());
cout << b.size() << endl;
for (int i = 0; i < b.size(); i++) {
cout << b[i] << endl;
}
return 0;
} | [
"expression.operator.arithmetic.change",
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change"
] | 780,158 | 780,159 | u853947407 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
using LL = long long;
using PII = pair<LL, LL>;
using VI = vector<LL>;
using VVI = vector<VI>;
using VB = vector<bool>;
using VS = vector<string>;
using VP = vector<PII>;
#define VV(T) vector<vector<T>>
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(x, c) for (auto x : (c))
#define ALL(c) (c).begin(), (c).end()
#define REVERSE(c) reverse(ALL(c))
#define SORT(c) stable_sort(ALL(c))
#define RSORT(c) stable_sort((c).rbegin(), (c).rend())
#define FOR(i, a, b) for (LL i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define $(x) \
{ cout << #x << " = " << (x) << endl; }
void solve(LL N, vector<LL> a) {
LL X = N;
VI v(N);
LL M = 0;
while (N > 0) {
LL L = N / 2 + 1;
FOR(i, L, N + 1) {
//$(i);
LL sum = 0;
for (LL j = i + i; j < N + 1; j += i) {
sum += v[j - 1];
}
//$(sum);
if (a[i - 1] == sum % 2) {
v[i - 1] = 0;
} else {
v[i - 1] = 1;
M++;
}
//$(v[i - 1]);
}
N = L - 1;
}
cout << M << endl;
REP(i, X) {
if (v[i] == 1) {
cout << i + 1 << " ";
}
}
cout << endl;
}
int main() {
LL N;
scanf("%lld", &N);
vector<LL> a(N);
for (int i = 0; i < N; i++) {
scanf("%lld", &a[i]);
}
solve(N, move(a));
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
using LL = long long;
using PII = pair<LL, LL>;
using VI = vector<LL>;
using VVI = vector<VI>;
using VB = vector<bool>;
using VS = vector<string>;
using VP = vector<PII>;
#define VV(T) vector<vector<T>>
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(x, c) for (auto x : (c))
#define ALL(c) (c).begin(), (c).end()
#define REVERSE(c) reverse(ALL(c))
#define SORT(c) stable_sort(ALL(c))
#define RSORT(c) stable_sort((c).rbegin(), (c).rend())
#define FOR(i, a, b) for (LL i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define $(x) \
{ cout << #x << " = " << (x) << endl; }
void solve(LL N, vector<LL> a) {
LL X = N;
VI v(N);
LL M = 0;
while (N > 0) {
LL L = N / 2 + 1;
FOR(i, L, N + 1) {
//$(i);
LL sum = 0;
for (LL j = i + i; j < X + 1; j += i) {
//$(j);
sum += v[j - 1];
}
//$(sum);
if (a[i - 1] == sum % 2) {
v[i - 1] = 0;
} else {
v[i - 1] = 1;
M++;
}
//$(v[i - 1]);
}
N = L - 1;
}
cout << M << endl;
REP(i, X) {
if (v[i] == 1) {
cout << i + 1 << " ";
}
}
cout << endl;
}
int main() {
LL N;
scanf("%lld", &N);
vector<LL> a(N);
for (int i = 0; i < N; i++) {
scanf("%lld", &a[i]);
}
solve(N, move(a));
return 0;
}
| [
"identifier.change",
"control_flow.loop.condition.change"
] | 780,166 | 780,167 | u816800341 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
using LL = long long;
using PII = pair<LL, LL>;
using VI = vector<LL>;
using VVI = vector<VI>;
using VB = vector<bool>;
using VS = vector<string>;
using VP = vector<PII>;
#define VV(T) vector<vector<T>>
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(x, c) for (auto x : (c))
#define ALL(c) (c).begin(), (c).end()
#define REVERSE(c) reverse(ALL(c))
#define SORT(c) stable_sort(ALL(c))
#define RSORT(c) stable_sort((c).rbegin(), (c).rend())
#define FOR(i, a, b) for (LL i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define $(x) \
{ cout << #x << " = " << (x) << endl; }
void solve(LL N, vector<LL> a) {
LL X = N;
VI v(N);
LL M = 0;
while (N > 0) {
LL L = N / 2 + 1;
FOR(i, L, N + 1) {
//$(i);
LL sum = 0;
for (LL j = i + i; j < N + 1; j += i) {
sum += v[j - 1];
}
//$(sum);
if (a[i - 1] == sum % 2) {
v[i - 1] = 0;
} else {
v[i - 1] = 1;
M++;
}
//$(v[i - 1]);
}
N = L - 1;
}
cout << M << endl;
REP(i, X) {
if (v[i] == 1) {
cout << i + 1 << " ";
}
cout << endl;
}
}
int main() {
LL N;
scanf("%lld", &N);
vector<LL> a(N);
for (int i = 0; i < N; i++) {
scanf("%lld", &a[i]);
}
solve(N, move(a));
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
using LL = long long;
using PII = pair<LL, LL>;
using VI = vector<LL>;
using VVI = vector<VI>;
using VB = vector<bool>;
using VS = vector<string>;
using VP = vector<PII>;
#define VV(T) vector<vector<T>>
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(x, c) for (auto x : (c))
#define ALL(c) (c).begin(), (c).end()
#define REVERSE(c) reverse(ALL(c))
#define SORT(c) stable_sort(ALL(c))
#define RSORT(c) stable_sort((c).rbegin(), (c).rend())
#define FOR(i, a, b) for (LL i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define $(x) \
{ cout << #x << " = " << (x) << endl; }
void solve(LL N, vector<LL> a) {
LL X = N;
VI v(N);
LL M = 0;
while (N > 0) {
LL L = N / 2 + 1;
FOR(i, L, N + 1) {
//$(i);
LL sum = 0;
for (LL j = i + i; j < X + 1; j += i) {
//$(j);
sum += v[j - 1];
}
//$(sum);
if (a[i - 1] == sum % 2) {
v[i - 1] = 0;
} else {
v[i - 1] = 1;
M++;
}
//$(v[i - 1]);
}
N = L - 1;
}
cout << M << endl;
REP(i, X) {
if (v[i] == 1) {
cout << i + 1 << " ";
}
}
cout << endl;
}
int main() {
LL N;
scanf("%lld", &N);
vector<LL> a(N);
for (int i = 0; i < N; i++) {
scanf("%lld", &a[i]);
}
solve(N, move(a));
return 0;
}
| [
"identifier.change",
"control_flow.loop.condition.change"
] | 780,168 | 780,167 | u816800341 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 200000 + 10;
int n, a[N], np[N], b1[N];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]);
vector<int> v;
for (int b = n; b >= 1; b--) {
ll sum = 0;
for (int d = b * 2; d <= n; d += b)
sum += b1[d];
if (a[b] % 2 != sum % 2) {
v.push_back(b);
b1[b] = 1;
}
}
for (int i = 1; i <= n; i++) {
ll sum = 0;
for (int j = i; j <= n; j += i)
sum += b1[i];
if (sum % 2 != a[i] % 2) {
puts("-1");
return 0;
}
}
cout << v.size() << endl;
for (auto t : v)
cout << t << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 200000 + 10;
int n, a[N], np[N], b1[N];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]);
vector<int> v;
for (int b = n; b >= 1; b--) {
ll sum = 0;
for (int d = b * 2; d <= n; d += b)
sum += b1[d];
if (a[b] % 2 != sum % 2) {
v.push_back(b);
b1[b] = 1;
}
}
for (int i = 1; i <= n; i++) {
ll sum = 0;
for (int j = i; j <= n; j += i)
sum += b1[j];
if (sum % 2 != a[i] % 2) {
puts("-1");
return 0;
}
}
cout << v.size() << endl;
for (auto t : v)
cout << t << endl;
return 0;
}
| [
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change"
] | 780,169 | 780,170 | u011129112 | cpp |
p02972 | #include <algorithm>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
int main() {
int n;
cin >> n;
vi a(n + 1);
for (int i = 1; i < n + 1; i++) {
scanf("%d", &a[i]);
}
int cnt = 0;
vi ans(n + 1, 0);
for (int i = n; i >= 1; i--) {
int j = i;
ans[i] = a[i];
j *= 2;
while (j < n) {
ans[i] ^= ans[j];
j *= 2;
}
if (ans[i] == 1) {
cnt++;
}
}
cout << cnt << endl;
for (int i = 1; i < n + 1; i++) {
if (ans[i] == 1) {
printf("%d ", i);
}
}
printf("\n");
return 0;
}
| #include <algorithm>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
int main() {
int n;
cin >> n;
vi a(n + 1);
for (int i = 1; i < n + 1; i++) {
scanf("%d", &a[i]);
}
int cnt = 0;
vi ans(n + 1, 0);
for (int i = n; i >= 1; i--) {
int j = i;
ans[i] = a[i];
j += i;
while (j <= n) {
ans[i] ^= ans[j];
j += i;
}
if (ans[i] == 1) {
cnt++;
}
}
cout << cnt << endl;
for (int i = 1; i < n + 1; i++) {
if (ans[i] == 1) {
printf("%d ", i);
}
}
printf("\n");
return 0;
}
| [
"assignment.change",
"expression.operator.compare.change",
"control_flow.loop.condition.change"
] | 780,173 | 780,174 | u683667873 | cpp |
p02972 | #include <algorithm>
#include <iostream>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
typedef long long int64;
int main(void) {
int64 N;
int64 tmp = 0, num = 0;
cin >> N;
vector<int64> a(N + 1);
vector<int64> b(N + 1);
for (int64 i = 1; i <= N; i++) {
cin >> a[i];
b[i] = 0;
}
for (int64 i = N; i > 0; i--) {
tmp = 1;
for (int64 j = N / i + 1; j > 0; j--) {
if (j * i <= N)
tmp += b[j * i];
}
if (tmp % 2 == a[i]) {
b[i] = 1;
num++;
}
}
cout << num << endl;
for (int64 i = 0; i < N; i++) {
if (b[i] == 1)
cout << i << " ";
}
// cout<<endl;
return 0;
} | #include <algorithm>
#include <iostream>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
typedef long long int64;
int main(void) {
int64 N;
int64 tmp = 0, num = 0;
cin >> N;
vector<int64> a(N + 1);
vector<int64> b(N + 1);
for (int64 i = 1; i <= N; i++) {
cin >> a[i];
b[i] = 0;
}
for (int64 i = N; i > 0; i--) {
tmp = 0;
for (int64 j = N / i + 1; j > 1; j--) {
if (j * i <= N)
tmp += b[j * i];
}
if (tmp % 2 != a[i]) {
b[i] = 1;
num++;
}
}
cout << num << endl;
for (int64 i = 1; i <= N; i++) {
if (b[i] == 1)
cout << i << " ";
}
// cout<<endl;
return 0;
} | [
"literal.number.change",
"assignment.value.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change",
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"variable_declaration.value.change",
"cont... | 780,177 | 780,178 | u647569169 | cpp |
p02972 | #include <bits/stdc++.h>
#define LL long long
#define fi first
#define se second
#define mp make_pair
#define pb push_back
using namespace std;
LL gcd(LL a, LL b) { return b ? gcd(b, a % b) : a; }
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; }
LL powmod(LL a, LL b, LL MOD) {
LL ans = 1;
while (b) {
if (b % 2)
ans = ans * a % MOD;
a = a * a % MOD;
b /= 2;
}
return ans;
}
const int N = 2e5 + 11;
int n, a[N];
priority_queue<int> q;
int b[N], cnt;
int main() {
ios::sync_with_stdio(false);
cin >> n;
for (int i = 1; i <= n; i++)
cin >> a[i];
for (int i = n; i >= 1; i--) {
int res = 0;
cnt = 0;
for (int j = 2 * i; j <= n; j += i) {
res += b[j];
}
if ((res % 2) != a[i])
b[i] = 1;
if (b[i])
cnt++;
}
cout << cnt << endl;
for (int i = 1; i <= n; i++)
if (b[i])
cout << i << ' ';
return 0;
} | #include <bits/stdc++.h>
#define LL long long
#define fi first
#define se second
#define mp make_pair
#define pb push_back
using namespace std;
LL gcd(LL a, LL b) { return b ? gcd(b, a % b) : a; }
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; }
LL powmod(LL a, LL b, LL MOD) {
LL ans = 1;
while (b) {
if (b % 2)
ans = ans * a % MOD;
a = a * a % MOD;
b /= 2;
}
return ans;
}
const int N = 2e5 + 11;
int n, a[N];
priority_queue<int> q;
int b[N], cnt;
int main() {
ios::sync_with_stdio(false);
cin >> n;
for (int i = 1; i <= n; i++)
cin >> a[i];
for (int i = n; i >= 1; i--) {
int res = 0;
// cnt=0;
for (int j = 2 * i; j <= n; j += i) {
res += b[j];
}
if ((res % 2) != a[i])
b[i] = 1;
// if()
if (b[i])
cnt++;
}
cout << cnt << endl;
for (int i = 1; i <= n; i++)
if (b[i])
cout << i << ' ';
return 0;
} | [] | 780,179 | 780,180 | u862237347 | cpp |
p02972 | #include <bits/stdc++.h>
#define LL long long
#define fi first
#define se second
#define mp make_pair
#define pb push_back
using namespace std;
LL gcd(LL a, LL b) { return b ? gcd(b, a % b) : a; }
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; }
LL powmod(LL a, LL b, LL MOD) {
LL ans = 1;
while (b) {
if (b % 2)
ans = ans * a % MOD;
a = a * a % MOD;
b /= 2;
}
return ans;
}
const int N = 2e5 + 11;
int n, a[N];
priority_queue<int> q;
int b[N], cnt;
int main() {
ios::sync_with_stdio(false);
cin >> n;
for (int i = 1; i <= n; i++)
cin >> a[i];
for (int i = n; i >= 1; i--) {
int res = 0;
cnt = 0;
for (int j = 2 * i; j <= n; j += i) {
res += b[j];
}
if ((res % 2) != a[i])
b[i] = res ^ 1;
if (b[i])
cnt++;
}
cout << cnt << endl;
for (int i = 1; i <= n; i++)
if (b[i])
cout << i << ' ';
return 0;
} | #include <bits/stdc++.h>
#define LL long long
#define fi first
#define se second
#define mp make_pair
#define pb push_back
using namespace std;
LL gcd(LL a, LL b) { return b ? gcd(b, a % b) : a; }
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; }
LL powmod(LL a, LL b, LL MOD) {
LL ans = 1;
while (b) {
if (b % 2)
ans = ans * a % MOD;
a = a * a % MOD;
b /= 2;
}
return ans;
}
const int N = 2e5 + 11;
int n, a[N];
priority_queue<int> q;
int b[N], cnt;
int main() {
ios::sync_with_stdio(false);
cin >> n;
for (int i = 1; i <= n; i++)
cin >> a[i];
for (int i = n; i >= 1; i--) {
int res = 0;
// cnt=0;
for (int j = 2 * i; j <= n; j += i) {
res += b[j];
}
if ((res % 2) != a[i])
b[i] = 1;
// if()
if (b[i])
cnt++;
}
cout << cnt << endl;
for (int i = 1; i <= n; i++)
if (b[i])
cout << i << ' ';
return 0;
} | [
"expression.operation.binary.remove"
] | 780,181 | 780,180 | u862237347 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
a[0] = 0;
for (int i = 1; i < n + 1; ++i) {
cin >> a[i];
}
vector<int> b(n + 1);
b[0] = 0;
int m = 0;
vector<int> out;
for (int i = n; i > 0; --i) {
if (i >= n / 2 + 1) {
// iの倍数はi一つしかないから, a[i]とボールの数が一致する必要がある
b[i] = a[i];
if (a[i] == 1) {
m += 1;
out.push_back(i);
}
} else {
int j = 2 * i;
int tmp = 0;
while (j <= n) {
tmp += a[j];
j += i;
}
if (a[i] % 2 == tmp % 2) {
b[i] = 0;
} else {
b[i] = 1;
m += 1;
out.push_back(i);
}
}
}
cout << m << endl;
for (int i = 0; i < out.size(); ++i) {
cout << out[i];
if (i + 1 < out.size())
cout << " ";
}
if (m > 0)
cout << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n + 1);
a[0] = 0;
for (int i = 1; i <= n; ++i) {
cin >> a[i];
}
vector<int> b(n + 1);
b[0] = 0;
int m = 0;
vector<int> out;
for (int i = n; i > 0; --i) {
if (i >= n / 2 + 1) {
// iの倍数はi一つしかないから, a[i]とボールの数が一致する必要がある
b[i] = a[i];
if (a[i] == 1) {
m += 1;
out.push_back(i);
}
} else {
int j = 2 * i;
int tmp = 0;
while (j <= n) {
tmp += b[j];
j += i;
}
if (a[i] % 2 == tmp % 2) {
b[i] = 0;
} else {
b[i] = 1;
m += 1;
out.push_back(i);
}
}
}
cout << m << endl;
for (int i = 0; i < out.size(); ++i) {
cout << out[i];
if (i + 1 < out.size())
cout << " ";
}
if (m > 0)
cout << endl;
return 0;
} | [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change",
"expression.operation.binary.remove",
"assignment.value.change",
"identifier.change"
] | 780,182 | 780,183 | u323492289 | cpp |
p02972 | #include <algorithm>
#include <iostream>
#include <vector>
int main() {
int n;
std::cin >> n;
std::vector<int> a(n);
for (auto &&e : a)
std::cin >> e;
std::vector<int> ans(n);
for (int i = n - 1; i >= 0; --i) {
ans[i] = a[i];
for (int j = (i + 1) * 2; j <= n; j += i + 1)
if (a[j - 1] == 1)
ans[i] = -ans[i] + 1;
}
std::cout << std::count(ans.begin(), ans.end(), 1) << std::endl;
bool isFirst = true;
for (int i = 0; i < n; ++i) {
if (ans[i] == 1) {
if (!isFirst)
std::cout << " ";
isFirst = false;
std::cout << i + 1;
}
}
std::cout << std::endl;
} | #include <algorithm>
#include <iostream>
#include <vector>
int main() {
int n;
std::cin >> n;
std::vector<int> a(n);
for (auto &&e : a)
std::cin >> e;
std::vector<int> ans(n);
for (int i = n - 1; i >= 0; --i) {
ans[i] = a[i];
for (int j = (i + 1) * 2; j <= n; j += i + 1)
if (ans[j - 1] == 1)
ans[i] = -ans[i] + 1;
}
std::cout << std::count(ans.begin(), ans.end(), 1) << std::endl;
bool isFirst = true;
for (int i = 0; i < n; ++i) {
if (ans[i] == 1) {
if (!isFirst)
std::cout << " ";
isFirst = false;
std::cout << i + 1;
}
}
std::cout << std::endl;
} | [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 780,184 | 780,185 | u492926158 | cpp |
p02972 | /**
������������ Author : Avi J Patel ������������
������������ University : DA-IICT ������������
**/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define N 100000
#define ff first
#define ss second
#define si size()
#define MOD 1000000007
#define large 10000000000000001
#define For(i, m, n) for (long long i = m; i < n; i++)
#define st(x) sort(x.begin(), x.end())
#define re(x, i) reverse(x.begin() + i, x.end())
#define FAST \
ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0); \
srand(time(NULL));
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) {
return (a.second < b.second);
}
/*void calc()
{
for(int i=0;i<2005;i++)
{
a[i][0]=1;
a[i][i]=1;
for(int j=1;j<i;j++)
{
a[i][j]=(a[i-1][j-1]+a[i-1][j])%MOD;
}
}
}*/
int main() {
int n;
cin >> n;
vector<int> a(n);
int temp = 0;
for (int i = 0; i < n; i++) {
cin >> a[i];
if (a[i])
temp = 1;
}
if (temp == 0) {
cout << 0;
return 0;
}
int cnt = 0;
vector<int> ans(n);
for (int i = n - 1; i >= 0; i--) {
if (i == n - 1) {
ans[i] = a[i];
if (a[i])
cnt++;
} else {
temp = 0;
for (int j = 2 * i + 1; j < n; j += i + 1) {
if (ans[j] == 1)
temp++;
}
if (a[i] % 2 == 0 && temp % 2 == 0) {
ans[i] == 0;
} else if (a[i] % 2 == 1 && temp % 2 == 1) {
ans[i] = 1;
cnt++;
} else if (a[i] % 2 == 0 && temp % 2 == 1) {
ans[i] = 1;
cnt++;
} else if (a[i] % 2 == 1 && temp % 2 == 0) {
ans[i] = 1;
cnt++;
}
}
// cout<<ans[i]<<" ";
}
cout << cnt << endl;
for (int i = 0; i < ans.size(); i++) {
if (ans[i])
cout << i + 1 << " ";
}
return 0;
}
| /**
������������ Author : Avi J Patel ������������
������������ University : DA-IICT ������������
**/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define N 100000
#define ff first
#define ss second
#define si size()
#define MOD 1000000007
#define large 10000000000000001
#define For(i, m, n) for (long long i = m; i < n; i++)
#define st(x) sort(x.begin(), x.end())
#define re(x, i) reverse(x.begin() + i, x.end())
#define FAST \
ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0); \
srand(time(NULL));
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) {
return (a.second < b.second);
}
/*void calc()
{
for(int i=0;i<2005;i++)
{
a[i][0]=1;
a[i][i]=1;
for(int j=1;j<i;j++)
{
a[i][j]=(a[i-1][j-1]+a[i-1][j])%MOD;
}
}
}*/
int main() {
int n;
cin >> n;
vector<int> a(n);
int temp = 0;
for (int i = 0; i < n; i++) {
cin >> a[i];
if (a[i])
temp = 1;
}
if (temp == 0) {
cout << 0;
return 0;
}
int cnt = 0;
vector<int> ans(n);
for (int i = n - 1; i >= 0; i--) {
if (i == n - 1) {
ans[i] = a[i];
if (a[i])
cnt++;
} else {
temp = 0;
for (int j = 2 * i + 1; j < n; j += i + 1) {
if (ans[j] == 1)
temp++;
}
if (a[i] % 2 == 0 && temp % 2 == 0) {
ans[i] == 0;
} else if (a[i] % 2 == 1 && temp % 2 == 1) {
ans[i] = 0;
} else if (a[i] % 2 == 0 && temp % 2 == 1) {
ans[i] = 1;
cnt++;
} else if (a[i] % 2 == 1 && temp % 2 == 0) {
ans[i] = 1;
cnt++;
}
}
// cout<<ans[i]<<" ";
}
cout << cnt << endl;
for (int i = 0; i < ans.size(); i++) {
if (ans[i])
cout << i + 1 << " ";
}
return 0;
}
| [
"literal.number.change",
"assignment.value.change"
] | 780,186 | 780,187 | u589330060 | cpp |
p02972 | #include <iostream>
#include <vector>
using namespace std;
int main() {
int n, k;
vector<int> a;
cin >> n;
a.push_back(0);
for (int i = 0; i < n; i++) {
cin >> k;
a.push_back(k);
}
int m = 0, b[200010] = {};
vector<int> ans;
for (int i = n; i > 0; i--) {
int sum = 0;
for (int j = i * 2; j < n; j += i) {
sum += b[j];
}
if (sum % 2 != a[i]) {
m++;
b[i] = 1;
ans.push_back(i);
}
}
cout << m << endl;
for (int i = m - 1; i >= 0; i--) {
cout << ans[i];
if (i)
cout << " ";
}
cout << endl;
return 0;
} | #include <iostream>
#include <vector>
using namespace std;
int main() {
int n, k;
vector<int> a;
cin >> n;
a.push_back(0);
for (int i = 0; i < n; i++) {
cin >> k;
a.push_back(k);
}
int m = 0, b[200010] = {};
vector<int> ans;
for (int i = n; i > 0; i--) {
int sum = 0;
for (int j = i * 2; j <= n; j += i) {
sum += b[j];
}
if (sum % 2 != a[i]) {
m++;
b[i] = 1;
ans.push_back(i);
}
}
cout << m << endl;
for (int i = m - 1; i >= 0; i--) {
cout << ans[i];
if (i)
cout << " ";
}
cout << endl;
return 0;
} | [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 780,188 | 780,189 | u047554023 | cpp |
p02972 | #include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for (ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
void print(const std::vector<int> &v) {
std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
std::cout << std::endl;
}
int main() {
long long N;
cin >> N;
vector<int> a(N); // amari
REP(i, N) { cin >> a[i]; }
vector<int> b(N, 0);
// cout << N / 2 << endl;
for (int i = N - 1; i > N / 2 - 1; i--) {
b[i] = a[i];
// cout << "i+1" << i + 1 << " b;" << b[i] << endl;
}
// cout << "maji" << endl;
for (int i = N / 2 - 1; i >= 0; i--) {
int tmp = 0;
for (int j = 2 * (i + 1); j * (i + 1) <= N; j += (i + 1)) {
tmp += b[j - 1];
}
if (tmp % 2 == a[i]) {
b[i] = 0;
} else {
b[i] = 1;
}
}
// cout << "maji" << endl;
cout << accumulate(b.begin(), b.end(), 0) << endl;
REP(i, N) {
if (b[i] > 0) {
cout << i + 1 << " ";
}
}
cout << endl;
return 0;
} | #include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for (ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
void print(const std::vector<int> &v) {
std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
std::cout << std::endl;
}
int main() {
long long N;
cin >> N;
vector<int> a(N); // amari
REP(i, N) { cin >> a[i]; }
vector<int> b(N, 0);
// cout << N / 2 << endl;
for (int i = N - 1; i > N / 2 - 1; i--) {
b[i] = a[i];
// cout << "i+1" << i + 1 << " b;" << b[i] << endl;
}
// cout << "maji" << endl;
for (int i = N / 2 - 1; i >= 0; i--) {
int tmp = 0;
for (int j = 2 * (i + 1); j <= N; j += (i + 1)) {
tmp += b[j - 1];
}
if (tmp % 2 == a[i]) {
b[i] = 0;
} else {
b[i] = 1;
}
}
// cout << "maji" << endl;
cout << accumulate(b.begin(), b.end(), 0) << endl;
REP(i, N) {
if (b[i] > 0) {
cout << i + 1 << " ";
}
}
cout << endl;
return 0;
} | [
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove"
] | 780,192 | 780,193 | u824337972 | cpp |
p02972 | #define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>
#define IOS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define endl '\n'
#define INF (1LL << 59)
#define ff first
#define ss second
#define mod 998244353
#define pb push_back
#define mp make_pair
#define int long long
#define all(a) a.begin(), a.end()
#define inf (1LL << 61)
#define ull unsigned long long
#define debug1(x) cerr << #x << ": " << x << '\n'
#define debug2(x, y) cerr << #x << ": " << x << '\t' << #y << ": " << y << '\n'
#define debug3(x, y, z) \
cerr << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": " \
<< z << '\n'
using namespace std;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1}; // 4 Direction
// int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
int gcd(int x, int y) {
if (y == 0)
return x;
else
return gcd(y, x % y);
}
int expo(int n, int m, int p) // modULAR EXPONENTIATION
{
int r = 1;
n = n % p;
while (m > 0) {
if (m % 2)
r = (r * n) % p;
n = (n * n) % p;
m = m / 2;
}
return r % p;
}
bool isPrime(int n) {
// Corner cases
if (n <= 1)
return false;
if (n <= 3)
return true;
// This is checked so that we can skip
// middle five numbers in below loop
if (n % 2 == 0 || n % 3 == 0)
return false;
for (int i = 5; i * i <= n; i = i + 6)
if (n % i == 0 || n % (i + 2) == 0)
return false;
return true;
}
int32_t main() {
IOS;
/*#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
/********************* Code starts here ***********************/
// int n,ans=inf;
// cin>>n;
// vector<int>a(n);
// for(int i=0;i<n;i++)
// {
// cin>>a[i];
// }
int n;
cin >> n;
vector<int> a(n + 1);
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
vector<int> b(n + 1);
for (int i = n; i >= 1; i--) {
if (2 * i > n) {
b[i] = a[i];
} else {
int c = 0, j = 2 * i;
while (j <= n) {
c = c + b[j];
j += i;
}
b[i] = (a[i] - c % 2 + 2) % 2;
}
}
for (int i = 1; i <= n; i++) {
int j = i, c = 0;
while (j <= n) {
c = c + b[j];
j += i;
}
if (c % 2 != b[i]) {
cout << -1 << endl;
return 0;
}
}
vector<int> ans;
for (int i = 1; i <= n; i++) {
if (b[i])
ans.pb(i);
}
cout << ans.size() << endl;
for (auto x : ans)
cout << x << ' ';
} | #define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>
#define IOS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define endl '\n'
#define INF (1LL << 59)
#define ff first
#define ss second
#define mod 998244353
#define pb push_back
#define mp make_pair
#define int long long
#define all(a) a.begin(), a.end()
#define inf (1LL << 61)
#define ull unsigned long long
#define debug1(x) cerr << #x << ": " << x << '\n'
#define debug2(x, y) cerr << #x << ": " << x << '\t' << #y << ": " << y << '\n'
#define debug3(x, y, z) \
cerr << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": " \
<< z << '\n'
using namespace std;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1}; // 4 Direction
// int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
int gcd(int x, int y) {
if (y == 0)
return x;
else
return gcd(y, x % y);
}
int expo(int n, int m, int p) // modULAR EXPONENTIATION
{
int r = 1;
n = n % p;
while (m > 0) {
if (m % 2)
r = (r * n) % p;
n = (n * n) % p;
m = m / 2;
}
return r % p;
}
bool isPrime(int n) {
// Corner cases
if (n <= 1)
return false;
if (n <= 3)
return true;
// This is checked so that we can skip
// middle five numbers in below loop
if (n % 2 == 0 || n % 3 == 0)
return false;
for (int i = 5; i * i <= n; i = i + 6)
if (n % i == 0 || n % (i + 2) == 0)
return false;
return true;
}
int32_t main() {
IOS;
/*#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
/********************* Code starts here ***********************/
// int n,ans=inf;
// cin>>n;
// vector<int>a(n);
// for(int i=0;i<n;i++)
// {
// cin>>a[i];
// }
int n;
cin >> n;
vector<int> a(n + 1);
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
vector<int> b(n + 1);
for (int i = n; i >= 1; i--) {
if (2 * i > n) {
b[i] = a[i];
} else {
int c = 0, j = 2 * i;
while (j <= n) {
c = c + b[j];
j += i;
}
b[i] = (a[i] - c % 2 + 2) % 2;
}
// cout<<i<<' '<<b[i]<<endl;
}
for (int i = 1; i <= n; i++) {
// cout<<b[i]<<endl;
int j = i, c = 0;
while (j <= n) {
c = c + b[j];
j += i;
}
// cout<<c<<' '<<a[i]<<endl;
if (((c) % 2) != a[i]) {
cout << -1 << endl;
return 0;
}
}
vector<int> ans;
for (int i = 1; i <= n; i++) {
if (b[i])
ans.pb(i);
// cout<<b[i]<<endl;
}
cout << ans.size() << endl;
for (auto x : ans)
cout << x << ' ';
} | [
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change",
"identifier.change"
] | 780,200 | 780,201 | u478857940 | cpp |
p02972 | #include <bits/stdc++.h>
//#define int long long
using namespace std;
using LL = long long;
using P = pair<int, int>;
#define FOR(i, a, n) for (int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define pb(a) push_back(a)
#define all(x) (x).begin(), (x).end()
template <typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) {
return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) {
t = v;
}
template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) {
for (auto &e : t)
fill_v(e, v);
}
const int INF = (int)1e9;
const LL INFL = (LL)1e18;
const int MOD = 1e9 + 7;
signed main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
vector<int> a(n);
REP(i, n) cin >> a[i];
vector<int> dp(n + 5);
for (int i = n; i > 0; i--) {
int cnt = 0, cur = i;
while (cur <= n) {
cnt += dp[cur];
cur += i;
}
if (cnt % 2 != a[i - 1])
dp[i] = 1;
}
// REP(i, n)
// cout << dp[i+1] << " \n"[i == n-1];
int ans = 0;
REP(i, n) if (dp[i + 1] == 1) ans++;
cout << ans << endl;
REP(i, n) if (dp[i + 1] == 1) cout << dp[i + 1] << " \n"[i == n - 1];
} | #include <bits/stdc++.h>
//#define int long long
using namespace std;
using LL = long long;
using P = pair<int, int>;
#define FOR(i, a, n) for (int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define pb(a) push_back(a)
#define all(x) (x).begin(), (x).end()
template <typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) {
return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) {
t = v;
}
template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) {
for (auto &e : t)
fill_v(e, v);
}
const int INF = (int)1e9;
const LL INFL = (LL)1e18;
const int MOD = 1e9 + 7;
signed main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
vector<int> a(n);
REP(i, n) cin >> a[i];
vector<int> dp(n + 5);
for (int i = n; i > 0; i--) {
int cnt = 0, cur = i;
while (cur <= n) {
cnt += dp[cur];
cur += i;
}
if (cnt % 2 != a[i - 1])
dp[i] = 1;
}
// REP(i, n)
// cout << dp[i+1] << " \n"[i == n-1];
int ans = 0;
REP(i, n) if (dp[i + 1] == 1) ans++;
cout << ans << endl;
REP(i, n) if (dp[i + 1] == 1) cout << i + 1 << " \n"[i == n - 1];
} | [] | 780,202 | 780,203 | u544732702 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> v(n + 1), sol, vu(n + 1);
for (int i = 1; i <= n; ++i) {
cin >> v[i];
}
for (int i = n; i >= 1; --i) {
int j = i;
vu[i] = v[i];
while (j <= n) {
vu[i] += vu[j];
j += i;
vu[i] %= 2;
}
if (vu[i] == 1)
sol.emplace_back(i);
}
cout << sol.size() << '\n';
for (int i : sol)
cout << i << ' ';
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> v(n + 1), sol, vu(n + 1);
for (int i = 1; i <= n; ++i) {
cin >> v[i];
}
for (int i = n; i >= 1; --i) {
int j = 2 * i;
vu[i] = v[i];
while (j <= n) {
vu[i] += vu[j];
j += i;
vu[i] %= 2;
}
if (vu[i] == 1)
sol.emplace_back(i);
}
cout << sol.size() << '\n';
for (int i : sol)
cout << i << ' ';
}
| [
"assignment.change"
] | 780,206 | 780,207 | u150436276 | cpp |
p02972 | #pragma once
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define bit(x, v) ((ll)x << v)
const ll INF = 1000000007;
const ll MAX = 1000010;
const ll MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++) {
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
long long COM(int n, int k) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
ll gcd(ll a, ll b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
int pr[100010];
void uini(int n) {
for (size_t i = 0; i <= n; i++) {
pr[i] = i;
}
}
int parent(int x) {
if (x == pr[x])
return x;
return pr[x] = parent(pr[x]);
}
bool unit(int x, int y) {
int px = parent(x);
int py = parent(y);
if (px == py)
return false;
if (px < py) {
pr[py] = px;
} else {
pr[px] = py;
}
return true;
}
// res[i][c] := i 文字目以降で最初に文字 c が登場する index (存在しないときは n)
vector<vector<int>> calcNext(const string &S) {
int n = (int)S.size();
vector<vector<int>> res(n + 1, vector<int>(26, n));
for (int i = n - 1; i >= 0; --i) {
for (int j = 0; j < 26; ++j)
res[i][j] = res[i + 1][j];
res[i][S[i] - 'a'] = i;
}
return res;
}
// mod 1000000007 の世界で a += b する関数
void add(long long &a, long long b) {
a += b;
if (a >= MOD)
a -= MOD;
}
const ll ainf = 998244353;
struct cell {
int x, y;
int deep;
cell(int x, int y, int deep) : x(x), y(y), deep(deep) {}
};
int dx[] = {-1, 1, 0, 0};
int dy[] = {0, 0, -1, 1};
int W, H, N;
int X1[500], X2[500], Y1[500], Y2[500];
bool fld[500 * 6][500 * 6];
int compress(int *x1, int *x2, int w) {
vector<int> xs;
for (int i = 0; i < N; i++) {
for (int d = -1; d <= 1; d++) {
int tx1 = x1[i] + d, tx2 = x2[i] + d;
if (1 <= tx1 && tx1 <= W)
xs.push_back(tx1);
if (1 <= tx2 && tx2 <= W)
xs.push_back(tx2);
}
}
sort(xs.begin(), xs.end());
xs.erase(unique(xs.begin(), xs.end()), xs.end());
for (size_t i = 0; i < N; i++) {
x1[i] = find(xs.begin(), xs.end(), x1[i]) - xs.begin();
x2[i] = find(xs.begin(), xs.end(), x2[i]) - xs.begin();
}
return xs.size();
}
const int MAX_N = 1 << 17;
//
// int n,dat[2 * MAX_N - 1];
//
// void init(int n_) {
// n = 1;
// while (n < n_)
// {
// n *= 2;
// }
// for (size_t i = 0; i < 2 * n - 1; i++)
// {
// dat[i] = INT_MAX;
// }
//}
//
// void update(int k, int a) {
// k += n - 1;
// dat[k] = a;
// while (k > 0) {
// k = (k - 1) / 2;
// dat[k] = min(dat[k * 2 + 1], dat[k * 2 + 2]);
// }
//}
// int query(int a, int b, int k, int l, int r) {
// if (r <= a || b <= 1) return INT_MAX;
//
// if (a <= l && r <= b) return dat[k];
// else {
// int vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
// int vr = query(a, b, k * 2 + 1, (l + r) / 2, r);
// return min(vl, vr);
// }
//
// auto p = tie(a,b,k);
//}
ll fmemo[1000010];
ll fact(ll x) {
if (fmemo[x] > 0)
return fmemo[x];
if (x == 0)
return 1;
fmemo[x] = (x * fact(x - 1));
fmemo[x] %= INF;
return fmemo[x];
}
void solv() {
ll n;
cin >> n;
int a[200010];
for (size_t i = 1; i <= n; i++) {
cin >> a[i];
}
int b[200010];
int sum = 0;
memset(b, 0, sizeof(b));
vector<int> vec;
for (int i = n; i > 0; i--) {
int j = i * 2;
int v = 0;
int c = 3;
while (j < n) {
v += b[j];
j = i * c;
c++;
}
if ((a[i] % 2 == 0) ^ (v % 2 == 0)) {
b[i] = 1;
vec.push_back(i);
sum++;
}
}
cout << sum << endl;
for (size_t i = 0; i < vec.size(); i++) {
if (i > 0)
cout << " ";
cout << vec[i];
}
cout << endl;
}
int main() {
// COMinit();
solv();
return 0;
}
| #pragma once
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define bit(x, v) ((ll)x << v)
const ll INF = 1000000007;
const ll MAX = 1000010;
const ll MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++) {
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
long long COM(int n, int k) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
ll gcd(ll a, ll b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
int pr[100010];
void uini(int n) {
for (size_t i = 0; i <= n; i++) {
pr[i] = i;
}
}
int parent(int x) {
if (x == pr[x])
return x;
return pr[x] = parent(pr[x]);
}
bool unit(int x, int y) {
int px = parent(x);
int py = parent(y);
if (px == py)
return false;
if (px < py) {
pr[py] = px;
} else {
pr[px] = py;
}
return true;
}
// res[i][c] := i 文字目以降で最初に文字 c が登場する index (存在しないときは n)
vector<vector<int>> calcNext(const string &S) {
int n = (int)S.size();
vector<vector<int>> res(n + 1, vector<int>(26, n));
for (int i = n - 1; i >= 0; --i) {
for (int j = 0; j < 26; ++j)
res[i][j] = res[i + 1][j];
res[i][S[i] - 'a'] = i;
}
return res;
}
// mod 1000000007 の世界で a += b する関数
void add(long long &a, long long b) {
a += b;
if (a >= MOD)
a -= MOD;
}
const ll ainf = 998244353;
struct cell {
int x, y;
int deep;
cell(int x, int y, int deep) : x(x), y(y), deep(deep) {}
};
int dx[] = {-1, 1, 0, 0};
int dy[] = {0, 0, -1, 1};
int W, H, N;
int X1[500], X2[500], Y1[500], Y2[500];
bool fld[500 * 6][500 * 6];
int compress(int *x1, int *x2, int w) {
vector<int> xs;
for (int i = 0; i < N; i++) {
for (int d = -1; d <= 1; d++) {
int tx1 = x1[i] + d, tx2 = x2[i] + d;
if (1 <= tx1 && tx1 <= W)
xs.push_back(tx1);
if (1 <= tx2 && tx2 <= W)
xs.push_back(tx2);
}
}
sort(xs.begin(), xs.end());
xs.erase(unique(xs.begin(), xs.end()), xs.end());
for (size_t i = 0; i < N; i++) {
x1[i] = find(xs.begin(), xs.end(), x1[i]) - xs.begin();
x2[i] = find(xs.begin(), xs.end(), x2[i]) - xs.begin();
}
return xs.size();
}
const int MAX_N = 1 << 17;
//
// int n,dat[2 * MAX_N - 1];
//
// void init(int n_) {
// n = 1;
// while (n < n_)
// {
// n *= 2;
// }
// for (size_t i = 0; i < 2 * n - 1; i++)
// {
// dat[i] = INT_MAX;
// }
//}
//
// void update(int k, int a) {
// k += n - 1;
// dat[k] = a;
// while (k > 0) {
// k = (k - 1) / 2;
// dat[k] = min(dat[k * 2 + 1], dat[k * 2 + 2]);
// }
//}
// int query(int a, int b, int k, int l, int r) {
// if (r <= a || b <= 1) return INT_MAX;
//
// if (a <= l && r <= b) return dat[k];
// else {
// int vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
// int vr = query(a, b, k * 2 + 1, (l + r) / 2, r);
// return min(vl, vr);
// }
//
// auto p = tie(a,b,k);
//}
ll fmemo[1000010];
ll fact(ll x) {
if (fmemo[x] > 0)
return fmemo[x];
if (x == 0)
return 1;
fmemo[x] = (x * fact(x - 1));
fmemo[x] %= INF;
return fmemo[x];
}
void solv() {
ll n;
cin >> n;
int a[200010];
for (size_t i = 1; i <= n; i++) {
cin >> a[i];
}
int b[200010];
int sum = 0;
memset(b, 0, sizeof(b));
vector<int> vec;
for (int i = n; i > 0; i--) {
int j = i * 2;
int v = 0;
int c = 3;
while (j <= n) {
v += b[j];
j = i * c;
c++;
}
if ((a[i] == 0) ^ (v % 2 == 0)) {
b[i] = 1;
vec.push_back(i);
sum++;
}
}
cout << sum << endl;
for (size_t i = 0; i < vec.size(); i++) {
if (i > 0)
cout << " ";
cout << vec[i];
}
cout << endl;
}
int main() {
// COMinit();
solv();
return 0;
}
| [
"expression.operator.compare.change",
"control_flow.loop.condition.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove"
] | 780,214 | 780,215 | u224756887 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int maxM = 2e5 + 7;
const int maxV = 90010;
const int MOD = 1e9 + 7;
int T;
const int maxN = 2e5 + 8;
const ll INF = 1000000000000000010LL;
const int K = 15;
int n;
int a[maxN];
int b[maxN];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", &a[i]);
}
for (int i = n / 2 + 1; i <= n; i++) {
b[i] = a[i];
}
for (int i = n / 2; i >= 1; i--) {
int x = 2 * i;
int res = 0;
while (x <= n) {
res += a[x];
x += i;
}
res %= 2;
if (res != a[i])
b[i] = 1;
}
vector<int> ans;
for (int i = 1; i <= n; i++) {
if (b[i] == 1)
ans.push_back(i);
}
int s = ans.size();
cout << s << endl;
for (auto x : ans) {
cout << x << endl;
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int maxM = 2e5 + 7;
const int maxV = 90010;
const int MOD = 1e9 + 7;
int T;
const int maxN = 2e5 + 8;
const ll INF = 1000000000000000010LL;
const int K = 15;
int n;
int a[maxN];
int b[maxN];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", &a[i]);
}
for (int i = n / 2 + 1; i <= n; i++) {
b[i] = a[i];
}
for (int i = n / 2; i >= 1; i--) {
int x = 2 * i;
int res = 0;
while (x <= n) {
res += b[x];
x += i;
}
res %= 2;
if (res != a[i])
b[i] = 1;
}
vector<int> ans;
for (int i = 1; i <= n; i++) {
if (b[i] == 1)
ans.push_back(i);
}
int s = ans.size();
cout << s << endl;
for (auto x : ans) {
cout << x << endl;
}
return 0;
}
| [
"assignment.value.change",
"identifier.change"
] | 780,218 | 780,219 | u807919574 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
ll a[200001];
for (int i = 1; i <= N; i++)
cin >> a[i];
ll b[200001] = {}, sum, count = 0;
for (int i = N; i >= 1; i--) {
sum = 0;
for (int j = i; j <= N; j += i) {
sum += b[i];
}
if (sum % 2 != a[i])
b[i]++;
}
for (int i = 1; i <= N; i++) {
b[i] = b[i] % 2;
if (b[i] % 2 == 1)
count++;
}
cout << count << endl;
for (int i = 1; i <= N; i++) {
if (b[i] % 2 == 1)
cout << i << ' ';
}
cout << endl;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
ll a[200001];
for (int i = 1; i <= N; i++)
cin >> a[i];
ll b[200001] = {}, sum, count = 0;
for (int i = N; i >= 1; i--) {
sum = 0;
for (int j = i; j <= N; j += i) {
sum += b[j];
}
if (sum % 2 != a[i])
b[i]++;
}
for (int i = 1; i <= N; i++) {
b[i] = b[i] % 2;
if (b[i] == 1)
count++;
}
cout << count << endl;
for (int i = 1; i <= N; i++) {
if (b[i] == 1)
cout << i << ' ';
}
cout << endl;
} | [
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove"
] | 780,220 | 780,221 | u960997735 | cpp |
p02972 | #include <algorithm>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
long long MOD = 1000000007;
int main() {
int N;
cin >> N;
vector<int> a(N + 1, 0);
vector<int> box(N + 1, 0);
for (int i = 0; i < N; i++) {
cin >> a[i + 1];
}
int ans = 0;
for (int i = N; i > 0; i--) {
int sum = 0;
for (int j = 2; i * j <= N; j++) {
sum += a[i * j];
}
if (sum % 2 != a[i]) {
box[i] = 1;
ans++;
}
}
cout << ans << endl;
int flag = 0;
for (int i = 1; i <= N; i++) {
if (box[i]) {
if (flag != 0) {
cout << ' ';
}
cout << i;
flag = 1;
}
}
cout << endl;
} | #include <algorithm>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
long long MOD = 1000000007;
int main() {
int N;
cin >> N;
vector<int> a(N + 1, 0);
vector<int> box(N + 1, 0);
for (int i = 0; i < N; i++) {
cin >> a[i + 1];
}
int ans = 0;
for (int i = N; i > 0; i--) {
int sum = 0;
for (int j = 2; i * j <= N; j++) {
sum += box[i * j];
}
if (sum % 2 != a[i]) {
box[i] = 1;
ans++;
}
}
cout << ans << endl;
int flag = 0;
for (int i = 1; i <= N; i++) {
if (box[i]) {
if (flag != 0) {
cout << ' ';
}
cout << i;
flag = 1;
}
}
cout << endl;
} | [
"assignment.value.change",
"identifier.change"
] | 780,222 | 780,223 | u658993896 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
int main() {
int n, A[200000], num[200001] = {0};
cin >> n;
rep(i, n) cin >> A[i];
vector<int> B;
for (int i = n; i > 0; i--) {
if (num[i] % 2 != A[i - 1]) {
B.push_back(i);
int p = i;
for (int j = 2; j <= sqrt(p); j++)
if (p % j == 0) {
if (j != p / j)
num[j]++, num[p / j]++;
else
num[j]++;
}
}
}
cout << B.size() << endl;
rep(i, B.size()) cout << B[i] << " ";
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
int main() {
int n, A[200000], num[200001] = {0};
cin >> n;
rep(i, n) cin >> A[i];
vector<int> B;
for (int i = n; i > 0; i--) {
if (num[i] % 2 != A[i - 1]) {
B.push_back(i);
int p = i;
for (int j = 1; j <= sqrt(p); j++)
if (p % j == 0) {
if (j != p / j)
num[j]++, num[p / j]++;
else
num[j]++;
}
}
}
cout << B.size() << endl;
rep(i, B.size()) cout << B[i] << " ";
} | [
"literal.number.change",
"variable_declaration.value.change",
"control_flow.loop.for.initializer.change",
"expression.off_by_one"
] | 780,226 | 780,227 | u441296840 | cpp |
p02972 | #include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define endl '\n'
#define eb emplace_back
#define fst first
#define scd second
constexpr int mod = 1000000007;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
// value
int N;
int a[200020];
int ans[200020];
int divisor[200020];
void calc(int n) {
for (int i = 1; i < int(sqrt(n)) + 1; i++) {
if (n % i == 0) {
divisor[i]++;
if (i != n / i)
divisor[n / i]++;
}
}
}
void solve() {
cin >> N;
for (int i = 1; i <= N; i++) {
cin >> a[i];
}
int cnt = 0;
for (int i = N; i >= 1; i--) {
if (divisor[i] % 2 != a[i]) {
ans[i] = 1;
cnt++;
calc(i);
}
}
cout << cnt << endl;
for (int i = 1; i <= N; i++) {
if (ans[i] == 1)
cout << 1 << endl;
}
return;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
solve();
return 0;
}
| #include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define endl '\n'
#define eb emplace_back
#define fst first
#define scd second
constexpr int mod = 1000000007;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
// value
int N;
int a[200020];
int ans[200020];
int divisor[200020];
void calc(int n) {
for (int i = 1; i < int(sqrt(n)) + 1; i++) {
if (n % i == 0) {
divisor[i]++;
if (i != n / i)
divisor[n / i]++;
}
}
}
void solve() {
cin >> N;
for (int i = 1; i <= N; i++) {
cin >> a[i];
}
int cnt = 0;
for (int i = N; i >= 1; i--) {
if (divisor[i] % 2 != a[i]) {
ans[i] = 1;
cnt++;
calc(i);
}
}
cout << cnt << endl;
for (int i = 1; i <= N; i++) {
if (ans[i] == 1)
cout << i << endl;
}
return;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
solve();
return 0;
}
| [
"identifier.replace.add",
"literal.replace.remove",
"io.output.change"
] | 780,230 | 780,231 | u381714561 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define ld long double
#define vec vector<ll>
#define ms multiset<ll>
#define f(i, x, n) for (int i = x; i < n; i++)
#define int long long
#define mod 998244353
#define endl "\n"
void fastio() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
int32_t main() {
fastio();
int n;
cin >> n;
int a[n + 1];
f(i, 1, n + 1) cin >> a[i];
int an[n + 1];
memset(an, 0, sizeof(an));
for (int i = n; i > n / 2; i--) {
if (a[i] == 1)
an[i] = 1;
}
for (int i = n / 2; i >= 1; i--) {
int tp = 0;
for (int j = 2 * i; j <= n; j += i) {
if (an[j] == 1)
tp++;
}
if (tp % 2 != a[i])
an[i] = 1;
}
f(i, 1, n + 1) {
int tp = 0;
for (int j = i; j <= n; j += i) {
tp += an[j];
}
if (tp % 2 != a[i]) {
cout << -1;
return 0;
}
}
int ct = 0;
f(i, 1, n + 1) {
if (an[i] == 1)
ct++;
}
cout << ct << endl;
f(i, 1, n + 1) {
if (an[i] == 1)
cout << a[i] << " ";
}
} | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define ld long double
#define vec vector<ll>
#define ms multiset<ll>
#define f(i, x, n) for (int i = x; i < n; i++)
#define int long long
#define mod 998244353
#define endl "\n"
void fastio() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
int32_t main() {
fastio();
int n;
cin >> n;
int a[n + 1];
f(i, 1, n + 1) cin >> a[i];
int an[n + 1];
memset(an, 0, sizeof(an));
for (int i = n; i > n / 2; i--) {
if (a[i] == 1)
an[i] = 1;
}
for (int i = n / 2; i >= 1; i--) {
int tp = 0;
for (int j = 2 * i; j <= n; j += i) {
if (an[j] == 1)
tp++;
}
if (tp % 2 != a[i])
an[i] = 1;
}
f(i, 1, n + 1) {
int tp = 0;
for (int j = i; j <= n; j += i) {
tp += an[j];
}
if (tp % 2 != a[i]) {
cout << -1;
return 0;
}
}
int ct = 0;
f(i, 1, n + 1) {
if (an[i] == 1)
ct++;
}
cout << ct << endl;
f(i, 1, n + 1) {
if (an[i] == 1)
cout << i << " ";
}
} | [] | 780,232 | 780,233 | u966690395 | cpp |
p02972 | #include <bits/stdc++.h>
#ifdef DEBUG
#define PRINT(x) \
cout << "func " << __func__ << ": line " << __LINE__ << ": " << #x << " = " \
<< (x) << endl;
#define PRINTA(a, first, last) \
cout << "func " << __func__ << ": line " << __LINE__ << ": " << #a << "[" \
<< (first) << ", " << (last) << ")" << endl; \
for (int i = (first); i < (last); ++i) { \
cout << #a << "[" << i << "] = " << (a)[i] << endl; \
}
#define PRINTP(p) \
cout << "func " << __func__ << ": line " << __LINE__ << ": " << #p << " = (" \
<< (p.first) << ", " << (p.second) << ")" << endl;
#define PRINTI(a, i) \
cout << "func " << __func__ << ": line " << __LINE__ << ": " << #a << "[" \
<< #i << "] = " << #a << "[" << (i) << "] = " << (a)[i] << endl;
#else
#define PRINT(x)
#define PRINTA(a, first, last)
#define PRINTP(p)
#define PRINTI(a, i)
#endif
#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 RREP(i, n) for (int i = (n)-1; i >= 0; --i)
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(), (a).end()
#define MOD 1000000007
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
template <class T, class U> void amax(T &x, U y) {
if (x < y)
x = y;
}
template <class T, class U> void amin(T &x, U y) {
if (x > y)
x = y;
}
const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int N;
cin >> N;
vector<int> a(N + 1);
FOR(i, 1, N + 1) cin >> a[i];
vector<int> x(N);
vector<int> b;
RFOR(i, 1, N + 1) {
int s = 0;
for (int j = 2 * i; j <= N; j += i) {
s += x[i];
}
x[i] = (a[i] + s) % 2;
if (x[i]) {
b.push_back(i);
}
}
int M = b.size();
cout << M << endl;
REP(i, M) { cout << b[i] << (i == M - 1 ? '\n' : ' '); }
cout << flush;
return 0;
}
| #include <bits/stdc++.h>
#ifdef DEBUG
#define PRINT(x) \
cout << "func " << __func__ << ": line " << __LINE__ << ": " << #x << " = " \
<< (x) << endl;
#define PRINTA(a, first, last) \
cout << "func " << __func__ << ": line " << __LINE__ << ": " << #a << "[" \
<< (first) << ", " << (last) << ")" << endl; \
for (int i = (first); i < (last); ++i) { \
cout << #a << "[" << i << "] = " << (a)[i] << endl; \
}
#define PRINTP(p) \
cout << "func " << __func__ << ": line " << __LINE__ << ": " << #p << " = (" \
<< (p.first) << ", " << (p.second) << ")" << endl;
#define PRINTI(a, i) \
cout << "func " << __func__ << ": line " << __LINE__ << ": " << #a << "[" \
<< #i << "] = " << #a << "[" << (i) << "] = " << (a)[i] << endl;
#else
#define PRINT(x)
#define PRINTA(a, first, last)
#define PRINTP(p)
#define PRINTI(a, i)
#endif
#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 RREP(i, n) for (int i = (n)-1; i >= 0; --i)
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(), (a).end()
#define MOD 1000000007
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
template <class T, class U> void amax(T &x, U y) {
if (x < y)
x = y;
}
template <class T, class U> void amin(T &x, U y) {
if (x > y)
x = y;
}
const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int N;
cin >> N;
vector<int> a(N + 1);
FOR(i, 1, N + 1) cin >> a[i];
vector<int> x(N + 1);
vector<int> b;
RFOR(i, 1, N + 1) {
int s = 0;
for (int j = 2 * i; j <= N; j += i) {
s += x[j];
}
x[i] = (a[i] + s) % 2;
if (x[i]) {
b.push_back(i);
}
}
int M = b.size();
cout << M << endl;
REP(i, M) { cout << b[i] << (i == M - 1 ? '\n' : ' '); }
cout << flush;
return 0;
}
| [
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change"
] | 780,234 | 780,235 | u537859408 | cpp |
p02972 | #include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define INF (1e9)
int N;
int main() {
cin >> N;
vi A(N);
for (int i = 0; i < N; i++) {
cin >> A[i];
}
int M = 0;
vi B(N, 0);
for (int i = N - 1; i >= 0; i--) {
int sum = 0;
for (int j = i; j < N; j += (i + 1))
sum += B[j];
if (sum % 2 != A[i]) {
M++;
B[i] = 1;
}
}
cout << M << endl;
for (int i = 0; i < N; i++) {
if (B[i] == 1)
cout << 1 << ' ';
}
cout << endl;
return 0;
}
| #include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define INF (1e9)
int N;
int main() {
cin >> N;
vi A(N);
for (int i = 0; i < N; i++) {
cin >> A[i];
}
int M = 0;
vi B(N, 0);
for (int i = N - 1; i >= 0; i--) {
int sum = 0;
for (int j = i; j < N; j += (i + 1))
sum += B[j];
if (sum % 2 != A[i]) {
M++;
B[i] = 1;
}
}
cout << M << endl;
for (int i = 0; i < N; i++) {
if (B[i] == 1)
cout << i + 1 << ' ';
}
cout << endl;
return 0;
}
| [
"expression.operation.binary.add"
] | 780,239 | 780,240 | u551373727 | cpp |
p02972 | #include <algorithm>
#include <bitset>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iso646.h>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<long long> vll;
typedef pair<long long, long long> pll;
const double INF = 1e16;
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
ll const MAX_N = 1e5 + 10;
bool done[MAX_N];
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
int main() {
ll i, j;
ll N;
cin >> N;
vll A(N);
for (auto &e : A)
cin >> e;
vll B(N, 0);
for (i = N; i > 0; i--) {
if (N / i == 1) {
B[i - 1] = A[i - 1];
} else {
ll sum = 0;
for (j = 2; i * j <= N; j++) {
sum += A[i * j - 1];
}
if (sum % 2 == 0) {
B[i - 1] = A[i - 1];
} else {
B[i - 1] = 1 - A[i - 1];
}
}
}
cout << accumulate(B.begin(), B.end(), 0LL) << endl;
for (i = 1; i <= N; i++) {
if (B[i - 1] == 1) {
cout << i << " ";
}
}
return 0;
}
| #include <algorithm>
#include <bitset>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iso646.h>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<long long> vll;
typedef pair<long long, long long> pll;
const double INF = 1e16;
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
ll const MAX_N = 1e5 + 10;
bool done[MAX_N];
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
int main() {
ll i, j;
ll N;
cin >> N;
vll A(N);
for (auto &e : A)
cin >> e;
vll B(N, 0);
for (i = N; i > 0; i--) {
if (N / i == 1) {
B[i - 1] = A[i - 1];
} else {
ll sum = 0;
for (j = 2; i * j <= N; j++) {
sum += B[i * j - 1];
}
if (sum % 2 == 0) {
B[i - 1] = A[i - 1];
} else {
B[i - 1] = 1 - A[i - 1];
}
}
}
cout << accumulate(B.begin(), B.end(), 0LL) << endl;
for (i = 1; i <= N; i++) {
if (B[i - 1] == 1) {
cout << i << " ";
}
}
return 0;
}
| [
"assignment.value.change",
"identifier.change"
] | 780,241 | 780,242 | u455505352 | cpp |
p02972 | #include <algorithm>
#include <iostream>
int main() {
int a[200001], b[200001], result[200001];
long long int N, count = 0, M = 0;
std::cin >> N;
for (int i = 1; i <= N; i++)
std::cin >> a[i];
for (int i = N; i > 0; i--) {
count = 0;
for (int j = i; j < N; j = j + i) {
count += b[j];
}
if (a[i] != count % 2) {
b[i] = 1;
result[M] = i;
M++;
} else
b[i] = 0;
}
std::cout << M << std::endl;
for (int i = 0; i < M; i++) {
std::cout << result[i] << ' ';
}
std::cout << std::endl;
return 0;
}
| #include <algorithm>
#include <iostream>
int main() {
int a[200001], b[200001], result[200001];
long long int N, count = 0, M = 0;
std::cin >> N;
for (int i = 1; i <= N; i++)
std::cin >> a[i];
for (int i = N; i > 0; i--) {
count = 0;
for (int j = i; j <= N; j = j + i) {
count += b[j];
}
if (a[i] != count % 2) {
b[i] = 1;
result[M] = i;
M++;
} else
b[i] = 0;
}
std::cout << M << std::endl;
for (int i = 0; i < M; i++) {
std::cout << result[i] << ' ';
}
std::cout << std::endl;
return 0;
}
| [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 780,247 | 780,248 | u451529323 | cpp |
p02972 | #include <algorithm>
#include <iostream>
int main() {
int a[200001], b[200001], result[200001];
long long int N, count = 0, M = 0;
std::cin >> N;
for (int i = 1; i <= N; i++)
std::cin >> a[i];
for (int i = N; i > 0; i--) {
for (int j = i; j < N; j = j + i) {
count += b[j];
}
if (a[i] != count % 2) {
b[i] = 1;
result[M] = i;
M++;
} else
b[i] = 0;
}
std::cout << M << std::endl;
for (int i = 0; i < M; i++) {
std::cout << result[i] << ' ';
}
std::cout << std::endl;
return 0;
}
| #include <algorithm>
#include <iostream>
int main() {
int a[200001], b[200001], result[200001];
long long int N, count = 0, M = 0;
std::cin >> N;
for (int i = 1; i <= N; i++)
std::cin >> a[i];
for (int i = N; i > 0; i--) {
count = 0;
for (int j = i; j <= N; j = j + i) {
count += b[j];
}
if (a[i] != count % 2) {
b[i] = 1;
result[M] = i;
M++;
} else
b[i] = 0;
}
std::cout << M << std::endl;
for (int i = 0; i < M; i++) {
std::cout << result[i] << ' ';
}
std::cout << std::endl;
return 0;
}
| [
"assignment.add",
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 780,249 | 780,248 | u451529323 | cpp |
p02972 | #include <algorithm>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX(a, b) (((a) < (b)) ? (b) : (a))
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pint;
const ll inf = (1LL << 60);
const ll mod = 1000000007;
ll max(ll a, ll b) {
if (a < b)
return b;
else
return a;
}
ll min(ll a, ll b) {
if (a < b)
return a;
else
return b;
}
int main() {
ll N;
cin >> N;
vector<ll> a(N), b(N);
rep(i, N) { cin >> a[i]; }
ll M = 0;
for (int i = N; i >= 1; i--) {
ll k = 2, sum = 0;
while (k * i <= N) {
sum += a[k * i - 1];
k++;
}
if (sum % 2 == a[i - 1]) {
b[i - 1] = 0;
} else if (sum % 2 != a[i - 1]) {
b[i - 1] = 1;
M += 1;
}
}
cout << M << endl;
rep(i, N) {
if (b[i] == 1) {
cout << i + 1 << " ";
}
}
return 0;
} | #include <algorithm>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX(a, b) (((a) < (b)) ? (b) : (a))
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pint;
const ll inf = (1LL << 60);
const ll mod = 1000000007;
ll max(ll a, ll b) {
if (a < b)
return b;
else
return a;
}
ll min(ll a, ll b) {
if (a < b)
return a;
else
return b;
}
int main() {
ll N;
cin >> N;
vector<ll> a(N), b(N);
rep(i, N) { cin >> a[i]; }
ll M = 0;
for (int i = N; i >= 1; i--) {
ll k = 2, sum = 0;
while (k * i <= N) {
sum += b[k * i - 1];
k++;
}
if (sum % 2 == a[i - 1]) {
b[i - 1] = 0;
} else if (sum % 2 != a[i - 1]) {
b[i - 1] = 1;
M += 1;
}
}
cout << M << endl;
rep(i, N) {
if (b[i] == 1) {
cout << i + 1 << " ";
}
}
return 0;
} | [
"assignment.value.change",
"identifier.change"
] | 780,250 | 780,251 | u305138467 | cpp |
p02972 | #include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << '\n';
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = (int)1e9;
int main(void) {
int N;
cin >> N;
vector<int> a(N);
for (int i = 0; i < N; i++) {
cin >> a[i];
}
// debug(1);
vector<bool> used(N, false);
for (int i = N; i >= 1; i--) {
int sum = 0;
for (int j = i; j < N; j += i) {
// printf("i, j = %d, %d\n", i, j);
if (used[j - 1])
sum ^= 1;
}
if (sum != a[i - 1])
used[i - 1] = true;
}
// debug(2);
int M = 0;
for (int i = 0; i < N; i++) {
if (used[i])
M++;
}
cout << M << '\n';
for (int i = 0; i < N; i++) {
if (used[i])
cout << i + 1 << '\n';
}
return 0;
} | #include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << '\n';
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = (int)1e9;
int main(void) {
int N;
cin >> N;
vector<int> a(N);
for (int i = 0; i < N; i++) {
cin >> a[i];
}
vector<bool> used(N, false);
for (int i = N; i >= 1; i--) {
int sum = 0;
for (int j = i; j <= N; j += i) {
// printf("i, j = %d, %d\n", i, j);
if (used[j - 1])
sum ^= 1;
}
if (sum != a[i - 1])
used[i - 1] = true;
}
int M = 0;
for (int i = 0; i < N; i++) {
if (used[i])
M++;
}
cout << M << '\n';
for (int i = 0; i < N; i++) {
if (used[i])
cout << i + 1 << '\n';
}
return 0;
} | [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 780,254 | 780,255 | u660834360 | cpp |
p02972 | #include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (ll(i) = 0; (i) < (n); (i)++)
#define repf(i, m, n) for (ll(i) = m; (i) < n; (i)++)
#define all(v) (v).begin(), (v).end()
#define ll long long
#define vec(name, num) vector<ll> name((num), 0);
#define op(i) cout << (i) << endl;
#define opf(i) cout << fixed << setprecision(10) << (i) << endl;
#define ip(i) cin >> (i);
#define opN cout << "No" << endl;
#define opY cout << "Yes" << endl;
#define opP cout << "Possible" << endl;
#define opI cout << "Impossible" << endl;
#define mat(name, fnum, snum) \
; \
vector<vector<ll>> name((fnum), vector<ll>((snum), 0));
#define matC(name, fnum, snum) \
; \
vector<vector<char>> name((fnum), vector<char>((snum), 0));
#define debugP \
int debug_point; \
cin >> debug_point;
#define FI first
#define SE second
const ll MOD = 1e9 + 7;
////const long long MOD = 2;
//
void solve(long long N, std::vector<long long> a) {
vec(b, N);
ll M = 0;
for (ll i = N - 1; i >= 0; i--) {
ll tmp = 0;
for (ll j = 2;; j++) {
if (j * (i + 1) <= N) {
tmp += b[(j * (i + 1) - 1)];
} else
break;
}
b[i] = (tmp % 2) ^ a[i];
if (b[i] == 1)
M++;
}
op(M);
rep(i, N) {
if (b[i] == 1)
op(b[i])
}
}
// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools (tips: You
// use the default template now. You can remove this line by using your custom
// template)
int main() {
long long N;
scanf("%lld", &N);
std::vector<long long> a(N);
for (int i = 0; i < N; i++) {
scanf("%lld", &a[i]);
}
solve(N, std::move(a));
return 0;
}
| #include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (ll(i) = 0; (i) < (n); (i)++)
#define repf(i, m, n) for (ll(i) = m; (i) < n; (i)++)
#define all(v) (v).begin(), (v).end()
#define ll long long
#define vec(name, num) vector<ll> name((num), 0);
#define op(i) cout << (i) << endl;
#define opf(i) cout << fixed << setprecision(10) << (i) << endl;
#define ip(i) cin >> (i);
#define opN cout << "No" << endl;
#define opY cout << "Yes" << endl;
#define opP cout << "Possible" << endl;
#define opI cout << "Impossible" << endl;
#define mat(name, fnum, snum) \
; \
vector<vector<ll>> name((fnum), vector<ll>((snum), 0));
#define matC(name, fnum, snum) \
; \
vector<vector<char>> name((fnum), vector<char>((snum), 0));
#define debugP \
int debug_point; \
cin >> debug_point;
#define FI first
#define SE second
const ll MOD = 1e9 + 7;
////const long long MOD = 2;
//
void solve(long long N, std::vector<long long> a) {
vec(b, N);
ll M = 0;
for (ll i = N - 1; i >= 0; i--) {
ll tmp = 0;
for (ll j = 2;; j++) {
if (j * (i + 1) <= N) {
tmp += b[(j * (i + 1) - 1)];
} else
break;
}
b[i] = (tmp % 2) ^ a[i];
if (b[i] == 1)
M++;
}
op(M);
rep(i, N) {
if (b[i] == 1)
op(i + 1)
}
}
// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools (tips: You
// use the default template now. You can remove this line by using your custom
// template)
int main() {
long long N;
scanf("%lld", &N);
std::vector<long long> a(N);
for (int i = 0; i < N; i++) {
scanf("%lld", &a[i]);
}
solve(N, std::move(a));
return 0;
}
| [
"call.arguments.change"
] | 780,269 | 780,270 | u190234543 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
int main() {
int N;
cin >> N;
vector<int> a(N + 1);
a.at(0) == 0;
for (int i = 0; i < N; i++)
cin >> a.at(i + 1);
vector<int> b(N + 1, 0);
int count = 0;
for (int i = N; i >= 1; i--) {
int now = 0;
for (int j = 2;; j++) {
if (i * j < N)
now += b.at(i * j);
else
break;
}
if ((now + a.at(i)) % 2 == 1) {
b.at(i) = 1;
count++;
} else
b.at(i) = 0;
}
cout << count << endl;
for (int i = 1; i <= N; i++) {
if (b.at(i) == 1)
cout << i << " ";
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
int main() {
int N;
cin >> N;
vector<int> a(N + 1);
a.at(0) == 0;
for (int i = 0; i < N; i++)
cin >> a.at(i + 1);
vector<int> b(N + 1, 0);
int count = 0;
for (int i = N; i >= 1; i--) {
int now = 0;
for (int j = 2;; j++) {
if (i * j <= N)
now += b.at(i * j);
else
break;
}
if ((now + a.at(i)) % 2 == 1) {
b.at(i) = 1;
count++;
} else
b.at(i) = 0;
}
cout << count << endl;
for (int i = 1; i <= N; i++) {
if (b.at(i) == 1)
cout << i << " ";
}
return 0;
}
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 780,271 | 780,272 | u618649215 | cpp |
p02972 | #include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
int main() {
int N;
cin >> N;
vector<int> a(N + 1);
a.at(0) == 0;
for (int i = 0; i < N; i++)
cin >> a.at(i + 1);
vector<int> b(N + 1, 0);
int count = 0;
for (int i = N; i >= 1; i--) {
int now = 0;
for (int j = 2;; j++) {
if (i * j < N)
now += b.at(i * j);
else
break;
}
if ((now + a.at(i)) % 2 == 1) {
b.at(i) = 1;
count++;
} else
b.at(i) = 0;
}
cout << count << endl;
for (int i = 0; i < N; i++) {
if (b.at(i) == 1)
cout << i << " ";
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
int main() {
int N;
cin >> N;
vector<int> a(N + 1);
a.at(0) == 0;
for (int i = 0; i < N; i++)
cin >> a.at(i + 1);
vector<int> b(N + 1, 0);
int count = 0;
for (int i = N; i >= 1; i--) {
int now = 0;
for (int j = 2;; j++) {
if (i * j <= N)
now += b.at(i * j);
else
break;
}
if ((now + a.at(i)) % 2 == 1) {
b.at(i) = 1;
count++;
} else
b.at(i) = 0;
}
cout << count << endl;
for (int i = 1; i <= N; i++) {
if (b.at(i) == 1)
cout << i << " ";
}
return 0;
}
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"literal.number.change",
"variable_declaration.value.change",
"control_flow.loop.for.initializer.change",
"expression.off_by_one",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change"
] | 780,273 | 780,272 | u618649215 | cpp |
p02973 | #include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define N 100000
typedef long long ll;
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) int(x.size())
#define OUT(a) cout << (a) << endl
#define VECIN(type, c, n) \
vector<type> c(n); \
for (auto &i : c) \
cin >> i;
int main() {
int n;
cin >> n;
vector<int> a(n);
REP(i, n) { cin >> a[i]; }
vector<int> b;
b.push_back(a[n - 1]);
for (int i = n - 2; i >= 0; i--) {
if (a[i] >= b[SZ(b) - 1]) {
b.push_back(a[i]);
} else {
auto x = upper_bound(ALL(b), a[i]);
b[b.begin() - x] = a[i];
}
}
OUT(SZ(b));
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define N 100000
typedef long long ll;
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) int(x.size())
#define OUT(a) cout << (a) << endl
#define VECIN(type, c, n) \
vector<type> c(n); \
for (auto &i : c) \
cin >> i;
int main() {
int n;
cin >> n;
vector<int> a(n);
REP(i, n) { cin >> a[i]; }
vector<int> b;
b.push_back(a[n - 1]);
for (int i = n - 2; i >= 0; i--) {
if (a[i] >= b[SZ(b) - 1]) {
b.push_back(a[i]);
} else {
auto x = upper_bound(ALL(b), a[i]);
b[x - b.begin()] = a[i];
}
}
OUT(SZ(b));
return 0;
} | [
"assignment.change",
"expression.operation.binary.remove"
] | 780,276 | 780,277 | u120967809 | cpp |
p02973 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
int main() {
int n;
cin >> n;
int a[100005], b[100005];
rep(i, n) cin >> a[i];
int l = 100000, r = 100001;
b[l] = a[0];
for (int i = 1; i < n; i++) {
int x = upper_bound(b + l, b + r, a[i]) - b;
if (x == l)
l--;
b[x - 1] = a[i];
}
cout << r - l << endl;
return 0;
} | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
int main() {
int n;
cin >> n;
int a[100005], b[100005];
rep(i, n) cin >> a[i];
int l = 100000, r = 100001;
b[l] = a[0];
for (int i = 1; i < n; i++) {
int x = lower_bound(b + l, b + r, a[i]) - b;
if (x == l)
l--;
b[x - 1] = a[i];
}
cout << r - l << endl;
return 0;
} | [
"identifier.change",
"call.function.change",
"expression.operation.binary.change"
] | 780,295 | 780,296 | u620735210 | cpp |
p02973 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, N) for (int i = 0; i < (int)N; i++)
const ll MOD = pow(10, 9) + 7;
const ll LLINF = pow(2, 61) - 1;
const int INF = pow(2, 30) - 1;
const int N_MAX = pow(10, 5) + 10;
int main() {
int N;
cin >> N;
int A[N];
rep(i, N) cin >> A[i];
int now = INF;
vector<int> ml;
for (int i = N - 1; i >= 0; i--) {
if (i == N - 1) {
ml.push_back(A[i]);
continue;
}
if (*(ml.end() - 1) <= A[i]) {
ml.push_back(A[i]);
continue;
}
*(lower_bound(ml.begin(), ml.end(), A[i])) = A[i];
}
// rep(i,ml.size()) cout << ml[i] << " "; cout << endl;
int result = ml.size();
cout << result << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, N) for (int i = 0; i < (int)N; i++)
const ll MOD = pow(10, 9) + 7;
const ll LLINF = pow(2, 61) - 1;
const int INF = pow(2, 30) - 1;
const int N_MAX = pow(10, 5) + 10;
int main() {
int N;
cin >> N;
int A[N];
rep(i, N) cin >> A[i];
int now = INF;
vector<int> ml;
for (int i = N - 1; i >= 0; i--) {
if (i == N - 1) {
ml.push_back(A[i]);
continue;
}
if (*(ml.end() - 1) <= A[i]) {
ml.push_back(A[i]);
continue;
}
*(upper_bound(ml.begin(), ml.end(), A[i])) = A[i];
}
// rep(i,ml.size()) cout << ml[i] << " "; cout << endl;
int result = ml.size();
cout << result << endl;
return 0;
} | [
"assignment.variable.change",
"identifier.change",
"call.function.change"
] | 780,297 | 780,298 | u680707192 | cpp |
p02973 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, a;
multiset<int> s;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a;
s.insert(a);
auto itr = s.lower_bound(a);
if (itr != begin(s))
s.erase(*--itr);
}
cout << s.size() << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, a;
multiset<int> s;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a;
s.insert(a);
auto itr = s.lower_bound(a);
if (itr != begin(s))
s.erase(
--itr); //値指定は一致した値全て消去する。単一要素の削除ならイテレータ指定が良い。
}
cout << s.size() << endl;
} | [
"call.arguments.change"
] | 780,299 | 780,300 | u661308718 | cpp |
p02973 | #include <bits/stdc++.h>
using namespace std;
int n, a, b[100005];
int main() {
scanf("%d", &n);
for (int i = 0; i < n; n++) {
scanf("%d", &a);
a++;
*(lower_bound(b, b + n, a) - 1) = a;
}
printf("%d\n", n - (lower_bound(b, b + n, 1) - b));
} | #include <bits/stdc++.h>
using namespace std;
int n, a, b[100005];
int main() {
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", &a);
a++;
*(lower_bound(b, b + n, a) - 1) = a;
}
printf("%d\n", n - (lower_bound(b, b + n, 1) - b));
} | [
"identifier.change"
] | 780,304 | 780,305 | u309985845 | cpp |
p02973 | #include <bits/stdc++.h>
using Int = long long;
using namespace std;
int main() {
int N;
cin >> N;
vector<Int> v(N);
for (auto &e : v)
cin >> e;
reverse(v.begin(), v.end());
Int ans = 0;
set<Int> S;
for (int i = 0; i < N; ++i) {
auto itr = S.lower_bound(v[i] + 1);
if (itr == S.end()) {
++ans;
} else {
S.erase(itr);
}
S.insert(v[i]);
}
cout << ans << endl;
}
| #include <bits/stdc++.h>
using Int = long long;
using namespace std;
int main() {
int N;
cin >> N;
vector<Int> v(N);
for (auto &e : v)
cin >> e;
reverse(v.begin(), v.end());
Int ans = 0;
multiset<Int> S;
for (int i = 0; i < N; ++i) {
auto itr = S.lower_bound(v[i] + 1);
if (itr == S.end()) {
++ans;
} else {
S.erase(itr);
}
S.insert(v[i]);
}
cout << ans << endl;
}
| [
"variable_declaration.type.change"
] | 780,306 | 780,307 | u318334550 | cpp |
p02973 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[n - 1 - i];
}
vector<int> dp(n, 1e9);
for (int i = 0; i < n; i++) {
int t = distance(dp.begin(), lower_bound(dp.begin(), dp.end(), a[i]));
dp[t] = a[i];
}
cout << distance(dp.begin(), lower_bound(dp.begin(), dp.end(), 1e9)) << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[n - 1 - i];
}
vector<int> dp(n, 2e9);
for (int i = 0; i < n; i++) {
int t = distance(dp.begin(), upper_bound(dp.begin(), dp.end(), a[i]));
dp[t] = a[i];
}
cout << distance(dp.begin(), lower_bound(dp.begin(), dp.end(), 2e9)) << endl;
} | [
"literal.number.change",
"call.arguments.change",
"identifier.change",
"call.function.change",
"io.output.change"
] | 780,314 | 780,313 | u244626757 | cpp |
p02973 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
int min = 1e9 + 1;
int count = 0;
multiset<int, greater<int>> nums;
int a;
cin >> a;
nums.insert(a);
count++;
for (int i = 1; i < N; i++) {
cin >> a;
auto coloredIte = nums.upper_bound(a);
if (coloredIte == nums.end()) {
count++;
} else {
nums.erase(*coloredIte);
}
nums.insert(a);
}
cout << count << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
int min = 1e9 + 1;
int count = 0;
multiset<int, greater<int>> nums;
int a;
cin >> a;
nums.insert(a);
count++;
for (int i = 1; i < N; i++) {
cin >> a;
auto coloredIte = nums.upper_bound(a);
if (coloredIte == nums.end()) {
count++;
} else {
nums.erase(coloredIte);
}
nums.insert(a);
}
cout << count << endl;
return 0;
} | [
"call.arguments.change"
] | 780,317 | 780,318 | u759177660 | cpp |
p02973 | #include <algorithm>
#include <bitset>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
template <class T> using Vvec = vector<vector<T>>;
int main() {
int N;
cin >> N;
vector<int> A(N);
for (int &x : A)
cin >> x;
multiset<int> st;
st.insert(A[0]);
for (int i = 1; i < N; i++) {
auto itr = st.lower_bound(A[i]);
if (itr != st.begin()) {
itr--;
st.erase(itr, ++itr);
}
st.insert(A[i]);
}
cout << st.size() << endl;
} | #include <algorithm>
#include <bitset>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
template <class T> using Vvec = vector<vector<T>>;
int main() {
int N;
cin >> N;
vector<int> A(N);
for (int &x : A)
cin >> x;
multiset<int> st;
st.insert(A[0]);
for (int i = 1; i < N; i++) {
auto itr = st.lower_bound(A[i]);
if (itr != st.begin()) {
itr--;
st.erase(itr);
}
st.insert(A[i]);
}
cout << st.size() << endl;
} | [
"call.arguments.change"
] | 780,319 | 780,320 | u440312135 | cpp |
p02973 | #include <algorithm>
#include <bitset>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
template <class T> using Vvec = vector<vector<T>>;
int main() {
int N;
cin >> N;
vector<int> A(N);
for (int &x : A)
cin >> x;
multiset<int> st;
st.insert(A[0]);
for (int i = 1; i < N; i++) {
auto itr = st.lower_bound(A[i]);
if (itr != st.begin()) {
itr--;
st.erase(*itr);
}
st.insert(A[i]);
}
cout << st.size() << endl;
} | #include <algorithm>
#include <bitset>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
template <class T> using Vvec = vector<vector<T>>;
int main() {
int N;
cin >> N;
vector<int> A(N);
for (int &x : A)
cin >> x;
multiset<int> st;
st.insert(A[0]);
for (int i = 1; i < N; i++) {
auto itr = st.lower_bound(A[i]);
if (itr != st.begin()) {
itr--;
st.erase(itr);
}
st.insert(A[i]);
}
cout << st.size() << endl;
} | [
"call.arguments.change"
] | 780,321 | 780,320 | u440312135 | cpp |
p02973 | #include <algorithm>
#include <iostream>
#include <map>
using namespace std;
typedef long long ll;
int main() {
ll n, cnt = 0;
map<ll, ll> m;
cin >> n;
ll a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = n - 1; i >= 0; i--) {
auto it = m.upper_bound(a[i]);
if (it == m.end()) {
cnt++;
} else {
if ((*it).second == 1)
m.erase(it);
else
(*it).second--;
}
m[a[i]] = 1;
}
cout << cnt << endl;
}
| #include <algorithm>
#include <iostream>
#include <map>
using namespace std;
typedef long long ll;
int main() {
ll n, cnt = 0;
map<ll, ll> m;
cin >> n;
ll a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = n - 1; i >= 0; i--) {
auto it = m.upper_bound(a[i]);
if (it == m.end()) {
cnt++;
} else {
if ((*it).second == 1)
m.erase(it);
else
(*it).second--;
}
m[a[i]]++;
}
cout << cnt << endl;
}
| [] | 780,322 | 780,323 | u352248517 | cpp |
p02973 | #include "bits/stdc++.h"
#define rep(i, n) for (int i = 0; i < n; i++)
#define MX 100005
#define ll long long
#define INF 1000000005
using namespace std;
int main() {
int n, a, col[MX], ans = 0;
cin >> n >> a;
fill(col, col + n, 0);
col[0] = -a;
rep(i, n - 1) {
cin >> a;
*upper_bound(col, col + n, -a) = -a;
}
ans = lower_bound(col, col + n, 0) - col;
cout << ans << endl;
return 0;
} | #include "bits/stdc++.h"
#define rep(i, n) for (int i = 0; i < n; i++)
#define MX 100005
#define ll long long
#define INF 1000000005
using namespace std;
int main() {
int n, a, col[MX], ans = 0;
cin >> n >> a;
fill(col, col + n, 1);
col[0] = -a;
rep(i, n - 1) {
cin >> a;
*upper_bound(col, col + n, -a) = -a;
}
ans = lower_bound(col, col + n, 1) - col;
cout << ans << endl;
return 0;
} | [
"literal.number.change",
"call.arguments.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 780,326 | 780,327 | u445015174 | cpp |
p02973 | #include <bits/stdc++.h>
using namespace std;
vector<int> v;
int n, ans = 0;
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
if (v.empty()) {
v.push_back(x);
++ans;
} else {
if (x <= v[0]) {
v.insert(v.begin(), x);
++ans;
} else {
int tmp = upper_bound(v.begin(), v.end(), x) - v.begin() - 1;
v.erase(v.begin() + tmp);
v.insert(v.begin() + tmp, x);
}
}
}
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
vector<int> v;
int n, ans = 0;
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
if (v.empty()) {
v.push_back(x);
++ans;
} else {
if (x <= v[0]) {
v.insert(v.begin(), x);
++ans;
} else {
int tmp = lower_bound(v.begin(), v.end(), x) - v.begin() - 1;
v.erase(v.begin() + tmp);
v.insert(v.begin() + tmp, x);
}
}
}
cout << ans << endl;
return 0;
} | [
"identifier.change",
"call.function.change",
"expression.operation.binary.change"
] | 780,334 | 780,335 | u701136990 | cpp |
p02973 | #ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <type_traits>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif
#define y0 qvya13579
#define y1 qvyb24680
#define j0 qvja13579
#define j1 qvjb24680
#define next qvne13579xt
#define prev qvpr13579ev
#define INF 1000000007
#define MOD 1000000007
#define PI acos(-1.0)
#define endl "\n"
#define IOS \
cin.tie(0); \
ios::sync_with_stdio(false)
#define M_P make_pair
#define PU_B push_back
#define PU_F push_front
#define PO_B pop_back
#define PO_F pop_front
#define U_B upper_bound
#define L_B lower_bound
#define B_S binary_search
#define PR_Q priority_queue
#define FIR first
#define SEC second
#if __cplusplus < 201103L
#define stoi(argument_string) atoi((argument_string).c_str())
#endif
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP_R(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define FOR(i, m, n) for (int i = ((int)(m)); i < (int)(n); ++i)
#define FOR_R(i, m, n) for (int i = ((int)(m)-1); i >= (int)(n); --i)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define SIZ(x) ((int)(x).size())
#define CIN(x) cin >> (x)
#define CIN2(x, y) cin >> (x) >> (y)
#define CIN3(x, y, z) cin >> (x) >> (y) >> (z)
#define CIN4(x, y, z, w) cin >> (x) >> (y) >> (z) >> (w)
#define CIN5(x, y, z, w, u) cin >> (x) >> (y) >> (z) >> (w) >> (u)
#define SCAND(x) scanf("%d", &(x))
#define SCAND2(x, y) scanf("%d%d", &(x), &(y))
#define SCAND3(x, y, z) scanf("%d%d%d", &(x), &(y), &(z))
#define SCAND4(x, y, z, w) scanf("%d%d%d%d", &(x), &(y), &(z), &(w))
#define SCAND5(x, y, z, w, u) scanf("%d%d%d%d%d", &(x), &(y), &(z), &(w), &(u))
#define SCANLLD(x) scanf("%lld", &(x))
#define SCANLLD2(x, y) scanf("%lld%lld", &(x), &(y))
#define SCANLLD3(x, y, z) scanf("%lld%lld%lld", &(x), &(y), &(z))
#define SCANLLD4(x, y, z, w) scanf("%lld%lld%lld%lld", &(x), &(y), &(z), &(w))
#define SCANLLD5(x, y, z, w, u) \
scanf("%lld%lld%lld%lld%lld", &(x), &(y), &(z), &(w), &(u))
#define PRINTD(x) printf("%d\n", (x))
#define PRINTLLD(x) printf("%lld\n", (x))
#define DEBUG(argument) cerr << (#argument) << " : " << (argument) << "\n"
typedef long long int lli;
using namespace std;
bool compare_by_2nd(pair<int, int> a, pair<int, int> b) {
if (a.second != b.second) {
return a.second < b.second;
} else {
return a.first < b.first;
}
}
int ctoi(char c) {
if (c >= '0' and c <= '9') {
return (int)(c - '0');
}
return -1;
}
int alphabet_pos(char c) {
if (c >= 'a' and c <= 'z') {
return (int)(c - 'a');
}
return -1;
}
int alphabet_pos_capital(char c) {
if (c >= 'A' and c <= 'Z') {
return (int)(c - 'A');
}
return -1;
}
vector<string> split(string str, char ch) {
int first = 0;
int last = str.find_first_of(ch);
if (last == string::npos) {
last = SIZ(str);
}
vector<string> result;
while (first < SIZ(str)) {
string Ssubstr(str, first, last - first);
result.push_back(Ssubstr);
first = last + 1;
last = str.find_first_of(ch, first);
if (last == string::npos) {
last = SIZ(str);
}
}
return result;
}
int gcd(int a, int b) // assuming a,b >= 1
{
if (a < b) {
return gcd(b, a);
}
if (a % b == 0) {
return b;
}
return gcd(b, a % b);
}
int lcm(int a, int b) // assuming a,b >= 1
{
return a * b / gcd(a, b);
}
lli pow_fast(lli x, lli n_power, lli modulus) {
if (n_power == 0) {
return 1;
}
if (n_power % 2 == 0) {
return pow_fast(x * x % modulus, n_power / 2, modulus);
}
return x * pow_fast(x, n_power - 1, modulus) % modulus;
}
struct CombinationTable {
vector<vector<long long>> val;
CombinationTable(int size)
: val(size + 1, vector<long long>(size + 1)) // constructor
{
for (int i = 0; i <= size; ++i) // note that 0 <= i <= size
{
for (int j = 0; j <= i; ++j) {
if (j == 0 or j == i) {
val[i][j] = 1LL;
} else {
val[i][j] = val[i - 1][j - 1] + val[i - 1][j];
}
}
}
}
};
struct UnionFind // size-based
{
vector<int> parent, treesize;
UnionFind(int size)
: parent(size), treesize(size, 1) // constructor
{
for (int i = 0; i < size; ++i) {
parent[i] = i;
}
}
int root(int x) {
if (parent[x] == x) {
return x;
}
return parent[x] = root(parent[x]);
}
void unite(int x, int y) {
x = root(x);
y = root(y);
if (x == y) {
return;
}
if (treesize[x] < treesize[y]) {
parent[x] = y;
treesize[y] += treesize[x];
} else {
parent[y] = x;
treesize[x] += treesize[y];
}
}
bool sametree(int x, int y) { return root(x) == root(y); }
int gettreesize(int x) { return treesize[root(x)]; }
};
/*------------------ the end of the template -----------------------*/
signed main() {
IOS; /* making cin faster */
int N;
SCAND(N);
vector<int> a(N);
REP(i, N) { SCAND(a[i]); }
vector<int> dp(N, 1);
REP(i, N) { *lower_bound(ALL(dp), -a[i]) = -a[i]; }
PRINTD(lower_bound(ALL(dp), 1) - dp.begin());
}
| #ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <type_traits>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif
#define y0 qvya13579
#define y1 qvyb24680
#define j0 qvja13579
#define j1 qvjb24680
#define next qvne13579xt
#define prev qvpr13579ev
#define INF 1000000007
#define MOD 1000000007
#define PI acos(-1.0)
#define endl "\n"
#define IOS \
cin.tie(0); \
ios::sync_with_stdio(false)
#define M_P make_pair
#define PU_B push_back
#define PU_F push_front
#define PO_B pop_back
#define PO_F pop_front
#define U_B upper_bound
#define L_B lower_bound
#define B_S binary_search
#define PR_Q priority_queue
#define FIR first
#define SEC second
#if __cplusplus < 201103L
#define stoi(argument_string) atoi((argument_string).c_str())
#endif
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP_R(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define FOR(i, m, n) for (int i = ((int)(m)); i < (int)(n); ++i)
#define FOR_R(i, m, n) for (int i = ((int)(m)-1); i >= (int)(n); --i)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define SIZ(x) ((int)(x).size())
#define CIN(x) cin >> (x)
#define CIN2(x, y) cin >> (x) >> (y)
#define CIN3(x, y, z) cin >> (x) >> (y) >> (z)
#define CIN4(x, y, z, w) cin >> (x) >> (y) >> (z) >> (w)
#define CIN5(x, y, z, w, u) cin >> (x) >> (y) >> (z) >> (w) >> (u)
#define SCAND(x) scanf("%d", &(x))
#define SCAND2(x, y) scanf("%d%d", &(x), &(y))
#define SCAND3(x, y, z) scanf("%d%d%d", &(x), &(y), &(z))
#define SCAND4(x, y, z, w) scanf("%d%d%d%d", &(x), &(y), &(z), &(w))
#define SCAND5(x, y, z, w, u) scanf("%d%d%d%d%d", &(x), &(y), &(z), &(w), &(u))
#define SCANLLD(x) scanf("%lld", &(x))
#define SCANLLD2(x, y) scanf("%lld%lld", &(x), &(y))
#define SCANLLD3(x, y, z) scanf("%lld%lld%lld", &(x), &(y), &(z))
#define SCANLLD4(x, y, z, w) scanf("%lld%lld%lld%lld", &(x), &(y), &(z), &(w))
#define SCANLLD5(x, y, z, w, u) \
scanf("%lld%lld%lld%lld%lld", &(x), &(y), &(z), &(w), &(u))
#define PRINTD(x) printf("%d\n", (x))
#define PRINTLLD(x) printf("%lld\n", (x))
#define DEBUG(argument) cerr << (#argument) << " : " << (argument) << "\n"
typedef long long int lli;
using namespace std;
bool compare_by_2nd(pair<int, int> a, pair<int, int> b) {
if (a.second != b.second) {
return a.second < b.second;
} else {
return a.first < b.first;
}
}
int ctoi(char c) {
if (c >= '0' and c <= '9') {
return (int)(c - '0');
}
return -1;
}
int alphabet_pos(char c) {
if (c >= 'a' and c <= 'z') {
return (int)(c - 'a');
}
return -1;
}
int alphabet_pos_capital(char c) {
if (c >= 'A' and c <= 'Z') {
return (int)(c - 'A');
}
return -1;
}
vector<string> split(string str, char ch) {
int first = 0;
int last = str.find_first_of(ch);
if (last == string::npos) {
last = SIZ(str);
}
vector<string> result;
while (first < SIZ(str)) {
string Ssubstr(str, first, last - first);
result.push_back(Ssubstr);
first = last + 1;
last = str.find_first_of(ch, first);
if (last == string::npos) {
last = SIZ(str);
}
}
return result;
}
int gcd(int a, int b) // assuming a,b >= 1
{
if (a < b) {
return gcd(b, a);
}
if (a % b == 0) {
return b;
}
return gcd(b, a % b);
}
int lcm(int a, int b) // assuming a,b >= 1
{
return a * b / gcd(a, b);
}
lli pow_fast(lli x, lli n_power, lli modulus) {
if (n_power == 0) {
return 1;
}
if (n_power % 2 == 0) {
return pow_fast(x * x % modulus, n_power / 2, modulus);
}
return x * pow_fast(x, n_power - 1, modulus) % modulus;
}
struct CombinationTable {
vector<vector<long long>> val;
CombinationTable(int size)
: val(size + 1, vector<long long>(size + 1)) // constructor
{
for (int i = 0; i <= size; ++i) // note that 0 <= i <= size
{
for (int j = 0; j <= i; ++j) {
if (j == 0 or j == i) {
val[i][j] = 1LL;
} else {
val[i][j] = val[i - 1][j - 1] + val[i - 1][j];
}
}
}
}
};
struct UnionFind // size-based
{
vector<int> parent, treesize;
UnionFind(int size)
: parent(size), treesize(size, 1) // constructor
{
for (int i = 0; i < size; ++i) {
parent[i] = i;
}
}
int root(int x) {
if (parent[x] == x) {
return x;
}
return parent[x] = root(parent[x]);
}
void unite(int x, int y) {
x = root(x);
y = root(y);
if (x == y) {
return;
}
if (treesize[x] < treesize[y]) {
parent[x] = y;
treesize[y] += treesize[x];
} else {
parent[y] = x;
treesize[x] += treesize[y];
}
}
bool sametree(int x, int y) { return root(x) == root(y); }
int gettreesize(int x) { return treesize[root(x)]; }
};
/*------------------ the end of the template -----------------------*/
signed main() {
IOS; /* making cin faster */
int N;
SCAND(N);
vector<int> a(N);
REP(i, N) { SCAND(a[i]); }
vector<int> dp(N, 1);
REP(i, N) { *upper_bound(ALL(dp), -a[i]) = -a[i]; }
PRINTD(lower_bound(ALL(dp), 1) - dp.begin());
}
| [
"assignment.variable.change",
"identifier.change",
"call.function.change"
] | 780,343 | 780,344 | u900727536 | cpp |
p02973 | #include <algorithm>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
#define int long long
#define All(v) (v).begin(), (v).end()
int dy[4] = {-1, 0, 1, 0};
int dx[4] = {0, 1, 0, -1};
int Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int mod = 1000000007;
const int inf = mod * mod;
const int d5 = 100100;
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
set<int> se;
for (auto v : a) {
if (se.lower_bound(v) != se.begin()) {
se.erase(prev(se.lower_bound(v)));
}
se.insert(v);
}
cout << se.size() << endl;
} | #include <algorithm>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
#define int long long
#define All(v) (v).begin(), (v).end()
int dy[4] = {-1, 0, 1, 0};
int dx[4] = {0, 1, 0, -1};
int Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int mod = 1000000007;
const int inf = mod * mod;
const int d5 = 100100;
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
multiset<int> se;
for (auto v : a) {
if (se.lower_bound(v) != se.begin()) {
se.erase(prev(se.lower_bound(v)));
}
se.insert(v);
}
cout << se.size() << endl;
} | [
"variable_declaration.type.change"
] | 780,350 | 780,351 | u282228874 | cpp |
p02973 | #include <algorithm>
#include <iostream>
#include <vector>
namespace multiset {
class multiset {
private:
std::vector<int> tree;
int MSB;
void add(int i, int x) {
for (; i < tree.size(); i += i & -i) {
tree[i] += x;
}
}
int sum(int i) {
int res = 0;
for (; i > 0; i -= i & -i) {
res += tree[i];
}
return res;
}
int bisect(int w) {
int i = 0;
for (int k = MSB; k > 0; k /= 2) {
if (i + k < tree.size() && tree[i + k] < w) {
w -= tree[i + k];
i += k;
}
}
return i + 1;
}
int get_MSB(int N) {
int i = 1;
while (i < N) {
i *= 2;
}
return i / 2;
}
public:
multiset(int N) : tree(N + 1), MSB(get_MSB(N)) {}
void insert(int x) { add(x, 1); }
void erase(int x) { add(x, -1); }
int lower_bound(int x) {
int s = sum(x);
return (s == 0) ? 0 : bisect(s);
}
size_t size() { return sum(tree.size() - 1); }
};
} // namespace multiset
int main() {
int N;
std::cin >> N;
std::vector<int> A(N);
for (auto &&a : A) {
std::cin >> a;
}
std::vector<int> B = A;
std::sort(begin(B), end(B));
B.erase(std::unique(begin(B), end(B)), end(B));
auto f = [&](int val) -> int {
return std::lower_bound(begin(A), end(A), val) - begin(A) + 1;
};
multiset::multiset ms(B.size());
for (auto a : A) {
auto i = ms.lower_bound(f(a) - 1);
if (i != 0) {
ms.erase(i);
}
ms.insert(f(a));
}
std::cout << ms.size() << '\n';
}
| #include <algorithm>
#include <iostream>
#include <vector>
namespace multiset {
class multiset {
private:
std::vector<int> tree;
int MSB;
void add(int i, int x) {
for (; i < tree.size(); i += i & -i) {
tree[i] += x;
}
}
int sum(int i) {
int res = 0;
for (; i > 0; i -= i & -i) {
res += tree[i];
}
return res;
}
int bisect(int w) {
int i = 0;
for (int k = MSB; k > 0; k /= 2) {
if (i + k < tree.size() && tree[i + k] < w) {
w -= tree[i + k];
i += k;
}
}
return i + 1;
}
int get_MSB(int N) {
int i = 1;
while (i < N) {
i *= 2;
}
return i / 2;
}
public:
multiset(int N) : tree(N + 1), MSB(get_MSB(N)) {}
void insert(int x) { add(x, 1); }
void erase(int x) { add(x, -1); }
int lower_bound(int x) {
int s = sum(x);
return (s == 0) ? 0 : bisect(s);
}
size_t size() { return sum(tree.size() - 1); }
};
} // namespace multiset
int main() {
int N;
std::cin >> N;
std::vector<int> A(N);
for (auto &&a : A) {
std::cin >> a;
}
std::vector<int> B = A;
std::sort(begin(B), end(B));
B.erase(std::unique(begin(B), end(B)), end(B));
auto f = [&](int val) -> int {
return std::lower_bound(begin(B), end(B), val) - begin(B) + 1;
};
multiset::multiset ms(B.size());
for (auto a : A) {
auto i = ms.lower_bound(f(a) - 1);
if (i != 0) {
ms.erase(i);
}
ms.insert(f(a));
}
std::cout << ms.size() << '\n';
}
| [
"identifier.change",
"call.arguments.change",
"function.return_value.change",
"expression.operation.binary.change"
] | 780,371 | 780,372 | u606045429 | cpp |
p02973 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<ll, ll> P;
#define fi first
#define se second
set<string> c;
map<ll, ll> mp;
const ll inf = (1e18);
const ll mod = 1000000007;
const ll mod2 = 998244353;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll c, ll d) { return c / gcd(c, d) * d; }
ll dp[10005];
int main() {
int n;
cin >> n;
vector<ll> a(n);
for (int i = 0; i < n; i++)
cin >> a.at(i);
fill(dp, dp + n, inf);
for (int i = n - 1; i >= 0; i--) {
*lower_bound(dp, dp + n, a.at(i)) = a.at(i);
}
cout << lower_bound(dp, dp + n, inf) - dp << endl;
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<ll, ll> P;
#define fi first
#define se second
set<string> c;
map<ll, ll> mp;
const ll inf = (1e18);
const ll mod = 1000000007;
const ll mod2 = 998244353;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll c, ll d) { return c / gcd(c, d) * d; }
ll dp[100005];
int main() {
int n;
cin >> n;
vector<ll> a(n);
for (int i = 0; i < n; i++)
cin >> a.at(i);
fill(dp, dp + n, inf);
for (int i = n - 1; i >= 0; i--) {
*upper_bound(dp, dp + n, a.at(i)) = a.at(
i); //同じ色にできる奴は入れ替わる => infでないものの数だけ色が必要
}
cout << lower_bound(dp, dp + n, inf) - dp << endl;
}
| [
"literal.number.change",
"variable_declaration.array_dimensions.change",
"assignment.variable.change",
"identifier.change",
"call.function.change"
] | 780,379 | 780,380 | u822169805 | cpp |
p02973 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<ll, ll> P;
#define fi first
#define se second
set<string> c;
map<ll, ll> mp;
const ll inf = (1e18);
const ll mod = 1000000007;
const ll mod2 = 998244353;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll c, ll d) { return c / gcd(c, d) * d; }
ll dp[10005];
int main() {
int n;
cin >> n;
vector<ll> a(n);
for (int i = 0; i < n; i++)
cin >> a.at(i);
fill(dp, dp + n, inf);
for (int i = n - 1; i >= 0; i--) {
*lower_bound(dp, dp + n, a.at(i)) = a.at(i);
}
cout << lower_bound(dp, dp + n, inf) - dp << endl;
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<ll, ll> P;
#define fi first
#define se second
set<string> c;
map<ll, ll> mp;
const ll inf = (1e18);
const ll mod = 1000000007;
const ll mod2 = 998244353;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll c, ll d) { return c / gcd(c, d) * d; }
ll dp[100005];
int main() {
int n;
cin >> n;
vector<ll> a(n);
for (int i = 0; i < n; i++)
cin >> a.at(i);
fill(dp, dp + n, inf);
for (int i = n - 1; i >= 0; i--) {
*upper_bound(dp, dp + n, a.at(i)) = a.at(i);
}
cout << lower_bound(dp, dp + n, inf) - dp << endl;
} | [
"literal.number.change",
"variable_declaration.array_dimensions.change",
"assignment.variable.change",
"identifier.change",
"call.function.change"
] | 780,379 | 780,381 | u822169805 | cpp |
p02973 | #include <algorithm>
#include <cstdio>
#include <iostream>
using namespace std;
int n, len;
int a[100005], f[100005];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]);
f[++len] = a[1];
for (int i = 2; i <= n; i++) {
if (f[len] >= a[i])
f[++len] = a[i];
else {
int l = 1, r = len;
while (l <= r) {
int mid = (l + r) >> 1;
if (f[len] >= a[i])
l = mid + 1;
else
r = mid - 1;
}
f[r] = max(f[r], a[i]);
}
}
printf("%d", len);
return 0;
} | #include <algorithm>
#include <cstdio>
#include <iostream>
using namespace std;
int n, len;
int a[100005], f[100005];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]);
f[++len] = a[1];
for (int i = 2; i <= n; i++) {
if (f[len] >= a[i])
f[++len] = a[i];
else {
int l = 1, r = len;
while (l <= r) {
int mid = (l + r) >> 1;
if (f[mid] >= a[i])
l = mid + 1;
else
r = mid - 1;
}
f[l] = max(f[l], a[i]);
}
}
printf("%d", len);
return 0;
} | [
"identifier.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change",
"assignment.variable.change",
"assignment.value.change",
"call.arguments.change"
] | 780,389 | 780,390 | u307700000 | cpp |
p02973 | #include <algorithm>
#include <cstdio>
#include <iostream>
using namespace std;
int n, len;
int a[100005], f[100005];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]);
f[++len] = a[1];
for (int i = 2; i <= n; i++) {
if (f[len] >= a[i])
f[++len] = a[i];
else {
int l = 1, r = len;
while (l <= r) {
int mid = (l + r) >> 1;
if (f[len] > a[i])
l = mid + 1;
else
r = mid - 1;
}
f[l] = max(f[l], a[i]);
}
}
printf("%d", len);
return 0;
} | #include <algorithm>
#include <cstdio>
#include <iostream>
using namespace std;
int n, len;
int a[100005], f[100005];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]);
f[++len] = a[1];
for (int i = 2; i <= n; i++) {
if (f[len] >= a[i])
f[++len] = a[i];
else {
int l = 1, r = len;
while (l <= r) {
int mid = (l + r) >> 1;
if (f[mid] >= a[i])
l = mid + 1;
else
r = mid - 1;
}
f[l] = max(f[l], a[i]);
}
}
printf("%d", len);
return 0;
} | [
"identifier.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change",
"expression.operator.compare.change"
] | 780,391 | 780,390 | u307700000 | cpp |
p02973 | #include <algorithm>
#include <cstdio>
#include <iostream>
using namespace std;
int n, len;
int a[100005], f[100005];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]);
f[++len] = a[1];
for (int i = 2; i <= n; i++) {
if (f[len] >= a[i])
f[++len] = a[i];
else {
int l = 1, r = len;
while (l <= r) {
int mid = (l + r) >> 1;
if (f[len] >= a[i])
l = mid + 1;
else
r = mid - 1;
}
f[l] = max(f[l], a[i]);
}
}
printf("%d", len);
return 0;
} | #include <algorithm>
#include <cstdio>
#include <iostream>
using namespace std;
int n, len;
int a[100005], f[100005];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]);
f[++len] = a[1];
for (int i = 2; i <= n; i++) {
if (f[len] >= a[i])
f[++len] = a[i];
else {
int l = 1, r = len;
while (l <= r) {
int mid = (l + r) >> 1;
if (f[mid] >= a[i])
l = mid + 1;
else
r = mid - 1;
}
f[l] = max(f[l], a[i]);
}
}
printf("%d", len);
return 0;
} | [
"identifier.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change"
] | 780,392 | 780,390 | u307700000 | cpp |
p02973 | #include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <vector>
using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1111111111;
constexpr lint LINF = 1LL << 60;
template <class T> ostream &operator<<(ostream &os, const vector<T> &vec) {
for (const auto &e : vec)
os << e << (&e == &vec.back() ? "" : " ");
return os;
}
#ifdef _DEBUG
template <class T> void dump(const char *str, T &&h) {
cerr << str << " = " << h << "\n";
};
template <class Head, class... Tail>
void dump(const char *str, Head &&h, Tail &&...t) {
while (*str != ',')
cerr << *str++;
cerr << " = " << h << "\n";
dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else
#define DMP(...) ((void)0)
#endif
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int N;
cin >> N;
vector<int> w(N);
for (int i = 0; i < N; i++)
cin >> w[i];
reverse(w.begin(), w.end());
vector<int> ans(N, INF);
for (int i = 0; i < N; i++)
*lower_bound(ans.begin(), ans.end(), w[i]) = w[i];
cout << lower_bound(ans.begin(), ans.end(), INF) - ans.begin() << "\n";
return 0;
} | #include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <vector>
using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1111111111;
constexpr lint LINF = 1LL << 60;
template <class T> ostream &operator<<(ostream &os, const vector<T> &vec) {
for (const auto &e : vec)
os << e << (&e == &vec.back() ? "" : " ");
return os;
}
#ifdef _DEBUG
template <class T> void dump(const char *str, T &&h) {
cerr << str << " = " << h << "\n";
};
template <class Head, class... Tail>
void dump(const char *str, Head &&h, Tail &&...t) {
while (*str != ',')
cerr << *str++;
cerr << " = " << h << "\n";
dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else
#define DMP(...) ((void)0)
#endif
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int N;
cin >> N;
vector<int> w(N);
for (int i = 0; i < N; i++)
cin >> w[i];
reverse(w.begin(), w.end());
vector<int> ans(N, INF);
for (int i = 0; i < N; i++)
*upper_bound(ans.begin(), ans.end(), w[i]) = w[i];
cout << lower_bound(ans.begin(), ans.end(), INF) - ans.begin() << "\n";
return 0;
} | [
"assignment.variable.change",
"identifier.change",
"call.function.change"
] | 780,393 | 780,394 | u532573979 | cpp |
p02973 | #include <algorithm>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif
const int MOD = 1000000007, INF = 1111111111;
using namespace std;
using lint = long long;
int main() {
int N;
cin >> N;
vector<int> a(N), memo;
for (int i = 0; i < N; i++)
cin >> a[i];
memo.emplace_back(a[0]);
for (int i = 1; i < N; i++) {
if (memo.back() >= a[i])
memo.emplace_back(a[i]);
else
*lower_bound(memo.begin(), memo.end(), a[i], greater<int>()) = a[i];
}
cout << memo.size();
}
| #include <algorithm>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif
const int MOD = 1000000007, INF = 1111111111;
using namespace std;
using lint = long long;
int main() {
int N;
cin >> N;
vector<int> a(N), memo;
for (int i = 0; i < N; i++)
cin >> a[i];
memo.emplace_back(a[0]);
for (int i = 1; i < N; i++) {
if (memo.back() >= a[i])
memo.emplace_back(a[i]);
else
*upper_bound(memo.begin(), memo.end(), a[i], greater<int>()) = a[i];
}
cout << memo.size();
}
| [
"assignment.variable.change",
"identifier.change",
"call.function.change"
] | 780,395 | 780,396 | u532573979 | cpp |
p02973 | #include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int, int> pii;
typedef priority_queue<int, vector<int>, greater<int>> minHeap;
#define ones(x) __builtin_popcount(x)
#define onesl(x) __builtin_popcountl(x)
#define onesll(x) __builtin_popcountll(x)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define scn(n) scanf("%d", &n)
#define scnll(n) scanf("%lld", &n)
#define scn2(n, m) scanf("%d%d", &n, &m)
#define scn3(n, m, w) scanf("%d%d%d", &n, &m, &w)
#define scn2ll(n, m) scanf("%lld%lld", &n, &m)
#define atoz(v) v.begin(), v.end()
#define ratoz(v) v.rbegin(), v.rend()
#define Fill(a, v) memset(a, v, sizeof(a))
#define sz(v) v.size()
#define fi first
#define se second
#define inf 1e9
#define pi acos(-1.0)
#define sqr(x) x *x
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define ten(n) (int)1e##n
#define tenll(n) (lli)1e##n
#define mod 1000000007
#define FastIO \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
int Set(int N, int pos) { return N = N | (1 << pos); }
int reset(int N, int pos) { return N = N & ~(1 << pos); }
bool check(int N, int pos) { return (bool)(N & (1 << pos)); }
inline int addmod(int x, int y) { return (x % mod + y % mod) % mod; }
inline int submod(int x, int y) { return (x % mod - y % mod + mod) % mod; }
inline int mulmod(int x, int y) { return (x % mod * 1LL * y % mod) % mod; }
inline int nextSubMask(int i, int mask) {
return (i - 1) & mask;
} /// returns next smallest submask
void we_r_done() {
cout << "NO";
exit(0);
}
void debug(bool ok, string mssg) {
if (ok)
return;
cout << mssg;
exit(0);
}
int main() {
/// freopen("output.txt","w",stdout);
/// freopen("input.txt","r",stdin);
FastIO;
int n;
cin >> n;
multiset<int> st;
int x;
cin >> x;
st.insert(x);
for (int i = 2; i <= n; i++) {
cin >> x;
auto it = st.upper_bound(x);
if (it == st.begin()) {
st.insert(x);
} else {
it--;
if (*it != x)
st.erase(it);
st.insert(x);
}
}
cout << st.size();
return 0;
}
/// sin and cos expect input in radians not degrees. so use , sin(degrees * pi /
/// 180) using bs = bitset<MX>; // how many distinct number can be form?
| #include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int, int> pii;
typedef priority_queue<int, vector<int>, greater<int>> minHeap;
#define ones(x) __builtin_popcount(x)
#define onesl(x) __builtin_popcountl(x)
#define onesll(x) __builtin_popcountll(x)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define scn(n) scanf("%d", &n)
#define scnll(n) scanf("%lld", &n)
#define scn2(n, m) scanf("%d%d", &n, &m)
#define scn3(n, m, w) scanf("%d%d%d", &n, &m, &w)
#define scn2ll(n, m) scanf("%lld%lld", &n, &m)
#define atoz(v) v.begin(), v.end()
#define ratoz(v) v.rbegin(), v.rend()
#define Fill(a, v) memset(a, v, sizeof(a))
#define sz(v) v.size()
#define fi first
#define se second
#define inf 1e9
#define pi acos(-1.0)
#define sqr(x) x *x
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define ten(n) (int)1e##n
#define tenll(n) (lli)1e##n
#define mod 1000000007
#define FastIO \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
int Set(int N, int pos) { return N = N | (1 << pos); }
int reset(int N, int pos) { return N = N & ~(1 << pos); }
bool check(int N, int pos) { return (bool)(N & (1 << pos)); }
inline int addmod(int x, int y) { return (x % mod + y % mod) % mod; }
inline int submod(int x, int y) { return (x % mod - y % mod + mod) % mod; }
inline int mulmod(int x, int y) { return (x % mod * 1LL * y % mod) % mod; }
inline int nextSubMask(int i, int mask) {
return (i - 1) & mask;
} /// returns next smallest submask
void we_r_done() {
cout << "NO";
exit(0);
}
void debug(bool ok, string mssg) {
if (ok)
return;
cout << mssg;
exit(0);
}
int main() {
/// freopen("output.txt","w",stdout);
/// freopen("input.txt","r",stdin);
FastIO;
int n;
cin >> n;
multiset<int> st;
int x;
cin >> x;
st.insert(x);
for (int i = 2; i <= n; i++) {
cin >> x;
auto it = st.lower_bound(x);
if (it == st.begin()) {
st.insert(x);
} else {
it--;
// cout<<" "<<*it<<endl;
if (*it != x)
st.erase(it);
st.insert(x);
}
}
cout << st.size();
return 0;
}
/// sin and cos expect input in radians not degrees. so use , sin(degrees * pi /
/// 180) using bs = bitset<MX>; // how many distinct number can be form?
| [
"call.function.change"
] | 780,397 | 780,398 | u582464343 | cpp |
p02973 | #include <bits/stdc++.h>
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define IOS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define INTXT \
std::ifstream in("input.txt"); \
std::cin.rdbuf(in.rdbuf());
#define INF 1e9
using namespace std;
typedef long long ll;
static const int MOD = 1000000007LL;
signed main() {
IOS int n;
cin >> n;
vector<int> nums;
int max_val = -1 * INF;
REP(i, n) {
int a;
cin >> a;
a = -a;
if (a >= max_val) {
nums.push_back(a);
max_val = a;
} else {
int idx =
distance(nums.begin(), lower_bound(nums.begin(), nums.end(), a));
nums.at(idx) = a;
max_val = min(nums.at(nums.size() - 1), max_val);
}
// cout << i << " ";
// REP(j, nums.size()){
// cout << " " << nums.at(j);
// }
// cout << endl;
}
cout << nums.size() << endl;
}
| #include <bits/stdc++.h>
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define IOS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define INTXT \
std::ifstream in("input.txt"); \
std::cin.rdbuf(in.rdbuf());
#define INF 1e9
using namespace std;
typedef long long ll;
static const int MOD = 1000000007LL;
signed main() {
IOS int n;
cin >> n;
vector<int> nums;
int max_val = -1 * INF;
REP(i, n) {
int a;
cin >> a;
a = -a;
if (a >= max_val) {
nums.push_back(a);
max_val = a;
} else {
int idx =
distance(nums.begin(), upper_bound(nums.begin(), nums.end(), a));
nums.at(idx) = a;
max_val = min(nums.at(nums.size() - 1), max_val);
}
// cout << i << " ";
// REP(j, nums.size()){
// cout << " " << nums.at(j);
// }
// cout << endl;
}
cout << nums.size() << endl;
}
| [
"identifier.change",
"call.function.change",
"call.arguments.change"
] | 780,402 | 780,403 | u653807637 | cpp |
p02973 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> Vec;
#define REP(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) REP(i, 0, n)
const int INF = 1e9;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define ALL(v) v.begin(), v.end()
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define pb(x) push_back(x)
#define sum(v) accumulate(ALL(v), 0)
template <typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) {
return s << "(" << p.first << ", " << p.second << ")";
}
// vector
template <typename T> ostream &operator<<(ostream &s, const vector<T> &v) {
int len = v.size();
for (int i = 0; i < len; ++i) {
s << v[i];
if (i < len - 1)
s << " ";
}
return s;
}
// 2 dimentional vector
template <typename T>
ostream &operator<<(ostream &s, const vector<vector<T>> &vv) {
int len = vv.size();
for (int i = 0; i < len; ++i) {
s << vv[i] << endl;
}
return s;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
ll n;
cin >> n;
Vec v(n);
vector<ll> w;
ll min = INF;
rep(i, n) {
int tmp;
cin >> tmp;
// dbg(tmp);
if (min >= tmp) {
w.pb(tmp);
min = tmp;
} else {
rep(j, w.size()) {
if (tmp > w[j]) {
w[j] = tmp;
break;
}
if (j == w.size() - 1) {
min = tmp;
}
}
}
// dbg(w);
}
cout << w.size() << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> Vec;
#define REP(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) REP(i, 0, n)
const int INF = 1e9;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define ALL(v) v.begin(), v.end()
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define pb(x) push_back(x)
#define sum(v) accumulate(ALL(v), 0)
template <typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) {
return s << "(" << p.first << ", " << p.second << ")";
}
// vector
template <typename T> ostream &operator<<(ostream &s, const vector<T> &v) {
int len = v.size();
for (int i = 0; i < len; ++i) {
s << v[i];
if (i < len - 1)
s << " ";
}
return s;
}
// 2 dimentional vector
template <typename T>
ostream &operator<<(ostream &s, const vector<vector<T>> &vv) {
int len = vv.size();
for (int i = 0; i < len; ++i) {
s << vv[i] << endl;
}
return s;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
ll n;
cin >> n;
Vec v(n);
vector<ll> w;
ll min = INF;
rep(i, n) {
int tmp;
cin >> tmp;
// dbg(tmp);
if (min >= tmp) {
w.pb(tmp);
min = tmp;
} else {
rep(j, w.size()) {
if (tmp > w[j]) {
w[j] = tmp;
if (j == w.size() - 1) {
min = tmp;
}
break;
}
}
}
// dbg(min);
// dbg(w);
}
cout << w.size() << endl;
return 0;
}
| [
"control_flow.break.add"
] | 780,404 | 780,405 | u592686932 | cpp |
p02973 | // includes {{{
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
// #include<deque>
// #include<multiset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;
int main() {
std::ios::sync_with_stdio(false), std::cin.tie(0);
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
set<int> st;
int ans = 0;
// 証明できます,できるので
for (int i = 0; i < n; i++) {
auto ite = st.lower_bound(a[i]);
if (ite != st.begin()) {
st.erase(*prev(ite));
} else
ans++;
st.insert(a[i]);
}
cout << ans << endl;
return 0;
}
| // includes {{{
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
// #include<deque>
// #include<multiset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;
int main() {
std::ios::sync_with_stdio(false), std::cin.tie(0);
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
multiset<int> st;
int ans = 0;
// 証明できます,できるので
for (int i = 0; i < n; i++) {
auto ite = st.lower_bound(a[i]);
if (ite != st.begin()) {
st.erase(prev(ite));
} else
ans++;
st.insert(a[i]);
}
cout << ans << endl;
return 0;
}
| [
"variable_declaration.type.change",
"call.arguments.change"
] | 780,408 | 780,409 | u884379688 | cpp |
p02973 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;
int main() {
ios::sync_with_stdio(false);
int n, a[100005] = {};
vector<int> b = {0};
cin >> n;
for (int i = 1; i <= n; i++)
cin >> a[i];
reverse(a + 1, a + n + 1);
for (int i = 1; i <= n; i++) {
if (a[i] >= b.back())
b.push_back(a[i]);
else
*lower_bound(b.begin(), b.end(), a[i]) = a[i];
}
cout << (int)b.size() - 1;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;
int main() {
ios::sync_with_stdio(false);
int n, a[100005] = {};
vector<int> b = {0};
cin >> n;
for (int i = 1; i <= n; i++)
cin >> a[i];
reverse(a + 1, a + n + 1);
for (int i = 1; i <= n; i++) {
if (a[i] >= b.back())
b.push_back(a[i]);
else
*upper_bound(b.begin(), b.end(), a[i]) = a[i];
}
cout << (int)b.size() - 1;
}
| [
"assignment.variable.change",
"identifier.change",
"call.function.change"
] | 780,412 | 780,413 | u151855078 | cpp |
p02973 | // 5_abc134_e
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector> // C++
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define SZ(x) ((int)(x).size())
#define INF (1e16)
typedef long long ll;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
vector<int> a(n);
rep(i, n) { cin >> a[i]; }
vector<int> l;
l.push_back(a[n - 1]);
int length = 0;
for (int i = n - 2; i >= 0; i--) {
if (a[i] >= l[length]) {
l.push_back(a[i]);
length++;
} else {
auto j = lower_bound(l.begin(), l.end(), a[i]);
int k = j - l.begin();
l[k] = a[i];
}
}
cout << length + 1 << endl;
return 0;
}
| // 5_abc134_e
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector> // C++
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define SZ(x) ((int)(x).size())
#define INF (1e16)
typedef long long ll;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
vector<int> a(n);
rep(i, n) { cin >> a[i]; }
vector<int> l;
l.push_back(a[n - 1]);
int length = 0;
for (int i = n - 2; i >= 0; i--) {
if (a[i] >= l[length]) {
l.push_back(a[i]);
length++;
} else {
auto j = upper_bound(l.begin(), l.end(), a[i]);
int k = j - l.begin();
l[k] = a[i];
}
}
cout << length + 1 << endl;
return 0;
}
| [
"identifier.change",
"call.function.change"
] | 780,416 | 780,417 | u811561461 | cpp |
p02973 | #include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int N;
cin >> N;
vector<int> maxes;
auto find_greater = [&](int n) {
int l = 0, r = maxes.size() - 1;
int res = r + 1;
while (l < r) {
auto c = (l + r) / 2;
if (n > maxes[c]) {
res = c;
r = c - 1;
} else {
l = c + 1;
}
}
return res;
};
for (int i = 0; i < N; i++) {
int a;
cin >> a;
auto p = find_greater(a);
if (p == maxes.size()) {
maxes.push_back(a);
} else {
maxes[p] = a;
}
}
cout << maxes.size() << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int N;
cin >> N;
vector<int> maxes;
auto find_greater = [&](int n) {
int l = 0, r = maxes.size() - 1;
int res = r + 1;
while (l <= r) {
auto c = (l + r) / 2;
if (n > maxes[c]) {
res = c;
r = c - 1;
} else {
l = c + 1;
}
}
return res;
};
for (int i = 0; i < N; i++) {
int a;
cin >> a;
auto p = find_greater(a);
if (p == maxes.size()) {
maxes.push_back(a);
} else {
maxes[p] = a;
}
}
cout << maxes.size() << endl;
return 0;
}
| [
"expression.operator.compare.change",
"control_flow.loop.condition.change"
] | 780,418 | 780,419 | u500092662 | cpp |
p02973 | #include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int N;
cin >> N;
vector<int> maxes;
auto find_greater = [&](int n) {
int l = 0, r = maxes.size() - 1;
int res = r + 1;
while (l < r) {
auto c = (l + r) / 2;
if (n > maxes[c]) {
res = c;
l = c + 1;
} else {
r = c - 1;
}
}
return res;
};
for (int i = 0; i < N; i++) {
int a;
cin >> a;
auto p = find_greater(a);
if (p == maxes.size()) {
maxes.push_back(a);
} else {
maxes[p] = a;
}
}
cout << maxes.size() << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int N;
cin >> N;
vector<int> maxes;
auto find_greater = [&](int n) {
int l = 0, r = maxes.size() - 1;
int res = r + 1;
while (l <= r) {
auto c = (l + r) / 2;
if (n > maxes[c]) {
res = c;
r = c - 1;
} else {
l = c + 1;
}
}
return res;
};
for (int i = 0; i < N; i++) {
int a;
cin >> a;
auto p = find_greater(a);
if (p == maxes.size()) {
maxes.push_back(a);
} else {
maxes[p] = a;
}
}
cout << maxes.size() << endl;
return 0;
}
| [
"expression.operator.compare.change",
"control_flow.loop.condition.change",
"control_flow.branch.else.add",
"assignment.add"
] | 780,420 | 780,419 | u500092662 | cpp |
p02973 | #include <bits/stdc++.h>
using namespace std;
int A[100005], tree[400005];
map<int, int> M;
void update(int left, int right, int x, int val, int root) {
if (left > x || right < x)
return;
if (left == right) {
tree[root] = val;
return;
}
int mid = (left + right) / 2;
update(left, mid, x, val, root * 2);
update(mid + 1, right, x, val, root * 2 + 1);
tree[root] = max(tree[root * 2], tree[root * 2 + 1]);
}
int query(int left, int right, int L, int R, int root) {
if (left > R || right < L)
return 0;
if (left >= L && right <= R)
return tree[root];
int mid = (left + right) / 2;
return max(query(left, mid, L, R, root * 2),
query(mid + 1, right, L, R, root * 2 + 1));
}
int main() {
ios::sync_with_stdio(0);
cin.tie(NULL), cout.tie(NULL);
int N;
cin >> N;
for (int i = 1; i <= N; i++) {
cin >> A[i];
M[A[i]];
}
int k = 0;
for (auto &it : M)
it.second = ++k;
for (int i = 1; i <= N; i++)
A[i] = M[A[i]];
int ans = 0;
for (int i = 1; i <= N; i++) {
int curr = query(1, k, A[i], k, 1) + 1;
update(1, N, A[i], curr, 1);
ans = max(ans, curr);
}
cout << ans << "\n";
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int A[100005], tree[400005];
map<int, int> M;
void update(int left, int right, int x, int val, int root) {
if (left > x || right < x)
return;
if (left == right) {
tree[root] = val;
return;
}
int mid = (left + right) / 2;
update(left, mid, x, val, root * 2);
update(mid + 1, right, x, val, root * 2 + 1);
tree[root] = max(tree[root * 2], tree[root * 2 + 1]);
}
int query(int left, int right, int L, int R, int root) {
if (left > R || right < L)
return 0;
if (left >= L && right <= R)
return tree[root];
int mid = (left + right) / 2;
return max(query(left, mid, L, R, root * 2),
query(mid + 1, right, L, R, root * 2 + 1));
}
int main() {
ios::sync_with_stdio(0);
cin.tie(NULL), cout.tie(NULL);
int N;
cin >> N;
for (int i = 1; i <= N; i++) {
cin >> A[i];
M[A[i]];
}
int k = 0;
for (auto &it : M)
it.second = ++k;
for (int i = 1; i <= N; i++)
A[i] = M[A[i]];
int ans = 0;
for (int i = 1; i <= N; i++) {
int curr = query(1, k, A[i], k, 1) + 1;
update(1, k, A[i], curr, 1);
ans = max(ans, curr);
}
cout << ans << "\n";
return 0;
}
| [
"identifier.change",
"call.arguments.change"
] | 780,422 | 780,423 | u363653022 | cpp |
p02973 | // Sani buyuk Osman Pasa Plevneden cikmam diyor.
// FatihSultanMehmedHan
// Abdulhamid Han
// Bismillahirrahmanirrahim
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long lo;
typedef pair<int, int> PII;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL)
#define FOR for (int i = 1; i <= n; i++)
#define mid ((start + end) / 2)
#define ort ((bas + son) / 2)
const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 1000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 500005;
const lo mod = 1000000007;
int n, m, b[li], a[li], k, flag, t;
int cev;
string s;
multiset<int> st;
vector<int> v;
int main(void) {
scanf("%d", &n);
FOR { scanf("%d", &a[i]); }
//~ st.insert(inf)
st.insert(a[1]);
for (int i = 2; i <= n; i++) {
//~ cout<<st.size()<<endl;
auto it = st.begin();
if (*it >= a[i]) {
st.insert(a[i]);
continue;
}
it = st.lower_bound(a[i]);
//~ auto it1=st.upper_bound(a[i]);
//~ if(st.size()==1){
//~ it--;
//~ if(it==st.end()){
//~ it--;
//~ st.erase(it);
//~ st.insert(*it);
//~ continue;
//~ }
//~ else{
//~ st.insert(a[i]);continue;
//~ }
//~ }
it--;
//~ if(it==){st.insert(a[i]);continue;}
//~ if(*it>=a[i]){st.insert(a[i]);continue;}
st.erase(it);
st.insert(*it);
}
printf("%d\n", st.size());
return 0;
}
| // Sani buyuk Osman Pasa Plevneden cikmam diyor.
// FatihSultanMehmedHan
// Abdulhamid Han
// Bismillahirrahmanirrahim
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long lo;
typedef pair<int, int> PII;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL)
#define FOR for (int i = 1; i <= n; i++)
#define mid ((start + end) / 2)
#define ort ((bas + son) / 2)
const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 1000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 500005;
const lo mod = 1000000007;
int n, m, b[li], a[li], k, flag, t;
int cev;
string s;
multiset<int> st;
vector<int> v;
int main(void) {
scanf("%d", &n);
FOR { scanf("%d", &a[i]); }
//~ st.insert(inf)
st.insert(a[1]);
for (int i = 2; i <= n; i++) {
//~ cout<<st.size()<<endl;
auto it = st.begin();
//~ it++;
//~ cout<<*it<<endl;
if (*it >= a[i]) {
st.insert(a[i]);
continue;
}
it = st.lower_bound(a[i]);
//~ auto it1=st.upper_bound(a[i]);
//~ if(st.size()==1){
//~ it--;
//~ if(it==st.end()){
//~ it--;
//~ st.erase(it);
//~ st.insert(*it);
//~ continue;
//~ }
//~ else{
//~ st.insert(a[i]);continue;
//~ }
//~ }
it--;
//~ if(it==){st.insert(a[i]);continue;}
//~ if(*it>=a[i]){st.insert(a[i]);continue;}
st.erase(it);
st.insert(a[i]);
}
printf("%d\n", st.size());
return 0;
}
| [] | 780,426 | 780,427 | u050607149 | cpp |
p02973 | #include <cstdio>
#include <set>
using namespace std;
int main() {
int n, a, cnt = 1;
set<int> s;
scanf("%d%d", &n, &a);
s.insert(a);
for (int i = 1; i < n; ++i) {
scanf("%d", &a);
if (*s.begin() >= a)
++cnt;
else
s.erase(--s.lower_bound(a));
s.insert(a);
}
printf("%d\n", cnt);
return 0;
}
| #include <cstdio>
#include <set>
using namespace std;
int main() {
int n, a, cnt = 1;
multiset<int> s;
scanf("%d%d", &n, &a);
s.insert(a);
for (int i = 1; i < n; ++i) {
scanf("%d", &a);
if (*s.begin() >= a)
++cnt;
else
s.erase(--s.lower_bound(a));
s.insert(a);
}
printf("%d\n", cnt);
return 0;
}
| [
"variable_declaration.type.change"
] | 780,428 | 780,429 | u359025499 | cpp |
p02973 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
scanf("%d", &n);
set<int> s;
int ans = 0;
for (int i = 0; i < n; i++) {
int x;
scanf("%d", &x);
s.insert(x);
auto it = s.lower_bound(x);
if (it == s.begin())
ans++;
else {
it--;
s.erase(it);
}
}
printf("%d\n", ans);
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
scanf("%d", &n);
multiset<int> s;
int ans = 0;
for (int i = 0; i < n; i++) {
int x;
scanf("%d", &x);
s.insert(x);
auto it = s.lower_bound(x);
if (it == s.begin())
ans++;
else {
it--;
s.erase(it);
}
}
printf("%d\n", ans);
}
| [
"variable_declaration.type.change"
] | 780,432 | 780,433 | u100131109 | cpp |
p02973 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> A(N);
for (int i = 0; i < N; i++) {
cin >> A[i];
}
vector<int> Color(N);
for (int i = 0; i < N; i++) {
Color[i] = -1;
}
int cnt = 0;
for (int i = N - 1; i >= 0; i--) {
if (i == N - 1) {
Color[cnt] = A[i];
cnt++;
} else {
// Color の中で最大なのは常に Color[cnt-1]
// A[i] がどのColor よりも大きかったら(同じ値でも)
if (A[i] >= Color[cnt - 1]) {
Color[cnt] = A[i];
cnt++;
} else {
// A[i]より大きい最小のColor を A[i]と置き換える そうするとColor
// の大小関係が変わらない
for (int j = 0; j < cnt; j++) {
if (A[i] < Color[j]) {
Color[j] = A[i];
}
}
}
}
}
printf("%d\n", cnt);
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> A(N);
for (int i = 0; i < N; i++) {
cin >> A[i];
}
vector<int> Color(N);
for (int i = 0; i < N; i++) {
Color[i] = -1;
}
int cnt = 0;
for (int i = N - 1; i >= 0; i--) {
if (i == N - 1) {
Color[cnt] = A[i];
cnt++;
} else {
// Color の中で最大なのは常に Color[cnt-1]
// A[i] がどのColor よりも大きかったら(同じ値でも)
if (A[i] >= Color[cnt - 1]) {
Color[cnt] = A[i];
cnt++;
} else {
// A[i]より大きい最小のColor を A[i]と置き換える そうするとColor
// の大小関係が変わらない
for (int j = 0; j < cnt; j++) {
if (A[i] < Color[j]) {
Color[j] = A[i];
break;
}
}
}
}
}
printf("%d\n", cnt);
return 0;
}
| [
"control_flow.break.add"
] | 780,464 | 780,465 | u883982500 | cpp |
p02973 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> A(N);
for (int i = 0; i < N; i++) {
cin >> A[i];
}
vector<int> Color(N);
for (int i = 0; i < N; i++) {
Color[i] = -1;
}
int cnt = 0;
for (int i = N - 1; i >= 0; i--) {
if (i == N - 1) {
Color[cnt] = A[i];
cnt++;
} else {
// Color の中で最大なのは常に Color[cnt-1]
// A[i] がどのColor よりも大きかったら(同じ値でも)
if (A[i] >= Color[cnt - 1]) {
Color[cnt] = A[i];
cnt++;
} else {
// A[i]より大きい最小のColor を A[i]と置き換える そうするとColor
// の大小関係が変わらない
for (int j = 0; j < cnt; j++) {
if (A[i] > Color[j]) {
Color[j] = A[i];
}
}
}
}
}
printf("%d\n", cnt);
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> A(N);
for (int i = 0; i < N; i++) {
cin >> A[i];
}
vector<int> Color(N);
for (int i = 0; i < N; i++) {
Color[i] = -1;
}
int cnt = 0;
for (int i = N - 1; i >= 0; i--) {
if (i == N - 1) {
Color[cnt] = A[i];
cnt++;
} else {
// Color の中で最大なのは常に Color[cnt-1]
// A[i] がどのColor よりも大きかったら(同じ値でも)
if (A[i] >= Color[cnt - 1]) {
Color[cnt] = A[i];
cnt++;
} else {
// A[i]より大きい最小のColor を A[i]と置き換える そうするとColor
// の大小関係が変わらない
for (int j = 0; j < cnt; j++) {
if (A[i] < Color[j]) {
Color[j] = A[i];
break;
}
}
}
}
}
printf("%d\n", cnt);
return 0;
}
| [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 780,466 | 780,465 | u883982500 | cpp |
p02973 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> A(N);
for (int i = 0; i < N; i++) {
cin >> A[i];
}
vector<int> Color(N);
for (int i = 0; i < N; i++) {
Color[i] = -1;
}
int cnt = 0;
for (int i = N - 1; i >= 0; i--) {
if (i == N - 1) {
Color[cnt] = A[i];
cnt++;
} else {
// Color の中で最大なのは常に Color[cnt-1]
// A[i] がどのColor よりも大きかったら
if (A[i] >= Color[cnt - 1]) {
Color[cnt] = A[i];
cnt++;
} else {
// A[i]より大きい最小のColor を A[i]と置き換える そうするとColor
// の大小関係が変わらない
for (int j = 0; j < cnt; j++) {
if (A[i] >= Color[j]) {
Color[j] = A[i];
}
}
}
}
}
printf("%d\n", cnt);
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> A(N);
for (int i = 0; i < N; i++) {
cin >> A[i];
}
vector<int> Color(N);
for (int i = 0; i < N; i++) {
Color[i] = -1;
}
int cnt = 0;
for (int i = N - 1; i >= 0; i--) {
if (i == N - 1) {
Color[cnt] = A[i];
cnt++;
} else {
// Color の中で最大なのは常に Color[cnt-1]
// A[i] がどのColor よりも大きかったら(同じ値でも)
if (A[i] >= Color[cnt - 1]) {
Color[cnt] = A[i];
cnt++;
} else {
// A[i]より大きい最小のColor を A[i]と置き換える そうするとColor
// の大小関係が変わらない
for (int j = 0; j < cnt; j++) {
if (A[i] < Color[j]) {
Color[j] = A[i];
break;
}
}
}
}
}
printf("%d\n", cnt);
return 0;
}
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 780,467 | 780,465 | u883982500 | cpp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.