WEIRD2- help me out in this code.

//temp array is storing frequency of input numbers. ‘min’ and ‘max’ are minimum and maximum numbers in input //array.


 for(i=min; i<=max ; i++)
        {   
            for(j=min; j<=max ; j++){
                if(j>temp[i]) break;
                a=i; b=j;
                if(b<=temp[a] && a<=temp[b])
                    {
                        count++;
                    }
           }
    THIS is giving AC whereas the code below is giving WA. Can anyone tell me the difference between the 
    two??
     for(i=min; i<=max ; i++)
        {   
            for(j=min; j<=temp[i] ; j++){
                a=i; b=j;
                if(b<=temp[a] && a<=temp[b])
                    {
                        count++;
                    }
           }
    
    
    

@townboy

I tried the one with which you are getting WA, but I received AC on it.

My solution Link

I read your code which you have mentioned above. In that code when I changed array size of temp from max+1 to 1000001, the code gave AC answer

Your solution after modification