Vending Machines

Salve, questo è il mio codice per il problema “Vending Machines”

Ho fatto 50/100 ma non mi trovo ad un problema della sub-categoria 3, nonostante io mi trovi a tutte quante (compresa quella finale, senza limitazioni)

        // insert your code here
        bool hacker = false;
        bool run= true;
        int currency=L[0];
        if(L[0]<0){
                hacker=true;
                run=false;
        }
        if(run){
        for (int i = 1; i < Q; i++) {
            if(L[i]>0){
                currency+=L[i];
            }else{
                int index= (L[i]* -1)-1;
                if((currency-P[index])>=0){
                    currency=currency-P[index];
                }else{
                    hacker=true;
                    i=Q;
                }
            }
            }
        }

ci sono errori?? Grazie mille

Prova con questo input:
1
2 4
0 4
-1 2 4 -2

dovrebbe dare come output OK