Runtime error (NZEC) in CHECHOC

I get Runtime Error(NZEC) but it successfully executes for the custom inputs.
Please someone tell me whats the problem! i really can`t understand.
Here is my code:

for i in range(int(input)):
rows,cols,no_of_toffe,tot_sum=[int(rows)for rows in input().split()]
while(no_of_toffe*2>tot_sum):
no_of_toffe=no_of_toffe-1

if no_of_toffe*2==tot_sum:
    tot_toffe=rows*cols*no_of_toffe
    print(tot_toffe)
elif tot_sum%2!=0 and no_of_toffe*2<tot_sum: 
    tot_toffe=rows*cols*no_of_toffe
    rem=(no_of_toffe*2)-tot_sum
    plus_t=no_of_toffe+rem
    if cols%2==0:
        c=cols//2
        
    else:
        c=(cols//2)+1
    remcol=cols-c
    sum_even=(c*plus_t*rows)+(remcol*rows*no_of_toffe)
    print(sum_even)