[problem code = TWONMS] my bluej compile is giving right answer but codechef compiler is giving error. HELP !

import java.util.Scanner;

public class two_number

{

public static void main(String args[])
{
    long ali,bob,n,res,max,min,i,j,t;
    Scanner sc=new Scanner(System.in);
    t=sc.nextLong();
    for(j=0;j<=t;j++)
    {
    ali=sc.nextLong();
    bob=sc.nextLong();
    n=sc.nextLong();
    for(i=2;i<=n+1;i++)
    {
        if(i%2==0)
        {
           ali=ali*2;
        }
        else
        {
           bob=bob*2;
        }
    }
    if(ali>bob)
    {
        max=ali;
        min=bob;
    }
    else
    {
        max=bob;
        min=ali;
    }
    res=max/min;
    System.out.println(res);
}

}
}

It is because of overflow.Instead of multiplying every time try to find out the logic.

sir,can you explain type of overflow ?