• + 0 comments

    //THis code clear all test cases

    static String solve(int d, int k)

    {
    
        long count=0;
    
        for(long i=0;i<Math.sqrt(d);i++)
    
        {
    
            long p=(long)Math.sqrt((long)d-i*i);
    
            if((p*p+i*i)==d)
    
            {
    
                count+=4;
    
            }
    
        }
    
    
        if(k>=count)
    
        {
    
            return "possible";
    
        }
    
        return "impossible";
    
    }