criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define li          long
#define ll          long long
#define ull         unsigned long long
#define ff          first
#define ss          second
#define pii         pair<int,int>
#define pli         pair<li,li>
#define pll         pair<ll,ll>
#define pb          push_back
#define fo(i,k,n)   for(int i = k;i<n; i++)
#define ro(i,k,n)   for(int i = k; i>=n; i--)
#define tc          int t;cin>>t;while(t--)
#define all(v)      v.begin(),v.end()
#define inf         INT_MAX
#define ninf        INT_MIN
#define W(x)        cout<<x<<endl
#define WW(x,y)     cout<<x<<' '<<y<<endl;
#define in(x)       cin>>x
#define v(x)        vector<x>
#define int         long long
#define ar(x,y)     array<x,y>
const ll mod1 = 99844353;
const ll mod2 = 1e9+7;
/* template <class T>
using oset = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>; */

void fastio()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

template<class T>
T power(T a,T b){
    T res = (T)1;
    while(b>0){
        if(b&1)res = res*a;
        b>>=1;
        a*=a;
    }
    return res;
}

struct dsu{
  unordered_map<int,int> pr,sz;
  dsu(){
    (this->pr).clear();
    (this->sz).clear();
  }
  void make(int x){
    pr[x] = x;
    sz[x] = 1;
  }
  int getpar(int x){
    if(pr[x] == x)return x;
    return pr[x] = getpar(pr[x]);
  }
  void merge(int x,int y){
    x = getpar(x);
    y = getpar(y);
    if(sz[x]<sz[y])swap(x,y);
    pr[y] = x;
    sz[x]+=sz[y];
    sz[y] = 0;
  }
};


void solve(){
  int n;
  cin>>n;
  vector<int> ans(n+1,0);
  fo(i,1,101){
    fo(j,1,101){
      fo(k,1,101){
        int num= i*i+j*j+k*k+i*j+j*k+k*i;
        if(num<=n)ans[num]++;
      }
    }
  }
  rep(i,1,n+1) cout<<ans[i]<<"\n";
}

signed main(){
    fastio();
    int t = 1;
    //cin>>t;
    while(t--){
        solve();
    }
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:84:7: error: 'i' was not declared in this scope
   84 |   rep(i,1,n+1) cout<<ans[i]<<"\n";
      |       ^
a.cc:84:3: error: 'rep' was not declared in this scope
   84 |   rep(i,1,n+1) cout<<ans[i]<<"\n";
      |   ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
static const int64_t mod=1000000007;
int64_t f(int64_t x,int64_t y){
if(y==0)
  return 1;
  else if(y%2==0)
    return (f(x,y/2)*f(x,y/2))%mod;
  else
    return (x*((f(x,y/2)*f(x,y/2))%mod))%mod;
}
int main(){
 int64_t N;cin>>N;
  map<int,int>M;
  for(int i=0;i<10000000;i++)
    M[i]=0;
  for(int i=2;i<=150;i++)
    for(int i=2;i<=150;i++)
      for(int k=2;k<=150;k++){
      int sum=i*i+j*j+k*k;
    if(sum%2==0 && (i+j+k)%2==0 && i<((i+j+k)/2)&& j<((i+j+k)/2)&&k<((i+j+k)/2)){
    M.at(sum/2)++;
    }
          }for(int i=1;i<=N;i++)
        cout<<M.at(i)<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:19: error: 'j' was not declared in this scope
   20 |       int sum=i*i+j*j+k*k;
      |                   ^
Language: C++

/* Bismillahirrahmanirrahim */
/* Author : Jehian Norman Saviero (@Reiva5) */
#include <bits/stdc++.h>
 
// MACROS SAMPAH
#define Jehian using
#define Norman namespace
#define Saviero std
 
Jehian Norman Saviero;
 
// MACROS TYPE
typedef long long ll;
typedef unsigned long ul;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
 
// MACROS FOR PRINT
#define nl printf("\n")
#define sp printf(" ")
 
// MACROS FOR ATTRIBUTE
#define fi first
#define se second
 
// MACROS FOR FUNCTION AND METHOD
#define eb emplace_back
#define mp make_pair
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define ALL(x) (x).begin(), (x).end()
#define ALLN(x,n) (x), (x)+(n)
#define CUBE(x) (SQR(x)*(x))
#define SET(x,y) for (int _qwe = sizeof(x)/sizeof(x[0]); _qwe; ) x[--_qwe] = (y)
#define SQR(x) ((x)*(x))
#define SSORT(x,sz) sort(ALLN(x,sz))
#define RESET(x) memset((x), 0, sizeof(x))
#define VSORT(x) sort(ALL(x))
 
// MACROS READ INPUT
#define sci(x) scanf("%d", &x)
#define scl(x) scanf("%ld", &x)
#define scll(x) scanf("%lld", &x)
#define scul(x) scl(x)
#define scull(x) scll(x)

const int sz = 1e6+5;
int cnt[sz];

int main() {
	RESET(cnt);
	for (int x = 1; x <= 100; ++x) {
		for (int y = 1; y <= 100; ++y) {
			for (int z = 1; z <= 100; ++z) {
				++cnt[x * x + y * y + z * z + x * y + y * z + x * z];
			}
		}
	}
	int N;
	sci(N);
	for (int i = 1; i <= N; ++i) {
		printf("%d\n", cnt[i]);
	}
	return 0;
}c

Compiler output:
a.cc:71:2: error: 'c' does not name a type
   71 | }c
      |  ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

int main(){
    int N;
    cin >> N;

    int cnt = 0;
    for(int i = 1; i <= N; i++){
        cnt = 0;
        for(int x = 1; x <= sqrt(i); x++){
            for(int y = 1; y <= sqrt(i); y++){
                for(int z = 1; z <= sqrt(i); z++){
                    if (x*x + y*y + z*z + x*y + y*z + z*x == i){
                        cnt++;
                    }1
                }
            }
        }
        cout << cnt << endl;
    }


    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:23: error: expected ';' before '}' token
   18 |                     }1
      |                       ^
      |                       ;
   19 |                 }
      |                 ~
Language: C++

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    map <int,int> p;
    for (int i=1; i<=99; i++){
        for (int j=1; j<=99; j++){
            for (int k=1; k<=99; k++){
                int t=i*i+j*j+k*k+i*j+i*k+j*k;
                if (temp<=n) p[temp]++;
            }
        }
    }
    for (int i=1; i<=n; i++) cout<<p[i]<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:21: error: 'temp' was not declared in this scope; did you mean 'tm'?
   14 |                 if (temp<=n) p[temp]++;
      |                     ^~~~
      |                     tm
