chef and power 2(http://www.codechef.com/CDAV2014/problems/POWER)

why my answer was not accepted

#include<stdio.h>
int f(long long int );
int p(long long int,long long int ,long long int);
int main()
{
int t;
scanf("%d",&t);
while(t–)
{
long long int n,s,m=1000000007,a,b;
scanf("%lld",&n);
s=f(n);

	a=(n*f(n))%m;
	
	b=p(2,a,m);
	printf("%lld\n",b);
	
}
return(0);

}

int f(long long int n)
{
long long int c=0,r;
while(n)
{
r=n%2;
if(r==1)
c++;
n=n/2;
}
return©;
}
int p(long long int a,long long int n,long long int m)
{
long long int res=1;
while (n)
if(n&1){
res=(resa)%m;
–n;
}
else{
a=(a
a)%m;
n>>=1;
}
return (res%m) ;
}

I guess it should be b=p(2,n*f(n),m) . a^b mod m is not equal to (a^(b mod m))mod m

I think there is a misprint in the question instead of 2^(n^f(n)) the answer asked is 2^(n *f(n)).
For n = 3 your answer is 512 whereas it should be 64.

Can you post the link of your solution here?