well std::bad_alloc often comes when out of memory.
My guess is that <List1.size() is always true since you add to it for each loop
and hence create an infinite loop.
Did you try VRonin code?
If you just want list1 in  and list2 in
why all the loops then?