Language: C++

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    map <int,int> p;
    for (int i=1; i<=99; i++){
        for (int j=1; j<=99; j++){
            for (int k=1; k<=99; k++){
                int t=x*x+y*y+z*z+x*y+x*z+y*z;
                if (temp<=n) p[temp]++;
            }
        }
    }
    for (int i=1; i<=n; i++) cout<<p[i]<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:23: error: 'x' was not declared in this scope
   13 |                 int t=x*x+y*y+z*z+x*y+x*z+y*z;
      |                       ^
a.cc:13:27: error: 'y' was not declared in this scope
   13 |                 int t=x*x+y*y+z*z+x*y+x*z+y*z;
      |                           ^
a.cc:13:31: error: 'z' was not declared in this scope
   13 |                 int t=x*x+y*y+z*z+x*y+x*z+y*z;
      |                               ^
a.cc:14:21: error: 'temp' was not declared in this scope; did you mean 'tm'?
   14 |                 if (temp<=n) p[temp]++;
      |                     ^~~~
      |                     tm
Language: C

#include <bits/stdc++.h>
#define mem(i,a) memset(i,a,sizeof(i))
#define PI acos(-1.0)
#define DMAX 100000+5
#define MOD 998244353
#define eps 1e-8
#define mp make_pair
#define INF 1000000000+9
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
template<class T> inline void read(T &x){
    x=0; 
    T f=1;
    char ch=getchar();
    while(ch<'0' || ch>'9'){
        if(ch=='-'){
            f=-1;
        }
        ch=getchar();
    }
    while(ch<='9' && ch>='0'){
        x=x*10+(ch-'0');
        ch=getchar();
    }
    x*=f;
}
int n;
int f[DMAX];
int main(){
    read(n);
    for(int i=1;i<=100;i++){
        for(int j=1;j<=100;j++){
            for(int k=1;k<=100;k++){
                int pol=i*i+j*j+k*k+i*j+i*k+j*k;
                f[pol]++;
            }
        }
    }
    for(int i=1;i<=n;i++){
        cout<<f[i]<<endl;
    }
    return 0;
}


Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define x first
#define y second
#define mp make_pair
#define pb push_back

typedef long long ll;

const ll MOD = 1e9+7;
const ll INF = 1e9+5;

int cnt[10005];

