#include <iostream>
using namespace std;
int n;
int a [1000] ;
int f (int x)
{
int ret=0;
for (; x; x&=x-1) ret++;
return ret;
}
int g (int x)
{
return x & -x ;
}
int main ()
{
cin>>n;
for (int i = 0; i < n; i++)scanf("%d",&a[i]);
for (int i=0; i < n; i++)
cout<<f(a[i])+g(a[i]))<<" ";
cout<<endl;
return 0;
}
#include <iostream>
#include <string>
using namespace std;
char base[64] ;
char table[256] ;
void init ()
{
for (int i=0; i<26; i++)base[i]='A'+i;
for (int i=0; i<26; i++)base[26 +i]='a'+i;
for (int i=0; i<10; i++)base[52+i]='0'+i;
base [62] = '+', base[63] ='/';
for (int i =0; i<256; i++)table[i]=0xff;
for (int i =0; i <64; i++) table[base[i]]=i;
table['='] =0;
}
string decode (string str)
{
string ret;
int i;
for (i=0; i < str.size(); i +=4){
ret +=table[str [1]] <<2|table[str[1+1]]>> 4;
if (str[i+2] !='=')
ret += (table[str[i+1] ] &0x0f) <<4|table[str[i+2]] >> 2;
if (str [i+3] !='=')
ret += table[str[i+2] ] << 6 | table[str[i+3]];
}
return ret;
}
int main ()
{
init () ;
cout<<(int)table[0])<<endl;
string str;
cin>>str;
cout<<decode (str) <<endl;
return 0;
}
#include <iostream>
using namespace std;
const int n=100000;
const int N=n+1;
int m;
int a[N], b[N], c[N], d[N] ;
int f[N], g[N] ;
void init ()
{
f[1]=g[1]=1;
for (int i=2; i <= n; i++) {
if (!a[i] ) {
b[m++] =i;
c[i] =1,f[i]=2;
d[i] =1,g[i] =i+1;
}
for (int j = 0; j < m && b[j] * i <= n; j++) {
int k=b[j] ;
a[i*k] =1;
if (i%k==0) {
c[i*k] =c[i] +1;
f[i*k] =f[i] /c[i*k] * (c[i*k]+1) ;
d[i*k] =d[i] ;
g[i*k] =g[i] *k+d[i] ;
break;
}
else {
c[i*k] =1;
f[i*k] =2*f[i] ;
d[i*k] =g[i] ;
g[i*k] =g[i] * (k+1) ;
}
}
}
}
int main ()
{
init () ;
int x;
cin>>x;
cout<<f[x]<<" "<<g[x]<<endl ;
return 0;
}
#include <iostream>
using namespace std;
const int MAXN =1000000;
int F[MAXN];
int main() {
int n;
cin >>n;
int i = 0,p = 0, c = 0;
while (___(1)___) {
if(F[i] == 0 ) {
if(___(2)___) {
F[i] = 1;
___(3)___;
}
___(4)___;
}
___(5)___;
}
int ans = -1;
for (i =0 ; i < n; i++)
if (F[i] == 0)
ans = i;
cout << ans << endl;
return 0;
}
#include <iostream>
using namespace std;
struct point {
int x, y, id;
};
bool equals(point a, point b) {
return a.x == b.x && a.y == b.y;
}
bool cmp(point a, point b) {
return ___(1)___;
}
void sort(point A[], int n) {
for(int i=0; i<n; i++)
for(int j=1; j<n; j++)
if (cmp(A[j], A[j - 1])) {
point t = A[j];
A[j] = A[j - 1];
A[j-1]=t;
}
}
int unique(point A[], int n) {
int t=0;
for(int i=0; i<n; i++)
if (___(2)___)
A[t++] = A[i];
return t;
}
bool binary_search(point A[], int n, int x, int y) {
point p;
p.x = x;
p.y =y;
p.id = n;
int a=0,b=n-1;
while(a<b) {
int mid = ___(3)___;
if (___(4)___)
a=mid+1;
else
b = mid;
}
return equals(A[a], p);
}
const int MAXN = 1000;
point A[MAXN];
int main() {
int n;
cin >> n;
for(int i=0; i<n; i++) {
cin >> A[i].x >> A[i].y;
A[i].id = i;
}
sort(A, n);
n = unique(A, n);
int ans = 0;
for(int i=0; i<n; i++)
for(int j=0; j<n; j++)
if ( ___(5)___ && binary_search(A, n, A[i].x, A[j].y) && binary_search(A, n, A[j].x, A[i].y)) {
ans++;
}
cout<<ans<<endl;
return 0;
}