Language: C++

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

int countSetBits(int n) 
{ 
    int c=0; 
    while(n){ 
           n&=(n - 1); 
           c++; 
    } 
    return c; 
} 

int count(int n){
    int ans=0;
    while(n>0){
        n=n%countSetBits(n);
        ans++;
    }
    return ans;
}

int main()
{
    int n,num=0;cin>>n;
    string s;cin>>s;
    for(int i=n-1,j=0;i>=0,j<n;i--,j++){
        if(s[j]=='1')
        num+=1*pow(2,i);
    }
    int i=n-1,j=0,m;
    while(n--){
       if(s[j]=='1')
          m=num-pow(2,i);
       else
          m=num+pow(2,i);
       cout<<count(m)<<"\n";
       i--,j++;
    }
    return 0;
}

Compiler output:
a.cc:6:1: error: extended character   is not valid in an identifier
    6 |     int c=0;
      | ^
a.cc:6:1: error: extended character   is not valid in an identifier
a.cc:6:1: error: extended character   is not valid in an identifier
a.cc:6:1: error: extended character   is not valid in an identifier
a.cc:7:1: error: extended character   is not valid in an identifier
    7 |     while(n){
      | ^
a.cc:7:1: error: extended character   is not valid in an identifier
a.cc:7:1: error: extended character   is not valid in an identifier
a.cc:7:1: error: extended character   is not valid in an identifier
a.cc:8:1: error: extended character   is not valid in an identifier
    8 |            n&=(n - 1);
      | ^
a.cc:8:1: error: extended character   is not valid in an identifier
a.cc:8:1: error: extended character   is not valid in an identifier
a.cc:8:1: error: extended character   is not valid in an identifier
a.cc:8:1: error: extended character   is not valid in an identifier
a.cc:8:1: error: extended character   is not valid in an identifier
a.cc:8:1: error: extended character   is not valid in an identifier
a.cc:8:1: error: extended character   is not valid in an identifier
a.cc:8:1: error: extended character   is not valid in an identifier
a.cc:8:1: error: extended character   is not valid in an identifier
a.cc:8:1: error: extended character   is not valid in an identifier
a.cc:9:1: error: extended character   is not valid in an identifier
    9 |            c++;
      | ^
a.cc:9:1: error: extended character   is not valid in an identifier
a.cc:9:1: error: extended character   is not valid in an identifier
a.cc:9:1: error: extended character   is not valid in an identifier
a.cc:9:1: error: extended character   is not valid in an identifier
a.cc:9:1: error: extended character   is not valid in an identifier
a.cc:9:1: error: extended character   is not valid in an identifier
a.cc:9:1: error: extended character   is not valid in an identifier
a.cc:9:1: error: extended character   is not valid in an identifier
a.cc:9:1: error: extended character   is not valid in an identifier
a.cc:9:1: error: extended character   is not valid in an identifier
a.cc:10:1: error: extended character   is not valid in an identifier
   10 |     }
      | ^
a.cc:10:1: error: extended character   is not valid in an identifier
a.cc:10:1: error: extended character   is not valid in an identifier
a.cc:10:1: error: extended character   is not valid in an identifier
a.cc:11:1: error: extended character   is not valid in an identifier
   11 |     return c;
      | ^
a.cc:11:1: error: extended character   is not valid in an identifier
a.cc:11:1: error: extended character   is not valid in an identifier
a.cc: In function 'int countSetBits(int)':
a.cc:6:1: error: '\U000000a0\U000000a0\U000000a0\U000000a0int' was not declared in this scope
    6 |     int c=0;
      | ^~~~~~~
a.cc:7:1: error: '\U000000a0\U000000a0\U000000a0\U000000a0while' was not declared in this scope
    7 |     while(n){
      | ^~~~~~~~~
a.cc:11:1: error: '\U000000a0\U000000a0\U000000a0' was not declared in this scope
   11 |     return c;
      | ^~~
a.cc:12:1: warning: no return statement in function returning non-void [-Wreturn-type]
   12 | }
      | ^