What is wrong in this program .It sayhs wrong answer. Throws an error where as this program works fine in my pc.

#include <stdio.h>

int main()
 {
long int n;
long int k;
long int a;
long int b;
int t;
int ca=0;
int cb=0;
int j=0;
int i=1;
scanf("%d",&t);
while(j<t)
{
scanf("%d%d%d%d",&n,&a,&b,&k);
if((1<=t) && (t<=15) && (1<=k) && (k<=n) && (n<=10^18) && (1<=a) && (a<=10^9) && (1<=b) && (b<=10^9))
{
	while(n>=i)
	{
	if((i%a) == 0 && !((i%b) == 0))ca++;
 	if((i%b) == 0 && !((i%a) == 0))cb++;
	//printf("t=%d n=%d i=%d i<=n=%d a=%d b=%d (i/a)=%d (i/b)=%d ca=%d cb=%d\n",t,n,i,(n>=i),a,b,(i%a),(i%b),ca,cb);
	i++;
	}

}	
printf("ca=%d cb=%d\n",ca,cb);
if((ca+cb)>=k)
printf("Win\n");
else 
printf("Lose\n");
j++;
}
return 0;

}

Please provide the question link which you are trying to solve. Without it how would we know which solution you are working upon. However if this is a solution for a problem in ongoing contest, please delete it immediately.

Print only what is specified in the input output format. Also, initialise i, ca, cb inside the t loop, everytime.

Also, refer to this for the second subtask.