Few lines code :)


#1
 int Solution::solve(vector<int> &a, vector<int> &b) {
    int l=0,i=0,j=0,tim=0;
    while(a.size()>i){
        int p=a[i]-tim;
        tim+=b[i];
        if(p<0)l++;
        i++;
    }
    return l;
}