C++ Bad Alloc ERROR

using try-catch block, I determined that this section of code triggered a bad alloc exception

for(int i = 0;i<n;i++){
            for(int j = 0;i<t.length()-subs[i].length()+1;j++){
                    st cur;
                    cur.type = i+1; 
                    cur.a = j; 
                    cur.b = j+subs[i].length()-1;

For references, here is the full problem I am working on: Problem - 1714D - Codeforces

The sturct st only contains three ints and a bool operator. intervals is a vector of st.

NVM, it is a stupid mistake. In the second for-loop, I used I< instead of j<