Why I am getting wrong answer in DWNLD?

I have tried all the cases of mine, I am having right answer. But on submitting the code it is wrong.
Link to it is here CodeChef: Practical coding for everyone

ok, I don’t know if you have background in other programming language, but from what I have seen in your code, you are doing something like this

int arr[ n ]; //accessable are from 0 to ( n - 1 )
arr[ n ]; //undefined behavior

and I understand why you did what you did. Because it is much easier to work with based 1, but since C++ is a language that is has 0-based array, you need to start from 0 that is, let me give you example for one of the lines in your code and change it to access start from 0

for(int a=1;a<=N;a++){
	cin >> T[a] >> D[a];
}

and above it, you declare T to be sized of N, if it access the index N, it will have undefined behaviour, so, to make it 0-based you can simply do this

for( int a = 0; a < N; ++a )
{
    cin >> T[ a ] >> D[ a ];
}

and do the same for all the loops that treats the array as if it starts at 1. If you still wants to have it starts at one after all my ramblings, you can just simply do this

int arr[ n + 1 ]; //accessible from 0 to n
arr[ n ]; //a defined behaviour
        int pos=0;
        while (k>0)
        {
            if (k>=t[pos])
            {
                k-=t[pos];
                pos++;
            }
            else 
            {
                t[pos]-=k;
                k=0;
            }    
        }

The si or y in your code should be equal to pos in my code. This is the loop you need to make.