My code is giving tle

#include <bits/stdc++.h>
using namespace std;
int main()
{
int test;
cin>>test;
int arr[64]={0};
while(test–)
{
int input;
cin >>input;
int j=0;
while(input>0)
{
int temp=(input&1);
arr[j]=arr[j]+temp;
input>>1;
++j;
}

}
	int p=1;
int sum=0;
for(int i=0;i<64;i++)
{
	arr[i]=arr[i]%3;
		sum=sum+(arr[i]*p);
	p*=2;
	
}
cout<<sum;

}

on line 17

u should assign input = input >> 1;

u werent updating the value therefore u were getting tle

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.