2 out of 3 test cases getting failed

for this particular problem
https://hack.codingblocks.com/contests/c/474/64

i cant figure out what are the cases which are giving wrong answer
here are are my seemingly correct solutions
http://ide.codingblocks.com/#/s/13974
http://ide.codingblocks.com/#/s/13975

The value of a^b is very large. Answer is out of integer range.That’s why ans is wrong as it becomes negative if you store a larger than int value in int. Prateek bhaiya has told this that you can use java or python for such cases.They support calculation in very large numbers. I am sharing code for big int in java

    Scanner scn = new Scanner(System.in);
	int n = scn.nextInt();
	int m = scn.nextInt();
	
	BigInteger bn =  BigInteger.valueOf(n);
	BigInteger ans = bn.pow(m);
	System.out.println(ans);

You can try with ‘long long int’ also in C++ if that works.