MGCSET - Editorial

import java.util.*;
class chef2
{
public static void main(String args[])
{

	Scanner sc=new Scanner(System.in);
	int t=sc.nextInt();
	int ar1[]=new int[t];
	int l=0;
	for(int j=0;j<t;j++)
	{
		int f=0;
	int n=sc.nextInt();
	int m=sc.nextInt();
	int ar[]=new int[n];
	for(int i=0;i<n;i++)
	ar[i]=sc.nextInt();
for(int i=0;i<n;i++)
{
	
	for(int r=1;r<=n;r++)
	{ int c=0;
		for(int k=i;k<r;k++)
		{
			if(!(i==0&&r==n))
			c=c+ar[k];
			
		}
		if((c%m==0)&&c!=0)
			f++;
	}
}
	ar1[l]=f;	
	l++;
	}
	for(int i=0;i<t;i++)
	{
		int z=ar1[i];
		System.out.println((int)(Math.pow(2,z)-1));
	}
}

}

whats wrong with this?

hey can anyone tell why this solution is giving WA for second task?..
when i am submitting like this it is giving AC -

int sum=pow(2,freq)-1;
link for correct solution.

https://www.codechef.com/viewsolution/20327375
but when i am using this-

cout pow(2,freq)-1 ;

it is not giving AC
linkā€¦https://www.codechef.com/viewsolution/20329958

thanks in advanceā€¦
@vijju123 @vivek_1998299 @meooow

pow(2,cnt)-1 is giving WA in second test case but 1<<c gives CA. Why?