stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include <iostream>

//#include <string>

using namespace std;

int n;

int h[100010];



int max(int *num) {

	int res = 0;

	for (int i = 0; i < n; i++) {

		if (res < num[i]) {

			res = num[i];

		}

	}

	return res;

}



int main() {

	int count[100010] = { 0 };

	cin >> n;

	for (int i = 0; i < n; i++) {

		cin >> h[i];

	}

	h[n] = 2000000000;

	int j=0;

	int k = 0;

	for (int i = 0; i < n - 1; i++) {

		j = i;

		k = i;

		while (h[j] >= h[j + 1]) {

			j++;

			count[i]++;

		}

		if (count[i] != 0) {

			while (count[k] != 0) {

				k++;

				count[k] = count[k - 1] - 1;

			}

			i = k;

		}

	}

	cout << max(count) << endl;

	return 0;

}

// Optimized solution to the same problem (faster):
#include <iostream>

#include <string>

#include <vector>

#include <stack>

#include <queue>



#include <stdio.h>

#include <math.h>

#include <stdlib.h>



using namespace std;



inline int max(int a, int b) {//最大

	if (a > b) return a;

	return b;

}



int n, h[100005],ans=0,max1=0;

int main() {

	cin >> n;

	for (int i = 0; i < n; i++) {

		cin >> h[i];

	}

	for (int i = 0; i < n; i++) {

		while (h[i]>=h[i+1] && i<n-1) {

			max1++;

			

			i++;

		}

		ans=max(max1, ans);

		max1 = 0;

	}

	cout << ans << endl;

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

const int inf=1e5+5;

typedef long long ll;

int n,m;

bool vis[100005];

vector<int> v[100005];

int main()

{

    cin>>n;

    int a[n+1];

    for(int i=0;i<n;i++) cin>>a[i];

    int ans=0;

    int k=0;

    for(int i=1;i<n;i++){

        if(a[i]>a[i-1]){

           k=i;

        }

        ans=max(ans,i-k);

    }

    cout<<ans;

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/tree_policy.hpp>

#define leading zero str.erase(0, min(str.find_first_not_of('0'), str.size()-1));

using namespace __gnu_pbds;

using namespace std;

typedef long long ll;

typedef pair<int, int> pii;

typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

string text="abcdefghijklmnopqrstuvwxyz";

const int maxn=1e6+7;

//        .--------------.

//        | Try First One|

//        '--------------'

//                |     .--------------.

//                |     |              |

//                V     V              |

//              .--------------.       |

//              |      AC.     |<---.  |

//              '--------------'    |  |

//              (True)|  |(False)   |  |

//           .--------'  |          |  |

//           |           V          |  |

//           |  .--------------.    |  |

//           |  |   Try Again  |----'  |

//           |  '--------------'       |

//           |                         |

//           |  .--------------.       |

//           '->| Try Next One |-------'

//              '--------------'

int main()

{

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    ll n;

    cin>>n;

    ll a[n+2];

    for(int i=0;i<n;i++)cin>>a[i];

    ll cnt=1;

    ll mx=-1;

    for(int i=1;i<n;i++){

        if(a[i]<=a[i-1])cnt++;

        else{

            mx=max(mx,cnt);

            cnt=1;

        }

    }

    mx=max(mx,cnt);

    if(mx==-1)cout<<0<<endl;

    else cout<<mx-1<<endl;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <string>

#include <vector>

#include <set>

#include <algorithm>

using namespace std;



int main() {

  int n;

  string s;

  cin >> n >> s;

  int ans = 0;

  for (int i = 0; i < n; ++i) {

    set<char> x, y;

    for (int j = 0; j <= i; ++j) {

      x.insert(s[j]);

    }

    for (int j = i+1; j < n; ++j) {

      y.insert(s[j]);

    }

    vector<char> v(n);

    auto it = set_intersection(x.begin(), x.end(), y.begin(), y.end(), v.begin());

    v.resize(it-v.begin());

    // cout << v.size() << endl;

    // for (auto it : v) {

    //   cout << it <<  ' ';

    // } cout << endl;

    ans = max(ans, (int)v.size());

  }

  cout << ans << endl;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>

using namespace std;

const int MAXN = 100;

char s[MAXN + 5];

int cnt1[26], cnt2[26];

int main() {

	int N;

	scanf("%d%s", &N, s);

	for(int i=0;i<N;i++)

		cnt1[s[i]-'a']++;

	int ans = 0, res = 0;

	for(int i=0;i<N-1;i++) {

		cnt2[s[i]-'a']++;

		if( cnt2[s[i]-'a'] == 1 ) ans++;

		if( cnt2[s[i]-'a'] == cnt1[s[i]-'a'] ) ans--;

		res = max(res, ans);

	}

	printf("%d\n", res);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <cstdio>

#include <cstring>

#include <cstdlib>

#define N 110

using namespace std;



char s[N],ss[N];



int main()

{

	char c;

	int j,k,temp,n,i,ans,flag;

	

	while (scanf("%d",&n)!=EOF)

	{

		c=getchar();

		fgets(s,sizeof(s),stdin);

		s[n]='\0';

		ans=0;

		

		for (i=1;i<n;i++)

		{

			strcpy(ss,s);

			temp=0;

			

			for (j=0;j<i&&j<n;j++)

			{

				flag=1;

				

				for (k=i;k<n;k++)

				{

					if (ss[k]==s[j])

					{

						if (flag)

						{

							flag=0;

							temp++;

						}

						

						ss[k]='#';

					}

				}

			}

			

			ans=max(ans,temp);

		}

		

		printf("%d\n",ans);

	}

	

	return 0;

 } 

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>

using namespace std;

const int MAXN = 100;

char s[MAXN + 5];

int cnt1[26], cnt2[26];

int main() {

	int N;

	scanf("%d%s", &N, s);

	for(int i=0;i<N;i++)

		cnt1[s[i]-'a']++;

	int ans = 0, res = 0;

	for(int i=0;i<N-1;i++) {

		cnt2[s[i]-'a']++;

		if( cnt2[s[i]-'a'] == 1 ) ans++;

		if( cnt2[s[i]-'a'] == cnt1[s[i]-'a'] ) ans--;

		res = max(res, ans);

	}

	printf("%d\n", res);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<string>

#include<set>

#include<queue>

#include<algorithm>

using namespace std;

int vis[200];

int main(){

	int t;

	string a;

	cin>>t;

	cin>>a;

	set<char> left;

	set<char> right;

	set<char> final;

	queue<char> q;

	queue<char> p;

	int n=a.length();

	for(int i=0;i<n;i++){

		q.push(a[i]);



	}



	for(int i=0;i<n-1;i++){

		left.insert(a[i]);

		q.pop();

		p=q;

		right.clear();

		while(!p.empty()){

			right.insert(p.front());

			p.pop();

		}

		

		set<char>::iterator it1;

		set<char>::iterator it2;

		for(it1=left.begin();it1!=left.end();it1++){

			final.insert(*it1);

		}

		for(it2=right.begin();it2!=right.end();it2++){

			final.insert(*it2);

		}

		int an=left.size()+right.size()-final.size();

		vis[i]=an;

	

	}

	sort(vis,vis+n-1);

	cout<<vis[n-2]<<endl;



	return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>

using namespace std;

const int MAXN = 100;

char s[MAXN + 5];

int cnt1[26], cnt2[26];

int main() {

	int N;

	scanf("%d%s", &N, s);

	for(int i=0;i<N;i++)

		cnt1[s[i]-'a']++;

	int ans = 0, res = 0;

	for(int i=0;i<N-1;i++) {

		cnt2[s[i]-'a']++;

		if( cnt2[s[i]-'a'] == 1 ) ans++;

		if( cnt2[s[i]-'a'] == cnt1[s[i]-'a'] ) ans--;

		res = max(res, ans);

	}

	printf("%d\n", res);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <iomanip>

#include <stdio.h>

#include <cstring>

#include <string>

#include <algorithm>

#include <vector>

#include <queue>

#include <set>

#include <map>

#include <functional>

#include <math.h>

using namespace std;



typedef long long ll;

typedef pair<int, int> pii;



int main() {

  int l; string S; cin >> l >> S;



  int mid, ans = 0;

  for (int k = 1; k < l; k++) {

    set<int> s1, s2;

    int cnt = 0;

    for (int i = 0; i < k; i++) s1.insert(S[i]);

    for (int i = k; i < l; i++) s2.insert(S[i]);

    for (auto p:s2) {

      if (s1.find(p) != s1.end()) cnt++;

    }

    ans = max(ans, cnt);

  }

  cout << ans << endl;

}




// Optimized solution to the same problem (faster):
#include <map>

#include <set>

#include <ctime>

#include <cmath>

#include <queue>

#include <stack>

#include <vector>

#include <string>

#include <cstdio>

#include <cstdlib>

#include <cstring>

#include <sstream>

#include <iostream>

#include <algorithm>

#include <functional>

using namespace std;

#define For(i, x, y) for(int i=x;i<=y;i++)  

#define _For(i, x, y) for(int i=x;i>=y;i--)

#define Mem(f, x) memset(f,x,sizeof(f))  

#define Sca(x) scanf("%d", &x)

#define Sca2(x,y) scanf("%d%d",&x,&y)

#define Sca3(x,y,z) scanf("%d%d%d",&x,&y,&z)

#define Scl(x) scanf("%lld",&x);  

#define Pri(x) printf("%d\n", x)

#define Prl(x) printf("%lld\n",x);  

#define CLR(u) for(int i=0;i<=N;i++)u[i].clear();

#define LL long long

#define ULL unsigned long long  

#define mp make_pair

#define PII pair<int,int>

#define PIL pair<int,long long>

#define PLL pair<long long,long long>

#define pb push_back

#define fi first

#define se second 

typedef vector<int> VI;

const double eps = 1e-9;

const int maxn = 110;

const int INF = 0x3f3f3f3f;

const int mod = 1e9 + 7; 

int N,M,K;

char str[maxn];

int num1[maxn];

int num2[maxn];

void solve(){

	int now = 0;

	int ans = 0;

	for(int i = 1; i <= N ; i ++){

		num1[str[i] - 'a']--;

		num2[str[i] - 'a']++;

		if(!num1[str[i] - 'a'] && num2[str[i] - 'a'] >= 2) now--;

		if(num2[str[i] - 'a'] == 1 && num1[str[i] - 'a']) now++;

		ans = max(ans,now);

	}

	cout << ans << endl;

}

int main(){

	Sca(N);

	scanf("%s",str + 1);

	for(int i = 1; i <= N ; i ++){

		num1[str[i] - 'a']++;

	}

	solve();

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cstdio>

#include<cstdlib>

#include<cstring>

#include<iostream>

#include<cmath>

#include<algorithm>

using namespace std;

typedef long long LL;

const int MAXN = 1e5;



char s[MAXN + 5],ans[MAXN + 5];

LL a[MAXN + 5],b[MAXN + 5];

bool q = 0;

LL sum = 0,k = 0;



int main(){

	memset(s,0,sizeof(s));

	cin >> s+1;

	cin >> k;

	int len = strlen(s+1);

	for(int i = 1;i <= len;i++){

		a[i] = (LL)s[i];

	}

	for(int i = 1;i <= len;i++){

		if(k ==0)break;

		if(a[i] == 97)continue;

		else{

			if(a[i]+k >122){

				k =k - (122 - a[i]+1);

				a[i] = 97;	

			}

		}

	}

	if(k > 0){

		if(k > 26)k %=26;

		a[len] += k;

		if(a[len] > 122){

			a[len] = 97 + a[len] - 122 - 1;

		}

	}

	for(int i = 1;i <= len;i++){

		cout << (char)a[i];

	}

	cout << endl;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstdlib>

#include<cstring>

#include<cmath>

#include<algorithm>

using namespace std;

char str[100005];

int num[100005];

int main()

{

	int k,i,j,min,bei;

	scanf("%s",str);

	scanf("%d",&k);

	int len = strlen(str);

	for(i = 0;i < len; i++)

	{

		if(str[i] == 'a')

		{

			num[i] = 0;

			continue;

		}

		num[i] = 'z' - str[i] + 1;

	}

	for(i = 0;i < len; i++)

	{

		if(k == 0)

			break;

		if(i + 1 < len)

		{	

			if(k >= num[i] && str[i] != 'a')

			{

				str[i] = 'a';

				k -= num[i];

			}

		}

		else

		{

			k = k % 26;

			if(str[i] + k <= 'z')

			{

				str[i] = str[i] + k;

				}

			else

			{

				k = k - num[i];

				str[i] = 'a';

				str[i] = str[i] + k;

				}

			k = 0;

		}

	}

	puts(str);

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;

using namespace std;

#define Khela ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

#define ll long long int

#define llu long long unsigned int

#define pf printf

#define sf scanf

#define f first

#define s second

#define pb push_back

#define mk make_pair

#define pii pair<int ,int>

#define PII pair<ll ,ll>

 

int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};

int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};

int dx4[] = {0, 0, 1, -1};

int dy4[] = {1, -1, 0, 0};

 

typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;

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));}

const int max=1e9+100;

const ll  MAX=1e18+500;

const int sz=2e5+100;

int mark[sz];

int main()

{

    Khela

    int a,b,c,i,j,k,q,p,x,y,ct,ct1,m,l,r,x1,y1,mn,h,sum1,in,z,mid,n,mx;

    char ch;

    double d;

    string str1,str2,str;

    bool bl,bl1;

    int t,cs=1;

    while(cin>>n)

    {

        memset(mark,0,sizeof mark);

        int ara[n+2];

        for(i=1;i<=n;i++) cin>>ara[i];



        int ct=0;

        for(i=n;i>=1;i--){

           int tot=0;

           for(j=i+i;j<=n;j+=i) tot+=mark[j];

           if(tot % 2 != ara[i]){

               ++ct;

               ++mark[i];

           }

        }

        

        cout<<ct<<endl;

        for(i=1;i<=n;i++){

            if(mark[i]>0){

                cout<<i<<" ";

            }

        }

       if(ct>0) cout<<endl;

      

        

    }











}

// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

#define LLI long long int

#define ULTRA 2134567890

#define de(x) if(x!=0 && MODE==x)

#define MODE 1

using namespace std;



int arr[200007];

bool b[200007];



int main()

{

    int i,j;

    int N;



    scanf("%d", &N);



    int cnt = 0;

    for( i=1; i<=N; i++)

    {

        scanf("%d", &arr[i]);

    }



    vector<int> keep;

    for( i=N; i>=1; i--)

    {

        if( b[i] != arr[i])

        {

            for( j=1; j*j<=i; j++)

            {

                if(i%j==0)

                {

                    b[j] ^= 1;

                    if( j*j!=i)

                        b[i/j] ^= 1;

                }

            }

            keep.push_back(i);

        }

    }



    printf("%d\n", keep.size());

    for( auto it:keep)

    {

        printf("%d ", it);

    }

    printf("\n");



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

#define abdelrahman010 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll;

using namespace std;

const int N = 2e5 + 5;

int main() {

    abdelrahman010

    int n , a[N];

    cin >> n;

    for(int i = 1;i <= n;i++)

        cin >> a[i];

    vector<int> v;

    int cnt[N] = {};

    for(int i = n;i >= 1;i--) {

        if (a[i]) {

            int c = 0;

            for (int j = i + i; j <= n; j += i)

                c += cnt[j];

            if (c % 2 == 0) {

                v.push_back(i);

                cnt[i]++;

            }

        } else {

            int c = 0;

            for (int j = i + i; j <= n; j += i)

                c += cnt[j];

            if (c % 2) {

                v.push_back(i);

                cnt[i]++;

            }

        }

    }

    cout << v.size() << '\n';

    for(auto &i : v)

        cout << i << " ";

    return 0;

}

// Optimized solution to the same problem (faster):
/// إِنَّ مَعَ الْعُسْرِ يُسْرًا

/// لَا أَبْرَحُ حَتَّىٰ أَبْلُغَ



#include <bits/stdc++.h>

#include <ext/rope>

#include <bits/stdc++.h>

#include <ext/pb_ds/tree_policy.hpp>

#include <ext/pb_ds/assoc_container.hpp>



using namespace __gnu_cxx;

using namespace __gnu_pbds;

using namespace std;

template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;



#define ll long long

#define ld  double



#define HabdModeActive ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#define S second

#define F first

#define PI acos(-1)

#define MAX 5000005

#define file freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);

const int N = 2e5 + 5;

int cnt [N];

int main() {

    HabdModeActive

    int n;

    cin>>n;

    int arr[n+2];

    for(int i=1 ; i<=n; i++)

    {

        cin>>arr[i];

    }

    vector<int>vec;

    for(int i=n ; i>=1  ; i--)

    {

        if(arr[i] != cnt[i]%2)

        {

            vec.push_back(i);

            cnt[i]++;

            for(ll j=1 ;j*j <= i ; j++)

            {

                if(i%j==0 && i!=j)

                {

                    cnt[j]++;

                    if(j*j != i)

                        cnt[i/j]++;

                }

            }

        }

    }

    if(cnt[1]%2 != arr[1])

        cout<<-1;

    else{

        cout<<vec.size()<<endl;

        for(auto v :vec)

            cout<<v<<" ";

    }



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#define me(a,x) memset(a,x,sizeof(a))

#define sc scanf

#define itn int

using namespace std;

const int N=1e6;

const long long mod=1e9+7;

const int oo=0x7fffffff;

const int sup=0x80000000;

typedef long long ll;

typedef unsigned long long ull;

template <typename it>void db(it *begin,it *end){while(begin!=end)cout<<(*begin++)<<" ";puts("");}

template <typename it>

string to_str(it n){string s="";while(n)s+=n%10+'0',n/=10;reverse(s.begin(),s.end());return s;}

template <typename it>int o(it a){cout<<a<<endl;return 0;}

ll mul(ll a,ll b,ll c){ll ans=0;for(;b;b>>=1,a=(a+a)%c)if(b&1)ans=(ans+a)%c;return ans;}

ll ksm(ll a,ll b,ll c){ll ans=1;for(;b;b>>=1,a=mul(a,a,c))if(b&1)ans=mul(ans,a,c);return ans;}

int n;

int a[N],b[N]={0};

int main(){

	//freopen("in.txt","r",stdin);

	cin>>n;

	for(int i=1;i<=n;i++)cin>>a[i];

  for (int i = n; i >= 1; --i) {

    b[i] = a[i];

    for (int j = i * 2; j <= n; j += i)

      b[i] ^= b[j];

  }

  int cnt = 0;

  for (int i = 1; i <= n; ++i) if (b[i] == 1) cnt++;

  printf("%d\n", cnt);

  for (int i = 1; i <= n; ++i)

    if (b[i] == 1) printf("%d ", i);

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int a[300008],b[2000008];

int main(){

    int n,t=0;

    scanf("%d",&n);

    for(int i=1;i<=n;i++)

        scanf("%d",a+i),b[i]=0;

    for(int i=n;i>=1;i--){

          int   s=b[i];

        for(int j=2;j*i<=n;j++){

            s+=b[i*j];

        }

        if(s%2!=a[i]){

            s++;

            t++;

            b[i]=1;

            if(s%2!=a[i]){

                printf("-1\n");

                return 0;

            }

        }

    }

    printf("%d\n",t);

    for(int i=1;i<=n;i++){

        if(b[i]){

            printf("%d ",i);

        }

    }

    printf("\n");

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <cstdio>

#include <vector>

using namespace std;



const int N = 400003;

int n, a[N], b[N];



vector <int> ans;



signed main(void)

{

	//后面影像前面 

	scanf("%d", &n);

	for(int i=1; i<=n; ++i)

		scanf("%d", &a[i]);

	for(int i=n; i>=1; --i)

	{

		int res = 0;

		for(int j=i+i; j<=n; j+=i)

			res+=b[j];

		if(res %2 != a[i]){

		 b[i] = 1;

	ans.push_back(i);

	}

	}	

	printf("%d\n", ans.size());

	for(int i=0; i<ans.size(); ++i)

	printf("%d ", ans[i]);

	return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int a[300008],b[2000008];

int main(){

    int n,t=0;

    scanf("%d",&n);

    for(int i=1;i<=n;i++)

        scanf("%d",a+i),b[i]=0;

    for(int i=n;i>=1;i--){

          int   s=b[i];

        for(int j=2;j*i<=n;j++){

            s+=b[i*j];

        }

        if(s%2!=a[i]){

            s++;

            t++;

            b[i]=1;

            if(s%2!=a[i]){

                printf("-1\n");

                return 0;

            }

        }

    }

    printf("%d\n",t);

    for(int i=1;i<=n;i++){

        if(b[i]){

            printf("%d ",i);

        }

    }

    printf("\n");

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

const int maxn=2e5+10;

const int mod=1e6+3;

typedef long long ll;

#define inf 0x3f3f3f3f

#define mem(a,b) memset(a,b,sizeof(a))

#define per(i,a,b) for(int i=(a);i<b;i++)

#define rep(i,a,b) for(int i=(a);i<=b;i++)

#define pi acos(-1.0)

#define mid ((l+r)>>1)

#define lson rt<<1,l,mid

#define rson rt<<1|1,mid+1,r

#define qwq puts("QWQ");

void read(int &x)

{

	int f=1;x=0;

	char ch=getchar();

	while(ch<'0'||ch>'9')

	{

		if(ch=='-')f=-1;

		ch=getchar();

	}

	while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();

	x*=f;

}

int a[maxn],b[maxn];

int main()

{

   int n;read(n);

   rep(i,1,n)read(a[i]);

   int i,j,ans=0;

   for(i=n;i>=1;i--)

   {

   	   int sum=0;

   	   for(j=i*2;j<=n;j+=i)

   	   {

   	   	 sum+=b[j];

   	   }

   	   if(sum%2!=a[i])

   	   {

   	   	  b[i]=1;ans++;

   	   }

   }

   printf("%d\n",ans);

   rep(i,1,n)

   {

   	if(b[i])printf("%d ",i);

   }

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<math.h>

int main()

{

	int n,an=0;

	scanf("%d",&n);

	int a[n],b[n]={},c[n];

	for(int i=0;i<n;i++)

		scanf("%d",a+i);

	for(int i=n;i>0;i--)

		if(a[i-1]!=b[i-1])

		{

			c[an++]=i;

			for(int j=1;j<sqrt(i);j++)

				if(i%j==0)

				{

					b[j-1]=!b[j-1];

					b[i/j-1]=!b[i/j-1];

				}

			int t=sqrt(i);

			if(t*t==i)

				b[t-1]=!b[t-1];

		}

	printf("%d\n",an);

	for(int i=an-1;i>=0;i--)

		printf("%d ",c[i]);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#define IOS ios_base::sync_with_stdio(false); cin.tie(0);

using namespace std;



int main(){

	IOS;

	int n;

	cin >> n;

	vector<int> num(n+1);

	for(int i=1;i<=n;i++) cin >> num[i];

	vector<int> cnt(n+1,0),ans;

	for(int i=n;i>0;i--){

		if(num[i]==0){

			if(cnt[i]%2==1){

				ans.push_back(i);

				for(int j=1;j*j<=i;j++){

					if(i%j==0){

						cnt[j]++;

						if(j*j!=i) cnt[i/j]++;

					}

				}

			}

		}

		else{

			if(cnt[i]%2==0){

				ans.push_back(i);

				for(int j=1;j*j<=i;j++){

					if(i%j==0){

						cnt[j]++;

						if(j*j!=i) cnt[i/j]++;

					}

				}

			}

		}

	}

	cout << ans.size() << '\n';

	for(int f:ans) cout << f << ' ';

	cout << '\n';

	return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<math.h>

int main()

{

	int n,an=0;

	scanf("%d",&n);

	int a[n],b[n]={},c[n];

	for(int i=0;i<n;i++)

		scanf("%d",a+i);

	for(int i=n;i>0;i--)

		if(a[i-1]!=b[i-1])

		{

			c[an++]=i;

			for(int j=1;j<sqrt(i);j++)

				if(i%j==0)

				{

					b[j-1]=!b[j-1];

					b[i/j-1]=!b[i/j-1];

				}

			int t=sqrt(i);

			if(t*t==i)

				b[t-1]=!b[t-1];

		}

	printf("%d\n",an);

	for(int i=an-1;i>=0;i--)

		printf("%d ",c[i]);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#define IOS ios_base::sync_with_stdio(false); cin.tie(0);

#define endl '\n'

#define N 200000 + 5

using namespace std;



int n, a[N], b[N];



int main(){

    IOS;

    cin >> n;

    for(int i=1; i<=n; i++)

        cin >> a[i];

    for(int i=n; i>=1; i--){

        int sum = 0;

        for(int j=i+i; j<=n; j+=i){

            sum += b[j];

            sum %= 2;

        }

        b[i] = sum ^ a[i];

    }

    vector<int> ans; // index

    for(int i=1; i<=n; i++)

        if(b[i])

            ans.push_back(i);

    cout << ans.size() << endl;

    for(int i=0; i<ans.size(); i++)

        cout << ans[i] << (i == ans.size()-1 ? "\n" : " ");

    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<math.h>

int main()

{

	int n,an=0;

	scanf("%d",&n);

	int a[n],b[n]={},c[n];

	for(int i=0;i<n;i++)

		scanf("%d",a+i);

	for(int i=n;i>0;i--)

		if(a[i-1]!=b[i-1])

		{

			c[an++]=i;

			for(int j=1;j<sqrt(i);j++)

				if(i%j==0)

				{

					b[j-1]=!b[j-1];

					b[i/j-1]=!b[i/j-1];

				}

			int t=sqrt(i);

			if(t*t==i)

				b[t-1]=!b[t-1];

		}

	printf("%d\n",an);

	for(int i=an-1;i>=0;i--)

		printf("%d ",c[i]);

	return 0;

}

// Fastest known solution for this problem: