SLAB program-Don't know where I am going wrong; Need help

Problem link: https://www.codechef.com/problems/SLAB

My code:

#include <iostream>
using namespace std;

int main() {
	long long int T;
	cin>>T;
	if(T>=1&&T<=1000)
	{
	    while(T--)
	    {
    	   long long income,tax=0,net=0;
    	    cin>>income;
    	    if(income<=250000)
    	    {
    	        net+=income-tax;
    	    }
    	    else if(income>250000&&income<=500000)
    	    {
    	        tax=0.05*(income);
    	        net+=income-tax;
    	    }
    	    else if(income>500000&&income<=750000)
    	    {
    	        tax=0.1*(income);
    	        net+=income-tax-12500;
    	    }
    	    else if(income>750000&&income<=1000000)
    	    {
    	        tax=0.15*income;
    	        net+=income-tax-37500;
    	    }
    	    else if(income>1000000&&income<=1250000)
    	    {
    	        tax=0.2*income;
    	        net+=income-tax-75000;
    	    }
    	    else if(income>1250000&&income<=1500000)
    	    {
    	        tax=0.25*income;
    	        net+=income-tax-125000;
    	    }
    	    else if(income>1500000)
    	    {
    	        tax=0.3*income;
    	        net+=income-tax-187500;
    	    }
    	    
    	    cout<<net<<endl;
	    }   
	}
	return 0;
}

For each interval, you only need to tax the amount of money that lies within it with corresponding tax.
Correct way would be:

			tax += ( (min(500000,n)-250000)*5 )/100;
		if(n>500000)
			tax += ( (min(750000,n)-500000)*10 )/100;
		if(n>750000)
			tax += ( (min(1000000,n)-750000)*15 )/100;
		if(n>1000000)
			tax += ( (min(1250000,n)-1000000)*20 )/100;
		if(n>1250000)
			tax += ( (min(1500000,n)-1250000)*25 )/100;
		if(n>1500000)
			tax += ( (n-1500000)*30 )/100;
		cout<<n-tax<<'\n';

Is this correct tho?

#include <iostream>
using namespace std;
#define slab 250000
int main() {
	long long int T;
	cin>>T;
	if(T>=1&&T<=1000)
	{
	    while(T--)
	    {
    	   long long income,tax=0,net=0;
    	    cin>>income;
    	    if(income<=250000)
    	    {
    	        net+=income-tax;
    	    }
    	    else if(income>250000&&income<=500000)
    	    {
    	        tax=0.05*(250000-income);
    	        net+=income-tax;
    	    }
    	    else if(income>500000&&income<=750000)
    	    {
    	        tax=0.1*(income-500000);
    	        net+=income-tax-0.05*(slab);
    	    }
    	    else if(income>750000&&income<=1000000)
    	    {
    	        tax=0.15*(income-750000);
    	        net+=income-tax-0.05*slab-0.1*slab;
    	    }
    	    else if(income>1000000&&income<=1250000)
    	    {
    	        tax=0.2*(income-1000000);
    	        net+=income-tax-0.05*slab-0.1*slab-0.15*slab;
    	    }
    	    else if(income>1250000&&income<=1500000)
    	    {
    	        tax=0.25*(income-1250000);
    	        net+=income-tax-100000-0.05*slab-0.1*slab-0.15*slab-0.20*slab;
    	    }
    	    else if(income>1500000)
    	    {
    	        tax=0.3*(income-1500000);
    	        net+=income-tax-200000-0.05*slab-0.1*slab-0.15*slab-0.20*slab-0.25*slab;
    	    }
    	    cout<<net<<endl;
	    }   
	}
	return 0;
}

This takes infinitely long time to get even submitted,you know, the circle goes on and on and on…