Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<string>
#include<math.h>
using namespace std;

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

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:12:1: error: extended character   is not valid in an identifier
   12 |     unsigned int count = 0;
      | ^
a.cc:12:1: error: extended character   is not valid in an identifier
a.cc:12:1: error: extended character   is not valid in an identifier
a.cc:12:1: error: extended character   is not valid in an identifier
a.cc:13:1: error: extended character   is not valid in an identifier
   13 |     while (n) {
      | ^
a.cc:13:1: error: extended character   is not valid in an identifier
a.cc:13:1: error: extended character   is not valid in an identifier
a.cc:13:1: error: extended character   is not valid in an identifier
a.cc:14:1: error: extended character   is not valid in an identifier
   14 |            n &= (n - 1);
      | ^
a.cc:14:1: error: extended character   is not valid in an identifier
a.cc:14:1: error: extended character   is not valid in an identifier
a.cc:14:1: error: extended character   is not valid in an identifier
a.cc:14:1: error: extended character   is not valid in an identifier
a.cc:14:1: error: extended character   is not valid in an identifier
a.cc:14:1: error: extended character   is not valid in an identifier
a.cc:14:1: error: extended character   is not valid in an identifier
a.cc:14:1: error: extended character   is not valid in an identifier
a.cc:14:1: error: extended character   is not valid in an identifier
a.cc:14:1: error: extended character   is not valid in an identifier
a.cc:15:1: error: extended character   is not valid in an identifier
   15 |            count++;
      | ^
a.cc:15:1: error: extended character   is not valid in an identifier
a.cc:15:1: error: extended character   is not valid in an identifier
a.cc:15:1: error: extended character   is not valid in an identifier
a.cc:15:1: error: extended character   is not valid in an identifier
a.cc:15:1: error: extended character   is not valid in an identifier
a.cc:15:1: error: extended character   is not valid in an identifier
a.cc:15:1: error: extended character   is not valid in an identifier
a.cc:15:1: error: extended character   is not valid in an identifier
a.cc:15:1: error: extended character   is not valid in an identifier
a.cc:15:1: error: extended character   is not valid in an identifier
a.cc:16:1: error: extended character   is not valid in an identifier
   16 |     }
      | ^
a.cc:16:1: error: extended character   is not valid in an identifier
a.cc:16:1: error: extended character   is not valid in an identifier
a.cc:16:1: error: extended character   is not valid in an identifier
a.cc:17:1: error: extended character   is not valid in an identifier
   17 |     return count;
      | ^
a.cc:17:1: error: extended character   is not valid in an identifier
a.cc:17:1: error: extended character   is not valid in an identifier
a.cc: In function 'unsigned int countSetBits(int)':
a.cc:12:1: error: '\U000000a0\U000000a0\U000000a0\U000000a0unsigned' was not declared in this scope
   12 |     unsigned int count = 0;
      | ^~~~~~~~~~~~
a.cc:13:1: error: '\U000000a0\U000000a0\U000000a0\U000000a0while' was not declared in this scope
   13 |     while (n) {
      | ^~~~~~~~~
a.cc:17:1: error: '\U000000a0\U000000a0\U000000a0' was not declared in this scope
   17 |     return count;
      | ^~~
a.cc:18:1: warning: no return statement in function returning non-void [-Wreturn-type]
   18 | }
      | ^