Modular exponentiation- doubt

code: https://ide.codingblocks.com/s/116890
what is the error? getting wrong answer in testcases

you take modulus each time as constrain are large so value can overflow
#include
using namespace std;

int main() {
long long int a,b,c;
cin>>a>>b>>c;
long long int ans=1;;
while(b>0){
if(b&1){
ans=aans;
ans%=c;
}
a=a
a;
a%=c;
b=b>>1;
}
cout<<ans%c;
return 0;
}