include
include
int main()
{int t;
long long int a,b,m,i=0,l,k;
scanf("%d",&t);
while(t--)
{
scanf("%lld",&a);
scanf("%lld",&b);
l=a%10;
if(l==1 || l==5 || l==6 || l==0)
printf("%lld\n",l);
else
{if(b==0)
printf("%lld\n",1);
else
{if(l==4 || l==9)
{k=b%2;
if(b%2==0)
m=pow(l,2);
else
m=pow(l,k);
}
else
{if(l==2 || l==3 || l==7 || l==8)
{k=b%4;
if(b%4==0)
m=pow(l,4);
else
m=pow(l,k);
}
}
printf("%lld\n",m%10);
}
}}
return 0;
}
This is my code and it is correct but showing wrong.. What is error can you tell.