int main() {
	for (int x=1 ; x<=100 ; x++) {
		for (int y=1 ; y<=100 ; y++) {
			for (int z=1 ; z<=100 ; z++) {
				int br = x*x+y*y+z*z+x*y+y*z+*z*x;
				if (br>10000) break;
				cnt[br]++;
			}
		}
	}
	int n;
	cin >>n;
	for (int i=1 ; i<=n ; i++) {
		cout <<cnt[i]<<'\n';
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:62: error: invalid type argument of unary '*' (have 'int')
   21 |                                 int br = x*x+y*y+z*z+x*y+y*z+*z*x;
      |                                                              ^~
Language: C++

#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define REP(i, n) for(int i = 0; i < n; ++i)
using namespace std;
using namespace atcoder;
using LLONG = long long;
const LLONG MOD = 998244353;

int counts[200001];

// O(|n|)
const int Popcount(const string& n)
{
	int cnt = 0;
	for (const char ch : n)
	{
		if (ch == '1') ++cnt;
	}
	return cnt;
}

int main()
{
	// 予め　X (mod Popcount(X) ± 1) と 2^i (mod Popcount(X) ± 1) を計算しておく
	// 各々 O(N) で計算可能で，初回の f(n) 計算はこの事前計算によって完了
	// ２回目以降の f(n) 計算は n = f(X) ~ log(X) ~ N 程度に桁が落ちているので，
	// int型で n を保持しシミュレーションしていくことで O(1) 程度で高速に計算可能
	int N; string X; cin >> N >> X;
	int popX = Popcount(X);
	if (popX == 0) { REP(i, N) cout << 1 << endl; return 0; }
	
	vector<int> mods = { popX + 1, popX - 1 };

	// a[i][k] = { 2^i (mod Popcount(X) + 1), 2^i (mod Popcount(X) - 1) }
	vector<vector<int>> a(N, vector<int>(2, 0));

	// b[k] = { X (mod Popcount(X) + 1), X(mod Popcount(X) - 1) }
	vector<int> b(2, 0);

	for (int k = 0; k < 2; ++k)
	{
		if (mods[k] == 0) continue;

		a[0][k] = 1 % mods[k];
		b[k] = static_cast<int>(X[N - 1] - '0') % mods[k];

		for(int i = 1; i < N; ++i)
		{
			// 2^i mod Popcount(X)±1 については，
			// 2^(i-1) を２倍していくことで桁溢れせず計算可能
			a[i][k] = (2 * a[i - 1][k]) % mods[k];

			// X mod Popcount(X)±1 については，
			// 1が立っている桁（＝2^iを含む）について，
			// 2^i mod Popcount(X)±1 (=a[i][k]) を足していけばよい
			if (X[N - 1 - i] == '1')
			{
				b[k] += a[i][k];
				b[k] %= mods[k];
			}
		}
	}

	vector<int> ans(N);
	REP(i, N)
	{
		// mod Popcount(X) + 1 か mod Popcount(X) - 1 になるか判定
		// i桁目が０ならば，１に置換するので mod Popcount(X) + 1 となる
		int k = X[i] == '0' ? 0 : 1;
		
		// 置換した結果，全て０になるなら答えは０回
		if (mods[k] == 0)
		{
			ans[i] = 0;
			continue;
		}

		// 置換後の n = f(X) を計算
		// k = 0 （０->１に置換）のとき，X に 2^(N-1-i) を加える
		int n = k == 0 ? b[k] + a[N - 1 - i][k] : b[k] - a[N - 1 - i][k];
		if (n < 0) n += mods[k];
		n %= mods[k];

		// n が０になるまで繰り返す
		// n ~ log(X) となるので，int型で計算可能
		ans[i] = 1;
		while (n > 0)
		{
			int popcount = 0, digit = 0;
			while (n >= (1 << digit))
			{
				if (n & (1 << digit)) ++popcount;
				++digit;
			}
			n %= popcount;
			++ans[i];
		}
	}

	REP(i, N)
	{
		cout << ans[i] << endl;
	}
}


Compiler output:
a.cc:15:17: error: 'atcoder' is not a namespace-name
   15 | using namespace atcoder;
      |                 ^~~~~~~
Language: C++

#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <atcoder/dsu>

#define REP(i, n) for(int i = 0; i < n; ++i)
using namespace std;
using namespace atcoder;
using LLONG = long long;
const LLONG MOD = 998244353;

int counts[200001];

// O(|n|)
const int Popcount(const string& n)
{
	int cnt = 0;
	for (const char ch : n)
	{
		if (ch == '1') ++cnt;
	}
	return cnt;
}

int main()
{
	// 予め　X (mod Popcount(X) ± 1) と 2^i (mod Popcount(X) ± 1) を計算しておく
	// 各々 O(N) で計算可能で，初回の f(n) 計算はこの事前計算によって完了
	// ２回目以降の f(n) 計算は n = f(X) ~ log(X) ~ N 程度に桁が落ちているので，
	// int型で n を保持しシミュレーションしていくことで O(1) 程度で高速に計算可能
	int N; string X; cin >> N >> X;
	int popX = Popcount(X);
	if (popX == 0) { REP(i, N) cout << 1 << endl; return 0; }
	
	vector<int> mods = { popX + 1, popX - 1 };

	// a[i][k] = { 2^i (mod Popcount(X) + 1), 2^i (mod Popcount(X) - 1) }
	vector<vector<int>> a(N, vector<int>(2, 0));

	// b[k] = { X (mod Popcount(X) + 1), X(mod Popcount(X) - 1) }
	vector<int> b(2, 0);

	for (int k = 0; k < 2; ++k)
	{
		if (mods[k] == 0) continue;

		a[0][k] = 1 % mods[k];
		b[k] = static_cast<int>(X[N - 1] - '0') % mods[k];

		for(int i = 1; i < N; ++i)
		{
			// 2^i mod Popcount(X)±1 については，
			// 2^(i-1) を２倍していくことで桁溢れせず計算可能
			a[i][k] = (2 * a[i - 1][k]) % mods[k];

			// X mod Popcount(X)±1 については，
			// 1が立っている桁（＝2^iを含む）について，
			// 2^i mod Popcount(X)±1 (=a[i][k]) を足していけばよい
			if (X[N - 1 - i] == '1')
			{
				b[k] += a[i][k];
				b[k] %= mods[k];
			}
		}
	}

	vector<int> ans(N);
	REP(i, N)
	{
		// mod Popcount(X) + 1 か mod Popcount(X) - 1 になるか判定
		// i桁目が０ならば，１に置換するので mod Popcount(X) + 1 となる
		int k = X[i] == '0' ? 0 : 1;
		
		// 置換した結果，全て０になるなら答えは０回
		if (mods[k] == 0)
		{
			ans[i] = 0;
			continue;
		}

		// 置換後の n = f(X) を計算
		// k = 0 （０->１に置換）のとき，X に 2^(N-1-i) を加える
		int n = k == 0 ? b[k] + a[N - 1 - i][k] : b[k] - a[N - 1 - i][k];
		if (n < 0) n += mods[k];
		n %= mods[k];

		// n が０になるまで繰り返す
		// n ~ log(X) となるので，int型で計算可能
		ans[i] = 1;
		while (n > 0)
		{
			int popcount = 0, digit = 0;
			while (n >= (1 << digit))
			{
				if (n & (1 << digit)) ++popcount;
				++digit;
			}
			n %= popcount;
			++ans[i];
		}
	}

	REP(i, N)
	{
		cout << ans[i] << endl;
	}
}


Compiler output:
a.cc:12:10: fatal error: atcoder/dsu: No such file or directory
   12 | #include <atcoder/dsu>
      |          ^~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for(int i=0;i<(n);i++)
using namespace std;

int N;

int pcnt(int x) {
  return __builtin_popcount(x);
}

int f(int a) {
  if (a == 0) return 0;
  return f(a % pcnt(a)) + 1;
}

int main() {
  cin >> N;
  string s;
  cin >> s;
  vector<int> X(N);
  rep(i, N) X[i] = s[i] - '0';
  int opc = 0;
  rep(i, N) opc += X[i];
  
  vector<int> ans(N);
  // b=0は0→1の反転をする場合
  rep(b, 2) {
    int pc = opc;
    if (b == 0) pc++;
    else pc--;
    
    // x(mod pc)を求める
    int y = 0;
    for (int i = 0; i < N; i++) {
      y = (2*y)%pc;
      y += X[i];
    }
    
    // ビット反転させていく
    int bit = 1;
    for (int i = N-1; i >= 0; i--) {
      if (b == X[i]) {
        int z = y;
        if (b == 0) {
          z = (z + bit) % pc;
        } else {
          z = (z - bit + pc) % pc;
        }
        ans[i] = f(z) + 1;
      }
      bit *= 2;
      bit %= pc;
    }
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:56:4: error: expected '}' at end of input
   56 |   }
      |    ^
a.cc:18:12: note: to match this '{'
   18 | int main() {
      |            ^
Language: C++

#include<bits/stdc++.h>
 using namespace std;
 #define ll long long int
 int main()
  {   ios_base::sync_with_stdio(false);
    cin.tie(NULL);
      ll c,d,e,f,g,r,i,x=0,sum,l,v,aa,bb,y;
     ll n;
      cin>>n;
     string s,t;
      cin>>s;
       t=s;
        sum=0;
       reverse(t.begin(),t.end());
        char f;
       for(i=0;i<n;i++)
       { if(t[i]=='1')
            sum+=pow(2,i);
       }
        for(i=0;i<n;i++)
        {    c=sum;
              d=0;  
            if(s[i]=='0')
           c+=1LL<<(n-i-1);
              else
           c-=1LL<<(n-i-1); 
             while(c)
             { c=c%(__builtin_popcount(c)); 
                 d++;
             }
             cout<<d<<endl;
        }

  }


Compiler output:
a.cc: In function 'int main()':
a.cc:15:14: error: conflicting declaration 'char f'
   15 |         char f;
      |              ^
a.cc:7:16: note: previous declaration as 'long long int f'
    7 |       ll c,d,e,f,g,r,i,x=0,sum,l,v,aa,bb,y;
      |                ^
Language: C++

#include<bits/stdc++.h>
 using namespace std;
 #define ll long long int
 int main()
  {  ios::_sync_with_stdio(0);cin.tie(0);cout.tie(0);
      ll c,d,e,f,g,r,i,x=0,sum,l,v,aa,bb,y;
     ll n;
      cin>>n;
     string s,t;
      cin>>s;
       t=s;
        sum=0;
       reverse(t.begin(),t.end());
       for(i=0;i<n;i++)
       { if(t[i]=='1')
            sum+=pow(2,i);
       }
        for(i=0;i<n;i++)
        {    c=sum;
        d=0;
            if(s[i]=='0')
              {s[i]='1';
           c+=pow(2,n-i-1);
              }
              else
              {  s[i]='0';
           c-=pow(2,n-i-1);
              }
             while(c)
             { c=c%(__builtin_popcount(c));
                 d++;
             }
             cout<<d<<endl;
        }

  }


Compiler output:
a.cc: In function 'int main()':
a.cc:5:11: error: '_sync_with_stdio' is not a member of 'std::ios' {aka 'std::basic_ios<char>'}
    5 |   {  ios::_sync_with_stdio(0);cin.tie(0);cout.tie(0);
      |           ^~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define INF pow(10, 9) + 7
#define rep(i, N) for(ll i = 0; i < N; i++)
#define rep2(i, j, k) for(ll i = j; i < k; i++)
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define chmax(x, y) x = max(x, y)
#define print(x) cout << x << "\n"
#define ALL(v) v.begin(), v.end()
#define SUM(v) accumulate(ALL(v), 0)
#define MAX(v) *max_element(ALL(v))
#define MIN(v) *min_element(ALL(v))
#define SORT(v) sort(ALL(v))
#define REV(v) reverse(ALL(v))
typedef long long ll;
using namespace std;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vs = vector<string>;
using vvs = vector<vector<string>>;

void solve(){
	
	ll N, pop_count;
	string X;
	cin >> N >> X;
	vl ans(N, 1);
	vl A(N);
	
	ll cnt = 0;
	
	ll M0 = 0;
	ll M1 = 0;
	ll temp0 = 1;
	ll temp1 = 1;
	
	rep(i, N)  cnt += X[i] == '1';
	
	rep(i, N){
		if(X[N - 1 - i] == '1'){
			if(cnt != 1)  M0 = (M0 + temp0) % (cnt - 1);
			M1 = (M1 + temp1) % (cnt + 1);
		}
		if(cnt != 1)  temp0 = (temp0 * 2) % (cnt - 1);
		temp1 = (temp1 * 2) % (cnt + 1);
	}
	
	temp0 = 1;
	temp1 = 1;

	rep(i, N){
		
		if(X[N - 1 - i] == '0')  A[N - 1 - i] = (M1 + temp1) % (cnt + 1);

		else{
			if(cnt == 1){
				A[i] = 0;
				ans[N - 1 - i] -= 1;
			}
			else{
				A[N - 1 - i] = (M0 - temp0) % (cnt - 1);
				A[N - 1 - i] = A[N - 1 - i] + (cnt - 1);
				
		}
		
		if(cnt != 1)  temp0 = (temp0 * 2) % (cnt - 1);
		temp1 = (temp1 * 2) % (cnt + 1);
		
	}

	rep(i, N){
		
		while(A[i]){
			
			pop_count = __builtin_popcount(A[i]);
			A[i] %= pop_count;
			ans[i] += 1;
			
		}
		
	}
	
	rep(i, N)  print(ans[i]);

}	

int main(){
    
    fastio;
	solve();
    
	return 0;
	
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:86:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   86 | int main(){
      |         ^~
a.cc:86:9: note: remove parentheses to default-initialize a variable
   86 | int main(){
      |         ^~
      |         --
a.cc:86:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:86:11: error: a function-definition is not allowed here before '{' token
   86 | int main(){
      |           ^
a.cc:93:2: error: expected '}' at end of input
   93 | }
      |  ^
a.cc:21:13: note: to match this '{'
   21 | void solve(){
      |             ^
Language: C++

#include <bits/stdc++.h>
#define INF pow(10, 9) + 7
#define rep(i, N) for(ll i = 0; i < N; i++)
#define rep2(i, j, k) for(ll i = j; i < k; i++)
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define chmax(x, y) x = max(x, y)
#define print(x) cout << x << "\n"
#define ALL(v) v.begin(), v.end()
#define SUM(v) accumulate(ALL(v), 0)
#define MAX(v) *max_element(ALL(v))
#define MIN(v) *min_element(ALL(v))
#define SORT(v) sort(ALL(v))
#define REV(v) reverse(ALL(v))
typedef long long ll;
using namespace std;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vs = vector<string>;
using vvs = vector<vector<string>>;

void solve(){
	
	ll N, pop_count;
	string X;
	cin >> N >> X;
	vl ans(N, 1);
	vl A(N);
	
	ll cnt = 0;
	
	ll M0 = 0;
	ll M1 = 0;
	ll temp0 = 1;
	ll temp1 = 1;
	
	rep(i, N)  cnt += X[i] == '1';
	
	rep(i, N){
		if(X[N - 1 - i] == '1'){
			if(cnt != 1)  M0 = (M0 + temp0) % (cnt - 1);
			M1 = (M1 + temp1) % (cnt + 1);
		}
		if(cnt != 1)  temp0 = (temp0 * 2) % (cnt - 1);
		temp1 = (temp1 * 2) % (cnt + 1);
	}
	
	temp0 = 1;
	temp1 = 1;

	rep(i, N){
		
		if(X[N - 1 - i] == '0')  A[N - 1 - i] = (M1 + temp1) % (cnt + 1);

		else{
			if(cnt == 1){
				A[i] = 0;
				ans[N - 1 - i] -= 1;
			}
			else{
				A[N - 1 - i] = (M0 - temp0) % (cnt - 1);
				A[N - 1 - i] = A[N - 1 - i] + (cnt - 1)
				
		}
		
		if(cnt != 1)  temp0 = (temp0 * 2) % (cnt - 1);
		temp1 = (temp1 * 2) % (cnt + 1);
		
	}

	rep(i, N){
		
		while(A[i]){
			
			pop_count = __builtin_popcount(A[i]);
			A[i] %= pop_count;
			ans[i] += 1;
			
		}
		
	}
	
	rep(i, N)  print(ans[i]);

}	

int main(){
    
    fastio;
	solve();
    
	return 0;
	
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:61:72: error: expected ';' before '}' token
   61 |                                 A[N - 1 - i] = A[N - 1 - i] + (cnt - 1)
      |                                                                        ^
      |                                                                        ;
   62 | 
   63 |                 }
      |                 ~                                                       
a.cc:86:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   86 | int main(){
      |         ^~
a.cc:86:9: note: remove parentheses to default-initialize a variable
   86 | int main(){
      |         ^~
      |         --
a.cc:86:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:86:11: error: a function-definition is not allowed here before '{' token
   86 | int main(){
      |           ^
a.cc:93:2: error: expected '}' at end of input
   93 | }
      |  ^
a.cc:21:13: note: to match this '{'
   21 | void solve(){
      |             ^
Language: C++

N = int(input())
X = input()
ans = [1] * N
A = [0] * N

cnt = X.count("1")
M0 = 0
M1 = 0
temp0 = 1
temp1 = 1

for i in range(N):
    if(X[N - 1 - i] == '1'):
        if(cnt != 1):
            M0 = (M0 + temp0) % (cnt - 1)
        M1 = (M1 + temp1) % (cnt + 1)

    if(cnt != 1):
        temp0 = (temp0 * 2) % (cnt - 1)
    temp1 = (temp1 * 2) % (cnt + 1)

temp0 = 1
temp1 = 1

for i in range(N):

    if(X[N - 1 - i] == '0'):
        A[N - 1 - i] = (M1 + temp1) % (cnt + 1)

    else:
        if(cnt == 1):
            A[i] = 0
            ans[N - 1 - i] -= 1
        
        else:
            A[N - 1 - i] = abs(M0 - temp0) % (cnt - 1)

    if(cnt != 1):
        temp0 = (temp0 * 2) % (cnt - 1)
    temp1 = (temp1 * 2) % (cnt + 1)

for i in range(N):

    while(A[i]):

        pop_count = bin(A[i]).count("1")
        A[i] %= pop_count
        ans[i] += 1

for i in range(N):  print(ans[i]);

Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N = int(input())
      | ^
Language: C

#include <gmp.h>
int main()
{
  mpz_t a,b,c;
  // 初期化
  mpz_init(a);
  mpz_set_ui(a,1234567890);
  // 初期化してわりあて
  mpz_init_set_ui(b,9876543210);
  mpz_init_set_ui(c,1234987654321);

  gmp_printf ("mpz_init_set_ui %Zd\n", a);
  gmp_printf ("mpz_init_set_ui %Zd\n", b);
  gmp_printf ("mpz_init_set_ui %Zd\n", c);

  // mpz_tをmpz_tへコピー
  mpz_set(b,a);
  gmp_printf ("mpz_set %Zd\n", b);

// 文字列から数値を生成
mpz_set_str(a,"12394872039846520983745092837458238947528346283745802837468238947520137489572463589",10);
  mpz_set_str(b,"39846520983745092837458238947528346283745802837468238947520137489572463589",10);
  mpz_set_str(c,"12394872039846520983745092837458238947528346283745802837468238947520137489572463589",10);

  gmp_printf ("mpz_set_str %Zd\n", a);
  gmp_printf ("mpz_set_str %Zd\n", b);
  gmp_printf ("mpz_set_str %Zd\n", c);
  return 0;
}


Compiler output:
/usr/bin/ld: /tmp/cchm6kja.o: in function `main':
main.c:(.text+0x10): undefined reference to `__gmpz_init'
/usr/bin/ld: main.c:(.text+0x21): undefined reference to `__gmpz_set_ui'
/usr/bin/ld: main.c:(.text+0x3a): undefined reference to `__gmpz_init_set_ui'
/usr/bin/ld: main.c:(.text+0x53): undefined reference to `__gmpz_init_set_ui'
/usr/bin/ld: main.c:(.text+0x6e): undefined reference to `__gmp_printf'
/usr/bin/ld: main.c:(.text+0x89): undefined reference to `__gmp_printf'
/usr/bin/ld: main.c:(.text+0xa4): undefined reference to `__gmp_printf'
/usr/bin/ld: main.c:(.text+0xb7): undefined reference to `__gmpz_set'
/usr/bin/ld: main.c:(.text+0xd2): undefined reference to `__gmp_printf'
/usr/bin/ld: main.c:(.text+0xed): undefined reference to `__gmpz_set_str'
/usr/bin/ld: main.c:(.text+0x108): undefined reference to `__gmpz_set_str'
/usr/bin/ld: main.c:(.text+0x123): undefined reference to `__gmpz_set_str'
/usr/bin/ld: main.c:(.text+0x13e): undefined reference to `__gmp_printf'
/usr/bin/ld: main.c:(.text+0x159): undefined reference to `__gmp_printf'
/usr/bin/ld: main.c:(.text+0x174): undefined reference to `__gmp_printf'
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>

using namespace std;
// change
const int MOD = 1000000007;

ll modpow(ll a,ll n,ll mod){
  ll ans=1;
  while(n>0){
    if(n&1){
      ans=ans*a%mod;
    }

    a=a*a%mod;
    /*
    n>>=1;
    */
   n/=2;
  }

  return ans;
}

void Solve();


signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(20)<<fixed;
  Solve();
}



/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
//segtreeの葉の先頭の添え字はN-1
void Solve(){
  int n;
  scanf("%d",&n);
  char s[n+10];
  scanf("%s",s);
 
  int count=0;
  for(int i=n-1;i>=0;i--){
    if(s[i]=='1'){
      count++;
    }
  }
 
  int prep=0;
  int prem=0;
 
  int now=1;
  for(int i=n-1;i>=0;i--){
    int a=s[i]-'0';
    prep+=now*a;
    prep%=(count+1);
    now*=2;
    now%=(count+1);
  }
  now=1;
 
  if(count>1){
    for(int i=n-1;i>=0;i--){
      int a=s[i]-'0';
      prem+=now*a;
      prem%=(count-1);
      now*=2;
      now%=(count-1);
    }
  }
 
  for(int i=0;i<n;i++){
    int x=0;
    int ans=1;
    if(s[i]=='0'){
      x=prep;
      x+=modpow(2,n-1-i,count+1);
      x%=(count+1);
    }
    else if(count==1 && s[i]=='1'){
      printf("0\n");
      continue;
    }
    else{
      x=prem;
      x-=modpow(2,n-1-i,count-1);
      x+=2*(count-1);
      x%=(count-1);
    }
 
    int past=x;
    int cnt=0;
    while(past!=0){
      cnt=0;
      x=past;
      while(x!=0){
        if(x%2==1){
          cnt++;
        }
        x/=2;
      }
 
      if(cnt==0){
        ans++;
        break;
      }
      past=past%cnt;
      ans++;
    }
 
    printf("%d\n",ans);
  }
}


Compiler output:
a.cc:7:1: error: 'll' does not name a type
    7 | ll modpow(ll a,ll n,ll mod){
      | ^~
a.cc: In function 'int main()':
a.cc:30:9: error: 'setprecision' was not declared in this scope
   30 |   cout<<setprecision(20)<<fixed;
      |         ^~~~~~~~~~~~
a.cc:2:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
    1 | #include<iostream>
  +++ |+#include <iomanip>
    2 | 
a.cc: In function 'void Solve()':
a.cc:83:10: error: 'modpow' was not declared in this scope
   83 |       x+=modpow(2,n-1-i,count+1);
      |          ^~~~~~
a.cc:92:10: error: 'modpow' was not declared in this scope
   92 |       x-=modpow(2,n-1-i,count-1);
      |          ^~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define pb push_back
set<int > se;


int main(){
	int n;
	cin >> n;

	string s;
	cin >> s;

	// cout << n << s << endl;

	int value =0;
	int initsetbits =0;
	int powcoun =0;
	for (int j = news.size()-1; j>=0; --j)
	{
		
		if(news[j] == '1'){
			initsetbits++;
		}

		value = value + (news[j]-'0')*pow(2,powcoun++);
	} 

	
	for (int i = 0; i <s.size(); ++i)
	{
		
		int len = s.size();
		// vector<int > news(len);
		string news = s;

		// news[i] = (s[i]=='0') ? '1' : '0';

		int setbits = initsetbits;
		int count = value;
		if(s[i] =='0'){
			setbits++;
			count = count + pow(2,s.size()-i-1);
		}
		else{
			setbits--;
			count = count - pow(2,s.size()-i-1);
		}

		int rem = count%setbits;
		if(rem == 0){
			cout << 1 << endl;
		}
		else{
			count = rem;
			setbits =0;
			int ans = 1;

			while(rem!=0){
				setbits =  __builtin_popcount(count);
				rem = count%setbits;
				ans++;	
			}

			cout << ans << endl;
		}

		
		
	}
	


}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:22: error: 'news' was not declared in this scope
   20 |         for (int j = news.size()-1; j>=0; --j)
      |                      ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//(a+b-1)/b
//priority_queue<ll, vector<ll>, greater<ll>> q;
using pl = pair<ll,ll>;
using vvb=vector<vector<bool>>;
using vb= vector<bool>;
ll f(ll a,ll b,ll p){
	if(b==0) return 1;
	if(b%2==0){
		ll t=f(a,b/2,p);
		return t*t%p;
	}
	return a*(f(a,b-1,p))%p;
} 

//__builtin_popcount()
signed main(){
	int n; cin>>n;
	if(n==1){
		if(s=="0")cout<<1<<endl;
		else cout<<0<<endl;
		return 0;
	}
	string s; cin>>s;
	string t=s;
	reverse(all(t));
	vl memo1(n),memo2(n);
	ll sum1=0,sum2=0;
	if(t[0]=='1')sum1=1,sum2=1;
	ll cnt=0;
	rep(i,0,n)cnt+=(s[i]=='1');
	memo1[0]=1; memo2[0]=1;
	rep(i,1,n){
		memo1[i]=memo1[i-1]*2%(cnt+1);
		memo2[i]=memo2[i-1]*2%(cnt-1);
		if(t[i]=='1'){
			sum1+=memo1[i];
			sum1%=(cnt+1);
			sum2+=memo2[i];
			sum2%=(cnt-1);
		}
	}
	vl ans(n);
	rep(i,0,n){
		ll j;
		if(t[i]=='0'){
			j=sum1;
			j+=memo1[i];
			j%=(cnt+1);
		}
		else{
			j=sum2;
			j-=memo2[i];
			if(j<0)j+=(cnt-1);
			j%=(cnt-1);
		}

		ll add=1;
		while(j>0){
			j%=__builtin_popcount(j);
			add++;
		}
		ans[i]=add;
	}
	reverse(all(ans));
	rep(i,0,n)cout<<ans[i]<<endl;


	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:20: error: 's' was not declared in this scope
   32 |                 if(s=="0")cout<<1<<endl;
      |                    ^
Language: C++

#include <iostream>

using namespace std;

long long int ModPow(long long int a, long long int p, long long int M){
  long long int res = 1;
  long long int f = a;
  while(p > 0){
    if(p & 1){
      res = (res * f) % M;
    }
    f = (f*f)%M
    p >>= 1;
  }
  return res;
}

long long int Popcount(long long int X){
  long long int cntr = 0;
  while(X > 0){
    if(X & 1)
      cntr++;
    X >>= 1;
  }
  return cntr;
};

int main(){
  int N;
  cin >> N;
  string s;
  long long int baseM = 0;
  long long int baseR = 0;
  for(int i = 0; i < N; i++){
    char c;
    cin >> c;
    s.push_bakc(c);
    if(c - '0')
      baseM++;
  }
  for(int i = 0; i < N; i++){
    if(s[i] - '0')
      baseR = (baseR + ModPow(2, N-i-1, baseM))%M;
  }
  cout << 0;
}

Compiler output:
a.cc: In function 'long long int ModPow(long long int, long long int, long long int)':
a.cc:12:16: error: expected ';' before 'p'
   12 |     f = (f*f)%M
      |                ^
      |                ;
   13 |     p >>= 1;
      |     ~           
a.cc: In function 'int main()':
a.cc:37:7: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'push_bakc'; did you mean 'push_back'?
   37 |     s.push_bakc(c);
      |       ^~~~~~~~~
      |       push_back
a.cc:43:49: error: 'M' was not declared in this scope
   43 |       baseR = (baseR + ModPow(2, N-i-1, baseM))%M;
      |                                                 ^
Language: C++

#include <bits/stdc++.h>
#include<unordered_map>
using namespace std;

typedef long long ll;
const ll mod = 1e9 + 7;
const int N=2000000;
const int M=2000;

void Run()
{
     ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
int op[N];
int zero[N];
int one[N];
 
int main()
{
    int n;
    cin >> n;
    string s;
    cin >> s;
 
    int cnt = 0;
    int len = s.size();
    for(int i = 0; i < len; ++i)
    {
        if(s[i] == '1')
            cnt++;
    }
 
    for(int i = 1; i < N; ++i)
    {
        int tmp = 0;
        for(int j = 0; j < 20; ++j)
        {
            if(i & (1  j))
                tmp++;
        }
        op[i] = op[i % tmp] + 1;
    }
 
    ll sum0 = 0, sum1 = 0;
    ll tmp0 = 1, tmp1 = 1;
    for(int i = len - 1; i >= 0; --i)
    {
        tmp0 = (tmp0 << 1) % (cnt + 1);
        if(cnt == 1)tmp1 = 0;
        else tmp1 = (tmp1 << 1) % (cnt - 1);
 
        if(s[i] == '1')
        {
            sum0 = (sum0 + tmp0) % (cnt + 1);
            if(cnt == 1)sum1 = 0;
            else sum1 = (sum1 + tmp1) % (cnt - 1);
        }
 
    }
 
    zero[0] = 1;
    one[0] = (cnt == 1 ? 0 : 1);
    for(int i = len - 2; i >= 0; --i)
    {
        zero[len - i - 1] = (zero[len - i - 2]) % (cnt + 1);
        one[len - i - 1] = (cnt == 1 ? 0 : (one[len - i - 2] 1) % (cnt - 1));
    }
 
    for(int i = 0; i < len; ++i)
    {
        int t = len - i - 1;
        if(s[i] == '0')
        {
           int r = (sum0 + zero[t]) % (cnt + 1);
           cout << (1 + op[r]) << endl;
        }
        else
        {
            int r = (cnt == 1 ? 0 : ((sum1 - one[t]) % (cnt - 1)));
            cout << (1 + op[r]) << endl;
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:22: error: expected ')' before 'j'
   38 |             if(i & (1  j))
      |                    ~ ^ ~
      |                      )
a.cc:39:22: error: expected ')' before ';' token
   39 |                 tmp++;
      |                      ^
      |                      )
a.cc:38:15: note: to match this '('
   38 |             if(i & (1  j))
      |               ^
a.cc:66:61: error: expected ')' before numeric constant
   66 |         one[len - i - 1] = (cnt == 1 ? 0 : (one[len - i - 2] 1) % (cnt - 1));
      |                                            ~                ^~
      |                                                             )
a.cc:66:77: error: expected ')' before ';' token
   66 |         one[len - i - 1] = (cnt == 1 ? 0 : (one[len - i - 2] 1) % (cnt - 1));
      |                            ~                                                ^
      |                                                                             )
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define int long long
#define endl "\n"
#define pii pair<int,int> 
#define ff first
#define ss second
#define mii map<int,int>
#define si set<int>
#define sti stack<int>
#define qi queue<int>
#define vi vector<int>
#define pq priority_queue<int>
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
//const int M=1e9+7;

power(int n,int x,int M){
	if(x==0) return(1);
	int y=power(n,x/2,M);
	y=(y*y)%M;
	if(x%2==0) return(y);
	else return((y*n)%M);
}

void solve(){
	int n;
	cin>>n;
	string s; cin>>s;
	int bits=0;
	for(auto x:s) if(x=='1') bits++;
	int x1=0,x2=0;
	if(bits-1>0){
		for(int i=0;i<s.size();i++){if(s[i]=='1') x1=(power(2,n-i-1,bits-1)+x1)%(bits-1);}
	}
	for(int i=0;i<s.size();i++){if(s[i]=='1') x2=(power(2,n-i-1,bits+1)+x2)%(bits+1);}
	cout<<endl;
	cout<<x1<<" "<<x2<<endl;
	for(int i=0;i<s.size();i++){
		int x=0;
		if(s[i]=='1'){
			if(bits-1==0){cout<<0<<endl;continue;}
			else{
				x=(x1+(bits-1)-power(2,n-i-1,bits-1))%(bits-1);
			}
		}
		else{
			x=(x2+power(2,n-i-1,bits+1))%(bits+1);
		}
		int ans=1;
		while(x!=0){
			int y=__builtin_popcount(x);
			x%=y;
			ans++;
		}
		cout<<ans<<endl;
	}
}

int32_t main(){
	int t=1;
	//cin>>t;
	while(t--){
		solve();	
	}
}

Compiler output:
a.cc:18:1: error: ISO C++ forbids declaration of 'power' with no type [-fpermissive]
   18 | power(int n,int x,int M){
      | ^~~~~
Language: Java

#include <iostream>
using namespace std;
typedef long long ll;
const int N=2e5+5;
int ans[N];
int pow(ll x,int y,int mod){
    ll ans=1;
    while(y){
        if(y&1) ans=ans*x%mod;
        x=x*x%mod;
    }
    return ans;
}
ll x1[N],x2[N];
void init(){
    for(int i=1; i<N; i++) {
        int y=i,z=0;
        while(y) {
            if(y&1) z++;
            y>>=1;
        }
        ans[i]=ans[i%z]+1;
    }
}

int main() {
    init();
    int n;
    string s;
    cin>>n;
    cin>>s;
    int cnt=0;
    ll sum1=0,sum2=0;
    for(int i=0;i<n;i++){
        if(s[i]=='1')cnt++;
    }
    x1[0]=x2[0]=1;
    for(int i=1;i<n;i++){
        x1[i]=x1[i-1]*2%(cnt-1);
        x2[i]=x2[i-1]*2%(cnt+1);
    }
    for(int i=0;i<n;i++){
        if(s[i]=='1'){
            sum1=(sum1+x1[n-i-1])%(cnt-1);
            sum2=(sum2+x2[n-i-1])%(cnt+1);
        }
    }
    for(int i=0;i<n;i++){
        int sum;
        if(s[i]=='1'){
            sum=(sum1-x1[n-i-1]+cnt-1)%(cnt-1);

        }
        else {
            sum=(sum2+x2[n-i-1])%(cnt+1);
        }
        cout<<ans[sum]+1<<"\n";
    }
    return 0;
}


Compiler output:
Main.java:1: error: illegal character: '#'
#include <iostream>
^
Main.java:1: error: class, interface, enum, or record expected
#include <iostream>
         ^
Main.java:3: error: class, interface, enum, or record expected
typedef long long ll;
^
Main.java:4: error: class, interface, enum, or record expected
const int N=2e5+5;
^
Main.java:5: error: class, interface, enum, or record expected
int ans[N];
^
Main.java:6: error: unnamed classes are a preview feature and are disabled by default.
int pow(ll x,int y,int mod){
^
  (use --enable-preview to enable unnamed classes)
Main.java:14: error: class, interface, enum, or record expected
ll x1[N],x2[N];
^
Main.java:30: error: not a statement
    cin>>n;
       ^
Main.java:31: error: not a statement
    cin>>s;
       ^
Main.java:57: error: not a statement
        cout<<ans[sum]+1<<"\n";
                        ^
10 errors
Language: C++

#include<bits/stdc++.h>
#define ll long long
using namespace std;
/*ll quickpow(ll a,ll b,ll mod)
{
	ll ans=1,base=a;
	while(b)
	{
		if(b&1)
		ans=(ans*base)%mod;
		ans=(ans*ans)%mod;
		b>>=1;
	}return ans%mod;
 } */
ll power(ll a,ll b,ll mod){return b?power(a*a%mod,b/2,mod)*(b%2?a:1)%mod:1;}
ll cal(ll n)
{
    ll cnt=1;
    while(n)
	{
        n=n%__builtin_popcount(n);
        cnt++;
    }
    return cnt;
}
int main()
{
    ll n,cnt=0,ans1=0,ans2=0,ans;
    string s;
    cin>>n>>s;
    for(int i=0;i<n;i++)
	{
        if(s[i]=='1') cnt++;
    }
    if(cnt>1)
	{
        for(ll i=0;i<n;i++)
		{
            if(s[i]=='1') ans1=(ans1+quickpow(2,n-i-1,cnt-1))%(cnt-1);
			ans2=(ans2+quickpow(2,n-i-1,cnt+1))%(cnt+1);
        }
        for(ll i=0;i<n;i++)
		{
            if(s[i]=='0')
			{
                ans=(ans2+quickpow(2,n-i-1,cnt+1))%(cnt+1);
                cout<<cal(ans)<<endl;
            }else
			{
                ans=(ans1+((cnt-1)-quickpow(2,n-i-1,cnt-1)%(cnt-1))%(cnt-1))%(cnt-1);
                cout<<cal(ans)<<endl;
            }
        }
    }
	else if(cnt==1)
	{
        for(int i=0;i<n;i++)
		{
            if(s[i]=='1') ans2=(ans2+quickpow(2,n-i-1,cnt+1))%(cnt+1);
        }
        for(ll i=0;i<n;i++)
		{
            if(s[i]=='0')
			{
                ans=(ans2+quickpow(2,n-i-1,cnt+1))%(cnt+1);
                cout<<cal(ans)<<endl;
            }else
			{
                cout<<0<<endl;
            }
        }
    }
	else
	{
        for(int i=0;i<n;i++) cout<<1<<endl;
    }
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:38: error: 'quickpow' was not declared in this scope
   39 |             if(s[i]=='1') ans1=(ans1+quickpow(2,n-i-1,cnt-1))%(cnt-1);
      |                                      ^~~~~~~~
a.cc:40:36: error: 'quickpow' was not declared in this scope
   40 |                         ans2=(ans2+quickpow(2,n-i-1,cnt+1))%(cnt+1);
      |                                    ^~~~~~~~
a.cc:46:27: error: 'quickpow' was not declared in this scope
   46 |                 ans=(ans2+quickpow(2,n-i-1,cnt+1))%(cnt+1);
      |                           ^~~~~~~~
a.cc:50:36: error: 'quickpow' was not declared in this scope
   50 |                 ans=(ans1+((cnt-1)-quickpow(2,n-i-1,cnt-1)%(cnt-1))%(cnt-1))%(cnt-1);
      |                                    ^~~~~~~~
a.cc:59:38: error: 'quickpow' was not declared in this scope
   59 |             if(s[i]=='1') ans2=(ans2+quickpow(2,n-i-1,cnt+1))%(cnt+1);
      |                                      ^~~~~~~~
a.cc:65:27: error: 'quickpow' was not declared in this scope
   65 |                 ans=(ans2+quickpow(2,n-i-1,cnt+1))%(cnt+1);
      |                           ^~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

const int mxN=2e5;

ll func(ll u)
{
	ll cnt = 0;
	while(u){
		ll tmp = __builtin_popcount(u);
		u %= tmp;
		cnt++;
	}
	return cnt;
}
void print_bin(ll u)
{
	while(u){
		if(u&1){
			cout << 1;
		}
		else{
			cout << 0;
		}
		u >>= 1;
	}
	cout << '\n';
}

int main()
{
	ll n;
	string xx;
	cin >> n >> xx;
	ll x = stoi(xx, 0, 2);

	//cout << x << '\n';
	for(ll i = n-1; i >= 0; i--){
		ll y = x ^ (1<<i);
		//print_bin(y);	
		cout << func(y) << '\n';
	}
	return 0;
}


Compiler output:
a.cc:6:1: error: 'll' does not name a type
    6 | ll func(ll u)
      | ^~
a.cc:16:6: error: variable or field 'print_bin' declared void
   16 | void print_bin(ll u)
      |      ^~~~~~~~~
a.cc:16:16: error: 'll' was not declared in this scope
   16 | void print_bin(ll u)
      |                ^~
a.cc: In function 'int main()':
a.cc:32:9: error: 'll' was not declared in this scope
   32 |         ll n;
      |         ^~
a.cc:34:16: error: 'n' was not declared in this scope; did you mean 'yn'?
   34 |         cin >> n >> xx;
      |                ^
      |                yn
a.cc:35:11: error: expected ';' before 'x'
   35 |         ll x = stoi(xx, 0, 2);
      |           ^~
      |           ;
a.cc:38:15: error: expected ';' before 'i'
   38 |         for(ll i = n-1; i >= 0; i--){
      |               ^~
      |               ;
a.cc:38:25: error: 'i' was not declared in this scope
   38 |         for(ll i = n-1; i >= 0; i--){
      |                         ^
a.cc:39:19: error: expected ';' before 'y'
   39 |                 ll y = x ^ (1<<i);
      |                   ^~
      |                   ;
a.cc:41:30: error: 'y' was not declared in this scope; did you mean 'yn'?
   41 |                 cout << func(y) << '\n';
      |                              ^
      |                              yn
a.cc:41:25: error: 'func' was not declared in this scope
   41 |                 cout << func(y) << '\n';
      |                         ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define REPr(i, n) for(int i = (n)-1; i >= 0; --i)
#define FORq(i, m, n) for(int i = (m); i <= (n); ++i)
#define FORqr(i, m, n) for(int i = (n); i >= (m); --i)
#define MP make_pair
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x, 0, sizeof(x))
#define FILL(x, y) memset(x, y, sizeof(x))
#define MM(x) memset(x, -1, sizeof(x))
#define ALL(x) (x).begin(), (x).end()
#define DB(x) cerr << #x << " = " << x << endl
#define DB2(x, y)                                                              \
    cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n";
#define DEBUG                                                                  \
    int x12345;                                                                \
    cin >> x12345;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
const long long MOD = 1e9 + 7;
///////////////////////////////////////////////
// for template
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;
}
///////////////////////////////////////////////
/// 🍈( '-' 🍈 |AC|
const int N_MAX = 202;

ll popcnt(string S){
    int N = S.length();
    int cnt = 0;
    REP(i,N){
        if (S[i] == '1') cnt++;
    }
    return cnt;
}

ll firstcomp(string S, ll m){
    if (m == -1) return -1;
    int N = S.length();
    ll Bs = 1;
    ll ret = 0;
    REPr(i,N){
        if (S[i] == '1') ret += Bs % m;
        ret %= m;
        Bs *= 2;
        Bs %= m
    }
    return ret % m;
}

ll secondcomp(ll x){
    ll ret = 0;
    while(__builtin_popcountll(x) != 0){
        x = x % __builtin_popcountll(x);
        ret++;
    }
    return ret;
}

int main() {
    int N; cin >> N;
    string S; cin >> S;
    ll cnt0 = firstcomp(S, popcnt(S));
    ll cnt1 = firstcomp(S, popcnt(S) + 1);
    ll cnt2 = firstcomp(S, popcnt(S) - 1);

    ll pcnt = popcnt(S);

    vector<ll> bin1(N+3),bin2(N+3);
    bin1[0] = 1 % (pcnt + 1);
     if (pcnt != 1) bin2[0] = 1 % (pcnt - 1);
    for(int i = 1; i <= N + 1; i++){
        bin1[i] = (bin1[i-1] * 2) % (pcnt + 1);
        if (pcnt != 1) bin2[i] = (bin2[i-1] * 2) % (pcnt - 1);
    }

    REP(i,N){
        if (S[i] == '0'){
            cout << 1 + secondcomp((cnt1 + (bin1[N - i - 1])) % (pcnt + 1) ) << "\n";
        }else{
            //cout << "cnt2 = " << cnt2 << "\n";
            //cout << "bin2[N-i-1] = " << bin2[N - i - 1] << "\n";
            ll secin = ((cnt2 - (bin2[N - i - 1])) + (pcnt - 1)) % (pcnt - 1);
            cout << 1 + secondcomp(secin) << "\n";
        }
    }
}

Compiler output:
a.cc: In function 'll firstcomp(std::string, ll)':
a.cc:67:16: error: expected ';' before '}' token
   67 |         Bs %= m
      |                ^
      |                ;
   68 |     }
      |     ~