If you don't give a vector size, it will be zero.
If it's zero rand()%droup1.size()/2 would be as rand()%0.
Returning % the reminder of a division you will get an error caused by the division by zero.
Group1r does not have a size but is the vector being pushed back at the time. Group1 on the other hand has a size of 12. Cnt was declared earlier in the code as an int.